]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/wincmn.cpp
added automatic growing of in-place wxTextCtrls for generic wxListCtrl and wxTreeCtrl
[wxWidgets.git] / src / common / wincmn.cpp
index e40b8f23c492bf6204faeebdb9c616a82aa1065b..b95dde4a4b46a68f4bb4780e5b774bd01d9dfe04 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
@@ -409,7 +421,7 @@ wxSize wxWindowBase::DoGetBestSize() const
               node = node->GetNext() )
         {
             wxWindow *win = node->GetData();
-            if ( win->IsTopLevel() || wxDynamicCast(win, wxStatusBar) )
+            if ( win->IsTopLevel() || wxDynamicCast(win, wxStatusBar) || !win->IsShown())
             {
                 // dialogs and frames lie in different top level windows -
                 // don't deal with them here; as for the status bars, they
@@ -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
 // ----------------------------------------------------------------------------