Tutorial |
||
|
||
|
Statusbar(); |
unsigned
int get_context_id(const
String&
context_description) const; |
unsigned
int push(const String& text, unsigned int context_id = 0); void pop(unsigned int context_id = 0); void remove(unsigned int message_id, unsigned int context_id = 0); |
void
set_has_resize_grip(bool setting); bool get_has_resize_grip() const; |
#include<inti/main.h> #include <inti/core.h> #include <inti/gtk/statusbar.h> using namespace Inti; class StatusbarWindow : public Gtk::Window { Gtk::Statusbar *status_bar; protected: void on_push_item(int context_id); void on_pop_item(int context_id); public: StatusbarWindow(); ~StatusbarWindow(); }; |
#include"statusbar.h" #include <inti/gtk/button.h> #include <inti/bind.h> StatusbarWindow::StatusbarWindow() { set_title("Inti Statusbar Example"); set_size_request(200, 100); Gtk::VBox *vbox = new Gtk::VBox(false, 1); add(*vbox); vbox->show(); status_bar = new Gtk::Statusbar; vbox->pack_start(*status_bar); status_bar->show(); int context_id = status_bar->get_context_id("Statusbar example"); Gtk::Button *button = new Gtk::Button("push item"); button->sig_clicked().connect(bind(slot(this, &StatusbarWindow::on_push_item), context_id)); vbox->pack_start(*button, true,true, 2); button->show(); button = new Gtk::Button("pop last item"); button->sig_clicked().connect(bind(slot(this, &StatusbarWindow::on_pop_item), context_id)); vbox->pack_start(*button, true,true, 2); button->show(); // Always display the window as the last step so it all splashes on the screen at once. show(); } StatusbarWindow::~StatusbarWindow() { } void StatusbarWindow::on_push_item(int context_id) { static int count = 1; String text = String::format("Item %d", count++); status_bar->push(text, context_id); } void StatusbarWindow::on_pop_item(int context_id) { status_bar->pop(context_id); } int main (int argc, char *argv[]) { using namespace Main; init(&argc, &argv); StatusbarWindow window; window.sig_destroy().connect(slot(&Inti::Main::quit)); run(); return 0; } |
|
|||
|
|||