本文整理汇总了C++中wxSizerFlags函数的典型用法代码示例。如果您正苦于以下问题:C++ wxSizerFlags函数的具体用法?C++ wxSizerFlags怎么用?C++ wxSizerFlags使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wxSizerFlags函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxFrame
MainFrame::MainFrame()
: wxFrame(NULL, wxID_ANY, "Main wx app",
wxDefaultPosition, wxSize(400, 300))
{
wxPanel *p = new wxPanel(this, wxID_ANY);
wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
sizer->Add
(
new wxStaticText
(
p, wxID_ANY,
wxString::Format
(
"Main wxApp instance is %p (%s),\n"
"thread ID %ld.\n",
wxApp::GetInstance(),
wxVERSION_STRING,
wxThread::GetCurrentId()
)
),
wxSizerFlags(1).Expand().Border(wxALL, 10)
);
sizer->Add
(
new wxButton(p, ID_RUN_DLL, "Run GUI from DLL"),
wxSizerFlags(0).Right().Border(wxALL, 10)
);
p->SetSizerAndFit(sizer);
wxSizer *fsizer = new wxBoxSizer(wxVERTICAL);
fsizer->Add(p, wxSizerFlags(1).Expand());
SetSizerAndFit(fsizer);
}
示例2: GetSizer
void wxRearrangeDialog::AddExtraControls(wxWindow *win)
{
wxSizer * const sizer = GetSizer();
wxCHECK_RET( sizer, "the dialog must be created first" );
wxASSERT_MSG( sizer->GetChildren().GetCount() == Pos_Max,
"calling AddExtraControls() twice?" );
sizer->Insert(Pos_Buttons, win, wxSizerFlags().Expand().Border());
win->MoveAfterInTabOrder(m_ctrl);
// we need to update the initial/minimal window size
sizer->SetSizeHints(this);
}
示例3: wxRearrangeList
bool
wxRearrangeCtrl::Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayInt& order,
const wxArrayString& items,
long style,
const wxValidator& validator,
const wxString& name)
{
// create all the windows
if ( !wxPanel::Create(parent, id, pos, size, wxTAB_TRAVERSAL, name) )
return false;
m_list = new wxRearrangeList(this, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
order, items,
style, validator);
wxButton * const btnUp = new wxButton(this, wxID_UP);
wxButton * const btnDown = new wxButton(this, wxID_DOWN);
// arrange them in a sizer
wxSizer * const sizerBtns = new wxBoxSizer(wxVERTICAL);
sizerBtns->Add(btnUp, wxSizerFlags().Centre().Border(wxBOTTOM));
sizerBtns->Add(btnDown, wxSizerFlags().Centre().Border(wxTOP));
wxSizer * const sizerTop = new wxBoxSizer(wxHORIZONTAL);
sizerTop->Add(m_list, wxSizerFlags(1).Expand().Border(wxRIGHT));
sizerTop->Add(sizerBtns, wxSizerFlags(0).Centre().Border(wxLEFT));
SetSizer(sizerTop);
m_list->SetFocus();
return true;
}
示例4: OPT_GET
void OptionPage::OptionFont(wxSizer *sizer, std::string opt_prefix) {
const agi::OptionValue *face_opt = OPT_GET(opt_prefix + "Font Face");
const agi::OptionValue *size_opt = OPT_GET(opt_prefix + "Font Size");
parent->AddChangeableOption(face_opt->GetName());
parent->AddChangeableOption(size_opt->GetName());
wxTextCtrl *font_name = new wxTextCtrl(this, -1, face_opt->GetString());
font_name->SetMinSize(wxSize(160, -1));
font_name->Bind(wxEVT_COMMAND_TEXT_UPDATED, StringUpdater(face_opt->GetName().c_str(), parent));
wxSpinCtrl *font_size = new wxSpinCtrl(this, -1, wxString::Format("%d", (int)size_opt->GetInt()), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 3, 42, size_opt->GetInt());
font_size->Bind(wxEVT_COMMAND_SPINCTRL_UPDATED, IntUpdater(size_opt->GetName().c_str(), parent));
wxButton *pick_btn = new wxButton(this, -1, _("Choose..."));
pick_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, std::bind(font_button, parent, font_name, font_size));
wxSizer *button_sizer = new wxBoxSizer(wxHORIZONTAL);
button_sizer->Add(font_name, wxSizerFlags(1).Expand());
button_sizer->Add(pick_btn, wxSizerFlags().Expand());
Add(sizer, _("Font Face"), button_sizer);
Add(sizer, _("Font Size"), font_size);
}
示例5: wxDialog
PreferencesWindow::PreferencesWindow(wxWindow* parent) : wxDialog(parent, wxID_ANY, wxT("Preferences"), wxDefaultPosition, wxSize(400, 400), wxRESIZE_BORDER | wxCAPTION | wxCLOSE_BOX) {
wxSizer* sizer = newd wxBoxSizer(wxVERTICAL);
book = newd wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_TOP);
//book->SetPadding(4);
book->AddPage(CreateGeneralPage(), wxT("General"), true);
book->AddPage(CreateEditorPage(), wxT("Editor"));
book->AddPage(CreateGraphicsPage(), wxT("Graphics"));
book->AddPage(CreateUIPage(), wxT("Interface"));
book->AddPage(CreateClientPage(), wxT("Client Version"));
sizer->Add(book, 1, wxEXPAND | wxALL, 10);
wxSizer* subsizer = newd wxBoxSizer(wxHORIZONTAL);
subsizer->Add(newd wxButton(this, wxID_OK, wxT("OK")), wxSizerFlags(1).Center());
subsizer->Add(newd wxButton(this, wxID_CANCEL, wxT("Cancel")), wxSizerFlags(1).Center());
subsizer->Add(newd wxButton(this, wxID_APPLY, wxT("Apply")), wxSizerFlags(1).Center());
sizer->Add(subsizer, 0, wxCENTER | wxLEFT | wxBOTTOM | wxRIGHT, 10);
SetSizerAndFit(sizer);
// FindWindowById(PANE_ADVANCED_GRAPHICS, this)->GetParent()->Fit();
}
示例6: wxPanel
RelationshipWindow::RelationshipWindow(wxWindow * parent)
: wxPanel(parent)
, m_imageList(0)
{
// ImageList
const wxSize imageSize(32, 32);
m_imageList = new wxImageList(imageSize.GetWidth(), imageSize.GetHeight());
m_imageList->Add(wxArtProvider::GetIcon(wxART_INFORMATION, wxART_OTHER, imageSize));
m_imageList->Add(wxArtProvider::GetIcon(wxART_QUESTION, wxART_OTHER, imageSize));
m_imageList->Add(wxArtProvider::GetIcon(wxART_WARNING, wxART_OTHER, imageSize));
m_imageList->Add(wxArtProvider::GetIcon(wxART_ERROR, wxART_OTHER, imageSize));
m_searchTextCtrl = new wxTextCtrl(this, Ctrl_SearchText);
m_searchTextCtrl->SetToolTip(gLangText.textSearchTip());
#if USES_TOOLBOOK
m_bookCtrl = new wxToolbook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_BOTTOM);
#else
m_bookCtrl = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_BOTTOM);
#endif // USES_TOOLBOOK
m_bookCtrl->Hide();
m_bookCtrl->AssignImageList(m_imageList);
m_rsp0 = new RelationshipPanel(m_bookCtrl);
m_rsp1 = new RelationshipPanel(m_bookCtrl);
m_bookCtrl->AddPage( m_rsp0, gLangText.btnMyCompanyText(), false, 0 );
m_bookCtrl->AddPage( m_rsp1, gLangText.btnMyDepartmentText(), true, 1 );
gMyCompany = m_rsp0;
gMyCoGroup = m_rsp1;
gMsgHandler = m_rsp1;
m_rsp0->buildAllContacts();
m_rsp1->buildConversations();
m_sizerFrame = new wxBoxSizer(wxVERTICAL);
m_sizerFrame->Insert(0, m_bookCtrl, wxSizerFlags(4).Expand().Border(wxALL, 0));
m_sizerFrame->Show(m_bookCtrl);
m_sizerFrame->Layout();
this->SetSizer(m_sizerFrame);
m_sizerFrame->SetSizeHints(this);
m_sizerFrame->Fit(this);
//m_timer.SetOwner(this);
}
示例7: WX_HOOK_MODAL_DIALOG
int wxGenericFileDialog::ShowModal()
{
WX_HOOK_MODAL_DIALOG();
if (CreateExtraControl())
{
wxSizer *sizer = GetSizer();
sizer->Insert(2 /* after m_filectrl */, m_extraControl,
wxSizerFlags().Expand().HorzBorder());
sizer->Fit(this);
}
m_filectrl->SetDirectory(m_dir);
return wxDialog::ShowModal();
}
示例8: AOConfigDialogPane
void AdvancedDialog::AddAoPage(void)
{
if (TheAO())
{
m_pAOPane = new AOConfigDialogPane(m_pDevicesSettingsPanel, TheAO());
m_pAOPane->LayoutControls(m_pDevicesSettingsPanel, m_brainCtrls);
m_pAOPane->Layout();
m_pDevicesSettingsPanel->GetSizer()->Add(m_pAOPane, wxSizerFlags(0).Border(wxTOP, 10).Expand());
m_pDevicesSettingsPanel->Layout();
}
else
{
m_pAOPane = NULL;
}
}
示例9: wxPanel
DbSelectionPanel::DbSelectionPanel(wxWindow* parent,
const wxString& filePrompt,
const wxString& filePickerCtrlTitle,
bool autoValidate,
PWScore* core,
unsigned rowsep) : wxPanel(parent), m_filepicker(0),
m_sc(0),
m_bAutoValidate(autoValidate),
m_core(core)
{
wxSizerFlags borderFlags = wxSizerFlags().Border(wxLEFT|wxRIGHT, SideMargin);
/* This doesn't work since the second Border() call overwrites all the
* previous border values. So now we have to insert separators by hand
*/
//wxSizerFlags rowFlags = borderFlags.Border(wxBOTTOM, RowSeparation);
wxBoxSizer* panelSizer = new wxBoxSizer(wxVERTICAL);
panelSizer->AddSpacer(TopMargin);
panelSizer->Add(new wxStaticText(this, wxID_ANY, filePrompt), borderFlags);
panelSizer->AddSpacer(RowSeparation);
COpenFilePickerValidator validator(m_filepath);
m_filepicker = new wxFilePickerCtrl(this, wxID_ANY, wxEmptyString,
filePickerCtrlTitle,
_("Password Safe Databases (*.psafe4; *.psafe3; *.dat)|*.psafe4;*.psafe3;*.dat|Password Safe Backups (*.bak)|*.bak|Password Safe Intermediate Backups (*.ibak)|*.ibak|All files (*.*; *)|*.*;*"),
wxDefaultPosition, wxDefaultSize,
wxFLP_DEFAULT_STYLE | wxFLP_USE_TEXTCTRL,
validator);
panelSizer->Add(m_filepicker, borderFlags.Expand());
panelSizer->AddSpacer(RowSeparation*rowsep);
m_filepicker->Connect( m_filepicker->GetEventType(),
wxFileDirPickerEventHandler(DbSelectionPanel::OnFilePicked),
NULL, this);
panelSizer->Add(new wxStaticText(this, wxID_ANY, _("Safe Combination:")), borderFlags);
panelSizer->AddSpacer(RowSeparation);
m_sc = new CSafeCombinationCtrl(this);
m_sc->SetValidatorTarget(&m_combination);
panelSizer->Add(m_sc, borderFlags.Expand());
SetSizerAndFit(panelSizer);
//The parent window must call our TransferDataToWindow and TransferDataFromWindow
m_parent->SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
}
示例10: wxFrame
wxNotificationMessageWindow::wxNotificationMessageWindow(wxGenericNotificationMessageImpl* notificationImpl)
: wxFrame(NULL, wxID_ANY, _("Notice"),
wxDefaultPosition, wxDefaultSize,
wxBORDER_NONE | wxFRAME_TOOL_WINDOW | wxSTAY_ON_TOP /* no caption, no border styles */),
m_timer(this),
m_mouseActiveCount(0),
m_notificationImpl(notificationImpl)
{
m_buttonSizer = NULL;
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW));
m_messagePanel = new wxPanel(this, wxID_ANY);
wxSizer * const msgSizer = new wxBoxSizer(wxHORIZONTAL);
m_messagePanel->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
m_messagePanel->SetSizer(msgSizer);
PrepareNotificationControl(m_messagePanel);
// Add message icon to layout
m_messageBmp = new wxStaticBitmap
(
m_messagePanel,
wxID_ANY,
wxArtProvider::GetMessageBoxIcon(wxICON_INFORMATION)
);
m_messageBmp->Hide();
PrepareNotificationControl(m_messageBmp);
msgSizer->Add(m_messageBmp, wxSizerFlags().Centre().DoubleBorder());
// Create title and message sizers
wxSizer* textSizer = new wxBoxSizer(wxVERTICAL);
m_messageTitle = new wxStaticText(m_messagePanel, wxID_ANY, wxString());
m_messageTitle->SetFont(m_messageTitle->GetFont().MakeBold());
textSizer->Add(m_messageTitle, wxSizerFlags(0).Border());
m_messageTitle->Hide();
PrepareNotificationControl(m_messageTitle);
m_messageText = new wxStaticText(m_messagePanel, wxID_ANY, wxString());
textSizer->Add(m_messageText, wxSizerFlags(0).Border(wxLEFT | wxRIGHT | wxBOTTOM));
PrepareNotificationControl(m_messageText);
msgSizer->Add(textSizer, wxSizerFlags(1).Center());
// Add a single close button if no actions are specified
m_closeBtn = wxBitmapButton::NewCloseButton(m_messagePanel, wxID_ANY);
msgSizer->Add(m_closeBtn, wxSizerFlags(0).Border(wxALL, 3).Top());
m_closeBtn->Bind(wxEVT_BUTTON, &wxNotificationMessageWindow::OnCloseClicked, this);
PrepareNotificationControl(m_closeBtn, false);
wxSizer * const sizerTop = new wxBoxSizer(wxHORIZONTAL);
sizerTop->Add(m_messagePanel, wxSizerFlags().Border(wxALL, FromDIP(1)));
SetSizer(sizerTop);
}
示例11: wxDialog
DialogDummyVideo::DialogDummyVideo(wxWindow *parent)
: wxDialog(parent, -1, _("Dummy video options"))
, fps(OPT_GET("Video/Dummy/FPS")->GetDouble())
, width(OPT_GET("Video/Dummy/Last/Width")->GetInt())
, height(OPT_GET("Video/Dummy/Last/Height")->GetInt())
, length(OPT_GET("Video/Dummy/Last/Length")->GetInt())
, color(OPT_GET("Colour/Video Dummy/Last Colour")->GetColor())
, pattern(OPT_GET("Video/Dummy/Pattern")->GetBool())
{
SetIcon(GETICON(use_dummy_video_menu_16));
auto res_sizer = new wxBoxSizer(wxHORIZONTAL);
res_sizer->Add(spin_ctrl(this, 1, 10000, &width), wxSizerFlags(1).Expand());
res_sizer->Add(new wxStaticText(this, -1, " x "), wxSizerFlags().Center());
res_sizer->Add(spin_ctrl(this, 1, 10000, &height), wxSizerFlags(1).Expand());
auto color_sizer = new wxBoxSizer(wxHORIZONTAL);
auto color_btn = new ColourButton(this, wxSize(30, 17), false, color);
color_sizer->Add(color_btn, wxSizerFlags().DoubleBorder(wxRIGHT));
color_sizer->Add(new wxCheckBox(this, -1, _("Checkerboard &pattern"), wxDefaultPosition, wxDefaultSize, 0, wxGenericValidator(&pattern)), wxSizerFlags(1).Center());
sizer = new wxFlexGridSizer(2, 5, 5);
AddCtrl(_("Video resolution:"), resolution_shortcuts(this, width, height));
AddCtrl("", res_sizer);
AddCtrl(_("Color:"), color_sizer);
AddCtrl(_("Frame rate (fps):"), spin_ctrl(this, .1, 1000.0, &fps));
AddCtrl(_("Duration (frames):"), spin_ctrl(this, 2, 36000000, &length)); // Ten hours of 1k FPS
AddCtrl("", length_display = new wxStaticText(this, -1, ""));
wxStdDialogButtonSizer *btn_sizer = CreateStdDialogButtonSizer(wxOK | wxCANCEL | wxHELP);
btn_sizer->GetHelpButton()->Bind(wxEVT_BUTTON, std::bind(&HelpButton::OpenPage, "Dummy Video"));
auto main_sizer = new wxBoxSizer(wxVERTICAL);
main_sizer->Add(sizer, wxSizerFlags(1).Border().Expand());
main_sizer->Add(new wxStaticLine(this, wxHORIZONTAL), wxSizerFlags().HorzBorder().Expand());
main_sizer->Add(btn_sizer, wxSizerFlags().Expand().Border());
UpdateLengthDisplay();
SetSizerAndFit(main_sizer);
CenterOnParent();
Bind(wxEVT_COMBOBOX, &DialogDummyVideo::OnResolutionShortcut, this);
color_btn->Bind(EVT_COLOR, [=](wxThreadEvent& e) { color = color_btn->GetColor(); });
Bind(wxEVT_SPINCTRL, [=](wxCommandEvent&) {
TransferDataFromWindow();
UpdateLengthDisplay();
});
}
示例12: RotatorConfigDialogPane
void AdvancedDialog::AddRotatorPage(void)
{
if (pRotator)
{
// We have a rotator selected
m_pRotatorPane = new RotatorConfigDialogPane(m_pDevicesSettingsPanel, pRotator);
m_pRotatorPane->LayoutControls(m_pDevicesSettingsPanel, m_brainCtrls);
m_pRotatorPane->Layout();
m_pDevicesSettingsPanel->GetSizer()->Add(m_pRotatorPane, wxSizerFlags(0).Border(wxTOP, 10).Expand());
m_pDevicesSettingsPanel->Layout();
}
else
{
m_pRotatorPane = NULL;
}
}
示例13: switch
void AttentionBar::ShowMessage(const AttentionMessage& msg)
{
if ( msg.IsBlacklisted() )
return;
wxString iconName;
switch ( msg.m_kind )
{
case AttentionMessage::Info:
iconName = wxART_INFORMATION;
break;
case AttentionMessage::Warning:
iconName = wxART_WARNING;
break;
case AttentionMessage::Error:
iconName = wxART_ERROR;
break;
}
m_icon->SetBitmap(wxArtProvider::GetBitmap(iconName, wxART_MENU, wxSize(16, 16)));
m_label->SetLabelText(msg.m_text);
m_buttons->Clear(true/*delete_windows*/);
m_actions.clear();
for ( AttentionMessage::Actions::const_iterator i = msg.m_actions.begin();
i != msg.m_actions.end(); ++i )
{
wxButton *b = new wxButton(this, wxID_ANY, i->first);
#ifdef __WXMAC__
MakeButtonRounded(b->GetHandle());
#endif
m_buttons->Add(b, wxSizerFlags().Center().Border(wxRIGHT, BUTTONS_SPACE));
m_actions[b] = i->second;
}
// we need to size the control correctly _and_ lay out the controls if this
// is the first time it's being shown, otherwise we can get garbled look:
SetSize(GetParent()->GetClientSize().x,
GetBestSize().y);
Layout();
Show();
GetParent()->Layout();
}
示例14: CreateTextureXDialog
CreateTextureXDialog(wxWindow* parent) : wxDialog(parent, -1, "Create Texture Definitions")
{
// Setup layout
auto m_vbox = new wxBoxSizer(wxVERTICAL);
SetSizer(m_vbox);
// --- Format options ---
auto frame = new wxStaticBox(this, -1, "Format");
auto framesizer = new wxStaticBoxSizer(frame, wxVERTICAL);
m_vbox->Add(framesizer, 0, wxEXPAND | wxALL, UI::pad());
// Doom format
rb_format_doom_ = new wxRadioButton(
this, -1, "Doom (TEXTURE1 + PNAMES)", wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
rb_format_strife_ = new wxRadioButton(this, -1, "Strife (TEXTURE1 + PNAMES)");
rb_format_textures_ = new wxRadioButton(this, -1, "ZDoom (TEXTURES)");
WxUtils::layoutVertically(
framesizer,
{ rb_format_doom_, rb_format_strife_, rb_format_textures_ },
wxSizerFlags(1).Expand().Border(wxALL, UI::pad()));
// --- Source options ---
frame = new wxStaticBox(this, -1, "Source");
framesizer = new wxStaticBoxSizer(frame, wxVERTICAL);
m_vbox->Add(framesizer, 0, wxEXPAND | wxALL, UI::pad());
// New list
rb_new_ = new wxRadioButton(this, -1, "Create New (Empty)", wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
framesizer->Add(rb_new_, 0, wxEXPAND | wxALL, UI::pad());
// Import from Base Resource Archive
rb_import_bra_ = new wxRadioButton(this, -1, "Import from Base Resource Archive:");
framesizer->Add(rb_import_bra_, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, UI::pad());
// Add buttons
m_vbox->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxALL, UI::pad());
// Bind events
rb_new_->Bind(wxEVT_RADIOBUTTON, &CreateTextureXDialog::onRadioNewSelected, this);
rb_import_bra_->Bind(wxEVT_RADIOBUTTON, &CreateTextureXDialog::onRadioNewSelected, this);
SetInitialSize(wxSize(-1, -1));
wxWindowBase::Layout();
}
示例15: PrefsPanelBase
// -----------------------------------------------------------------------------
// OpenGLPrefsPanel class constructor
// -----------------------------------------------------------------------------
OpenGLPrefsPanel::OpenGLPrefsPanel(wxWindow* parent) : PrefsPanelBase(parent), last_font_size_{ gl_font_size }
{
// Create sizer
auto sizer = new wxBoxSizer(wxVERTICAL);
SetSizer(sizer);
WxUtils::layoutVertically(
sizer,
vector<wxObject*>{ cb_gl_np2_ = new wxCheckBox(this, -1, "Enable Non-power-of-two textures if supported"),
cb_gl_point_sprite_ = new wxCheckBox(this, -1, "Enable point sprites if supported"),
cb_gl_use_vbo_ = new wxCheckBox(this, -1, "Use Vertex Buffer Objects if supported"),
WxUtils::createLabelHBox(this, "Font Size:", ntc_font_size_ = new NumberTextCtrl(this)) },
wxSizerFlags(0).Expand());
cb_gl_point_sprite_->SetToolTip(
"Only disable this if you are experiencing graphical glitches like things disappearing");
ntc_font_size_->SetToolTip("The size of the font to use in OpenGL, eg. for info overlays in the map editor");
}