summaryrefslogtreecommitdiff
path: root/libs/gtkmm2/pango/pangomm/renderer.h
blob: 8428c15b50e8295c13453d00cb474c4e9a1f8793 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
// -*- c++ -*-
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _PANGOMM_RENDERER_H
#define _PANGOMM_RENDERER_H

#include <glibmm.h>

/* $Id$ */

/* renderer.h
 *
 * Copyright(C) 2004 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or(at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */


#include <glibmm/object.h>
#include <pangomm/context.h>
#include <pangomm/glyphstring.h>
#include <pangomm/layout.h>
#include <pangomm/layoutline.h>
#include <pangomm/types.h> //For Matrix.


#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _PangoRenderer PangoRenderer;
typedef struct _PangoRendererClass PangoRendererClass;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */


namespace Pango
{ class Renderer_Class; } // namespace Pango
namespace Pango
{


/** @addtogroup pangommEnums Enums and Flags */

/**
 * @ingroup pangommEnums
 */
enum RenderPart
{
  RENDER_PART_FOREGROUND,
  RENDER_PART_BACKGROUND,
  RENDER_PART_UNDERLINE,
  RENDER_PART_STRIKETHROUGH
};

} // namespace Pango


#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Glib
{

template <>
class Value<Pango::RenderPart> : public Glib::Value_Enum<Pango::RenderPart>
{
public:
  static GType value_type() G_GNUC_CONST;
};

} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */


namespace Pango
{


/** TODO.
 */

class Renderer : public Glib::Object
{
  
#ifndef DOXYGEN_SHOULD_SKIP_THIS

public:
  typedef Renderer CppObjectType;
  typedef Renderer_Class CppClassType;
  typedef PangoRenderer BaseObjectType;
  typedef PangoRendererClass BaseClassType;

private:  friend class Renderer_Class;
  static CppClassType renderer_class_;

private:
  // noncopyable
  Renderer(const Renderer&);
  Renderer& operator=(const Renderer&);

protected:
  explicit Renderer(const Glib::ConstructParams& construct_params);
  explicit Renderer(PangoRenderer* castitem);

#endif /* DOXYGEN_SHOULD_SKIP_THIS */

public:
  virtual ~Renderer();

#ifndef DOXYGEN_SHOULD_SKIP_THIS
  static GType get_type()      G_GNUC_CONST;
  static GType get_base_type() G_GNUC_CONST;
#endif

  ///Provides access to the underlying C GObject.
  PangoRenderer*       gobj()       { return reinterpret_cast<PangoRenderer*>(gobject_); }

  ///Provides access to the underlying C GObject.
  const PangoRenderer* gobj() const { return reinterpret_cast<PangoRenderer*>(gobject_); }

  ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
  PangoRenderer* gobj_copy();

private:

 
protected:
 
public:

  
  /** Draws @a layout  with the specified Pango::Renderer.
   * 
   * Since: 1.8
   * @param layout A Pango::Layout.
   * @param x X position of left edge of baseline, in user space coordinates
   * in Pango units.
   * @param y X position of left edge of baseline, in user space coordinates
   * in Pango units.
   */
  void draw_layout(const Glib::RefPtr<Layout>& layout, int x, int y);
  
  /** Draws @a line  with the specified Pango::Renderer.
   * 
   * Since: 1.8
   * @param line A Pango::LayoutLine.
   * @param x X position of left edge of baseline, in user space coordinates
   * in Pango units.
   * @param y X position of left edge of baseline, in user space coordinates
   * in Pango units.
   */
  void draw_layout_line(const Glib::RefPtr<LayoutLine>& line, int x, int y);
  
  /** Draws the glyphs in @a glyphs  with the specified Pango::Renderer.
   * 
   * Since: 1.8
   * @param font A Pango::Font.
   * @param glyphs A Pango::GlyphString.
   * @param x X position of left edge of baseline, in user space coordinates
   * in Pango units.
   * @param y X position of left edge of baseline, in user space coordinates
   * in Pango units.
   */
  void draw_glyphs(const Glib::RefPtr<Font>& font, const GlyphString& glyphs, int x, int y);
  
  /** Draws an axis-aligned rectangle in user space coordinates with the
   * specified Pango::Renderer.
   * 
   * Since: 1.8
   * @param part Type of object this rectangle is part of.
   * @param x X position at which to draw rectangle, in user space coordinates in Pango units.
   * @param y Y position at which to draw rectangle, in user space coordinates in Pango units.
   * @param width Width of rectangle in PangoUnits in user space coordinates.
   * @param height Height of rectangle in PangoUnits in user space coordinates.
   */
  void draw_rectangle(RenderPart part, int x, int y, int width, int height);
  
  /** Draw a squiggly line that approximately covers the given rectangle
   * in the style of an underline used to indicate a spelling error.
   * (The width of the underline is rounded to an integer number
   * of up/down segments and the resulting rectangle is centered
   * in the original rectangle)
   * 
   * Since: 1.8
   * @param x X coordinate of underline, in Pango units in user coordinate system.
   * @param y Y coordinate of underline, in Pango units in user coordinate system.
   * @param width Width of underline, in Pango units in user coordinate system.
   * @param height Height of underline, in Pango units in user coordinate system.
   */
  void draw_error_underline(int x, int y, int width, int height);
  
  /** Draws a trapezoid with the parallel sides aligned with the X axis
   * using the given Pango::Renderer; coordinates are in device space.
   * 
   * Since: 1.8
   * @param part Type of object this trapezoid is part of.
   * @param y1 Y coordinate of top of trapezoid.
   * @param x11 X coordinate of left end of top of trapezoid.
   * @param x21 X coordinate of right end of top of trapezoid.
   * @param y2 X coordinate of top of trapezoid.
   * @param x12 X coordinate of left end of top of trapezoid.
   * @param x22 Y coordinate of left end of top of trapezoid.
   */
  void draw_trapezoid(RenderPart part, double y1, double x11, double x21, double y2, double x12, double x22);
  
  /** Draws a single glyph with coordinates in device space.
   * 
   * Since: 1.8
   * @param font A Pango::Font.
   * @param glyph The glyph index of a single glyph.
   * @param x X coordinate of left edge of baseline of glyph.
   * @param y Y coordinate of left edge of baseline of glyph.
   */
  void draw_glyph(const Glib::RefPtr<Font>& font, Glyph glyph, double x, double y);

  
  /** Does initial setup before rendering operations on @a renderer .
   * deactivate() should be called when done drawing.
   * Calls such as draw_layout() automatically
   * activate the layout before drawing on it. Calls to
   * activate() and deactivate() can
   * be nested and the renderer will only be initialized and
   * deinitialized once.
   * 
   * Since: 1.8
   */
  void activate();
  
  /** Cleans up after rendering operations on @a renderer . See
   * docs for activate().
   * 
   * Since: 1.8
   */
  void deactivate();

  
  /** Informs Pango that the way that the renderering is done
   * for @a part  has changed in a way that would prevent multiple
   * pieces being joined together into one drawing call. For
   * instance, if a subclass of Pango::Renderer was to add a stipple
   * option for drawing underlines, it needs to call
   * 
   * @code
   * pango_renderer_part_changed (render, PANGO_RENDER_PART_UNDERLINE);
   * @endcode
   * 
   * When the stipple changes or underlines with different stipples
   * might be joined together. Pango automatically calls this for
   * changes to colors. (See set_color())
   * 
   * Since: 1.8
   * @param part The part for which rendering has changed.
   */
  void part_changed(RenderPart part);

  
  /** Sets the color for part of the rendering.
   * 
   * Since: 1.8
   * @param part The part to change the color of.
   * @param color The new color or <tt>0</tt> to unset the current color.
   */
  void set_color(RenderPart part, const Color& color);
  
 
  /** Gets the current rendering color for the specified part.
   * @param part The part to get the color for.
   * @return The color for the specified part, or <tt>0</tt>
   * if it hasn't been set and should be inherited from the
   * environment.
   * 
   * Since: 1.8.
   */
  Color get_color(RenderPart part) const;

  
  /** Sets the transformation matrix that will be applied when rendering.
   * 
   * Since: 1.8
   * @param matrix A Pango::Matrix, or <tt>0</tt> to unset any existing matrix.
   * (No matrix set is the same as setting the identity matrix.).
   */
  void set_matrix(const Matrix& matrix);
  //TOOD: _WRAP_METHOD(Matrix get_matrix(), pango_renderer_get_matrix)
  //Note: The returned matrix is owned by Pango and must not be modified or freed.


public:

public:
  //C++ methods used to invoke GTK+ virtual functions:

protected:
  //GTK+ Virtual Functions (override these to change behaviour):

  //Default Signal Handlers::


};

} /* namespace Pango */


namespace Glib
{
  /** @relates Pango::Renderer
   * @param object The C instance
   * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
   * @result A C++ instance that wraps this C instance.
   */
  Glib::RefPtr<Pango::Renderer> wrap(PangoRenderer* object, bool take_copy = false);
}


#endif /* _PANGOMM_RENDERER_H */