]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/wincmn.cpp
added wxListCtrl::AssignImageList
[wxWidgets.git] / src / common / wincmn.cpp
index e40b8f23c492bf6204faeebdb9c616a82aa1065b..ef975509eaf419da83520ea8786c799de4568044 100644 (file)
     #include "wx/dnd.h"
 #endif // wxUSE_DRAG_AND_DROP
 
+#if wxUSE_HELP
+    #include "wx/cshelp.h"
+#endif // wxUSE_HELP
+
 #if wxUSE_TOOLTIPS
     #include "wx/tooltip.h"
 #endif // wxUSE_TOOLTIPS
@@ -77,6 +81,11 @@ BEGIN_EVENT_TABLE(wxWindowBase, wxEvtHandler)
     EVT_SYS_COLOUR_CHANGED(wxWindowBase::OnSysColourChanged)
     EVT_INIT_DIALOG(wxWindowBase::OnInitDialog)
     EVT_MIDDLE_DOWN(wxWindowBase::OnMiddleClick)
+
+#if wxUSE_HELP
+    EVT_HELP(-1, wxWindowBase::OnHelp)
+#endif // wxUSE_HELP
+
 END_EVENT_TABLE()
 
 // ============================================================================
@@ -153,6 +162,9 @@ void wxWindowBase::InitBase()
 #if wxUSE_CARET
     m_caret = (wxCaret *)NULL;
 #endif // wxUSE_CARET
+
+    // Whether we're using the current theme for this window (wxGTK only for now)
+    m_themeEnabled = FALSE;
 }
 
 // common part of window creation process
@@ -838,6 +850,64 @@ void wxWindowBase::InitDialog()
     GetEventHandler()->ProcessEvent(event);
 }
 
+// ----------------------------------------------------------------------------
+// context-sensitive help support
+// ----------------------------------------------------------------------------
+
+#if wxUSE_HELP
+
+// associate this help text with this window
+void wxWindowBase::SetHelpText(const wxString& text)
+{
+    wxHelpProvider *helpProvider = wxHelpProvider::Get();
+    if ( helpProvider )
+    {
+        helpProvider->AddHelp(this, text);
+    }
+}
+
+// associate this help text with all windows with the same id as this
+// one
+void wxWindowBase::SetHelpTextForId(const wxString& text)
+{
+    wxHelpProvider *helpProvider = wxHelpProvider::Get();
+    if ( helpProvider )
+    {
+        helpProvider->AddHelp(GetId(), text);
+    }
+}
+
+// get the help string associated with this window (may be empty)
+wxString wxWindowBase::GetHelpText() const
+{
+    wxString text;
+    wxHelpProvider *helpProvider = wxHelpProvider::Get();
+    if ( helpProvider )
+    {
+        text = helpProvider->GetHelp(this);
+    }
+
+    return text;
+}
+
+// show help for this window
+void wxWindowBase::OnHelp(wxHelpEvent& event)
+{
+    wxHelpProvider *helpProvider = wxHelpProvider::Get();
+    if ( helpProvider )
+    {
+        if ( helpProvider->ShowHelp(this) )
+        {
+            // skip the event.Skip() below
+            return;
+        }
+    }
+
+    event.Skip();
+}
+
+#endif // wxUSE_HELP
+
 // ----------------------------------------------------------------------------
 // tooltips
 // ----------------------------------------------------------------------------