- Fix stock labels when not using mnemonics for Chinese (cw.ahbong).
- Added wxComboBox::IsListEmpty() and IsTextEmpty().
- Added wxDataViewCtrl::GetSelectedItemsCount() and HasSelection().
+- Added wxFLP_SMALL and wxDIRP_SMALL styles.
OSX:
#define wxFLP_OVERWRITE_PROMPT 0x1000
#define wxFLP_FILE_MUST_EXIST 0x2000
#define wxFLP_CHANGE_DIR 0x4000
+#define wxFLP_SMALL wxPB_SMALL
// NOTE: wxMULTIPLE is not supported !
#define wxDIRP_DIR_MUST_EXIST 0x0008
#define wxDIRP_CHANGE_DIR 0x0010
+#define wxDIRP_SMALL wxPB_SMALL
// map platform-dependent controls which implement the wxFileDirPickerWidgetBase
// extracts the style for our picker from wxFileDirPickerCtrlBase's style
long GetPickerStyle(long style) const
{
- return (style & (wxFLP_OPEN|wxFLP_SAVE|wxFLP_OVERWRITE_PROMPT|
- wxFLP_FILE_MUST_EXIST|wxFLP_CHANGE_DIR|wxFLP_USE_TEXTCTRL));
+ return style & (wxFLP_OPEN |
+ wxFLP_SAVE |
+ wxFLP_OVERWRITE_PROMPT |
+ wxFLP_FILE_MUST_EXIST |
+ wxFLP_CHANGE_DIR |
+ wxFLP_USE_TEXTCTRL |
+ wxFLP_SMALL);
}
private:
// extracts the style for our picker from wxFileDirPickerCtrlBase's style
long GetPickerStyle(long style) const
- { return (style & (wxDIRP_DIR_MUST_EXIST|wxDIRP_CHANGE_DIR|wxDIRP_USE_TEXTCTRL)); }
+ {
+ return style & (wxDIRP_DIR_MUST_EXIST |
+ wxDIRP_CHANGE_DIR |
+ wxDIRP_USE_TEXTCTRL |
+ wxDIRP_SMALL);
+ }
private:
DECLARE_DYNAMIC_CLASS(wxDirPickerCtrl)
// ----------------------------------------------------------------------------
#define wxPB_USE_TEXTCTRL 0x0002
+#define wxPB_SMALL 0x8000
class WXDLLIMPEXP_CORE wxPickerBase : public wxNavigationEnabled<wxControl>
{
existing file.
@style{wxFLP_CHANGE_DIR}
Change current working directory on each user file selection change.
+ @style{wxFLP_SMALL}
+ Use smaller version of the control with a small "..." button instead
+ of the normal "Browse" one. This flag is new since wxWidgets 2.9.3.
@endStyleTable
support its absence.
@style{wxDIRP_CHANGE_DIR}
Change current working directory on each user directory selection change.
+ @style{wxDIRP_SMALL}
+ Use smaller version of the control with a small "..." button instead
+ of the normal "Browse" one. This flag is new since wxWidgets 2.9.3.
@endStyleTable
@beginEventEmissionTable{wxFileDirPickerEvent}
wxCheckBox *m_chkDirTextCtrl,
*m_chkDirChangeDir,
- *m_chkDirMustExist;
+ *m_chkDirMustExist,
+ *m_chkSmall;
wxBoxSizer *m_sizer;
private:
m_chkDirTextCtrl = CreateCheckBoxAndAddToSizer(dirbox, wxT("With textctrl"), false);
m_chkDirMustExist = CreateCheckBoxAndAddToSizer(dirbox, wxT("Dir must exist"), false);
m_chkDirChangeDir = CreateCheckBoxAndAddToSizer(dirbox, wxT("Change working dir"), false);
+ m_chkSmall = CreateCheckBoxAndAddToSizer(dirbox, "&Small version", false);
boxleft->Add(dirbox, 0, wxALL|wxGROW, 5);
boxleft->Add(new wxButton(this, PickerPage_Reset, wxT("&Reset")),
if ( m_chkDirChangeDir->GetValue() )
style |= wxDIRP_CHANGE_DIR;
+ if ( m_chkSmall->GetValue() )
+ style |= wxDIRP_SMALL;
+
return style;
}
m_chkDirTextCtrl->SetValue((wxDIRP_DEFAULT_STYLE & wxDIRP_USE_TEXTCTRL) != 0);
m_chkDirMustExist->SetValue((wxDIRP_DEFAULT_STYLE & wxDIRP_DIR_MUST_EXIST) != 0);
m_chkDirChangeDir->SetValue((wxDIRP_DEFAULT_STYLE & wxDIRP_CHANGE_DIR) != 0);
+ m_chkSmall->SetValue((wxFLP_DEFAULT_STYLE & wxDIRP_SMALL) != 0);
}
{
if (event.GetEventObject() == m_chkDirTextCtrl ||
event.GetEventObject() == m_chkDirChangeDir ||
- event.GetEventObject() == m_chkDirMustExist)
+ event.GetEventObject() == m_chkDirMustExist ||
+ event.GetEventObject() == m_chkSmall)
RecreatePicker();
}
wxCheckBox *m_chkFileTextCtrl,
*m_chkFileOverwritePrompt,
*m_chkFileMustExist,
- *m_chkFileChangeDir;
+ *m_chkFileChangeDir,
+ *m_chkSmall;
wxRadioBox *m_radioFilePickerMode;
wxBoxSizer *m_sizer;
m_chkFileOverwritePrompt = CreateCheckBoxAndAddToSizer(filebox, wxT("Overwrite prompt"), false);
m_chkFileMustExist = CreateCheckBoxAndAddToSizer(filebox, wxT("File must exist"), false);
m_chkFileChangeDir = CreateCheckBoxAndAddToSizer(filebox, wxT("Change working dir"), false);
+ m_chkSmall = CreateCheckBoxAndAddToSizer(filebox, "&Small version", false);
+
boxleft->Add(filebox, 0, wxALL|wxGROW, 5);
boxleft->Add(new wxButton(this, PickerPage_Reset, wxT("&Reset")),
if ( m_chkFileChangeDir->GetValue() )
style |= wxFLP_CHANGE_DIR;
+ if ( m_chkSmall->GetValue() )
+ style |= wxFLP_SMALL;
+
if (m_radioFilePickerMode->GetSelection() == FilePickerMode_Open)
style |= wxFLP_OPEN;
else
m_chkFileOverwritePrompt->SetValue((wxFLP_DEFAULT_STYLE & wxFLP_OVERWRITE_PROMPT) != 0);
m_chkFileMustExist->SetValue((wxFLP_DEFAULT_STYLE & wxFLP_FILE_MUST_EXIST) != 0);
m_chkFileChangeDir->SetValue((wxFLP_DEFAULT_STYLE & wxFLP_CHANGE_DIR) != 0);
+ m_chkSmall->SetValue((wxFLP_DEFAULT_STYLE & wxFLP_SMALL) != 0);
UpdateFilePickerMode();
}
if (event.GetEventObject() == m_chkFileTextCtrl ||
event.GetEventObject() == m_chkFileOverwritePrompt ||
event.GetEventObject() == m_chkFileMustExist ||
- event.GetEventObject() == m_chkFileChangeDir)
+ event.GetEventObject() == m_chkFileChangeDir ||
+ event.GetEventObject() == m_chkSmall)
RecreatePicker();
if (event.GetEventObject() == m_radioFilePickerMode)
m_sizer->Add(m_picker, HasTextCtrl() ? 0 : 1, GetDefaultPickerCtrlFlag(), 5);
// For aesthetic reasons, make sure the picker is at least as high as the
- // associated text control and is always at least square.
- const wxSize pickerBestSize(m_picker->GetBestSize());
- const wxSize textBestSize( HasTextCtrl() ? m_text->GetBestSize() : wxSize());
- wxSize pickerMinSize;
- pickerMinSize.y = wxMax(pickerBestSize.y, textBestSize.y);
- pickerMinSize.x = wxMax(pickerBestSize.x, pickerMinSize.y);
- if ( pickerMinSize != pickerBestSize )
- m_picker->SetMinSize(pickerMinSize);
+ // associated text control and is always at least square, unless we are
+ // explicitly using wxPB_SMALL style to force it to take as little space as
+ // possible.
+ if ( !HasFlag(wxPB_SMALL) )
+ {
+ const wxSize pickerBestSize(m_picker->GetBestSize());
+ const wxSize textBestSize( HasTextCtrl() ? m_text->GetBestSize() : wxSize());
+ wxSize pickerMinSize;
+ pickerMinSize.y = wxMax(pickerBestSize.y, textBestSize.y);
+ pickerMinSize.x = wxMax(pickerBestSize.x, pickerMinSize.y);
+ if ( pickerMinSize != pickerBestSize )
+ m_picker->SetMinSize(pickerMinSize);
+ }
SetSizer(m_sizer);
{
m_pickerStyle = style;
+ // If the special wxPB_SMALL flag is used, ignore the provided label and
+ // use the shortest possible label and the smallest possible button fitting
+ // it.
+ long styleButton = 0;
+ wxString labelButton;
+ if ( m_pickerStyle & wxPB_SMALL )
+ {
+ labelButton = _("...");
+ styleButton = wxBU_EXACTFIT;
+ }
+ else
+ {
+ labelButton = label;
+ }
+
// create this button
- if ( !wxButton::Create(parent, id, label, pos, size, 0, validator, name) )
+ if ( !wxButton::Create(parent, id, labelButton,
+ pos, size, styleButton, validator, name) )
{
wxFAIL_MSG( wxT("wxGenericFileButton creation failed") );
return false;
XRC_ADD_STYLE(wxDIRP_USE_TEXTCTRL);
XRC_ADD_STYLE(wxDIRP_DIR_MUST_EXIST);
XRC_ADD_STYLE(wxDIRP_CHANGE_DIR);
+ XRC_ADD_STYLE(wxDIRP_SMALL);
XRC_ADD_STYLE(wxDIRP_DEFAULT_STYLE);
AddWindowStyles();
}
XRC_ADD_STYLE(wxFLP_OVERWRITE_PROMPT);
XRC_ADD_STYLE(wxFLP_FILE_MUST_EXIST);
XRC_ADD_STYLE(wxFLP_CHANGE_DIR);
+ XRC_ADD_STYLE(wxFLP_SMALL);
XRC_ADD_STYLE(wxFLP_DEFAULT_STYLE);
XRC_ADD_STYLE(wxFLP_USE_TEXTCTRL);
AddWindowStyles();