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

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

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

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



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

示例1:

//------------------------------------------------------------------------------
bool mforms::gtk::MenuItemImpl::get_enabled(mforms::MenuBase *item) {
  bool ret = false;
  Gtk::Widget *mb = item->get_data<Gtk::Widget>();
  if (mb)
    ret = mb->get_sensitive();
  return ret;
}
开发者ID:pk-codebox-evo,项目名称:mysql-workbench,代码行数:8,代码来源:lf_menubar.cpp


示例2: onWindowStateEvent

bool CamWnd::onWindowStateEvent(GdkEventWindowState* ev)
{
    if ((ev->changed_mask & (GDK_WINDOW_STATE_ICONIFIED|GDK_WINDOW_STATE_WITHDRAWN)) != 0)
    {
        // Now let's see what the new state of the window is
        if ((ev->new_window_state & (GDK_WINDOW_STATE_ICONIFIED|GDK_WINDOW_STATE_WITHDRAWN)) == 0)
        {
            // Window got maximised again, re-add the GL widget to fix it from going gray
            Gtk::Widget* glWidget = getWidget();

            // greebo: Unfortunate hack to fix the grey GL renderviews in Win32
            Gtk::Container* container = glWidget->get_parent();

            if (container != NULL)
            {
                glWidget->reference();
                container->remove(*glWidget);
                container->add(*glWidget);
                glWidget->unreference();
            }
        }
    }

    return false;
}
开发者ID:Zbyl,项目名称:DarkRadiant,代码行数:25,代码来源:CamWnd.cpp


示例3:

//------------------------------------------------------------------------------
void mforms::gtk::ToolBarImpl::insert_item(mforms::ToolBar *toolbar, int index, mforms::ToolBarItem *item) {
  ::ToolBarImpl *impl = toolbar->get_data< ::ToolBarImpl>();
  Gtk::Widget *w = cast<Gtk::Widget *>(item->get_data_ptr());
  if (!w)
    return;

  if (item && item->get_type() == SeparatorItem) {
    Gtk::Separator *sep = dynamic_cast<Gtk::Separator *>(w);
    if (sep) {
      sep->set_orientation(toolbar_orientation_from_type(impl->_toolbar_type));
      sep->show();
    }
  }

  const int size = impl->_toolbar.get_children().size();
  if (index < 0 || index >= size)
    index = -1;
  if (impl && w) {
    bool expand = item->get_expandable();
    bool fill = false;
    if (item->get_type() == mforms::ExpanderItem)
      expand = fill = true;

    impl->_toolbar.pack_start(*Gtk::manage(w), expand, fill);
    impl->_toolbar.reorder_child(*w, index);

    w->show_all();
  }
}
开发者ID:pk-codebox-evo,项目名称:mysql-workbench,代码行数:30,代码来源:lf_toolbar.cpp


示例4: switch

//------------------------------------------------------------------------------
std::string mforms::gtk::ToolBarImpl::get_item_text(mforms::ToolBarItem *item) {
  std::string text;

  switch (item->get_type()) {
    case mforms::FlatSelectorItem:
    case mforms::SelectorItem: {
      Gtk::ComboBoxText *ct = cast<Gtk::ComboBoxText *>(item->get_data_ptr());
      if (ct)
        text = ct->get_active_text();
      break;
    }
    case mforms::ColorSelectorItem: {
      const Gtk::ComboBox *combo = cast<Gtk::ComboBox *>(item->get_data_ptr());
      if (combo) {
        const Gtk::TreeIter iter = combo->get_active();
        const Gtk::TreeRow row = *iter;
        text = row.get_value(color_combo_columns->color);
      }
      break;
    }
    case mforms::SearchFieldItem: {
      Gtk::Entry *e = cast<Gtk::Entry *>(item->get_data_ptr());
      if (e)
        text = e->get_text();
      break;
    }
    default: {
      Gtk::Widget *btn = cast<Gtk::Widget *>(item->get_data_ptr());
      if (btn)
        text = btn->get_name();
    }
  }

  return text;
}
开发者ID:pk-codebox-evo,项目名称:mysql-workbench,代码行数:36,代码来源:lf_toolbar.cpp


示例5: NoteEditor

  NoteEditor(grt::Module *m, const grt::BaseListRef &args)
    : PluginEditorBase(m, args), _be(workbench_model_NoteFigureRef::cast_from(args[0])) {
    set_border_width(8);

    _xml = Gtk::Builder::create_from_file(bec::GRTManager::get()->get_data_file_path("modules/data/editor_note.glade"));

    Gtk::Widget *widget;
    _xml->get_widget("base_table", widget);

    Gtk::Image *image;
    _xml->get_widget("image", image);

    // image->set(grtm->get_data_file_path(""));

    Gtk::Entry *entry;
    _xml->get_widget("name_entry", entry);

    add_entry_change_timer(entry, sigc::mem_fun(this, &NoteEditor::set_name));

    Gtk::TextView *tview;
    _xml->get_widget("text_view", tview);

    add_text_change_timer(tview, sigc::mem_fun(_be, &NoteEditorBE::set_text));

    widget->reparent(*this);

    show_all();

    refresh_form_data();
  }
开发者ID:pk-codebox-evo,项目名称:mysql-workbench,代码行数:30,代码来源:editor_note_fe.cpp


示例6: on_note_opened_event

  void NoteAddin::on_note_opened_event(Note & )
  {
    on_note_opened();
    NoteWindow * window = get_window();

    for(std::list<Gtk::MenuItem*>::const_iterator iter = m_tools_menu_items.begin();
        iter != m_tools_menu_items.end(); ++iter) {
      Gtk::Widget *item= *iter;
      if ((item->get_parent() == NULL) ||
          (item->get_parent() != window->plugin_menu()))
        window->plugin_menu()->add (*item);
    }

    for(std::list<Gtk::MenuItem*>::const_iterator iter = m_text_menu_items.begin();
        iter != m_text_menu_items.end(); ++iter) {
      Gtk::Widget *item = *iter;
      if ((item->get_parent() == NULL) ||
          (item->get_parent() != window->text_menu())) {
        window->text_menu()->add (*item);
        window->text_menu()->reorder_child(*(Gtk::MenuItem*)item, 7);
      }
    }
      
    for(ToolItemMap::const_iterator iter = m_toolbar_items.begin();
        iter != m_toolbar_items.end(); ++iter) {
      if ((iter->first->get_parent() == NULL) ||
          (iter->first->get_parent() != window->toolbar())) {
        window->toolbar()->insert (*(iter->first), iter->second);
      }
    }
  }
开发者ID:haobug,项目名称:gnote,代码行数:31,代码来源:noteaddin.cpp


示例7: PrintWidgetPath

void PrintWidgetPath(Gtk::Widget& searched_wdg)
{
    io::cout << "Focus Widget Reverse Path: " << searched_wdg.get_name() << io::endl;
    for( Gtk::Widget* wdg = &searched_wdg; wdg = wdg->get_parent(), wdg; )
        io::cout << " -> " << wdg->get_name();
    io::cout << io::endl;
}
开发者ID:cargabsj175,项目名称:bombono-dvd,代码行数:7,代码来源:test_text.cpp


示例8: _onEntitySelectionChanged

// Callback for objective entity selection changed in list box
void ObjectivesEditor::_onEntitySelectionChanged()
{
	// Clear the objectives list
	_objectiveList->clear();
	
    Gtk::Button* delEntityButton = gladeWidget<Gtk::Button>(
        "deleteEntityButton"
    );
    Gtk::Widget* objButtonPanel = gladeWidget<Gtk::Widget>(
        "objButtonPanel"
    );

	// Get the selection
    Gtk::TreeView* entityList = gladeWidget<Gtk::TreeView>(
        "entitiesTreeView"
    );
	Gtk::TreeModel::iterator iter = entityList->get_selection()->get_selected();
	if (iter) 
    {
		// Get name of the entity and find the corresponding ObjectiveEntity in
		// the map
		std::string name = Glib::ustring((*iter)[_objEntityColumns.entityName]);

		// Save the current selection and refresh the objectives list
		_curEntity = _entities.find(name);
		refreshObjectivesList();

		// Enable the delete button and objectives panel
		delEntityButton->set_sensitive(true);
        objButtonPanel->set_sensitive(true);

        // Enable mission logic button
        gladeWidget<Gtk::Widget>(
            "editSuccessLogicButton"
        )->set_sensitive(true);

		// Enable obj condition button
        gladeWidget<Gtk::Widget>(
            "editObjectiveConditionsButton"
        )->set_sensitive(true);
	}
	else
    {
		// No selection, disable the delete button and clear the objective
		// panel
		delEntityButton->set_sensitive(false);
		objButtonPanel->set_sensitive(false);

        // Disable mission logic button
        gladeWidget<Gtk::Widget>(
            "editSuccessLogicButton"
        )->set_sensitive(false);

		// Disable obj condition button
        gladeWidget<Gtk::Widget>(
            "editObjectiveConditionsButton"
        )->set_sensitive(false);
	}
}
开发者ID:DerSaidin,项目名称:DarkRadiant,代码行数:60,代码来源:ObjectivesEditor.cpp


示例9: on_action_view_toolbar

void GridWindow::on_action_view_toolbar()
{	
    Gtk::Widget	*pToolBar = mUIManager->get_widget("/ToolBar");
	if (pToolBar->is_visible())
		pToolBar->hide();
	else
		pToolBar->show();
}
开发者ID:elbeno,项目名称:xwordedit,代码行数:8,代码来源:grid_window.cpp


示例10: runtime_error

//------------------------------------------------------------------------------
void mforms::gtk::ToolBarImpl::set_item_enabled(mforms::ToolBarItem *item, bool is_on) {
  Gtk::Widget *w = cast<Gtk::Widget *>(item->get_data_ptr());
  if (w) {
    w->set_sensitive(is_on);
    if (w->get_sensitive() != is_on)
      throw new std::runtime_error("Failed to change sensivity");
  }
}
开发者ID:pk-codebox-evo,项目名称:mysql-workbench,代码行数:9,代码来源:lf_toolbar.cpp


示例11: manage

SearchNotesWidget::SearchNotesWidget(NoteManager & m)
  : m_accel_group(Gtk::AccelGroup::create())
  , m_no_matches_box(NULL)
  , m_manager(m)
  , m_clickX(0), m_clickY(0)
  , m_matches_column(NULL)
  , m_note_list_context_menu(NULL)
  , m_notebook_list_context_menu(NULL)
  , m_initial_position_restored(false)
  , m_sort_column_id(2)
  , m_sort_column_order(Gtk::SORT_DESCENDING)
{
  set_hexpand(true);
  set_vexpand(true);
  make_actions();

  // Notebooks Pane
  Gtk::Widget *notebooksPane = Gtk::manage(make_notebooks_pane());
  notebooksPane->show();

  set_position(150);
  add1(*notebooksPane);
  add2(m_matches_window);

  make_recent_tree();
  m_tree = manage(m_tree);
  m_tree->set_enable_search(false);
  m_tree->show();

  update_results();

  m_matches_window.property_hscrollbar_policy() = Gtk::POLICY_AUTOMATIC;
  m_matches_window.property_vscrollbar_policy() = Gtk::POLICY_AUTOMATIC;
  m_matches_window.add(*m_tree);
  m_matches_window.show();

  // Update on changes to notes
  m.signal_note_deleted.connect(sigc::mem_fun(*this, &SearchNotesWidget::on_note_deleted));
  m.signal_note_added.connect(sigc::mem_fun(*this, &SearchNotesWidget::on_note_added));
  m.signal_note_renamed.connect(sigc::mem_fun(*this, &SearchNotesWidget::on_note_renamed));
  m.signal_note_saved.connect(sigc::mem_fun(*this, &SearchNotesWidget::on_note_saved));

  // Watch when notes are added to notebooks so the search
  // results will be updated immediately instead of waiting
  // until the note's queue_save () kicks in.
  notebooks::NotebookManager::obj().signal_note_added_to_notebook()
    .connect(sigc::mem_fun(*this, &SearchNotesWidget::on_note_added_to_notebook));
  notebooks::NotebookManager::obj().signal_note_removed_from_notebook()
    .connect(sigc::mem_fun(*this, &SearchNotesWidget::on_note_removed_from_notebook));
  notebooks::NotebookManager::obj().signal_note_pin_status_changed
    .connect(sigc::mem_fun(*this, &SearchNotesWidget::on_note_pin_status_changed));

  Glib::RefPtr<Gio::Settings> settings = Preferences::obj().get_schema_settings(Preferences::SCHEMA_GNOTE);
  settings->signal_changed().connect(sigc::mem_fun(*this, &SearchNotesWidget::on_settings_changed));
  parse_sorting_setting(settings->get_string(Preferences::SEARCH_SORTING));
  settings = Preferences::obj().get_schema_settings(Preferences::SCHEMA_DESKTOP_GNOME_INTERFACE);
  settings->signal_changed().connect(sigc::mem_fun(*this, &SearchNotesWidget::on_settings_changed));
}
开发者ID:mattiklock,项目名称:gnote,代码行数:58,代码来源:searchnoteswidget.cpp


示例12: on_size_allocate

MainWindow::MainWindow()
{
	set_default_size(600, 400);
	toggling_show_menubar = App::enable_mainwin_menubar;

	main_dock_book_ = manage(new DockBook());
	main_dock_book_->allow_empty = true;
	main_dock_book_->show();

	class Bin : public Gtk::Bin {
	public:
		Bin() { }
	protected:
		void on_size_allocate(Gtk::Allocation &allocation) {
			Gtk::Bin::on_size_allocate(allocation);
			if (get_child() != NULL)
				get_child()->size_allocate(allocation);
		}
	};

	bin_ = manage((Gtk::Bin*)new Bin());
	bin_->add(*main_dock_book_);
	bin_->show();

	Gtk::VBox *vbox = manage(new Gtk::VBox());

	Gtk::Widget* menubar = App::ui_manager()->get_widget("/menubar-main");
	if (menubar != NULL)
	{
		vbox->pack_start(*menubar, false, false, 0);
	}

	vbox->pack_end(*bin_, true, true, 0);
	vbox->show();
	if(!App::enable_mainwin_menubar) menubar->hide();

	add(*vbox);

	add_accel_group(App::ui_manager()->get_accel_group());

	init_menus();
	window_action_group = Gtk::ActionGroup::create("mainwindow-recentfiles");
	App::ui_manager()->insert_action_group(window_action_group);

	App::signal_recent_files_changed().connect(
		sigc::mem_fun(*this, &MainWindow::on_recent_files_changed) );

	signal_delete_event().connect(
		sigc::ptr_fun(App::shutdown_request) );

	App::dock_manager->signal_dockable_registered().connect(
		sigc::mem_fun(*this,&MainWindow::on_dockable_registered) );

	App::dock_manager->signal_dockable_unregistered().connect(
		sigc::mem_fun(*this,&MainWindow::on_dockable_unregistered) );

	GRAB_HINT_DATA("mainwindow");
}
开发者ID:d-j-a-y,项目名称:synfig,代码行数:58,代码来源:mainwindow.cpp


示例13:

Gtk::VBox *
Extension::get_params_widget(void)
{
    Gtk::VBox * retval = Gtk::manage(new Gtk::VBox());
    Gtk::Widget * content = Gtk::manage(new Gtk::Label("Params"));
    retval->pack_start(*content, true, true, 5);
    content->show();
    retval->show();
    return retval;
}
开发者ID:Grandrogue,项目名称:inkscape_metal,代码行数:10,代码来源:extension.cpp


示例14:

Gtk::Widget *
PathParam::param_newWidget()
{
    Gtk::HBox * _widget = Gtk::manage(new Gtk::HBox());

    Gtk::Label* pLabel = Gtk::manage(new Gtk::Label(param_label));
    static_cast<Gtk::HBox*>(_widget)->pack_start(*pLabel, true, true);
    pLabel->set_tooltip_text(param_tooltip);

    Gtk::Widget*  pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("tool-node-editor"), Inkscape::ICON_SIZE_BUTTON) );
    Gtk::Button * pButton = Gtk::manage(new Gtk::Button());
    pButton->set_relief(Gtk::RELIEF_NONE);
    pIcon->show();
    pButton->add(*pIcon);
    pButton->show();
    pButton->signal_clicked().connect(sigc::mem_fun(*this, &PathParam::on_edit_button_click));
    static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true);
    pButton->set_tooltip_text(_("Edit on-canvas"));

    pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("edit-copy"), Inkscape::ICON_SIZE_BUTTON) );
    pButton = Gtk::manage(new Gtk::Button());
    pButton->set_relief(Gtk::RELIEF_NONE);
    pIcon->show();
    pButton->add(*pIcon);
    pButton->show();
    pButton->signal_clicked().connect(sigc::mem_fun(*this, &PathParam::on_copy_button_click));
    static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true);
    pButton->set_tooltip_text(_("Copy path"));

    pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("edit-paste"), Inkscape::ICON_SIZE_BUTTON) );
    pButton = Gtk::manage(new Gtk::Button());
    pButton->set_relief(Gtk::RELIEF_NONE);
    pIcon->show();
    pButton->add(*pIcon);
    pButton->show();
    pButton->signal_clicked().connect(sigc::mem_fun(*this, &PathParam::on_paste_button_click));
    static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true);
    pButton->set_tooltip_text(_("Paste path"));

    pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("edit-clone"), Inkscape::ICON_SIZE_BUTTON) );
    pButton = Gtk::manage(new Gtk::Button());
    pButton->set_relief(Gtk::RELIEF_NONE);
    pIcon->show();
    pButton->add(*pIcon);
    pButton->show();
    pButton->signal_clicked().connect(sigc::mem_fun(*this, &PathParam::on_link_button_click));
    static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true);
    pButton->set_tooltip_text(_("Link to path on clipboard"));

    static_cast<Gtk::HBox*>(_widget)->show_all_children();

    return dynamic_cast<Gtk::Widget *> (_widget);
}
开发者ID:myutwo,项目名称:inkscape,代码行数:53,代码来源:path.cpp


示例15: app_gtkmm_get_column_header

// Note: This works only if the column has custom widget set.
Gtk::Widget* app_gtkmm_get_column_header(Gtk::TreeViewColumn& column)
{
	Gtk::Widget* w = column.get_widget();
	Gtk::Widget* p1 = 0;
	Gtk::Widget* p2 = 0;
	Gtk::Widget* p3 = 0;

	// move up to GtkAlignment, then GtkHBox, then GtkButton.
	if (w && (p1 = w->get_parent()) && (p2 = p1->get_parent()) && (p3 = p2->get_parent()))
		return p3;

	return NULL;
}
开发者ID:BackupTheBerlios,项目名称:gsmartcontrol-svn,代码行数:14,代码来源:app_gtkmm_utils.cpp


示例16: add

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();
}
开发者ID:yborisovstc,项目名称:fap2-studio-gtk,代码行数:51,代码来源:mainwnd.cpp


示例17: app_gtkmm_set_widget_tooltip

// A wrapper around set_tooltip_*() for portability across different gtkmm versions.
void app_gtkmm_set_widget_tooltip(Gtk::Widget& widget,
		const Glib::ustring& tooltip_text, bool use_markup)
{
	// set_tooltip_* is available since 2.12
#ifndef APP_GTKMM_OLD_TOOLTIPS
	if (use_markup) {
		widget.set_tooltip_markup(tooltip_text);
	} else {
		widget.set_tooltip_text(tooltip_text);
	}

#else  // use the old tooltips api
	Gtk::Widget* toplevel = widget.get_toplevel();
	if (toplevel && toplevel->is_toplevel()) {  // orphan widgets return themselves, so check toplevelness.
		GtkTooltips* tooltips = static_cast<GtkTooltips*>(toplevel->get_data("window_tooltips"));
		if (tooltips) {
			if (use_markup) {
				// strip markup
				Glib::ustring stripped;
				if (app_pango_strip_markup(tooltip_text, stripped)) {
					gtk_tooltips_set_tip(tooltips, widget.gobj(), stripped.c_str(), "");
				}

			} else {
				gtk_tooltips_set_tip(tooltips, widget.gobj(), tooltip_text.c_str(), "");
			}
		}
	}
#endif
}
开发者ID:BackupTheBerlios,项目名称:gsmartcontrol-svn,代码行数:31,代码来源:app_gtkmm_utils.cpp


示例18:

                               int *width, int *height) const
#else
/** Get required size for cell.
 * @param widget widget
 * @param cell_area area of the cell
 * @param x_offset ignored
 * @param y_offset ignored
 * @param width upon return contains the required width of the cell
 * @param height upon return contains the required height of the cell
 */
void
TwoLinesCellRenderer::get_size_vfunc(Gtk::Widget &widget,
				     const Gdk::Rectangle *cell_area,
				     int *x_offset, int *y_offset,
				     int *width, int *height) const
#endif
{
#ifdef GLIBMM_PROPERTIES_ENABLED
  // Compute text width
  Glib::RefPtr<Pango::Layout> layout_ptr = widget.create_pango_layout(__property_line1);
  Pango::Rectangle rect = layout_ptr->get_pixel_logical_extents();
	
  int line1_width  = property_xpad() * 2 + rect.get_width();
  int line1_height = property_ypad() * 2 + rect.get_height();
  int line2_height;

  if (__property_line2_enabled.get_value()) {
    Glib::RefPtr<Pango::Layout> layout2 = widget.create_pango_layout(__property_line2);
#if GTK_VERSION_GE(3,0)
    Pango::FontDescription font2("sans 10");
#else
    Glib::RefPtr<Gtk::Style> style = widget.get_style();
    Pango::FontDescription font2 = style->get_font();
#endif

    font2.set_size((int)roundf(Pango::SCALE_SMALL * font2.get_size()));
    layout2->set_font_description(font2);
    Pango::Rectangle rect2 = layout2->get_pixel_logical_extents();
    layout2->set_ellipsize(Pango::ELLIPSIZE_END);

    line2_height = property_ypad() * 2 + rect2.get_height();
  } else {
    line2_height = 0;
  }

  if (width)  *width  = line1_width;
  if (height) *height = line1_height + 4 + line2_height;
#endif
}
开发者ID:sanyaade-teachings,项目名称:fawkes,代码行数:49,代码来源:twolines_cellrenderer.cpp


示例19: _defocus

void Dialog::_defocus()
{
    SPDesktop *desktop = SP_ACTIVE_DESKTOP;

    if (desktop) {
        Gtk::Widget *canvas = Glib::wrap(GTK_WIDGET(desktop->canvas));

        // make sure the canvas window is present before giving it focus
        Gtk::Window *toplevel_window = dynamic_cast<Gtk::Window *>(canvas->get_toplevel());
        if (toplevel_window)
            toplevel_window->present();

        canvas->grab_focus();
    }
}
开发者ID:zanqi,项目名称:inkscape,代码行数:15,代码来源:dialog.cpp


示例20:

void
Dockable::add(Gtk::Widget& x)
{
	if(prev_widget_)
	{
		remove(*prev_widget_);
		clear_previous();
	}

	if(scrolled_)
	{
		delete scrolled_;
		scrolled_=0;
	}

	if(use_scrolled_)
	{
		scrolled_=new Gtk::ScrolledWindow;

		scrolled_->add(x);

		attach(*scrolled_, 0, 1, 1,2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);

		x.show();

		scrolled_->show();

		scrolled_->set_shadow_type(Gtk::SHADOW_NONE);
		scrolled_->set_policy(Gtk::POLICY_AUTOMATIC,Gtk::POLICY_AUTOMATIC);
		prev_widget_=scrolled_;
	}
	else
	{
		attach(x, 0, 1, 1,2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
		x.show();
		prev_widget_=&x;
	}
	prev_widget_delete_connection=prev_widget_->signal_delete_event().connect(
		sigc::hide(
			sigc::mem_fun(
				*this,
				&Dockable::clear_previous
			)
		)
	);
}
开发者ID:d-j-a-y,项目名称:synfig,代码行数:46,代码来源:dockable.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ gtk::Window类代码示例发布时间:2022-05-31
下一篇:
C++ gtk::VBox类代码示例发布时间: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