ObjGUI  Check-in [5e7f2ca83f]

Overview
Comment:Remove useless whitespaces.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 5e7f2ca83fd02f44a41ec65a6bab88099b45782128ceda929d0c82c1a6f7b95d
User & Date: js on 2012-01-05 15:42:11
Other Links: manifest | tags
Context
2012-01-07
04:05
Fixed type name in OGBox.h check-in: 78911a1cfe user: dillonaumiller@gmail.com tags: trunk
2012-01-05
15:42
Remove useless whitespaces. check-in: 5e7f2ca83f user: js tags: trunk
15:38
Change wrong OF prefix to OG. check-in: 8bf49d5900 user: js tags: trunk
Changes

Modified win32/OGApplication.m from [4a3c603165] to [3f6241711e].

15
16
17
18
19
20
21
22

23
24
25
26
27
28
29
15
16
17
18
19
20
21

22
23
24
25
26
27
28
29







-
+







 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
 

//==================================================================================================================================
// OGApplication.m
//==================================================================================================================================
#import <ObjFW/OFApplication.h> //this seems to be needed for "OF_APPLICATION_DELEGATE"
#import "OGWidget.h"
#import "OGApplication.h"
//==================================================================================================================================
85
86
87
88
89
90
91
92

93
94
95
96
97
98
99
85
86
87
88
89
90
91

92
93
94
95
96
97
98
99







-
+







  wcx.hInstance     = hInst;
  wcx.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
  wcx.hCursor       = LoadCursor(NULL, IDC_ARROW);
  wcx.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
  wcx.lpszMenuName  = NULL;
  wcx.lpszClassName = clsName;
  wcx.hIconSm       = NULL;
  

  RegisterClassEx(&wcx);
  //TODO: although this doesn't ever really fail, we should probably Throw an Exception here...
  //if(!RegisterClassEx(&wcx)) @throw ...;
}
//==================================================================================================================================
void win32_main()
{
109
110
111
112
113
114
115
116

117
118
119
109
110
111
112
113
114
115

116
117
118
119







-
+



    }
  }
}
//==================================================================================================================================
LRESULT CALLBACK win32_OGWndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
  void *ptr = (void *)GetWindowLong(hwnd, GWL_USERDATA);
  if(ptr == NULL) return DefWindowProc(hwnd, msg, wparam, lparam); 
  if(ptr == NULL) return DefWindowProc(hwnd, msg, wparam, lparam);
  return [(id)ptr MessageReceived : hwnd : msg : wparam : lparam];
}
//==================================================================================================================================

Modified win32/OGBox.m from [8a087b8b0e] to [892e0ea3ea].

16
17
18
19
20
21
22
23

24
25
26
27
28
29
30
16
17
18
19
20
21
22

23
24
25
26
27
28
29
30







-
+







 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
 

//==================================================================================================================================
// OGBox.m
//==================================================================================================================================
#include <malloc.h>
#include <windows.h>

#import <ObjFW/OFNotImplementedException.h>
77
78
79
80
81
82
83
84

85
86
87
88
89
90
91
92
93
94
95
96
97
77
78
79
80
81
82
83

84
85
86
87
88
89
90
91
92
93
94
95
96
97







-
+













  @throw [OFNotImplementedException exceptionWithClass: isa
                                              selector: _cmd];
}
//----------------------------------------------------------------------------------------------------------------------------------
- (int)MessageReceived : (HWND)hwnd : (UINT)msg : (WPARAM)wparam : (LPARAM)lparam
{
  HWND parent;
  

  switch(msg)
  {
    case WM_COMMAND:
      parent = GetParent(hwnd);
      if(parent != NULL)
        return SendMessage(parent, msg, wparam, lparam);
    break;
  }
  return DefWindowProc(hwnd, msg, wparam, lparam);
}
//----------------------------------------------------------------------------------------------------------------------------------
@end
//==================================================================================================================================

Modified win32/OGButton.m from [d076240d64] to [acf4c10e2b].

15
16
17
18
19
20
21
22

23
24
25
26
27
28
29
15
16
17
18
19
20
21

22
23
24
25
26
27
28
29







-
+







 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
 

//==================================================================================================================================
// OGButton.m
//==================================================================================================================================
#define BCM_GETIDEALSIZE 0x1601
#import "OGButton.h"
//==================================================================================================================================
@interface OGButton ()
50
51
52
53
54
55
56
57

58
59
60
61
62
63
64
65
66

67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85

86
87
88
89
90
91
92
50
51
52
53
54
55
56

57
58
59
60
61
62
63
64
65

66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84

85
86
87
88
89
90
91
92







-
+








-
+


















-
+







{
  return [[[self alloc] init] autorelease];
}
//----------------------------------------------------------------------------------------------------------------------------------
- init
{
  self = [super init];
  

  //we're specifying a different class name...
  //so we'll have to discard the default OGWidget HWND...
  DestroyWindow(widget);
  //and create a new one
  widget = NULL;
  HINSTANCE hInst = (HINSTANCE)GetModuleHandle(NULL);
  widget = CreateWindow("button", "", BS_PUSHBUTTON,
                          CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
                          NULL, NULL, hInst, NULL);  
                          NULL, NULL, hInst, NULL);
  SetWindowLong(widget, GWL_STYLE, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP);
  //crazy workaround since we don't have control of our WNDPROC for default "button"s
  CommandHandlerData *chd = (CommandHandlerData *)malloc(sizeof(CommandHandlerData));
  chd->funct  = CH_Command;
  chd->object = self;
  //and another workaround because "button" class seems to mess with our GWL_USERDATA storage...
  //SetWindowLong(widget, GWL_USERDATA, (UINT)(chd));
  SetProp(widget, "CommandHandlerData", chd);

  [self retain];
  return self;
}
//----------------------------------------------------------------------------------------------------------------------------------
- (OFString*)label
{
  int tlen = GetWindowTextLength(widget);
  char *buff = (char *)malloc(tlen + 1);
  GetWindowText(widget, buff, tlen+1);
  

  OFString *ret = [OFString stringWithUTF8String : buff];
  free(buff);
  return ret;
}
//----------------------------------------------------------------------------------------------------------------------------------
- (void)setLabel: (OFString*)label
{

Modified win32/OGComboBox.m from [3b3750f8b8] to [2d3c063bd9].

57
58
59
60
61
62
63
64

65
66
67
68
69
70

71
72
73
74
75
76
77
78
79
80
81
82
83
84
85

86
87
88
89
90

91
92
93
94
95
96
97
57
58
59
60
61
62
63

64
65
66
67
68
69

70
71
72
73
74
75
76
77
78
79
80
81
82
83
84

85
86
87
88
89

90
91
92
93
94
95
96
97







-
+





-
+














-
+




-
+








  //see [OGButton init] for reasoning here...
  DestroyWindow(widget);
  widget = NULL;
  HINSTANCE hInst = (HINSTANCE)GetModuleHandle(NULL);
  widget = CreateWindow("LISTBOX", "", LBS_NOINTEGRALHEIGHT,
                          0, 0, 32, 32,
                          NULL, NULL, hInst, NULL);  
                          NULL, NULL, hInst, NULL);
  SetWindowLong(widget, GWL_STYLE, LBS_NOINTEGRALHEIGHT | LBS_NOTIFY | WS_CHILD | WS_VISIBLE | WS_TABSTOP);
  CommandHandlerData *chd = (CommandHandlerData *)malloc(sizeof(CommandHandlerData));
  chd->funct  = CH_Command;
  chd->object = self;
  SetProp(widget, "CommandHandlerData", chd);
      

  [self retain];
  return self;
}
//----------------------------------------------------------------------------------------------------------------------------------
- initWithParent : (OGWidget *)parent
{
  self = [super init];

  //see [OGButton init] for reasoning here...
  DestroyWindow(widget);
  widget = NULL;
  HINSTANCE hInst = (HINSTANCE)GetModuleHandle(NULL);
  widget = CreateWindow("LISTBOX", "", LBS_NOINTEGRALHEIGHT | LBS_NOTIFY | WS_CHILD | WS_VISIBLE,
                          0, 0, 32, 32,
                          parent->widget, NULL, hInst, NULL);  
                          parent->widget, NULL, hInst, NULL);
  CommandHandlerData *chd = (CommandHandlerData *)malloc(sizeof(CommandHandlerData));
  chd->funct  = CH_Command;
  chd->object = self;
  SetProp(widget, "CommandHandlerData", chd);
      

  [self retain];
  return self;
}
//----------------------------------------------------------------------------------------------------------------------------------
- (id <OGComboBoxDataSource>)dataSource
{
  return dataSource;
106
107
108
109
110
111
112
113

114
115
116
117
118
119
120
106
107
108
109
110
111
112

113
114
115
116
117
118
119
120







-
+







      [dataSource methodForSelector: @selector(comboBox:itemAtIndex:)];

  size_t i, size = [dataSource numberOfItemsInComboBox: self];
  for (i = 0; i < size; i++)
  {
    OGComboBoxItem *item = itemAtIndex(dataSource,
        @selector(comboBox:itemAtIndex:), self, i);
    

    SendMessage(widget, LB_ADDSTRING, 0, (WPARAM)[item.label UTF8String]);
  }
}
//----------------------------------------------------------------------------------------------------------------------------------
- (void)OG_changed
{
  OFAutoreleasePool *pool = [OFAutoreleasePool new];

Modified win32/OGHBox.m from [99145ff743] to [dbee2fab85].

40
41
42
43
44
45
46
47

48
49
50
51
52
53
54
55
56

57
58
59
60
61
62
63
64
65

66
67
68
69
70
71
72
73
74
75
76
77

78
79
80
81
82
83
84
85
86

87
88

89
90
91
92
93
94
95
96

97
98
99
100
101

102
103
104
105
106
107
108
109
110

111
112
113
114

115
116
117
118
119
120
121
40
41
42
43
44
45
46

47
48
49
50
51
52
53
54
55

56
57
58
59
60
61
62
63
64

65
66
67
68
69
70
71
72
73
74
75
76

77
78
79
80
81
82
83
84
85

86
87

88
89
90
91
92
93
94
95

96
97
98
99
100

101
102
103
104
105
106
107
108
109

110
111
112
113

114
115
116
117
118
119
120
121







-
+








-
+








-
+











-
+








-
+

-
+







-
+




-
+








-
+



-
+







       expand: (BOOL)expand
         fill: (BOOL)fill
      padding: (float)padding
{
  RECT rc;
  SetParent(child->widget, widget);
  GetWindowRect(child->widget, &rc);
  

  og_box_child_t *newChild   = malloc(sizeof(og_box_child_t));
  newChild->hwnd         = child->widget;
  newChild->expand       = expand;
  newChild->fill         = fill;
  newChild->padding      = (int)padding;
  newChild->originalSize = (rc.right - rc.left);
  newChild->currentSize  = (float)(newChild->originalSize + (newChild->padding << 1));
  newChild->next         = NULL;
  

  if(firstBorn == NULL)
    firstBorn = newChild;
  else
  {
    og_box_child_t *curr = firstBorn;
    while(curr->next != NULL) curr = curr->next;
    curr->next = newChild;
  }
  

  [self OG_resizeChildren];
}
//----------------------------------------------------------------------------------------------------------------------------------
- (void)prependChild: (OGWidget*)child
        expand: (BOOL)expand
    fill: (BOOL)fill
       padding: (float)padding
{
  RECT rc;
  SetParent(child->widget, widget);
  GetWindowRect(child->widget, &rc);
  

  og_box_child_t *newChild   = malloc(sizeof(og_box_child_t));
  newChild->hwnd         = child->widget;
  newChild->expand       = expand;
  newChild->fill         = fill;
  newChild->padding      = (int)padding;
  newChild->originalSize = (rc.right - rc.left);
  newChild->currentSize  = (float)(newChild->originalSize + (newChild->padding << 1));
  newChild->next         = firstBorn;
  

  firstBorn = newChild;
  

  [self OG_resizeChildren];
}
//----------------------------------------------------------------------------------------------------------------------------------
- (void)OG_resizeChildren
{
  RECT rc;
  og_box_child_t *curr;
  

  //get our available size
  GetClientRect(widget, &rc);
  int width  = rc.right;
  int height = rc.bottom;
  

  //get total of childrens' widths
  int childOriginal = 0;
  curr = firstBorn;
  while(curr != NULL)
  {
    childOriginal += (curr->originalSize + (curr->padding << 1));
    curr = curr->next;
  }
  

  //how to divide our extra space
  int extra = width - childOriginal;
  float evenShare = 0.0f;
  

  if(extra <= 0)
  {
    curr = firstBorn;
    while(curr != NULL)
    {
      curr->currentSize = curr->originalSize;
      curr = curr->next;
147
148
149
150
151
152
153
154

155
156
157
158
159
160
161
147
148
149
150
151
152
153

154
155
156
157
158
159
160
161







-
+







        if(curr->expand == YES)
          if(curr->fill == YES)
            curr->currentSize = (float)curr->originalSize + evenShare;
        curr = curr->next;
      }
    }
  }
  

  //assign new positions/heights
  float x = 0.0f;
  curr = firstBorn;
  while(curr != NULL)
  {
    x += (float)curr->padding;
    SetWindowPos(curr->hwnd, NULL, (int)x, 0, curr->currentSize, height, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER);
170
171
172
173
174
175
176
177

178
179
180
181
182
183
184
185
186
187
170
171
172
173
174
175
176

177
178
179
180
181
182
183
184
185
186
187







-
+










{
  switch(msg)
  {
    case WM_SIZE:
      [self OG_resizeChildren];
      return DefWindowProc(hwnd, msg, wparam, lparam);
    break;
    

    case WM_SIZING:
      [self OG_resizeChildren];
      return DefWindowProc(hwnd, msg, wparam, lparam);
    break;
  }
  return [(id)super MessageReceived : hwnd : msg : wparam : lparam];
}
//----------------------------------------------------------------------------------------------------------------------------------
@end
//==================================================================================================================================

Modified win32/OGVBox.m from [8a22986e9e] to [615b173fac].

40
41
42
43
44
45
46
47

48
49
50
51
52
53
54
55
56

57
58
59
60
61
62
63
64
65

66
67
68
69
70
71
72
73
74
75
76
77

78
79
80
81
82
83
84
85
86

87
88

89
90
91
92
93
94
95
96
97

98
99
100
101
102

103
104
105
106
107
108
109
110
111

112
113
114
115

116
117
118
119
120
121
122
40
41
42
43
44
45
46

47
48
49
50
51
52
53
54
55

56
57
58
59
60
61
62
63
64

65
66
67
68
69
70
71
72
73
74
75
76

77
78
79
80
81
82
83
84
85

86
87

88
89
90
91
92
93
94
95
96

97
98
99
100
101

102
103
104
105
106
107
108
109
110

111
112
113
114

115
116
117
118
119
120
121
122







-
+








-
+








-
+











-
+








-
+

-
+








-
+




-
+








-
+



-
+







       expand: (BOOL)expand
         fill: (BOOL)fill
      padding: (float)padding
{
  RECT rc;
  SetParent(child->widget, widget);
  GetWindowRect(child->widget, &rc);
  

  og_box_child_t *newChild   = malloc(sizeof(og_box_child_t));
  newChild->hwnd         = child->widget;
  newChild->expand       = expand;
  newChild->fill         = fill;
  newChild->padding      = (int)padding;
  newChild->originalSize = (rc.bottom - rc.top);
  newChild->currentSize  = (float)(newChild->originalSize + (newChild->padding << 1));
  newChild->next         = NULL;
  

  if(firstBorn == NULL)
    firstBorn = newChild;
  else
  {
    og_box_child_t *curr = firstBorn;
    while(curr->next != NULL) curr = curr->next;
    curr->next = newChild;
  }
  

  [self OG_resizeChildren];
}
//----------------------------------------------------------------------------------------------------------------------------------
- (void)prependChild: (OGWidget*)child
        expand: (BOOL)expand
    fill: (BOOL)fill
       padding: (float)padding
{
  RECT rc;
  SetParent(child->widget, widget);
  GetWindowRect(child->widget, &rc);
  

  og_box_child_t *newChild   = malloc(sizeof(og_box_child_t));
  newChild->hwnd         = child->widget;
  newChild->expand       = expand;
  newChild->fill         = fill;
  newChild->padding      = (int)padding;
  newChild->originalSize = (rc.bottom - rc.top);
  newChild->currentSize  = (float)(newChild->originalSize + (newChild->padding << 1));
  newChild->next         = firstBorn;
  

  firstBorn = newChild;
  

  SetParent(child->widget, widget);
  [self OG_resizeChildren];
}
//----------------------------------------------------------------------------------------------------------------------------------
- (void)OG_resizeChildren
{
  RECT rc;
  og_box_child_t *curr;
  

  //get our available size
  GetClientRect(widget, &rc);
  int width  = rc.right;
  int height = rc.bottom;
  

  //get total of childrens' heights
  int childOriginal = 0;
  curr = firstBorn;
  while(curr != NULL)
  {
    childOriginal += (curr->originalSize + (curr->padding << 1));
    curr = curr->next;
  }
  

  //how to divide our extra space
  int extra = height - childOriginal;
  float evenShare = 0.0f;
  

  if(extra <= 0)
  {
    curr = firstBorn;
    while(curr != NULL)
    {
      curr->currentSize = curr->originalSize;
      curr = curr->next;
148
149
150
151
152
153
154
155

156
157
158
159
160
161
162
148
149
150
151
152
153
154

155
156
157
158
159
160
161
162







-
+







        if(curr->expand == YES)
          if(curr->fill == YES)
            curr->currentSize = (float)curr->originalSize + evenShare;
        curr = curr->next;
      }
    }
  }
  

  //assign new positions/heights
  float y = 0;
  curr = firstBorn;
  while(curr != NULL)
  {
    y += (float)curr->padding;
    SetWindowPos(curr->hwnd, NULL, 0, (int)y, width, curr->currentSize, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER);
171
172
173
174
175
176
177
178

179
180
181
182
183
184
185
186
187
188
171
172
173
174
175
176
177

178
179
180
181
182
183
184
185
186
187
188







-
+










{
  switch(msg)
  {
    case WM_SIZE:
      [self OG_resizeChildren];
      return DefWindowProc(hwnd, msg, wparam, lparam);
    break;
    

    case WM_SIZING:
      [self OG_resizeChildren];
      return DefWindowProc(hwnd, msg, wparam, lparam);
    break;
  }
  return [(id)super MessageReceived : hwnd : msg : wparam : lparam];
}
//----------------------------------------------------------------------------------------------------------------------------------
@end
//==================================================================================================================================

Modified win32/OGWidget.m from [1d9e0e9e1a] to [5d653bdf90].

34
35
36
37
38
39
40
41

42
43
44
45
46
47

48
49
50
51
52
53
54
34
35
36
37
38
39
40

41
42
43
44
45
46

47
48
49
50
51
52
53
54







-
+





-
+







}
//==================================================================================================================================
@implementation OGWidget
//----------------------------------------------------------------------------------------------------------------------------------
- init
{
  self = [super init];
  

  widget = NULL;
  HINSTANCE hInst = (HINSTANCE)GetModuleHandle(NULL);
  widget = CreateWindowEx(WS_EX_LEFT, "OGWidgetClass", "OGWidget", WS_OVERLAPPEDWINDOW,
                          0, 0, 1, 1, NULL, NULL, hInst, NULL);
  SetWindowLong(widget, GWL_USERDATA, (int)self);
  

  @try {
    if (isa == [OGWidget class])
      @throw [OFNotImplementedException
          exceptionWithClass: isa
              selector: @selector(init)];
  } @catch (id e) {
    [self release];

Modified win32/OGWindow.m from [602c7b29cd] to [9cad780e9f].

40
41
42
43
44
45
46
47

48
49
50
51
52
53
54
40
41
42
43
44
45
46

47
48
49
50
51
52
53
54







-
+







//==================================================================================================================================
static int CALLBACK Resize_EnumChildren(HWND child, LPARAM lparam)
{
  //it appears this is actually EnumAncestorWindows, and not EnumDirectChildWindows
  //so make sure child.parent == use
  HWND parent = (HWND)lparam;
  if(GetParent(child) != parent) return 1;
  

  RECT rc;
  GetClientRect(parent, &rc);
  SetWindowPos(child, NULL, 0, 0, rc.right, rc.bottom,
               SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER);
  return 1;
}
//==================================================================================================================================
63
64
65
66
67
68
69
70

71
72
73
74
75
76
77
78
79
80

81
82
83
84
85
86
87
63
64
65
66
67
68
69

70
71
72
73
74
75
76
77
78
79

80
81
82
83
84
85
86
87







-
+









-
+







//----------------------------------------------------------------------------------------------------------------------------------
- init
{
  self = [super init];

  SetWindowLong(widget, GWL_EXSTYLE, WS_EX_OVERLAPPEDWINDOW);
  //"event connections" are handled in MessageReceived
  

  [self retain];
  return self;
}
//----------------------------------------------------------------------------------------------------------------------------------
- (OFString*)title
{
  int tlen = GetWindowTextLength(widget);
  char *buff = (char *)malloc(tlen + 1);
  GetWindowText(widget, buff, tlen+1);
  

  OFString *ret = [OFString stringWithUTF8String : buff];
  free(buff);
  return ret;
}
//----------------------------------------------------------------------------------------------------------------------------------
- (void)setTitle: (OFString*)title
{
134
135
136
137
138
139
140
141

142
143
144
145
146
147
148
149
150
151
152
153

154
155
156
157
158
159

160
161
162
163
164

165
166
167
168
169
170
171
172
173
174
134
135
136
137
138
139
140

141
142
143
144
145
146
147
148
149
150
151
152

153
154
155
156
157
158

159
160
161
162
163

164
165
166
167
168
169
170
171
172
173
174







-
+











-
+





-
+




-
+










  [pool release];
  return YES;
}
//----------------------------------------------------------------------------------------------------------------------------------
- (int)MessageReceived : (HWND)hwnd : (UINT)msg : (WPARAM)wparam : (LPARAM)lparam
{
  HWND ctrlHwnd;
  

  switch(msg)
  {
    case WM_COMMAND:
      //NOTE: TODO: IMPLEMENT: this may need revised later for Menus and Accelerators
      ctrlHwnd = (HWND)lparam;
      CommandHandlerData *chd = (CommandHandlerData *)GetProp(ctrlHwnd, "CommandHandlerData");
      if(chd        == NULL) return DefWindowProc(hwnd, msg, wparam, lparam);
      if(chd->funct == NULL) return DefWindowProc(hwnd, msg, wparam, lparam);
      chd->funct(chd->object, wparam);
      return 0;
    break;
    

    case WM_CLOSE:
      if([self OG_willClose] == YES)
        og_destroy(hwnd, self);
      return 0;
    break;
    

    case WM_SIZE:
      //act like GTK; expand our child(ren) to fit
      EnumChildWindows(widget, Resize_EnumChildren, (LPARAM)widget);
    break;
    

    case WM_SIZING:
      //act like GTK; expand our child(ren) to fit
      EnumChildWindows(widget, Resize_EnumChildren, (LPARAM)widget);
    break;
  }
  return DefWindowProc(hwnd, msg, wparam, lparam);
}
//----------------------------------------------------------------------------------------------------------------------------------
@end
//==================================================================================================================================

Modified win32/test.m from [7bc3895fd9] to [c8bc2c5dd4].

34
35
36
37
38
39
40
41

42
43
44
45
46
47

48
49
50
51
52
53
54
34
35
36
37
38
39
40

41
42
43
44
45
46

47
48
49
50
51
52
53
54







-
+





-
+







  OGComboBoxItem **items;
}
@end
@implementation TestSource
- init
{
  self = [super init];
  

  items = (OGComboBoxItem **)malloc(sizeof(OGComboBoxItem *) << 2);
  items[0] = [OGComboBoxItem comboBoxItemWithLabel : @"Test Combo Item 0"];
  items[1] = [OGComboBoxItem comboBoxItemWithLabel : @"Test Combo Item 1"];
  items[2] = [OGComboBoxItem comboBoxItemWithLabel : @"Test Combo Item 2"];
  items[3] = [OGComboBoxItem comboBoxItemWithLabel : @"Test Combo Item 3"];
  

  [self retain];
  return self;
}
- (size_t)numberOfItemsInComboBox: (OGComboBox*)comboBox
{
  return 4;
}
85
86
87
88
89
90
91
92

93
94
95
96
97
98
99
85
86
87
88
89
90
91

92
93
94
95
96
97
98
99







-
+







  OGButton *b = [OGButton button];
  b.label = @"Klick mich!";
  b.delegate = self;
  [hboxPre appendChild: b
       expand: YES
         fill: YES
      padding: 0];
  

  OGComboBox *cb = [[OGComboBox alloc] initWithParent : hboxPre];
  cb.dataSource  = [[TestSource alloc] init];
  cb.delegate    = self;
  [hboxPre appendChild: cb
                expand: YES
                  fill: YES
               padding: 0];