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);
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);
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;
|
|
|
|
|
|
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);
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);
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
|
[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];
|
|
|
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];
|