Overview
Context
Changes
Added Makefile version [cbf87b91d8].
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
PREFIX ?= /usr/local
all:
@objfw-compile -Wall -g --lib 0.0 -o objgui \
`pkg-config --cflags --libs gtk+-3.0` \
`ls *.m | fgrep -v test.m`
test:
@objfw-compile -Wall -g -o test \
`pkg-config --cflags --libs gtk+-3.0` \
*.m
install:
mkdir -p ${PREFIX}/include/ObjGUI
cp *.h ${PREFIX}/include/ObjGUI/
cp libobjgui.so ${PREFIX}/lib/libobjgui.so.0.0
ln -sf libobjgui.so.0.0 ${PREFIX}/lib/libobjgui.so.0
ln -sf libobjgui.so.0 ${PREFIX}/lib/libobjgui.so
clean:
rm -f test *.so *.o *~
|
| | | | | | | | | | | | | | | | | | | |
Added OGApplication.h version [ac83513858].
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
#include <gtk/gtk.h>
#import <ObjFW/ObjFW.h>
@protocol OGApplicationDelegate <OFObject>
- (void)applicationDidFinishLaunching;
@optional
- (void)applicationWillTerminate;
@end
@interface OGApplication: OFObject <OFApplicationDelegate>
{
id <OFApplicationDelegate> delegate;
}
+ (void)quit;
@end
#define OG_APPLICATION_DELEGATE(cls) \
Class \
og_application_delegate() { \
return [cls class]; \
}
|
| | | | | | | | | | | | | | | | | | | | | |
Added OGApplication.m version [3fc1de7962].
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
#import "OGApplication.h"
OF_APPLICATION_DELEGATE(OGApplication)
extern Class og_application_delegate(void);
@implementation OGApplication
+ (void)quit
{
gtk_main_quit();
}
- (void)applicationDidFinishLaunching
{
OFAutoreleasePool *pool;
int *argc;
char ***argv;
delegate = [[og_application_delegate() alloc] init];
[[OFApplication sharedApplication] getArgumentCount: &argc
andArgumentValues: &argv];
gtk_init(argc, argv);
pool = [OFAutoreleasePool new];
[delegate applicationDidFinishLaunching];
[pool release];
gtk_main();
}
- (void)applicationWillTerminate
{
[delegate applicationWillTerminate];
}
@end
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Added OGBox.h version [8a7b04865c].
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
#import "OGWidget.h"
@interface OGBox: OGWidget
+ box;
- (void)appendChild: (OGWidget*)child
expand: (BOOL)expand
fill: (BOOL)fill
padding: (float)padding;
- (void)prependChild: (OGWidget*)child
expand: (BOOL)expand
fill: (BOOL)fill
padding: (float)padding;
@end
|
| | | | | | | | | | | | |
Added OGBox.m version [1c275431c8].
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
#import "OGBox.h"
@implementation OGBox
+ box
{
return [[[self alloc] init] autorelease];
}
- init
{
self = [super init];
@try {
if (isa == [OGBox class])
@throw [OFNotImplementedException
exceptionWithClass: isa
selector: _cmd];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- (void)appendChild: (OGWidget*)child
expand: (BOOL)expand
fill: (BOOL)fill
padding: (float)padding
{
gtk_box_pack_start(GTK_BOX(widget), child->widget, expand, fill,
padding);
}
- (void)prependChild: (OGWidget*)child
expand: (BOOL)expand
fill: (BOOL)fill
padding: (float)padding
{
gtk_box_pack_end(GTK_BOX(widget), child->widget, expand, fill, padding);
}
@end
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Added OGButton.h version [719e887149].
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
#import "OGWidget.h"
@class OGButton;
@protocol OGButtonDelegate <OFObject>
@optional
- (void)buttonWasClicked: (OGButton*)button;
@end
@interface OGButton: OGWidget
{
id <OGButtonDelegate> delegate;
}
@property (assign) id <OGButtonDelegate> delegate;
@property (copy) OFString *label;
+ button;
@end
|
| | | | | | | | | | | | | | | | | |
Added OGButton.m version [61e8a6d13f].
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
#import "OGButton.h"
@interface OGButton ()
- (void)OG_clicked;
@end
static void
clicked(GtkWidget *widget, gpointer data)
{
[(OGButton*)data OG_clicked];
}
@implementation OGButton
@synthesize delegate;
+ button
{
return [[[self alloc] init] autorelease];
}
- init
{
self = [super init];
widget = gtk_button_new();
g_signal_connect(G_OBJECT(widget), "clicked", G_CALLBACK(clicked),
self);
g_signal_connect(G_OBJECT(widget), "destroy", G_CALLBACK(og_destroy),
self);
[self retain];
return self;
}
- (OFString*)label
{
return [OFString stringWithUTF8String:
gtk_button_get_label(GTK_BUTTON(widget))];
}
- (void)setLabel: (OFString*)label
{
gtk_button_set_label(GTK_BUTTON(widget), [label UTF8String]);
}
- (void)OG_clicked
{
OFAutoreleasePool *pool = [OFAutoreleasePool new];
if ([delegate respondsToSelector: @selector(buttonWasClicked:)])
[delegate buttonWasClicked: self];
[pool release];
}
@end
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Added OGHBox.h version [c930914b09].
|
1
2
3
4
|
+
+
+
+
|
#import "OGBox.h"
@interface OGHBox: OGBox
@end
|
| | |
Added OGHBox.m version [f83c2e998a].
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
#import "OGHBox.h"
@implementation OGHBox
- init
{
self = [super init];
widget = gtk_hbox_new(FALSE, 0);
g_signal_connect(G_OBJECT(widget), "destroy", G_CALLBACK(og_destroy),
self);
[self retain];
return self;
}
@end
|
| | | | | | | | | | | | | | |
Added OGVBox.h version [7d3b22a99a].
|
1
2
3
4
|
+
+
+
+
|
#import "OGBox.h"
@interface OGVBox: OGBox
@end
|
| | |
Added OGVBox.m version [ff76a184fe].
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
#import "OGVBox.h"
@implementation OGVBox
- init
{
self = [super init];
widget = gtk_vbox_new(FALSE, 0);
g_signal_connect(G_OBJECT(widget), "destroy", G_CALLBACK(og_destroy),
self);
[self retain];
return self;
}
@end
|
| | | | | | | | | | | | | | |
Added OGWidget.h version [fab0087c15].
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
#include <gtk/gtk.h>
#import <ObjFW/ObjFW.h>
@interface OGWidget: OFObject
{
@public
GtkWidget *widget;
}
- (void)show;
- (void)hide;
@end
extern void og_destroy(GtkWidget*, OGWidget*);
|
| | | | | | | | | | | | | |
Added OGWidget.m version [33691ef540].
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
#include "OGWidget.h"
void og_destroy(GtkWidget *widget, OGWidget *object)
{
[object release];
}
@implementation OGWidget
- init
{
self = [super init];
@try {
if (isa == [OGWidget class])
@throw [OFNotImplementedException
exceptionWithClass: isa
selector: @selector(init)];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- (void)show
{
gtk_widget_show_all(widget);
}
- (void)hide
{
gtk_widget_hide(widget);
}
@end
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Added OGWindow.h version [df45c3fe07].
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
#import "OGWidget.h"
@class OGWindow;
@protocol OGWindowDelegate <OFObject>
@optional
- (BOOL)windowWillClose: (OGWindow*)window;
@end
@interface OGWindow: OGWidget
{
id <OGWindowDelegate> delegate;
}
@property (assign) id <OGWindowDelegate> delegate;
@property (copy) OFString *title;
@property (assign) of_point_t position;
@property (assign) of_dimension_t dimension;
+ window;
- (void)addChild: (OGWidget*)widget;
@end
|
| | | | | | | | | | | | | | | | | | | | |
Added OGWindow.m version [787f92d7be].