mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-03 08:00:50 +00:00
add progressbar
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@525 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -124,11 +124,11 @@ static void frame_mouse_down(MwWidget handle, void* user, void* call) {
|
||||
if(m->button == MwLLMouseLeft) {
|
||||
int st = 0;
|
||||
int i;
|
||||
int y = MwGetDefaultBorderWidth(handle);
|
||||
int y = MwDefaultBorderWidth(handle);
|
||||
int h = MwGetInteger(handle, MwNheight);
|
||||
|
||||
st = get_first_entry(handle->parent, lb);
|
||||
for(i = 0; (st + i) < arrlen(lb->list) && i < (h - MwGetDefaultBorderWidth(handle) * 2) / MwTextHeight(handle, "M"); i++) {
|
||||
for(i = 0; (st + i) < arrlen(lb->list) && i < (h - MwDefaultBorderWidth(handle) * 2) / MwTextHeight(handle, "M"); i++) {
|
||||
if(y <= m->point.y && m->point.y <= (y + MwTextHeight(handle, "M"))) {
|
||||
unsigned long t;
|
||||
int old = lb->selected;
|
||||
@@ -169,11 +169,11 @@ static void frame_mouse_move(MwWidget handle, void* user, void* call) {
|
||||
if(lb->pressed) {
|
||||
int st = 0;
|
||||
int i;
|
||||
int y = MwGetDefaultBorderWidth(handle);
|
||||
int y = MwDefaultBorderWidth(handle);
|
||||
int h = MwGetInteger(handle, MwNheight);
|
||||
|
||||
st = get_first_entry(handle->parent, lb);
|
||||
for(i = 0; (st + i) < arrlen(lb->list) && i < (h - MwGetDefaultBorderWidth(handle) * 2) / MwTextHeight(handle, "M"); i++) {
|
||||
for(i = 0; (st + i) < arrlen(lb->list) && i < (h - MwDefaultBorderWidth(handle) * 2) / MwTextHeight(handle, "M"); i++) {
|
||||
if(y <= p->y && p->y <= (y + MwTextHeight(handle, "M"))) {
|
||||
lb->selected = st + i;
|
||||
}
|
||||
@@ -192,21 +192,21 @@ static void frame_draw(MwWidget handle) {
|
||||
int i;
|
||||
MwPoint p;
|
||||
int st = 0;
|
||||
int ent;
|
||||
int area;
|
||||
int ent;
|
||||
int area;
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
r.width = MwGetInteger(handle, MwNwidth);
|
||||
r.height = MwGetInteger(handle, MwNheight);
|
||||
|
||||
p.x = MwGetDefaultBorderWidth(handle);
|
||||
p.y = MwGetDefaultBorderWidth(handle);
|
||||
p.x = MwDefaultBorderWidth(handle);
|
||||
p.y = MwDefaultBorderWidth(handle);
|
||||
|
||||
st = get_first_entry(handle->parent, lb);
|
||||
|
||||
area = r.height - MwGetDefaultBorderWidth(handle) * 2;
|
||||
ent = area / MwTextHeight(handle, "M");
|
||||
area = r.height - MwDefaultBorderWidth(handle) * 2;
|
||||
ent = area / MwTextHeight(handle, "M");
|
||||
|
||||
for(i = st; i < arrlen(lb->list) && i < st + ent; i++) {
|
||||
int selected = lb->selected == i ? 1 : 0;
|
||||
@@ -224,7 +224,7 @@ static void frame_draw(MwWidget handle) {
|
||||
if(lb->list[i].pixmap != NULL) {
|
||||
MwRect r2;
|
||||
int h = (lb->list[i].pixmap->height > MwTextHeight(handle, "M")) ? MwTextHeight(handle, "M") : lb->list[i].pixmap->height;
|
||||
r2.x = MwGetDefaultBorderWidth(handle);
|
||||
r2.x = MwDefaultBorderWidth(handle);
|
||||
r2.y = p.y + (MwTextHeight(handle, "M") - h) / 2;
|
||||
r2.width = h * lb->list[i].pixmap->width / lb->list[i].pixmap->height;
|
||||
r2.height = h;
|
||||
@@ -237,9 +237,9 @@ static void frame_draw(MwWidget handle) {
|
||||
|
||||
if(t == NULL) t = "";
|
||||
|
||||
p.x += MwGetDefaultBorderWidth(handle);
|
||||
p.x += MwDefaultBorderWidth(handle);
|
||||
MwDrawText(handle, &p, t, 0, MwALIGNMENT_BEGINNING, selected ? base : text);
|
||||
p.x += get_col_width(lb, j) - MwGetDefaultBorderWidth(handle);
|
||||
p.x += get_col_width(lb, j) - MwDefaultBorderWidth(handle);
|
||||
|
||||
if(j == 0) p.x -= MwGetInteger(handle->parent, MwNleftPadding);
|
||||
}
|
||||
@@ -259,7 +259,7 @@ static void resize(MwWidget handle) {
|
||||
int h = MwGetInteger(handle, MwNheight);
|
||||
int ih, y;
|
||||
|
||||
y = MwGetInteger(handle, MwNhasHeading) ? (MwTextHeight(handle, "M") + MwGetDefaultBorderWidth(handle) * 2) : 0;
|
||||
y = MwGetInteger(handle, MwNhasHeading) ? (MwTextHeight(handle, "M") + MwDefaultBorderWidth(handle) * 2) : 0;
|
||||
|
||||
if(lb->vscroll == NULL) {
|
||||
lb->vscroll = MwVaCreateWidget(MwScrollBarClass, "vscroll", handle, w - 16, 0, 16, h, NULL);
|
||||
@@ -288,7 +288,7 @@ static void resize(MwWidget handle) {
|
||||
MwNheight, h,
|
||||
NULL);
|
||||
}
|
||||
h -= MwGetDefaultBorderWidth(handle) * 2;
|
||||
h -= MwDefaultBorderWidth(handle) * 2;
|
||||
|
||||
ih = arrlen(lb->list);
|
||||
if(ih == 0) ih = 1;
|
||||
@@ -350,16 +350,16 @@ static void draw(MwWidget handle) {
|
||||
r.x = x;
|
||||
r.y = 0;
|
||||
r.width = get_col_width(lb, i);
|
||||
r.height = MwGetDefaultBorderWidth(handle) * 2 + MwTextHeight(handle, "M");
|
||||
r.height = MwDefaultBorderWidth(handle) * 2 + MwTextHeight(handle, "M");
|
||||
MwDrawFrame(handle, &r, base, 0);
|
||||
|
||||
x += MwGetDefaultBorderWidth(handle);
|
||||
x += MwDefaultBorderWidth(handle);
|
||||
|
||||
p.x = x;
|
||||
p.y = r.y + r.height / 2;
|
||||
MwDrawText(handle, &p, lb->list[0].name[i], 0, MwALIGNMENT_BEGINNING, text);
|
||||
|
||||
x += r.width + MwGetDefaultBorderWidth(handle);
|
||||
x += r.width + MwDefaultBorderWidth(handle);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -516,7 +516,7 @@ MwClassRec MwListBoxClassRec = {
|
||||
NULL, /* mouse_up */
|
||||
NULL, /* mouse_down */
|
||||
NULL, /* key */
|
||||
func_handler, /* custom */
|
||||
func_handler, /* execute */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
Reference in New Issue
Block a user