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 54 55 56 57 58 59 60 61 62
|
#pike __REAL_VERSION__
#require constant(GTK.Widget)
#define INDEX(x) GTK[x]
//! GDK wrapper module.
//!
//! This is a convenience module that is identical to either
//! either the @[GDK2] or the @[GDK1] module depending on
//! which (if any) of them is available.
//!
//! @seealso
//! @[GDK1], @[GDK2]
//! @decl import GTK
//! @decl constant Atom
object Atom = class
{
mapping atoms = ([]);
class fake_atom
{
object ra;
string n;
object get_atom()
{
if(ra) return ra;
return ra = GTK->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(GTK, "Gdk"+what))
return INDEX("Gdk"+what);
if(has_index(GTK, "GDK_"+what))
return INDEX("GDK_"+what);
if(has_index(GTK, "GDK_"+upper_case(GTK->unsillycaps(what))))
return INDEX("GDK_"+upper_case(GTK->unsillycaps(what)));
return UNDEFINED;
// return GDKSupport[what];
}
|