Tutorial |
||
|
||
|
Arrow(); Arrow(Gtk::ArrowType arrow_type, Gtk::ShadowType shadow_type); |
void set(Gtk::ArrowType arrow_type, Gtk::ShadowType shadow_type); |
#include<inti/main.h> #include <inti/core.h> #include <inti/gtk/arrow.h> #include <inti/gtk/button.h> using namespace Inti; // ArrowButton class ArrowButton : public Gtk::Button { ArrowButton(const ArrowButton&); ArrowButton& operator=(const ArrowButton&); public: ArrowButton(Gtk::ArrowType arrow_type, Gtk::ShadowType shadow_type); virtual ~ArrowButton(); }; // ArrowWindow class ArrowWindow : public Gtk::Window { ArrowWindow(const ArrowWindow&); ArrowWindow& operator=(const ArrowWindow&); public: ArrowWindow(); virtual ~ArrowWindow(); }; |
#include"arrow.h" // ArrowButton ArrowButton::ArrowButton(Gtk::ArrowType arrow_type, Gtk::ShadowType shadow_type) { // Create an Arrow widget with the specified parameters and pack it into the button. Gtk::Arrow *arrow = new Gtk::Arrow(arrow_type, shadow_type); add(*arrow); } ArrowButton::~ArrowButton() { } // ArrowWindow ArrowWindow::ArrowWindow() { set_title("Arrow Buttons"); set_border_width(10); // Create a box to hold the arrows/buttons Gtk::HBox *hbox = new Gtk::HBox; hbox->set_border_width(2); add(*hbox); // Pack and show all the widgets. ArrowButton *button = new ArrowButton(Gtk::ARROW_UP, Gtk::SHADOW_IN); hbox->pack_start(*button, false,false, 3); button = new ArrowButton(Gtk::ARROW_DOWN, Gtk::SHADOW_OUT); hbox->pack_start(*button, false,false, 3); button = new ArrowButton(Gtk::ARROW_LEFT, Gtk::SHADOW_ETCHED_IN); hbox->pack_start(*button, false,false, 3); button = new ArrowButton(Gtk::ARROW_RIGHT, Gtk::SHADOW_ETCHED_OUT); hbox->pack_start(*button, false,false, 3); show_all(); } ArrowWindow::~ArrowWindow() { } // Convenience macro for a simple main function GCODE_MAIN(ArrowWindow) |
#define
INTI_MAIN(MainWidget)\ int main (int argc, char *argv[])\ {\ Inti::Main::init(&argc, &argv);\ MainWidget main_widget;\ main_widget.sig_destroy().connect(slot(&Inti::Main::quit));\ main_widget.show();\ Inti::Main::run();\ return 0;\ } |
|
|||
|
|||