~kubuntu-members/korundum/4.11

« back to all changes in this revision

Viewing changes to qtruby/modules/qwt/qwt.cpp

  • Committer: Ian Monroe
  • Date: 2010-11-21 15:55:01 UTC
  • Revision ID: git-v1:c37670e4e3c59f5eb2ba112f5341a5e706217f6f
Split up Smoke into Qt and KDE directories. 
Move libsmoke stuff into the generator directory
Split up Ruby into qtruby and korundum directories

svn path=/trunk/KDE/kdebindings/ruby/; revision=1199320

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <ruby.h>
 
2
 
 
3
#include <QHash>
 
4
#include <QList>
 
5
#include <QtDebug>
 
6
 
 
7
#include <smoke/qwt_smoke.h>
 
8
 
 
9
#include <qtruby.h>
 
10
 
 
11
#include <iostream>
 
12
 
 
13
static VALUE getClassList(VALUE /*self*/)
 
14
{
 
15
    VALUE classList = rb_ary_new();
 
16
    for (int i = 1; i <= qwt_Smoke->numClasses; i++) {
 
17
        if (qwt_Smoke->classes[i].className && !qwt_Smoke->classes[i].external)
 
18
            rb_ary_push(classList, rb_str_new2(qwt_Smoke->classes[i].className));
 
19
    }
 
20
    return classList;
 
21
}
 
22
 
 
23
const char*
 
24
resolve_classname_qwt(smokeruby_object * o)
 
25
{
 
26
    return qtruby_modules[o->smoke].binding->className(o->classId);
 
27
}
 
28
 
 
29
extern TypeHandler Qwt_handlers[];
 
30
 
 
31
extern "C" {
 
32
 
 
33
VALUE qwt_module;
 
34
VALUE qwt_internal_module;
 
35
 
 
36
static QtRuby::Binding binding;
 
37
 
 
38
Q_DECL_EXPORT void
 
39
Init_qwt()
 
40
{
 
41
    init_qwt_Smoke();
 
42
 
 
43
    binding = QtRuby::Binding(qwt_Smoke);
 
44
 
 
45
    smokeList << qwt_Smoke;
 
46
 
 
47
    QtRubyModule module = { "Qwt", resolve_classname_qwt, 0, &binding };
 
48
    qtruby_modules[qwt_Smoke] = module;
 
49
 
 
50
    install_handlers(Qwt_handlers);
 
51
 
 
52
    qwt_module = rb_define_module("Qwt");
 
53
    qwt_internal_module = rb_define_module_under(qwt_module, "Internal");
 
54
 
 
55
    rb_define_singleton_method(qwt_internal_module, "getClassList", (VALUE (*) (...)) getClassList, 0);
 
56
 
 
57
    rb_require("qwt/qwt.rb");
 
58
    rb_funcall(qwt_internal_module, rb_intern("init_all_classes"), 0);
 
59
}
 
60
 
 
61
}