/* SplashWindow::show * Shows the splash window with [message]. If [progress] is true, a * progress bar will also be shown *******************************************************************/ void SplashWindow::show(string message, bool progress, wxWindow* parent) { // Setup progress bar int rheight = height; if (progress) { show_progress = true; setProgress(0.0f); rheight += 10; } else show_progress = false; // Set parent if (!parent && theApp->isInitialised()) SetParent(theMainWindow); else SetParent(parent); // Show & init window #ifndef __WXGTK__ SetInitialSize(wxSize(width, rheight)); #else SetInitialSize(wxSize(width + 6, rheight + 6)); #endif setMessage(message); Show(); CentreOnParent(); forceRedraw(); }
void CtrlRegisterList::onPopupClick(wxCommandEvent& evt) { switch (evt.GetId()) { case ID_REGISTERLIST_DISPLAY32: resolvePointerStrings = false; maxBits = 32; SetInitialSize(ClientToWindowSize(GetMinClientSize())); postEvent(debEVT_UPDATELAYOUT,0); Refresh(); break; case ID_REGISTERLIST_DISPLAY64: resolvePointerStrings = false; maxBits = 64; SetInitialSize(ClientToWindowSize(GetMinClientSize())); postEvent(debEVT_UPDATELAYOUT,0); Refresh(); break; case ID_REGISTERLIST_DISPLAY128: resolvePointerStrings = false; maxBits = 128; SetInitialSize(ClientToWindowSize(GetMinClientSize())); postEvent(debEVT_UPDATELAYOUT,0); Refresh(); break; case ID_REGISTERLIST_DISPLAY128STRINGS: resolvePointerStrings = true; maxBits = 128; SetInitialSize(ClientToWindowSize(GetMinClientSize())); postEvent(debEVT_UPDATELAYOUT, 0); Refresh(); break; case ID_REGISTERLIST_CHANGELOWER: changeValue(LOWER64); Refresh(); break; case ID_REGISTERLIST_CHANGEUPPER: changeValue(UPPER64); Refresh(); break; case ID_REGISTERLIST_CHANGEVALUE: if (cpu->getRegisterSize(category) == 32) changeValue(CHANGE32); else changeValue(LOWER64); Refresh(); break; case ID_REGISTERLIST_GOTOINMEMORYVIEW: postEvent(debEVT_GOTOINMEMORYVIEW, cpu->getRegister(category, currentRows[category])._u32[0]); break; case ID_REGISTERLIST_GOTOINDISASM: postEvent(debEVT_GOTOINDISASM, cpu->getRegister(category, currentRows[category])._u32[0]); break; default: wxMessageBox( L"Unimplemented.", L"Unimplemented.", wxICON_INFORMATION); break; } }
bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id, const wxURI& location, const wxPoint& pos, const wxSize& size, long style, const wxString& szBackend, const wxValidator& validator, const wxString& name) { if(!szBackend.empty()) { wxClassInfo* pClassInfo = wxClassInfo::FindClass(szBackend); if(!pClassInfo || !DoCreate(pClassInfo, parent, id, pos, size, style, validator, name)) { m_imp = NULL; return false; } if (!Load(location)) { delete m_imp; m_imp = NULL; return false; } SetInitialSize(size); return true; } else { wxClassInfo::const_iterator it = wxClassInfo::begin_classinfo(); const wxClassInfo* classInfo; while((classInfo = NextBackend(&it)) != NULL) { if(!DoCreate(classInfo, parent, id, pos, size, style, validator, name)) continue; if (Load(location)) { SetInitialSize(size); return true; } else delete m_imp; } m_imp = NULL; return false; } }
/* SDialog::setSavedSize * Resizes the dialog to its saved size *******************************************************************/ void SDialog::setSavedSize(int def_width, int def_height) { Misc::winf_t info = Misc::getWindowInfo(id); if (!info.id.IsEmpty()) { SetInitialSize(wxSize(info.width, info.height)); SetClientSize(info.width, info.height); } else { SetInitialSize(wxSize(def_width, def_height)); SetClientSize(def_width, def_height); } }
bool wxChoice::CreateAndInit(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, int n, const wxString choices[], long style, const wxValidator& validator, const wxString& name) { // initialize wxControl if ( !CreateControl(parent, id, pos, size, style, validator, name) ) return false; // now create the real HWND if ( !MSWCreateControl(wxT("COMBOBOX"), wxEmptyString, pos, size) ) return false; // choice/combobox normally has "white" (depends on colour scheme, of // course) background rather than inheriting the parent's background SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); // initialize the controls contents for ( int i = 0; i < n; i++ ) { Append(choices[i]); } // and now we may finally size the control properly (if needed) SetInitialSize(size); return true; }
/* ThingDirCanvas::ThingDirCanvas * ThingDirCanvas class constructor *******************************************************************/ ThingDirCanvas::ThingDirCanvas(wxWindow* parent) : OGLCanvas(parent, -1, true, 15) { // Init variables angle = 0; point_hl = -1; last_check = 0; point_sel = -1; // Get system panel background colour wxColour bgcolwx = Drawing::getPanelBGColour(); col_bg.set(bgcolwx.Red(), bgcolwx.Green(), bgcolwx.Blue()); // Get system text colour wxColour textcol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); col_fg.set(textcol.Red(), textcol.Green(), textcol.Blue()); // Setup dir points double rot = 0; for (int a = 0; a < 8; a++) { dir_points.push_back(fpoint2_t(sin(rot), 0 - cos(rot))); rot -= (3.1415926535897932384626433832795 * 2) / 8.0; } // Bind Events Bind(wxEVT_MOTION, &ThingDirCanvas::onMouseEvent, this); Bind(wxEVT_LEAVE_WINDOW, &ThingDirCanvas::onMouseEvent, this); Bind(wxEVT_LEFT_DOWN, &ThingDirCanvas::onMouseEvent, this); // Fixed size SetInitialSize(wxSize(128, 128)); SetMaxSize(wxSize(128, 128)); }
bool wxColourButton::Create( wxWindow *parent, wxWindowID id, const wxColour &col, const wxPoint &pos, const wxSize &size, long style, const wxValidator& validator, const wxString &name ) { if (!PreCreation( parent, pos, size ) || !wxControl::CreateBase(parent, id, pos, size, style, validator, name)) { wxFAIL_MSG( wxT("wxColourButton creation failed") ); return false; } m_colour = col; #ifdef __WXGTK3__ m_widget = gtk_color_button_new_with_rgba(m_colour); #else m_widget = gtk_color_button_new_with_color( m_colour.GetColor() ); #endif g_object_ref(m_widget); // GtkColourButton signals g_signal_connect(m_widget, "color-set", G_CALLBACK(gtk_clrbutton_setcolor_callback), this); m_parent->DoAddChild( this ); PostCreation(size); SetInitialSize(size); return true; }
bool wxListBox::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, int n, const wxString choices[], long style, const wxValidator& validator, const wxString& name) { // initialize base class fields if ( !CreateControl(parent, id, pos, size, style, validator, name) ) return false; // create the native control if ( !MSWCreateControl(wxT("LISTBOX"), wxEmptyString, pos, size) ) { // control creation failed return false; } // initialize the contents for ( int i = 0; i < n; i++ ) { Append(choices[i]); } // now we can compute our best size correctly, so do it again SetInitialSize(size); return true; }
bool wxCustomButton::Create(wxWindow* parent, wxWindowID id, const wxString& label, const wxBitmap &bitmap, const wxPoint& pos, const wxSize& size, long style, const wxValidator& val, const wxString& name) { if (!wxControl::Create(parent,id,pos,size,wxNO_BORDER|wxCLIP_CHILDREN,val,name)) return FALSE; wxControl::SetLabel(label); wxControl::SetBackgroundColour(parent->GetBackgroundColour()); wxControl::SetForegroundColour(parent->GetForegroundColour()); wxControl::SetFont(parent->GetFont()); if (bitmap.Ok()) m_bmpLabel = bitmap; if (!SetButtonStyle(style)) return FALSE; wxSize bestSize = DoGetBestSize(); SetSize(wxSize(size.x<0 ? bestSize.x:size.x, size.y<0 ? bestSize.y:size.y)); #if (wxMINOR_VERSION<8) SetBestSize(GetSize()); #else SetInitialSize(GetSize()); #endif CalcLayout(TRUE); return TRUE; }
CTimeCtrl::CTimeCtrl() { InitializeIIDs(&IID_DTime, &IID_DTimeEvents); SetInitialSize(24, 22); m_interval = (short) DEFAULT_INTERVAL; // initialize interval property }
SetupWizardDialog::SetupWizardDialog(wxWindow* parent) : wxDialog(parent, -1, "First Time SLADE Setup", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) { // Create pages pages.push_back(new TempFolderWizardPage(this)); pages.push_back(new BaseResourceWizardPage(this)); pages.push_back(new NodeBuildersWizardPage(this)); current_page = 0; // Hide all pages for (unsigned a = 0; a < pages.size(); a++) pages[a]->Show(false); // Init layout setupLayout(); // Set icon wxIcon icon; icon.CopyFromBitmap(getIcon("i_logo")); SetIcon(icon); // Setup layout SetInitialSize(wxSize(600, 500)); Layout(); Fit(); SetMinSize(GetBestSize()); CenterOnParent(); showPage(0); // Bind events btn_next->Bind(wxEVT_BUTTON, &SetupWizardDialog::onBtnNext, this); btn_prev->Bind(wxEVT_BUTTON, &SetupWizardDialog::onBtnPrev, this); }
bool wxAnimationCtrl::Create( wxWindow *parent, wxWindowID id, const wxAnimation& anim, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { if (!PreCreation( parent, pos, size ) || !base_type::CreateBase(parent, id, pos, size, style & wxWINDOW_STYLE_MASK, wxDefaultValidator, name)) { wxFAIL_MSG( wxT("wxAnimationCtrl creation failed") ); return false; } SetWindowStyle(style); m_widget = gtk_image_new(); g_object_ref(m_widget); gtk_widget_show(m_widget); m_parent->DoAddChild( this ); PostCreation(size); SetInitialSize(size); if (anim.IsOk()) SetAnimation(anim); // init the timer used for animation m_timer.SetOwner(this); return true; }
CtrlRegisterList::CtrlRegisterList(wxWindow* parent, DebugInterface* _cpu) : wxScrolledWindow(parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxWANTS_CHARS|wxBORDER_NONE|wxVSCROLL), cpu(_cpu) { rowHeight = getDebugFontHeight()+2; charWidth = getDebugFontWidth(); category = 0; maxBits = 128; lastPc = 0xFFFFFFFF; for (int i = 0; i < cpu->getRegisterCategoryCount(); i++) { int count = cpu->getRegisterCount(i); ChangedReg* regs = new ChangedReg[count]; memset(regs,0,sizeof(ChangedReg)*count); changedCategories.push_back(regs); int maxLen = 0; for (int k = 0; k < cpu->getRegisterCount(i); k++) { maxLen = std::max<int>(maxLen,strlen(cpu->getRegisterName(i,k))); } int x = 17+(maxLen+2)*charWidth; startPositions.push_back(x); currentRows.push_back(0); } SetDoubleBuffered(true); SetInitialSize(ClientToWindowSize(GetMinClientSize())); wxSize actualSize = getOptimalSize(); SetVirtualSize(actualSize); SetScrollbars(1, rowHeight, actualSize.x, actualSize.y / rowHeight, 0, 0); }
bool wxStaticText::Create(wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { if ( !CreateControl(parent, id, pos, size, style, wxDefaultValidator, name) ) return false; if ( !MSWCreateControl(wxT("STATIC"), wxEmptyString, pos, size) ) return false; // we set the label here and not through MSWCreateControl() because we // need to do many operation on it for ellipsization&markup support SetLabel(label); // as we didn't pass the correct label to MSWCreateControl(), it didn't set // the initial size correctly -- do it now InvalidateBestSize(); SetInitialSize(size); // NOTE: if the label contains ampersand characters which are interpreted as // accelerators, they will be rendered (at least on WinXP) only if the // static text is placed inside a window class which correctly handles // focusing by TAB traversal (e.g. wxPanel). return true; }
bool wxChoice::CreateAndInit(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, int n, const wxString choices[], long style, const wxValidator& validator, const wxString& name) { // initialize wxControl if ( !CreateControl(parent, id, pos, size, style, validator, name) ) return false; // now create the real HWND if ( !MSWCreateControl(wxT("COMBOBOX"), wxEmptyString, pos, size) ) return false; // initialize the controls contents for ( int i = 0; i < n; i++ ) { Append(choices[i]); } // and now we may finally size the control properly (if needed) SetInitialSize(size); return true; }
void wxPickerBase::PostCreation() { // the picker's proportion value defaults to 1 when there's no text control // associated with it - in that case it defaults to 0 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, 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); SetInitialSize( GetMinSize() ); }
bool wxTimePickerCtrlGeneric::Create(wxWindow *parent, wxWindowID id, const wxDateTime& date, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) { // The text control we use already has a border, so we don't need one // ourselves. style &= ~wxBORDER_MASK; style |= wxBORDER_NONE; if ( !Base::Create(parent, id, pos, size, style, validator, name) ) return false; m_impl = new wxTimePickerGenericImpl(this); m_impl->SetValue(date); InvalidateBestSize(); SetInitialSize(size); return true; }
ParamNum::ParamNum(wxPanel *panel, wxString pname, wxString labelname, double initval, int places) { int numheight = -1; wxControl::Create(panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE); name = pname; decimals = places; ostype = GetSystem(); textfont = wxFont(wxFontInfo(8).FaceName("Tahoma")); //textfont = wxFont(wxFontInfo(8).FaceName("Tahoma")); //textfont = wxFont(8, wxFONTFAMILY_SWISS, wxNORMAL, wxNORMAL, false, wxT("Tahoma")); if(ostype == Mac) { textfont = wxFont(wxFontInfo(11).FaceName("Tahoma")); //textfont = wxFont(11, wxFONTFAMILY_SWISS, wxNORMAL, wxNORMAL, false, wxT("Tahoma")); numheight = 20; } sizer = new wxBoxSizer(wxHORIZONTAL); snum = numstring(initval, places); label = new wxStaticText(this, wxID_STATIC, labelname, wxDefaultPosition, wxSize(65, -1), wxALIGN_CENTRE); numbox = new wxTextCtrl(this, wxID_ANY, snum, wxDefaultPosition, wxSize(40, numheight), wxTE_PROCESS_ENTER); label->SetFont(textfont); numbox->SetFont(textfont); SetInitialSize(wxDefaultSize); Move(wxDefaultPosition); sizer->Add(label, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 2); sizer->Add(numbox, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 2); SetSizer(sizer); Layout(); }
void wxButton::DoSetBitmapMargins(wxCoord x, wxCoord y) { m_marginBmpX = x + 2; m_marginBmpY = y + 2; SetInitialSize(wxDefaultSize); }
ParamText::ParamText(wxPanel *panel, wxString pname, wxString labelname, wxString initval, int labelwid, int textwid) { wxControl::Create(panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE); name = pname; labelwidth = labelwid; textwidth = textwid; buttonwidth = 0; ostype = GetSystem(); textfont = wxFont(wxFontInfo(8).FaceName("Tahoma")); //textfont = wxFont(8, wxFONTFAMILY_SWISS, wxNORMAL, wxNORMAL, false, "Tahoma"); if(ostype == Mac) textfont = wxFont(wxFontInfo(11).FaceName("Tahoma")); confont = textfont; sizer = new wxBoxSizer(wxHORIZONTAL); label = new wxStaticText(this, wxID_STATIC, labelname, wxDefaultPosition, wxSize(labelwidth, -1), wxALIGN_CENTRE); textbox = new wxTextCtrl(this, wxID_ANY, initval, wxDefaultPosition, wxSize(textwidth, -1), wxTE_PROCESS_ENTER); label->SetFont(textfont); textbox->SetFont(textfont); SetInitialSize(wxDefaultSize); Move(wxDefaultPosition); sizer->Add(label, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 2); sizer->Add(textbox, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 2); SetSizer(sizer); Layout(); }
GeneratePalettesDialog(wxWindow* parent) : wxDialog(parent, -1, "Generate Palettes", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) { // Set dialog icon wxIcon icon; icon.CopyFromBitmap(Icons::getIcon(Icons::ENTRY, "palette")); SetIcon(icon); // Setup main sizer wxBoxSizer* msizer = new wxBoxSizer(wxVERTICAL); SetSizer(msizer); wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); msizer->Add(sizer, 1, wxEXPAND|wxALL, 6); // Add buttons rb_doom = new wxRadioButton(this, -1, "Doom (14 Palettes)", wxDefaultPosition, wxDefaultSize, wxRB_GROUP); sizer->Add(rb_doom, 0, wxEXPAND|wxALL, 4); rb_hexen = new wxRadioButton(this, -1, "Hexen (28 Palettes)"); sizer->Add(rb_hexen, 0, wxEXPAND|wxALL, 4); sizer->Add(CreateButtonSizer(wxOK|wxCANCEL), 0, wxEXPAND|wxBOTTOM|wxTOP, 4); // Init layout Layout(); // Setup dialog size SetInitialSize(wxSize(-1, -1)); SetMinSize(GetSize()); CenterOnParent(); }
bool wxCommandLinkButton::Create(wxWindow *parent, wxWindowID id, const wxString& mainLabel, const wxString& note, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) { if ( ! wxGenericCommandLinkButton::Create(parent, id, mainLabel, note, pos, size, style, validator, name) ) return false; SetMainLabelAndNote(mainLabel, note); SetInitialSize(); return true; }
bool wxMenuButton::Create( wxWindow* parent, wxWindowID id, const wxString &label, const wxBitmap &bitmap, const wxPoint& pos, const wxSize& size, long style, const wxValidator& val, const wxString& name) { m_style = style; long flat = style & wxMENUBUT_FLAT; wxControl::Create(parent,id,pos,size,wxNO_BORDER|wxCLIP_CHILDREN,val,name); wxControl::SetLabel(label); SetBackgroundColour(parent->GetBackgroundColour()); SetForegroundColour(parent->GetForegroundColour()); SetFont(parent->GetFont()); m_labelButton = new MenuLabelButton(this, id, label, bitmap, wxCUSTBUT_BUTTON|flat); m_dropdownButton = new MenuDropButton(this, IDD_DROPDOWN_BUTTON, wxCUSTBUT_BUTTON|flat); wxSize bestSize = DoGetBestSize(); SetSize( wxSize(size.x < 0 ? bestSize.x : size.x, size.y < 0 ? bestSize.y : size.y) ); #if (wxMINOR_VERSION<8) SetBestSize(GetSize()); #else SetInitialSize(GetSize()); #endif return TRUE; }
bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { SetName(name); m_backgroundColour = parent->GetBackgroundColour() ; m_foregroundColour = parent->GetForegroundColour() ; m_bitmap = bitmap; if ( id == wxID_ANY ) m_windowId = (int)NewControlId(); else m_windowId = id; m_windowStyle = style; bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name ); SetInitialSize( size ) ; return ret; }
bool wxSymbolListCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { style |= wxWANTS_CHARS | wxFULL_REPAINT_ON_RESIZE; if ((style & wxBORDER_MASK) == wxBORDER_DEFAULT) style |= wxBORDER_THEME; if ( !wxVScrolledWindow::Create(parent, id, pos, size, style, name) ) return false; // make sure the native widget has the right colour since we do // transparent drawing by default SetBackgroundColour(GetBackgroundColour()); m_colBgSel = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT); // flicker-free drawing requires this SetBackgroundStyle(wxBG_STYLE_CUSTOM); SetFont(*wxNORMAL_FONT); SetupCtrl(); SetInitialSize(size); return true; }
bool wxGauge::Create( wxWindow *parent, wxWindowID id, int range, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name ) { m_needParent = true; if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, validator, name )) { wxFAIL_MSG( wxT("wxGauge creation failed") ); return false; } m_rangeMax = range; m_widget = gtk_progress_bar_new(); if ( style & wxGA_VERTICAL ) { gtk_progress_bar_set_orientation( GTK_PROGRESS_BAR(m_widget), GTK_PROGRESS_BOTTOM_TO_TOP ); } m_parent->DoAddChild( this ); PostCreation(size); SetInitialSize(size); return true; }
GfxCropDialog(wxWindow* parent, ArchiveEntry* entry, Palette8bit* pal) : wxDialog(parent, -1, "Crop", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) { // Set dialog icon wxIcon icon; icon.CopyFromBitmap(Icons::getIcon(Icons::GENERAL, "settings")); SetIcon(icon); // Setup main sizer wxBoxSizer* msizer = new wxBoxSizer(wxVERTICAL); SetSizer(msizer); wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); msizer->Add(sizer, 1, wxEXPAND|wxALL, 6); // Add preview canvas_preview = new CropCanvas(this); sizer->Add(canvas_preview, 1, wxEXPAND|wxALL, 4); // Add buttons sizer->Add(CreateButtonSizer(wxOK|wxCANCEL), 0, wxEXPAND|wxBOTTOM, 4); // Setup dialog size SetInitialSize(wxSize(-1, -1)); SetMinSize(GetSize()); CenterOnParent(); }
bool wxNativeWindow::Create(wxWindow* parent, wxWindowID winid, wxNativeWindowHandle widget) { wxCHECK_MSG( widget, false, wxS("Invalid null GtkWidget") ); // Standard wxGTK controls use PreCreation() but we never have any size // specified at this stage, so don't bother with it. if ( !CreateBase(parent, winid) ) return false; // Add a reference to the widget to match g_object_unref() in wxWindow dtor. m_widget = widget; g_object_ref(m_widget); parent->DoAddChild(this); PostCreation(); // Ensure that the best (and minimal) size is set to fully display the // widget. GtkRequisition req; gtk_widget_get_preferred_size(widget, NULL, &req); SetInitialSize(wxSize(req.width, req.height)); return true; }
bool wxDirButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, const wxString &path, const wxString &message, const wxString &wildcard, const wxPoint &pos, const wxSize &size, long style, const wxValidator& validator, const wxString &name ) { if (!(style & wxDIRP_USE_TEXTCTRL)) { // VERY IMPORTANT: this code is identic to relative code in wxFileButton; // if you find a problem here, fix it also in wxFileButton ! if (!PreCreation( parent, pos, size ) || !wxControl::CreateBase(parent, id, pos, size, style & wxWINDOW_STYLE_MASK, validator, name)) { wxFAIL_MSG( wxT("wxDirButtonGTK creation failed") ); return false; } // create the dialog associated with this button SetWindowStyle(style); m_message = message; m_wildcard = wildcard; if ((m_dialog = CreateDialog()) == NULL) return false; SetPath(path); // little trick used to avoid problems when there are other GTK windows 'grabbed': // GtkFileChooserDialog won't be responsive to user events if there is another // window which called gtk_grab_add (and this happens if e.g. a wxDialog is running // in modal mode in the application - see wxDialogGTK::ShowModal). // An idea could be to put the grab on the m_dialog->m_widget when the GtkFileChooserButton // is clicked and then remove it as soon as the user closes the dialog itself. // Unfortunately there's no way to hook in the 'clicked' event of the GtkFileChooserButton, // thus we add grab on m_dialog->m_widget when it's shown and remove it when it's // hidden simply using its "show" and "hide" events - clean & simple :) g_signal_connect(m_dialog->m_widget, "show", G_CALLBACK(gtk_grab_add), NULL); g_signal_connect(m_dialog->m_widget, "hide", G_CALLBACK(gtk_grab_remove), NULL); // NOTE: we deliberately ignore the given label as GtkFileChooserButton // use as label the currently selected file m_widget = gtk_file_chooser_button_new_with_dialog( m_dialog->m_widget ); g_object_ref(m_widget); // GtkFileChooserButton signals g_signal_connect(m_widget, "current-folder-changed", G_CALLBACK(gtk_dirbutton_currentfolderchanged_callback), this); m_parent->DoAddChild( this ); PostCreation(size); SetInitialSize(size); } else return wxGenericDirButton::Create(parent, id, label, path, message, wildcard, pos, size, style, validator, name); return true; }
bool wxStaticText::Create( wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) { DontCreatePeer(); if ( !wxControl::Create( parent, id, pos, size, style, wxDefaultValidator, name ) ) return false; SetPeer(wxWidgetImpl::CreateStaticText( this, parent, id, label, pos, size, style, GetExtraStyle() )); MacPostControlCreate( pos, size ); SetLabel(label); if ( HasFlag(wxST_NO_AUTORESIZE) ) { // Normally this is done in SetLabel() below but we avoid doing it when // this style is used, so we need to explicitly do it in the ctor in // this case or otherwise the control would retain its initial tiny size. InvalidateBestSize(); SetInitialSize(size); } return true; }