gwenhywfar  5.10.1
w_groupbox.mm
Go to the documentation of this file.
1 /***************************************************************************
2  begin : August 16 2010
3  copyright : (C) 2010 by Samuel Strupp
4 
5  ***************************************************************************
6  * Please see toplevel file COPYING for license details *
7  ***************************************************************************/
8 
9 
11 #import "CocoaGroupBox.h"
12 
13 
14 static GWENHYWFAR_CB
17  int index,
18  int value,
19  int doSignal) {
20  CocoaGroupBox *box;
21 
23  assert(box);
24 
25  switch(prop) {
27  return 0;
28 
30  return 0;
31 
33  NSRect frame = [box frame];
34  frame.size.width = value;
35  [box setFrame:frame];
36  }
37  return 0;
38 
40  NSRect frame = [box frame];
41  frame.size.height = value;
42  [box setFrame:frame];
43  }
44  return 0;
45 
46  default:
47  break;
48  }
49 
51  "Function is not appropriate for this type of widget (%s)",
53  return GWEN_ERROR_INVALID;
54 }
55 
56 
57 
58 
59 static GWENHYWFAR_CB
62  int index,
63  int defaultValue) {
64  CocoaGroupBox *box;
65 
67  assert(box);
68 
69  switch(prop) {
71  //return (gtk_widget_get_sensitive(GTK_WIDGET(g))==TRUE)?1:0;
72  return 1;
73 
75  //return (gtk_widget_has_focus(GTK_WIDGET(g))==TRUE)?1:0;
76  return 0;
77 
79  return [box frame].size.width;
80 
82  return [box frame].size.height;
83 
84  default:
85  break;
86  }
87 
89  "Function is not appropriate for this type of widget (%s)",
91  return defaultValue;
92 }
93 
94 
95 
96 static GWENHYWFAR_CB
99  int index,
100  const char *value,
101  int doSignal) {
102  CocoaGroupBox *box;
103 
105  assert(box);
106 
107  switch(prop) {
109  NSString *stringValue = [[NSString alloc] initWithCString:value encoding:NSUTF8StringEncoding];
110  [box setTitle:stringValue];
111  [stringValue release];
112  }
113  return 0;
114  default:
115  break;
116  }
117 
119  "Function is not appropriate for this type of widget (%s)",
121  return GWEN_ERROR_INVALID;
122 }
123 
124 
125 
126 static GWENHYWFAR_CB
129  int index,
130  const char *defaultValue) {
131  CocoaGroupBox *box;
132 
134  assert(box);
135 
136  switch(prop) {
138  return [[box title] cStringUsingEncoding:NSUTF8StringEncoding];
139  default:
140  break;
141  }
142 
144  "Function is not appropriate for this type of widget (%s)",
146  return defaultValue;
147 }
148 
149 
150 
151 static GWENHYWFAR_CB
153  CocoaGroupBox *box;
154  //GtkWidget *gChild;
155  //uint32_t cflags;
156 
158  assert(box);
159 
160  NSView *subview = (NSView*)(GWEN_Widget_GetImplData(wChild, COCOA_DIALOG_WIDGET_REAL));
161  assert(subview);
162 
163  [(CocoaWindowContentView*)[box contentView] addLayoutSubview:subview];
164 
165  //cflags=GWEN_Widget_GetFlags(wChild);
166 
167  /*gtk_box_pack_start(GTK_BOX(g), gChild,
168  (cflags & GWEN_WIDGET_FLAGS_FILLY)?TRUE:FALSE,
169  (cflags & GWEN_WIDGET_FLAGS_FILLY)?TRUE:FALSE,
170  0);*/
171 
172  return 0;
173 }
174 
175 
176 
178  CocoaGroupBox *box;
179  const char *s;
180  uint32_t flags;
181  GWEN_WIDGET *wParent;
182 
183  flags=GWEN_Widget_GetFlags(w);
184  wParent=GWEN_Widget_Tree_GetParent(w);
185  s=GWEN_Widget_GetText(w, 0);
186 
187 
188  box = [[[CocoaGroupBox alloc] initWithFrame:NSMakeRect(10.0, 10.0, 100.0, 22.0)] autorelease];
189  if (flags & GWEN_WIDGET_FLAGS_FILLX) box.fillX = YES;
190  if (flags & GWEN_WIDGET_FLAGS_FILLY) box.fillY = YES;
191 
192  CocoaWindowContentView *newContentView = [[CocoaWindowContentView alloc] initWithFrame:[[box contentView] frame]];
193  [newContentView setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
194  [box setContentView:newContentView];
195  [newContentView release];
196 
197  if (s && *s) {
198  NSString *title = [[NSString alloc] initWithCString:s encoding:NSUTF8StringEncoding];
199  [box setTitle:title];
200  [title release];
201  }
202 
205 
211 
212  if (wParent)
213  GWEN_Widget_AddChildGuiWidget(wParent, w);
214 
215  return 0;
216 }
217 
218 
GWEN_WIDGET_TYPE GWEN_Widget_GetType(const GWEN_WIDGET *w)
Definition: widget.c:185
#define COCOA_DIALOG_WIDGET_REAL
#define GWEN_ERROR_INVALID
Definition: error.h:67
GWEN_WIDGET_SETCHARPROPERTY_FN GWEN_Widget_SetSetCharPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_SETCHARPROPERTY_FN fn)
Definition: widget.c:717
GWEN_WIDGET_GETCHARPROPERTY_FN GWEN_Widget_SetGetCharPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_GETCHARPROPERTY_FN fn)
Definition: widget.c:732
static GWENHYWFAR_CB int CocoaGui_WGroupBox_SetIntProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, int value, int doSignal)
Definition: w_groupbox.mm:15
GWEN_DIALOG_PROPERTY
Definition: dialog.h:260
static GWENHYWFAR_CB int CocoaGui_WGroupBox_AddChildGuiWidget(GWEN_WIDGET *w, GWEN_WIDGET *wChild)
Definition: w_groupbox.mm:152
uint32_t GWEN_Widget_GetFlags(const GWEN_WIDGET *w)
Definition: widget.c:149
#define DBG_WARN(dbg_logger, format, args...)
Definition: debug.h:125
static GWENHYWFAR_CB int CocoaGui_WGroupBox_GetIntProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, int defaultValue)
Definition: w_groupbox.mm:60
#define GWEN_LOGDOMAIN
Definition: logger.h:35
void GWEN_Widget_SetImplData(GWEN_WIDGET *w, int index, void *ptr)
Store a pointer with the widget.
Definition: widget.c:136
GWEN_WIDGET_GETINTPROPERTY_FN GWEN_Widget_SetGetIntPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_GETINTPROPERTY_FN fn)
Definition: widget.c:702
void * GWEN_Widget_GetImplData(const GWEN_WIDGET *w, int index)
Definition: widget.c:122
#define GWENHYWFAR_CB
Definition: gwenhywfarapi.h:89
GWEN_WIDGET_ADDCHILDGUIWIDGET_FN GWEN_Widget_SetAddChildGuiWidgetFn(GWEN_WIDGET *w, GWEN_WIDGET_ADDCHILDGUIWIDGET_FN fn)
Definition: widget.c:747
GWEN_WIDGET_SETINTPROPERTY_FN GWEN_Widget_SetSetIntPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_SETINTPROPERTY_FN fn)
Definition: widget.c:687
#define COCOA_DIALOG_WIDGET_CONTENT
struct GWEN_WIDGET GWEN_WIDGET
Definition: widget_be.h:34
int GWEN_Widget_AddChildGuiWidget(GWEN_WIDGET *w, GWEN_WIDGET *wChild)
Definition: widget.c:828
#define GWEN_WIDGET_FLAGS_FILLY
Definition: dialog.h:62
static GWENHYWFAR_CB int CocoaGui_WGroupBox_SetCharProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, const char *value, int doSignal)
Definition: w_groupbox.mm:97
#define GWEN_WIDGET_FLAGS_FILLX
Definition: dialog.h:61
int CocoaGui_WGroupBox_Setup(GWEN_WIDGET *w)
Definition: w_groupbox.mm:177
static GWENHYWFAR_CB const char * CocoaGui_WGroupBox_GetCharProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, const char *defaultValue)
Definition: w_groupbox.mm:127
const char * GWEN_Widget_Type_toString(GWEN_WIDGET_TYPE t)
Definition: widget.c:452
const char * GWEN_Widget_GetText(const GWEN_WIDGET *w, int idx)
Definition: widget.c:293