Permalink
Browse files

Moved things around

  • Loading branch information...
1 parent 8d2b6b0 commit d113577a8d227b8b5452f715da67cc2f6e0ee7a9 nddrylliog committed Aug 15, 2010
View
1 .gitignore
@@ -1,3 +1,4 @@
hiworld
+build
*_tmp
.libs
View
2 gtk.use
@@ -5,4 +5,4 @@ Description: GNU User interface Toolkit
Pkgs: gtk+-2.0
Includes: gtk/gtk.h, gdk/gdk.h
Requires: gdk
-SourcePath: .
+SourcePath: source
View
24 gtk/_GObject.ooc
@@ -1,24 +0,0 @@
-use gtk
-import gtk/Gtk
-
-_GObjectStruct: cover from GtkObject
-
-/**
- * The base of the GObject hierarchy. Can send and receive signals
- */
-_GObject: cover from _GObjectStruct* {
-
- connect: func ~nodata (signalName: GChar*, callback: Func) -> GULong {
- connect(signalName, callback, null)
- }
-
- connect: func (signalName: GChar*, callback: Func, data: GPointer) -> GULong {
- gtk_signal_connect(GTK_OBJECT(this), signalName,
- GTK_SIGNAL_FUNC(callback), data)
- }
-
-}
-
-GTK_OBJECT: extern func (_GObject) -> _GObject
-GTK_SIGNAL_FUNC: extern func (Func) -> Func
-gtk_signal_connect: extern func (_GObject, GChar*, Func, GPointer) -> GULong
View
3 samples/hiworld.ooc
@@ -6,7 +6,7 @@ main: func {
win := Window new("GTK Hello World")
win setUSize(400, 200) .connect("delete_event", exit)
- button := Button new("Click me!")
+ button := Button new("Click you!")
button connect("clicked", func {
"You tricked me!" println()
}) .setBorderWidth(50)
@@ -15,5 +15,4 @@ main: func {
Gtk main()
}
-g_print: extern func (String, ...)
exit: extern func
View
0 gtk/AccelGroup.ooc → source/gtk/AccelGroup.ooc
File renamed without changes.
View
0 gtk/Box.ooc → source/gtk/Box.ooc
File renamed without changes.
View
0 gtk/Button.ooc → source/gtk/Button.ooc
File renamed without changes.
View
0 gtk/Container.ooc → source/gtk/Container.ooc
File renamed without changes.
View
0 gtk/Entry.ooc → source/gtk/Entry.ooc
File renamed without changes.
View
0 gtk/Gtk.ooc → source/gtk/Gtk.ooc
File renamed without changes.
View
0 gtk/HBox.ooc → source/gtk/HBox.ooc
File renamed without changes.
View
0 gtk/Image.ooc → source/gtk/Image.ooc
File renamed without changes.
View
27 gtk/ItemFactory.ooc → source/gtk/ItemFactory.ooc
@@ -3,39 +3,40 @@ import structs/List
import gtk/[Gtk,Type,AccelGroup,Widget]
ItemFactoryEntry: cover from GtkItemFactoryEntry {
-
+
path, accelerator : extern GChar*
- callback: extern Func
+ callback: extern Pointer
callbackAction: extern(callback_action) GUInt
itemType: extern(item_type) GChar*
extraData: extern(extra_data) GPointer
-
- new: static func (.path, .accelerator, .callback, .callbackAction, .itemType) -> This {
+
+ new: static func (.path, .accelerator, callback: Func, .callbackAction, .itemType) -> This {
this : This
this path = path
this accelerator = accelerator
- this callback = callback
+ this callback = callback as Closure thunk
this callbackAction = callbackAction
this itemType = itemType
+ this extraData = callback as Closure context
return this
}
-
+
}
ItemFactory: cover from GtkItemFactory* {
-
- new: static extern(gtk_item_factory_new) func(type: Type,path: GChar*,accel_group: AccelGroup) -> This
-
+
+ new: static extern(gtk_item_factory_new) func(type: Type,path: GChar*,accel_group: AccelGroup) -> This
+
createItems: extern(gtk_item_factory_create_items) func(nEntries: GInt, entries: ItemFactoryEntry*, callbackData: GPointer)
-
+
createItems: func ~arrayList (entries: List<ItemFactoryEntry>, callbackData: GPointer) {
createItems(entries size(), entries toArray(), callbackData)
}
-
+
createItems: func ~arrayListNoCallback (entries: List<ItemFactoryEntry>) {
createItems(entries, null)
}
-
+
getWidget: extern(gtk_item_factory_get_widget) func(widget: GChar*) -> Widget
-
+
}
View
0 gtk/Label.ooc → source/gtk/Label.ooc
File renamed without changes.
View
10 gtk/Progressbar.ooc → source/gtk/ProgressBar.ooc
@@ -1,14 +1,12 @@
use gdk, gtk
import gtk/[Gtk, Widget]
-ProgressbarStruct: cover from GtkProgressBar {
+ProgressBarStruct: cover from GtkProgressBar {
window: extern GdkWindow*
- allocation: extern GtkAllocation
-}
+ allocation: extern GtkAllocation
+}
-ProgressBar: cover from ProgressBarStruct* extends Widget {
-
+ProgressBar: cover from ProgressBarStruct* extends Widget {
new: extern(gtk_progress_bar_new) static func -> Widget
pulse: extern(gtk_progress_bar_pulse) func
-
}
View
0 gtk/Type.ooc → source/gtk/Type.ooc
File renamed without changes.
View
0 gtk/VBox.ooc → source/gtk/VBox.ooc
File renamed without changes.
View
40 gtk/Widget.ooc → source/gtk/Widget.ooc
@@ -4,14 +4,14 @@ import gdk/Drawable
WidgetStruct: cover from GtkWidget {
window: extern GdkWindow*
- allocation: extern GtkAllocation
-}
+ allocation: extern GtkAllocation
+}
/**
* A GTK widget, such as a Button, a Label, a Checkbox
*/
Widget: cover from WidgetStruct* extends _GObject {
-
+
/**
* Set the sensitivity of this widget
* @param sensitive if true, the widget will react to the user
@@ -24,13 +24,13 @@ Widget: cover from WidgetStruct* extends _GObject {
* @see realize
*/
isRealized: extern(GTK_WIDGET_REALIZED) func -> Bool
-
+
/**
* Realize this component on-screen, e.g. allocate resources, etc.
* It's often not needed to call it directly, use show() instead.
*/
realize: extern(gtk_widget_realize) func
-
+
/**
* Sets whether the application intends to draw on the widget in
* an "expose-event" handler.
@@ -43,46 +43,46 @@ Widget: cover from WidgetStruct* extends _GObject {
* widget background.
*/
setAppPaintable: extern(gtk_widget_set_app_paintable) func (Bool)
-
-
+
+
getWindow: extern(gtk_widget_get_window) func -> Drawable
-
- /**
+
+ /*
* Force the repaint of this widget
*/
/*
forceRepaint: func (childrenToo: Bool) {
-
+
while(Gtk eventsPending()) {
Gtk mainIteration()
}
// ugly workaround
gdk_window_invalidate_rect(this@ as WidgetStruct window, null, childrenToo)
gdk_window_process_updates(this@ as WidgetStruct window, childrenToo)
-
+
}
*/
-
+
/**
* Shows this widget on-screen.
*/
show: extern(gtk_widget_show) func
-
+
/**
* Shows this widget on-screen and all its children.
*/
showAll: extern(gtk_widget_show_all) func
-
+
/**
* Hides this widget
*/
hide: extern(gtk_widget_hide) func
-
+
/**
* Destroys this widget
*/
destroy: extern(gtk_widget_destroy) func
-
+
/**
* set the position of this wdiget
* @param x the x coordinate of the desired position for this widget, or
@@ -91,30 +91,30 @@ Widget: cover from WidgetStruct* extends _GObject {
* -1 for default position
*/
setPosition: extern(gtk_widget_set_uposition) func (x, y : GInt)
-
+
/**
* set the size of this widget
* @param width the desired width for this widget, or -1 for the default
* @param height the desired height for this widget, or -1 for the default
*/
setUSize: extern(gtk_widget_set_usize) func (width, height : GInt)
-
+
/**
* The height of this window
*/
getWidth: func -> Int {
// FIXME ugly workaround
return this@ as WidgetStruct allocation width;
}
-
+
/**
* The height of this window
*/
getHeight: func -> Int {
// FIXME ugly workaround
return this@as WidgetStruct allocation height;
}
-
+
/*
getStyle: func -> Style {
return gtk_widget_get_style(this) as Style;
View
0 gtk/Window.ooc → source/gtk/Window.ooc
File renamed without changes.
View
19 source/gtk/_GObject.ooc
@@ -0,0 +1,19 @@
+use gtk
+import gtk/Gtk
+
+_GObjectStruct: cover from GtkObject
+
+/**
+ * The base of the GObject hierarchy. Can send and receive signals
+ */
+_GObject: cover from _GObjectStruct* {
+
+ connect: func ~nodata (signalName: GChar*, callback: Func) -> GULong {
+ gtk_signal_connect(GTK_OBJECT(this), signalName, GTK_SIGNAL_FUNC(callback as Closure thunk), callback as Closure context)
+ }
+
+}
+
+GTK_OBJECT: extern func (_GObject) -> _GObject
+GTK_SIGNAL_FUNC: extern func (Pointer) -> Pointer
+gtk_signal_connect: extern func (_GObject, GChar*, Pointer, GPointer) -> GULong

0 comments on commit d113577

Please sign in to comment.