Browse files

More implementing

  • Loading branch information...
1 parent 9559cba commit b501e2436cfc15069f1bb74574f96c9ed8d2278a @shamanas committed May 29, 2011
Showing with 372 additions and 13 deletions.
  1. +48 −0 source/gtk/GList.ooc
  2. +3 −3 source/gtk/Widget.ooc
  3. +321 −10 source/gtk/Window.ooc
View
48 source/gtk/GList.ooc
@@ -0,0 +1,48 @@
+include glib
+
+gList : cover from GList {
+ data : extern Pointer
+}
+
+_GList : cover from gList* {
+ data : func->Pointer {
+ this@ as gList data
+ }
+ new : extern(g_list_alloc) static func->This
+ append : extern(g_list_append) func(Pointer)->This
+ prepend : extern(g_list_prepend) func(Pointer)->This
+ insert : extern(g_list_insert) func(Pointer)->This
+ insertBefore : extern(g_list_insert_before) func(This,Pointer)->This
+ insertSorted : extern(g_list_insert_sorted) func(Pointer,Func(Pointer,Pointer)->Bool)->This
+ remove : extern(g_list_remove) func(This)->This
+ removeLink : extern(g_list_remove_link) func(This)->This
+ deleteLink : extern(g_list_delete_link) func(This)->This
+ removeAll : extern(g_list_remove_all) func(Pointer)->This
+ free : extern(g_list_free) func
+ freeFull : extern(g_list_free_full) func(Func(Pointer))
+ free1 : extern(g_list_free_1) func
+ length : extern(g_list_length) func->UInt
+ copy : extern(g_list_copy) func->This
+ reverse : extern(g_list_reverse) func->This
+ sort : extern(g_list_sort) func(Func(Pointer,Pointer)->Bool)->This
+ insertSortedWithData : extern(g_list_insert_sorted_with_data) func(Pointer,Func(Pointer,Pointer,Pointer)->Bool,Pointer)->This
+ sortWithData : extern(g_list_sort_with_data) func(Func(Pointer,Pointer,Pointer)->Bool,Pointer)->This
+
+ concat : extern(g_list_concat) static func(This,This)->This
+ foreach : extern(g_list_foreach) func(Func(Pointer,Pointer),Pointer)
+ first : extern(g_list_first) func->This
+ last : extern(g_list_last) func->This
+ previous : extern(g_list_previous) func->This
+ next : extern(g_list_next) func->This
+ nth : extern(g_list_nth) func(UInt)->This
+ nthData : extern(g_list_nth_data) func(UInt)->Pointer
+ nthPrev : extern(g_list_nth_prev) func(UInt)->This
+ find : extern(g_list_find) func(Pointer)->This
+ findCustom : extern(g_list_find_custom) func(Pointer,Func(Pointer,Pointer)->Bool)->This
+ position : extern(g_list_position) func(This)->Int
+ index : extern(g_list_index) func(Pointer)->Int
+
+ pushAllocator : extern(g_list_push_allocator) static func(Pointer)
+ popAllocator : extern(g_list_pop_allocator) static func
+}
+
View
6 source/gtk/Widget.ooc
@@ -1,6 +1,6 @@
use gdk, gtk
import gtk/[Gtk, _GObject, Window]
-import gdk/Drawable
+import gdk/[Drawable, Window, Screen]
WidgetStruct: cover from GtkWidget {
window: extern GdkWindow*
@@ -104,15 +104,15 @@ Widget: cover from WidgetStruct* extends _GObject {
*/
getWidth: func -> Int {
// FIXME ugly workaround
- return this@ as WidgetStruct allocation width;
+ return this@ as WidgetStruct allocation width
}
/**
* The height of this window
*/
getHeight: func -> Int {
// FIXME ugly workaround
- return this@as WidgetStruct allocation height;
+ return this@ as WidgetStruct allocation height
}
/*
View
331 source/gtk/Window.ooc
@@ -1,40 +1,351 @@
use gtk
-import gtk/[Gtk, Container, AccelGroup]
+import gtk/[Gtk, Container, AccelGroup, Type, Widget, GList]
+import gdk/[Window, Screen]
WindowStruct: cover from GtkWindow
+WindowPosition : enum {
+ none,
+ center,
+ mouse,
+ center_always,
+ center_on_parent
+}
+
/**
* A simple Gtk window
*/
Window: cover from WindowStruct* extends Container {
+ new: extern(gtk_window_new) static func~withInt(Int)->This
/**
* Create a new top-level window
*/
new: static func -> This {
- return gtk_window_new(GTK_WINDOW_TOPLEVEL) as This
+ new(GTK_WINDOW_TOPLEVEL)
}
/**
* Create a new titled top-level window
*/
new: static func ~with_title (title: String) -> This {
- w := new()
- w setTitle(title);
- return w
+ w := new(). setTitle(title)
+ w
}
/**
* Change the title of this window
*/
- setTitle: func (title: String) { gtk_window_set_title(this, title) }
+ setTitle : extern(gtk_window_set_title) func(CString)
+ getTitle : extern(gtk_window_get_title) func~cstr->CString
+ getTitle : func~str->String { getTitle() toString() }
-
+ title : String {
+ get {
+ getTitle~str()
+ } set (str) {
+ setTitle(str)
+ }
+ }
+
+ setWmClass : extern(gtk_window_set_wm_class) func(CString,CString)
+
+ setRole : extern(gtk_window_set_role) func(CString)
+ getRole : extern(gtk_window_get_role) func~cstr->CString
+ getRole : func~str->String { getRole() toString() }
+ role : String {
+ get {
+ getRole~str()
+ } set (str) {
+ setRole(str)
+ }
+ }
+
+ setStartupId : extern(gtk_window_set_startup_id) func(CString)
+
+ addAccelGroup: extern(gtk_window_add_accel_group) func (AccelGroup)
+ removeAccelGroup : extern(gtk_window_remove_accel_group) func(AccelGroup)
+
+ setPosition : extern(gtk_window_set_position) func(Int)
+ activateFocus : extern(gtk_window_activate_focus) func
+
+ setFocus : extern(gtk_window_set_focus) func(Widget)
+ getFocus : extern(gtk_window_get_focus) func->Widget
+ focus : Widget {
+ get {
+ getFocus()
+ } set (f) {
+ setFocus(f)
+ }
+ }
+
+ activateDefault : extern(gtk_window_activate_default) func
+ setDefault : extern(gtk_window_set_default) func(Widget)
+ getDefault : extern(gtk_window_get_default_widget) func->Widget
+ default : Widget {
+ get {
+ getDefault()
+ } set (d) {
+ setDefault(d)
+ }
+ }
+
+ setTransientFor : extern(gtk_window_set_transient_for) func(Window)
+ getTransientFor : extern(gtk_window_get_transient_for) func->Window
+
+ setOpacity : extern(gtk_window_set_opacity) func(Double)
+ getOpacity : extern(gtk_window_get_opacity) func->Double
+ opacity : Double {
+ get {
+ getOpacity()
+ } set (o) {
+ setOpacity(o)
+ }
+ }
+
+ setTypeHint : extern(gtk_window_set_type_hint) func(WindowTypeHint)
+ getTypeHint : extern(gtk_window_get_type_hint) func->WindowTypeHint
+ typeHint : WindowTypeHint {
+ get {
+ getTypeHint()
+ } set (i) {
+ setTypeHint(i)
+ }
+ }
+
+ setSkipTaskbarHint : extern(gtk_window_set_skip_taskbar_hint) func(Bool)
+ getSkipTaskbarHint : extern(gtk_window_get_skip_taskbar_hint) func->Bool
+ skipTaskbarHint? : Bool {
+ get {
+ getSkipTaskbarHint()
+ } set (b) {
+ setSkipTaskbarHint(b)
+ }
+ }
+
+ setSkipPagerHint : extern(gtk_window_set_skip_pager_hint) func(Bool)
+ getSkipPagerHint : extern(gtk_window_get_skip_pager_hint) func->Bool
+ skipPagerHint? : Bool {
+ get {
+ getSkipPagerHint()
+ } set (b) {
+ setSkipPagerHint(b)
+ }
+ }
+
+ setUrgencyHint : extern(gtk_window_set_urgency_hint) func(Bool)
+ getUrgencyHint : extern(gtk_window_get_urgency_hint) func->Bool
+ urgencyHint? : Bool {
+ get {
+ getUrgencyHint()
+ } set (b) {
+ setUrgencyHint(b)
+ }
+ }
+
+ setAcceptFocus : extern(gtk_window_set_accept_focus) func(Bool)
+ getAcceptFocus : extern(gtk_window_get_accept_focus) func->Bool
+ acceptFocus? : Bool {
+ get {
+ getAcceptFocus()
+ } set (b) {
+ setAcceptFocus(b)
+ }
+ }
+
+ setFocusOnMap : extern(gtk_window_set_focus_on_map) func(Bool)
+ getFocusOnMap : extern(gtk_window_get_focus_on_map) func->Bool
+ focusOnMap? : Bool {
+ get {
+ getFocusOnMap()
+ } set (b) {
+ setFocusOnMap(b)
+ }
+ }
- addAccelGroup: extern(gtk_window_add_accel_group) func (accelGroup: AccelGroup)
+ setDestroyWithParent : extern(gtk_window_set_destroy_with_parent) func(Bool)
+ getDestroyWithParent : extern(gtk_window_get_destroy_with_parent) func->Bool
+ destroyWithParent? : Bool {
+ get {
+ getDestroyWithParent()
+ } set (b) {
+ setDestroyWithParent(b)
+ }
+ }
+
+ setMnemonicsVisible : extern(gtk_window_set_mnemonics_visible) func(Bool)
+ getMnemonicsVisible : extern(gtk_window_get_mnemonics_visible) func->Bool
+ mnemonicsVisible? : Bool {
+ get {
+ getMnemonicsVisible()
+ } set (b) {
+ setMnemonicsVisible(b)
+ }
+ }
+
+ setResizable : extern(gtk_window_set_resizable) func(Bool)
+ getResizable : extern(gtk_window_get_resizable) func->Bool
+ resizable? : Bool {
+ get {
+ getResizable()
+ } set (b) {
+ setResizable(b)
+ }
+ }
+
+ setGravity : extern(gtk_window_set_gravity) func(Gravity)
+ getGravity : extern(gtk_window_get_gravity) func->Gravity
+ gravity : Gravity {
+ get {
+ getGravity()
+ } set (i) {
+ setGravity(i)
+ }
+ }
+
+ setScreen : extern(gtk_window_set_screen) func(Screen)
+ getScreen : extern(gtk_window_get_screen) func->Screen
+ screen : Screen {
+ get {
+ getScreen()
+ } set (s) {
+ setScreen(s)
+ }
+ }
+
+ setDecorated : extern(gtk_window_set_decorated) func(Bool)
+ getDecorated : extern(gtk_window_get_decorated) func->Bool
+ decorated? : Bool {
+ get {
+ getDecorated()
+ } set (b) {
+ setDecorated(b)
+ }
+ }
+
+ setDeletable : extern(gtk_window_set_deletable) func(Bool)
+ getDeletable : extern(gtk_window_get_deletable) func->Bool
+ deletable? : Bool {
+ get {
+ getDeletable()
+ } set (b) {
+ setDeletable(b)
+ }
+ }
+ setIconList : extern(gtk_window_set_icon_list) func(_GList)
+ getIconList : extern(gtk_window_get_icon_list) func->_GList
+ iconList : _GList {
+ get {
+ getIconList()
+ } set (g) {
+ setIconList(g)
+ }
+ }
+
+ active? : extern(gtk_window_is_active) func->Bool
+ hasToplevelFocus? : extern(gtk_window_has_toplevel_socus) func->Bool
+
+ setGeometryHints : extern(gtk_window_set_geometry_hints) func(Widget,Geometry,WindowHints)
+
+ getType : extern(gtk_window_get_type) func->Type
+
+}
+/*
+void gtk_window_set_icon (GtkWindow *window,
+ GdkPixbuf *icon);
+void gtk_window_set_icon_name (GtkWindow *window,
+ const gchar *name);
+gboolean gtk_window_set_icon_from_file (GtkWindow *window,
+ const gchar *filename,
+ GError **err);
+GdkPixbuf* gtk_window_get_icon (GtkWindow *window);
+G_CONST_RETURN
+gchar *gtk_window_get_icon_name (GtkWindow *window);
+void gtk_window_set_default_icon_list (GList *list);
+GList* gtk_window_get_default_icon_list (void);
+void gtk_window_set_default_icon (GdkPixbuf *icon);
+void gtk_window_set_default_icon_name (const gchar *name);
+G_CONST_RETURN
+gchar *gtk_window_get_default_icon_name (void);
+gboolean gtk_window_set_default_icon_from_file (const gchar *filename,
+ GError **err);
+
+void gtk_window_set_auto_startup_notification (gboolean setting);
+
+void gtk_window_set_modal (GtkWindow *window,
+ gboolean modal);
+gboolean gtk_window_get_modal (GtkWindow *window);
+GList* gtk_window_list_toplevels (void);
+
+void gtk_window_add_mnemonic (GtkWindow *window,
+ guint keyval,
+ GtkWidget *target);
+void gtk_window_remove_mnemonic (GtkWindow *window,
+ guint keyval,
+ GtkWidget *target);
+gboolean gtk_window_mnemonic_activate (GtkWindow *window,
+ guint keyval,
+ GdkModifierType modifier);
+void gtk_window_set_mnemonic_modifier (GtkWindow *window,
+ GdkModifierType modifier);
+GdkModifierType gtk_window_get_mnemonic_modifier (GtkWindow *window);
+
+gboolean gtk_window_activate_key (GtkWindow *window,
+ GdkEventKey *event);
+gboolean gtk_window_propagate_key_event (GtkWindow *window,
+ GdkEventKey *event);
+
+void gtk_window_present (GtkWindow *window);
+void gtk_window_present_with_time (GtkWindow *window,
+ guint32 timestamp);
+void gtk_window_iconify (GtkWindow *window);
+void gtk_window_deiconify (GtkWindow *window);
+void gtk_window_stick (GtkWindow *window);
+void gtk_window_unstick (GtkWindow *window);
+void gtk_window_maximize (GtkWindow *window);
+void gtk_window_unmaximize (GtkWindow *window);
+void gtk_window_fullscreen (GtkWindow *window);
+void gtk_window_unfullscreen (GtkWindow *window);
+void gtk_window_set_keep_above (GtkWindow *window, gboolean setting);
+void gtk_window_set_keep_below (GtkWindow *window, gboolean setting);
+
+void gtk_window_begin_resize_drag (GtkWindow *window,
+ GdkWindowEdge edge,
+ gint button,
+ gint root_x,
+ gint root_y,
+ guint32 timestamp);
+void gtk_window_begin_move_drag (GtkWindow *window,
+ gint button,
+ gint root_x,
+ gint root_y,
+ guint32 timestamp);
+*/
+version(!GTK_DISABLE_DEPRECATED) {
+extend Window {
+ setHasFrame : extern(gtk_window_set_has_frame) func(Bool)
+ getHasFrame : extern(gtk_window_get_has_frame) func->Bool
+ /*
+ hasFrame? : Bool {
+ get {
+ getHasFrame()
+ } set (b) {
+ setHasFrame(b)
+ }
+ }
+ */
+
+ setFrameDimensions : extern(gtk_window_set_frame_dimensions) func(Int,Int,Int,Int)
+ getFrameDimensions : extern(gtk_window_get_frame_dimensions) func~withRef(Int@,Int@,Int@,Int@)
+ getFrameDimensions : func~tuple -> (Int,Int,Int,Int) {
+ a,b,c,d : Int
+ getFrameDimensions(a&,b&,c&,d&)
+ (a,b,c,d)
+ }
+
+ setPolicy : extern(gtk_window_set_policy) func(Int,Int,Int)
+}
}
GTK_WINDOW_TOPLEVEL: extern Int
-gtk_window_new: extern func (Int) -> Window
-gtk_window_set_title: extern func (Window, CString)

0 comments on commit b501e24

Please sign in to comment.