~ubuntu-branches/ubuntu/vivid/ardour/vivid-proposed

« back to all changes in this revision

Viewing changes to libs/gtkmm2/pango/pangomm/layout.cc

  • Committer: Package Import Robot
  • Author(s): Felipe Sateler, Jaromír Mikeš, Felipe Sateler
  • Date: 2014-05-22 14:39:25 UTC
  • mfrom: (29 sid)
  • mto: This revision was merged to the branch mainline in revision 30.
  • Revision ID: package-import@ubuntu.com-20140522143925-vwqfo9287pmkrroe
Tags: 1:2.8.16+git20131003-3
* Team upload

[ Jaromír Mikeš ]
* Add -dbg package

[ Felipe Sateler ]
* Upload to experimental

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Generated by gtkmmproc -- DO NOT MODIFY!
 
2
 
 
3
#include <pangomm/layout.h>
 
4
#include <pangomm/private/layout_p.h>
 
5
 
 
6
#include <pango/pango-enum-types.h>
 
7
// -*- c++ -*-
 
8
/* $Id$ */
 
9
 
 
10
/* 
 
11
 *
 
12
 * Copyright 1998-2002 The gtkmm Development Team
 
13
 *
 
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.
 
18
 *
 
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.
 
23
 *
 
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.
 
27
 */
 
28
 
 
29
namespace Pango
 
30
{
 
31
 
 
32
Layout::Layout(const Glib::RefPtr<Context>& context)
 
33
:
 
34
  Glib::Object(G_OBJECT(pango_layout_new(context->gobj())))
 
35
{}
 
36
 
 
37
void Layout::set_text(const Glib::ustring& text)
 
38
{
 
39
  pango_layout_set_text(gobj(), text.c_str(), text.bytes());
 
40
}
 
41
 
 
42
void Layout::set_markup(const Glib::ustring& markup)
 
43
{
 
44
  return pango_layout_set_markup(gobj(), markup.c_str(), markup.bytes());
 
45
}
 
46
 
 
47
void Layout::set_markup(const Glib::ustring& markup, gunichar accel_marker, gunichar& accel_char)
 
48
{
 
49
  return pango_layout_set_markup_with_accel(gobj(), markup.c_str(), markup.bytes(), accel_marker, &accel_char);
 
50
}
 
51
 
 
52
Glib::ArrayHandle<PangoLogAttr> Layout::get_log_attrs() const
 
53
{
 
54
  //Get array:
 
55
  PangoLogAttr* pAttrs = 0;
 
56
  int n_attrs = 0;
 
57
  pango_layout_get_log_attrs(const_cast<PangoLayout*>(gobj()), &pAttrs, &n_attrs);
 
58
 
 
59
  return Glib::ArrayHandle<PangoLogAttr>(pAttrs, n_attrs, Glib::OWNERSHIP_SHALLOW);
 
60
}
 
61
 
 
62
Rectangle Layout::index_to_pos(int index) const
 
63
{
 
64
  Rectangle pos;
 
65
  pango_layout_index_to_pos(const_cast<PangoLayout*>(gobj()), index, pos.gobj());
 
66
  return pos;
 
67
}
 
68
 
 
69
Rectangle Layout::get_cursor_strong_pos(int index) const
 
70
{
 
71
  Rectangle strong_pos;
 
72
  pango_layout_get_cursor_pos(const_cast<PangoLayout*>(gobj()), index, strong_pos.gobj(), 0);
 
73
  return strong_pos;
 
74
}
 
75
 
 
76
Rectangle Layout::get_cursor_weak_pos(int index) const
 
77
{
 
78
  Rectangle weak_pos;
 
79
  pango_layout_get_cursor_pos(const_cast<PangoLayout*>(gobj()), index, 0, weak_pos.gobj());
 
80
  return weak_pos;
 
81
}
 
82
 
 
83
Rectangle Layout::get_ink_extents() const
 
84
{
 
85
  Rectangle ink_extents;
 
86
  pango_layout_get_extents(const_cast<PangoLayout*>(gobj()), ink_extents.gobj(), 0);
 
87
  return ink_extents;
 
88
}
 
89
 
 
90
Rectangle Layout::get_logical_extents() const
 
91
{
 
92
  Rectangle logical_extents;
 
93
  pango_layout_get_extents(const_cast<PangoLayout*>(gobj()), 0, logical_extents.gobj());
 
94
  return logical_extents;
 
95
}
 
96
 
 
97
Rectangle Layout::get_pixel_ink_extents() const
 
98
{
 
99
  Rectangle ink_extents;
 
100
  pango_layout_get_pixel_extents(const_cast<PangoLayout*>(gobj()), ink_extents.gobj(), 0);
 
101
  return ink_extents;
 
102
}
 
103
 
 
104
Rectangle Layout::get_pixel_logical_extents() const
 
105
{
 
106
  Rectangle logical_extents;
 
107
  pango_layout_get_pixel_extents(const_cast<PangoLayout*>(gobj()), 0, logical_extents.gobj());
 
108
  return logical_extents;
 
109
}
 
110
 
 
111
void Layout::get_iter(LayoutIter& iter)
 
112
{
 
113
  iter.assign_gobj(pango_layout_get_iter(gobj()));
 
114
}
 
115
 
 
116
void Layout::unset_font_description()
 
117
{
 
118
  pango_layout_set_font_description(gobj(), 0);
 
119
}
 
120
 
 
121
} /* namespace Pango */
 
122
 
 
123
 
 
124
namespace
 
125
{
 
126
} // anonymous namespace
 
127
 
 
128
// static
 
129
GType Glib::Value<Pango::Alignment>::value_type()
 
130
{
 
131
  return pango_alignment_get_type();
 
132
}
 
133
 
 
134
// static
 
135
GType Glib::Value<Pango::WrapMode>::value_type()
 
136
{
 
137
  return pango_wrap_mode_get_type();
 
138
}
 
139
 
 
140
// static
 
141
GType Glib::Value<Pango::EllipsizeMode>::value_type()
 
142
{
 
143
  return pango_ellipsize_mode_get_type();
 
144
}
 
145
 
 
146
 
 
147
namespace Glib
 
148
{
 
149
 
 
150
Glib::RefPtr<Pango::Layout> wrap(PangoLayout* object, bool take_copy)
 
151
{
 
152
  return Glib::RefPtr<Pango::Layout>( dynamic_cast<Pango::Layout*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
 
153
  //We use dynamic_cast<> in case of multiple inheritance.
 
154
}
 
155
 
 
156
} /* namespace Glib */
 
157
 
 
158
 
 
159
namespace Pango
 
160
{
 
161
 
 
162
 
 
163
/* The *_Class implementation: */
 
164
 
 
165
const Glib::Class& Layout_Class::init()
 
166
{
 
167
  if(!gtype_) // create the GType if necessary
 
168
  {
 
169
    // Glib::Class has to know the class init function to clone custom types.
 
170
    class_init_func_ = &Layout_Class::class_init_function;
 
171
 
 
172
    // This is actually just optimized away, apparently with no harm.
 
173
    // Make sure that the parent type has been created.
 
174
    //CppClassParent::CppObjectType::get_type();
 
175
 
 
176
    // Create the wrapper type, with the same class/instance size as the base type.
 
177
    register_derived_type(pango_layout_get_type());
 
178
 
 
179
    // Add derived versions of interfaces, if the C type implements any interfaces:
 
180
  }
 
181
 
 
182
  return *this;
 
183
}
 
184
 
 
185
void Layout_Class::class_init_function(void* g_class, void* class_data)
 
186
{
 
187
  BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
 
188
  CppClassParent::class_init_function(klass, class_data);
 
189
 
 
190
}
 
191
 
 
192
 
 
193
Glib::ObjectBase* Layout_Class::wrap_new(GObject* object)
 
194
{
 
195
  return new Layout((PangoLayout*)object);
 
196
}
 
197
 
 
198
 
 
199
/* The implementation: */
 
200
 
 
201
PangoLayout* Layout::gobj_copy()
 
202
{
 
203
  reference();
 
204
  return gobj();
 
205
}
 
206
 
 
207
Layout::Layout(const Glib::ConstructParams& construct_params)
 
208
:
 
209
  Glib::Object(construct_params)
 
210
{}
 
211
 
 
212
Layout::Layout(PangoLayout* castitem)
 
213
:
 
214
  Glib::Object((GObject*)(castitem))
 
215
{}
 
216
 
 
217
Layout::~Layout()
 
218
{}
 
219
 
 
220
 
 
221
Layout::CppClassType Layout::layout_class_; // initialize static member
 
222
 
 
223
GType Layout::get_type()
 
224
{
 
225
  return layout_class_.init().get_type();
 
226
}
 
227
 
 
228
GType Layout::get_base_type()
 
229
{
 
230
  return pango_layout_get_type();
 
231
}
 
232
 
 
233
 
 
234
Glib::RefPtr<Layout> Layout::create(const Glib::RefPtr<Context>& context)
 
235
{
 
236
  return Glib::RefPtr<Layout>( new Layout(context) );
 
237
}
 
238
Glib::RefPtr<Layout> Layout::copy()
 
239
{
 
240
  return Glib::wrap(pango_layout_copy(gobj()));
 
241
}
 
242
 
 
243
Glib::RefPtr<Context> Layout::get_context() const
 
244
{
 
245
 
 
246
  Glib::RefPtr<Context> retvalue = Glib::wrap(pango_layout_get_context(const_cast<PangoLayout*>(gobj())));
 
247
 
 
248
  if(retvalue)
 
249
    retvalue->reference(); //The function does not do a ref for us.
 
250
  return retvalue;
 
251
}
 
252
 
 
253
void Layout::set_attributes(AttrList& attrs)
 
254
{
 
255
  pango_layout_set_attributes(gobj(), (attrs).gobj());
 
256
}
 
257
 
 
258
AttrList Layout::get_attributes() const
 
259
{
 
260
  return AttrList((pango_layout_get_attributes(const_cast<PangoLayout*>(gobj()))));
 
261
}
 
262
 
 
263
Glib::ustring Layout::get_text() const
 
264
{
 
265
  return Glib::convert_const_gchar_ptr_to_ustring(pango_layout_get_text(const_cast<PangoLayout*>(gobj())));
 
266
}
 
267
 
 
268
void Layout::set_font_description(const FontDescription& desc)
 
269
{
 
270
  pango_layout_set_font_description(gobj(), (desc).gobj());
 
271
}
 
272
 
 
273
void Layout::set_width(int width)
 
274
{
 
275
  pango_layout_set_width(gobj(), width);
 
276
}
 
277
 
 
278
int Layout::get_width() const
 
279
{
 
280
  return pango_layout_get_width(const_cast<PangoLayout*>(gobj()));
 
281
}
 
282
 
 
283
void Layout::set_wrap(WrapMode wrap)
 
284
{
 
285
  pango_layout_set_wrap(gobj(), ((PangoWrapMode)(wrap)));
 
286
}
 
287
 
 
288
WrapMode Layout::get_wrap() const
 
289
{
 
290
  return ((WrapMode)(pango_layout_get_wrap(const_cast<PangoLayout*>(gobj()))));
 
291
}
 
292
 
 
293
void Layout::set_indent(int indent)
 
294
{
 
295
  pango_layout_set_indent(gobj(), indent);
 
296
}
 
297
 
 
298
int Layout::get_indent() const
 
299
{
 
300
  return pango_layout_get_indent(const_cast<PangoLayout*>(gobj()));
 
301
}
 
302
 
 
303
void Layout::set_spacing(int spacing)
 
304
{
 
305
  pango_layout_set_spacing(gobj(), spacing);
 
306
}
 
307
 
 
308
int Layout::get_spacing() const
 
309
{
 
310
  return pango_layout_get_spacing(const_cast<PangoLayout*>(gobj()));
 
311
}
 
312
 
 
313
void Layout::set_justify(bool justify)
 
314
{
 
315
  pango_layout_set_justify(gobj(), static_cast<int>(justify));
 
316
}
 
317
 
 
318
bool Layout::get_justify() const
 
319
{
 
320
  return pango_layout_get_justify(const_cast<PangoLayout*>(gobj()));
 
321
}
 
322
 
 
323
bool Layout::get_auto_dir() const
 
324
{
 
325
  return pango_layout_get_auto_dir(const_cast<PangoLayout*>(gobj()));
 
326
}
 
327
 
 
328
void Layout::set_auto_dir(bool auto_dir)
 
329
{
 
330
  pango_layout_set_auto_dir(gobj(), static_cast<int>(auto_dir));
 
331
}
 
332
 
 
333
void Layout::set_alignment(Alignment alignment)
 
334
{
 
335
  pango_layout_set_alignment(gobj(), ((PangoAlignment)(alignment)));
 
336
}
 
337
 
 
338
Alignment Layout::get_alignment() const
 
339
{
 
340
  return ((Alignment)(pango_layout_get_alignment(const_cast<PangoLayout*>(gobj()))));
 
341
}
 
342
 
 
343
void Layout::set_tabs(TabArray& tabs)
 
344
{
 
345
  pango_layout_set_tabs(gobj(), (tabs).gobj());
 
346
}
 
347
 
 
348
TabArray Layout::get_tabs() const
 
349
{
 
350
  return TabArray((pango_layout_get_tabs(const_cast<PangoLayout*>(gobj()))));
 
351
}
 
352
 
 
353
void Layout::set_single_paragraph_mode(bool setting)
 
354
{
 
355
  pango_layout_set_single_paragraph_mode(gobj(), static_cast<int>(setting));
 
356
}
 
357
 
 
358
bool Layout::get_single_paragraph_mode() const
 
359
{
 
360
  return pango_layout_get_single_paragraph_mode(const_cast<PangoLayout*>(gobj()));
 
361
}
 
362
 
 
363
void Layout::set_ellipsize(EllipsizeMode ellipsize)
 
364
{
 
365
  pango_layout_set_ellipsize(gobj(), ((PangoEllipsizeMode)(ellipsize)));
 
366
}
 
367
 
 
368
EllipsizeMode Layout::get_ellipsize() const
 
369
{
 
370
  return ((EllipsizeMode)(pango_layout_get_ellipsize(const_cast<PangoLayout*>(gobj()))));
 
371
}
 
372
 
 
373
void Layout::context_changed()
 
374
{
 
375
  pango_layout_context_changed(gobj());
 
376
}
 
377
 
 
378
void Layout::get_cursor_pos(int index, Rectangle& strong_pos, Rectangle& weak_pos) const
 
379
{
 
380
  pango_layout_get_cursor_pos(const_cast<PangoLayout*>(gobj()), index, (strong_pos).gobj(), (weak_pos).gobj());
 
381
}
 
382
 
 
383
void Layout::move_cursor_visually(bool strong, int old_index, int old_trailing, int direction, int& new_index, int& new_trailing) const
 
384
{
 
385
  pango_layout_move_cursor_visually(const_cast<PangoLayout*>(gobj()), static_cast<int>(strong), old_index, old_trailing, direction, &new_index, &new_trailing);
 
386
}
 
387
 
 
388
bool Layout::xy_to_index(int x, int y, int& index, int& trailing) const
 
389
{
 
390
  return pango_layout_xy_to_index(const_cast<PangoLayout*>(gobj()), x, y, &index, &trailing);
 
391
}
 
392
 
 
393
void Layout::get_extents(Rectangle& ink_rect, Rectangle& logical_rect) const
 
394
{
 
395
  pango_layout_get_extents(const_cast<PangoLayout*>(gobj()), (ink_rect).gobj(), (logical_rect).gobj());
 
396
}
 
397
 
 
398
void Layout::get_pixel_extents(Rectangle& ink_rect, Rectangle& logical_rect) const
 
399
{
 
400
  pango_layout_get_pixel_extents(const_cast<PangoLayout*>(gobj()), (ink_rect).gobj(), (logical_rect).gobj());
 
401
}
 
402
 
 
403
void Layout::get_size(int& width, int& height) const
 
404
{
 
405
  pango_layout_get_size(const_cast<PangoLayout*>(gobj()), &width, &height);
 
406
}
 
407
 
 
408
void Layout::get_pixel_size(int& width, int& height) const
 
409
{
 
410
  pango_layout_get_pixel_size(const_cast<PangoLayout*>(gobj()), &width, &height);
 
411
}
 
412
 
 
413
int Layout::get_line_count() const
 
414
{
 
415
  return pango_layout_get_line_count(const_cast<PangoLayout*>(gobj()));
 
416
}
 
417
 
 
418
Glib::RefPtr<LayoutLine> Layout::get_line(int line)
 
419
{
 
420
 
 
421
  Glib::RefPtr<LayoutLine> retvalue = Glib::wrap(pango_layout_get_line(gobj(), line));
 
422
 
 
423
  if(retvalue)
 
424
    retvalue->reference(); //The function does not do a ref for us.
 
425
  return retvalue;
 
426
}
 
427
 
 
428
Glib::RefPtr<const LayoutLine> Layout::get_line(int line) const
 
429
{
 
430
 
 
431
  Glib::RefPtr<const LayoutLine> retvalue = Glib::wrap(pango_layout_get_line(const_cast<PangoLayout*>(gobj()), line));
 
432
 
 
433
  if(retvalue)
 
434
    retvalue->reference(); //The function does not do a ref for us.
 
435
  return retvalue;
 
436
}
 
437
 
 
438
SListHandle_LayoutLine Layout::get_lines()
 
439
{
 
440
  return SListHandle_LayoutLine(pango_layout_get_lines(gobj()), Glib::OWNERSHIP_SHALLOW);
 
441
}
 
442
 
 
443
SListHandle_ConstLayoutLine Layout::get_lines() const
 
444
{
 
445
  return SListHandle_ConstLayoutLine(pango_layout_get_lines(const_cast<PangoLayout*>(gobj())), Glib::OWNERSHIP_SHALLOW);
 
446
}
 
447
 
 
448
 
 
449
} // namespace Pango
 
450
 
 
451