add progressbar
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@525 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
parent
e2b654853c
commit
e5e0de7765
25 changed files with 159 additions and 52 deletions
|
|
@ -24,7 +24,7 @@ L_LIBS = $(LIBS)
|
|||
|
||||
L_OBJS = src/core.o src/default.o src/draw.o src/lowlevel.o src/error.o src/unicode.o src/color.o src/messagebox.o src/directory.o src/string.o src/filechooser.o
|
||||
L_OBJS += external/stb_ds.o external/stb_image.o external/stb_truetype.o
|
||||
L_OBJS += src/widget/window.o src/widget/button.o src/widget/frame.o src/widget/menu.o src/widget/submenu.o src/widget/image.o src/widget/scrollbar.o src/widget/checkbox.o src/widget/label.o src/widget/entry.o src/widget/numberentry.o src/widget/viewport.o src/widget/listbox.o
|
||||
L_OBJS += src/widget/window.o src/widget/button.o src/widget/frame.o src/widget/menu.o src/widget/submenu.o src/widget/image.o src/widget/scrollbar.o src/widget/checkbox.o src/widget/label.o src/widget/entry.o src/widget/numberentry.o src/widget/viewport.o src/widget/listbox.o src/widget/progressbar.o
|
||||
L_OBJS += src/cursor/hidden.o src/cursor/default.o src/cursor/cross.o src/cursor/text.o
|
||||
L_OBJS += src/icon/warning.o src/icon/note.o src/icon/info.o src/icon/news.o src/icon/error.o src/icon/file.o src/icon/directory.o src/icon/back.o src/icon/forward.o src/icon/up.o src/icon/down.o src/icon/left.o src/icon/right.o src/icon/computer.o src/icon/search.o
|
||||
L_OBJS += src/text/font.o src/text/boldfont.o src/text/ttf.o src/text/boldttf.o src/text/draw.o
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ MWDECL const char* MwDefaultDarkForeground;
|
|||
* @brief Gets default border width
|
||||
* @param handle Widget
|
||||
*/
|
||||
MWDECL int MwGetDefaultBorderWidth(MwWidget handle);
|
||||
MWDECL int MwDefaultBorderWidth(MwWidget handle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,5 +38,6 @@
|
|||
#include <Mw/Widget/NumberEntry.h>
|
||||
#include <Mw/Widget/Viewport.h>
|
||||
#include <Mw/Widget/ListBox.h>
|
||||
#include <Mw/Widget/ProgressBar.h>
|
||||
|
||||
#endif
|
||||
|
|
|
|||
25
include/Mw/Widget/ProgressBar.h
Normal file
25
include/Mw/Widget/ProgressBar.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/* $Id$ */
|
||||
/*!
|
||||
* @file Mw/Widget/ProgressBar.h
|
||||
* @brief ProgressBar widget
|
||||
*/
|
||||
#ifndef __MW_WIDGET_PROGRESSBAR_H__
|
||||
#define __MW_WIDGET_PROGRESSBAR_H__
|
||||
|
||||
#include <Mw/MachDep.h>
|
||||
#include <Mw/TypeDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @brief ProgressBar widget class
|
||||
*/
|
||||
MWDECL MwClass MwProgressBarClass;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
16
milsko.xml
16
milsko.xml
|
|
@ -61,6 +61,7 @@
|
|||
<integer name="hasBorder" />
|
||||
<integer name="inverted" />
|
||||
<integer name="modernLook" />
|
||||
<integer name="waitMS" />
|
||||
|
||||
<string name="title" />
|
||||
<string name="text" />
|
||||
|
|
@ -309,6 +310,14 @@
|
|||
<integer name="toggle" />
|
||||
</arguments>
|
||||
</function>
|
||||
<function name="MwGetParent">
|
||||
<return>
|
||||
<widget />
|
||||
</return>
|
||||
<arguments>
|
||||
<widget name="handle" />
|
||||
</arguments>
|
||||
</function>
|
||||
</functions>
|
||||
</header>
|
||||
<header name="Error">
|
||||
|
|
@ -548,5 +557,12 @@
|
|||
<function name="MakeBorderless" />
|
||||
</functions>
|
||||
</widget>
|
||||
<widget name="ProgressBar">
|
||||
<properties>
|
||||
<property name="minValue" />
|
||||
<property name="maxValue" />
|
||||
<property name="value" />
|
||||
</properties>
|
||||
</widget>
|
||||
</widgets>
|
||||
</milsko>
|
||||
|
|
|
|||
|
|
@ -406,7 +406,7 @@ void MwLLNextEvent(MwLL handle) {
|
|||
MwLLGetXYWH(handle, &x, &y, &w, &h);
|
||||
|
||||
MwLLDispatch(handle, draw, NULL);
|
||||
if(handle->copy_buffer){
|
||||
if(handle->copy_buffer) {
|
||||
XCopyArea(handle->display, handle->pixmap, handle->window, handle->gc, 0, 0, w, h, 0, 0);
|
||||
XSetWindowBackgroundPixmap(handle->display, handle->window, handle->pixmap);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,11 +158,13 @@ MwWidget MwCreateWidget(MwClass widget_class, const char* name, MwWidget parent,
|
|||
shdefault(h->handler, NULL);
|
||||
shdefault(h->data, NULL);
|
||||
|
||||
h->prop_event = 0;
|
||||
if(MwDispatch2(h, create) != 0) {
|
||||
h->widget_class = NULL;
|
||||
MwDestroyWidget(h);
|
||||
return NULL;
|
||||
}
|
||||
h->prop_event = 1;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
|
@ -589,6 +591,6 @@ void MwToggleDarkTheme(MwWidget handle, int toggle) {
|
|||
}
|
||||
}
|
||||
|
||||
MwWidget MwGetParent(MwWidget handle){
|
||||
MwWidget MwGetParent(MwWidget handle) {
|
||||
return handle->parent;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ const char* MwDefaultForeground = "#000";
|
|||
const char* MwDefaultDarkBackground = "#333";
|
||||
const char* MwDefaultDarkForeground = "#ddd";
|
||||
|
||||
int MwGetDefaultBorderWidth(MwWidget handle) {
|
||||
int MwDefaultBorderWidth(MwWidget handle) {
|
||||
if(MwGetInteger(handle, MwNmodernLook)) {
|
||||
return 1;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ void MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color) {
|
|||
}
|
||||
|
||||
void MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int invert) {
|
||||
MwDrawFrameEx(handle, rect, color, invert, MwGetDefaultBorderWidth(handle));
|
||||
MwDrawFrameEx(handle, rect, color, invert, MwDefaultBorderWidth(handle));
|
||||
}
|
||||
|
||||
void MwDrawWidgetBack(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border) {
|
||||
|
|
@ -201,11 +201,11 @@ void MwDrawFrameEx(MwWidget handle, MwRect* rect, MwLLColor color, int invert, i
|
|||
|
||||
void MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int direction) {
|
||||
MwPoint p1[4], p2[4], p3[4], p4[3];
|
||||
const int border = MwGetInteger(handle, MwNmodernLook) ? 1 : MwGetDefaultBorderWidth(handle);
|
||||
const int border = MwGetInteger(handle, MwNmodernLook) ? 1 : MwDefaultBorderWidth(handle);
|
||||
int ColorDiff = get_color_diff(handle);
|
||||
MwLLColor darker = MwLightenColor(handle, color, -ColorDiff, -ColorDiff, -ColorDiff);
|
||||
MwLLColor lighter = MwLightenColor(handle, color, ColorDiff, ColorDiff, ColorDiff);
|
||||
MwLLColor col = invert ? MwLightenColor(handle, color, -8, -8, -8) : color;
|
||||
MwLLColor col = invert ? MwLightenColor(handle, color, -8, -8, -8) : color;
|
||||
|
||||
double deg = 30 * ((direction == MwEAST || direction == MwWEST) ? 2 : 1);
|
||||
double c = cos(deg / 180 * M_PI);
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ static void draw(MwWidget handle) {
|
|||
r.width = px->width * sh;
|
||||
r.height = px->height * sh;
|
||||
}
|
||||
r.width -= MwGetDefaultBorderWidth(handle) * 2;
|
||||
r.height -= MwGetDefaultBorderWidth(handle) * 2;
|
||||
r.width -= MwDefaultBorderWidth(handle) * 2;
|
||||
r.height -= MwDefaultBorderWidth(handle) * 2;
|
||||
|
||||
r.x += (double)(ow - r.width) / 2;
|
||||
r.y += (double)(oh - r.height) / 2;
|
||||
|
|
@ -75,7 +75,7 @@ MwClassRec MwButtonClassRec = {
|
|||
MwForceRender2, /* mouse_up */
|
||||
MwForceRender2, /* mouse_down */
|
||||
NULL, /* key */
|
||||
NULL, /* custom */
|
||||
NULL, /* execute */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ MwClassRec MwCheckBoxClassRec = {
|
|||
MwForceRender2, /* mouse_up */
|
||||
MwForceRender2, /* mouse_down */
|
||||
NULL, /* key */
|
||||
NULL, /* custom */
|
||||
NULL, /* execute */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ MwClassRec MwEntryClassRec = {
|
|||
MwForceRender2, /* mouse_up */
|
||||
MwForceRender2, /* mouse_down */
|
||||
key, /* key */
|
||||
NULL, /* custom */
|
||||
NULL, /* execute */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@ static void draw(MwWidget handle) {
|
|||
fr.height = MwGetInteger(handle, MwNheight);
|
||||
MwDrawFrame(handle, &fr, base, inverted);
|
||||
|
||||
rr.x = MwGetDefaultBorderWidth(handle);
|
||||
rr.y = MwGetDefaultBorderWidth(handle);
|
||||
rr.width = MwGetInteger(handle, MwNwidth) - (MwGetDefaultBorderWidth(handle) * 2);
|
||||
rr.height = MwGetInteger(handle, MwNheight) - (MwGetDefaultBorderWidth(handle) * 2);
|
||||
rr.x = MwDefaultBorderWidth(handle);
|
||||
rr.y = MwDefaultBorderWidth(handle);
|
||||
rr.width = MwGetInteger(handle, MwNwidth) - (MwDefaultBorderWidth(handle) * 2);
|
||||
rr.height = MwGetInteger(handle, MwNheight) - (MwDefaultBorderWidth(handle) * 2);
|
||||
} else {
|
||||
|
||||
rr.x = 0;
|
||||
|
|
@ -51,7 +51,7 @@ MwClassRec MwFrameClassRec = {
|
|||
NULL, /* mouse_up */
|
||||
NULL, /* mouse_down */
|
||||
NULL, /* key */
|
||||
NULL, /* custom */
|
||||
NULL, /* execute */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ MwClassRec MwImageClassRec = {
|
|||
NULL, /* mouse_up */
|
||||
NULL, /* mouse_down */
|
||||
NULL, /* key */
|
||||
NULL, /* custom */
|
||||
NULL, /* execute */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ MwClassRec MwLabelClassRec = {
|
|||
NULL, /* mouse_up */
|
||||
NULL, /* mouse_down */
|
||||
NULL, /* key */
|
||||
NULL, /* custom */
|
||||
NULL, /* execute */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ MwClassRec MwMenuClassRec = {
|
|||
mouse_up, /* mouse_up */
|
||||
mouse_down, /* mouse_down */
|
||||
NULL, /* key */
|
||||
func_handler, /* custom */
|
||||
func_handler, /* execute */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ MwClassRec MwNumberEntryClassRec = {
|
|||
mouse_up, /* mouse_up */
|
||||
mouse_down, /* mouse_down */
|
||||
key, /* key */
|
||||
NULL, /* custom */
|
||||
NULL, /* execute */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ MwClassRec MwOpenGLClassRec = {
|
|||
NULL, /* mouse_up */
|
||||
NULL, /* mouse_down */
|
||||
NULL, /* key */
|
||||
func_handler, /* custom */
|
||||
func_handler, /* execute */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
|
|||
63
src/widget/progressbar.c
Normal file
63
src/widget/progressbar.c
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/* $Id$ */
|
||||
#include <Mw/Milsko.h>
|
||||
|
||||
static int create(MwWidget handle) {
|
||||
MwSetDefault(handle);
|
||||
MwVaApply(handle,
|
||||
MwNminValue, 0,
|
||||
MwNmaxValue, 100,
|
||||
MwNvalue, 0,
|
||||
NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
MwRect r;
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwLLColor fill = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
double w;
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
r.width = MwGetInteger(handle, MwNwidth);
|
||||
r.height = MwGetInteger(handle, MwNheight);
|
||||
|
||||
MwDrawFrame(handle, &r, base, 1);
|
||||
MwDrawRect(handle, &r, base);
|
||||
w = MwGetInteger(handle, MwNvalue) - MwGetInteger(handle, MwNminValue);
|
||||
w = w / (MwGetInteger(handle, MwNmaxValue) - MwGetInteger(handle, MwNminValue));
|
||||
|
||||
r.x += MwDefaultBorderWidth(handle);
|
||||
r.y += MwDefaultBorderWidth(handle);
|
||||
r.width -= MwDefaultBorderWidth(handle) * 2;
|
||||
r.height -= MwDefaultBorderWidth(handle) * 2;
|
||||
|
||||
r.width = r.width * w;
|
||||
MwDrawRect(handle, &r, fill);
|
||||
|
||||
MwLLFreeColor(fill);
|
||||
MwLLFreeColor(base);
|
||||
}
|
||||
|
||||
static void prop_change(MwWidget handle, const char* key) {
|
||||
if(strcmp(key, MwNminValue) == 0 || strcmp(key, MwNmaxValue) == 0 || strcmp(key, MwNvalue) == 0) MwForceRender(handle);
|
||||
}
|
||||
|
||||
MwClassRec MwProgressBarClassRec = {
|
||||
create, /* create */
|
||||
NULL, /* destroy */
|
||||
draw, /* draw */
|
||||
NULL, /* click */
|
||||
NULL, /* parent_resize */
|
||||
prop_change, /* prop_change */
|
||||
NULL, /* mouse_move */
|
||||
NULL, /* mouse_up */
|
||||
NULL, /* mouse_down */
|
||||
NULL, /* key */
|
||||
NULL, /* execute */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL};
|
||||
MwClass MwProgressBarClass = &MwProgressBarClassRec;
|
||||
|
|
@ -194,13 +194,13 @@ static void mouse_down(MwWidget handle, void* ptr) {
|
|||
scr->point = handle->mouse_point;
|
||||
scr->drag = 0;
|
||||
if(or == MwVERTICAL) {
|
||||
int tri = (ww - MwGetDefaultBorderWidth(handle) * 2) + MwGetDefaultBorderWidth(handle);
|
||||
int tri = (ww - MwDefaultBorderWidth(handle) * 2) + MwDefaultBorderWidth(handle);
|
||||
if(tri <= scr->point.y && scr->point.y <= (wh - tri)) {
|
||||
scr->drag = 1;
|
||||
scr->pos = calc_positition(handle) - scr->point.y;
|
||||
}
|
||||
} else if(or == MwHORIZONTAL) {
|
||||
int tri = (wh - MwGetDefaultBorderWidth(handle) * 2) + MwGetDefaultBorderWidth(handle);
|
||||
int tri = (wh - MwDefaultBorderWidth(handle) * 2) + MwDefaultBorderWidth(handle);
|
||||
if(tri <= scr->point.x && scr->point.x <= (ww - tri)) {
|
||||
scr->drag = 1;
|
||||
scr->pos = calc_positition(handle) - scr->point.x;
|
||||
|
|
@ -225,13 +225,13 @@ static int mwScrollBarGetVisibleLengthImpl(MwWidget handle) {
|
|||
int s = 0;
|
||||
|
||||
if(or == MwVERTICAL) {
|
||||
tri = (ww - MwGetDefaultBorderWidth(handle) * 2) * 2;
|
||||
tri = (ww - MwDefaultBorderWidth(handle) * 2) * 2;
|
||||
s = wh;
|
||||
} else if(or == MwHORIZONTAL) {
|
||||
tri = (wh - MwGetDefaultBorderWidth(handle) * 2) * 2;
|
||||
tri = (wh - MwDefaultBorderWidth(handle) * 2) * 2;
|
||||
s = ww;
|
||||
}
|
||||
return s - tri - MwGetDefaultBorderWidth(handle) * 2;
|
||||
return s - tri - MwDefaultBorderWidth(handle) * 2;
|
||||
}
|
||||
|
||||
static void func_handler(MwWidget handle, const char* name, void* out, va_list va) {
|
||||
|
|
@ -253,7 +253,7 @@ MwClassRec MwScrollBarClassRec = {
|
|||
MwForceRender2, /* mouse_up */
|
||||
mouse_down, /* mouse_down */
|
||||
NULL, /* key */
|
||||
func_handler, /* custom */
|
||||
func_handler, /* execute */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ MwClassRec MwSubMenuClassRec = {
|
|||
MwForceRender2, /* mouse_up */
|
||||
MwForceRender2, /* mouse_down */
|
||||
NULL, /* key */
|
||||
func_handler, /* custom */
|
||||
func_handler, /* execute */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ MwClassRec MwViewportClassRec = {
|
|||
NULL, /* mouse_up */
|
||||
NULL, /* mouse_down */
|
||||
NULL, /* key */
|
||||
func_handler, /* custom */
|
||||
func_handler, /* execute */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
|
|||
|
|
@ -523,7 +523,7 @@ MwClassRec MwVulkanClassRec = {
|
|||
NULL, /* mouse_up */
|
||||
NULL, /* mouse_down */
|
||||
NULL, /* key */
|
||||
func_handler, /* custom */
|
||||
func_handler, /* execute */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ MwClassRec MwWindowClassRec = {
|
|||
NULL, /* mouse_up */
|
||||
NULL, /* mouse_down */
|
||||
NULL, /* key */
|
||||
func_handler, /* custom */
|
||||
func_handler, /* execute */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue