+#endif // USE_LOG
+
+#if wxUSE_MENUS
+
+#if wxUSE_TOOLTIPS
+
+void WidgetsFrame::OnSetTooltip(wxCommandEvent& WXUNUSED(event))
+{
+ static wxString s_tip = _T("This is a tooltip");
+
+ wxString s = wxGetTextFromUser
+ (
+ _T("Tooltip text: "),
+ _T("Widgets sample"),
+ s_tip,
+ this
+ );
+
+ if ( s.empty() )
+ return;
+
+ s_tip = s;
+
+ if( wxMessageBox( _T("Test multiline tooltip text?"),
+ _T("Widgets sample"),
+ wxYES_NO,
+ this
+ ) == wxYES )
+ {
+ s = _T("#1 ") + s_tip + _T("\n") + _T("#2 ") + s_tip;
+ }
+
+ WidgetsPage *page = wxStaticCast(m_book->GetCurrentPage(), WidgetsPage);
+ page->GetWidget()->SetToolTip(s);
+
+ wxControl *ctrl2 = page->GetWidget2();
+ if ( ctrl2 )
+ ctrl2->SetToolTip(s);
+}
+
+#endif // wxUSE_TOOLTIPS
+
+void WidgetsFrame::OnSetFgCol(wxCommandEvent& WXUNUSED(event))
+{
+#if wxUSE_COLOURDLG
+ // allow for debugging the default colour the first time this is called
+ WidgetsPage *page = wxStaticCast(m_book->GetCurrentPage(), WidgetsPage);
+ if (!m_colFg.Ok())
+ m_colFg = page->GetForegroundColour();
+
+ wxColour col = wxGetColourFromUser(this, m_colFg);
+ if ( !col.Ok() )
+ return;
+
+ m_colFg = col;
+
+ page->GetWidget()->SetForegroundColour(m_colFg);
+ page->GetWidget()->Refresh();
+
+ wxControl *ctrl2 = page->GetWidget2();
+ if ( ctrl2 )
+ {
+ ctrl2->SetForegroundColour(m_colFg);
+ ctrl2->Refresh();
+ }
+#else
+ wxLogMessage(_T("Colour selection dialog not available in current build."));
+#endif
+}
+
+void WidgetsFrame::OnSetBgCol(wxCommandEvent& WXUNUSED(event))
+{
+#if wxUSE_COLOURDLG
+ WidgetsPage *page = wxStaticCast(m_book->GetCurrentPage(), WidgetsPage);
+ if ( !m_colBg.Ok() )
+ m_colBg = page->GetBackgroundColour();
+
+ wxColour col = wxGetColourFromUser(this, m_colBg);
+ if ( !col.Ok() )
+ return;
+
+ m_colBg = col;
+
+ page->GetWidget()->SetBackgroundColour(m_colBg);
+ page->GetWidget()->Refresh();
+
+ wxControl *ctrl2 = page->GetWidget2();
+ if ( ctrl2 )
+ {
+ ctrl2->SetBackgroundColour(m_colFg);
+ ctrl2->Refresh();
+ }
+#else
+ wxLogMessage(_T("Colour selection dialog not available in current build."));
+#endif
+}
+
+void WidgetsFrame::OnSetFont(wxCommandEvent& WXUNUSED(event))
+{
+#if wxUSE_FONTDLG
+ WidgetsPage *page = wxStaticCast(m_book->GetCurrentPage(), WidgetsPage);
+ if (!m_font.Ok())
+ m_font = page->GetFont();
+
+ wxFont font = wxGetFontFromUser(this, m_font);
+ if ( !font.Ok() )
+ return;
+
+ m_font = font;
+
+ page->GetWidget()->SetFont(m_font);
+ page->GetWidget()->Refresh();
+
+ wxControl *ctrl2 = page->GetWidget2();
+ if ( ctrl2 )
+ {
+ ctrl2->SetFont(m_font);
+ ctrl2->Refresh();
+ }
+#else
+ wxLogMessage(_T("Font selection dialog not available in current build."));
+#endif
+}
+
+void WidgetsFrame::OnEnable(wxCommandEvent& event)
+{
+ WidgetsPage *page = wxStaticCast(m_book->GetCurrentPage(), WidgetsPage);
+ page->GetWidget()->Enable(event.IsChecked());
+}
+
+#endif // wxUSE_MENUS