1
/***************************************************************************
2
ktexteditor.cpp - KTextEditor ruby extension
4
begin : Thurs May 29 2008
5
copyright : (C) 2008 by Richard Dale
6
email : Richard_Dale@tipitina.demon.co.uk
7
***************************************************************************/
9
/***************************************************************************
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
16
***************************************************************************/
24
#include <smoke/ktexteditor_smoke.h>
30
static VALUE getClassList(VALUE /*self*/)
32
VALUE classList = rb_ary_new();
33
for (int i = 1; i <= ktexteditor_Smoke->numClasses; i++) {
34
if (ktexteditor_Smoke->classes[i].className && !ktexteditor_Smoke->classes[i].external)
35
rb_ary_push(classList, rb_str_new2(ktexteditor_Smoke->classes[i].className));
41
resolve_classname_ktexteditor(smokeruby_object * o)
43
return qtruby_modules[o->smoke].binding->className(o->classId);
46
extern TypeHandler KTextEditor_handlers[];
50
VALUE ktexteditor_module;
51
VALUE ktexteditor_internal_module;
53
static QtRuby::Binding binding;
58
init_ktexteditor_Smoke();
60
binding = QtRuby::Binding(ktexteditor_Smoke);
62
smokeList << ktexteditor_Smoke;
64
QtRubyModule module = { "KTextEditor", resolve_classname_ktexteditor, 0, &binding };
65
qtruby_modules[ktexteditor_Smoke] = module;
67
install_handlers(KTextEditor_handlers);
69
ktexteditor_module = rb_define_module("KTextEditor");
70
ktexteditor_internal_module = rb_define_module_under(ktexteditor_module, "Internal");
72
rb_define_singleton_method(ktexteditor_internal_module, "getClassList", (VALUE (*) (...)) getClassList, 0);
74
rb_require("ktexteditor/ktexteditor.rb");
75
rb_funcall(ktexteditor_internal_module, rb_intern("init_all_classes"), 0);