mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2025-12-31 06:30:52 +00:00
icon
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@360 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -26,7 +26,7 @@ int main() {
|
||||
lb = MwCreateWidget(MwListBoxClass, "listbox", wmain, 5, 5, 630, 470);
|
||||
|
||||
MwAddUserHandler(lb, MwNactivateHandler, activate, NULL);
|
||||
MwListBoxInsertMultiple(lb, -1, (char**)harvard, sizeof(harvard) / sizeof(harvard[0]) - 1);
|
||||
MwListBoxInsertMultiple(lb, -1, (char**)harvard, NULL, sizeof(harvard) / sizeof(harvard[0]) - 1);
|
||||
|
||||
MwLoop(wmain);
|
||||
}
|
||||
|
||||
@@ -24,17 +24,19 @@ MWDECL MwClass MwListBoxClass;
|
||||
* %param handle Widget
|
||||
* %param index Index
|
||||
* %param text Text
|
||||
* %param pixmap Pixmap
|
||||
*/
|
||||
MWDECL void MwListBoxInsert(MwWidget handle, int index, const char* text);
|
||||
MWDECL void MwListBoxInsert(MwWidget handle, int index, const char* text, MwLLPixmap pixmap);
|
||||
|
||||
/*!
|
||||
* %brief Inserts multiple items on the listbox
|
||||
* %param handle Widget
|
||||
* %param index Index
|
||||
* %param text Text
|
||||
* %param pixmap Pixmap
|
||||
* %param count Count
|
||||
*/
|
||||
MWDECL void MwListBoxInsertMultiple(MwWidget handle, int index, char** text, int count);
|
||||
MWDECL void MwListBoxInsertMultiple(MwWidget handle, int index, char** text, MwLLPixmap* pixmap, int count);
|
||||
|
||||
/*!
|
||||
* %brief Deletes item from the listbox
|
||||
|
||||
@@ -105,10 +105,11 @@ static void frame_draw(MwWidget handle) {
|
||||
}
|
||||
if(lb->pixmap_list[i] != NULL) {
|
||||
MwRect r2;
|
||||
int h = (lb->pixmap_list[i]->height > MwTextHeight(handle, "M")) ? MwTextHeight(handle, "M") : lb->pixmap_list[i]->height;
|
||||
r2.x = MwDefaultBorderWidth;
|
||||
r2.y = p.y + (MwTextHeight(handle, "M") - lb->pixmap_list[i]->height) / 2;
|
||||
r2.width = lb->pixmap_list[i]->width;
|
||||
r2.height = lb->pixmap_list[i]->height;
|
||||
r2.y = p.y + (MwTextHeight(handle, "M") - h) / 2;
|
||||
r2.width = h * lb->pixmap_list[i]->width / lb->pixmap_list[i]->height;
|
||||
r2.height = h;
|
||||
MwLLDrawPixmap(handle->lowlevel, &r2, lb->pixmap_list[i]);
|
||||
}
|
||||
p.y += MwTextHeight(handle, lb->list[i]) / 2;
|
||||
@@ -228,7 +229,7 @@ MwClassRec MwListBoxClassRec = {
|
||||
NULL};
|
||||
MwClass MwListBoxClass = &MwListBoxClassRec;
|
||||
|
||||
void MwListBoxInsert(MwWidget handle, int index, const char* text) {
|
||||
void MwListBoxInsert(MwWidget handle, int index, const char* text, MwLLPixmap pixmap) {
|
||||
char* str = malloc(strlen(text) + 1);
|
||||
MwListBox lb = handle->internal;
|
||||
|
||||
@@ -236,7 +237,7 @@ void MwListBoxInsert(MwWidget handle, int index, const char* text) {
|
||||
|
||||
if(index == -1) index = arrlen(lb->list);
|
||||
arrins(lb->list, index, str);
|
||||
arrins(lb->pixmap_list, index, NULL);
|
||||
arrins(lb->pixmap_list, index, pixmap);
|
||||
|
||||
resize(handle);
|
||||
if(index < (MwGetInteger(lb->vscroll, MwNvalue) + MwGetInteger(lb->vscroll, MwNareaShown))) {
|
||||
@@ -244,7 +245,7 @@ void MwListBoxInsert(MwWidget handle, int index, const char* text) {
|
||||
}
|
||||
}
|
||||
|
||||
void MwListBoxInsertMultiple(MwWidget handle, int index, char** text, int count) {
|
||||
void MwListBoxInsertMultiple(MwWidget handle, int index, char** text, MwLLPixmap* pixmap, int count) {
|
||||
int i;
|
||||
MwListBox lb = handle->internal;
|
||||
int old;
|
||||
@@ -256,7 +257,11 @@ void MwListBoxInsertMultiple(MwWidget handle, int index, char** text, int count)
|
||||
strcpy(str, text[i]);
|
||||
|
||||
arrins(lb->list, index, str);
|
||||
arrins(lb->pixmap_list, index, NULL);
|
||||
if(pixmap == NULL) {
|
||||
arrins(lb->pixmap_list, index, NULL);
|
||||
} else {
|
||||
arrins(lb->pixmap_list, index, pixmap[i]);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user