• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ gtk::Box类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中gtk::Box的典型用法代码示例。如果您正苦于以下问题:C++ Box类的具体用法?C++ Box怎么用?C++ Box使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Box类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ZoomControl

ParamsDialog::ParamsDialog(MainWindow *_mw) : Gtk::Dialog("Parameters", *_mw, true),
	mw(_mw)
{
	add_button(Gtk::Stock::CANCEL, Gtk::ResponseType::RESPONSE_CANCEL);
	add_button(Gtk::Stock::OK, Gtk::ResponseType::RESPONSE_OK);

	Gtk::Box* box = get_vbox();
	Gtk::Table *tbl = Gtk::manage(new Gtk::Table(3,2));

	f_c_re = Gtk::manage(new Util::HandyEntry<Fractal::Value>());
	f_c_re->set_activates_default(true);
	f_c_im = Gtk::manage(new Util::HandyEntry<Fractal::Value>());
	f_c_im->set_activates_default(true);

	zc = Gtk::manage(new ZoomControl(mw));

	Gtk::Label* label;

	label = Gtk::manage(new Gtk::Label("Centre Real (x) "));
	label->set_alignment(1, 0.5);
	tbl->attach(*label, 0, 1, 0, 1);
	tbl->attach(*f_c_re, 1, 2, 0, 1);

	label = Gtk::manage(new Gtk::Label("Centre Imaginary (y) "));
	label->set_alignment(1, 0.5);
	tbl->attach(*label, 0, 1, 1, 2);
	tbl->attach(*f_c_im, 1, 2, 1, 2);

	tbl->attach(*zc, 0, 2, 2, 3);

	box->pack_start(*tbl);
	set_default_response(Gtk::ResponseType::RESPONSE_OK);
}
开发者ID:crazyscot,项目名称:brot2,代码行数:33,代码来源:ParamsDialog.cpp


示例2: DialogBox

SelectDialog::SelectDialog
(
   ButtonID    buttons,
   const char* title,
   const char* message,
   bool        needSelection

)
 : DialogBox(buttons, title)
 , sw_(0)
 , list_(0)
 , selectBtn_(0)
 , deselectBtn_(0)
 , needSelection_(needSelection)
{
    get_vbox()->set_border_width(2);
    if (message)
    {
       Gtk::Box* hbox = manage(new Gtk::HBox);
       get_vbox()->pack_start(*hbox, false, false);

       Gtk::Frame* frame = manage(new Gtk::Frame);
       hbox->pack_start(*frame);
       hbox->set_border_width(3);

       Gtk::Label* label = manage(new Gtk::Label(message, .0));
       frame->add(*label);

       label->set_padding(3, 5);
       Gtk_set_size(label, 570, -1);
       label->set_justify(Gtk_FLAG(JUSTIFY_LEFT));
       label->set_line_wrap(true);
    }
    sw_ = manage(new Gtk::ScrolledWindow);
    get_vbox()->pack_start(*sw_);

    sw_->set_policy(Gtk_FLAG(POLICY_AUTOMATIC), Gtk_FLAG(POLICY_AUTOMATIC));
    Gtk_set_size(sw_, 580, 300);

    list_ = manage(new Gtk::List);
    Gtk_add_with_viewport(sw_, *list_);
    list_->set_selection_mode(Gtk_FLAG(SELECTION_MULTIPLE));

    add_select_button("Select _All", true);
    add_select_button("_Deselect All", false);

    Gtk_set_resizable(this, true);

    if (needSelection)
    {
       if (Gtk::Button* btn = get_ok_button())
       {
           btn->set_sensitive(false);
       }
    }
    selConn_ = Gtk_CONNECT_0(list_, selection_changed,
      this, &SelectDialog::on_selection_changed);

    get_vbox()->show_all();
}
开发者ID:Panke,项目名称:zerobugs,代码行数:60,代码来源:select_dialog.cpp


示例3: add

void dialog::operate4(Image imag,std::string filename)
{
    set_default_size(300, 50);
    set_border_width(10);
    set_position(Gtk::WIN_POS_CENTER);
    set_resizable(false);

    Gtk::Box *vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0));
    add(*vbox);

    Gtk::Grid *grid = Gtk::manage(new Gtk::Grid);
    vbox->add(*grid);

    Gtk::Label *label = Gtk::manage(new Gtk::Label("File Name :"));
    grid->attach(*label,0,0,1,1);
    Gtk::Entry *bvalue = Gtk::manage(new Gtk::Entry());
    grid->attach(*bvalue, 1, 0, 1, 1);
    Gtk::Label *label2 = Gtk::manage(new Gtk::Label(".bmp"));
    grid->attach(*label2,2,0,1,1);

    set_title("Save As");
    bvalue->set_text("Untitled");
    bvalue->set_max_length(50);

    Gtk::Button *bok = Gtk::manage(new Gtk::Button("OK"));
    bok->signal_clicked().connect(sigc::bind<Gtk::Entry*>(sigc::mem_fun(*this, &dialog::on_bok4_click), bvalue,imag,filename));
    grid->attach(*bok, 2, 2, 1, 1);
    show_all_children();
}
开发者ID:CS101-ProjectTeam,项目名称:Digital-Image-Processor,代码行数:29,代码来源:dialog.cpp


示例4: ProjectSettingsDialog

ProjectSettingsDialog :: ProjectSettingsDialog(_ProjectManager* project)
   : _projectFrame("Project"), _compilerFrame("Compiler"),
     _linkerFrame("Linker"), _debuggerFrame("Debugger"),
     _typeLabel("Type"), _namespaceLabel("Namespace"),
     _warningLabel("Warn about unresolved references"), _optionsLabel("Additional options"),
     _targetLabel("Target file name"), _outputLabel("Output path"),
     _modeLabel("Debug mode"), _argumentsLabel("Command arguments")
{
   _project = project;

   Gtk::Box *box = get_vbox();

   box->pack_start(_projectFrame, Gtk::PACK_SHRINK);

   _projectFrame.add(_projectGrid);
   _projectGrid.set_row_homogeneous(true);
   _projectGrid.set_column_homogeneous(true);
   _projectGrid.attach(_typeLabel, 0, 0, 1, 1);
   _projectGrid.attach(_typeCombobox, 1, 0, 1, 1);
   _projectGrid.attach(_namespaceLabel, 0, 1, 1, 1);
   _projectGrid.attach(_namespaceText, 1, 1, 1, 1);

   box->pack_start(_compilerFrame);

   _compilerFrame.add(_compilerGrid);
   _compilerGrid.set_row_homogeneous(true);
   _compilerGrid.set_column_homogeneous(true);
   _compilerGrid.attach(_warningCheckbox, 0, 0, 1, 1);
   _compilerGrid.attach(_warningLabel, 1, 0, 1, 1);
   _compilerGrid.attach(_optionsLabel, 0, 1, 1, 1);
   _compilerGrid.attach(_optionsText, 1, 1, 1, 1);

   box->pack_start(_linkerFrame);

   _linkerFrame.add(_linkerrGrid);
   _linkerrGrid.set_row_homogeneous(true);
   _linkerrGrid.set_column_homogeneous(true);
   _linkerrGrid.attach(_targetLabel, 0, 0, 1, 1);
   _linkerrGrid.attach(_targetText, 1, 0, 1, 1);
   _linkerrGrid.attach(_outputLabel, 0, 1, 1, 1);
   _linkerrGrid.attach(_outputText, 1, 1, 1, 1);

   box->pack_start(_debuggerFrame);

   _debuggerFrame.add(_debuggerGrid);
   _debuggerGrid.set_row_homogeneous(true);
   _debuggerGrid.set_column_homogeneous(true);
   _debuggerGrid.attach(_modeLabel, 0, 0, 1, 1);
   _debuggerGrid.attach(_modeCombobox, 1, 0, 1, 1);
   _debuggerGrid.attach(_argumentsLabel, 0, 1, 1, 1);
   _debuggerGrid.attach(_argumentsText, 1, 1, 1, 1);

   add_button("OK", Gtk::RESPONSE_OK);
   add_button("Cancel", Gtk::RESPONSE_CANCEL);

   populate();

   show_all_children();
}
开发者ID:ELENA-LANG,项目名称:elena-lang,代码行数:59,代码来源:gtkdialogs.cpp


示例5: warning

void
FontSubstitution::show(Glib::ustring out, GSList *l)
{
   Gtk::MessageDialog warning(_("\nSome fonts are not available and have been substituted."),
                       false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, true);
   warning.set_resizable(true);
   warning.set_title(_("Font substitution"));

   GtkWidget *dlg = GTK_WIDGET(warning.gobj());
   sp_transientize(dlg);

   Gtk::TextView * textview = new Gtk::TextView();
   textview->set_editable(false);
   textview->set_wrap_mode(Gtk::WRAP_WORD);
   textview->show();
   textview->get_buffer()->set_text(_(out.c_str()));

   Gtk::ScrolledWindow * scrollwindow = new Gtk::ScrolledWindow();
   scrollwindow->add(*textview);
   scrollwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
   scrollwindow->set_shadow_type(Gtk::SHADOW_IN);
   scrollwindow->set_size_request(0, 100);
   scrollwindow->show();

   Gtk::CheckButton *cbSelect = new Gtk::CheckButton();
   cbSelect->set_label(_("Select all the affected items"));
   cbSelect->set_active(true);
   cbSelect->show();

   Gtk::CheckButton *cbWarning = new Gtk::CheckButton();
   cbWarning->set_label(_("Don't show this warning again"));
   cbWarning->show();

#if GTK_CHECK_VERSION(3,0,0)
   Gtk::Box * box = warning.get_content_area();
#else
   Gtk::Box * box = warning.get_vbox();
#endif
   box->set_spacing(2);
   box->pack_start(*scrollwindow, true, true, 4);
   box->pack_start(*cbSelect, false, false, 0);
   box->pack_start(*cbWarning, false, false, 0);

   warning.run();

   if (cbWarning->get_active()) {
       Inkscape::Preferences *prefs = Inkscape::Preferences::get();
       prefs->setInt("/options/font/substitutedlg", 0);
   }

   if (cbSelect->get_active()) {

       SPDesktop *desktop = SP_ACTIVE_DESKTOP;
       Inkscape::Selection *selection = sp_desktop_selection (desktop);
       selection->clear();
       selection->setList(l);
   }

}
开发者ID:Grandrogue,项目名称:inkscape_metal,代码行数:59,代码来源:font-substitution.cpp


示例6: buttonClear

/**
 * Constructor
 */
Messages::Messages()
    : UI::Widget::Panel("", "/dialogs/messages", SP_VERB_DIALOG_DEBUG),
      buttonClear(_("_Clear"), _("Clear log messages")),
      checkCapture(_("Capture log messages"), _("Capture log messages"))
{
    Gtk::Box *contents = _getContents();

    /*
     * Menu replaced with buttons
     *
    menuBar.items().push_back( Gtk::Menu_Helpers::MenuElem(_("_File"), fileMenu) );
    fileMenu.items().push_back( Gtk::Menu_Helpers::MenuElem(_("_Clear"),
           sigc::mem_fun(*this, &Messages::clear) ) );
    fileMenu.items().push_back( Gtk::Menu_Helpers::MenuElem(_("Capture log messages"),
           sigc::mem_fun(*this, &Messages::captureLogMessages) ) );
    fileMenu.items().push_back( Gtk::Menu_Helpers::MenuElem(_("Release log messages"),
           sigc::mem_fun(*this, &Messages::releaseLogMessages) ) );
    contents->pack_start(menuBar, Gtk::PACK_SHRINK);
    */

    //### Set up the text widget
    messageText.set_editable(false);
    textScroll.add(messageText);
    textScroll.set_policy(Gtk::POLICY_ALWAYS, Gtk::POLICY_ALWAYS);
    contents->pack_start(textScroll);

    buttonBox.set_spacing(6);
    buttonBox.pack_start(checkCapture, true, true, 6);
    buttonBox.pack_end(buttonClear, false, false, 10);
    contents->pack_start(buttonBox, Gtk::PACK_SHRINK);

    // sick of this thing shrinking too much
    set_size_request(400, 300);
    
    show_all_children();

    message(_("Ready."));

    buttonClear.signal_clicked().connect(sigc::mem_fun(*this, &Messages::clear));
    checkCapture.signal_clicked().connect(sigc::mem_fun(*this, &Messages::toggleCapture));

    /*
     * TODO - Setting this preference doesn't capture messages that the user can see.
     * Inkscape creates an instance of a dialog on startup and sends messages there, but when the user
     * opens the dialog View > Messages the DialogManager creates a new instance of this class that is not capturing messages.
     *
     * message(_("Enable log display by setting dialogs.debug 'redirect' attribute to 1 in preferences.xml"));
    */

    handlerDefault = 0;
    handlerGlibmm  = 0;
    handlerAtkmm   = 0;
    handlerPangomm = 0;
    handlerGdkmm   = 0;
    handlerGtkmm   = 0;

}
开发者ID:AakashDabas,项目名称:inkscape,代码行数:60,代码来源:messages.cpp


示例7: add_header

void Dialog::add_header(const std::string & label)
{
    Gtk::Box * vbox;

    builder()->get_widget("dialog-vbox1", vbox);
    auto markup = str(boost::format("<span size=\"x-large\">%1%</span>") % label);
    auto header = manage(new view::Header(markup));
    header->show();
    vbox->pack_start(*header, false, true);
}
开发者ID:GNOME,项目名称:niepce,代码行数:10,代码来源:dialog.cpp


示例8: main

int main(int argc, char *argv[])
{

    // make window
    Glib::RefPtr<Gtk::Application> app =
        Gtk::Application::create(argc, argv,
                                 "tutorial2");

    Gtk::Window window;

    window.set_default_size(400,200);
    window.set_title("Tutorial 2");

    // This creates a vertical box container with 0 padding
    Gtk::Box *vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0));
    window.add(*vbox);

    // creates menu bar
    Gtk::MenuBar *menubar = Gtk::manage(new Gtk::MenuBar());
    vbox->pack_start(*menubar, Gtk::PACK_SHRINK, 0);

    // create menu items
    Gtk::MenuItem *menuitem_file = Gtk::manage(new Gtk::MenuItem("_File", true));
    menubar->append(*menuitem_file);
    Gtk::Menu *filemenu = Gtk::manage(new Gtk::Menu());
    menuitem_file->set_submenu(*filemenu);
    Gtk::MenuItem *menuitem_quit = Gtk::manage(new Gtk::MenuItem("_Quit", true));
    filemenu->append(*menuitem_quit);

    // create grid container with border width 10
    // and add it to the new cell of the vertical box
    Gtk::Grid *grid = Gtk::manage(new Gtk::Grid);
    grid->set_border_width(10);
    vbox->add(*grid);

    // create button
    Gtk::Button *b1 = Gtk::manage(new Gtk::Button("Button 1"));
    b1->set_hexpand(true);		//  take up all unused space horizontally
    b1->set_vexpand(true);		//  take up all unused space vertically
    // possition 0(x), 0(y), span 1 cell wide and 2 cells down
    grid->attach(*b1, 0, 0, 1, 2);

    Gtk::Button *b2 = Gtk::manage(new Gtk::Button("Button 2"));
    grid->attach(*b2, 1, 0, 1, 1);

    Gtk::Button *b3 = Gtk::manage(new Gtk::Button("Button 3"));
    grid->attach(*b3, 1, 1, 1, 1);

    vbox->show_all();

    return app->run(window);
}
开发者ID:vladimir-kirillovskiy,项目名称:misc,代码行数:52,代码来源:main.cpp


示例9: search

DeviceSelector::DeviceSelector()
{
  //domyślny rozmiar okna
  set_default_size(600, 300);
  //przyciski
  ok.set_label("OK");
  ok.set_sensitive(false);
  cancel.set_label("Anuluj");
  start_search.set_label("Szukaj urządzeń");

  //umieszczenie prezycisków
  hbox.pack_start(ok);
  hbox.pack_start(cancel);
  hbox.pack_start(start_search);

  //łączenie przycisków z akcjami
  start_search.signal_clicked().connect(sigc::mem_fun(*this, &DeviceSelector::start_search_clicked));
  ok.signal_clicked().connect(sigc::mem_fun(*this, &DeviceSelector::ok_clicked));
  cancel.signal_clicked().connect(sigc::mem_fun(*this, &DeviceSelector::cancel_clicked));


  //widok listy
  scrolled_window.add(view);
  ref_tree_model = Gtk::ListStore::create(dtn);
  view.set_model(ref_tree_model);
  scrolled_window.set_size_request(400, 300);

  //kolumny
  view.append_column("Nazwa", dtn.col_name);
  view.append_column("MAC", dtn.col_MAC);

  //umieszczenie pionowe
  //vbox.pack_start(scrolled_window, Gtk::PACK_EXPAND_PADDING);
  //vbox.pack_end(hbox, Gtk::PACK_SHRINK);

  //umieszczenie vboxa w oknie
  Gtk::Box *tmp = get_content_area();
  tmp->pack_start(scrolled_window, Gtk::PACK_EXPAND_PADDING);
  tmp->pack_end(hbox, Gtk::PACK_SHRINK);
  //tmp->pack_start(vbox, Gtk::PACK_EXPAND_WIDGET);

  //wyświetlenie
  tmp->show_all_children(true);

  //wyświetlanie urządzeń
  this->signal_devices_ready().connect(sigc::mem_fun(*this, &DeviceSelector::on_devices_ready));

  exiting = exited = false;

  //szukanie urządzeń
  search();
}
开发者ID:kn65op,项目名称:ECGReceiver,代码行数:52,代码来源:DeviceSelector.cpp


示例10: message

DebugDialogImpl::DebugDialogImpl()
{
    set_title(_("Messages"));
    set_size_request(300, 400);

#if WITH_GTKMM_3_0
    Gtk::Box *mainVBox = get_content_area();
#else
    Gtk::Box *mainVBox = get_vbox();
#endif

    //## Add a menu for clear()
    Gtk::MenuItem* item = Gtk::manage(new Gtk::MenuItem(_("_File"), true));
    item->set_submenu(fileMenu);
    menuBar.append(*item);

    item = Gtk::manage(new Gtk::MenuItem(_("_Clear"), true));
    item->signal_activate().connect(sigc::mem_fun(*this, &DebugDialogImpl::clear));
    fileMenu.append(*item);

    item = Gtk::manage(new Gtk::MenuItem(_("Capture log messages")));
    item->signal_activate().connect(sigc::mem_fun(*this, &DebugDialogImpl::captureLogMessages));
    fileMenu.append(*item);
    
    item = Gtk::manage(new Gtk::MenuItem(_("Release log messages")));
    item->signal_activate().connect(sigc::mem_fun(*this, &DebugDialogImpl::releaseLogMessages));
    fileMenu.append(*item);

    mainVBox->pack_start(menuBar, Gtk::PACK_SHRINK);
    

    //### Set up the text widget
    messageText.set_editable(false);
    textScroll.add(messageText);
    textScroll.set_policy(Gtk::POLICY_ALWAYS, Gtk::POLICY_ALWAYS);
    mainVBox->pack_start(textScroll);

    show_all_children();

    message("ready.");
    message("enable log display by setting ");
    message("dialogs.debug 'redirect' attribute to 1 in preferences.xml");

    handlerDefault = 0;
    handlerGlibmm  = 0;
    handlerAtkmm   = 0;
    handlerPangomm = 0;
    handlerGdkmm   = 0;
    handlerGtkmm   = 0;
}
开发者ID:AakashDabas,项目名称:inkscape,代码行数:50,代码来源:debug.cpp


示例11: set_menubar

void FormImpl::set_menubar(mforms::Form *self, mforms::MenuBar *menu)
{
  FormImpl* form = self->get_data<FormImpl>();
  Gtk::MenuBar *mbar = widget_for_menubar(menu);
  if (form && mbar)
  {
    Gtk::Box *box = dynamic_cast<Gtk::Box*>(self->get_content()->get_data<ViewImpl>()->get_inner());
    if (!box)
      throw std::logic_error("set_menubar called on a window without a Box as toplevel content");
    box->pack_start(*mbar, false, true);
    box->reorder_child(*mbar, 0);

    on_add_menubar_to_window(menu, form->_window);
  }
}
开发者ID:ThiagoGarciaAlves,项目名称:mysql-workbench,代码行数:15,代码来源:lf_form.cpp


示例12: manage

Gtk::Widget *
Widget_RendDesc::create_time_tab()
{
	Gtk::Alignment *paddedPanel = manage(new Gtk::Alignment(0, 0, 1, 1));
	paddedPanel->set_padding(12, 12, 12, 12);

	Gtk::Box *panelBox = manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 12));  // for future widgets
	panelBox->set_homogeneous(false);
	paddedPanel->add(*panelBox);

	time_frame = manage(new Gtk::Frame(_("Time Settings")));
	time_frame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) time_frame->get_label_widget())->set_markup(_("<b>Time Settings</b>"));
	panelBox->pack_start(*time_frame, Gtk::PACK_SHRINK);

	Gtk::Alignment *timeFramePadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	timeFramePadding->set_padding(6, 0, 24, 0);
	time_frame->add(*timeFramePadding);

	Gtk::Grid *timeFrameGrid = manage(new Gtk::Grid());
	timeFramePadding->add(*timeFrameGrid);
	timeFrameGrid->set_row_spacing(6);
	timeFrameGrid->set_column_spacing(250);

	Gtk::Label *timeFPSLabel = manage(new Gtk::Label(_("_Frames per second"), 0, 0.5, true));
	timeFPSLabel->set_mnemonic_widget(*entry_fps);
	timeFrameGrid->attach(*timeFPSLabel, 0, 0, 1, 1);
	entry_fps->set_hexpand(true);
	timeFrameGrid->attach(*entry_fps, 1, 0, 1, 1);

	Gtk::Label *timeStartLabel = manage(new Gtk::Label(_("_Start Time"), 0, 0.5, true));
	timeStartLabel->set_mnemonic_widget(*entry_start_time);
	timeFrameGrid->attach(*timeStartLabel, 0, 1, 1, 1);
	timeFrameGrid->attach(*entry_start_time, 1, 1, 1, 1);

	Gtk::Label *timeEndLabel = manage(new Gtk::Label(_("_End Time"), 0, 0.5, true));
	timeEndLabel->set_mnemonic_widget(*entry_end_time);
	timeFrameGrid->attach(*timeEndLabel, 0, 2, 1, 1);
	timeFrameGrid->attach(*entry_end_time, 1, 2, 1, 1);

	Gtk::Label *timeDurationLabel = manage(new Gtk::Label(_("_Duration"), 0, 0.5, true));
	timeDurationLabel->set_mnemonic_widget(*entry_duration);
	timeFrameGrid->attach(*timeDurationLabel, 0, 3, 1, 1);
	timeFrameGrid->attach(*entry_duration, 1, 3, 1, 1);

	paddedPanel->show_all();
	return paddedPanel;
}
开发者ID:blackwarthog,项目名称:synfig,代码行数:48,代码来源:renddesc.cpp


示例13:

    Gtk::Widget *SmartChessWindow::createNotificationBar() {
        Gtk::Box* statusbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL));
        statusbox->set_vexpand(false);
        statusbox->set_hexpand();

        mStatusBar = Gtk::manage(new Gtk::Statusbar());
        mStatusBar->set_vexpand(false);
        mStatusBar->set_hexpand();
        statusbox->add(*mStatusBar);

        Gtk::ProgressBar* progressbar = Gtk::manage(new Gtk::ProgressBar());
        progressbar->set_hexpand(false);
        progressbar->set_vexpand(false);
        statusbox->add(*progressbar);

        return statusbox;
    }
开发者ID:elfus,项目名称:smart-chess,代码行数:17,代码来源:SmartChessWindow.cpp


示例14:

Tree_active::Tree_active(Dir_preview* dp, Gtk::Box& box)
	: Tree{dp, box}
{
	box.pack_start(get_widget(), Gtk::PACK_EXPAND_WIDGET);
	m_tree_view->set_sensitive();
	m_tree_view->grab_focus();

	m_separator->set_margin_left(2);
	m_separator->set_margin_right(2);
	box.pack_start(*m_separator, Gtk::PACK_SHRINK);

	// register the signals
	// Note that we're registering on_cursor_change signal AFTER setting the
	// cursor on purpose - we don't need to check the cursor for preview as
	// this was already done by libhawk when we created this tab.

	register_signals();
}
开发者ID:gman0,项目名称:hawk-gtk3,代码行数:18,代码来源:Tree_active.cpp


示例15: update_property

bool GstPropertiesModule::update_property(const std::shared_ptr<GValueBase>& value_base, const std::string prop_name)
{
	for (auto internal_box : properties_box->get_children())
	{
		Gtk::Box *hb = dynamic_cast<Gtk::Box*>(internal_box);
		if (hb == nullptr)
		{
			continue;
		}

		if (reinterpret_cast<gchar*>(hb->get_data("property-name")) != prop_name)
			continue;

		for (auto widget : hb->get_children())
		{
			if (widget->get_data("is-gvalue-widget") == GINT_TO_POINTER(1))
			{
				bool sensitive = widget->get_sensitive();
				hb->remove(*widget);
				widget = value_base->get_widget();
				widget->set_sensitive(sensitive);
				widget->show();
				hb->pack_start(*widget, true, 10);
				hb->reorder_child(*widget, 1);
				return true;
			}
		}
	}

	return false;
}
开发者ID:GNOME,项目名称:gst-debugger,代码行数:31,代码来源:gst_properties_module.cpp


示例16:

myWindow::myWindow()
{
	set_default_size(400, 200);
	set_title("Tutorial 3");

	Gtk::Box *vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0));
	add(*vbox);

	Gtk::MenuBar *menubar = Gtk::manage(new Gtk::MenuBar());
	vbox->pack_start(*menubar, Gtk::PACK_SHRINK, 0);

	Gtk::MenuItem *menuitem_file = Gtk::manage(new Gtk::MenuItem("_File", true));
	menubar->append(*menuitem_file);
	Gtk::Menu *filemenu = Gtk::manage(new Gtk::Menu());
	menuitem_file->set_submenu(*filemenu);
	Gtk::MenuItem *menuitem_quit = Gtk::manage(new Gtk::MenuItem("_Quit", true));
	menuitem_quit->signal_activate().connect(sigc::mem_fun(*this, &myWindow::on_quit_click));
	filemenu->append(*menuitem_quit);

	Gtk::Grid *grid = Gtk::manage(new Gtk::Grid);
	grid->set_border_width(10);
	vbox->add(*grid);

	Gtk::Button *b1 = Gtk::manage(new Gtk::Button("Big Button 1"));
    b1->set_hexpand(true);
    b1->set_vexpand(true);
    b1->signal_clicked().connect(sigc::mem_fun(*this, &myWindow::on_big_button1_click));
    grid->attach(*b1, 0, 0, 1, 2);

    Gtk::Button *b2 = Gtk::manage(new Gtk::Button("Button 2"));
    b2->signal_clicked().connect(sigc::mem_fun(*this, &myWindow::on_button2_click));
    grid->attach(*b2, 1, 0, 1, 1);

    Gtk::Button *b3 = Gtk::manage(new Gtk::Button("Button 3"));
    b3->signal_clicked().connect(sigc::mem_fun(*this, &myWindow::on_button3_click));
    grid->attach(*b3, 1, 1, 1, 1);

    vbox->show_all();
}
开发者ID:vladimir-kirillovskiy,项目名称:misc,代码行数:39,代码来源:myWindow.cpp


示例17: add

IdleExample::IdleExample() :
    m_Box(Gtk::ORIENTATION_VERTICAL, 5),
    m_ButtonQuit(Gtk::Stock::QUIT)
{
    set_border_width(5);

    // Put buttons into container

    // Adding a few widgets:
    add(m_Box);
    m_Box.pack_start( *Gtk::manage(new Gtk::Label("Formatting Windows drive C:")));
    m_Box.pack_start( *Gtk::manage(new Gtk::Label("100 MB")) );
    m_Box.pack_start(m_ProgressBar_c);

    m_Box.pack_start( *Gtk::manage(new Gtk::Label("")) );

    m_Box.pack_start( *Gtk::manage(new Gtk::Label("Formatting Windows drive D:")));
    m_Box.pack_start( *Gtk::manage(new Gtk::Label("5000 MB")) );
    m_Box.pack_start(m_ProgressBar_d);

    Gtk::Box* hbox = Gtk::manage( new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL,10));
    m_Box.pack_start(*hbox);
    hbox->pack_start(m_ButtonQuit, Gtk::PACK_EXPAND_PADDING);

    // Connect the signal handlers:
    m_ButtonQuit.signal_clicked().connect( sigc::mem_fun(*this,
                                           &IdleExample::on_button_clicked) );

    // formatting drive c in timeout signal handler - called once every 50ms
    Glib::signal_timeout().connect( sigc::mem_fun(*this, &IdleExample::on_timer),
                                    50 );

    // formatting drive d in idle signal handler - called as quickly as possible
    Glib::signal_idle().connect( sigc::mem_fun(*this, &IdleExample::on_idle) );

    show_all_children();
}
开发者ID:hamedobaidy,项目名称:gtkmm_eclipse_examples,代码行数:37,代码来源:idleexample.cpp


示例18: append_property

void GstPropertiesModule::append_property(const std::shared_ptr<GValueBase>& value_base, const std::string &prop_name)
{
	auto e = std::dynamic_pointer_cast<ElementModel>(controller->get_selected_object());
	if (!e) return;
	auto klass = controller->get_klass(e->get_type_name());
	if (!klass) return;
	auto prop = klass.get().get_property(prop_name);
	if (!prop) return;

	Gtk::Box *hbox = new Gtk::Box (Gtk::ORIENTATION_HORIZONTAL, 0);
	hbox->set_data("property-name", g_strdup (prop_name.c_str()), g_free);
	Gtk::Label *lbl = Gtk::manage(new Gtk::Label(prop_name));
	lbl->set_tooltip_text(prop->get_blurb());
	Gtk::Button *btn = Gtk::manage(new Gtk::Button("Refresh"));
	btn->signal_clicked().connect([this, prop_name] {request_selected_element_property(prop_name);});
	hbox->pack_start(*lbl, false, false);
	auto value_widget = value_base->get_widget();
	value_base->set_sensitive(prop.get().get_flags() & G_PARAM_WRITABLE);
	hbox->pack_start(*value_widget, true, true);
	hbox->pack_start(*btn, false, false);
	properties_box->pack_start(*hbox);
	hbox->show_all();
}
开发者ID:GNOME,项目名称:gst-debugger,代码行数:23,代码来源:gst_properties_module.cpp


示例19:

dialog_localsettings::dialog_localsettings()
{
    this->set_size_request(350, -1);
    this->set_title("Local Settings");

    this->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
    this->add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);

    Gtk::Frame *frame = Gtk::manage(new Gtk::Frame);
    frame->set_margin_top(5);
    frame->set_margin_left(5);
    frame->set_margin_right(5);
    frame->set_margin_bottom(5);
    frame->set_hexpand(true);
    frame->set_vexpand(true);

    Gtk::Grid *grid = Gtk::manage(new Gtk::Grid);
    grid->set_margin_top(15);
    grid->set_margin_left(15);
    grid->set_margin_right(15);
    grid->set_margin_bottom(15);
    grid->set_hexpand(true);
    grid->set_vexpand(true);
    grid->set_row_spacing(15);
    frame->add(*grid);

    Gtk::Label *label = Gtk::manage(new Gtk::Label("Host: "));
    label->set_halign(Gtk::ALIGN_END);
    grid->attach(*label, 0, 0, 1, 1);

    eHost = Gtk::manage(new Gtk::Entry);
    eHost->set_hexpand(true);
    grid->attach(*eHost, 1, 0, 1, 1);

    label = Gtk::manage(new Gtk::Label("Username: "));
    label->set_halign(Gtk::ALIGN_END);
    grid->attach(*label, 0, 1, 1, 1);

    eUserName = Gtk::manage(new Gtk::Entry);
    eUserName->set_hexpand(true);
    grid->attach(*eUserName, 1, 1, 1, 1);

    label = Gtk::manage(new Gtk::Label("Password: "));
    label->set_halign(Gtk::ALIGN_END);
    grid->attach(*label, 0, 2, 1, 1);

    ePassword = Gtk::manage(new Gtk::Entry);
    ePassword->set_hexpand(true);
    grid->attach(*ePassword, 1, 2, 1, 1);

    label = Gtk::manage(new Gtk::Label("Update Interval: "));
    label->set_halign(Gtk::ALIGN_END);
    grid->attach(*label, 0, 3, 1, 1);

    Gtk::Box *box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 0));
    grid->attach(*box, 1, 3, 1, 1);

    sUpdateInterval = Gtk::manage(new Gtk::SpinButton(Gtk::Adjustment::create(5.0, 1.0, 60.0, 1.0, 10.0, 0.0), 0.0, 0));
    sUpdateInterval->set_hexpand(false);
    box->pack_start(*sUpdateInterval, Gtk::PACK_EXPAND_WIDGET, 2);

    label = Gtk::manage(new Gtk::Label("(seconds)"));
    label->set_halign(Gtk::ALIGN_END);
    box->pack_start(*label, Gtk::PACK_EXPAND_WIDGET, 2);

    frame->show_all();

    this->get_content_area()->add(*frame);
}
开发者ID:CSRedRat,项目名称:gutorrent,代码行数:69,代码来源:dialog_localsettings.cpp


示例20: run

// class constructor
genericFilechooserInputOutput::genericFilechooserInputOutput
(
	Gtk::Window& parent, 
	const Glib::ustring& title,
	const Glib::ustring& inputLabel,
	const Glib::ustring& outputLabel,
	const Glib::ustring& inputButtonLabel,
	const Glib::ustring& outputButtonLabel,
	const Glib::ustring& inputPlaceHolderLabel,
	const Glib::ustring& outputPlaceHolderLabel,
	bool setModal
)
: 
	Gtk::Dialog(title, parent, setModal),
	dialogOptionBox(get_vbox ())
{
	// dialog configuration
	set_resizable(true);
	set_position(Gtk::WIN_POS_CENTER);
	set_decorated(true);
	// define labels
	Gtk::Label * inputPathLabel = Gtk::manage(new Gtk::Label(inputLabel));
	Gtk::Label * outputPathLabel = Gtk::manage(new Gtk::Label(outputLabel));
	// define box
	Gtk::Box * pathInputBox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 2));
	Gtk::Box * pathOutputBox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 2));
	// define buttons
	pathInputButton = Gtk::manage(new Gtk::Button(inputButtonLabel));
	pathOutputButton = Gtk::manage(new Gtk::Button(outputButtonLabel));
	// define entry
	pathInputEntry = Gtk::manage(new Gtk::Entry());
	pathInputEntry->set_editable(true);
	pathInputEntry->set_placeholder_text(inputPlaceHolderLabel);
	pathOutputEntry = Gtk::manage(new Gtk::Entry());
	pathOutputEntry->set_editable(true);
	pathOutputEntry->set_placeholder_text(outputPlaceHolderLabel);
	// pack the entry and its button
	pathInputBox->pack_start(*pathInputEntry);
	pathInputBox->pack_start(*pathInputButton);
	pathOutputBox->pack_start(*pathOutputEntry);
	pathOutputBox->pack_start(*pathOutputButton);
    // pack elements into the dialog box
    dialogOptionBox->pack_start(*inputPathLabel);
    dialogOptionBox->pack_start(*pathInputBox);
    dialogOptionBox->pack_start(*outputPathLabel);
    dialogOptionBox->pack_start(*pathOutputBox);
	// append filechooser buttons and linked events
	add_button
	(
		Gtk::Stock::CANCEL, 
		Gtk::RESPONSE_CANCEL
	);
	add_button
	(
		Gtk::Stock::OK, 
		Gtk::RESPONSE_OK
	);
	connectSignalClicked();
	show_all_children();
//	
	// run the filechooser and grab the result
	response = run();
}
开发者ID:Byvirven,项目名称:MXFTools,代码行数:64,代码来源:genericFilechooserInputOutput.cpp



注:本文中的gtk::Box类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ gtk::Button类代码示例发布时间:2022-05-31
下一篇:
C++ gtk::Allocation类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap