| 42 | | // Hier irgendwelche Signale. |
| | 42 | klass->can_undo = &can_undo_callback; |
| | 43 | klass->can_redo = &can_redo_callback; |
| | 44 | klass->highlight_updated = &highlight_updated_callback; |
| | 45 | klass->marker_updated = &marker_updated_callback; |
| | 46 | } |
| | 47 | |
| | 48 | void Gtk::SourceBuffer_Class::can_undo_callback(GtkSourceBuffer* self, |
| | 49 | gboolean can_undo) |
| | 50 | { |
| | 51 | CppObjectType* const obj = dynamic_cast<CppObjectType*>( |
| | 52 | Glib::ObjectBase::_get_current_wrapper((GObject*)self)); |
| | 53 | |
| | 54 | if(obj && obj->is_derived_() ) |
| | 55 | { |
| | 56 | try |
| | 57 | { |
| | 58 | obj->on_can_undo(can_undo == TRUE); |
| | 59 | } |
| | 60 | catch(...) |
| | 61 | { |
| | 62 | Glib::exception_handlers_invoke(); |
| | 63 | } |
| | 64 | } |
| | 65 | else |
| | 66 | { |
| | 67 | BaseClassType* const base = static_cast<BaseClassType*>( |
| | 68 | g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) |
| | 69 | ); |
| | 70 | |
| | 71 | if(base && base->can_undo) |
| | 72 | (*base->can_undo)(self, can_undo); |
| | 73 | } |
| | 74 | } |
| | 75 | |
| | 76 | void Gtk::SourceBuffer_Class::can_redo_callback(GtkSourceBuffer* self, |
| | 77 | gboolean can_redo) |
| | 78 | { |
| | 79 | CppObjectType* const obj = dynamic_cast<CppObjectType*>( |
| | 80 | Glib::ObjectBase::_get_current_wrapper((GObject*)self)); |
| | 81 | |
| | 82 | if(obj && obj->is_derived_() ) |
| | 83 | { |
| | 84 | try |
| | 85 | { |
| | 86 | obj->on_can_redo(can_redo == TRUE); |
| | 87 | } |
| | 88 | catch(...) |
| | 89 | { |
| | 90 | Glib::exception_handlers_invoke(); |
| | 91 | } |
| | 92 | } |
| | 93 | else |
| | 94 | { |
| | 95 | BaseClassType* const base = static_cast<BaseClassType*>( |
| | 96 | g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) |
| | 97 | ); |
| | 98 | |
| | 99 | if(base && base->can_redo) |
| | 100 | (*base->can_redo)(self, can_redo); |
| | 101 | } |
| | 102 | } |
| | 103 | |
| | 104 | void Gtk::SourceBuffer_Class::highlight_updated_callback(GtkSourceBuffer* self, |
| | 105 | GtkTextIter* begin, |
| | 106 | GtkTextIter* end) |
| | 107 | { |
| | 108 | CppObjectType* const obj = dynamic_cast<CppObjectType*>( |
| | 109 | Glib::ObjectBase::_get_current_wrapper((GObject*)self)); |
| | 110 | |
| | 111 | if(obj && obj->is_derived_() ) |
| | 112 | { |
| | 113 | try |
| | 114 | { |
| | 115 | obj->on_highlight_updated( |
| | 116 | Glib::wrap(begin), |
| | 117 | Glib::wrap(end) |
| | 118 | ); |
| | 119 | } |
| | 120 | catch(...) |
| | 121 | { |
| | 122 | Glib::exception_handlers_invoke(); |
| | 123 | } |
| | 124 | } |
| | 125 | else |
| | 126 | { |
| | 127 | BaseClassType* const base = static_cast<BaseClassType*>( |
| | 128 | g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) |
| | 129 | ); |
| | 130 | |
| | 131 | if(base && base->highlight_updated) |
| | 132 | (*base->highlight_updated)(self, begin, end); |
| | 133 | } |
| | 134 | } |
| | 135 | |
| | 136 | void Gtk::SourceBuffer_Class::marker_updated_callback(GtkSourceBuffer* self, |
| | 137 | GtkTextIter* pos) |
| | 138 | { |
| | 139 | CppObjectType* const obj = dynamic_cast<CppObjectType*>( |
| | 140 | Glib::ObjectBase::_get_current_wrapper((GObject*)self)); |
| | 141 | |
| | 142 | if(obj && obj->is_derived_() ) |
| | 143 | { |
| | 144 | try |
| | 145 | { |
| | 146 | obj->on_marker_updated(Glib::wrap(pos) ); |
| | 147 | } |
| | 148 | catch(...) |
| | 149 | { |
| | 150 | Glib::exception_handlers_invoke(); |
| | 151 | } |
| | 152 | } |
| | 153 | else |
| | 154 | { |
| | 155 | BaseClassType* const base = static_cast<BaseClassType*>( |
| | 156 | g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) |
| | 157 | ); |
| | 158 | |
| | 159 | if(base && base->marker_updated) |
| | 160 | (*base->marker_updated)(self, pos); |
| | 161 | } |
| | 167 | } |
| | 168 | |
| | 169 | namespace |
| | 170 | { |
| | 171 | |
| | 172 | void SourceBuffer_signal_can_undo_callback(GtkSourceBuffer* self, |
| | 173 | gboolean can_undo, |
| | 174 | void* data) |
| | 175 | { |
| | 176 | using namespace Gtk; |
| | 177 | typedef sigc::slot<void, bool> SlotType; |
| | 178 | |
| | 179 | if(Glib::ObjectBase::_get_current_wrapper((GObject*)self) ) |
| | 180 | { |
| | 181 | try |
| | 182 | { |
| | 183 | sigc::slot_base* const slot = |
| | 184 | Glib::SignalProxyNormal::data_to_slot(data); |
| | 185 | |
| | 186 | if(slot) |
| | 187 | (*static_cast<SlotType*>(slot))( |
| | 188 | can_undo == TRUE |
| | 189 | ); |
| | 190 | } |
| | 191 | catch(...) |
| | 192 | { |
| | 193 | Glib::exception_handlers_invoke(); |
| | 194 | } |
| | 195 | } |
| | 196 | } |
| | 197 | |
| | 198 | const Glib::SignalProxyInfo SourceBuffer_signal_can_undo_info = |
| | 199 | { |
| | 200 | "can_undo", |
| | 201 | (GCallback) &SourceBuffer_signal_can_undo_callback, |
| | 202 | (GCallback) &SourceBuffer_signal_can_undo_callback |
| | 203 | }; |
| | 204 | |
| | 205 | void SourceBuffer_signal_can_redo_callback(GtkSourceBuffer* self, |
| | 206 | gboolean can_redo, |
| | 207 | void* data) |
| | 208 | { |
| | 209 | using namespace Gtk; |
| | 210 | typedef sigc::slot<void, bool> SlotType; |
| | 211 | |
| | 212 | if(Glib::ObjectBase::_get_current_wrapper((GObject*)self) ) |
| | 213 | { |
| | 214 | try |
| | 215 | { |
| | 216 | sigc::slot_base* const slot = |
| | 217 | Glib::SignalProxyNormal::data_to_slot(data); |
| | 218 | |
| | 219 | if(slot) |
| | 220 | (*static_cast<SlotType*>(slot))( |
| | 221 | can_redo == TRUE |
| | 222 | ); |
| | 223 | } |
| | 224 | catch(...) |
| | 225 | { |
| | 226 | Glib::exception_handlers_invoke(); |
| | 227 | } |
| | 228 | } |
| | 229 | } |
| | 230 | |
| | 231 | const Glib::SignalProxyInfo SourceBuffer_signal_can_redo_info = |
| | 232 | { |
| | 233 | "can_redo", |
| | 234 | (GCallback) &SourceBuffer_signal_can_redo_callback, |
| | 235 | (GCallback) &SourceBuffer_signal_can_redo_callback |
| | 236 | }; |
| | 237 | |
| | 238 | void SourceBuffer_signal_highlight_updated_callback(GtkSourceBuffer* self, |
| | 239 | GtkTextIter* begin, |
| | 240 | GtkTextIter* end, |
| | 241 | void* data) |
| | 242 | { |
| | 243 | using namespace Gtk; |
| | 244 | typedef sigc::slot< |
| | 245 | void, |
| | 246 | const SourceBuffer::iterator&, |
| | 247 | const SourceBuffer::iterator& |
| | 248 | > SlotType; |
| | 249 | |
| | 250 | if(Glib::ObjectBase::_get_current_wrapper((GObject*)self) ) |
| | 251 | { |
| | 252 | try |
| | 253 | { |
| | 254 | sigc::slot_base* const slot = |
| | 255 | Glib::SignalProxyNormal::data_to_slot(data); |
| | 256 | |
| | 257 | if(slot) |
| | 258 | (*static_cast<SlotType*>(slot))( |
| | 259 | Glib::wrap(begin), |
| | 260 | Glib::wrap(end) |
| | 261 | ); |
| | 262 | } |
| | 263 | catch(...) |
| | 264 | { |
| | 265 | Glib::exception_handlers_invoke(); |
| | 266 | } |
| | 267 | } |
| | 268 | } |
| | 269 | |
| | 270 | const Glib::SignalProxyInfo SourceBuffer_signal_highlight_updated_info = |
| | 271 | { |
| | 272 | "highlight_updated", |
| | 273 | (GCallback) &SourceBuffer_signal_highlight_updated_callback, |
| | 274 | (GCallback) &SourceBuffer_signal_highlight_updated_callback |
| | 275 | }; |
| | 276 | |
| | 277 | void SourceBuffer_signal_marker_updated_callback(GtkSourceBuffer* self, |
| | 278 | GtkTextIter* pos, |
| | 279 | void* data) |
| | 280 | { |
| | 281 | using namespace Gtk; |
| | 282 | typedef sigc::slot< |
| | 283 | void, |
| | 284 | const SourceBuffer::iterator& |
| | 285 | > SlotType; |
| | 286 | |
| | 287 | if(Glib::ObjectBase::_get_current_wrapper((GObject*)self) ) |
| | 288 | { |
| | 289 | try |
| | 290 | { |
| | 291 | sigc::slot_base* const slot = |
| | 292 | Glib::SignalProxyNormal::data_to_slot(data); |
| | 293 | |
| | 294 | if(slot) |
| | 295 | (*static_cast<SlotType*>(slot))( |
| | 296 | Glib::wrap(pos) |
| | 297 | ); |
| | 298 | } |
| | 299 | catch(...) |
| | 300 | { |
| | 301 | Glib::exception_handlers_invoke(); |
| | 302 | } |
| | 303 | } |
| | 304 | } |
| | 305 | |
| | 306 | const Glib::SignalProxyInfo SourceBuffer_signal_marker_updated_info = |
| | 307 | { |
| | 308 | "marker_updated", |
| | 309 | (GCallback) &SourceBuffer_signal_marker_updated_callback, |
| | 310 | (GCallback) &SourceBuffer_signal_marker_updated_callback |
| | 311 | }; |
| | 312 | |
| | 382 | |
| | 383 | void Gtk::SourceBuffer::on_can_undo(bool can_undo) |
| | 384 | { |
| | 385 | BaseClassType* const base = static_cast<BaseClassType*>( |
| | 386 | g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) |
| | 387 | ); |
| | 388 | |
| | 389 | if(base && base->can_undo) |
| | 390 | (*base->can_undo)(gobj(), can_undo ? TRUE : FALSE); |
| | 391 | } |
| | 392 | |
| | 393 | void Gtk::SourceBuffer::on_can_redo(bool can_redo) |
| | 394 | { |
| | 395 | BaseClassType* const base = static_cast<BaseClassType*>( |
| | 396 | g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) |
| | 397 | ); |
| | 398 | |
| | 399 | if(base && base->can_redo) |
| | 400 | (*base->can_redo)(gobj(), can_redo ? TRUE : FALSE); |
| | 401 | } |
| | 402 | |
| | 403 | void Gtk::SourceBuffer::on_highlight_updated(const iterator& begin, |
| | 404 | const iterator& end) |
| | 405 | { |
| | 406 | BaseClassType* const base = static_cast<BaseClassType*>( |
| | 407 | g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) |
| | 408 | ); |
| | 409 | |
| | 410 | if(base && base->highlight_updated) |
| | 411 | (*base->highlight_updated)( |
| | 412 | gobj(), |
| | 413 | const_cast<GtkTextIter*>(begin.gobj()), |
| | 414 | const_cast<GtkTextIter*>(end.gobj()) |
| | 415 | ); |
| | 416 | } |
| | 417 | |
| | 418 | void Gtk::SourceBuffer::on_marker_updated(const iterator& pos) |
| | 419 | { |
| | 420 | BaseClassType* const base = static_cast<BaseClassType*>( |
| | 421 | g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) |
| | 422 | ); |
| | 423 | |
| | 424 | if(base && base->marker_updated) |
| | 425 | (*base->marker_updated)( |
| | 426 | gobj(), |
| | 427 | const_cast<GtkTextIter*>(pos.gobj()) |
| | 428 | ); |
| | 429 | } |
| | 430 | |
| | 431 | Glib::SignalProxy1<void, bool> Gtk::SourceBuffer::signal_can_undo() |
| | 432 | { |
| | 433 | return Glib::SignalProxy1<void, bool>( |
| | 434 | this, |
| | 435 | &SourceBuffer_signal_can_undo_info |
| | 436 | ); |
| | 437 | } |
| | 438 | |
| | 439 | Glib::SignalProxy1<void, bool> Gtk::SourceBuffer::signal_can_redo() |
| | 440 | { |
| | 441 | return Glib::SignalProxy1<void, bool>( |
| | 442 | this, |
| | 443 | &SourceBuffer_signal_can_redo_info |
| | 444 | ); |
| | 445 | } |
| | 446 | |
| | 447 | Glib::SignalProxy2< |
| | 448 | void, |
| | 449 | const Gtk::SourceBuffer::iterator&, |
| | 450 | const Gtk::SourceBuffer::iterator& |
| | 451 | > Gtk::SourceBuffer::signal_highlight_updated() |
| | 452 | { |
| | 453 | return Glib::SignalProxy2<void, const iterator&, const iterator&>( |
| | 454 | this, |
| | 455 | &SourceBuffer_signal_highlight_updated_info |
| | 456 | ); |
| | 457 | } |
| | 458 | |
| | 459 | Glib::SignalProxy1< |
| | 460 | void, |
| | 461 | const Gtk::SourceBuffer::iterator& |
| | 462 | > Gtk::SourceBuffer::signal_marker_updated() |
| | 463 | { |
| | 464 | return Glib::SignalProxy1<void, const iterator&>( |
| | 465 | this, |
| | 466 | &SourceBuffer_signal_marker_updated_info |
| | 467 | ); |
| | 468 | } |
| | 469 | |
| | 470 | bool Gtk::SourceBuffer::get_check_brackets() const |
| | 471 | { |
| | 472 | return gtk_source_buffer_get_check_brackets( |
| | 473 | const_cast<GtkSourceBuffer*>(gobj()) |
| | 474 | ) == TRUE; |
| | 475 | } |
| | 476 | |
| | 477 | void Gtk::SourceBuffer::set_check_brackets(bool check_brackets) |
| | 478 | { |
| | 479 | return gtk_source_buffer_set_check_brackets( |
| | 480 | gobj(), |
| | 481 | check_brackets ? TRUE : FALSE |
| | 482 | ); |
| | 483 | } |
| | 484 | |
| | 485 | /*void Gtk::SourceBuffer::set_bracket_match_style( |
| | 486 | const Glib::RefPtr<Gtk::SourceTagStyle>& style |
| | 487 | ) |
| | 488 | { |
| | 489 | gtk_source_buffer_set_bracket_match_style( |
| | 490 | const_cast<GtkSourceBuffer*>(gobj() ), |
| | 491 | style->gobj() |
| | 492 | ); |
| | 493 | }*/ |
| | 494 | |
| | 495 | bool Gtk::SourceBuffer::get_highlight() const |
| | 496 | { |
| | 497 | return gtk_source_buffer_get_highlight( |
| | 498 | const_cast<GtkSourceBuffer*>(gobj()) |
| | 499 | ) == TRUE; |
| | 500 | } |
| | 501 | |
| | 502 | void Gtk::SourceBuffer::set_highlight(bool highlight) |
| | 503 | { |
| | 504 | gtk_source_buffer_set_highlight( |
| | 505 | gobj(), |
| | 506 | highlight ? TRUE : FALSE |
| | 507 | ); |
| | 508 | } |
| | 509 | |
| | 510 | gint Gtk::SourceBuffer::get_max_undo_levels() const |
| | 511 | { |
| | 512 | return gtk_source_buffer_get_max_undo_levels( |
| | 513 | const_cast<GtkSourceBuffer*>(gobj()) |
| | 514 | ); |
| | 515 | } |
| | 516 | |
| | 517 | void Gtk::SourceBuffer::set_max_undo_levels(gint max_undo_levels) |
| | 518 | { |
| | 519 | gtk_source_buffer_set_max_undo_levels( |
| | 520 | gobj(), |
| | 521 | max_undo_levels |
| | 522 | ); |
| | 523 | } |
| | 524 | |
| | 525 | Glib::RefPtr<Gtk::SourceLanguage> Gtk::SourceBuffer::get_language() const |
| | 526 | { |
| | 527 | return Glib::wrap(gtk_source_buffer_get_language( |
| | 528 | const_cast<GtkSourceBuffer*>(gobj()) |
| | 529 | ) ); |
| | 530 | } |
| | 531 | |
| | 532 | void |
| | 533 | Gtk::SourceBuffer::set_language(const Glib::RefPtr<SourceLanguage> language) |
| | 534 | { |
| | 535 | // Add new reference to the language because the C instance holds a |
| | 536 | // new reference now. |
| | 537 | g_object_ref(G_OBJECT(language->gobj()) ); |
| | 538 | |
| | 539 | gtk_source_buffer_set_language( |
| | 540 | gobj(), |
| | 541 | language->gobj() |
| | 542 | ); |
| | 543 | } |
| | 544 | |
| | 545 | gunichar Gtk::SourceBuffer::get_escape_char() const |
| | 546 | { |
| | 547 | return gtk_source_buffer_get_escape_char( |
| | 548 | const_cast<GtkSourceBuffer*>(gobj()) |
| | 549 | ); |
| | 550 | } |
| | 551 | |
| | 552 | void Gtk::SourceBuffer::set_escape_char(gunichar escape_char) |
| | 553 | { |
| | 554 | gtk_source_buffer_set_escape_char( |
| | 555 | gobj(), |
| | 556 | escape_char |
| | 557 | ); |
| | 558 | } |
| | 559 | |
| | 560 | bool Gtk::SourceBuffer::can_undo() const |
| | 561 | { |
| | 562 | return gtk_source_buffer_can_undo( |
| | 563 | const_cast<GtkSourceBuffer*>(gobj()) |
| | 564 | ); |
| | 565 | } |
| | 566 | |
| | 567 | bool Gtk::SourceBuffer::can_redo() const |
| | 568 | { |
| | 569 | return gtk_source_buffer_can_redo( |
| | 570 | const_cast<GtkSourceBuffer*>(gobj()) |
| | 571 | ); |
| | 572 | } |
| | 573 | |
| | 574 | void Gtk::SourceBuffer::undo() |
| | 575 | { |
| | 576 | gtk_source_buffer_undo(gobj() ); |
| | 577 | } |
| | 578 | |
| | 579 | void Gtk::SourceBuffer::redo() |
| | 580 | { |
| | 581 | gtk_source_buffer_redo(gobj() ); |
| | 582 | } |
| | 583 | |
| | 584 | void Gtk::SourceBuffer::begin_not_undoable_action() |
| | 585 | { |
| | 586 | gtk_source_buffer_begin_not_undoable_action(gobj() ); |
| | 587 | } |
| | 588 | |
| | 589 | void Gtk::SourceBuffer::end_not_undoable_action() |
| | 590 | { |
| | 591 | gtk_source_buffer_end_not_undoable_action(gobj() ); |
| | 592 | } |