Example #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_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->embeddable_toolbar())) {
        Gtk::Grid *grid = window->embeddable_toolbar();
        grid->insert_column(iter->second);
        grid->attach(*iter->first, iter->second, 0, 1, 1);
      }
    }
  }
Example #2
0
    Gtk::Grid * SmartChessWindow::createOptionsArea() {
        const int OPTIONS_ROWS = 4;
        Gtk::Grid* options = Gtk::manage(new Gtk::Grid());
        options->set_vexpand();
        options->set_hexpand(false);
        options->insert_column(0);

        for(auto i : IntRange(OPTIONS_ROWS))
            options->insert_row(i);

        Gtk::Button* b = Gtk::manage(new Gtk::Button("Start"));
        b->set_hexpand(false);
        b->signal_clicked().connect(sigc::mem_fun(this, &SmartChessWindow::onStartGame));
        options->attach(*b, 0, 0, 1, 1);

        b = Gtk::manage(new Gtk::Button("End"));
        b->set_hexpand(false);
        b->signal_clicked().connect(sigc::mem_fun(this, &SmartChessWindow::onEndGame));
        options->attach(*b, 0, 1, 1, 1);

        b = Gtk::manage(new Gtk::Button("Reset"));
        b->set_hexpand(false);
        b->signal_clicked().connect(sigc::mem_fun(this, &SmartChessWindow::onResetGame));
        options->attach(*b, 0, 2, 1, 1);

        auto suboptions = createSuboptionsArea();
        options->attach(*suboptions, 0, 3, 1, 1);

        return options;
    }
Example #3
0
 void NoteAddin::add_tool_item (Gtk::ToolItem *item, int position)
 {
   if (is_disposing())
     throw sharp::Exception(_("Plugin is disposing already"));
       
   m_toolbar_items [item] = position;
     
   if (m_note->is_opened()) {
     Gtk::Grid *grid = get_window()->embeddable_toolbar();
     grid->insert_column(position);
     grid->attach(*item, position, 0, 1, 1);
   }
 }
Example #4
0
    Gtk::Grid * SmartChessWindow::createMainGrid() const {
        Gtk::Grid* grid = Gtk::manage(new Gtk::Grid());
        grid->set_row_homogeneous(false);
        grid->set_column_homogeneous(false);
        grid->set_vexpand();
        grid->set_hexpand();

        for(auto i : IntRange(ROW_COUNT))
            grid->insert_row(i);

        for(auto i : IntRange(COLUMN_COUNT))
            grid->insert_column(i);

        return grid;
    }