// Constructor. Creates GTK widgets. EntityClassChooser::EntityClassChooser () : _widget(gtk_window_new(GTK_WINDOW_TOPLEVEL)), _treeStore(NULL), _selection(NULL), _addButton(NULL) { gtk_window_set_transient_for(GTK_WINDOW(_widget), GlobalRadiant().getMainWindow()); gtk_window_set_modal(GTK_WINDOW(_widget), TRUE); gtk_window_set_position(GTK_WINDOW(_widget), GTK_WIN_POS_CENTER_ON_PARENT); gtk_window_set_title(GTK_WINDOW(_widget), ECLASS_CHOOSER_TITLE); // Set the default size of the window GdkScreen* scr = gtk_window_get_screen(GTK_WINDOW(_widget)); gint w = gdk_screen_get_width(scr); gint h = gdk_screen_get_height(scr); gtk_window_set_default_size(GTK_WINDOW(_widget), w / 3, h / 2); // Create GUI elements and pack into main VBox GtkWidget* vbx = gtk_vbox_new(FALSE, 3); gtk_box_pack_start(GTK_BOX(vbx), createTreeView(), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbx), createUsagePanel(), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbx), createButtonPanel(), FALSE, FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(_widget), 12); gtk_container_add(GTK_CONTAINER(_widget), vbx); // Signals g_signal_connect(_widget, "delete_event", G_CALLBACK(callbackHide), this); }
void FilterEditor::populateWindow() { // Create the dialog vbox GtkWidget* vbox = gtk_vbox_new(FALSE, 6); // Create the name entry box gtk_box_pack_start(GTK_BOX(vbox), gtkutil::LeftAlignedLabel(std::string("<b>") + _("Name") + "</b>"), FALSE, FALSE, 0); _widgets[WIDGET_NAME_ENTRY] = gtk_entry_new(); gtk_box_pack_start(GTK_BOX(vbox), gtkutil::LeftAlignment(_widgets[WIDGET_NAME_ENTRY], 18, 1), FALSE, FALSE, 0); g_signal_connect(G_OBJECT(_widgets[WIDGET_NAME_ENTRY]), "changed", G_CALLBACK(onNameEdited), this); // And the rule treeview gtk_box_pack_start(GTK_BOX(vbox), gtkutil::LeftAlignedLabel(std::string("<b>") + _("Rules") + "</b>"), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), createCriteriaPanel(), TRUE, TRUE, 0); // Add the help text if (!_viewOnly) { _widgets[WIDGET_HELP_TEXT] = gtkutil::LeftAlignedLabel(_(RULE_HELP_TEXT)); gtk_box_pack_start(GTK_BOX(vbox), _widgets[WIDGET_HELP_TEXT], FALSE, FALSE, 0); } // Buttons gtk_box_pack_start(GTK_BOX(vbox), createButtonPanel(), FALSE, FALSE, 0); gtk_container_add(GTK_CONTAINER(getWindow()), GTK_WIDGET(vbox)); }
void ColormapEditWidget::updateWidget() { if( m_buttonPanel->layout() ) { QWidget().setLayout( m_buttonPanel->layout() ); } m_buttonPanel->setLayout( createButtonPanel() ); }
PreferencesDialog::PreferencesDialog(wxWindow* parent) : wxDialog(parent, wxID_ANY, wxT("Preferences")) { wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); SetSizer(sizer); wxPanel* top = createTopPanel(this); wxPanel* bottom = createButtonPanel(this); sizer->Add(top); sizer->Add(bottom, wxSizerFlags().Center()); Fit(); }
void ColormapEditWidget::redrawWidget() { if( layout() ) { QWidget().setLayout( layout() ); } QVBoxLayout* vLayout = new QVBoxLayout(); vLayout->setContentsMargins( 1, 1, 1, 1 ); vLayout->setSpacing( 1 ); setLayout( vLayout ); QHBoxLayout* hLayoutTop = new QHBoxLayout(); m_nameEdit = new EditWithLabel( "name" ); m_nameEdit->setText( ColormapFunctions::get( m_selected).getName() ); m_sel = new SelectWithLabel( "colormap", 0 ); for ( int k = 0; k < ColormapFunctions::size(); ++k ) { m_sel->insertItem( k, ColormapFunctions::get( k ).getName() ); } m_sel->setCurrentIndex( m_selected ); connect( m_sel, SIGNAL( currentIndexChanged( int, int ) ), this, SLOT( selectionChanged( int) ) ); hLayoutTop->addWidget( m_nameEdit ); hLayoutTop->addWidget( m_sel ); vLayout->addLayout( hLayoutTop ); m_buttonPanel = new QWidget(); m_buttonPanel->setLayout( createButtonPanel() ); QScrollArea* scrollArea = new QScrollArea( this ); scrollArea->setWidgetResizable( true ); scrollArea->setWidget( m_buttonPanel ); vLayout->addWidget( scrollArea ); QHBoxLayout* hLayout5 = new QHBoxLayout(); hLayout5->addStretch(); CheckBox* contUpdating = new CheckBox( tr("continuous updating") ); contUpdating->setChecked( false ); contUpdating->setChecked( m_contUpdating ); connect( contUpdating, SIGNAL( stateChanged( int, int ) ), this, SLOT( contUpdatingChanged( int ) ) ); hLayout5->addWidget( contUpdating ); QPushButton* updateButton = new QPushButton( tr("update") ); connect( updateButton, SIGNAL( clicked() ), this, SLOT( update() ) ); hLayout5->addWidget( updateButton ); QPushButton* saveButton = new QPushButton( tr("save new") ); connect( saveButton, SIGNAL( clicked() ), this, SLOT( save() ) ); hLayout5->addWidget( saveButton ); vLayout->addLayout( hLayout5 ); QHBoxLayout* hLayout6 = new QHBoxLayout(); hLayout6->addStretch(); QPushButton* deleteButton = new QPushButton( tr("delete") ); connect( deleteButton, SIGNAL( clicked() ), this, SLOT( deleteCM() ) ); hLayout6->addWidget( deleteButton ); vLayout->addLayout( hLayout6 ); layout()->setContentsMargins( 1, 1, 1, 1 ); layout()->setSpacing( 1 ); repaint(); }