]> git.saurik.com Git - wxWidgets.git/blobdiff - src/richtext/richtextsymboldlg.cpp
Ensure there is valid context for DrawRectangle
[wxWidgets.git] / src / richtext / richtextsymboldlg.cpp
index 0e20dfe6f4af09ad16ba1497c67cf75baeed14c0..85c07f05924652f58835c11b2a623336bc1f3e4a 100644 (file)
@@ -293,7 +293,6 @@ BEGIN_EVENT_TABLE( wxSymbolPickerDialog, wxDialog )
 
 ////@begin wxSymbolPickerDialog event table entries
     EVT_COMBOBOX( ID_SYMBOLPICKERDIALOG_FONT, wxSymbolPickerDialog::OnFontCtrlSelected )
-
 #if defined(__UNICODE__)
     EVT_COMBOBOX( ID_SYMBOLPICKERDIALOG_SUBSET, wxSymbolPickerDialog::OnSubsetSelected )
     EVT_UPDATE_UI( ID_SYMBOLPICKERDIALOG_SUBSET, wxSymbolPickerDialog::OnSymbolpickerdialogSubsetUpdate )
@@ -304,11 +303,14 @@ BEGIN_EVENT_TABLE( wxSymbolPickerDialog, wxDialog )
 #endif
 
     EVT_UPDATE_UI( wxID_OK, wxSymbolPickerDialog::OnOkUpdate )
-
+    EVT_BUTTON( wxID_HELP, wxSymbolPickerDialog::OnHelpClick )
+    EVT_UPDATE_UI( wxID_HELP, wxSymbolPickerDialog::OnHelpUpdate )
 ////@end wxSymbolPickerDialog event table entries
 
 END_EVENT_TABLE()
 
+IMPLEMENT_HELP_PROVISION(wxSymbolPickerDialog)
+
 /*!
  * wxSymbolPickerDialog constructors
  */
@@ -366,6 +368,7 @@ void wxSymbolPickerDialog::Init()
 #if defined(__UNICODE__)
     m_fromUnicodeCtrl = NULL;
 #endif
+    m_stdButtonSizer = NULL;
 ////@end wxSymbolPickerDialog member initialisation
     m_dontUpdate = false;
 }
@@ -376,6 +379,10 @@ void wxSymbolPickerDialog::Init()
 
 void wxSymbolPickerDialog::CreateControls()
 {
+#ifdef __WXMAC__
+    SetWindowVariant(wxWINDOW_VARIANT_SMALL);
+#endif
+
 ////@begin wxSymbolPickerDialog content construction
     wxSymbolPickerDialog* itemDialog1 = this;
 
@@ -460,25 +467,29 @@ void wxSymbolPickerDialog::CreateControls()
 
 #endif
 
-    wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxHORIZONTAL);
-    itemBoxSizer3->Add(itemBoxSizer20, 0, wxGROW, 5);
-
-    itemBoxSizer20->Add(5, 5, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+    m_stdButtonSizer = new wxStdDialogButtonSizer;
 
-    wxStdDialogButtonSizer* itemStdDialogButtonSizer22 = new wxStdDialogButtonSizer;
+    itemBoxSizer3->Add(m_stdButtonSizer, 0, wxGROW|wxTOP|wxBOTTOM, 5);
+    wxButton* itemButton21 = new wxButton( itemDialog1, wxID_OK, _("Insert"), wxDefaultPosition, wxDefaultSize, 0 );
+    itemButton21->SetDefault();
+    m_stdButtonSizer->AddButton(itemButton21);
 
-    itemBoxSizer20->Add(itemStdDialogButtonSizer22, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
-    wxButton* itemButton23 = new wxButton( itemDialog1, wxID_OK, _("Insert"), wxDefaultPosition, wxDefaultSize, 0 );
-    itemButton23->SetDefault();
-    itemStdDialogButtonSizer22->AddButton(itemButton23);
+    wxButton* itemButton22 = new wxButton( itemDialog1, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
+    m_stdButtonSizer->AddButton(itemButton22);
 
-    wxButton* itemButton24 = new wxButton( itemDialog1, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
-    itemStdDialogButtonSizer22->AddButton(itemButton24);
+    wxButton* itemButton23 = new wxButton( itemDialog1, wxID_HELP, _("&Help"), wxDefaultPosition, wxDefaultSize, 0 );
+    m_stdButtonSizer->AddButton(itemButton23);
 
-    itemStdDialogButtonSizer22->Realize();
+    m_stdButtonSizer->Realize();
 
 ////@end wxSymbolPickerDialog content construction
 
+    if (GetHelpId() == -1)
+    {
+        wxWindow* button = FindWindowById(wxID_HELP);
+        if (button)
+            m_stdButtonSizer->Show(button, false);
+    }
 }
 
 /// Data transfer
@@ -505,12 +516,6 @@ bool wxSymbolPickerDialog::TransferDataToWindow()
             m_fontCtrl->SetSelection(0);
     }
 
-    if (!m_symbol.empty())
-    {
-        int sel = (int) m_symbol[0];
-        m_symbolsCtrl->SetSelection(sel);
-    }
-
 #if defined(__UNICODE__)
     if (m_subsetCtrl->GetCount() == 0)
     {
@@ -528,7 +533,13 @@ bool wxSymbolPickerDialog::TransferDataToWindow()
     m_symbolsCtrl->SetUnicodeMode(m_fromUnicode);
 #endif
 
-    UpdateSymbolDisplay();
+    if (!m_symbol.empty())
+    {
+        int sel = (int) m_symbol[0];
+        m_symbolsCtrl->SetSelection(sel);
+    }
+
+    UpdateSymbolDisplay(true, m_symbol.empty());
 
     m_dontUpdate = false;
 
@@ -1281,4 +1292,24 @@ wxSymbolListCtrl::GetClassDefaultAttributes(wxWindowVariant variant)
     return wxListBox::GetClassDefaultAttributes(variant);
 }
 
-#endif // wxUSE_RICHTEXT
+/*!
+ * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_HELP
+ */
+
+void wxSymbolPickerDialog::OnHelpClick( wxCommandEvent& WXUNUSED(event) )
+{
+    if ((GetHelpInfo().GetHelpId() != -1) && GetHelpInfo().GetUICustomization())
+        ShowHelp(this);
+}
+
+/*!
+ * wxEVT_UPDATE_UI event handler for wxID_HELP
+ */
+
+void wxSymbolPickerDialog::OnHelpUpdate( wxUpdateUIEvent& event )
+{
+    event.Enable((GetHelpInfo().GetHelpId() != -1) && GetHelpInfo().GetUICustomization());
+}
+
+#endif
+    // wxUSE_RICHTEXT