gwenhywfar 5.14.1
w_scrollarea.mm
Go to the documentation of this file.
1/***************************************************************************
2 begin : Aug 17 2010
3 copyright : (C) 2010 by Samuel Strupp
4
5 ***************************************************************************
6 * Please see toplevel file COPYING for license details *
7 ***************************************************************************/
8
9
10#import "CocoaScrollBox.h"
11
12
13
14static GWENHYWFAR_CB
17 int index,
18 int value,
19 int doSignal) {
20
21 CocoaScrollBox *scrollView;
22
24 assert(scrollView);
25
26 switch(prop) {
28 return 0;
29
31 return 0;
32
34 NSRect frame = [scrollView frame];
35 frame.size.width = value;
36 [scrollView setFrame:frame];
37 }
38 return 0;
39
41 NSRect frame = [scrollView frame];
42 frame.size.height = value;
43 [scrollView setFrame:frame];
44 }
45 return 0;
46
47 default:
48 break;
49 }
51 "Function is not appropriate for this type of widget (%s)",
53 return GWEN_ERROR_INVALID;
54}
55
56
57
58
59static GWENHYWFAR_CB
62 int index,
63 int defaultValue) {
64 CocoaScrollBox *scrollView;
65
67 assert(scrollView);
68
69 switch(prop) {
71 return 1;
72
74 return 0;
75
77 return [scrollView frame].size.width;
78
80 return [scrollView frame].size.height;
81
82 default:
83 break;
84 }
86 "Function is not appropriate for this type of widget (%s)",
88 return defaultValue;
89}
90
91
92
93static GWENHYWFAR_CB
96 int index,
97 const char *value,
98 int doSignal) {
99 CocoaScrollBox *scrollView;
100
102 assert(scrollView);
103
104
106 "Function is not appropriate for this type of widget (%s)",
108 return GWEN_ERROR_INVALID;
109}
110
111
112
113static GWENHYWFAR_CB
116 int index,
117 const char *defaultValue) {
118 CocoaScrollBox *scrollView;
119
121 assert(scrollView);
122
124 "Function is not appropriate for this type of widget (%s)",
126 return defaultValue;
127}
128
129
130
131static GWENHYWFAR_CB
133
134
135 CocoaScrollBox *scrollView;
136 NSView *childView;
137 uint32_t cflags;
138
140 assert(scrollView);
141
142 childView=(NSView*)(GWEN_Widget_GetImplData(wChild, COCOA_DIALOG_WIDGET_REAL));
143 assert(childView);
144
145 cflags=GWEN_Widget_GetFlags(wChild);
146
147 [scrollView setLayoutedDocumentView:childView];
148
149 return 0;
150}
151
152
153
155 //GtkWidget *g;
156 //GtkWidget *gContent;
157 CocoaScrollBox *scrollView;
158 uint32_t flags;
159 GWEN_WIDGET *wParent;
160
161 flags=GWEN_Widget_GetFlags(w);
162 wParent=GWEN_Widget_Tree_GetParent(w);
163
164 /* create widget */
165 /*g=gtk_scrolled_window_new(NULL, NULL);
166 gContent=gtk_vbox_new(TRUE, GTK2_GUI_DIALOG_DEFAULT_BOX_SPACING);
167 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(g), gContent);*/
168
169 scrollView = [[[CocoaScrollBox alloc] initWithFrame:NSMakeRect(0.0, 0.0, 100.0, 100.0)] autorelease];
170 [scrollView setHasVerticalScroller:YES];
171 [scrollView setHasHorizontalScroller:YES];
172 [scrollView setAutohidesScrollers:NO];
173 if (flags & GWEN_WIDGET_FLAGS_FILLX) scrollView.fillX = YES;
174 if (flags & GWEN_WIDGET_FLAGS_FILLY) scrollView.fillY = YES;
175
178
184
185 if (wParent)
187
188 return 0;
189}
190
191
#define COCOA_DIALOG_WIDGET_REAL
#define COCOA_DIALOG_WIDGET_CONTENT
#define DBG_WARN(dbg_logger, format,...)
Definition debug.h:125
#define GWEN_WIDGET_FLAGS_FILLY
Definition dialog.h:62
#define GWEN_WIDGET_FLAGS_FILLX
Definition dialog.h:61
GWEN_DIALOG_PROPERTY
Definition dialog.h:260
@ GWEN_DialogProperty_Height
Definition dialog.h:273
@ GWEN_DialogProperty_Enabled
Definition dialog.h:267
@ GWEN_DialogProperty_Focus
Definition dialog.h:276
@ GWEN_DialogProperty_Width
Definition dialog.h:272
#define GWEN_ERROR_INVALID
Definition error.h:67
#define GWENHYWFAR_CB
#define GWEN_LOGDOMAIN
Definition logger.h:32
int CocoaGui_WScrollArea_Setup(GWEN_WIDGET *w)
static GWENHYWFAR_CB int CocoaGui_WScrollArea_SetIntProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, int value, int doSignal)
static GWENHYWFAR_CB int CocoaGui_WScrollArea_GetIntProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, int defaultValue)
static GWENHYWFAR_CB int CocoaGui_WScrollArea_SetCharProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, const char *value, int doSignal)
static GWENHYWFAR_CB int CocoaGui_WScrollArea_AddChildGuiWidget(GWEN_WIDGET *w, GWEN_WIDGET *wChild)
static GWENHYWFAR_CB const char * CocoaGui_WScrollArea_GetCharProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, const char *defaultValue)
GWEN_WIDGET_GETCHARPROPERTY_FN GWEN_Widget_SetGetCharPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_GETCHARPROPERTY_FN fn)
Definition widget.c:740
GWEN_WIDGET_GETINTPROPERTY_FN GWEN_Widget_SetGetIntPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_GETINTPROPERTY_FN fn)
Definition widget.c:710
GWEN_WIDGET_ADDCHILDGUIWIDGET_FN GWEN_Widget_SetAddChildGuiWidgetFn(GWEN_WIDGET *w, GWEN_WIDGET_ADDCHILDGUIWIDGET_FN fn)
Definition widget.c:755
int GWEN_Widget_AddChildGuiWidget(GWEN_WIDGET *w, GWEN_WIDGET *wChild)
Definition widget.c:836
void GWEN_Widget_SetImplData(GWEN_WIDGET *w, int index, void *ptr)
Store a pointer with the widget.
Definition widget.c:136
void * GWEN_Widget_GetImplData(const GWEN_WIDGET *w, int index)
Definition widget.c:122
GWEN_WIDGET_SETINTPROPERTY_FN GWEN_Widget_SetSetIntPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_SETINTPROPERTY_FN fn)
Definition widget.c:695
uint32_t GWEN_Widget_GetFlags(const GWEN_WIDGET *w)
Definition widget.c:149
const char * GWEN_Widget_Type_toString(GWEN_WIDGET_TYPE t)
Definition widget.c:456
GWEN_WIDGET_TYPE GWEN_Widget_GetType(const GWEN_WIDGET *w)
Definition widget.c:185
GWEN_WIDGET_SETCHARPROPERTY_FN GWEN_Widget_SetSetCharPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_SETCHARPROPERTY_FN fn)
Definition widget.c:725
struct GWEN_WIDGET GWEN_WIDGET
Definition widget_be.h:34