//------------------------------------------------------------------------------
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;
}
Beispiel #2
0
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;
}
//------------------------------------------------------------------------------
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();
  }
}
//------------------------------------------------------------------------------
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;
}
Beispiel #5
0
void MainWindow::update_status(Result result) {
    switch (result) {
        status_frame.modify_bg(Gtk::STATE_NORMAL,Gdk::Color::Color("green")); // { dg-error "" }
        status_frame.modify_bg(Gtk::STATE_NORMAL,Gdk::Color::Color("red")); // { dg-error "" }
        status_label.set_text("Out of memory");
    }
}
  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();
  }
Beispiel #7
0
  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);
      }
    }
  }
Beispiel #8
0
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;
}
// 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);
	}
}
Beispiel #10
0
void GridWindow::on_action_view_toolbar()
{	
    Gtk::Widget	*pToolBar = mUIManager->get_widget("/ToolBar");
	if (pToolBar->is_visible())
		pToolBar->hide();
	else
		pToolBar->show();
}
//------------------------------------------------------------------------------
void mforms::gtk::ToolBarImpl::set_item_tooltip(mforms::ToolBarItem *item, const std::string &text) {
  Gtk::Widget *w = cast<Gtk::Widget *>(item->get_data_ptr());
  if (w) {
#if GTK_VERSION_GT(2, 10)
    w->set_tooltip_text(text);
#endif
  }
}
//------------------------------------------------------------------------------
bool mforms::gtk::ToolBarImpl::get_item_enabled(mforms::ToolBarItem *item) {
  bool ret = false;
  Gtk::Widget *w = cast<Gtk::Widget *>(item->get_data_ptr());
  if (w)
    ret = w->get_sensitive();

  return ret;
}
//------------------------------------------------------------------------------
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");
  }
}
Beispiel #14
0
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));
}
Beispiel #15
0
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");
}
Beispiel #16
0
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;
}
void mforms::gtk::ToolBarImpl::set_item_name(mforms::ToolBarItem *item, const std::string &name) {
  Gtk::Widget *w = cast<Gtk::Widget *>(item->get_data_ptr());
  if (w) {
    w->set_name(name);
    {
      Glib::RefPtr<Atk::Object> acc = w->get_accessible();
      if (acc)
        acc->set_name(name);
    }
  }
}
Beispiel #18
0
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);
}
//------------------------------------------------------------------------------
Gtk::Widget *mforms::widget_for_toolbar_item_named(mforms::ToolBar *toolbar, const std::string &name) {
  mforms::ToolBarItem *item = toolbar->find_item(name);
  if (item) {
    Gtk::Widget *w = cast<Gtk::Widget *>(item->get_data_ptr());
#if GTK_VERSION_LT(2, 16)
    if (item->get_type() == SearchFieldItem)
      w = cast<Gtk::Widget *>(w->get_data("entry"));
#endif
    return w;
  }
  return 0;
}
// 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;
}
Beispiel #21
0
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();
}
// 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
}
                               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
}
Beispiel #24
0
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();
    }
}
	void on_remove_widget()
	{
		hide();
		edit_done_called=true;
		if(parent)parent->grab_focus();
		Gtk::CellEditable::on_remove_widget();
	}
Beispiel #26
0
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
			)
		)
	);
}
Beispiel #27
0
void
MainWindow::toggle_show_menubar()
{
	Gtk::Widget* menubar = App::ui_manager()->get_widget("/menubar-main");

	if(toggling_show_menubar)
	{
		menubar->hide();
		toggling_show_menubar = false;
	}
	else
	{
		menubar->show();
		toggling_show_menubar = true;
	}
	App::enable_mainwin_menubar = toggling_show_menubar;
}
void
Dialog_ToolOptions::set_widget(Gtk::Widget&x)
{
	std::vector<Gtk::Widget*> children = sub_vbox_.get_children();
	for(std::vector<Gtk::Widget*>::iterator i = children.begin(); i != children.end(); ++i)
		sub_vbox_.remove(**i);
	sub_vbox_.show();
	sub_vbox_.pack_start(x,false,false);
	x.show();
}
Beispiel #29
0
PopupWin::PopupWin( Gtk::Widget* parent, SKELETON::View* view, const int mrg_x, const int mrg_y )
    : PopupWinBase( POPUPWIN_NOFRAME ),
      m_parent( parent ),
      m_view( view ),
      m_mrg_x( mrg_x ),
      m_mrg_y( mrg_y )
{
#ifdef _DEBUG
    std::cout << "PopupWin::PopupWin\n";
#endif

    m_view->sig_resize_popup().connect( sigc::mem_fun( *this, &PopupWin::slot_resize_popup ) );
    add( *m_view );
    m_view->sig_hide_popup().connect( sigc::mem_fun( *this, &PopupWin::slot_hide_popup ) );
    m_view->show_view();

    Gtk::Widget* toplevel = m_parent->get_toplevel();
    if( toplevel->is_toplevel() ) set_transient_for( *( ( Gtk::Window* )toplevel ) );
    slot_resize_popup();
}
//------------------------------------------------------------------------------
void mforms::gtk::TableImpl::add(Table *self, View *child, int left, int right, int top, int bottom, int flags) {
  TableImpl *table = self->get_data<TableImpl>();
  if (table) {
    if ((int)table->_colCount < right || (int)table->_rowCount < bottom)
      throw std::logic_error(base::strfmt("Tried to use col %d, row %d, but the table has got only %d cols, %d rows.",
                                          right, bottom, (int)table->_colCount, (int)table->_rowCount));
    Gtk::Widget *widget = child->get_data<ViewImpl>()->get_outer();
    if (widget) {
      int height = bottom - top;
      int width = right - left;
      table->_grid->attach(*widget, left, top, width, height);

      if (flags & mforms::VExpandFlag)
        widget->set_vexpand();
      if (flags & mforms::VFillFlag)
        widget->set_valign(Gtk::ALIGN_FILL);
      if (flags & mforms::HExpandFlag)
        widget->set_hexpand();
      if (flags & mforms::HFillFlag)
        widget->set_halign(Gtk::ALIGN_FILL);

      widget->show();
    }
  }
}