GFC Logo GFC Title Logo
Reference Manual
Main Page  |  Namespace List  |  Alphabetical List  |  Class List  |  File List

gc.hh

Go to the documentation of this file.
00001 /* GFC-UI: GTK+ Foundation Classes (User Interface Library) 00002 * Copyright (C) 2002-2004 The GFC 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 00023 00024 #ifndef GFC_GDK_GC_HH 00025 #define GFC_GDK_GC_HH 00026 00027 #ifndef GFC_GDK_G_OBJECT_HH 00028 #include <gfc/glib/object.hh> 00029 #endif 00030 00031 #ifndef __GDK_GC_H__ 00032 #include <gdk/gdkgc.h> 00033 #endif 00034 00035 #ifndef _CPP_VECTOR 00036 #include <vector> 00037 #endif 00038 00039 namespace GFC { 00040 00041 namespace Gdk { 00042 00043 class Bitmap; 00044 class Color; 00045 class Colormap; 00046 class Drawable; 00047 class Pixmap; 00048 class Point; 00049 class Rectangle; 00050 class Region; 00051 class Screen; 00052 00055 00056 enum CapStyle 00057 { 00058 CAP_NOT_LAST = GDK_CAP_NOT_LAST, 00061 00062 CAP_BUTT = GDK_CAP_BUTT, 00064 00065 CAP_ROUND = GDK_CAP_ROUND, 00068 00069 CAP_PROJECTING = GDK_CAP_PROJECTING 00072 }; 00073 00076 00077 enum Fill 00078 { 00079 SOLID = GDK_SOLID, 00081 00082 TILED = GDK_TILED, 00084 00085 STIPPLED = GDK_STIPPLED, 00089 00090 OPAQUE_STIPPLED = GDK_OPAQUE_STIPPLED 00094 }; 00095 00102 00103 enum Function 00104 { 00105 COPY = GDK_COPY, 00106 INVERT = GDK_INVERT, 00107 XOR = GDK_XOR, 00108 CLEAR = GDK_CLEAR, 00109 AND = GDK_AND, 00110 AND_REVERSE = GDK_AND_REVERSE, 00111 AND_INVERT = GDK_AND_INVERT, 00112 NOOP = GDK_NOOP, 00113 OR = GDK_OR, 00114 EQUIV = GDK_EQUIV, 00115 OR_REVERSE = GDK_OR_REVERSE, 00116 COPY_INVERT = GDK_COPY_INVERT, 00117 OR_INVERT = GDK_OR_INVERT, 00118 NAND = GDK_NAND, 00119 NOR = GDK_NOR, 00120 SET = GDK_SET 00121 }; 00122 00125 00126 enum JoinStyle 00127 { 00128 JOIN_MITER = GDK_JOIN_MITER, 00130 00131 JOIN_ROUND = GDK_JOIN_ROUND, 00133 00134 JOIN_BEVEL = GDK_JOIN_BEVEL 00137 }; 00138 00141 00142 enum LineStyle 00143 { 00144 LINE_SOLID = GDK_LINE_SOLID, 00146 00147 LINE_ON_OFF_DASH = GDK_LINE_ON_OFF_DASH, 00149 00150 LINE_DOUBLE_DASH = GDK_LINE_DOUBLE_DASH 00154 }; 00155 00158 00159 enum SubwindowMode 00160 { 00161 CLIP_BY_CHILDREN = GDK_CLIP_BY_CHILDREN, 00162 INCLUDE_INFERIORS = GDK_INCLUDE_INFERIORS 00163 }; 00164 00181 00182 class GCValues 00183 { 00184 friend class GC; 00185 00186 GdkGCValues values_; 00187 unsigned int mask_; 00188 00189 public: 00192 00193 GCValues(); 00195 00196 GCValues(const GCValues& src); 00199 00200 ~GCValues (); 00202 00203 GCValues& operator=(const GCValues& src); 00206 00210 00211 GdkGCValues* gdk_gc_values() const; 00213 00214 GdkGCValuesMask gdk_gc_values_mask() const; 00216 00217 Color foreground() const; 00219 00220 bool foreground_set() const; 00222 00223 Color background() const; 00225 00226 bool background_set() const; 00228 00229 Function function() const; 00231 00232 bool function_set() const; 00234 00235 Fill fill() const; 00237 00238 bool fill_set() const; 00240 00241 Pixmap* tile() const; 00243 00244 bool tile_set() const; 00246 00247 Bitmap* stipple() const; 00249 00250 bool stipple_set () const; 00252 00253 Bitmap* clip_mask() const; 00255 00256 bool clip_mask_set() const; 00258 00259 SubwindowMode subwindow_mode() const; 00261 00262 bool subwindow_mode_set() const; 00264 00265 int ts_x_origin() const; 00267 00268 bool ts_x_origin_set() const; 00270 00271 int ts_y_origin() const; 00273 00274 bool ts_y_origin_set() const; 00276 00277 int clip_x_origin() const; 00279 00280 bool clip_x_origin_set() const; 00282 00283 int clip_y_origin() const; 00285 00286 bool clip_y_origin_set () const; 00288 00289 bool graphics_exposures() const; 00291 00292 bool graphics_exposures_set() const; 00294 00295 int line_width() const; 00297 00298 bool line_width_set() const; 00300 00301 LineStyle line_style() const; 00303 00304 bool line_style_set() const; 00306 00307 CapStyle cap_style () const; 00309 00310 bool cap_style_set() const; 00312 00313 JoinStyle join_style() const; 00315 00316 bool join_style_set() const; 00318 00322 00323 void reset(); 00325 00326 void set_foreground(const Color& color); 00329 00330 void unset_foreground(); 00332 00333 void set_background(const Color& color); 00336 00337 void unset_background(); 00339 00340 void set_function(Function function); 00344 00345 void unset_function(); 00347 00348 void set_fill(Fill fill); 00351 00352 void unset_fill(); 00354 00355 void set_tile(Pixmap& tile); 00360 00361 void unset_tile(); 00363 00364 void set_stipple(Bitmap& stipple); 00369 00370 void unset_stipple(); 00372 00373 void set_clip_mask(Bitmap& mask); 00378 00379 void unset_clip_mask(); 00381 00382 void set_subwindow_mode(SubwindowMode mode); 00385 00386 void unset_subwindow_mode(); 00388 00389 void set_ts_origin(int x, int y); 00396 00397 void set_ts_x_origin(int x); 00403 00404 void unset_ts_x_origin(); 00406 00407 void set_ts_y_origin(int y); 00413 00414 void unset_ts_y_origin(); 00416 00417 void set_clip_origin(int x, int y); 00424 00425 void set_clip_x_origin(int x); 00431 00432 void unset_clip_x_origin(); 00434 00435 void set_clip_y_origin(int y); 00441 00442 void unset_clip_y_origin(); 00444 00445 void set_graphics_exposures(bool exposures); 00450 00451 void unset_graphics_exposures(); 00453 00454 void set_line_width(int width); 00457 00458 void unset_line_width(); 00460 00461 void set_line_style(LineStyle style); 00464 00465 void unset_line_style(); 00467 00468 void set_cap_style(CapStyle style); 00471 00472 void unset_cap_style(); 00474 00475 void set_join_style(JoinStyle style); 00478 00479 void unset_join_style(); 00481 00483 }; 00484 00531 00532 class GC : public G::Object 00533 { 00534 friend class G::Object; 00535 00536 GC(const GC&); 00537 GC& operator=(const GC&); 00538 00539 protected: 00542 00543 explicit GC(GdkGC *gc, bool owns_reference = true); 00550 00552 00553 public: 00556 00557 explicit GC(Drawable& drawable); 00563 00564 GC(Drawable& drawable, const GCValues& values); 00568 00569 virtual ~GC(); 00571 00575 00576 GdkGC* gdk_gc() const; 00578 00579 operator GdkGC* () const; 00581 00582 int ts_x_origin() const; 00584 00585 int ts_y_origin() const; 00587 00588 int clip_x_origin() const; 00590 00591 int clip_y_origin() const; 00593 00594 void get_values(GCValues& values) const; 00597 00598 Colormap* get_colormap() const; 00604 00605 Screen* get_screen() const; 00608 00612 00613 void set_values(const GCValues& values); 00620 00621 void set_foreground(const Color& color); 00624 00625 void set_background(const Color& color); 00628 00629 void set_function(Function function); 00633 00634 void set_fill(Fill fill); 00637 00638 void set_tile(Pixmap& tile); 00643 00644 void set_stipple(Pixmap& stipple); 00649 00650 void set_ts_origin(int x, int y); 00657 00658 void set_ts_origin(const Point& point); 00664 00665 void set_clip_origin(int x, int y); 00672 00673 void set_clip_origin(const Point& point); 00679 00680 void set_clip_mask(Bitmap& mask); 00685 00686 void set_clip(int x, int y, int width, int height); 00694 00695 void set_clip(const Rectangle& rectangle); 00700 00701 void set_clip(const Region& region); 00706 00707 void set_subwindow(SubwindowMode mode); 00710 00711 void set_exposures(bool exposures); 00716 00717 void set_line_attributes(int line_width, LineStyle line_style, CapStyle cap_style, JoinStyle join_style); 00725 00726 void set_line_width(int line_width); 00729 00730 void set_line_style(LineStyle line_style); 00733 00734 void set_cap_style(CapStyle cap_style); 00737 00738 void set_join_style(JoinStyle join_style); 00741 00742 void set_dashes(int dash_offset, const std::vector<gint8>& dash_list); 00750 00751 void offset(int x_offset, int y_offset); 00757 00758 void set_colormap(Colormap *colormap); 00764 00765 void set_rgb_fg_color(const Color& color); 00775 00776 void set_rgb_bg_color(const Color& color); 00786 00788 }; 00789 00790 } // namespace Gdk 00791 00792 } // namespace GFC 00793 00794 #include <gfc/gdk/inline/gc.inl> 00795 00796 #endif // GFC_GDK_GC_HH 00797 00798

Generated on Tue Aug 24 00:34:31 2004 for GFC-UI by doxygen 1.3.8