Reference Manual

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

# ruler.h

Go to the documentation of this file.

    00001 /*  Inti: Integrated Foundation Classes
    00002  *  Copyright (C) 2002 The Inti Development Team.
    00003  *
    00004  *  This program is free software; you can redistribute it and/or modify
    00005  *  it under the terms of the GNU General Public License as published by
    00006  *  the Free Software Foundation; either version 2 of the License, or
    00007  *  (at your option) any later version.
    00008  *
    00009  *  This program is distributed in the hope that it will be useful,
    00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00012  *  GNU Library General Public License for more details.
    00013  *
    00014  *  You should have received a copy of the GNU Library General Public License
    00015  *  along with this program; if not, write to the Free Software
    00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    00017  */
    00018
    00024
    00025 #ifndef INTI_GTK_RULER_H
    00026 #define INTI_GTK_RULER_H
    00027
    00028 #ifndef INTI_GTK_WIDGET_H
    00029 #include <inti/gtk/widget.h>
    00030 #endif
    00031
    00032 #ifndef __GTK_HRULER_H__
    00033 #include <gtk/gtkhruler.h>
    00034 #endif
    00035
    00036 #ifndef __GTK_VRULER_H__
    00037 #include <gtk/gtkvruler.h>
    00038 #endif
    00039
    00040 namespace Inti {
    00041
    00042 namespace Gtk {
    00043
    00044 class RulerClass;
    00045 class HRulerClass;
    00046 class VRulerClass;
    00047
    00056
    00057 class Ruler : public Widget
    00058 {
    00059         friend class G::Object;
    00060         friend class RulerClass;
    00061
    00062         Ruler(const Ruler&);
    00063         Ruler& operator=(const Ruler&);
    00064
    00065 protected:
    00068
    00069         Ruler();
    00071
    00072         explicit Ruler(GtkRuler *ruler, bool reference = false);
    00079
    00080         virtual ~Ruler() = 0;
    00082
    00084 //  Override these do_ methods only when you want change the default behaviour GtkRuler.
    00085
    00086         virtual void do_draw_ticks();
    00087
    00088         virtual void do_draw_pos();
    00089
    00090 //  Properties
    00091
    00092         typedef G::Property<double> LowerPropertyType;
    00093         typedef G::PropertyProxy<G::Object, LowerPropertyType> LowerPropertyProxy;
    00094         static const LowerPropertyType lower_property;
    00095
    00096         typedef G::Property<double> UpperPropertyType;
    00097         typedef G::PropertyProxy<G::Object, UpperPropertyType> UpperPropertyProxy;
    00098         static const UpperPropertyType upper_property;
    00099
    00100         typedef G::Property<double> PositionPropertyType;
    00101         typedef G::PropertyProxy<G::Object, PositionPropertyType> PositionPropertyProxy;
    00102         static const PositionPropertyType position_property;
    00103
    00104         typedef G::Property<double> MaxSizePropertyType;
    00105         typedef G::PropertyProxy<G::Object, MaxSizePropertyType> MaxSizePropertyProxy;
    00106         static const MaxSizePropertyType max_size_property;
    00107
    00108 public:
    00111
    00112         GtkRuler* gtk_ruler() const { return (GtkRuler*)instance; }
    00114
    00115         GtkRulerClass* gtk_ruler_class() const;
    00117
    00118         operator GtkRuler* () const;
    00120
    00121         MetricType get_metric() const;
    00124
    00125         double get_lower() const;
    00127
    00128         double get_upper() const;
    00130
    00131         double get_position() const;
    00133
    00134         void get_range(double *lower, double *upper, double *position, double *max_size = 0);
    00141
    00145
    00146         void set_metric(MetricType metric = PIXELS);
    00152
    00153         void set_range(double lower, double upper, double position, double max_size);
    00160
    00161         void draw_ticks();
    00163
    00164         void draw_pos();
    00166
    00170
    00171         const LowerPropertyProxy prop_lower()
    00172         {
    00173                 return LowerPropertyProxy(this, &lower_property);
    00174         }
    00176
    00177         const UpperPropertyProxy prop_upper()
    00178         {
    00179                 return UpperPropertyProxy(this, &upper_property);
    00180         }
    00182
    00183         const PositionPropertyProxy prop_position()
    00184         {
    00185                 return PositionPropertyProxy(this, &position_property);
    00186         }
    00188
    00189         const MaxSizePropertyProxy prop_max_size()
    00190         {
    00191                 return MaxSizePropertyProxy(this, &max_size_property);
    00192         }
    00194
    00196 };
    00197
    00205
    00206 class HRuler : public Ruler
    00207 {
    00208         friend class G::Object;
    00209         friend class HRulerClass;
    00210
    00211         HRuler(const HRuler&);
    00212         HRuler& operator=(const HRuler&);
    00213
    00214 protected:
    00217
    00218         explicit HRuler(GtkHRuler *hruler, bool reference = false);
    00225
    00227
    00228 public:
    00231
    00232         HRuler();
    00234
    00235         virtual ~HRuler();
    00237
    00241
    00242         GtkHRuler* gtk_hruler() const { return (GtkHRuler*)instance; }
    00244
    00245         GtkHRulerClass* gtk_hruler_class() const;
    00247
    00248         operator GtkHRuler* () const;
    00250
    00252 };
    00253
    00256
    00257 class VRuler : public Ruler
    00258 {
    00259         friend class G::Object;
    00260         friend class VRulerClass;
    00261
    00262         VRuler(const VRuler&);
    00263         VRuler& operator=(const VRuler&);
    00264
    00265 protected:
    00268
    00269         explicit VRuler(GtkVRuler *vruler, bool reference = false);
    00276
    00278
    00279 public:
    00282
    00283         VRuler();
    00285
    00286         virtual ~VRuler();
    00288
    00292
    00293         GtkVRuler* gtk_vruler() const { return (GtkVRuler*)instance; }
    00295
    00296         GtkVRulerClass* gtk_vruler_class() const;
    00298
    00299         operator GtkVRuler* () const;
    00301
    00303 };
    00304
    00305 } // namespace Gtk
    00306
    00307 } // namespace Inti
    00308
    00309 #endif // INTI_GTK_RULER_H
    00310

Main Page - Footer