Class Index Cross Index Namespace Index

Class Gtk::Button

Toplevel Button
Contained in: Gtk
Derived from: Gtk::Bin
Derived by: Gtk::OptionMenu Gtk::ToggleButton

#include <gtk--/button.h>


public function member index:

Button();
explicit Button(const string& label, gfloat x=0.5, gfloat y=0.5);
emitable signal void clicked();
emitable signal void enter();
GtkReliefStyle get_relief() const;
GtkButton* gtkobj();
const GtkButton* gtkobj() const;
static bool isA(Object* object);
emitable signal void leave();
emitable signal void pressed();
emitable signal void released();
void set_relief(GtkReliefStyle newstyle);
virtual ~Button();
 

protected function member index:

virtual void clicked_impl();
virtual void enter_impl();
virtual void leave_impl();
virtual void pressed_impl();
virtual void released_impl();
 

Description:

The button widget is a rectangular clickable widget. You can decorate it with images, text, or whatever you like.


Function Member Descriptions:

Gtk::Button::Button - Create an empty button.

Button();
With an empty button, you can Gtk_Button::add a widget such as a Gtk::Pixmap or Gtk::Box.

If you just wish to add a Gtk::Label, you may want to use the {Button(const string &label)} ctor directly instead.



Gtk::Button::Button - Simple Push Button with label.

explicit Button(const string& label, gfloat x=0.5, gfloat y=0.5);
Create a button with the given label inside. You won't be able to add a widget in this button since it already has a Gtk_Label in it.


Gtk::Button::clicked - Emitted on button press and release.

emitable signal void clicked();
virtual void clicked_impl();
Triggered when the user has pressed and released the mouse button This is the signal you most likely want to connect.


Gtk::Button::enter - Triggered when the mouse cursor enters the button

emitable signal void enter();
virtual void enter_impl();

Gtk::Button::get_relief - Return the button's relief style. (see Gtk_Button::set_relief)

GtkReliefStyle get_relief() const;

Gtk::Button::gtkobj - Returns the underlaying gtk+ object.

GtkButton* gtkobj();

Gtk::Button::isA - Returns true if object is this type.

static bool isA(Object* object);

Gtk::Button::leave - Triggered when the mouse cursor leaves the button

emitable signal void leave();
virtual void leave_impl();

Gtk::Button::pressed - Emited on button press.

emitable signal void pressed();
virtual void pressed_impl();
Triggered when the button is pressed (e.g. the mouse button is still down, it hasn't been released yet, see next signal)


Gtk::Button::released - Triggered when the user has released the mouse button

emitable signal void released();
virtual void released_impl();

Gtk::Button::set_relief - Set the button's relief style.

void set_relief(GtkReliefStyle newstyle);
This effects how the button looks. GtkReliefStyle can be one of GTK_RELIEF_NORMAL, GTK_RELIEF_HALF, or GTK_RELIEF_NONE.
  //This program shows the differences in button styles.

#include <gtk--/button.h> #include <gtk--/window.h> #include <gtk--/box.h> #include <gtk--/main.h>

//This custom window will contain 3 buttons, one of //each style. class custom_window : public Gtk::Window { Gtk::Button normal, half, none; Gtk::HBox some_hbox; public: custom_window(); };

//The constructor. Creates the window adds the buttons, //and sets their style. custom_window::custom_window() : Gtk::Window(GTK_WINDOW_TOPLEVEL), some_hbox(true, 2), normal("Normal"), half("Half"), none("None") { normal.set_relief(GTK_RELIEF_NORMAL); half.set_relief(GTK_RELIEF_HALF); none.set_relief(GTK_RELIEF_NONE); some_hbox.pack_start(normal, true, true, 0); some_hbox.pack_start(half, true, true, 0); some_hbox.pack_start(none, true, true, 0); add(some_hbox); show_all(); }

int main(int argc, char *argv[]) { Gtk::Main main_runner(argc, argv); custom_window some_window; main_runner.run(); }