Пример #1
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);
      }
    }
  }
Пример #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;
}
Пример #3
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;
}
// 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;
}
Пример #5
0
Gtk::Button* get_tree_view_column_header_button(Gtk::TreeViewColumn& column)
{
	Gtk::Widget* widget;

	if( !( widget = column.get_widget() ) )
	{
		// Если для заголовка не установлен никакой виджет, устанавливаем свой Gtk::Label,
		// чтобы по нему можно было выйти на остальные виджеты заголовка.
		Gtk::Label* header_label = Gtk::manage(new Gtk::Label(column.get_title()));
		column.set_widget(*header_label);
		header_label->show();

		widget = header_label->get_parent();
	}

	// Поднимаемся вверх по дереву контейнеров,
	// пока не наткнемся на Gtk::Button.
	while(widget && widget->get_name() != "GtkButton")
		widget = widget->get_parent();

	return dynamic_cast<Gtk::Button*>(widget);
}