Beispiel #1
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;
    }
Beispiel #2
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;
    }
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: "******"Password: "******"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);
}