// Author: Julian Smart
// Modified by:
// Created: 10/5/2006 3:11:58 PM
-// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
////@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 )
#endif
#if defined(__UNICODE__)
EVT_COMBOBOX( ID_SYMBOLPICKERDIALOG_FROM, wxSymbolPickerDialog::OnFromUnicodeSelected )
#endif
-#if defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXPM__) || defined(__WXMGL__) || defined(__WXMOTIF__) || defined(__WXCOCOA__) || defined(__WXX11__) || defined(__WXPALMOS__)
- EVT_UPDATE_UI( wxID_OK, wxSymbolPickerDialog::OnOkUpdate )
-#endif
-
-#if defined(__WXMAC__)
EVT_UPDATE_UI( wxID_OK, wxSymbolPickerDialog::OnOkUpdate )
-#endif
-
+ 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
*/
#if defined(__UNICODE__)
m_fromUnicodeCtrl = NULL;
#endif
+ m_stdButtonSizer = NULL;
////@end wxSymbolPickerDialog member initialisation
m_dontUpdate = false;
}
void wxSymbolPickerDialog::CreateControls()
{
+#ifdef __WXMAC__
+ SetWindowVariant(wxWINDOW_VARIANT_SMALL);
+#endif
+
////@begin wxSymbolPickerDialog content construction
wxSymbolPickerDialog* itemDialog1 = this;
itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxArrayString m_fontCtrlStrings;
- m_fontCtrl = new wxComboBox( itemDialog1, ID_SYMBOLPICKERDIALOG_FONT, _T(""), wxDefaultPosition, wxSize(240, -1), m_fontCtrlStrings, wxCB_READONLY );
+ m_fontCtrl = new wxComboBox( itemDialog1, ID_SYMBOLPICKERDIALOG_FONT, wxEmptyString, wxDefaultPosition, wxSize(240, -1), m_fontCtrlStrings, wxCB_READONLY );
m_fontCtrl->SetHelpText(_("The font from which to take the symbol."));
if (wxSymbolPickerDialog::ShowToolTips())
m_fontCtrl->SetToolTip(_("The font from which to take the symbol."));
#if defined(__UNICODE__)
wxArrayString m_subsetCtrlStrings;
- m_subsetCtrl = new wxComboBox( itemDialog1, ID_SYMBOLPICKERDIALOG_SUBSET, _T(""), wxDefaultPosition, wxDefaultSize, m_subsetCtrlStrings, wxCB_READONLY );
+ m_subsetCtrl = new wxComboBox( itemDialog1, ID_SYMBOLPICKERDIALOG_SUBSET, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_subsetCtrlStrings, wxCB_READONLY );
m_subsetCtrl->SetHelpText(_("Shows a Unicode subset."));
if (wxSymbolPickerDialog::ShowToolTips())
m_subsetCtrl->SetToolTip(_("Shows a Unicode subset."));
wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _("&Character code:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer12->Add(itemStaticText15, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
- m_characterCodeCtrl = new wxTextCtrl( itemDialog1, ID_SYMBOLPICKERDIALOG_CHARACTERCODE, _T(""), wxDefaultPosition, wxSize(140, -1), wxTE_READONLY|wxTE_CENTRE );
+ m_characterCodeCtrl = new wxTextCtrl( itemDialog1, ID_SYMBOLPICKERDIALOG_CHARACTERCODE, wxEmptyString, wxDefaultPosition, wxSize(140, -1), wxTE_READONLY|wxTE_CENTRE );
m_characterCodeCtrl->SetHelpText(_("The character code."));
if (wxSymbolPickerDialog::ShowToolTips())
m_characterCodeCtrl->SetToolTip(_("The character code."));
wxArrayString m_fromUnicodeCtrlStrings;
m_fromUnicodeCtrlStrings.Add(_("ASCII"));
m_fromUnicodeCtrlStrings.Add(_("Unicode"));
- m_fromUnicodeCtrl = new wxComboBox( itemDialog1, ID_SYMBOLPICKERDIALOG_FROM, _("ASCII"), wxDefaultPosition, wxDefaultSize, m_fromUnicodeCtrlStrings, wxCB_READONLY );
- m_fromUnicodeCtrl->SetStringSelection(_("ASCII"));
+ m_fromUnicodeCtrl = new wxComboBox( itemDialog1, ID_SYMBOLPICKERDIALOG_FROM, _("Unicode"), wxDefaultPosition, wxDefaultSize, m_fromUnicodeCtrlStrings, wxCB_READONLY );
+ m_fromUnicodeCtrl->SetStringSelection(_("Unicode"));
m_fromUnicodeCtrl->SetHelpText(_("The range to show."));
if (wxSymbolPickerDialog::ShowToolTips())
m_fromUnicodeCtrl->SetToolTip(_("The range to show."));
#endif
-#if defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXPM__) || defined(__WXMGL__) || defined(__WXMOTIF__) || defined(__WXCOCOA__) || defined(__WXX11__) || defined(__WXPALMOS__)
- wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxHORIZONTAL);
- itemBoxSizer3->Add(itemBoxSizer20, 0, wxGROW, 5);
-
- itemBoxSizer20->Add(5, 5, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
-
- wxButton* itemButton22 = new wxButton( itemDialog1, wxID_OK, _("Insert"), wxDefaultPosition, wxDefaultSize, 0 );
- itemButton22->SetDefault();
- itemButton22->SetHelpText(_("Inserts the chosen symbol."));
- if (wxSymbolPickerDialog::ShowToolTips())
- itemButton22->SetToolTip(_("Inserts the chosen symbol."));
- itemBoxSizer20->Add(itemButton22, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
-
- wxButton* itemButton23 = new wxButton( itemDialog1, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
- itemButton23->SetHelpText(_("Closes the dialog without inserting a symbol."));
- if (wxSymbolPickerDialog::ShowToolTips())
- itemButton23->SetToolTip(_("Closes the dialog without inserting a symbol."));
- itemBoxSizer20->Add(itemButton23, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
-
-#endif
-
-#if defined(__WXMAC__)
- wxBoxSizer* itemBoxSizer24 = new wxBoxSizer(wxHORIZONTAL);
- itemBoxSizer3->Add(itemBoxSizer24, 0, wxGROW, 5);
+ m_stdButtonSizer = new wxStdDialogButtonSizer;
- itemBoxSizer24->Add(5, 5, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+ 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);
- wxButton* itemButton26 = new wxButton( itemDialog1, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
- itemButton26->SetHelpText(_("Closes the dialog without inserting a symbol."));
- if (wxSymbolPickerDialog::ShowToolTips())
- itemButton26->SetToolTip(_("Closes the dialog without inserting a symbol."));
- itemBoxSizer24->Add(itemButton26, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+ wxButton* itemButton22 = new wxButton( itemDialog1, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_stdButtonSizer->AddButton(itemButton22);
- wxButton* itemButton27 = new wxButton( itemDialog1, wxID_OK, _("Insert"), wxDefaultPosition, wxDefaultSize, 0 );
- itemButton27->SetDefault();
- itemButton27->SetHelpText(_("Inserts the chosen symbol."));
- if (wxSymbolPickerDialog::ShowToolTips())
- itemButton27->SetToolTip(_("Inserts the chosen symbol."));
- itemBoxSizer24->Add(itemButton27, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+ wxButton* itemButton23 = new wxButton( itemDialog1, wxID_HELP, _("&Help"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_stdButtonSizer->AddButton(itemButton23);
-#endif
+ m_stdButtonSizer->Realize();
////@end wxSymbolPickerDialog content construction
+ if (GetHelpId() == -1)
+ {
+ wxWindow* button = FindWindowById(wxID_HELP);
+ if (button)
+ m_stdButtonSizer->Show(button, false);
+ }
}
/// Data transfer
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)
{
// Insert items into subset combo
int i;
- for (i = 0; i < (int) (sizeof(g_UnicodeSubsetTable)/sizeof(g_UnicodeSubsetTable[0])); i++)
+ for (i = 0; i < (int) WXSIZEOF(g_UnicodeSubsetTable); i++)
{
m_subsetCtrl->Append(g_UnicodeSubsetTable[i].m_name);
}
}
#endif
- UpdateSymbolDisplay();
+#if defined(__UNICODE__)
+ m_symbolsCtrl->SetUnicodeMode(m_fromUnicode);
+#endif
+
+ if (!m_symbol.empty())
+ {
+ int sel = (int) m_symbol[0];
+ m_symbolsCtrl->SetSelection(sel);
+ }
+
+ UpdateSymbolDisplay(true, m_symbol.empty());
m_dontUpdate = false;
{
// Need to make the subset selection reflect the current symbol
int i;
- for (i = 0; i < (int) (sizeof(g_UnicodeSubsetTable)/sizeof(g_UnicodeSubsetTable[0])); i++)
+ for (i = 0; i < (int) WXSIZEOF(g_UnicodeSubsetTable); i++)
{
if (sel >= g_UnicodeSubsetTable[i].m_low && sel <= g_UnicodeSubsetTable[i].m_high)
{
}
#endif
+#if defined(__UNICODE__)
+
+/*!
+ * wxEVT_UPDATE_UI event handler for ID_SYMBOLPICKERDIALOG_SUBSET
+ */
+
+void wxSymbolPickerDialog::OnSymbolpickerdialogSubsetUpdate( wxUpdateUIEvent& event )
+{
+ event.Enable(m_fromUnicode);
+}
+#endif
+
/*!
* wxEVT_UPDATE_UI event handler for wxID_OK
*/
SetupCtrl();
+ SetInitialSize(size);
+
return true;
}
{
wxASSERT_MSG( current == wxNOT_FOUND ||
(current >= m_minSymbolValue && current <= m_maxSymbolValue),
- _T("wxSymbolListCtrl::DoSetCurrent(): invalid symbol value") );
+ wxT("wxSymbolListCtrl::DoSetCurrent(): invalid symbol value") );
if ( current == m_current )
{
void wxSymbolListCtrl::SendSelectedEvent()
{
- wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, GetId());
+ wxCommandEvent event(wxEVT_LISTBOX, GetId());
event.SetEventObject(this);
event.SetInt(m_current);
{
wxCHECK_RET( selection == wxNOT_FOUND ||
(selection >= m_minSymbolValue && selection < m_maxSymbolValue),
- _T("wxSymbolListCtrl::SetSelection(): invalid symbol value") );
+ wxT("wxSymbolListCtrl::SetSelection(): invalid symbol value") );
DoSetCurrent(selection);
}
dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)));
dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
- dc.SetBackgroundMode(wxTRANSPARENT);
+ dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);
// iterate over all visible lines
const size_t lineMax = GetVisibleEnd();
// this event as a left-click instead
if ( item == m_current )
{
- wxCommandEvent event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, GetId());
+ wxCommandEvent event(wxEVT_LISTBOX_DCLICK, GetId());
event.SetEventObject(this);
event.SetInt(item);
return wxListBox::GetClassDefaultAttributes(variant);
}
-#endif // wxUSE_RICHTEXT
+/*!
+ * wxEVT_BUTTON 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