Main Page - Header
Author: The Inti Development Team

Reference Manual

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

# label.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
    00026
    00027 #ifndef INTI_GTK_LABEL_H
    00028 #define INTI_GTK_LABEL_H
    00029
    00030 #ifndef INTI_GTK_MISC_H
    00031 #include <inti/gtk/misc.h>
    00032 #endif
    00033
    00034 #ifndef __GTK_LABEL_H__
    00035 #include <gtk/gtklabel.h>
    00036 #endif
    00037
    00038 namespace Inti {
    00039
    00040 namespace Pango {
    00041 class AttrList;
    00042 class Layout;
    00043 }
    00044
    00045 namespace Gtk {
    00046
    00047 class LabelClass;
    00048 class Menu;
    00049
    00115
    00116 class Label : public Misc
    00117 {
    00118         friend class G::Object;
    00119         friend class LabelClass;
    00120
    00121         Label(const Label&);
    00122         Label& operator=(const Label&);
    00123
    00124 protected:
    00127
    00128         explicit Label(GtkLabel *label, bool reference = false);
    00135
    00139
    00140         virtual void on_move_cursor(MovementStep step, int count, bool extend_selection);
    00148
    00149         virtual void on_copy_clipboard();
    00151
    00152         virtual void on_populate_popup(Menu& menu);
    00155
    00157 //  Properties
    00158
    00159         typedef G::Property<String> LabelPropertyType;
    00160         typedef G::PropertyProxy<G::Object, LabelPropertyType> LabelPropertyProxy;
    00161         static const LabelPropertyType label_property;
    00162
    00163         typedef G::Property<Pointer<Pango::AttrList> > AttributesPropertyType;
    00164         typedef G::PropertyProxy<G::Object, AttributesPropertyType> AttributesPropertyProxy;
    00165         static const AttributesPropertyType attributes_property;
    00166
    00167         typedef G::Property<bool> UseMarkupPropertyType;
    00168         typedef G::PropertyProxy<G::Object, UseMarkupPropertyType> UseMarkupPropertyProxy;
    00169         static const UseMarkupPropertyType use_markup_property;
    00170
    00171         typedef G::Property<bool> UseUnderlinePropertyType;
    00172         typedef G::PropertyProxy<G::Object, UseUnderlinePropertyType> UseUnderlinePropertyProxy;
    00173         static const UseUnderlinePropertyType use_underline_property;
    00174
    00175         typedef G::Property<Justification, int> JustifyPropertyType;
    00176         typedef G::PropertyProxy<G::Object, JustifyPropertyType> JustifyPropertyProxy;
    00177         static const JustifyPropertyType justify_property;
    00178
    00179         typedef G::WritableProperty<String> PatternPropertyType;
    00180         typedef G::PropertyProxy<G::Object, PatternPropertyType> PatternPropertyProxy;
    00181         static const PatternPropertyType pattern_property;
    00182
    00183         typedef G::Property<bool> WrapPropertyType;
    00184         typedef G::PropertyProxy<G::Object, WrapPropertyType> WrapPropertyProxy;
    00185         static const WrapPropertyType wrap_property;
    00186
    00187         typedef G::Property<bool> SelectablePropertyType;
    00188         typedef G::PropertyProxy<G::Object, SelectablePropertyType> SelectablePropertyProxy;
    00189         static const SelectablePropertyType selectable_property;
    00190
    00191         typedef G::ReadableProperty<unsigned int> MnemonicKeyvalPropertyType;
    00192         typedef G::PropertyProxy<G::Object, MnemonicKeyvalPropertyType> MnemonicKeyvalPropertyProxy;
    00193         static const MnemonicKeyvalPropertyType mnemonic_keyval_property;
    00194
    00195         typedef G::Property<Widget*, G::Object*> MnemonicWidgetPropertyType;
    00196         typedef G::PropertyProxy<G::Object, MnemonicWidgetPropertyType> MnemonicWidgetPropertyProxy;
    00197         static const MnemonicWidgetPropertyType mnemonic_widget_property;
    00198
    00199         typedef G::ReadableProperty<int> CursorPositionPropertyType;
    00200         typedef G::PropertyProxy<G::Object, CursorPositionPropertyType> CursorPositionPropertyProxy;
    00201         static const CursorPositionPropertyType cursor_position_property;
    00202
    00203         typedef G::ReadableProperty<int> SelectionBoundPropertyType;
    00204         typedef G::PropertyProxy<G::Object, SelectionBoundPropertyType> SelectionBoundPropertyProxy;
    00205         static const SelectionBoundPropertyType selection_bound_property;
    00206
    00207 //  Signals
    00208
    00209         typedef G::Signal3<void, GtkMovementStep, int, bool> MoveCursorSignalType;
    00210         typedef G::SignalProxy<TypeInstance, MoveCursorSignalType> MoveCursorSignalProxy;
    00211         static const MoveCursorSignalType move_cursor_signal;
    00212
    00213         typedef G::Signal0<void> CopyClipboardSignalType;
    00214         typedef G::SignalProxy<TypeInstance, CopyClipboardSignalType> CopyClipboardSignalProxy;
    00215         static const CopyClipboardSignalType copy_clipboard_signal;
    00216
    00217         typedef G::Signal1<void, GtkMenu> PopulatePopupSignalType;
    00218         typedef G::SignalProxy<TypeInstance, PopulatePopupSignalType> PopulatePopupSignalProxy;
    00219         static const PopulatePopupSignalType populate_popup_signal;
    00220
    00221 public:
    00224
    00225         Label();
    00227
    00228         explicit Label(const String& str, bool use_underline = false);
    00232
    00233         virtual ~Label();
    00235
    00239
    00240         GtkLabel* gtk_label() const { return (GtkLabel*)instance; }
    00242
    00243         GtkLabelClass* gtk_label_class() const;
    00245
    00246         operator GtkLabel* () const;
    00248
    00249         String get_text() const;
    00255
    00256         Pointer<Pango::AttrList> get_attributes() const;
    00262
    00263         String get_label() const;
    00267
    00268         bool get_use_markup() const;
    00271
    00272         bool get_use_underline() const;
    00275
    00276         unsigned int get_mnemonic_keyval() const;
    00280
    00281         Widget* get_mnemonic_widget() const;
    00284
    00285         Justification get_justify() const;
    00287
    00288         bool get_line_wrap() const;
    00290
    00291         bool get_selectable() const;
    00294
    00295         void get_layout_offsets(int *x, int *y) const;
    00307
    00308         bool get_selection_bounds(int *start, int *end) const;
    00313
    00314         Pango::Layout* get_layout() const;
    00321
    00325
    00326         void set_text(const String& str);
    00331
    00332         void set_attributes(Pango::AttrList& attrs);
    00338
    00339         void set_markup(const String& str);
    00343
    00344         void set_label(const String& str);
    00348
    00349         void set_markup_with_mnemonic(const String& str);
    00358
    00359         void set_mnemonic_widget(Widget *widget);
    00372
    00373         void set_text_with_mnemonic(const String& str);
    00381
    00382         void set_justify(Justification jtype);
    00388
    00389         void set_pattern(const String& pattern);
    00395
    00396         void set_line_wrap(bool wrap);
    00403
    00404         void set_selectable(bool setting);
    00407
    00408         void select_region(int start_offset, int end_offset);
    00415
    00416         void set_use_markup(bool setting);
    00419
    00420         void set_use_underline(bool setting);
    00424
    00428
    00429         const LabelPropertyProxy prop_label()
    00430         {
    00431                 return LabelPropertyProxy(this, &label_property);
    00432         }
    00434
    00435         const AttributesPropertyProxy prop_attributes()
    00436         {
    00437                 return AttributesPropertyProxy(this, &attributes_property);
    00438         }
    00440
    00441         const UseMarkupPropertyProxy prop_use_markup()
    00442         {
    00443                 return UseMarkupPropertyProxy(this, &use_markup_property);
    00444         }
    00446
    00447         const UseUnderlinePropertyProxy prop_use_underline()
    00448         {
    00449                 return UseUnderlinePropertyProxy(this, &use_underline_property);
    00450         }
    00453
    00454         const JustifyPropertyProxy prop_justify()
    00455         {
    00456                 return JustifyPropertyProxy(this, &justify_property);
    00457         }
    00459
    00460         const PatternPropertyProxy prop_pattern()
    00461         {
    00462                 return PatternPropertyProxy(this, &pattern_property);
    00463         }
    00466
    00467         const WrapPropertyProxy prop_wrap()
    00468         {
    00469                 return WrapPropertyProxy(this, &wrap_property);
    00470         }
    00472
    00473         const SelectablePropertyProxy prop_selectable()
    00474         {
    00475                 return SelectablePropertyProxy(this, &selectable_property);
    00476         }
    00478
    00479         const MnemonicKeyvalPropertyProxy prop_mnemonic_keyval()
    00480         {
    00481                 return MnemonicKeyvalPropertyProxy(this, &mnemonic_keyval_property);
    00482         }
    00484
    00485         const MnemonicWidgetPropertyProxy prop_mnemonic_widget()
    00486         {
    00487                 return MnemonicWidgetPropertyProxy(this, &mnemonic_widget_property);
    00488         }
    00490
    00491         const CursorPositionPropertyProxy prop_cursor_position()
    00492         {
    00493                 return CursorPositionPropertyProxy(this, &cursor_position_property);
    00494         }
    00496
    00497         const SelectionBoundPropertyProxy prop_selection_bound()
    00498         {
    00499                 return SelectionBoundPropertyProxy(this, &selection_bound_property);
    00500         }
    00502
    00506
    00507         const MoveCursorSignalProxy sig_move_cursor()
    00508         {
    00509                 return MoveCursorSignalProxy(this, &move_cursor_signal);
    00510         }
    00512
    00513         const CopyClipboardSignalProxy sig_copy_clipboard()
    00514         {
    00515                 return CopyClipboardSignalProxy(this, &copy_clipboard_signal);
    00516         }
    00519
    00520         const PopulatePopupSignalProxy sig_populate_popup()
    00521         {
    00522                 return PopulatePopupSignalProxy(this, &populate_popup_signal);
    00523         }
    00526
    00528 };
    00529
    00530 } // namespace Gtk
    00531
    00532 } // namespace Inti
    00533
    00534 #endif // INTI_GTK_LABEL_H
    00535
    00536

Main Page - Footer