gwenhywfar
4.6.0beta
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
gui
cocoa
w_vlayout.mm
Go to the documentation of this file.
1
/***************************************************************************
2
begin : August 10 2010
3
copyright : (C) 2010 by Samuel Strupp
4
5
***************************************************************************
6
* Please see toplevel file COPYING for license details *
7
***************************************************************************/
8
9
#import "
CocoaVLayout.h
"
10
11
12
13
static
GWENHYWFAR_CB
14
int
CocoaGui_WVLayout_SetIntProperty
(
GWEN_WIDGET
*w,
15
GWEN_DIALOG_PROPERTY
prop,
16
int
index,
17
int
value,
18
int
doSignal) {
19
CocoaVLayout
*vlayout;
20
21
vlayout=(
CocoaVLayout
*)(
GWEN_Widget_GetImplData
(w,
COCOA_DIALOG_WIDGET_REAL
));
22
assert(vlayout);
23
24
switch
(prop) {
25
case
GWEN_DialogProperty_Enabled
:
26
//gtk_widget_set_sensitive(GTK_WIDGET(g), (value==0)?FALSE:TRUE);
27
return
0;
28
29
case
GWEN_DialogProperty_Focus
:
30
//gtk_widget_grab_focus(GTK_WIDGET(g));
31
return
0;
32
33
default
:
34
break
;
35
}
36
37
DBG_WARN
(
GWEN_LOGDOMAIN
,
38
"Function is not appropriate for this type of widget (%s)"
,
39
GWEN_Widget_Type_toString
(
GWEN_Widget_GetType
(w)));
40
return
GWEN_ERROR_INVALID
;
41
}
42
43
44
45
46
static
GWENHYWFAR_CB
47
int
CocoaGui_WVLayout_GetIntProperty
(
GWEN_WIDGET
*w,
48
GWEN_DIALOG_PROPERTY
prop,
49
int
index,
50
int
defaultValue) {
51
CocoaVLayout
*vlayout;
52
53
vlayout=(
CocoaVLayout
*)(
GWEN_Widget_GetImplData
(w,
COCOA_DIALOG_WIDGET_REAL
));
54
assert(vlayout);
55
56
switch
(prop) {
57
case
GWEN_DialogProperty_Enabled
:
58
//return (gtk_widget_get_sensitive(GTK_WIDGET(g))==TRUE)?1:0;
59
return
1;
60
61
case
GWEN_DialogProperty_Focus
:
62
//return (gtk_widget_has_focus(GTK_WIDGET(g))==TRUE)?1:0;
63
return
0;
64
65
default
:
66
break
;
67
}
68
69
DBG_WARN
(
GWEN_LOGDOMAIN
,
70
"Function is not appropriate for this type of widget (%s)"
,
71
GWEN_Widget_Type_toString
(
GWEN_Widget_GetType
(w)));
72
return
defaultValue;
73
}
74
75
76
77
static
GWENHYWFAR_CB
78
int
CocoaGui_WVLayout_SetCharProperty
(
GWEN_WIDGET
*w,
79
GWEN_DIALOG_PROPERTY
prop,
80
int
index,
81
const
char
*value,
82
int
doSignal) {
83
/*CocoaVLayout *vlayout;
84
85
vlayout=(CocoaVLayout*)(GWEN_Widget_GetImplData(w, COCOA_DIALOG_WIDGET_REAL));
86
assert(vlayout);*/
87
88
DBG_WARN
(
GWEN_LOGDOMAIN
,
89
"Function is not appropriate for this type of widget (%s)"
,
90
GWEN_Widget_Type_toString
(
GWEN_Widget_GetType
(w)));
91
return
GWEN_ERROR_INVALID
;
92
}
93
94
95
96
static
GWENHYWFAR_CB
97
const
char
*
CocoaGui_WVLayout_GetCharProperty
(
GWEN_WIDGET
*w,
98
GWEN_DIALOG_PROPERTY
prop,
99
int
index,
100
const
char
*defaultValue) {
101
/*CocoaVLayout *vlayout;
102
103
vlayout=(CocoaVLayout*)(GWEN_Widget_GetImplData(w, COCOA_DIALOG_WIDGET_REAL));
104
assert(vlayout);*/
105
106
DBG_WARN
(
GWEN_LOGDOMAIN
,
107
"Function is not appropriate for this type of widget (%s)"
,
108
GWEN_Widget_Type_toString
(
GWEN_Widget_GetType
(w)));
109
return
defaultValue;
110
}
111
112
113
114
static
GWENHYWFAR_CB
115
int
CocoaGui_WVLayout_AddChildGuiWidget
(
GWEN_WIDGET
*w,
GWEN_WIDGET
*wChild) {
116
CocoaVLayout
*vlayout;
117
NSView *childView;
118
uint32_t cflags;
119
120
vlayout=(
CocoaVLayout
*)(
GWEN_Widget_GetImplData
(w,
COCOA_DIALOG_WIDGET_REAL
));
121
assert(vlayout);
122
123
childView=(NSView*)(
GWEN_Widget_GetImplData
(wChild,
COCOA_DIALOG_WIDGET_REAL
));
124
assert(childView);
125
126
cflags=
GWEN_Widget_GetFlags
(wChild);
127
128
129
[vlayout
addLayoutSubview
:childView];
130
131
//Noch richtig implementieren
132
/*
133
gtk_box_pack_start(GTK_BOX(g), gChild,
134
(cflags & GWEN_WIDGET_FLAGS_FILLY)?TRUE:FALSE,
135
(cflags & GWEN_WIDGET_FLAGS_FILLY)?TRUE:FALSE,
136
0);*/
137
138
return
0;
139
}
140
141
142
143
int
CocoaGui_WVLayout_Setup
(
GWEN_WIDGET
*w) {
144
/*GtkWidget *g;
145
uint32_t flags;
146
GWEN_WIDGET *wParent;
147
148
flags=GWEN_Widget_GetFlags(w);
149
wParent=GWEN_Widget_Tree_GetParent(w);
150
151
g=gtk_vbox_new((flags & GWEN_WIDGET_FLAGS_EQUAL_HEIGHT)?TRUE:FALSE,
152
GTK2_GUI_DIALOG_DEFAULT_BOX_SPACING);
153
GWEN_Widget_SetImplData(w, GTK2_DIALOG_WIDGET_REAL, (void*) g);
154
GWEN_Widget_SetImplData(w, GTK2_DIALOG_WIDGET_CONTENT, (void*) g);
155
156
GWEN_Widget_SetSetIntPropertyFn(w, Gtk2Gui_WVLayout_SetIntProperty);
157
GWEN_Widget_SetGetIntPropertyFn(w, Gtk2Gui_WVLayout_GetIntProperty);
158
GWEN_Widget_SetSetCharPropertyFn(w, Gtk2Gui_WVLayout_SetCharProperty);
159
GWEN_Widget_SetGetCharPropertyFn(w, Gtk2Gui_WVLayout_GetCharProperty);
160
GWEN_Widget_SetAddChildGuiWidgetFn(w, Gtk2Gui_WVLayout_AddChildGuiWidget);
161
162
if (wParent)
163
GWEN_Widget_AddChildGuiWidget(wParent, w);*/
164
165
CocoaVLayout
*vlayout;
166
uint32_t flags;
167
GWEN_WIDGET
*wParent;
168
169
flags=
GWEN_Widget_GetFlags
(w);
170
wParent=GWEN_Widget_Tree_GetParent(w);
171
172
vlayout = [[[
CocoaVLayout
alloc] initWithFrame:NSMakeRect(10.0, 10.0, 200.0, 200.0)] autorelease];
173
if
(flags &
GWEN_WIDGET_FLAGS_FILLX
) vlayout.
fillX
= YES;
174
if
(flags &
GWEN_WIDGET_FLAGS_FILLY
) vlayout.
fillY
= YES;
175
176
GWEN_Widget_SetImplData
(w,
COCOA_DIALOG_WIDGET_REAL
, (
void
*) vlayout);
177
GWEN_Widget_SetImplData
(w,
COCOA_DIALOG_WIDGET_CONTENT
, (
void
*) vlayout);
178
179
GWEN_Widget_SetSetIntPropertyFn
(w,
CocoaGui_WVLayout_SetIntProperty
);
180
GWEN_Widget_SetGetIntPropertyFn
(w,
CocoaGui_WVLayout_GetIntProperty
);
181
GWEN_Widget_SetSetCharPropertyFn
(w,
CocoaGui_WVLayout_SetCharProperty
);
182
GWEN_Widget_SetGetCharPropertyFn
(w,
CocoaGui_WVLayout_GetCharProperty
);
183
GWEN_Widget_SetAddChildGuiWidgetFn
(w,
CocoaGui_WVLayout_AddChildGuiWidget
);
184
185
if
(wParent)
186
GWEN_Widget_AddChildGuiWidget
(wParent, w);
187
188
return
0;
189
}
190
191
Generated on Wed May 29 2013 05:31:48 for gwenhywfar by
1.8.3.1