File: GDK2.pmod

package info (click to toggle)
pike8.0 8.0.702-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 79,608 kB
  • sloc: ansic: 266,508; xml: 186,324; makefile: 3,537; sh: 1,731; cpp: 1,328; lisp: 655; awk: 441; asm: 242; objc: 240; pascal: 157; perl: 34; sed: 34
file content (53 lines) | stat: -rw-r--r-- 1,002 bytes parent folder | download | duplicates (6)
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
#pike __REAL_VERSION__
#require constant(GTK2.Widget)

#define INDEX(x) GTK2[x]

//! @decl import GTK2

//! @decl constant Atom

object Atom = class
{
  mapping atoms = ([]);

  class fake_atom
  {
    object ra;
    string n;
    object get_atom()
    {
      if(ra) return ra;
      return ra = GTK2->Gdk_Atom( n, 0 );
    }
    string get_name()
    {
      return get_atom()->get_name();
    }
    void create(string q)
    {
      n = q;
    }
  }

  object `[](string what)
  {
    if(atoms[what])
      return atoms[what];
    return atoms[what] = fake_atom( what );
  }
}();

mixed `[](string what)
{
  if(what == "_module_value") return UNDEFINED;
  if(what == "Atom") return Atom;
  if(has_index(GTK2, "Gdk"+what))
    return INDEX("Gdk"+what);
  if(has_index(GTK2, "GDK_"+what))
    return INDEX("GDK_"+what);
  if(has_index(GTK2, "GDK_"+upper_case(GTK2->unsillycaps(what))))
    return INDEX("GDK_"+upper_case(GTK2->unsillycaps(what)));
  return UNDEFINED;
//   return  GDKSupport[what];
}