Reference Manual

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

# gc.h

Go to the documentation of this file.

    00001 /*  Inti: Integrated Foundation Classes
    00002  *  Copyright (C) 2002-2003 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
    00024
    00025 #ifndef INTI_GDK_GC_H
    00026 #define INTI_GDK_GC_H
    00027
    00028 #ifndef INTI_GDK_G_OBJECT_H
    00029 #include <inti/glib/object.h>
    00030 #endif
    00031
    00032 #ifndef __GDK_GC_H__
    00033 #include <gdk/gdkgc.h>
    00034 #endif
    00035
    00036 #ifndef _CPP_VECTOR
    00037 #include <vector>
    00038 #endif
    00039
    00040 namespace Inti {
    00041
    00042 namespace Gdk {
    00043
    00044 class Bitmap;
    00045 class Color;
    00046 class Colormap;
    00047 class Drawable;
    00048 class GCClass;
    00049 class Pixmap;
    00050 class Point;
    00051 class Rectangle;
    00052 class Region;
    00053 class Screen;
    00054
    00057
    00058 enum CapStyle
    00059 {
    00060         CAP_NOT_LAST = GDK_CAP_NOT_LAST,
    00063
    00064         CAP_BUTT = GDK_CAP_BUTT,
    00066
    00067         CAP_ROUND = GDK_CAP_ROUND,
    00070
    00071         CAP_PROJECTING = GDK_CAP_PROJECTING
    00074 };
    00075
    00078
    00079 enum Fill
    00080 {
    00081         SOLID = GDK_SOLID,
    00083
    00084         TILED = GDK_TILED,
    00086
    00087         STIPPLED = GDK_STIPPLED,
    00091
    00092         OPAQUE_STIPPLED = GDK_OPAQUE_STIPPLED
    00096 };
    00097
    00104
    00105 enum Function
    00106 {
    00107         COPY = GDK_COPY,
    00108         INVERT = GDK_INVERT,
    00109         XOR = GDK_XOR,
    00110         CLEAR = GDK_CLEAR,
    00111         AND = GDK_AND,
    00112         AND_REVERSE = GDK_AND_REVERSE,
    00113         AND_INVERT = GDK_AND_INVERT,
    00114         NOOP = GDK_NOOP,
    00115         OR = GDK_OR,
    00116         EQUIV = GDK_EQUIV,
    00117         OR_REVERSE = GDK_OR_REVERSE,
    00118         COPY_INVERT = GDK_COPY_INVERT,
    00119         OR_INVERT = GDK_OR_INVERT,
    00120         NAND = GDK_NAND,
    00121         NOR = GDK_NOR,
    00122         SET = GDK_SET
    00123 };
    00124
    00127
    00128 enum JoinStyle
    00129 {
    00130         JOIN_MITER = GDK_JOIN_MITER,
    00132
    00133         JOIN_ROUND = GDK_JOIN_ROUND,
    00135
    00136         JOIN_BEVEL = GDK_JOIN_BEVEL
    00139 };
    00140
    00143
    00144 enum LineStyle
    00145 {
    00146         LINE_SOLID = GDK_LINE_SOLID,
    00148
    00149         LINE_ON_OFF_DASH = GDK_LINE_ON_OFF_DASH,
    00151
    00152         LINE_DOUBLE_DASH = GDK_LINE_DOUBLE_DASH
    00156 };
    00157
    00160
    00161 enum SubwindowMode
    00162 {
    00163         CLIP_BY_CHILDREN = GDK_CLIP_BY_CHILDREN,
    00164         INCLUDE_INFERIORS = GDK_INCLUDE_INFERIORS
    00165 };
    00166
    00183
    00184 class GCValues
    00185 {
    00186         friend class GC;
    00187
    00188         GdkGCValues values_;
    00189         unsigned int mask_;
    00190
    00191 public:
    00194
    00195         GCValues();
    00197
    00198         GCValues(const GCValues& src);
    00201
    00202         ~GCValues ();
    00204
    00205         GCValues& operator=(const GCValues& src);
    00208
    00212
    00213         GdkGCValues* gdk_gc_values() const;
    00215
    00216         GdkGCValuesMask gdk_gc_values_mask() const;
    00218
    00219         Color foreground() const;
    00221
    00222         bool foreground_set() const;
    00224
    00225         Color background() const;
    00227
    00228         bool background_set() const;
    00230
    00231         Function function() const;
    00233
    00234         bool function_set() const;
    00236
    00237         Fill fill() const;
    00239
    00240         bool fill_set() const;
    00242
    00243         Pixmap* tile() const;
    00245
    00246         bool tile_set() const;
    00248
    00249         Bitmap* stipple() const;
    00251
    00252         bool stipple_set () const;
    00254
    00255         Bitmap* clip_mask() const;
    00257
    00258         bool clip_mask_set() const;
    00260
    00261         SubwindowMode subwindow_mode() const;
    00263
    00264         bool subwindow_mode_set() const;
    00266
    00267         int ts_x_origin() const;
    00269
    00270         bool ts_x_origin_set() const;
    00272
    00273         int ts_y_origin() const;
    00275
    00276         bool ts_y_origin_set() const;
    00278
    00279         int clip_x_origin() const;
    00281
    00282         bool clip_x_origin_set() const;
    00284
    00285         int clip_y_origin() const;
    00287
    00288         bool clip_y_origin_set () const;
    00290
    00291         bool graphics_exposures() const;
    00293
    00294         bool graphics_exposures_set() const;
    00296
    00297         int line_width() const;
    00299
    00300         bool line_width_set() const;
    00302
    00303         LineStyle line_style() const;
    00305
    00306         bool line_style_set() const;
    00308
    00309         CapStyle cap_style () const;
    00311
    00312         bool cap_style_set() const;
    00314
    00315         JoinStyle join_style() const;
    00317
    00318         bool join_style_set() const;
    00320
    00324
    00325         void reset();
    00327
    00328         void set_foreground(const Color& color);
    00331
    00332         void unset_foreground();
    00334
    00335         void set_background(const Color& color);
    00338
    00339         void unset_background();
    00341
    00342         void set_function(Function function);
    00346
    00347         void unset_function();
    00349
    00350         void set_fill(Fill fill);
    00353
    00354         void unset_fill();
    00356
    00357         void set_tile(Pixmap& tile);
    00362
    00363         void unset_tile();
    00365
    00366         void set_stipple(Bitmap& stipple);
    00371
    00372         void unset_stipple();
    00374
    00375         void set_clip_mask(Bitmap& mask);
    00380
    00381         void unset_clip_mask();
    00383
    00384         void set_subwindow_mode(SubwindowMode mode);
    00387
    00388         void unset_subwindow_mode();
    00390
    00391         void set_ts_origin(int x, int y);
    00398
    00399         void set_ts_x_origin(int x);
    00405
    00406         void unset_ts_x_origin();
    00408
    00409         void set_ts_y_origin(int y);
    00415
    00416         void unset_ts_y_origin();
    00418
    00419         void set_clip_origin(int x, int y);
    00426
    00427         void set_clip_x_origin(int x);
    00433
    00434         void unset_clip_x_origin();
    00436
    00437         void set_clip_y_origin(int y);
    00443
    00444         void unset_clip_y_origin();
    00446
    00447         void set_graphics_exposures(bool exposures);
    00452
    00453         void unset_graphics_exposures();
    00455
    00456         void set_line_width(int width);
    00459
    00460         void unset_line_width();
    00462
    00463         void set_line_style(LineStyle style);
    00466
    00467         void unset_line_style();
    00469
    00470         void set_cap_style(CapStyle style);
    00473
    00474         void unset_cap_style();
    00476
    00477         void set_join_style(JoinStyle style);
    00480
    00481         void unset_join_style();
    00483
    00485 };
    00486
    00533
    00534 class GC : public G::Object
    00535 {
    00536         friend class G::Object;
    00537         friend class GCClass;
    00538
    00539         GC(const GC&);
    00540         GC& operator=(const GC&);
    00541
    00542 protected:
    00545
    00546         GC();
    00548
    00549         explicit GC(GdkGC *gc, bool reference = true);
    00556
    00558 //  Override these do_ methods when you want to change the default behaviour of the GdkGC.
    00559
    00560         virtual void do_get_values(GdkGCValues *values);
    00561
    00562         virtual void do_set_values(GdkGCValues *values, GdkGCValuesMask mask);
    00563
    00564         virtual void do_set_dashes(int dash_offset, gint8 dash_list[], int n);
    00565
    00566 public:
    00569
    00570         explicit GC(Drawable& drawable);
    00576
    00577         GC(Drawable& drawable, const GCValues& values);
    00581
    00582         virtual ~GC();
    00584
    00588
    00589         GdkGC* gdk_gc() const { return (GdkGC*)instance; }
    00591
    00592         GdkGCClass* gdk_gc_class() const;
    00594
    00595         operator GdkGC* () const;
    00597
    00598         int ts_x_origin() const;
    00600
    00601         int ts_y_origin() const;
    00603
    00604         int clip_x_origin() const;
    00606
    00607         int clip_y_origin() const;
    00609
    00610         void get_values(GCValues& values) const;
    00613
    00614         Colormap* get_colormap() const;
    00620
    00621         Screen* get_screen() const;
    00624
    00628
    00629         void set_values(const GCValues& values);
    00636
    00637         void set_foreground(const Color& color);
    00640
    00641         void set_background(const Color& color);
    00644
    00645         void set_function(Function function);
    00649
    00650         void set_fill(Fill fill);
    00653
    00654         void set_tile(Pixmap& tile);
    00659
    00660         void set_stipple(Pixmap& stipple);
    00665
    00666         void set_ts_origin(int x, int y);
    00673
    00674         void set_ts_origin(const Point& point);
    00680
    00681         void set_clip_origin(int x, int y);
    00688
    00689         void set_clip_origin(const Point& point);
    00695
    00696         void set_clip_mask(Bitmap& mask);
    00701
    00702         void set_clip(int x, int y, int width, int height);
    00710
    00711         void set_clip(const Rectangle& rectangle);
    00716
    00717         void set_clip(const Region& region);
    00722
    00723         void set_subwindow(SubwindowMode mode);
    00726
    00727         void set_exposures(bool exposures);
    00732
    00733         void set_line_attributes(int line_width, LineStyle line_style, CapStyle cap_style, JoinStyle join_style);
    00741
    00742         void set_line_width(int line_width);
    00745
    00746         void set_line_style(LineStyle line_style);
    00749
    00750         void set_cap_style(CapStyle cap_style);
    00753
    00754         void set_join_style(JoinStyle join_style);
    00757
    00758         void set_dashes(int dash_offset, const std::vector<gint8>& dash_list);
    00766
    00767         void offset(int x_offset, int y_offset);
    00773
    00774         void set_colormap(Colormap *colormap);
    00780
    00781         void set_rgb_fg_color(const Color& color);
    00791
    00792         void set_rgb_bg_color(const Color& color);
    00802
    00804 };
    00805
    00806 } // namespace Gdk
    00807
    00808 } // namespace Inti
    00809
    00810 #endif // INTI_GDK_GC_H
    00811
    00812

Main Page - Footer