gwenhywfar  4.8.0beta
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 
14 static 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 
59 static 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 
93 static 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 
113 static 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 
131 static 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 
176  GWEN_Widget_SetImplData(w, COCOA_DIALOG_WIDGET_REAL, (void*) scrollView);
178 
184 
185  if (wParent)
186  GWEN_Widget_AddChildGuiWidget(wParent, w);
187 
188  return 0;
189 }
190 
191