Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# button.h

Go to the documentation of this file.

    00001 /*  Inti: Integrated Foundation Classes
    00002  *  Copyright (C) 2002 The Inti Development Team.
    00003  *  Copyright (C) 2000 Red Hat, Inc.
    00004  *
    00005  *  This program is free software; you can redistribute it and/or modify
    00006  *  it under the terms of the GNU General Public License as published by
    00007  *  the Free Software Foundation; either version 2 of the License, or
    00008  *  (at your option) any later version.
    00009  *
    00010  *  This program is distributed in the hope that it will be useful,
    00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00013  *  GNU Library General Public License for more details.
    00014  *
    00015  *  You should have received a copy of the GNU Library General Public License
    00016  *  along with this program; if not, write to the Free Software
    00017  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    00018  */
    00019
    00025
    00026 #ifndef INTI_GTK_BUTTON_H
    00027 #define INTI_GTK_BUTTON_H
    00028
    00029 #ifndef INTI_GTK_BIN_H
    00030 #include <inti/gtk/bin.h>
    00031 #endif
    00032
    00033 #ifndef __GTK_BUTTON_H__
    00034 #include <gtk/gtkbutton.h>
    00035 #endif
    00036
    00037 #ifndef __GTK_STOCK_H__
    00038 #include <gtk/gtkstock.h>
    00039 #endif
    00040
    00041 #ifndef __GTK_ICON_FACTORY_H__
    00042 #include <gtk/gtkiconfactory.h>
    00043 #endif
    00044
    00045 namespace Inti {
    00046
    00047 namespace Gtk {
    00048
    00049 class ButtonClass;
    00050 class Image;
    00051
    00059
    00060 class Button : public Bin
    00061 {
    00062         friend class G::Object;
    00063         friend class ButtonClass;
    00064
    00065         Button(const Button&);
    00066         Button& operator=(const Button&);
    00067
    00068 protected:
    00071
    00072         explicit Button(GtkButton *button, bool reference = false);
    00079
    00083
    00084         bool depresssed() const;
    00086
    00090
    00091         void set_depressed(bool depressed);
    00096
    00100
    00101         virtual void on_pressed();
    00103
    00104         virtual void on_released();
    00106
    00107         virtual void on_clicked();
    00110
    00111         virtual void on_enter();
    00113
    00114         virtual void on_leave();
    00116
    00117         virtual void on_activate();
    00119
    00121 //  Properties
    00122
    00123         typedef G::Property<String> LabelPropertyType;
    00124         typedef G::PropertyProxy<G::Object, LabelPropertyType> LabelPropertyProxy;
    00125         static const LabelPropertyType label_property;
    00126
    00127         typedef G::Property<bool> UseUnderlinePropertyType;
    00128         typedef G::PropertyProxy<G::Object, UseUnderlinePropertyType> UseUnderlinePropertyProxy;
    00129         static const UseUnderlinePropertyType use_underline_property;
    00130
    00131         typedef G::Property<bool> UseStockPropertyType;
    00132         typedef G::PropertyProxy<G::Object, UseStockPropertyType> UseStockPropertyProxy;
    00133         static const UseStockPropertyType use_stock_property;
    00134
    00135         typedef G::Property<ReliefStyle, int> ReliefPropertyType;
    00136         typedef G::PropertyProxy<G::Object, ReliefPropertyType> ReliefPropertyProxy;
    00137         static const ReliefPropertyType relief_property;
    00138
    00139 //  Signals
    00140
    00141         typedef G::Signal0<void> PressedSignalType;
    00142         typedef G::SignalProxy<TypeInstance, PressedSignalType> PressedSignalProxy;
    00143         static const PressedSignalType pressed_signal;
    00144
    00145         typedef G::Signal0<void> ReleasedSignalType;
    00146         typedef G::SignalProxy<TypeInstance, ReleasedSignalType> ReleasedSignalProxy;
    00147         static const ReleasedSignalType released_signal;
    00148
    00149         typedef G::Signal0<void> ClickedSignalType;
    00150         typedef G::SignalProxy<TypeInstance, ClickedSignalType> ClickedSignalProxy;
    00151         static const ClickedSignalType clicked_signal;
    00152
    00153         typedef G::Signal0<void> EnterSignalType;
    00154         typedef G::SignalProxy<TypeInstance, EnterSignalType> EnterSignalProxy;
    00155         static const EnterSignalType enter_signal;
    00156
    00157         typedef G::Signal0<void> LeaveSignalType;
    00158         typedef G::SignalProxy<TypeInstance, LeaveSignalType> LeaveSignalProxy;
    00159         static const LeaveSignalType leave_signal;
    00160
    00161         typedef G::Signal0<void> ActivateSignalType;
    00162         typedef G::SignalProxy<TypeInstance, ActivateSignalType> ActivateSignalProxy;
    00163         static const ActivateSignalType activate_signal;
    00164
    00165 public:
    00168
    00169         Button();
    00171
    00172         explicit Button(Image& image);
    00175
    00176         explicit Button(const String& label, bool use_underline = false);
    00185
    00186         Button(Image& image, const String& label, bool use_underline = false, bool horizontal = false);
    00196
    00197         virtual ~Button();
    00199
    00203
    00204         GtkButton* gtk_button() const { return (GtkButton*)instance; }
    00206
    00207         GtkButtonClass* gtk_button_class() const;
    00209
    00210         operator GtkButton* () const;
    00212
    00213         ReliefStyle get_relief() const;
    00215
    00216         String get_label() const;
    00222
    00223         bool get_use_underline() const;
    00225
    00226         bool get_use_stock() const;
    00230
    00234
    00235         void pressed();
    00237
    00238         void released();
    00240
    00241         void clicked();
    00243
    00244         void enter();
    00246
    00247         void leave();
    00249
    00250         void set_relief(ReliefStyle newstyle);
    00256
    00257         void set_label(const String& label);
    00263
    00264         void set_use_underline(bool use_underline);
    00268
    00269         void set_use_stock(bool use_stock);
    00273
    00274         void set_image(Image& image, const String& label, bool use_underline = false, bool horizontal = false);
    00285
    00289
    00290         const LabelPropertyProxy prop_label()
    00291         {
    00292                 return LabelPropertyProxy(this, &label_property);
    00293         }
    00295
    00296         const UseUnderlinePropertyProxy prop_use_underline()
    00297         {
    00298                 return UseUnderlinePropertyProxy(this, &use_underline_property);
    00299         }
    00301
    00302         const UseStockPropertyProxy prop_use_stock()
    00303         {
    00304                 return UseStockPropertyProxy(this, &use_stock_property);
    00305         }
    00308
    00309         const ReliefPropertyProxy prop_relief()
    00310         {
    00311                 return ReliefPropertyProxy(this, &relief_property);
    00312         }
    00314
    00318
    00319         const PressedSignalProxy sig_pressed()
    00320         {
    00321                 return PressedSignalProxy(this, &pressed_signal);
    00322         }
    00324
    00325         const ReleasedSignalProxy sig_released()
    00326         {
    00327                 return ReleasedSignalProxy(this, &released_signal);
    00328         }
    00331
    00332         const ClickedSignalProxy sig_clicked()
    00333         {
    00334                 return ClickedSignalProxy(this, &clicked_signal);
    00335         }
    00339
    00340         const EnterSignalProxy sig_enter()
    00341         {
    00342                 return EnterSignalProxy(this, &enter_signal);
    00343         }
    00345
    00346         const LeaveSignalProxy sig_leave()
    00347         {
    00348                 return LeaveSignalProxy(this, &leave_signal);
    00349         }
    00351
    00352         const ActivateSignalProxy sig_activate()
    00353         {
    00354                 return ActivateSignalProxy(this, &activate_signal);
    00355         }
    00357
    00359 };
    00360
    00365
    00366 class StockButton : public Button
    00367 {
    00368 public:
    00371
    00372         explicit StockButton(const char *stock_id);
    00378
    00380 };
    00381
    00382 } // namespace Gtk
    00383
    00384 } // namespace Inti
    00385
    00386 #endif // INTI_GTK_BUTTON_H
    00387

Main Page - Footer