2
// Generated by gtkmmproc -- DO NOT MODIFY!
3
#ifndef _GTKMM_BUTTON_H
4
#define _GTKMM_BUTTON_H
9
/* $Id: button.hg,v 1.10 2006/08/21 19:07:14 jjongsma Exp $ */
13
* Copyright (C) 1998-2002 The gtkmm Development Team
15
* This library is free software; you can redistribute it and/or
16
* modify it under the terms of the GNU Lesser General Public
17
* License as published by the Free Software Foundation; either
18
* version 2.1 of the License, or (at your option) any later version.
20
* This library is distributed in the hope that it will be useful,
21
* but WITHOUT ANY WARRANTY; without even the implied warranty of
22
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23
* Lesser General Public License for more details.
25
* You should have received a copy of the GNU Lesser General Public
26
* License along with this library; if not, write to the Free
27
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30
#include <gtkmm/bin.h>
31
#include <gtkmm/activatable.h>
32
#include <gtkmm/stockid.h>
35
#ifndef DOXYGEN_SHOULD_SKIP_THIS
36
typedef struct _GtkButton GtkButton;
37
typedef struct _GtkButtonClass GtkButtonClass;
38
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
42
{ class Button_Class; } // namespace Gtk
46
namespace Stock { struct BuiltinStockID; }
48
/** A widget that creates a signal when clicked on.
50
* This widget is generally used with a signal handler that is called when the button is pressed.
51
* It can hold any valid child widget. The most commonly used child is the Gtk::Label.
53
* The Button widget looks like this:
54
* @image html button2.png
64
#ifndef DOXYGEN_SHOULD_SKIP_THIS
65
typedef Button CppObjectType;
66
typedef Button_Class CppClassType;
67
typedef GtkButton BaseObjectType;
68
typedef GtkButtonClass BaseClassType;
69
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
73
#ifndef DOXYGEN_SHOULD_SKIP_THIS
76
friend class Button_Class;
77
static CppClassType button_class_;
80
Button(const Button&);
81
Button& operator=(const Button&);
84
explicit Button(const Glib::ConstructParams& construct_params);
85
explicit Button(GtkButton* castitem);
87
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
90
#ifndef DOXYGEN_SHOULD_SKIP_THIS
91
static GType get_type() G_GNUC_CONST;
94
static GType get_base_type() G_GNUC_CONST;
97
///Provides access to the underlying C GtkObject.
98
GtkButton* gobj() { return reinterpret_cast<GtkButton*>(gobject_); }
100
///Provides access to the underlying C GtkObject.
101
const GtkButton* gobj() const { return reinterpret_cast<GtkButton*>(gobject_); }
105
//C++ methods used to invoke GTK+ virtual functions:
108
//GTK+ Virtual Functions (override these to change behaviour):
110
//Default Signal Handlers::
111
virtual void on_pressed();
112
virtual void on_released();
113
virtual void on_clicked();
114
virtual void on_enter();
115
virtual void on_leave();
116
virtual void on_activate();
124
/** Create an empty button.
125
* With an empty button, you can Gtk::Button::add() a widget
126
* such as a Gtk::Image or Gtk::Box.
128
* If you just wish to add a Gtk::Label,
130
* use the Gtk::Button(const Glib::ustring& label) ctor
136
/** Simple Push Button with label.
137
* Create a button with the given label inside. You won't be able
138
* to add a widget in this button since it already has a Gtk::Label
141
explicit Button(const Glib::ustring& label, bool mnemonic = false);
143
/** Creates a new Button containing the image and text from a stock item.
144
* Stock ids have identifiers like Gtk::Stock::OK and Gtk::Stock::APPLY.
145
* @param stock_id The stock item.
147
explicit Button(const StockID& stock_id);
150
/** Emits a Gtk::Button::clicked signal to the given Gtk::Button.
156
/** Sets the relief style of the edges of the given Gtk::Button widget.
157
* Three styles exist, GTK_RELIEF_NORMAL, GTK_RELIEF_HALF, GTK_RELIEF_NONE.
158
* The default style is, as one can guess, GTK_RELIEF_NORMAL.
160
* <!-- FIXME: put pictures of each style -->
161
* @param newstyle The GtkReliefStyle as described above.
163
void set_relief(ReliefStyle newstyle);
165
/** Returns the current relief style of the given Gtk::Button.
166
* @return The current Gtk::ReliefStyle.
168
ReliefStyle get_relief() const;
171
/** Sets the text of the label of the button to @a str. This text is
172
* also used to select the stock item if set_use_stock()
175
* This will also clear any previously set labels.
176
* @param label A string.
178
void set_label(const Glib::ustring& label);
180
/** Fetches the text from the label of the button, as set by
181
* set_label(). If the label text has not
182
* been set the return value will be <tt>0</tt>. This will be the
183
* case if you create an empty button with new() to
184
* use as a container.
185
* @return The text of the label widget. This string is owned
186
* by the widget and must not be modified or freed.
188
Glib::ustring get_label() const;
190
/** If true, an underline in the text of the button label indicates
191
* the next character should be used for the mnemonic accelerator key.
192
* @param use_underline <tt>true</tt> if underlines in the text indicate mnemonics.
194
void set_use_underline(bool use_underline = true);
196
/** Returns whether an embedded underline in the button label indicates a
197
* mnemonic. See set_use_underline().
198
* @return <tt>true</tt> if an embedded underline in the button label
199
* indicates the mnemonic accelerator keys.
201
bool get_use_underline() const;
203
/** If <tt>true</tt>, the label set on the button is used as a
204
* stock id to select the stock item for the button.
205
* @param use_stock <tt>true</tt> if the button should use a stock item.
207
void set_use_stock(bool use_stock = true);
209
/** Returns whether the button label is a stock item.
210
* @return <tt>true</tt> if the button label is used to
211
* select a stock item instead of being
212
* used directly as the label text.
214
bool get_use_stock() const;
217
/** Sets whether the button will grab focus when it is clicked with the mouse.
218
* Making mouse clicks not grab focus is useful in places like toolbars where
219
* you don't want the keyboard focus removed from the main area of the
223
* @param focus_on_click Whether the button grabs focus when clicked with the mouse.
225
void set_focus_on_click(bool focus_on_click = true);
227
/** Returns whether the button grabs focus when it is clicked with the mouse.
228
* See set_focus_on_click().
231
* @return <tt>true</tt> if the button grabs focus when it is clicked with
234
bool get_focus_on_click() const;
237
/** Sets the alignment of the child. This property has no effect unless
238
* the child is a Gtk::Misc or a Gtk::Aligment.
241
* @param xalign The horizontal position of the child, 0.0 is left aligned,
242
* 1.0 is right aligned.
243
* @param yalign The vertical position of the child, 0.0 is top aligned,
244
* 1.0 is bottom aligned.
246
void set_alignment(float xalign, float yalign);
248
/** Gets the alignment of the child in the button.
251
* @param xalign Return location for horizontal alignment.
252
* @param yalign Return location for vertical alignment.
254
void get_alignment(float& xalign, float& yalign);
257
/** Set the image of @a button to the given widget. Note that
258
* it depends on the Gtk::Settings:gtk-button-images setting whether the
259
* image will be displayed or not, you don't have to call
260
* Gtk::Widget::show() on @a image yourself.
263
* @param image A widget to set as the image for the button.
265
void set_image(Widget& image);
267
/** Gets the widget that is currenty set as the image of @a button.
268
* This may have been explicitly set by set_image()
269
* or specified as a stock item to the constructor.
275
/** Gets the widget that is currenty set as the image of @a button.
276
* This may have been explicitly set by set_image()
277
* or specified as a stock item to the constructor.
281
const Widget* get_image() const;
284
/** Sets the position of the image relative to the text
288
* @param position The position.
290
void set_image_position(PositionType position);
292
/** Gets the position of the image relative to the text
296
* @return The position.
298
PositionType get_image_position() const;
301
/** Returns the button's event window if it is realized, <tt>0</tt> otherwise.
302
* This function should be rarely needed.
305
* @return @a button's event window.
307
Glib::RefPtr<Gdk::Window> get_event_window();
309
/** Returns the button's event window if it is realized, <tt>0</tt> otherwise.
310
* This function should be rarely needed.
313
* @return @a button's event window.
315
Glib::RefPtr<const Gdk::Window> get_event_window() const;
320
* <tt>void on_my_%pressed()</tt>
323
Glib::SignalProxy0< void > signal_pressed();
328
* <tt>void on_my_%released()</tt>
331
Glib::SignalProxy0< void > signal_released();
336
* <tt>void on_my_%clicked()</tt>
339
Glib::SignalProxy0< void > signal_clicked();
344
* <tt>void on_my_%enter()</tt>
347
Glib::SignalProxy0< void > signal_enter();
352
* <tt>void on_my_%leave()</tt>
355
Glib::SignalProxy0< void > signal_leave();
360
* <tt>void on_my_%activate()</tt>
363
Glib::SignalProxy0< void > signal_activate();
366
#ifdef GLIBMM_PROPERTIES_ENABLED
367
/** Text of the label widget inside the button, if the button contains a label widget.
369
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
370
* @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
371
* the value of the property changes.
373
Glib::PropertyProxy<Glib::ustring> property_label() ;
374
#endif //#GLIBMM_PROPERTIES_ENABLED
376
#ifdef GLIBMM_PROPERTIES_ENABLED
377
/** Text of the label widget inside the button, if the button contains a label widget.
379
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
380
* @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
381
* the value of the property changes.
383
Glib::PropertyProxy_ReadOnly<Glib::ustring> property_label() const;
384
#endif //#GLIBMM_PROPERTIES_ENABLED
386
#ifdef GLIBMM_PROPERTIES_ENABLED
387
/** The border relief style.
389
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
390
* @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
391
* the value of the property changes.
393
Glib::PropertyProxy<ReliefStyle> property_relief() ;
394
#endif //#GLIBMM_PROPERTIES_ENABLED
396
#ifdef GLIBMM_PROPERTIES_ENABLED
397
/** The border relief style.
399
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
400
* @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
401
* the value of the property changes.
403
Glib::PropertyProxy_ReadOnly<ReliefStyle> property_relief() const;
404
#endif //#GLIBMM_PROPERTIES_ENABLED
406
#ifdef GLIBMM_PROPERTIES_ENABLED
407
/** If set, an underline in the text indicates the next character should be used for the mnemonic accelerator key.
409
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
410
* @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
411
* the value of the property changes.
413
Glib::PropertyProxy<bool> property_use_underline() ;
414
#endif //#GLIBMM_PROPERTIES_ENABLED
416
#ifdef GLIBMM_PROPERTIES_ENABLED
417
/** If set, an underline in the text indicates the next character should be used for the mnemonic accelerator key.
419
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
420
* @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
421
* the value of the property changes.
423
Glib::PropertyProxy_ReadOnly<bool> property_use_underline() const;
424
#endif //#GLIBMM_PROPERTIES_ENABLED
426
#ifdef GLIBMM_PROPERTIES_ENABLED
427
/** If set, the label is used to pick a stock item instead of being displayed.
429
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
430
* @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
431
* the value of the property changes.
433
Glib::PropertyProxy<bool> property_use_stock() ;
434
#endif //#GLIBMM_PROPERTIES_ENABLED
436
#ifdef GLIBMM_PROPERTIES_ENABLED
437
/** If set, the label is used to pick a stock item instead of being displayed.
439
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
440
* @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
441
* the value of the property changes.
443
Glib::PropertyProxy_ReadOnly<bool> property_use_stock() const;
444
#endif //#GLIBMM_PROPERTIES_ENABLED
446
#ifdef GLIBMM_PROPERTIES_ENABLED
447
/** Whether the button grabs focus when it is clicked with the mouse.
449
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
450
* @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
451
* the value of the property changes.
453
Glib::PropertyProxy<bool> property_focus_on_click() ;
454
#endif //#GLIBMM_PROPERTIES_ENABLED
456
#ifdef GLIBMM_PROPERTIES_ENABLED
457
/** Whether the button grabs focus when it is clicked with the mouse.
459
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
460
* @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
461
* the value of the property changes.
463
Glib::PropertyProxy_ReadOnly<bool> property_focus_on_click() const;
464
#endif //#GLIBMM_PROPERTIES_ENABLED
466
#ifdef GLIBMM_PROPERTIES_ENABLED
467
/** Horizontal position of child in available space. 0.0 is left aligned, 1.0 is right aligned.
469
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
470
* @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
471
* the value of the property changes.
473
Glib::PropertyProxy<float> property_xalign() ;
474
#endif //#GLIBMM_PROPERTIES_ENABLED
476
#ifdef GLIBMM_PROPERTIES_ENABLED
477
/** Horizontal position of child in available space. 0.0 is left aligned, 1.0 is right aligned.
479
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
480
* @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
481
* the value of the property changes.
483
Glib::PropertyProxy_ReadOnly<float> property_xalign() const;
484
#endif //#GLIBMM_PROPERTIES_ENABLED
486
#ifdef GLIBMM_PROPERTIES_ENABLED
487
/** Vertical position of child in available space. 0.0 is top aligned, 1.0 is bottom aligned.
489
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
490
* @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
491
* the value of the property changes.
493
Glib::PropertyProxy<float> property_yalign() ;
494
#endif //#GLIBMM_PROPERTIES_ENABLED
496
#ifdef GLIBMM_PROPERTIES_ENABLED
497
/** Vertical position of child in available space. 0.0 is top aligned, 1.0 is bottom aligned.
499
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
500
* @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
501
* the value of the property changes.
503
Glib::PropertyProxy_ReadOnly<float> property_yalign() const;
504
#endif //#GLIBMM_PROPERTIES_ENABLED
506
#ifdef GLIBMM_PROPERTIES_ENABLED
507
/** Child widget to appear next to the button text.
509
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
510
* @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
511
* the value of the property changes.
513
Glib::PropertyProxy<Gtk::Widget*> property_image() ;
514
#endif //#GLIBMM_PROPERTIES_ENABLED
516
#ifdef GLIBMM_PROPERTIES_ENABLED
517
/** Child widget to appear next to the button text.
519
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
520
* @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
521
* the value of the property changes.
523
Glib::PropertyProxy_ReadOnly<Gtk::Widget*> property_image() const;
524
#endif //#GLIBMM_PROPERTIES_ENABLED
526
#ifdef GLIBMM_PROPERTIES_ENABLED
527
/** The position of the image relative to the text.
529
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
530
* @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
531
* the value of the property changes.
533
Glib::PropertyProxy<PositionType> property_image_position() ;
534
#endif //#GLIBMM_PROPERTIES_ENABLED
536
#ifdef GLIBMM_PROPERTIES_ENABLED
537
/** The position of the image relative to the text.
539
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
540
* @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
541
* the value of the property changes.
543
Glib::PropertyProxy_ReadOnly<PositionType> property_image_position() const;
544
#endif //#GLIBMM_PROPERTIES_ENABLED
549
/*! A Gtk::Button example.
550
* Example 1: @link book/buttons/button/buttons.h @endlink
551
* Example 2: @link book/buttons/button/buttons.cc @endlink
552
* Example 3: @link book/buttons/button/main.cc @endlink
560
/** A Glib::wrap() method for this object.
562
* @param object The C instance.
563
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
564
* @result A C++ instance that wraps this C instance.
566
* @relates Gtk::Button
568
Gtk::Button* wrap(GtkButton* object, bool take_copy = false);
572
#endif /* _GTKMM_BUTTON_H */