gwenhywfar  4.7.0beta
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