gwenhywfar  4.3.3
w_stack.mm
Go to the documentation of this file.
1 /***************************************************************************
2  begin : August 19 2010
3  copyright : (C) 2010 by Samuel Strupp
4 
5  ***************************************************************************
6  * Please see toplevel file COPYING for license details *
7  ***************************************************************************/
8 
9 
10 
11 /*
12  * Note: This is a special use case for gtk_notebook.
13  * To use it as a WidgetStack we have to disable drawing od tabs
14  * and borders by calling:
15  * - gtk_notebook_set_show_tabs(GTK_NOTEBOOK(g), FALSE);
16  * - gtk_notebook_set_show_border(GTK_NOTEBOOK(g), FALSE);
17  *
18  */
19 
20 
21 
22 static GWENHYWFAR_CB
25  int index,
26  int value,
27  int doSignal) {
28  CocoaTabView *stackView;
29 
31  assert(stackView);
32 
33  switch(prop) {
35  return 0;
36 
38  return 0;
39 
41  NSRect frame = [stackView frame];
42  frame.size.width = value;
43  [stackView setFrame:frame];
44  }
45  return 0;
46 
48  NSRect frame = [stackView frame];
49  frame.size.height = value;
50  [stackView setFrame:frame];
51  }
52  return 0;
53 
55  if (value >= 0 && value < [stackView numberOfTabViewItems]) {
56  [stackView selectTabViewItemAtIndex:value];
57  }
58  return 0;
59 
60  default:
61  break;
62  }
63 
65  "Function is not appropriate for this type of widget (%s)",
67  return GWEN_ERROR_INVALID;
68 }
69 
70 
71 
72 
73 static GWENHYWFAR_CB
76  int index,
77  int defaultValue) {
78  CocoaTabView *stackView;
79 
81  assert(stackView);
82 
83  switch(prop) {
85  return 1;
86 
88  return 0;
89 
91  return [stackView frame].size.width;
92 
94  return [stackView frame].size.height;
95 
97  return [stackView indexOfTabViewItem:[stackView selectedTabViewItem]];
98 
99  default:
100  break;
101  }
102 
104  "Function is not appropriate for this type of widget (%s)",
106  return defaultValue;
107 }
108 
109 
110 
111 static GWENHYWFAR_CB
114  int index,
115  const char *value,
116  int doSignal) {
117  CocoaTabView *stackView;
118 
120  assert(stackView);
121 
123  "Function is not appropriate for this type of widget (%s)",
125  return GWEN_ERROR_INVALID;
126 }
127 
128 
129 
130 static GWENHYWFAR_CB
133  int index,
134  const char *defaultValue) {
135  CocoaTabView *stackView;
136 
138  assert(stackView);
139 
141  "Function is not appropriate for this type of widget (%s)",
143  return defaultValue;
144 }
145 
146 
147 
148 static GWENHYWFAR_CB
150  CocoaTabView *stackView;
151 
153  assert(stackView);
154 
155  NSView *subview =(NSView*)(GWEN_Widget_GetImplData(wChild, COCOA_DIALOG_WIDGET_REAL));
156  assert(subview);
157 
158  NSTabViewItem *item = [[NSTabViewItem alloc] init];
159 
160  [item setView:subview];
161 
162  [stackView addTabViewItem:item];
163  [item release];
164 
165  return 0;
166 }
167 
168 
169 
171  CocoaTabView *stackView;
172  uint32_t flags;
173  GWEN_WIDGET *wParent;
174 
175  flags=GWEN_Widget_GetFlags(w);
176  wParent=GWEN_Widget_Tree_GetParent(w);
177 
178  stackView = [[[CocoaTabView alloc] initWithFrame:NSMakeRect(0.0, 0.0, 100.0, 100.0)] autorelease];
179  [stackView setTabViewType:NSNoTabsNoBorder];
180  if (flags & GWEN_WIDGET_FLAGS_FILLX) stackView.fillX = YES;
181  if (flags & GWEN_WIDGET_FLAGS_FILLY) stackView.fillY = YES;
182 
183 
184  GWEN_Widget_SetImplData(w, COCOA_DIALOG_WIDGET_REAL, (void*) stackView);
186 
192 
193  if (wParent)
194  GWEN_Widget_AddChildGuiWidget(wParent, w);
195 
196  return 0;
197 }
198 
199