ODComboboxWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
virtual wxControl *GetWidget() const { return m_combobox; }
+ virtual wxTextEntryBase *GetTextEntry() const
+ { return m_combobox ? m_combobox->GetTextCtrl() : NULL; }
virtual wxItemContainer* GetContainer() const { return m_combobox; }
virtual void RecreateWidget() { CreateCombo(); }
void OnButtonAddMany(wxCommandEvent& event);
void OnComboBox(wxCommandEvent& event);
+ void OnDropDown(wxCommandEvent& event);
+ void OnCloseUp(wxCommandEvent& event);
void OnComboText(wxCommandEvent& event);
void OnCheckOrRadioBox(wxCommandEvent& event);
EVT_UPDATE_UI(ODComboPage_ChangeText, ODComboboxWidgetsPage::OnUpdateUIDeleteSelButton)
EVT_UPDATE_UI(ODComboPage_DeleteSel, ODComboboxWidgetsPage::OnUpdateUIDeleteSelButton)
+ EVT_COMBOBOX_DROPDOWN(ODComboPage_Combo, ODComboboxWidgetsPage::OnDropDown)
+ EVT_COMBOBOX_CLOSEUP(ODComboPage_Combo, ODComboboxWidgetsPage::OnCloseUp)
EVT_COMBOBOX(ODComboPage_Combo, ODComboboxWidgetsPage::OnComboBox)
EVT_TEXT(ODComboPage_Combo, ODComboboxWidgetsPage::OnComboText)
EVT_TEXT_ENTER(ODComboPage_Combo, ODComboboxWidgetsPage::OnComboText)
};
-IMPLEMENT_WIDGETS_PAGE(ODComboboxWidgetsPage, _T("OwnerDrawnCombobox"),
+IMPLEMENT_WIDGETS_PAGE(ODComboboxWidgetsPage, wxT("OwnerDrawnCombobox"),
GENERIC_CTRLS | WITH_ITEMS_CTRLS | COMBO_CTRLS
);
wxSizer *sizerLeft = new wxBoxSizer(wxVERTICAL);
// left pane - style box
- wxStaticBox *box = new wxStaticBox(this, wxID_ANY, _T("&Set style"));
+ wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("&Set style"));
wxSizer *sizerStyle = new wxStaticBoxSizer(box, wxVERTICAL);
- m_chkSort = CreateCheckBoxAndAddToSizer(sizerStyle, _T("&Sort items"));
- m_chkReadonly = CreateCheckBoxAndAddToSizer(sizerStyle, _T("&Read only"));
- m_chkDclickcycles = CreateCheckBoxAndAddToSizer(sizerStyle, _T("&Double-click Cycles"));
+ m_chkSort = CreateCheckBoxAndAddToSizer(sizerStyle, wxT("&Sort items"));
+ m_chkReadonly = CreateCheckBoxAndAddToSizer(sizerStyle, wxT("&Read only"));
+ m_chkDclickcycles = CreateCheckBoxAndAddToSizer(sizerStyle, wxT("&Double-click Cycles"));
sizerStyle->AddSpacer(4);
- m_chkBitmapbutton = CreateCheckBoxAndAddToSizer(sizerStyle, _T("&Bitmap button"));
- m_chkStdbutton = CreateCheckBoxAndAddToSizer(sizerStyle, _T("B&lank button background"));
+ m_chkBitmapbutton = CreateCheckBoxAndAddToSizer(sizerStyle, wxT("&Bitmap button"));
+ m_chkStdbutton = CreateCheckBoxAndAddToSizer(sizerStyle, wxT("B&lank button background"));
- wxButton *btn = new wxButton(this, ODComboPage_Reset, _T("&Reset"));
+ wxButton *btn = new wxButton(this, ODComboPage_Reset, wxT("&Reset"));
sizerStyle->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 3);
sizerLeft->Add(sizerStyle, 0, wxGROW | wxALIGN_CENTRE_HORIZONTAL);
// left pane - popup adjustment box
- box = new wxStaticBox(this, wxID_ANY, _T("Adjust &popup"));
+ box = new wxStaticBox(this, wxID_ANY, wxT("Adjust &popup"));
wxSizer *sizerPopupPos = new wxStaticBoxSizer(box, wxVERTICAL);
- sizerRow = CreateSizerWithTextAndLabel(_T("Min. Width:"),
+ sizerRow = CreateSizerWithTextAndLabel(wxT("Min. Width:"),
ODComboPage_PopupMinWidth,
&m_textPopupMinWidth);
m_textPopupMinWidth->SetValue(wxT("-1"));
sizerPopupPos->Add(sizerRow, 0, wxALL | wxGROW, 5);
- sizerRow = CreateSizerWithTextAndLabel(_T("Max. Height:"),
+ sizerRow = CreateSizerWithTextAndLabel(wxT("Max. Height:"),
ODComboPage_PopupHeight,
&m_textPopupHeight);
m_textPopupHeight->SetValue(wxT("-1"));
sizerPopupPos->Add(sizerRow, 0, wxALL | wxGROW, 5);
- m_chkAlignpopupright = CreateCheckBoxAndAddToSizer(sizerPopupPos, _T("Align Right"));
+ m_chkAlignpopupright = CreateCheckBoxAndAddToSizer(sizerPopupPos, wxT("Align Right"));
sizerLeft->Add(sizerPopupPos, 0, wxGROW | wxALIGN_CENTRE_HORIZONTAL | wxTOP, 2);
// left pane - button adjustment box
- box = new wxStaticBox(this, wxID_ANY, _T("Adjust &button"));
+ box = new wxStaticBox(this, wxID_ANY, wxT("Adjust &button"));
wxSizer *sizerButtonPos = new wxStaticBoxSizer(box, wxVERTICAL);
- sizerRow = CreateSizerWithTextAndLabel(_T("Width:"),
+ sizerRow = CreateSizerWithTextAndLabel(wxT("Width:"),
ODComboPage_ButtonWidth,
&m_textButtonWidth);
m_textButtonWidth->SetValue(wxT("-1"));
sizerButtonPos->Add(sizerRow, 0, wxALL | wxGROW, 5);
- sizerRow = CreateSizerWithTextAndLabel(_T("VSpacing:"),
+ sizerRow = CreateSizerWithTextAndLabel(wxT("VSpacing:"),
ODComboPage_ButtonSpacing,
&m_textButtonSpacing);
m_textButtonSpacing->SetValue(wxT("0"));
sizerButtonPos->Add(sizerRow, 0, wxALL | wxGROW, 5);
- sizerRow = CreateSizerWithTextAndLabel(_T("Height:"),
+ sizerRow = CreateSizerWithTextAndLabel(wxT("Height:"),
ODComboPage_ButtonHeight,
&m_textButtonHeight);
m_textButtonHeight->SetValue(wxT("-1"));
sizerButtonPos->Add(sizerRow, 0, wxALL | wxGROW, 5);
- m_chkAlignbutleft = CreateCheckBoxAndAddToSizer(sizerButtonPos, _T("Align Left"));
+ m_chkAlignbutleft = CreateCheckBoxAndAddToSizer(sizerButtonPos, wxT("Align Left"));
sizerLeft->Add(sizerButtonPos, 0, wxGROW | wxALIGN_CENTRE_HORIZONTAL | wxTOP, 2);
// middle pane
wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY,
- _T("&Change combobox contents"));
+ wxT("&Change combobox contents"));
wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
- btn = new wxButton(this, ODComboPage_ContainerTests, _T("Run &tests"));
+ btn = new wxButton(this, ODComboPage_ContainerTests, wxT("Run &tests"));
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
- sizerRow = CreateSizerWithTextAndLabel(_T("Current selection"),
+ sizerRow = CreateSizerWithTextAndLabel(wxT("Current selection"),
ODComboPage_CurText,
&text);
text->SetEditable(false);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
- sizerRow = CreateSizerWithTextAndLabel(_T("Insertion Point"),
+ sizerRow = CreateSizerWithTextAndLabel(wxT("Insertion Point"),
ODComboPage_InsertionPointText,
&text);
text->SetEditable(false);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(ODComboPage_Insert,
- _T("&Insert this string"),
+ wxT("&Insert this string"),
ODComboPage_InsertText,
&m_textInsert);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(ODComboPage_Add,
- _T("&Add this string"),
+ wxT("&Add this string"),
ODComboPage_AddText,
&m_textAdd);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
- btn = new wxButton(this, ODComboPage_AddSeveral, _T("&Append a few strings"));
+ btn = new wxButton(this, ODComboPage_AddSeveral, wxT("&Append a few strings"));
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
- btn = new wxButton(this, ODComboPage_AddMany, _T("Append &many strings"));
+ btn = new wxButton(this, ODComboPage_AddMany, wxT("Append &many strings"));
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(ODComboPage_Change,
- _T("C&hange current"),
+ wxT("C&hange current"),
ODComboPage_ChangeText,
&m_textChange);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(ODComboPage_Delete,
- _T("&Delete this item"),
+ wxT("&Delete this item"),
ODComboPage_DeleteText,
&m_textDelete);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
- btn = new wxButton(this, ODComboPage_DeleteSel, _T("Delete &selection"));
+ btn = new wxButton(this, ODComboPage_DeleteSel, wxT("Delete &selection"));
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
- btn = new wxButton(this, ODComboPage_Clear, _T("&Clear"));
+ btn = new wxButton(this, ODComboPage_Clear, wxT("&Clear"));
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
// right pane
#ifndef __WXGTK__
m_combobox->SetString(sel, m_textChange->GetValue());
#else
- wxLogMessage(_T("Not implemented in wxGTK"));
+ wxLogMessage(wxT("Not implemented in wxGTK"));
#endif
}
}
if ( !m_textInsert->IsModified() )
{
// update the default string
- m_textInsert->SetValue(wxString::Format(_T("test item %u"), ++s_item));
+ m_textInsert->SetValue(wxString::Format(wxT("test item %u"), ++s_item));
}
if (m_combobox->GetSelection() >= 0)
if ( !m_textAdd->IsModified() )
{
// update the default string
- m_textAdd->SetValue(wxString::Format(_T("test item %u"), ++s_item));
+ m_textAdd->SetValue(wxString::Format(wxT("test item %u"), ++s_item));
}
m_combobox->Append(s);
// "many" means 1000 here
for ( unsigned int n = 0; n < 1000; n++ )
{
- m_combobox->Append(wxString::Format(_T("item #%u"), n));
+ m_combobox->Append(wxString::Format(wxT("item #%u"), n));
}
}
void ODComboboxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event))
{
- m_combobox->Append(_T("First"));
- m_combobox->Append(_T("another one"));
- m_combobox->Append(_T("and the last (very very very very very very very very very very long) one"));
+ m_combobox->Append(wxT("First"));
+ m_combobox->Append(wxT("another one"));
+ m_combobox->Append(wxT("and the last (very very very very very very very very very very long) one"));
}
void ODComboboxWidgetsPage::OnTextPopupWidth(wxCommandEvent& WXUNUSED(event))
void ODComboboxWidgetsPage::OnUpdateUICurText(wxUpdateUIEvent& event)
{
if (m_combobox)
- event.SetText( wxString::Format(_T("%d"), m_combobox->GetSelection()) );
+ event.SetText( wxString::Format(wxT("%d"), m_combobox->GetSelection()) );
}
void ODComboboxWidgetsPage::OnUpdateUIInsertionPointText(wxUpdateUIEvent& event)
{
if (m_combobox)
- event.SetText( wxString::Format(_T("%ld"), m_combobox->GetInsertionPoint()) );
+ event.SetText( wxString::Format(wxT("%ld"), m_combobox->GetInsertionPoint()) );
}
void ODComboboxWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
wxString s = event.GetString();
wxASSERT_MSG( s == m_combobox->GetValue(),
- _T("event and combobox values should be the same") );
+ wxT("event and combobox values should be the same") );
if (event.GetEventType() == wxEVT_COMMAND_TEXT_ENTER)
- wxLogMessage(_T("OwnerDrawnCombobox enter pressed (now '%s')"), s.c_str());
+ {
+ wxLogMessage(wxT("OwnerDrawnCombobox enter pressed (now '%s')"), s.c_str());
+ }
else
- wxLogMessage(_T("OwnerDrawnCombobox text changed (now '%s')"), s.c_str());
+ {
+ wxLogMessage(wxT("OwnerDrawnCombobox text changed (now '%s')"), s.c_str());
+ }
}
void ODComboboxWidgetsPage::OnComboBox(wxCommandEvent& event)
{
long sel = event.GetInt();
- m_textDelete->SetValue(wxString::Format(_T("%ld"), sel));
+ m_textDelete->SetValue(wxString::Format(wxT("%ld"), sel));
- wxLogMessage(_T("OwnerDrawnCombobox item %ld selected"), sel);
+ wxLogMessage(wxT("OwnerDrawnCombobox item %ld selected"), sel);
- wxLogMessage(_T("OwnerDrawnCombobox GetValue(): %s"), m_combobox->GetValue().c_str() );
+ wxLogMessage(wxT("OwnerDrawnCombobox GetValue(): %s"), m_combobox->GetValue().c_str() );
}
void ODComboboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event)
return bmp;
}
+void ODComboboxWidgetsPage::OnDropDown(wxCommandEvent& WXUNUSED(event))
+{
+ wxLogMessage(wxT("Combobox dropped down"));
+}
+
+void ODComboboxWidgetsPage::OnCloseUp(wxCommandEvent& WXUNUSED(event))
+{
+ wxLogMessage(wxT("Combobox closed up"));
+}
+
#endif //wxUSE_ODCOMBOBOX