gwenhywfar  5.10.1
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 
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
GWEN_DIALOG_PROPERTY
Definition: dialog.h:260
int CocoaGui_WTabBook_Setup(GWEN_WIDGET *w)
Definition: w_tabbook.mm:153
uint32_t GWEN_Widget_GetFlags(const GWEN_WIDGET *w)
Definition: widget.c:149
#define DBG_WARN(dbg_logger, format, args...)
Definition: debug.h:125
#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
static GWENHYWFAR_CB int CocoaGui_WTabBook_AddChildGuiWidget(GWEN_WIDGET *w, GWEN_WIDGET *wChild)
Definition: w_tabbook.mm:120
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
static GWENHYWFAR_CB int CocoaGui_WTabBook_SetIntProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, int value, int doSignal)
Definition: w_tabbook.mm:14
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
#define GWEN_WIDGET_FLAGS_FILLX
Definition: dialog.h:61
static GWENHYWFAR_CB int CocoaGui_WTabBook_SetCharProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, const char *value, int doSignal)
Definition: w_tabbook.mm:83
static GWENHYWFAR_CB const char * CocoaGui_WTabBook_GetCharProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, const char *defaultValue)
Definition: w_tabbook.mm:102
static GWENHYWFAR_CB int CocoaGui_WTabBook_GetIntProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, int defaultValue)
Definition: w_tabbook.mm:51
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