Reference Manual

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

# toolbar.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_TOOLBAR_H
    00027 #define INTI_GTK_TOOLBAR_H
    00028
    00029 #ifndef INTI_GTK_CONTAINER_H
    00030 #include <inti/gtk/container.h>
    00031 #endif
    00032
    00033 #ifndef __GTK_TOOLBAR_H__
    00034 #include <gtk/gtktoolbar.h>
    00035 #endif
    00036
    00037 namespace Inti {
    00038
    00039 namespace Gtk {
    00040
    00041 class Button;
    00042 class Label;
    00043 class RadioButton;
    00044 class ToggleButton;
    00045 class ToolbarClass;
    00046
    00049
    00050 enum ToolbarChildType
    00051 {
    00052         TOOLBAR_CHILD_SPACE = GTK_TOOLBAR_CHILD_SPACE,
    00053         TOOLBAR_CHILD_BUTTON = GTK_TOOLBAR_CHILD_BUTTON,
    00054         TOOLBAR_CHILD_TOGGLEBUTTON = GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
    00055         TOOLBAR_CHILD_RADIOBUTTON = GTK_TOOLBAR_CHILD_RADIOBUTTON,
    00056         TOOLBAR_CHILD_WIDGET = GTK_TOOLBAR_CHILD_WIDGET
    00057 };
    00058
    00061
    00062 enum ToolbarSpaceStyle
    00063 {
    00064         TOOLBAR_SPACE_EMPTY = GTK_TOOLBAR_SPACE_EMPTY,
    00065         TOOLBAR_SPACE_LINE = GTK_TOOLBAR_SPACE_LINE
    00066 };
    00067
    00071
    00072 enum ToolbarStyle
    00073 {
    00074         TOOLBAR_ICONS = GTK_TOOLBAR_ICONS,
    00076
    00077         TOOLBAR_TEXT = GTK_TOOLBAR_TEXT,
    00079
    00080         TOOLBAR_BOTH = GTK_TOOLBAR_BOTH,
    00082
    00083         TOOLBAR_BOTH_HORIZ = GTK_TOOLBAR_BOTH_HORIZ
    00085 };
    00086
    00092
    00093 class ToolbarChild
    00094 {
    00095         friend class none;
    00096
    00097         ToolbarChild(const ToolbarChild&);
    00098         ToolbarChild& operator=(const ToolbarChild&);
    00099
    00100         GtkToolbarChild child_;
    00101
    00102 public:
    00105
    00106         GtkToolbarChild* gtk_toolbar_child() const { return const_cast<GtkToolbarChild*>(&child_); }
    00108
    00109         ToolbarChildType type() const;
    00111
    00112         Widget* widget() const;
    00114
    00115         Widget* icon() const;
    00117
    00118         Label* label() const;
    00120
    00122 };
    00123
    00133
    00134 class Toolbar : public Container
    00135 {
    00136         friend class G::Object;
    00137         friend class ToolbarClass;
    00138
    00139         Toolbar(const Toolbar&);
    00140         Toolbar& operator=(const Toolbar&);
    00141
    00142 protected:
    00145
    00146         explicit Toolbar(GtkToolbar *toolbar, bool reference = false);
    00153
    00157
    00158         virtual void on_orientation_changed(Orientation orientation);
    00161
    00162         virtual void on_style_changed(ToolbarStyle style);
    00169
    00171 //  Properties
    00172
    00173         typedef G::Property<Orientation, int> OrientationPropertyType;
    00174         typedef G::PropertyProxy<G::Object, OrientationPropertyType> OrientationPropertyProxy;
    00175         static const OrientationPropertyType orientation_property;
    00176
    00177         typedef G::Property<ToolbarStyle, int> ToolbarStylePropertyType;
    00178         typedef G::PropertyProxy<G::Object, ToolbarStylePropertyType> ToolbarStylePropertyProxy;
    00179         static const ToolbarStylePropertyType toolbar_style_property;
    00180
    00181 //  Signals
    00182
    00183         typedef G::Signal1<void, GtkOrientation> OrientationChangedSignalType;
    00184         typedef G::SignalProxy<TypeInstance, OrientationChangedSignalType> OrientationChangedSignalProxy;
    00185         static const OrientationChangedSignalType orientation_changed_signal;
    00186
    00187         typedef G::Signal1<void, GtkToolbarStyle> StyleChangedSignalType;
    00188         typedef G::SignalProxy<TypeInstance, StyleChangedSignalType> StyleChangedSignalProxy;
    00189         static const StyleChangedSignalType style_changed_signal;
    00190
    00191 public:
    00194
    00195         explicit Toolbar(Orientation orientation = ORIENTATION_HORIZONTAL, ToolbarStyle style = TOOLBAR_ICONS);
    00199
    00200         virtual ~Toolbar();
    00202
    00206
    00207         GtkToolbar* gtk_toolbar() const { return (GtkToolbar*)instance; }
    00209
    00210         GtkToolbarClass* gtk_toolbar_class() const;
    00212
    00213         operator GtkToolbar* () const;
    00215
    00216         bool children(std::vector<ToolbarChild*>& child_list) const;
    00220
    00221         Orientation get_orientation() const;
    00223
    00224         ToolbarStyle get_style() const;
    00227
    00228         IconSize get_icon_size() const;
    00230
    00231         bool get_tooltips() const;
    00233
    00237
    00238         Button* append_button
    00239         (
    00240                 const String& text,
    00241                 Widget *icon,
    00242                 const Slot0<void> *callback,
    00243                 const String& tooltip_text = 0,
    00244                 const String& tooltip_private_text = 0
    00245         );
    00253
    00254         Button* prepend_button
    00255         (
    00256                 const String& text,
    00257                 Widget *icon,
    00258                 const Slot0<void> *callback,
    00259                 const String& tooltip_text = 0,
    00260                 const String& tooltip_private_text = 0
    00261         );
    00269
    00270         Button* insert_button
    00271         (
    00272                 const String& text,
    00273                 Widget *icon,
    00274                 const Slot0<void> *callback,
    00275                 int position,
    00276                 const String& tooltip_text = 0,
    00277                 const String& tooltip_private_text = 0
    00278         );
    00287
    00288         ToggleButton* append_toggle_button
    00289         (
    00290                 const String& text,
    00291                 Widget *icon,
    00292                 const Slot0<void> *callback,
    00293                 const String& tooltip_text = 0,
    00294                 const String& tooltip_private_text = 0
    00295         );
    00303
    00304         ToggleButton* prepend_toggle_button
    00305         (
    00306                 const String& text,
    00307                 Widget *icon,
    00308                 const Slot0<void> *callback,
    00309                 const String& tooltip_text = 0,
    00310                 const String& tooltip_private_text  = 0
    00311         );
    00319
    00320         ToggleButton* insert_toggle_button
    00321         (
    00322                 const String& text,
    00323                 Widget *icon,
    00324                 const Slot0<void> *callback,
    00325                 int position,
    00326                 const String& tooltip_text = 0,
    00327                 const String& tooltip_private_text = 0
    00328         );
    00337
    00338         RadioButton* append_radio_button
    00339         (
    00340                 const RadioButton *group,
    00341                 const String& text,
    00342                 Widget *icon,
    00343                 const Slot0<void> *callback,
    00344                 const String& tooltip_text = 0,
    00345                 const String& tooltip_private_text = 0
    00346         );
    00359
    00360         RadioButton* prepend_radio_button
    00361         (
    00362                 const RadioButton *group,
    00363                 const String& text,
    00364                 Widget *icon,
    00365                 const Slot0<void> *callback,
    00366                 const String& tooltip_text = 0,
    00367                 const String& tooltip_private_text   = 0
    00368         );
    00381
    00382         RadioButton* insert_radio_button
    00383         (
    00384                 const RadioButton *group,
    00385                 const String& text,
    00386                 Widget *icon,
    00387                 const Slot0<void> *callback,
    00388                 int position,
    00389                 const String& tooltip_text = 0,
    00390                 const String& tooltip_private_text = 0
    00391         );
    00405
    00406         Button* append_stock
    00407         (
    00408                 const char *stock_id,
    00409                 const Slot0<void> *callback,
    00410                 const String& tooltip_text = 0,
    00411                 const String& tooltip_private_text = 0
    00412         );
    00419
    00420         Button* prepend_stock
    00421         (
    00422                 const char *stock_id,
    00423                 const Slot0<void> *callback,
    00424                 const String& tooltip_text = 0,
    00425                 const String& tooltip_private_text = 0
    00426         );
    00433
    00434         Button* insert_stock
    00435         (
    00436                 const char *stock_id,
    00437                 const Slot0<void> *callback,
    00438                 int position,
    00439                 const String& tooltip_text = 0,
    00440                 const String& tooltip_private_text = 0
    00441         );
    00449
    00450         void append_space();
    00452
    00453         void prepend_space();
    00455
    00456         void insert_space(int position);
    00459
    00460         void remove_space(int position);
    00462
    00463         void append_widget(Widget& widget, const String& tooltip_text = 0, const String& tooltip_private_text = 0);
    00468
    00469         void prepend_widget(Widget& widget, const String& tooltip_text = 0, const String& tooltip_private_text = 0);
    00474
    00475         void insert_widget(Widget& widget, int position, const String& tooltip_text = 0, const String& tooltip_private_text =  0);
    00481
    00482         void set_orientation(Orientation orientation);
    00485
    00486         void set_style(ToolbarStyle style);
    00489
    00490         void set_icon_size(IconSize icon_size);
    00496
    00497         void set_tooltips(bool enable);
    00500
    00501         void unset_style();
    00504
    00505         void unset_icon_size();
    00508
    00512
    00513         const OrientationPropertyProxy prop_orientation()
    00514         {
    00515                 return OrientationPropertyProxy(this, &orientation_property);
    00516         }
    00518
    00519         const ToolbarStylePropertyProxy prop_toolbar_style()
    00520         {
    00521                 return ToolbarStylePropertyProxy(this, &toolbar_style_property);
    00522         }
    00524
    00528
    00529         const OrientationChangedSignalProxy sig_orientation_changed()
    00530         {
    00531                 return OrientationChangedSignalProxy(this, &orientation_changed_signal);
    00532         }
    00534
    00535         const StyleChangedSignalProxy sig_style_changed()
    00536         {
    00537                 return StyleChangedSignalProxy(this, &style_changed_signal);
    00538         }
    00540
    00542 };
    00543
    00544 } // namespace Gtk
    00545
    00546 } // namespace Inti
    00547
    00548 #endif // INTI_GTK_TOOLBAR_H
    00549

Main Page - Footer