gwenhywfar  4.8.0beta
w_tabbook.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 
10 #import "CocoaTabView.h"
11 
12 
13 static GWENHYWFAR_CB
16  int index,
17  int value,
18  int doSignal) {
19  CocoaTabView *tabView;
20 
22  assert(tabView);
23 
24  switch(prop) {
26  return 0;
27 
29  return 0;
30 
32  if (value >= 0 && value < [tabView numberOfTabViewItems]) {
33  [tabView selectTabViewItemAtIndex:value];
34  }
35  return 0;
36 
37  default:
38  break;
39  }
40 
42  "Function is not appropriate for this type of widget (%s)",
44  return GWEN_ERROR_INVALID;
45 }
46 
47 
48 
49 
50 static GWENHYWFAR_CB
53  int index,
54  int defaultValue) {
55  CocoaTabView *tabView;
56 
58  assert(tabView);
59 
60  switch(prop) {
62  return 1;
63 
65  return 0;
66 
68  return [tabView indexOfTabViewItem:[tabView selectedTabViewItem]];
69 
70  default:
71  break;
72  }
73 
75  "Function is not appropriate for this type of widget (%s)",
77  return defaultValue;
78 }
79 
80 
81 
82 static GWENHYWFAR_CB
85  int index,
86  const char *value,
87  int doSignal) {
88  CocoaTabView *tabView;
89 
91  assert(tabView);
92 
94  "Function is not appropriate for this type of widget (%s)",
96  return GWEN_ERROR_INVALID;
97 }
98 
99 
100 
101 static GWENHYWFAR_CB
104  int index,
105  const char *defaultValue) {
106  CocoaTabView *tabView;
107 
109  assert(tabView);
110 
112  "Function is not appropriate for this type of widget (%s)",
114  return defaultValue;
115 }
116 
117 
118 
119 static GWENHYWFAR_CB
121  CocoaTabView *tabView;
122  const char *s;
123 
124 
126  assert(tabView);
127 
128  NSView *subview =(NSView*)(GWEN_Widget_GetImplData(wChild, COCOA_DIALOG_WIDGET_REAL));
129  assert(subview);
130 
131  s=GWEN_Widget_GetText(wChild, 0);
132 
133 
134  NSTabViewItem *item = [[NSTabViewItem alloc] init];
135 
136  if (s && *s) {
137  NSString *title = [[NSString alloc] initWithCString:s encoding:NSUTF8StringEncoding];
138  [item setLabel:title];
139  [title release];
140  }
141 
142  [item setView:subview];
143 
144  [tabView addTabViewItem:item];
145  [item release];
146 
147 
148  return 0;
149 }
150 
151 
152 
154  CocoaTabView *tabView;
155  uint32_t flags;
156  GWEN_WIDGET *wParent;
157 
158  flags=GWEN_Widget_GetFlags(w);
159  wParent=GWEN_Widget_Tree_GetParent(w);
160 
161  tabView=[[[CocoaTabView alloc] initWithFrame:NSMakeRect(10.0, 10.0, 100.0, 22.0)] autorelease];
162  if (flags & GWEN_WIDGET_FLAGS_FILLX) tabView.fillX = YES;
163  if (flags & GWEN_WIDGET_FLAGS_FILLY) tabView.fillY = YES;
164 
167 
173 
174  if (wParent)
175  GWEN_Widget_AddChildGuiWidget(wParent, w);
176 
177  return 0;
178 }
179 
180