2
// Generated by gtkmmproc -- DO NOT MODIFY!
12
* Copyright (C) 1998-2002 The gtkmm Development Team
14
* This library is free software; you can redistribute it and/or
15
* modify it under the terms of the GNU Library General Public
16
* License as published by the Free Software Foundation; either
17
* version 2 of the License, or (at your option) any later version.
19
* This library is distributed in the hope that it will be useful,
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22
* Library General Public License for more details.
24
* You should have received a copy of the GNU Library General Public
25
* License along with this library; if not, write to the Free
26
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29
#include <glibmm/object.h>
30
#include <gdkmm/drawable.h>
31
#include <gdkmm/types.h>
32
#include <gdkmm/rectangle.h>
33
#include <gdkmm/region.h>
34
#include <gdkmm/screen.h>
35
#include <gdk/gdkgc.h>
38
#ifndef DOXYGEN_SHOULD_SKIP_THIS
39
typedef struct _GdkGC GdkGC;
40
typedef struct _GdkGCClass GdkGCClass;
41
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
45
{ class GC_Class; } // namespace Gdk
50
/** @addtogroup gdkmmEnums Enums and Flags */
65
#ifndef DOXYGEN_SHOULD_SKIP_THIS
70
class Value<Gdk::LineStyle> : public Glib::Value_Enum<Gdk::LineStyle>
73
static GType value_type() G_GNUC_CONST;
77
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
97
#ifndef DOXYGEN_SHOULD_SKIP_THIS
102
class Value<Gdk::CapStyle> : public Glib::Value_Enum<Gdk::CapStyle>
105
static GType value_type() G_GNUC_CONST;
109
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
116
* @ingroup gdkmmEnums
128
#ifndef DOXYGEN_SHOULD_SKIP_THIS
133
class Value<Gdk::JoinStyle> : public Glib::Value_Enum<Gdk::JoinStyle>
136
static GType value_type() G_GNUC_CONST;
140
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
147
* @ingroup gdkmmEnums
160
#ifndef DOXYGEN_SHOULD_SKIP_THIS
165
class Value<Gdk::Fill> : public Glib::Value_Enum<Gdk::Fill>
168
static GType value_type() G_GNUC_CONST;
172
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
179
* @ingroup gdkmmEnums
204
#ifndef DOXYGEN_SHOULD_SKIP_THIS
209
class Value<Gdk::Function> : public Glib::Value_Enum<Gdk::Function>
212
static GType value_type() G_GNUC_CONST;
216
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
223
* @ingroup gdkmmEnums
234
#ifndef DOXYGEN_SHOULD_SKIP_THIS
239
class Value<Gdk::SubwindowMode> : public Glib::Value_Enum<Gdk::SubwindowMode>
242
static GType value_type() G_GNUC_CONST;
246
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
253
* @ingroup gdkmmEnums
254
* @par Bitwise operators:
255
* <tt>%GCValuesMask operator|(GCValuesMask, GCValuesMask)</tt><br>
256
* <tt>%GCValuesMask operator&(GCValuesMask, GCValuesMask)</tt><br>
257
* <tt>%GCValuesMask operator^(GCValuesMask, GCValuesMask)</tt><br>
258
* <tt>%GCValuesMask operator~(GCValuesMask)</tt><br>
259
* <tt>%GCValuesMask& operator|=(GCValuesMask&, GCValuesMask)</tt><br>
260
* <tt>%GCValuesMask& operator&=(GCValuesMask&, GCValuesMask)</tt><br>
261
* <tt>%GCValuesMask& operator^=(GCValuesMask&, GCValuesMask)</tt><br>
265
GC_FOREGROUND = 1 << 0,
266
GC_BACKGROUND = 1 << 1,
268
GC_FUNCTION = 1 << 3,
272
GC_CLIP_MASK = 1 << 7,
273
GC_SUBWINDOW = 1 << 8,
274
GC_TS_X_ORIGIN = 1 << 9,
275
GC_TS_Y_ORIGIN = 1 << 10,
276
GC_CLIP_X_ORIGIN = 1 << 11,
277
GC_CLIP_Y_ORIGIN = 1 << 12,
278
GC_EXPOSURES = 1 << 13,
279
GC_LINE_WIDTH = 1 << 14,
280
GC_LINE_STYLE = 1 << 15,
281
GC_CAP_STYLE = 1 << 16,
282
GC_JOIN_STYLE = 1 << 17
285
/** @ingroup gdkmmEnums */
286
inline GCValuesMask operator|(GCValuesMask lhs, GCValuesMask rhs)
287
{ return static_cast<GCValuesMask>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
289
/** @ingroup gdkmmEnums */
290
inline GCValuesMask operator&(GCValuesMask lhs, GCValuesMask rhs)
291
{ return static_cast<GCValuesMask>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
293
/** @ingroup gdkmmEnums */
294
inline GCValuesMask operator^(GCValuesMask lhs, GCValuesMask rhs)
295
{ return static_cast<GCValuesMask>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
297
/** @ingroup gdkmmEnums */
298
inline GCValuesMask operator~(GCValuesMask flags)
299
{ return static_cast<GCValuesMask>(~static_cast<unsigned>(flags)); }
301
/** @ingroup gdkmmEnums */
302
inline GCValuesMask& operator|=(GCValuesMask& lhs, GCValuesMask rhs)
303
{ return (lhs = static_cast<GCValuesMask>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
305
/** @ingroup gdkmmEnums */
306
inline GCValuesMask& operator&=(GCValuesMask& lhs, GCValuesMask rhs)
307
{ return (lhs = static_cast<GCValuesMask>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
309
/** @ingroup gdkmmEnums */
310
inline GCValuesMask& operator^=(GCValuesMask& lhs, GCValuesMask rhs)
311
{ return (lhs = static_cast<GCValuesMask>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
316
#ifndef DOXYGEN_SHOULD_SKIP_THIS
321
class Value<Gdk::GCValuesMask> : public Glib::Value_Flags<Gdk::GCValuesMask>
324
static GType value_type() G_GNUC_CONST;
328
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
337
/** All drawing operations in GDK take a graphics context (GC) argument.
338
* A graphics context encapsulates information about the way things are drawn, such as the foreground color or line width.
339
* By using graphics contexts, the number of arguments to each drawing call is greatly reduced, and communication overhead
340
* is minimized, since identical arguments do not need to be passed repeatedly.
343
class GC : public Glib::Object
346
#ifndef DOXYGEN_SHOULD_SKIP_THIS
349
typedef GC CppObjectType;
350
typedef GC_Class CppClassType;
351
typedef GdkGC BaseObjectType;
352
typedef GdkGCClass BaseClassType;
354
private: friend class GC_Class;
355
static CppClassType gc_class_;
360
GC& operator=(const GC&);
363
explicit GC(const Glib::ConstructParams& construct_params);
364
explicit GC(GdkGC* castitem);
366
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
371
#ifndef DOXYGEN_SHOULD_SKIP_THIS
372
static GType get_type() G_GNUC_CONST;
373
static GType get_base_type() G_GNUC_CONST;
376
///Provides access to the underlying C GObject.
377
GdkGC* gobj() { return reinterpret_cast<GdkGC*>(gobject_); }
379
///Provides access to the underlying C GObject.
380
const GdkGC* gobj() const { return reinterpret_cast<GdkGC*>(gobject_); }
382
///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
390
explicit GC(const Glib::RefPtr<Drawable>& drawable);
394
static Glib::RefPtr<GC> create();
397
static Glib::RefPtr<GC> create(const Glib::RefPtr<Drawable>& drawable);
400
// Custom wrap these?, maybe with a Gdk::GC::Value class. Need to do take care of refcounts of GdkGCValue's fields.
401
// Actually, I don't see the need for these methods. murrayc.
402
//_WRAP_METHOD(void get_values(GdkGCValues& values) const, gdk_gc_get_values)
403
//_WRAP_METHOD(void set_values(const GdkGCValues& values, GCValuesMask values_mask), gdk_gc_set_values)
404
//__IGNORE(gdk_gc_get_values, gdk_gc_set_values)
407
/** Sets the foreground color for a graphics context.
408
* Note that this function uses @a color ->pixel, use
409
* set_rgb_fg_color() to specify the foreground
410
* color as red, green, blue components.
411
* @param color The new foreground color.
413
void set_foreground(const Color& color);
415
/** Sets the background color for a graphics context.
416
* Note that this function uses @a color ->pixel, use
417
* set_rgb_bg_color() to specify the background
418
* color as red, green, blue components.
419
* @param color The new background color.
421
void set_background(const Color& color);
423
/** Determines how the current pixel values and the
424
* pixel values being drawn are combined to produce
425
* the final pixel values.
426
* @param function The Gdk::Function to use.
428
void set_function(Function function);
430
/** Set the fill mode for a graphics context.
431
* @param fill The new fill mode.
433
void set_fill(Fill fill);
435
/** Set a tile pixmap for a graphics context.
436
* This will only be used if the fill mode
438
* @param tile The new tile pixmap.
440
void set_tile(const Glib::RefPtr<Pixmap>& tile);
442
/** Set the stipple bitmap for a graphics context. The
443
* stipple will only be used if the fill mode is
444
* Gdk::STIPPLED or Gdk::OPAQUE_STIPPLED.
445
* @param stipple The new stipple bitmap.
447
void set_stipple(const Glib::RefPtr<Pixmap>& stipple);
449
/** Set the origin when using tiles or stipples with
450
* the GC. The tile or stipple will be aligned such
451
* that the upper left corner of the tile or stipple
452
* will coincide with this point.
453
* @param x The x-coordinate of the origin.
454
* @param y The y-coordinate of the origin.
456
void set_ts_origin(int x, int y);
458
/** Sets the origin of the clip mask. The coordinates are
459
* interpreted relative to the upper-left corner of
460
* the destination drawable of the current operation.
461
* @param x The x-coordinate of the origin.
462
* @param y The y-coordinate of the origin.
464
void set_clip_origin(int x, int y);
466
/** Sets the clip mask for a graphics context from a bitmap.
467
* The clip mask is interpreted relative to the clip
468
* origin. (See set_clip_origin()).
469
* @param mask A bitmap.
471
void set_clip_mask(const Glib::RefPtr<Bitmap>& mask);
473
/** Sets the clip mask for a graphics context from a
474
* rectangle. The clip mask is interpreted relative to the clip
475
* origin. (See set_clip_origin()).
476
* @param rectangle The rectangle to clip to.
478
void set_clip_rectangle(Rectangle& rectangle);
480
/** Sets the clip mask for a graphics context from a region structure.
481
* The clip mask is interpreted relative to the clip origin. (See
482
* set_clip_origin()).
483
* @param region The Gdk::Region.
485
void set_clip_region(const Region& region);
487
/** Sets how drawing with this GC on a window will affect child
488
* windows of that window.
489
* @param mode The subwindow mode.
491
void set_subwindow(SubwindowMode mode);
493
/** Sets whether copying non-visible portions of a drawable
494
* using this graphics context generate exposure events
495
* for the corresponding regions of the destination
496
* drawable. (See gdk_draw_drawable()).
497
* @param exposures If <tt>true</tt>, exposure events will be generated.
499
void set_exposures(bool exposures);
501
/** Sets various attributes of how lines are drawn. See
502
* the corresponding members of Gdk::GCValues for full
503
* explanations of the arguments.
504
* @param line_width The width of lines.
505
* @param line_style The dash-style for lines.
506
* @param cap_style The manner in which the ends of lines are drawn.
507
* @param join_style The in which lines are joined together.
509
void set_line_attributes(int line_width, LineStyle line_style, CapStyle cap_style, JoinStyle join_style);
511
/** Sets the way dashed-lines are drawn. Lines will be
512
* drawn with alternating on and off segments of the
513
* lengths specified in @a dash_list . The manner in
514
* which the on and off segments are drawn is determined
515
* by the @a line_style value of the GC. (This can
516
* be changed with set_line_attributes().)
518
* The @a dash_offset defines the phase of the pattern,
519
* specifying how many pixels into the dash-list the pattern
520
* should actually begin.
521
* @param dash_offset The phase of the dash pattern.
522
* @param dash_list An array of dash lengths.
523
* @param n The number of elements in @a dash_list .
525
void set_dashes(int dash_offset, gint8* dash_list, int n);
527
/** Offset attributes such as the clip and tile-stipple origins
528
* of the GC so that drawing at x - x_offset, y - y_offset with
529
* the offset GC has the same effect as drawing at x, y with the original
531
* @param x_offset Amount by which to offset the GC in the X direction.
532
* @param y_offset Amount by which to offset the GC in the Y direction.
534
void offset(int x_offset, int y_offset);
536
/** Sets the colormap for the GC to the given colormap. The depth
537
* of the colormap's visual must match the depth of the drawable
538
* for which the GC was created.
539
* @param colormap A Gdk::Colormap.
541
void set_colormap(const Glib::RefPtr<Colormap>& colormap);
543
/** Retrieves the colormap for a given GC, if it exists.
544
* A GC will have a colormap if the drawable for which it was created
545
* has a colormap, or if a colormap was set explicitely with
546
* gdk_gc_set_colormap.
547
* @return The colormap of @a gc , or <tt>0</tt> if @a gc doesn't have one.
549
Glib::RefPtr<Colormap> get_colormap();
551
/** Set the foreground color of a GC using an unallocated color. The
552
* pixel value for the color will be determined using GdkRGB. If the
553
* colormap for the GC has not previously been initialized for GdkRGB,
554
* then for pseudo-color colormaps (colormaps with a small modifiable
555
* number of colors), a colorcube will be allocated in the colormap.
557
* Calling this function for a GC without a colormap is an error.
558
* @param color An unallocated Gdk::Color.
560
void set_rgb_fg_color(const Color& color);
562
/** Set the background color of a GC using an unallocated color. The
563
* pixel value for the color will be determined using GdkRGB. If the
564
* colormap for the GC has not previously been initialized for GdkRGB,
565
* then for pseudo-color colormaps (colormaps with a small modifiable
566
* number of colors), a colorcube will be allocated in the colormap.
568
* Calling this function for a GC without a colormap is an error.
569
* @param color An unallocated Gdk::Color.
571
void set_rgb_bg_color(const Color& color);
574
/** Gets the Gdk::Screen for which @a gc was created
575
* @return The Gdk::Screen for @a gc .
579
Glib::RefPtr<Screen> get_screen();
581
/** Gets the Gdk::Screen for which @a gc was created
582
* @return The Gdk::Screen for @a gc .
586
Glib::RefPtr<const Screen> get_screen() const;
592
//C++ methods used to invoke GTK+ virtual functions:
595
//GTK+ Virtual Functions (override these to change behaviour):
597
//Default Signal Handlers::
602
} /* namespace Gdk */
608
* @param object The C instance
609
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
610
* @result A C++ instance that wraps this C instance.
612
Glib::RefPtr<Gdk::GC> wrap(GdkGC* object, bool take_copy = false);
616
#endif /* _GDKMM_GC_H */