fix look, add actual event
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@764 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
parent
8ed8e51ba7
commit
c97f1722fc
9 changed files with 106 additions and 29 deletions
|
|
@ -23,6 +23,16 @@ MWDECL const char* MwDefaultBackground;
|
||||||
*/
|
*/
|
||||||
MWDECL const char* MwDefaultForeground;
|
MWDECL const char* MwDefaultForeground;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Default sub background color
|
||||||
|
*/
|
||||||
|
MWDECL const char* MwDefaultSubBackground;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Default sub foreground color
|
||||||
|
*/
|
||||||
|
MWDECL const char* MwDefaultSubForeground;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Default dark theme background color
|
* @brief Default dark theme background color
|
||||||
*/
|
*/
|
||||||
|
|
@ -33,6 +43,16 @@ MWDECL const char* MwDefaultDarkBackground;
|
||||||
*/
|
*/
|
||||||
MWDECL const char* MwDefaultDarkForeground;
|
MWDECL const char* MwDefaultDarkForeground;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Default dark theme sub background color
|
||||||
|
*/
|
||||||
|
MWDECL const char* MwDefaultDarkSubBackground;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Default dark theme sub foreground color
|
||||||
|
*/
|
||||||
|
MWDECL const char* MwDefaultDarkSubForeground;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Gets default border width
|
* @brief Gets default border width
|
||||||
* @param handle Widget
|
* @param handle Widget
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,9 @@
|
||||||
#define MwNtitle "Stitle"
|
#define MwNtitle "Stitle"
|
||||||
#define MwNtext "Stext"
|
#define MwNtext "Stext"
|
||||||
#define MwNbackground "Sbackground"
|
#define MwNbackground "Sbackground"
|
||||||
|
#define MwNsubBackground "SsubBackground"
|
||||||
#define MwNforeground "Sforeground"
|
#define MwNforeground "Sforeground"
|
||||||
|
#define MwNsubForeground "SsubForeground"
|
||||||
|
|
||||||
#define MwNpixmap "Vpixmap"
|
#define MwNpixmap "Vpixmap"
|
||||||
#define MwNiconPixmap "ViconPixmap"
|
#define MwNiconPixmap "ViconPixmap"
|
||||||
|
|
@ -41,7 +43,7 @@
|
||||||
#define MwNfont "Vfont"
|
#define MwNfont "Vfont"
|
||||||
#define MwNboldFont "VboldFont"
|
#define MwNboldFont "VboldFont"
|
||||||
|
|
||||||
#define MwNactivateHandler "Cactivate" /* NULL/int* (MwListBox) */
|
#define MwNactivateHandler "Cactivate" /* NULL/int* (MwListBox)/void* (MwTreeView) */
|
||||||
#define MwNresizeHandler "Cresize" /* NULL */
|
#define MwNresizeHandler "Cresize" /* NULL */
|
||||||
#define MwNtickHandler "Ctick" /* NULL */
|
#define MwNtickHandler "Ctick" /* NULL */
|
||||||
#define MwNmenuHandler "Cmenu" /* MwMenu */
|
#define MwNmenuHandler "Cmenu" /* MwMenu */
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,18 @@ MwInline void MwTreeViewReset(MwWidget handle) {
|
||||||
MwVaWidgetExecute(handle, "mwTreeViewReset", NULL);
|
MwVaWidgetExecute(handle, "mwTreeViewReset", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Gets item from the treeview
|
||||||
|
* @param handle Widget
|
||||||
|
* @param item Item
|
||||||
|
* @return Item
|
||||||
|
*/
|
||||||
|
MwInline const char* MwTreeViewGet(MwWidget handle, void* item) {
|
||||||
|
const char* out;
|
||||||
|
MwVaWidgetExecute(handle, "mwTreeViewGet", (void*)&out, item);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,7 @@ new_example("examples/basic/listbox");
|
||||||
new_example("examples/basic/progressbar");
|
new_example("examples/basic/progressbar");
|
||||||
new_example("examples/basic/colorpicker");
|
new_example("examples/basic/colorpicker");
|
||||||
new_example("examples/basic/combobox");
|
new_example("examples/basic/combobox");
|
||||||
|
new_example("examples/basic/treeview");
|
||||||
|
|
||||||
if (param_get("opengl")) {
|
if (param_get("opengl")) {
|
||||||
new_example("examples/gldemos/boing", $gl_libs);
|
new_example("examples/gldemos/boing", $gl_libs);
|
||||||
|
|
|
||||||
|
|
@ -373,7 +373,7 @@ void MwSetText(MwWidget handle, const char* key, const char* value) {
|
||||||
MwLLSetBackground(handle->lowlevel, c);
|
MwLLSetBackground(handle->lowlevel, c);
|
||||||
MwLLFreeColor(c);
|
MwLLFreeColor(c);
|
||||||
}
|
}
|
||||||
if(strcmp(key, MwNbackground) == 0 || strcmp(key, MwNforeground) == 0) {
|
if(strcmp(key, MwNbackground) == 0 || strcmp(key, MwNforeground) == 0 || strcmp(key, MwNsubBackground) == 0 || strcmp(key, MwNsubForeground) == 0) {
|
||||||
MwForceRender(handle);
|
MwForceRender(handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -411,7 +411,7 @@ int MwGetInteger(MwWidget handle, const char* key) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* MwGetText(MwWidget handle, const char* key) {
|
const char* MwGetText(MwWidget handle, const char* key) {
|
||||||
if(shgeti(handle->text, key) == -1 && (strcmp(key, MwNbackground) == 0 || strcmp(key, MwNforeground) == 0)) {
|
if(shgeti(handle->text, key) == -1 && (strcmp(key, MwNbackground) == 0 || strcmp(key, MwNforeground) == 0 || strcmp(key, MwNsubBackground) == 0 || strcmp(key, MwNsubForeground) == 0)) {
|
||||||
const char* v = NULL;
|
const char* v = NULL;
|
||||||
MwWidget h = handle->parent;
|
MwWidget h = handle->parent;
|
||||||
while(h != NULL) {
|
while(h != NULL) {
|
||||||
|
|
@ -422,9 +422,13 @@ const char* MwGetText(MwWidget handle, const char* key) {
|
||||||
if(handle->dark_theme) {
|
if(handle->dark_theme) {
|
||||||
if(strcmp(key, MwNbackground) == 0) return MwDefaultDarkBackground;
|
if(strcmp(key, MwNbackground) == 0) return MwDefaultDarkBackground;
|
||||||
if(strcmp(key, MwNforeground) == 0) return MwDefaultDarkForeground;
|
if(strcmp(key, MwNforeground) == 0) return MwDefaultDarkForeground;
|
||||||
|
if(strcmp(key, MwNsubBackground) == 0) return MwDefaultDarkSubBackground;
|
||||||
|
if(strcmp(key, MwNsubForeground) == 0) return MwDefaultDarkSubForeground;
|
||||||
} else {
|
} else {
|
||||||
if(strcmp(key, MwNbackground) == 0) return MwDefaultBackground;
|
if(strcmp(key, MwNbackground) == 0) return MwDefaultBackground;
|
||||||
if(strcmp(key, MwNforeground) == 0) return MwDefaultForeground;
|
if(strcmp(key, MwNforeground) == 0) return MwDefaultForeground;
|
||||||
|
if(strcmp(key, MwNsubBackground) == 0) return MwDefaultSubBackground;
|
||||||
|
if(strcmp(key, MwNsubForeground) == 0) return MwDefaultSubForeground;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,15 @@
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
#include <Mw/Milsko.h>
|
#include <Mw/Milsko.h>
|
||||||
|
|
||||||
const char* MwDefaultBackground = "#d2d2d2";
|
const char* MwDefaultBackground = "#d2d2d2";
|
||||||
const char* MwDefaultForeground = "#000";
|
const char* MwDefaultForeground = "#000";
|
||||||
|
const char* MwDefaultSubBackground = "#fff";
|
||||||
|
const char* MwDefaultSubForeground = "#000";
|
||||||
|
|
||||||
const char* MwDefaultDarkBackground = "#333";
|
const char* MwDefaultDarkBackground = "#333";
|
||||||
const char* MwDefaultDarkForeground = "#ddd";
|
const char* MwDefaultDarkForeground = "#ddd";
|
||||||
|
const char* MwDefaultDarkSubBackground = "#000";
|
||||||
|
const char* MwDefaultDarkSubForeground = "#fff";
|
||||||
|
|
||||||
int MwDefaultBorderWidth(MwWidget handle) {
|
int MwDefaultBorderWidth(MwWidget handle) {
|
||||||
if(MwGetInteger(handle, MwNmodernLook)) {
|
if(MwGetInteger(handle, MwNmodernLook)) {
|
||||||
|
|
|
||||||
|
|
@ -185,10 +185,12 @@ static void frame_mouse_move(MwWidget handle, void* user, void* call) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void frame_draw(MwWidget handle) {
|
static void frame_draw(MwWidget handle) {
|
||||||
MwRect r;
|
MwRect r, r2;
|
||||||
MwListBox lb = handle->parent->internal;
|
MwListBox lb = handle->parent->internal;
|
||||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||||
MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
MwLLColor base2 = MwParseColor(handle, MwGetText(handle, MwNsubBackground));
|
||||||
|
MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||||
|
MwLLColor text2 = MwParseColor(handle, MwGetText(handle, MwNsubForeground));
|
||||||
int i;
|
int i;
|
||||||
MwPoint p;
|
MwPoint p;
|
||||||
int st = 0;
|
int st = 0;
|
||||||
|
|
@ -199,10 +201,16 @@ static void frame_draw(MwWidget handle) {
|
||||||
r.y = 0;
|
r.y = 0;
|
||||||
r.width = MwGetInteger(handle, MwNwidth);
|
r.width = MwGetInteger(handle, MwNwidth);
|
||||||
r.height = MwGetInteger(handle, MwNheight);
|
r.height = MwGetInteger(handle, MwNheight);
|
||||||
|
r2 = r;
|
||||||
|
|
||||||
p.x = MwDefaultBorderWidth(handle);
|
p.x = MwDefaultBorderWidth(handle);
|
||||||
p.y = MwDefaultBorderWidth(handle);
|
p.y = MwDefaultBorderWidth(handle);
|
||||||
|
|
||||||
|
MwDrawFrame(handle, &r, base, 1);
|
||||||
|
MwDrawRect(handle, &r, base2);
|
||||||
|
|
||||||
|
r = r2;
|
||||||
|
|
||||||
st = get_first_entry(handle->parent, lb);
|
st = get_first_entry(handle->parent, lb);
|
||||||
|
|
||||||
area = r.height - MwDefaultBorderWidth(handle) * 2;
|
area = r.height - MwDefaultBorderWidth(handle) * 2;
|
||||||
|
|
@ -218,8 +226,8 @@ static void frame_draw(MwWidget handle) {
|
||||||
r2.y = p.y;
|
r2.y = p.y;
|
||||||
r2.width = r.width;
|
r2.width = r.width;
|
||||||
r2.height = MwTextHeight(handle, "M");
|
r2.height = MwTextHeight(handle, "M");
|
||||||
MwDrawRect(handle, &r2, text);
|
MwDrawRect(handle, &r2, text2);
|
||||||
handle->bgcolor = text;
|
handle->bgcolor = text2;
|
||||||
}
|
}
|
||||||
if(lb->list[i].pixmap != NULL) {
|
if(lb->list[i].pixmap != NULL) {
|
||||||
MwRect r2;
|
MwRect r2;
|
||||||
|
|
@ -238,7 +246,7 @@ static void frame_draw(MwWidget handle) {
|
||||||
if(t == NULL) t = "";
|
if(t == NULL) t = "";
|
||||||
|
|
||||||
p.x += MwDefaultBorderWidth(handle);
|
p.x += MwDefaultBorderWidth(handle);
|
||||||
MwDrawText(handle, &p, t, 0, MwALIGNMENT_BEGINNING, selected ? base : text);
|
MwDrawText(handle, &p, t, 0, MwALIGNMENT_BEGINNING, selected ? base2 : text2);
|
||||||
p.x += get_col_width(lb, j) - MwDefaultBorderWidth(handle);
|
p.x += get_col_width(lb, j) - MwDefaultBorderWidth(handle);
|
||||||
if(j == 0) p.x -= 4;
|
if(j == 0) p.x -= 4;
|
||||||
|
|
||||||
|
|
@ -250,7 +258,9 @@ static void frame_draw(MwWidget handle) {
|
||||||
|
|
||||||
MwDrawFrame(handle, &r, base, 1);
|
MwDrawFrame(handle, &r, base, 1);
|
||||||
|
|
||||||
|
MwLLFreeColor(text2);
|
||||||
MwLLFreeColor(text);
|
MwLLFreeColor(text);
|
||||||
|
MwLLFreeColor(base2);
|
||||||
MwLLFreeColor(base);
|
MwLLFreeColor(base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
#include "Mw/TypeDefs.h"
|
#include "Mw/TypeDefs.h"
|
||||||
|
|
||||||
static void set_xywh(MwWidget handle) {
|
static void set_xywh(MwWidget handle) {
|
||||||
int height = 0;
|
int height = 0;
|
||||||
|
|
||||||
height = MwTextHeight(handle, "M") + 10;
|
height = MwTextHeight(handle, "M") + 10;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ static void set_all(MwTreeViewEntry** root, int v) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry** root, MwLLColor base, MwLLColor text, MwPoint* p, int next, int shift, int* skip, int* shared, int draw, MwPoint* mouse) {
|
static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry** root, MwLLColor base, MwLLColor text, MwLLColor base2, MwLLColor text2, MwPoint* p, int next, int shift, int* skip, int* shared, int draw, MwPoint* mouse) {
|
||||||
int i;
|
int i;
|
||||||
MwPoint l[2];
|
MwPoint l[2];
|
||||||
int skipped = 0;
|
int skipped = 0;
|
||||||
|
|
@ -40,7 +40,7 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
|
||||||
l[0] = *p;
|
l[0] = *p;
|
||||||
l[0].x -= LineSpace / 2;
|
l[0].x -= LineSpace / 2;
|
||||||
l[1] = *p;
|
l[1] = *p;
|
||||||
if(draw) MwLLLine(handle->lowlevel, &l[0], text);
|
if(draw) MwLLLine(handle->lowlevel, &l[0], text2);
|
||||||
|
|
||||||
l[0] = *p;
|
l[0] = *p;
|
||||||
l[0].x -= LineSpace / 2;
|
l[0].x -= LineSpace / 2;
|
||||||
|
|
@ -49,7 +49,7 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
|
||||||
if(next) {
|
if(next) {
|
||||||
l[1].y += MwTextHeight(handle, "M") / 2;
|
l[1].y += MwTextHeight(handle, "M") / 2;
|
||||||
}
|
}
|
||||||
if(draw) MwLLLine(handle->lowlevel, &l[0], text);
|
if(draw) MwLLLine(handle->lowlevel, &l[0], text2);
|
||||||
}
|
}
|
||||||
if(tree->tree != NULL) {
|
if(tree->tree != NULL) {
|
||||||
r.width = OpenerSize;
|
r.width = OpenerSize;
|
||||||
|
|
@ -114,10 +114,10 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
|
||||||
r.y = p->y - MwTextHeight(handle, "M") / 2;
|
r.y = p->y - MwTextHeight(handle, "M") / 2;
|
||||||
r.width = MwTextWidth(handle, tree->label);
|
r.width = MwTextWidth(handle, tree->label);
|
||||||
r.height = MwTextHeight(handle, "M");
|
r.height = MwTextHeight(handle, "M");
|
||||||
MwDrawRect(handle, &r, text);
|
MwDrawRect(handle, &r, text2);
|
||||||
}
|
}
|
||||||
handle->bgcolor = tree->selected ? text : base;
|
handle->bgcolor = tree->selected ? text2 : base2;
|
||||||
MwDrawText(handle, p, tree->label, 0, MwALIGNMENT_BEGINNING, tree->selected ? base : text);
|
MwDrawText(handle, p, tree->label, 0, MwALIGNMENT_BEGINNING, tree->selected ? base2 : text2);
|
||||||
handle->bgcolor = NULL;
|
handle->bgcolor = NULL;
|
||||||
} else {
|
} else {
|
||||||
if(p->x <= mouse->x && mouse->x <= (p->x + MwTextWidth(handle, tree->label)) && (p->y - MwTextHeight(handle, "M") / 2) <= mouse->y && mouse->y <= (p->y + MwTextHeight(handle, "M") / 2)) {
|
if(p->x <= mouse->x && mouse->x <= (p->x + MwTextWidth(handle, tree->label)) && (p->y - MwTextHeight(handle, "M") / 2) <= mouse->y && mouse->y <= (p->y + MwTextHeight(handle, "M") / 2)) {
|
||||||
|
|
@ -126,7 +126,7 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
|
||||||
set_all(root, 0);
|
set_all(root, 0);
|
||||||
tree->selected = 1;
|
tree->selected = 1;
|
||||||
if(((t = MwTimeGetTick()) - tree->click_time) < MwDoubleClickTimeout || MwGetInteger(handle->parent, MwNsingleClickSelectable)) {
|
if(((t = MwTimeGetTick()) - tree->click_time) < MwDoubleClickTimeout || MwGetInteger(handle->parent, MwNsingleClickSelectable)) {
|
||||||
/* TODO: dispatch event */
|
MwDispatchUserHandler(handle->parent, MwNactivateHandler, tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
tree->click_time = t;
|
tree->click_time = t;
|
||||||
|
|
@ -145,7 +145,7 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
|
||||||
l[0].x += shift + LineSpace / 2;
|
l[0].x += shift + LineSpace / 2;
|
||||||
l[0].y += MwTextHeight(handle, "M") - (MwTextHeight(handle, "M") - OpenerSize) / 2;
|
l[0].y += MwTextHeight(handle, "M") - (MwTextHeight(handle, "M") - OpenerSize) / 2;
|
||||||
|
|
||||||
recursion(handle, tree->tree[i], root, base, text, p, i != (arrlen(tree->tree) - 1) ? 1 : 0, shift + LineSpace, skip, shared, draw, mouse);
|
recursion(handle, tree->tree[i], root, base, text, base2, text2, p, i != (arrlen(tree->tree) - 1) ? 1 : 0, shift + LineSpace, skip, shared, draw, mouse);
|
||||||
|
|
||||||
l[1] = *p;
|
l[1] = *p;
|
||||||
l[1].x += shift + LineSpace / 2;
|
l[1].x += shift + LineSpace / 2;
|
||||||
|
|
@ -158,10 +158,12 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
|
||||||
}
|
}
|
||||||
|
|
||||||
static void frame_draw(MwWidget handle) {
|
static void frame_draw(MwWidget handle) {
|
||||||
MwRect r;
|
MwRect r, r2;
|
||||||
MwTreeView tv = handle->parent->internal;
|
MwTreeView tv = handle->parent->internal;
|
||||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||||
MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
MwLLColor base2 = MwParseColor(handle, MwGetText(handle, MwNsubBackground));
|
||||||
|
MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||||
|
MwLLColor text2 = MwParseColor(handle, MwGetText(handle, MwNsubForeground));
|
||||||
MwPoint p;
|
MwPoint p;
|
||||||
int shared = 0;
|
int shared = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -171,18 +173,26 @@ static void frame_draw(MwWidget handle) {
|
||||||
r.y = 0;
|
r.y = 0;
|
||||||
r.width = MwGetInteger(handle, MwNwidth);
|
r.width = MwGetInteger(handle, MwNwidth);
|
||||||
r.height = MwGetInteger(handle, MwNheight);
|
r.height = MwGetInteger(handle, MwNheight);
|
||||||
|
r2 = r;
|
||||||
|
|
||||||
p.x = MwDefaultBorderWidth(handle);
|
p.x = MwDefaultBorderWidth(handle);
|
||||||
p.y = MwDefaultBorderWidth(handle);
|
p.y = MwDefaultBorderWidth(handle);
|
||||||
|
|
||||||
|
MwDrawFrame(handle, &r, base, 1);
|
||||||
|
MwDrawRect(handle, &r, base2);
|
||||||
|
|
||||||
|
r = r2;
|
||||||
|
|
||||||
for(i = 0; i < arrlen(tv->tree); i++) {
|
for(i = 0; i < arrlen(tv->tree); i++) {
|
||||||
if(shared > (r.height / MwTextHeight(handle, "M"))) break;
|
if(shared > (r.height / MwTextHeight(handle, "M"))) break;
|
||||||
recursion(handle, tv->tree[i], tv->tree, base, text, &p, 0, 0, &skip, &shared, 1, NULL);
|
recursion(handle, tv->tree[i], tv->tree, base, text, base2, text2, &p, 0, 0, &skip, &shared, 1, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
MwDrawFrame(handle, &r, base, 1);
|
MwDrawFrame(handle, &r, base, 1);
|
||||||
|
|
||||||
|
MwLLFreeColor(text2);
|
||||||
MwLLFreeColor(text);
|
MwLLFreeColor(text);
|
||||||
|
MwLLFreeColor(base2);
|
||||||
MwLLFreeColor(base);
|
MwLLFreeColor(base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -222,7 +232,7 @@ static void frame_mouse_up(MwWidget handle, void* user, void* call) {
|
||||||
p.y = MwDefaultBorderWidth(tv->frame);
|
p.y = MwDefaultBorderWidth(tv->frame);
|
||||||
for(i = 0; i < arrlen(tv->tree); i++) {
|
for(i = 0; i < arrlen(tv->tree); i++) {
|
||||||
if(shared > (MwGetInteger(tv->frame, MwNheight) / MwTextHeight(tv->frame, "M"))) break;
|
if(shared > (MwGetInteger(tv->frame, MwNheight) / MwTextHeight(tv->frame, "M"))) break;
|
||||||
recursion(tv->frame, tv->tree[i], tv->tree, NULL, NULL, &p, 0, 0, &skip, &shared, 0, &tv->pressed);
|
recursion(tv->frame, tv->tree[i], tv->tree, NULL, NULL, NULL, NULL, &p, 0, 0, &skip, &shared, 0, &tv->pressed);
|
||||||
}
|
}
|
||||||
resize(handle->parent);
|
resize(handle->parent);
|
||||||
}
|
}
|
||||||
|
|
@ -356,6 +366,8 @@ static void mwTreeViewDeleteImpl(MwWidget handle, void* item) {
|
||||||
MwTreeViewEntry* e = item;
|
MwTreeViewEntry* e = item;
|
||||||
MwTreeViewEntry* p = e->parent;
|
MwTreeViewEntry* p = e->parent;
|
||||||
|
|
||||||
|
(void)handle;
|
||||||
|
|
||||||
free_all(p->tree);
|
free_all(p->tree);
|
||||||
p->tree = NULL;
|
p->tree = NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -368,6 +380,14 @@ static void mwTreeViewResetImpl(MwWidget handle) {
|
||||||
resize(handle);
|
resize(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char* mwTreeViewGetImpl(MwWidget handle, void* item) {
|
||||||
|
MwTreeViewEntry* e = item;
|
||||||
|
|
||||||
|
(void)handle;
|
||||||
|
|
||||||
|
return e->label;
|
||||||
|
}
|
||||||
|
|
||||||
static void func_handler(MwWidget handle, const char* name, void* out, va_list va) {
|
static void func_handler(MwWidget handle, const char* name, void* out, va_list va) {
|
||||||
if(strcmp(name, "mwTreeViewAdd") == 0) {
|
if(strcmp(name, "mwTreeViewAdd") == 0) {
|
||||||
void* parent = va_arg(va, void*);
|
void* parent = va_arg(va, void*);
|
||||||
|
|
@ -382,6 +402,10 @@ static void func_handler(MwWidget handle, const char* name, void* out, va_list v
|
||||||
if(strcmp(name, "mwTreeViewReset") == 0) {
|
if(strcmp(name, "mwTreeViewReset") == 0) {
|
||||||
mwTreeViewResetImpl(handle);
|
mwTreeViewResetImpl(handle);
|
||||||
}
|
}
|
||||||
|
if(strcmp(name, "mwTreeViewGet") == 0) {
|
||||||
|
void* item = va_arg(va, void*);
|
||||||
|
*(const char**)out = mwTreeViewGetImpl(handle, item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tick(MwWidget handle) {
|
static void tick(MwWidget handle) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue