Insets MyFrame::GetInsetsForStaticBox( Container* pStaticBox ) { Dimension dim = pStaticBox->getMinimumSize(); // FOR NOW::... return Insets( dim.height,10, 10,10 ); }
StyledTextBox::StyledTextBox(wxWindow* parent, wxString text, wxStandardID id) : StyledWindow(parent, text ,id) { pimpl = std::make_shared<StyledTextBoxImpl>(); SetWindowStyle(GetWindowStyle() | wxWANTS_CHARS); SetRenderer(std::make_shared<StyledTextBoxRenderer>()); SetInsets(Insets(3, 3, 3, 3)); SetMinSize(wxSize(0, 22)); }
Button_t::Button_t() : insets(Insets(0, 0, 0, 0)), ActionComponent_t(this) { enabled = true; pathToLoad = false; shapeColor = ARGB(255, 230, 230, 230); border = RGB(160, 160, 160); addChild(&label); label.setAlignment(TextAlignment::CENTER); }
void MagicView::SetFocusModelView(int f) { if (view_mode == VIEW_ALL) { view_focus = f; for (int row = 0; row < 2; row++) { for (int col = 0; col < 2; col++) { int index = 2*row + col; ActiveWindow* win = view_win[index]; win->Show(); win->SetCells(col, row, 1, 1); win->SetCellInsets(Insets(1,1,1,1)); if (index == view_focus) { win->SetStyle(WIN_WHITE_FRAME); } else { win->SetStyle(WIN_BLACK_FRAME); } } } } else if (IsUVEdit()) { view_focus = view_mode; } else { view_mode = f; view_focus = f; for (int i = 0; i < 4; i++) { ActiveWindow* win = view_win[i]; if (i == view_mode) { win->Show(); win->SetCells(0,0,2,2); win->SetStyle(WIN_WHITE_FRAME); } else { win->Hide(); win->SetCells(0,0,0,0); win->SetStyle(WIN_BLACK_FRAME); } } } main_win->DoLayout(); }
void SourceWindow::Recreate() { if ( mpParent ) { mpParent->removeAll(); mpParent->dispose(); delete mpParent; } Container* parent = new Container( this ); SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE)); parent->setLayout( new GridBagLayout() ); GridBagConstraints c; c.fill = GridBagConstraints::BOTH; c.weightx = 1.0; c.weighty = 1.0; #ifdef __WINDOWS__ || 1 mpBox = new wxStaticBox( this, -1, mSrcName ); #else // under my wxGtk, wxStaticBox'es crash... mpBox = new wxPanel( this, -1 ); #endif Container* boxPanel = new Container( mpBox ); boxPanel->setInsets( Insets( 20,10, 10,10 ) ); parent->add( boxPanel, &c ); mpSrc = new wxTextCtrl( mpBox, -1, "", wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY | wxHSCROLL ); boxPanel->setLayout( new GridBagLayout() ); c.fill = GridBagConstraints::BOTH; c.weightx = 1.0; c.weighty = 1.0; c.gridwidth = GridBagConstraints::REMAINDER; boxPanel->add( new Component( mpSrc ), &c ); c.gridwidth = GridBagConstraints::REMAINDER; c.fill = GridBagConstraints::NONE; c.weighty = 0.0; c.insets.top = 10; c.ipady = 3; // button seems to small in height without this boxPanel->add( new wxButton( mpBox, wxID_CLOSE, "&Close", wxDefaultPosition, wxSize( 70, 30 ) ), &c ); parent->doLayout(); mpParent = parent; wxFont font; #if defined(__WXMSW__) || defined(__WINDOWS__) font.SetFaceName("Courier"); font.SetPointSize( 9 ); font.RealizeResource(); #else font = wxSystemSettings::GetSystemFont(wxSYS_OEM_FIXED_FONT); font.SetStyle(wxNORMAL); font.SetWeight(wxNORMAL); font.SetPointSize( 9); #endif this->SetFont( font ); }
void ConfigDialog::AddControls() { Container* parent = new Container( this ); parent->setLayout( new GridBagLayout() ); Container* fieldsPanel = new Container(); fieldsPanel->setLayout( new GridBagLayout() ); GridBagConstraints c; c.gridwidth = 1; c.insets = Insets( 5,5, 5,5 ); c.fill = GridBagConstraints::HORIZONTAL; int rmd = GridBagConstraints::REMAINDER; int y = 0; c.gridy = y++; fieldsPanel->add( new wxStaticText( this,-1,"hgap:" ), &c ); c.gridwidth = rmd; fieldsPanel->add( MakeField( mpHgap ), &c ); c.gridwidth = 1; c.gridy = y++; fieldsPanel->add( new wxStaticText( this,-1, "vgap:" ), &c ); c.gridwidth = rmd; fieldsPanel->add( MakeField( mpVgap ), &c ); c.gridwidth = 1; c.gridy = y++; fieldsPanel->add( new wxStaticText( this,-1, "inset.left:" ), &c ); c.gridwidth = rmd; fieldsPanel->add( MakeField( mpLeft ), &c ); c.gridwidth = 1; c.gridy = y++; fieldsPanel->add( new wxStaticText( this,-1, "insets.right:" ), &c ); c.gridwidth = rmd; fieldsPanel->add( MakeField( mpRight ), &c ); c.gridwidth = 1; c.gridy = y++; fieldsPanel->add( new wxStaticText( this,-1, "insets.top:" ), &c ); c.gridwidth = rmd; fieldsPanel->add( MakeField( mpTop ), &c ); c.gridwidth = 1; c.gridy = y++; fieldsPanel->add( new wxStaticText( this,-1, "insets.bottom:" ), &c ); c.gridwidth = rmd; fieldsPanel->add( MakeField( mpBottom ), &c ); c.gridwidth = 1; c.gridy = y++; fieldsPanel->add( new wxStaticText( this,-1, "Grid-rows:" ), &c ); c.gridwidth = rmd; fieldsPanel->add( MakeField( mpRowCount ), &c ); c.gridwidth = 1; c.gridy = y++; fieldsPanel->add( new wxStaticText( this,-1, "Grid-cols:" ), &c ); c.gridwidth = rmd; fieldsPanel->add( MakeField( mpColCount ), &c ); c.gridwidth = 1; c.gridy = y++; fieldsPanel->add( new wxStaticText( this,-1, "Panel-font:" ), &c ); c.gridwidth = 1; c.weightx = 1.0; fieldsPanel->add( MakeField( mpFont ), &c ); c.gridwidth = rmd; c.weightx = 0.0; fieldsPanel->add( MakeButton( "Select &font...", ID_SELECT_FONT ), &c ); c.gridwidth = 1; Container* checkPanel1 = new Container(); Container* checkPanel2 = new Container(); Container* checkPanel3 = new Container(); Container* btnPanel = new Container(); c.weightx = 1.0; c.gridx = 0; c.gridy = y++; parent->add( fieldsPanel, &c ); c.gridwidth = rmd; c.insets.left = 10; c.gridx = 0; c.gridy = y++; parent->add( checkPanel1, &c ); c.gridwidth = rmd; c.gridy = y++; parent->add( checkPanel2, &c ); c.gridy = y++; parent->add( checkPanel3, &c ); c.gridy = y++; parent->add( new wxStaticText( this,-1, "(Note: this dialog is also resizable)" ), &c ); c.gridy = y++; parent->add( btnPanel, &c ); checkPanel1->setLayout( new BoxLayout( BoxLayout::X_AXIS ) ); checkPanel2->setLayout( new BoxLayout( BoxLayout::X_AXIS ) ); checkPanel3->setLayout( new BoxLayout( BoxLayout::X_AXIS ) ); c.insets.left = 10; checkPanel1->add( MakeCheckBox( "Use light-wieght comp. ", mpUseLightWeight ) ); checkPanel1->add( MakeCheckBox( "Use double-buffering.", mpUseDoubleBuf ) ); checkPanel2->add( MakeCheckBox( "Show source for layout.", mpShowSrcCode ) ); checkPanel2->add( MakeCheckBox( "Auto-pack layout.", mpAutoPack ) ); checkPanel3->add( MakeCheckBox( "Enable \"2-Phase layouting\" feature.", mpUseTwoPhase ) ); btnPanel->setLayout( new FlowLayout() ); btnPanel->add( MakeButton( "&Apply", wxID_APPLY ) ); btnPanel->add( MakeButton( "Apply && &return", ID_APPLY_AND_EXIT ) ); btnPanel->add( MakeButton( "&Cancel", wxID_CANCEL ) ); btnPanel->add( MakeButton( "&View dlg-source", ID_SHOW_DLG_SOURCE ) ); mpFont->Enable( FALSE ); if ( !_gCfgDlgSizeAdjusted ) { // for packing dialog initially use only 1-phase layouting // to let buttons in FlowLayout'ed btnPanel strech within\ in a single row parent->setTwoPhaseLayoutingGlobally(FALSE); parent->pack(); // for the other resizing do it the "featured" way parent->setTwoPhaseLayoutingGlobally(TRUE); } }
void MyFrame::Test_All_2( wxCommandEvent& event ) { RemoveAll(); SetTestName( "Test_All_2" ); parent = new Container( this ); SetCurrentContainer( parent ); parent->setLayout( new GridBagLayout() ); GridBagConstraints c; c.weightx = 1.0; c.weighty = 1.0; c.fill = GridBagConstraints::BOTH; c.gridwidth = GridBagConstraints::REMAINDER; c.insets = Insets( 5,10,2,10 ); Container* imagePanel = new Container(); parent->add( imagePanel, &c ); imagePanel->setLayout( new FlowLayout() ); for( int i = 0; i != 15; ++i ) { Component* pComp = MakeButton( "< " + IntToStr( i + 1 ) + " >" ); pComp->setMinimumSize( Dimension( 60,60 ) ); imagePanel->add( pComp ); } c.weighty = 0.0; c.fill = GridBagConstraints::VERTICAL; c.insets.top = 2; parent->add( MakeLabel( "---- Purchase A Fine Image Today -----" ), &c ); c.insets.top = 5; c.fill = GridBagConstraints::BOTH; Container* infoPanel = MakeStaticBox( "" ); Container* btnPanel = new Container(); parent->add( infoPanel, &c ); parent->add( btnPanel, &c ); btnPanel->setLayout( new FlowLayout() ); btnPanel->add( MakeButton( "&Purchase" ) ); btnPanel->add( MakeButton( "&Cancel" ) ); infoPanel->setLayout( new GridBagLayout() ); infoPanel->setInsets( GetInsetsForStaticBox( infoPanel ) ); SetCurrentContainer( infoPanel ); int rmd = GridBagConstraints::REMAINDER; c.insets = Insets( 5,5, 0,0 ); c.fill = GridBagConstraints::HORIZONTAL; c.weightx = 0.0; c.gridx = 0; c.gridy = 0; infoPanel->add( MakeLabel( "Name:" ), &c ); c.gridwidth = rmd; c.weightx = 1.0; c.gridwidth = 3; infoPanel->add( MakeTextField( "" ), &c ); c.gridwidth = 0; c.weightx = 0.0; c.gridx = 0; c.gridy = 1; infoPanel->add( MakeLabel( "Address:" ), &c ); c.gridwidth = rmd; c.weightx = 1.0; c.gridwidth = 3; infoPanel->add( MakeTextField( "" ), &c ); c.gridwidth = 0; c.weightx = 0.0; c.gridx = 0; c.gridy = 2; infoPanel->add( MakeLabel( "City:" ), &c ); c.weightx = 1.0; infoPanel->add( MakeTextField( "" ), &c ); c.weightx = 0.0; infoPanel->add( MakeLabel( "State:" ), &c ); infoPanel->add( MakeTextField( "" ), &c ); char* methods[] = { "Visa", "MasterCard", "Check" }; c.weightx = 0.0; c.gridx = 0; c.gridy = 3; infoPanel->add( MakeLabel( "Payment:" ), &c ); c.weightx = 0.0; c.fill = GridBagConstraints::NONE; c.anchor = GridBagConstraints::WEST; infoPanel->add( MakeComboBox( methods, sizeof(methods)/sizeof(char*) ), &c ); // no auto-packing for this panel... // (so many images in flow-layout may cause default width to be too big) parent->doLayout(); }
void MyFrame::Test_All_1( wxCommandEvent& event ) { RemoveAll(); SetTestName( "Test_All_1" ); parent = new Container( this ); SetCurrentContainer( parent ); parent->setLayout( new GridBagLayout() ); GridBagConstraints c; c.weightx = 1.0; c.weighty = 1.0; c.fill = GridBagConstraints::BOTH; c.gridwidth = GridBagConstraints::REMAINDER; Container* sortPanel = MakeStaticBox( "Filtering options: (in GridBagLayout)" ); Container* btnPanel = new Container(); parent->add( sortPanel, &c ); c.weighty = 0.0; parent->add( btnPanel, &c ); btnPanel->setLayout( new FlowLayout() ); btnPanel->setInsets( Insets( 10,10, 10,10 ) ); btnPanel->add( MakeLabel( "Buttons:" ) ); btnPanel->add( MakeButton( "&Apply" ) ); btnPanel->add( MakeButton( "&Cancel" ) ); btnPanel->add( MakeButton( "&Help" ) ); btnPanel->add( MakeLabel( "in a FlowLayout" ) ); SetCurrentContainer( sortPanel ); sortPanel->setInsets( GetInsetsForStaticBox( sortPanel ) ); // creating "Resolution" panel sortPanel->setLayout( new GridBagLayout() ); char* resValues[] = { "FIXED", "INVALID", "WONTFIX", "LATER", "REMIND", "DUPLICATE", "WORKSFORME" }; char* pltfValues[] = { "All", "DEC", "HP", "Macintosh", "PC", "SGI", "Sun", "Other" }; char* opSysValues[] = { "All", "Windows 3.1", "Windows 95", "Windows 98", "Windows NT", "Mac Sys7", "Mac Sys7.5", "Mac Sys7.6.1", "Mac Sys8.0", "Mac Sys7", "Mac Sys8.5", "Mac Sys8.6", "Aix", "BSD", "IRIX", "Linux", "FreeBSD", "NetBSD", "OSF/1", "SOLARIS", "SunOS", "Neutrino", "OS/2", "OpenVMS", "other" }; char* compValues[] = { "Not applied", "wxGrid", "wxHTML", "wxMedia", "wxLayout", "wxDialupManager", "wxFrameLayout" }; char* severValues[] = { "Blocker", "Critical", "Major", "Minor", "Trivial", "Enhancement", "Showstopper" }; char* priValues[] = { "P1", "P2", "P3", "P4", "P5" }; int resCnt = sizeof( resValues ) / sizeof(char*); int pltfCnt = sizeof( pltfValues ) / sizeof(char*); int opSysCnt = sizeof( opSysValues ) / sizeof(char*); int compCnt = sizeof( compValues ) / sizeof(char*); int svrCnt = sizeof( severValues ) / sizeof(char*); int priCnt = sizeof( priValues ) / sizeof(char*); c.weightx = 1.0; c.fill = GridBagConstraints::BOTH; c = GridBagConstraints(); // reset defauls c.fill = GridBagConstraints::BOTH; int rel = GridBagConstraints::RELATIVE; c.weightx = 1.0; c.insets.left = 2; c.insets.right = 2; c.gridx = 1; c.gridy = 1; sortPanel->add( MakeListBox ( resValues, resCnt ), &c ); c.gridx = 2; c.gridwidth = 2; sortPanel->add( MakeListBox ( severValues, svrCnt ), &c ); c.gridx = 4; c.gridwidth = 1; sortPanel->add( MakeListBox ( priValues, priCnt ), &c ); c.gridy = 3; c.gridx = 1; c.weighty = 1.0; c.gridwidth = 2; sortPanel->add( MakeListBox ( compValues, compCnt ), &c ); c.gridx = 3; sortPanel->add( MakeListBox ( pltfValues, pltfCnt ), &c ); c.gridwidth = 1; c.gridx = 0; c.gridy = 1; c.weighty = 1.0; c.gridheight = GridBagConstraints::REMAINDER; sortPanel->add( MakeListBox ( opSysValues, opSysCnt ), &c ); c.gridx = 0; c.gridy = 0; c.gridheight = 1; c.weighty = 0.0; sortPanel->add( MakeCheckBox( "OpSys" ), &c ); c.gridx = 1; sortPanel->add( MakeCheckBox( "Resolution" ), &c ); c.gridx = 2; c.gridwidth = 2; sortPanel->add( MakeCheckBox( "Severity" ), &c ); c.gridx = 4; c.gridwidth = 0; sortPanel->add( MakeCheckBox( "Priority" ), &c ); c.gridx = 1; c.gridy = 2; c.gridwidth = 2; sortPanel->add( MakeCheckBox( "Component" ), &c ); c.gridx = 3; sortPanel->add( MakeCheckBox( "Platform" ), &c ); c.gridwidth = 0; Container* keywordsPanel = MakeStaticBox( "Contain Keywords: (in another grid-bag)" ); keywordsPanel->setInsets( GetInsetsForStaticBox( keywordsPanel ) ); c.gridx = 1; c.gridy = 4; c.insets.top = 5; c.gridwidth = GridBagConstraints::REMAINDER; c.weighty = 0.0; sortPanel->add( keywordsPanel, &c ); keywordsPanel->setLayout( new GridBagLayout() ); SetCurrentContainer( keywordsPanel ); c = GridBagConstraints(); // reset defauls c.anchor = GridBagConstraints::NORTHWEST; c.gridx = 0; c.gridy = 0; keywordsPanel->add( MakeRadioButton( "Up", TRUE ), &c ); c.gridx = 0; c.gridy = 1; keywordsPanel->add( MakeRadioButton( "Down" ), &c ); c.gridx = 0; c.gridy = 2; keywordsPanel->add( MakeRadioButton( "Start" ), &c ); c.fill = GridBagConstraints::BOTH; c.gridx = 1; c.gridy = 0; c.weightx = 1.0; c.weighty = 1.0; c.gridheight = 3; keywordsPanel->add( MakeTextField( "p1, fixed, bcc" ), &c ); if ( mCfg.mAutoPack ) parent->pack(); else parent->doLayout(); }
void MagicView::SetupModelViews() { switch (view_mode) { case VIEW_ALL: { for (int row = 0; row < 2; row++) { for (int col = 0; col < 2; col++) { int index = 2*row + col; ActiveWindow* win = view_win[index]; win->Show(); win->SetCells(col, row, 1, 1); win->SetCellInsets(Insets(1,1,1,1)); } } uvmap_win->Hide(); uvmap_win->SetCells(0,0,0,0); } break; case VIEW_TOP: case VIEW_SIDE: case VIEW_FRONT: case VIEW_PERSPECTIVE: { view_focus = view_mode; for (int i = 0; i < 4; i++) { ActiveWindow* win = view_win[i]; if (i == view_mode) { win->Show(); win->SetCells(0,0,2,2); win->SetStyle(WIN_WHITE_FRAME); } else { win->Hide(); win->SetCells(0,0,0,0); win->SetStyle(WIN_BLACK_FRAME); } } uvmap_win->Hide(); uvmap_win->SetCells(0,0,0,0); } break; case VIEW_UV_MAP: { view_focus = view_mode; for (int i = 0; i < 4; i++) { ActiveWindow* win = view_win[i]; win->Hide(); win->SetCells(0,0,0,0); win->SetStyle(WIN_BLACK_FRAME); } uvmap_win->Show(); uvmap_win->SetCells(0,0,2,2); } break; default: break; } main_win->DoLayout(); }
void MagicView::OnInitialUpdate() { CView::OnInitialUpdate(); Color::SetPalette(standard_palette, 256, inverse_palette); if (!video_settings) video_settings = new VideoSettings; GetClientRect(&client_rect); // Use client area to set video window size int w = client_rect.right - client_rect.left; int h = client_rect.bottom - client_rect.top; video_settings->is_windowed = true; video_settings->window_width = w; video_settings->window_height = h; if (!video) { video = new VideoDX9(GetSafeHwnd(), video_settings); *video_settings = *video->GetVideoSettings(); if (video) { Color::UseVideo(video); video->UseXFont("System", 12, false, false); screen = new Screen(video); if (!screen) { ::Print("ERROR: Could not create Screen object.\n"); return; } ::Print(" Created screen object (%d x %d).\n", w, h); if (!screen->SetBackgroundColor(Color::Black)) ::Print(" WARNING: could not set video background color to Black\n"); screen->ClearAllFrames(true); ::Print(" Established requested video parameters.\n"); ::Print(" ---------------------------------------\n\n"); if (!scene) { scene = new Scene; scene->SetAmbient(Color(60,60,60)); Point light_pos(3e6, 5e6, 4e6); main_light = new Light(1.0f); //1.25f); main_light->MoveTo(light_pos); main_light->SetType(Light::LIGHT_DIRECTIONAL); main_light->SetColor(Color::White); main_light->SetShadow(true); scene->AddLight(main_light); back_light = new Light(0.5f); back_light->MoveTo(light_pos * -1); back_light->SetType(Light::LIGHT_DIRECTIONAL); back_light->SetColor(Color::White); scene->AddLight(back_light); Selection* seln = GetDocument()->GetSelection(); Selector* selector = GetDocument()->GetSelector(); if (seln && selector) { scene->Graphics().clear(); scene->AddGraphic(seln); scene->AddGraphic(selector); selector->UseModel(0); } } int mins[2] = { 0, 0 }; float weights[2] = { 1, 1 }; main_win = new ActiveWindow(screen, 0, 0, w, h, 100, 0); main_win->UseLayout(2, 2, mins, mins, weights, weights); main_win->SetBackColor(Color::Gray); screen->AddWindow(main_win); DWORD view_types[] = { ModelView::VIEW_PLAN, ModelView::VIEW_PROJECT, ModelView::VIEW_SIDE, ModelView::VIEW_FRONT }; for (int row = 0; row < 2; row++) { for (int col = 0; col < 2; col++) { int index = 2*row + col; ActiveWindow* win = new ActiveWindow(screen, col*w/2, row*h/2, w/2, h/2, 101+index, WIN_BLACK_FRAME, main_win); win->SetCells(col, row, 1, 1); win->SetCellInsets(Insets(1,1,1,1)); win->SetBackColor(Color(160,160,160)); ModelView* mv = new ModelView(win, scene, view_types[index]); if (view_types[index] == ModelView::VIEW_PROJECT) mv->SetFillMode(ModelView::FILL_TEXTURE); mv->UseGrid(grid); win->AddView(mv); view_win[index] = win; model_view[index] = mv; } } view_win[0]->SetStyle(WIN_WHITE_FRAME); uvmap_win = new ActiveWindow(screen, 0, 0, w, h, 110, WIN_BLACK_FRAME, main_win); uvmap_view = new UVMapView(uvmap_win); uvmap_win->AddView(uvmap_view); main_win->DoLayout(); } else { ::Print(" Could not establish requested video parameters.\n"); ::Print(" -----------------------------------------------\n\n"); } } }