gui::ImageSpace::ImageSpace() { set_border_width(BORDER_WIDTH); originalImage_.set_label("Original Image"); currentImage_.set_label("Current Image"); pack1(originalImage_, false, false); pack2(currentImage_, false, false); show_all_children(); }
gui::Workspace::Workspace() : imageSpace_(), toolBox_(imageSpace_.getOriginalImage(), imageSpace_.getCurrentImage()) { set_border_width(BORDER_WIDTH); pack_start(imageSpace_, true, true); pack_end(toolBox_, false, false); show_all_children(); }
DLWindow::DLWindow(DLControler *controler) : DLMatrixHelper(controler->getSize()), controler(controler), size(controler->getSize()), picSize((Gdk::Screen::get_default()->get_width() < Gdk::Screen::get_default()->get_height() ? Gdk::Screen::get_default()->get_width() : Gdk::Screen::get_default()->get_height() - ((Gdk::Screen::get_default()->get_width() < Gdk::Screen::get_default()->get_height() ? Gdk::Screen::get_default()->get_width() : Gdk::Screen::get_default()->get_height()*25) /100))/size), pixBufDog(Gdk::Pixbuf::create_from_file("./res/dog.png", picSize, picSize,false)), pixBufFlea(Gdk::Pixbuf::create_from_file("./res/flea.png", picSize, picSize,false)), pixBufVoid(Gdk::Pixbuf::create_from_file("./res/void.png", picSize, picSize,false)), pixBufVictory(Gdk::Pixbuf::create_from_file("./res/victory.png")), grid(), nbFlea(controler->getNbrFlea()), box(Gtk::ORIENTATION_VERTICAL), nbRun(0), buttonStart("Start") { tab = new char[size*size]; for (int i = 0; i < size*size; ++i) { tab[i] = '_'; } buttonStart.signal_clicked().connect(sigc::mem_fun(*this, &DLWindow::startButtonClicked)); set_border_width(10); add(box); box.pack_start(grid); box.pack_start(buttonStart); grid.override_background_color(Gdk::RGBA("black")); for (int i = 0; i < size*size; ++i) { listPixVoid.push_back(this->createImage(pixBufVoid)); } for (int i = 0; i < nbFlea; ++i) { listPixFlea.push_back(this->createImage(pixBufFlea)); } pictureDog = this->createImage(pixBufDog); pictureVictory = this->createImage(pixBufVictory); pictureVictory->show(); for (int i = 0; i < size; ++i) { for (int j = 0; j < size; ++j) { grid.attach(*listPixVoid[this->convert(i,j)], i,j,1,1); } } this->flushGrid(); this->update(tab); this->show_all_children(true); }
MiApp1::MiApp1() : // Gtk_Window(GTK_WINDOW_TOPLEVEL) : not needed, // GTK_WINDOW_TOPLEVEL is the constructor arg's default value v_box( false, 0 ), m_box1(), // creates a box to pack widgets into m_button1("Run"), m_button2("Quit"), aCanvas(), aLine1(aCanvas, Gdk_Color("#00000000cd00")), aLine2(aCanvas, Gdk_Color("#ff0045000000")) { // this is a new call, this just sets the title of our new window to // "Hello Buttons!" set_title("Draw on a Canvas"); // sets the border width of the window. set_border_width(10); // Sets window size set_usize( 640, 400); // Create the vertical vbox add(&v_box); // put the box into the main window. v_box.pack_start(m_box1, false, true, 0); // Now when the button is clicked, we call the "callback" function // with a pointer to "button 1" as it's argument connect_to_method(m_button1.clicked, this, &run ); // instead of gtk_container_add, we pack this button into the invisible // box, which has been packed into the window. // note that the pack_start default arguments are true, true, 0 m_box1.pack_start(m_button1, false, true, 0); // always remember this step, this tells GTK that our preparation // for this button is complete, and it can be displayed now. m_button1.show(); // call the same callback function with a different argument, // passing a pointer to "button 2" instead. connect_to_method(m_button2.clicked, Gtk_Main::instance(), &Gtk_Main::quit ); m_box1.pack_start(m_button2, false, true, 0); // The order in which we show the buttons is not really important, // but I recommend showing the window last, so it all pops up at // once. m_button2.show(); v_box.pack_end(aCanvas, true, true, 0); // now show show_all(); aCanvas.draw(); }
HelloWorld::HelloWorld() :m_button("Hello World") { set_border_width(10); m_button.signal_clicked().connect(sigc::mem_fun(*this, &HelloWorld::on_button_clicked)); add(m_button); m_button.show(); }
gui::PlotWindow::PlotWindow(const std::string title, const std::vector<int>& data) : plotArea_(data) { set_title(title); set_resizable(false); set_size_request(256 + BORDER_WIDTH, 256 + BORDER_WIDTH); set_border_width(BORDER_WIDTH); add(plotArea_); plotArea_.show(); }
gui::ToolBox::ToolBox(const Gtk::Image& original, Gtk::Image& current) : Gtk::Frame(FRAME_LABEL), buttonBox_(Gtk::ORIENTATION_VERTICAL), imageOriginal_( original), imageCurrent_(current) { set_border_width(BORDER_WIDTH); histogramWindow_ = nullptr; initButtons(); connectAll(); addAll(); show_all_children(); }
Example_MarkerComboBox::Example_MarkerComboBox() { set_title("Marker Combo Box"); set_border_width(10); this->add( m_MarkerComboBox ); show_all(); }
BreadCrumb(const Raul::Path& path, SPtr<GraphView> view = SPtr<GraphView>()) : _path(path) , _view(view) { assert(!view || view->graph()->path() == path); set_border_width(0); set_path(path); set_can_focus(false); show_all(); }
Gobby::PreferencesDialog::Page::Page(): Gtk::Frame(), m_box(false, 12) { Gtk::Frame::add(m_box); m_box.show(); // Remove shadow - use the frame just as container set_shadow_type(Gtk::SHADOW_NONE); set_border_width(12); }
Example_StrokeWidget::Example_StrokeWidget() { set_title("Line Style Widget"); set_border_width(10); this->add( m_StrokeWidget ); show_all(); }
GUIWindow::GUIWindow() : bigbox(Gtk::ORIENTATION_VERTICAL, 15), filebox(Gtk::ORIENTATION_HORIZONTAL, 5), sizebox(Gtk::ORIENTATION_VERTICAL, 5) { resLevel = 3; set_border_width(10); bigbox.set_homogeneous(false); filebox.set_homogeneous(false); set_size_request(400, 600); set_title("Mosaic Masterpiece"); add(bigbox); filename.set_max_length(300); filename.set_text("Pick an image..."); tags.set_text("Tags..."); tags.set_max_length(300); browse.set_label("Browse..."); close.set_label("Close"); run.set_label("RUN!"); low.set_label("Low"); med.set_label("Medium"); high.set_label("High"); sizegroup = low.get_group(); med.set_group(sizegroup); high.set_group(sizegroup); high.set_active(true); run.signal_clicked().connect(sigc::mem_fun(*this, &GUIWindow::OnRun)); close.signal_clicked().connect(sigc::mem_fun(*this, &GUIWindow::OnClose)); low.signal_clicked().connect(sigc::mem_fun(*this, &GUIWindow::LowRes)); med.signal_clicked().connect(sigc::mem_fun(*this, &GUIWindow::MedRes)); high.signal_clicked().connect(sigc::mem_fun(*this, &GUIWindow::HighRes)); status.set_label("Waiting for a picture..."); //filebox.pack_start(filename); //filebox.pack_start(run); sizebox.pack_start(low); sizebox.pack_start(med); sizebox.pack_start(high); bigbox.pack_start(status); bigbox.pack_start(filename); bigbox.pack_start(browse); bigbox.pack_start(sizebox); bigbox.pack_start(tags); bigbox.pack_start(run); bigbox.pack_start(close); show_all_children(); mm.OpenPipe(); }
BuilderFrame() { set_shadow_type(Gtk::SHADOW_ETCHED_IN); set_border_width(5); m_Label = Gtk::manage(new Gtk::Label()); m_Label->set_padding(3, 0); m_Label->set_visible(true); set_label_widget(*m_Label); }
ClassEditor::ClassEditor(StimTypes& stimTypes) : Gtk::VBox(false, 6), _stimTypes(stimTypes), _updatesDisabled(false) { set_border_width(6); _list = Gtk::manage(new Gtk::TreeView); _list->set_size_request(TREE_VIEW_WIDTH, TREE_VIEW_HEIGHT); // Connect the signals to the callbacks _list->get_selection()->signal_changed().connect(sigc::mem_fun(*this, &ClassEditor::onSRSelectionChange)); _list->signal_key_press_event().connect(sigc::mem_fun(*this, &ClassEditor::onTreeViewKeyPress), false); _list->signal_button_release_event().connect( sigc::bind(sigc::mem_fun(*this, &ClassEditor::onTreeViewButtonRelease), _list)); // Add the columns to the treeview // ID number Gtk::TreeViewColumn* numCol = Gtk::manage(new Gtk::TreeViewColumn("#")); Gtk::CellRendererText* numRenderer = Gtk::manage(new Gtk::CellRendererText); numCol->pack_start(*numRenderer, false); numCol->add_attribute(numRenderer->property_text(), SREntity::getColumns().index); numCol->add_attribute(numRenderer->property_foreground(), SREntity::getColumns().colour); _list->append_column(*numCol); // The S/R icon Gtk::TreeViewColumn* classCol = Gtk::manage(new Gtk::TreeViewColumn(_("S/R"))); Gtk::CellRendererPixbuf* pixbufRenderer = Gtk::manage(new Gtk::CellRendererPixbuf); classCol->pack_start(*pixbufRenderer, false); classCol->add_attribute(pixbufRenderer->property_pixbuf(), SREntity::getColumns().srClass); _list->append_column(*classCol); // The Type Gtk::TreeViewColumn* typeCol = Gtk::manage(new Gtk::TreeViewColumn(_("Type"))); Gtk::CellRendererPixbuf* typeIconRenderer = Gtk::manage(new Gtk::CellRendererPixbuf); typeCol->pack_start(*typeIconRenderer, false); typeCol->add_attribute(typeIconRenderer->property_pixbuf(), SREntity::getColumns().icon); Gtk::CellRendererText* typeTextRenderer = Gtk::manage(new Gtk::CellRendererText); typeCol->pack_start(*typeTextRenderer, false); typeCol->add_attribute(typeTextRenderer->property_text(), SREntity::getColumns().caption); typeCol->add_attribute(typeTextRenderer->property_foreground(), SREntity::getColumns().colour); _list->append_column(*typeCol); }
Example_AffineController::Example_AffineController() { set_title("Selector Example"); set_border_width(10); Gtk::Table* table = Gtk::manage( new Gtk::Table() ); // Create the selector m_AffineController = Papyrus::AffineController::create(); m_AffineController->add( m_Viewport.canvas() ); m_Viewport.canvas()->set_size( 300, 200 ); // Create some shapes to add to the group Papyrus::Rectangle::pointer rectangle = Papyrus::example_rectangle( ); Papyrus::Circle::pointer circle = Papyrus::example_circle( ); Papyrus::Arc::pointer arc = Papyrus::example_arc( ); Papyrus::Circle::pointer center_dot = Papyrus::Circle::create( 2.0, Papyrus::RGBA(0.0, 0.0, 0.0) ); // Add the shapes to the group m_Viewport.canvas()->add( rectangle ); m_Viewport.canvas()->add( circle ); m_Viewport.canvas()->add( arc ); m_Viewport.canvas()->add( center_dot ); // Translate the shapes so they don't necessarily overlap rectangle->set_xywh(0, -60, 50, 30); circle->translate(40, 20); circle->set_radius(25); arc->translate(0, 20); table->attach( m_Viewport, 0, 3, 0, 1 ); // Put Gtk labels and spin buttons for the various matrix effects in the table Gtk::Label* label; Gtk::Button* reset; for ( unsigned i=0; i < SCALES; i++ ) { label = Gtk::manage( new Gtk::Label( label_string[i], Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER ) ); table->attach( *label, 0, 1, i+1, i+2, Gtk::FILL ); reset = Gtk::manage( new Gtk::Button("Reset") ); reset->signal_clicked().connect( sigc::bind(sigc::mem_fun(*this, &Example_AffineController::on_reset), (Scale)i)); table->attach( *reset, 2, 3, i+1, i+2, Gtk::SHRINK, Gtk::SHRINK ); m_scale[i] = Gtk::manage( new Gtk::HScale(adjustments[i][0], adjustments[i][1], adjustments[i][2] ) ); m_scale[i]->set_value( adjustments[i][3] ); m_scale[i]->signal_value_changed().connect( sigc::bind( sigc::mem_fun(*this, &Example_AffineController::on_scale_changed), (Scale)i )); table->attach( *(m_scale[i]), 1, 2, i+1, i+2 ); } this->add( *table ); show_all(); }
main_window::main_window() : img_frame("Images"), opt_frame("Processing Options") { //create no comm image no_comm_image = Gdk::Pixbuf::create_from_xpm_data(no_comm_xpm); //initialize pictures to no_comm_image image.set(no_comm_image); processed_image.set(no_comm_image); //TODO: set url to something sane based on current IP configuration http = "http://"; ip = "10.6.12.11"; path = "/mjpg/video.mjpg"; delim = "--myboundary\r\n"; view = std::unique_ptr<camera_viewer>(new camera_viewer(http + ip + path, delim)); //setup configuration setip.signal_activate().connect(sigc::mem_fun(*this, &main_window::set_ip)); //setup menu bar menubar.prepend(configitem); configitem.set_label("Config"); configitem.set_submenu(configmenu); configmenu.prepend(setip); setip.set_label("Set Camera IP"); //set border width set_border_width(10); //setup images #ifndef USE_DEPRECATED_GTKMM_API img_box.set_orientation(Gtk::ORIENTATION_HORIZONTAL); #endif img_box.add(image); img_box.add(processed_image); img_frame.add(img_box); //setup options opt_frame.add(opts.widget()); //setup main grid #ifndef USE_DEPRECATED_GTKMM_API main_window_box.set_orientation(Gtk::ORIENTATION_HORIZONTAL); #endif main_window_box.add(img_frame); main_window_box.add(opt_frame); //setup main grid #ifndef USE_DEPRECATED_GTKMM_API main_box.set_orientation(Gtk::ORIENTATION_VERTICAL); #endif main_box.add(menubar); main_box.add(main_window_box); add(main_box); show_all(); //connect signals view->signal_lost_comm().connect(sigc::mem_fun(*this, &main_window::lost_comm)); view->signal_new_image().connect(sigc::mem_fun(*this, &main_window::new_image)); Glib::signal_idle().connect(sigc::mem_fun(*this, &main_window::idle_func)); }
RadioButtons::RadioButtons() : m_Box_Top(Gtk::ORIENTATION_VERTICAL), m_Box1(Gtk::ORIENTATION_VERTICAL, 10), m_Box2(Gtk::ORIENTATION_VERTICAL, 10), m_RadioButton1("button1"), m_RadioButton2("button2"), m_RadioButton3("button3"), m_Button_Close("close") { // Set title and border of the window set_title("radio buttons"); set_border_width(10); // Put radio buttons 2 and 3 in the same group as 1: Gtk::RadioButton::Group group = m_RadioButton1.get_group(); m_RadioButton2.set_group(group); m_RadioButton3.set_group(group); // Add outer box to the window (because the window // can only contain a single widget) add(m_Box_Top); // Put the inner boxes and the separator in the outer box: m_Box_Top.pack_start(m_Box1); m_Box_Top.pack_start(m_Separator); m_Box_Top.pack_start(m_Box2); // Set the inner boxes' borders m_Box1.set_border_width(10); m_Box2.set_border_width(10); // Put the radio buttons in Box1: m_Box1.pack_start(m_RadioButton1); m_Box1.pack_start(m_RadioButton2); m_Box1.pack_start(m_RadioButton3); // Set eh second button active m_RadioButton2.set_active(); // Put Close button in Box2 m_Box2.pack_start(m_Button_Close); // Make the button the default widget m_Button_Close.set_can_default(); m_Button_Close.grab_default(); // Connect the clicked signal of the button to // RadioButtons::on_button_clicked() m_Button_Close.signal_clicked().connect(sigc::mem_fun(*this, &RadioButtons::on_button_clicked)); // Show all children of the window show_all_children(); }//RadioButtons::RadioButtons
CreateWireframeDialog::CreateWireframeDialog(const Glib::ustring & title) : Dialog(title, true), m_filled(false), m_minVertices(false), m_coordBox(Gtk::manage(new CoordBox())), m_nameLabel(Gtk::manage(new Gtk::Label("Name: "))), m_nameEntry(Gtk::manage(new Gtk::Entry())) { set_size_request(-1, 230); set_resizable(false); set_border_width(10); // Entry for the name Gtk::HBox * const name_hbox = Gtk::manage(new Gtk::HBox()); name_hbox->pack_start(*m_nameLabel, Gtk::PACK_SHRINK, 0); name_hbox->pack_start(*m_nameEntry, Gtk::PACK_EXPAND_WIDGET, 0); name_hbox->set_spacing(0); name_hbox->set_homogeneous(false); // Check box for filling Gtk::CheckButton * const filled_button = Gtk::manage(new Gtk::CheckButton("Filled shape")); filled_button->signal_toggled().connect(sigc::mem_fun(*this, &CreateWireframeDialog::on_filled_button_toggled)); filled_button->set_active(false); get_content_area()->pack_start(*name_hbox, Gtk::PACK_SHRINK, 5); get_content_area()->pack_start(*filled_button, Gtk::PACK_SHRINK, 5); Gtk::Frame * const coord_frame = Gtk::manage(new Gtk::Frame("Points")); Gtk::ScrolledWindow * const scrolled_window = Gtk::manage(new Gtk::ScrolledWindow()); scrolled_window->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); scrolled_window->set_size_request(-1, 150); scrolled_window->set_border_width(5); scrolled_window->add(*m_coordBox); m_coordBox->set_spacing(0); coord_frame->add(*scrolled_window); get_content_area()->pack_start(*coord_frame, Gtk::PACK_SHRINK, 0); // Entries for the coordinates m_coordBox->add_coord(); m_coordBox->add_coord(); m_coordBox->add_coord(); // Add buttons (from left to right) add_button("Cancel", Gtk::RESPONSE_CANCEL); add_button("Add point", Gtk::RESPONSE_APPLY); add_button("OK", Gtk::RESPONSE_OK); signal_response().connect_notify(sigc::mem_fun(*this, &CreateWireframeDialog::on_my_response)); set_default_response(Gtk::RESPONSE_OK); show_all_children(); }
MarketBuildOptionsDialog::MarketBuildOptionsDialog(const std::string& CommonBuildOptions, const std::string& BuildOptions, const std::string FuncID) : Gtk::Dialog(), m_CommonBuildOptions(CommonBuildOptions),m_BuildOptions(BuildOptions),m_FuncID(FuncID) { set_size_request(450,-1); set_border_width(6); Gtk::Label* InfoLabel = Gtk::manage(new Gtk::Label()); InfoLabel->set_markup(std::string("<i>")+_("These options control the builds of source packages.\nChanging this is at your own risk.")+std::string("</i>")); InfoLabel->set_justify(Gtk::JUSTIFY_CENTER); get_vbox()->pack_start(*InfoLabel); Gtk::Label* CommonOptsLabel = Gtk::manage(new Gtk::Label()); if (!FuncID.empty()) CommonOptsLabel->set_markup(_("<u>Common source build options:</u>\n") +openfluid::tools::ReplaceEmptyString(CommonBuildOptions,_("<i>none</i>"))); else CommonOptsLabel->set_label(""); CommonOptsLabel->set_alignment(0,0.5); get_vbox()->pack_start(*CommonOptsLabel,Gtk::PACK_SHRINK,12); Gtk::Label* EditLabel = Gtk::manage(new Gtk::Label()); if (!FuncID.empty()) { EditLabel->set_label(_("Specific build options for ")+FuncID+_(":")); } else { EditLabel->set_label(_("Common source build options:")); } EditLabel->set_alignment(0,0.5); get_vbox()->pack_start(*EditLabel); if (FuncID.empty()) m_OptionsEntry.set_text(CommonBuildOptions); else m_OptionsEntry.set_text(BuildOptions); get_vbox()->pack_start(m_OptionsEntry); add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK); if(m_FuncID.empty()) set_title(_("Common build options for all source packages")); else set_title(_("Build options for ") + m_FuncID); show_all_children(); }
FindAndReplaceShader::FindAndReplaceShader() : gtkutil::BlockingTransientWindow(_(FINDDLG_WINDOW_TITLE), GlobalMainFrame().getTopLevelWindow()) { set_default_size(FINDDLG_DEFAULT_SIZE_X, FINDDLG_DEFAULT_SIZE_Y); set_border_width(12); set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG); // Create all the widgets populateWindow(); // Propagate shortcuts to the main window GlobalEventManager().connectDialogWindow(this); }
DownloadWindow::DownloadWindow() { // Self cofigure set_title ( "Reading data from device" ); set_resizable ( false ); set_deletable ( false ); set_border_width ( 20 ); // Widgets Gtk::VBox *box = get_vbox(); progressBar.set_size_request ( 300, -1 ); box->add ( progressBar ); // Finally show_all_children(); }
MainWnd::MainWnd() { set_border_width(0); irActionGroup = Gtk::ActionGroup::create("ActionGroup"); irActionGroup->add(Gtk::Action::create("MenuFile", "_File")); irActionGroup->add(Gtk::Action::create("Open", Gtk::Stock::OPEN), sigc::mem_fun(*this, &MainWnd::on_action_open)); irActionGroup->add(Gtk::Action::create("Save_as", Gtk::Stock::SAVE_AS), sigc::mem_fun(*this, &MainWnd::on_action_saveas)); irUiMgr = Gtk::UIManager::create(); irUiMgr->insert_action_group(irActionGroup); irUiMgr->add_ui_from_string(sUiInfo); Gtk::Widget* pMenuBar = irUiMgr->get_widget("/MenuBar"); Gtk::Widget* pToolBar = irUiMgr->get_widget("/ToolBar"); add(iVboxMain); iVboxMain.show(); // Base vertical layout: menu iVboxMain.pack_start(*pMenuBar, Gtk::PACK_SHRINK); // Base vertical layout: toolbar iVboxMain.pack_start(*pToolBar, Gtk::PACK_SHRINK); // Create main view client window irMainClientWnd = new Gtk::ScrolledWindow(); // Log view iLogWnd = new Gtk::ScrolledWindow(); iLogView = new LogView(); iLogWnd->add(*iLogView); iLogWnd->show(); // Visualization iVis.show(); // Services window iServ.show(); iServ.append_page(*iLogWnd, "Log"); iServ.append_page(iVis, "Visualization"); iVPanG.show(); // Base vertical layout: main horisontal layout iHPanG.show(); iVboxMain.pack_start(iVPanG, Gtk::PACK_EXPAND_WIDGET); // iVboxMain.pack_start(*irMainClientWnd, Gtk::PACK_EXPAND_WIDGET); // Detail view pane iHPanG.pack2(*irMainClientWnd, Gtk::EXPAND); iVPanG.pack1(iHPanG, Gtk::EXPAND); iVPanG.pack2(iServ, Gtk::EXPAND); pMenuBar->show(); pToolBar->show(); irMainClientWnd->show(); iLogView->show(); }
MapWindow::MapWindow() : m_draw(), m_VertParentBox(Gtk::ORIENTATION_VERTICAL), m_HorzChildBox(Gtk::ORIENTATION_HORIZONTAL), m_Button_File(), m_Button_Solve(), m_WorkerThread(NULL), DialogWindow() { // Add the text for the file button and picture m_Button_File.add_pixlabel("open.gif","Choose file"); m_Button_Solve.add_pixlabel("worker.gif","Solve path"); // Add a buffer border to the window set_border_width(10); // Set title, maximize window set_title("Astar"); maximize(); // Set the minimum window size set_size_request(400,300); // Connect button handlers m_Button_File.signal_clicked().connect(sigc::mem_fun(*this, &MapWindow::on_button_file_clicked) ); m_Button_Solve.signal_clicked().connect(sigc::mem_fun(*this, &MapWindow::on_button_solve_clicked) ); // Connect dispatcher for worker thread m_Dispatcher.connect(sigc::mem_fun(*this, &MapWindow::on_notification_from_worker_thread)); // Disable the Solve button m_Button_Solve.set_sensitive(false); // Add a vertical box add(m_VertParentBox); m_VertParentBox.show(); // Horizontal box contains the buttons m_HorzChildBox.pack_end(m_Button_File,Gtk::PACK_EXPAND_PADDING,0); m_HorzChildBox.pack_end(m_Button_Solve,Gtk::PACK_EXPAND_PADDING,0); // Vertical box contains the horizontal box and the drawing area m_VertParentBox.pack_start(m_HorzChildBox,false,false,10); m_VertParentBox.pack_start(m_draw); // Show show_all_children(); }
dialog() : m_stream(k3d::log()) { Gtk::Label* const label = new Gtk::Label(_("Logging SpaceNavigator events to stderr ...\nClose window to cancel logging.")); add(*Gtk::manage(label)); set_border_width(10); set_role("space_navigator"); show_all(); m_events.connect_button_signal(sigc::mem_fun(*this, &dialog::on_button)); m_events.connect_motion_signal(sigc::mem_fun(*this, &dialog::on_motion)); }
Buttons::Buttons() { m_button.add_pixlabel("info.xpm", "cool button"); set_title("Pixmap'd buttons!"); set_border_width(50); m_button.signal_clicked().connect( sigc::mem_fun(*this, &Buttons::on_button_clicked) ); add(m_button); show_all_children(); }
ErrorDialog::ErrorDialog (const String& main_message) : Gtk::Dialog ("Error", true, false), more ("details"), icon (Gtk::Stock::DIALOG_ERROR, Gtk::ICON_SIZE_DIALOG) { set_border_width (5); add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK); text.set_label (main_message); model = Gtk::ListStore::create (columns); details.set_model (model); details.append_column ("level", columns.icon); details.append_column ("message", columns.text); details.set_headers_visible (false); for (std::list<ErrorMsg>::iterator msg = messages.begin(); msg != messages.end(); ++msg) { Gtk::TreeModel::Row row = *(model->append()); row[columns.icon] = render_icon (( msg->loglevel == 1 ? Gtk::Stock::DIALOG_ERROR : Gtk::Stock::DIALOG_INFO ), Gtk::ICON_SIZE_MENU); row[columns.text] = msg->text; } hbox.set_border_width (10); hbox.set_spacing (10); hbox.pack_start (icon, Gtk::PACK_SHRINK); hbox.pack_start (text); details_window.add (details); details_window.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); details_window.set_shadow_type (Gtk::SHADOW_IN); more.add (details_window); get_vbox()->pack_start (hbox, Gtk::PACK_SHRINK); get_vbox()->pack_start (more); show_all(); if (Window::list_toplevels().size()) { int x, y, w, h; if (*Window::list_toplevels().begin()) { (*Window::list_toplevels().begin())->get_position (x, y); (*Window::list_toplevels().begin())->get_size (w, h); x = x + (w - get_width())/2; y = y + (h - get_height())/2; move (x,y); } } }
MainWindow::MainWindow() { set_title("ひらがな電卓Calc-H ver.0.8.8"); set_size_request(500, 280); Pango::FontDescription font_desc; #ifdef _WIN32 font_desc.set_family("MS Gothic"); #else font_desc.set_family("typewriter"); #endif m_label.modify_font(font_desc); m_entry.modify_font(font_desc); m_textview.modify_font(font_desc); m_button_enter.modify_font(font_desc); set_border_width(4); m_hbox.set_border_width(8); m_vbox.set_border_width(8); m_text_buf = Gtk::TextBuffer::create(); m_textview.set_buffer(m_text_buf); m_label.set_label("にゅうりょく:"); m_entry.set_text(""); m_button_enter.set_label("Enter"); m_button_enter.signal_clicked().connect( sigc::mem_fun(*this, &MainWindow::on_button_enter) ); m_hbox.pack_start(m_label, Gtk::PACK_SHRINK); m_hbox.pack_start(m_entry); m_hbox.pack_start(m_button_enter, Gtk::PACK_SHRINK); m_vbox.pack_start(m_textview); m_vbox.pack_start(m_hbox, Gtk::PACK_SHRINK); add(m_vbox); show_all_children(); m_button_enter.set_can_default(); set_focus(m_entry); std::string contents; contents += ch_logo; contents += '\n'; add_output(contents); } // MainWindow::MainWindow
LogTextView::LogTextView(string path_log_file) : path_log_file(path_log_file) { // create log file system("mkdir " LOG_FOLDER " &> /dev/null"); system((string("touch ") + path_log_file + string(" &> /dev/null")).c_str()); set_border_width(10); set_editable(false); log_text_buffer = Gtk::TextBuffer::create(); time_t result_time = time(NULL); log_text_buffer->set_text(ctime(&result_time)); this->set_buffer(log_text_buffer); this->add_line_file(ctime(&result_time)); }
SliderWindow::SliderWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& refGlade) : Gtk::Window(cobject), volumeSlider_(0) { volumeValue_ = 0; refGlade->get_widget("volume_slider", volumeSlider_); if (volumeSlider_) { volumeSlider_->signal_value_changed().connect(sigc::mem_fun(*this, &SliderWindow::on_volume_slider)); set_default_size(volumeSlider_->get_width(), volumeSlider_->get_width()); } add_events(Gdk::LEAVE_NOTIFY_MASK); signal_leave_notify_event().connect(sigc::mem_fun(*this, &SliderWindow::on_focus_out)); set_border_width(0); set_keep_above(true); }
HelloWorld::HelloWorld() : m_button("Hello World") // creates a new button with label "Hello World". { // Sets the border width of the window set_border_width(10); // When the button receives the "clicked" signal, it will call the // on_button_clicked() method defined below. m_button.signal_clicked().connect(sigc::mem_fun(*this, &HelloWorld::on_button_clicked)); // This packs the button into the Window (a container). add(m_button); // The final step is to display this newly created widget... m_button.show(); } //HelloWorld::HelloWorld