Browse Source

fixed crash when clicking on colored layout rects

pull/1/head
Leonard Ritter 10 years ago
parent
commit
c3efeb362c
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      example.cpp

+ 5
- 0
example.cpp View File

@@ -286,6 +286,7 @@ int colorrect(const char *label, NVGcolor color) {
int item = uiItem(); int item = uiItem();
UIRectData *data = (UIRectData *)uiAllocHandle(item, sizeof(UIRectData)); UIRectData *data = (UIRectData *)uiAllocHandle(item, sizeof(UIRectData));
data->head.subtype = ST_RECT; data->head.subtype = ST_RECT;
data->head.handler = NULL;
data->label = label; data->label = label;
data->color = color; data->color = color;
uiSetEvents(item, UI_BUTTON0_DOWN); uiSetEvents(item, UI_BUTTON0_DOWN);
@@ -297,6 +298,7 @@ int label(int iconid, const char *label) {
uiSetSize(item, 0, BND_WIDGET_HEIGHT); uiSetSize(item, 0, BND_WIDGET_HEIGHT);
UIButtonData *data = (UIButtonData *)uiAllocHandle(item, sizeof(UIButtonData)); UIButtonData *data = (UIButtonData *)uiAllocHandle(item, sizeof(UIButtonData));
data->head.subtype = ST_LABEL; data->head.subtype = ST_LABEL;
data->head.handler = NULL;
data->iconid = iconid; data->iconid = iconid;
data->label = label; data->label = label;
return item; return item;
@@ -460,6 +462,7 @@ int panel() {
int item = uiItem(); int item = uiItem();
UIData *data = (UIData *)uiAllocHandle(item, sizeof(UIData)); UIData *data = (UIData *)uiAllocHandle(item, sizeof(UIData));
data->subtype = ST_PANEL; data->subtype = ST_PANEL;
data->handler = NULL;
return item; return item;
} }


@@ -467,6 +470,7 @@ int hbox() {
int item = uiItem(); int item = uiItem();
UIData *data = (UIData *)uiAllocHandle(item, sizeof(UIData)); UIData *data = (UIData *)uiAllocHandle(item, sizeof(UIData));
data->subtype = ST_HBOX; data->subtype = ST_HBOX;
data->handler = NULL;
uiSetBox(item, UI_ROW); uiSetBox(item, UI_ROW);
return item; return item;
} }
@@ -476,6 +480,7 @@ int vbox() {
int item = uiItem(); int item = uiItem();
UIData *data = (UIData *)uiAllocHandle(item, sizeof(UIData)); UIData *data = (UIData *)uiAllocHandle(item, sizeof(UIData));
data->subtype = ST_VBOX; data->subtype = ST_VBOX;
data->handler = NULL;
uiSetBox(item, UI_COLUMN); uiSetBox(item, UI_COLUMN);
return item; return item;
} }


Loading…
Cancel
Save