mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-16 14:14:07 +00:00
better api for mouse
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@269 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -66,16 +66,16 @@ static void prop_change(MwWidget handle, const char* key) {
|
||||
}
|
||||
|
||||
MwClassRec MwButtonClassRec = {
|
||||
create, /* create */
|
||||
NULL, /* destroy */
|
||||
draw, /* draw */
|
||||
click, /* click */
|
||||
NULL, /* parent_resize */
|
||||
prop_change, /* prop_change */
|
||||
NULL, /* mouse_move */
|
||||
MwForceRender, /* mouse_up */
|
||||
MwForceRender, /* mouse_down */
|
||||
NULL, /* key */
|
||||
create, /* create */
|
||||
NULL, /* destroy */
|
||||
draw, /* draw */
|
||||
click, /* click */
|
||||
NULL, /* parent_resize */
|
||||
prop_change, /* prop_change */
|
||||
NULL, /* mouse_move */
|
||||
MwForceRender2, /* mouse_up */
|
||||
MwForceRender2, /* mouse_down */
|
||||
NULL, /* key */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
@@ -38,16 +38,16 @@ static void prop_change(MwWidget handle, const char* key) {
|
||||
}
|
||||
|
||||
MwClassRec MwCheckBoxClassRec = {
|
||||
create, /* create */
|
||||
NULL, /* destroy */
|
||||
draw, /* draw */
|
||||
click, /* click */
|
||||
NULL, /* parent_resize */
|
||||
prop_change, /* prop_change */
|
||||
NULL, /* mouse_move */
|
||||
MwForceRender, /* mouse_up */
|
||||
MwForceRender, /* mouse_down */
|
||||
NULL, /* key */
|
||||
create, /* create */
|
||||
NULL, /* destroy */
|
||||
draw, /* draw */
|
||||
click, /* click */
|
||||
NULL, /* parent_resize */
|
||||
prop_change, /* prop_change */
|
||||
NULL, /* mouse_move */
|
||||
MwForceRender2, /* mouse_up */
|
||||
MwForceRender2, /* mouse_down */
|
||||
NULL, /* key */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
@@ -118,16 +118,16 @@ static void key(MwWidget handle, int code) {
|
||||
}
|
||||
|
||||
MwClassRec MwEntryClassRec = {
|
||||
create, /* create */
|
||||
destroy, /* destroy */
|
||||
draw, /* draw */
|
||||
NULL, /* click */
|
||||
NULL, /* parent_resize */
|
||||
NULL, /* prop_change */
|
||||
NULL, /* mouse_move */
|
||||
MwForceRender, /* mouse_up */
|
||||
MwForceRender, /* mouse_down */
|
||||
key, /* key */
|
||||
create, /* create */
|
||||
destroy, /* destroy */
|
||||
draw, /* draw */
|
||||
NULL, /* click */
|
||||
NULL, /* parent_resize */
|
||||
NULL, /* prop_change */
|
||||
NULL, /* mouse_move */
|
||||
MwForceRender2, /* mouse_up */
|
||||
MwForceRender2, /* mouse_down */
|
||||
key, /* key */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
@@ -122,8 +122,11 @@ static void parent_resize(MwWidget handle) {
|
||||
set_xywh(handle);
|
||||
}
|
||||
|
||||
static void mouse_down(MwWidget handle) {
|
||||
static void mouse_down(MwWidget handle, void* ptr) {
|
||||
MENU_LOOP_DECL;
|
||||
|
||||
if(((MwLLMouse*)ptr)->button != MwLLMouseLeft) return;
|
||||
|
||||
BEGIN_MENU_LOOP;
|
||||
if(in_area) {
|
||||
if(m->sub[i]->wsub == NULL && arrlen(m->sub[i]->sub) > 0) {
|
||||
@@ -151,8 +154,11 @@ static void mouse_down(MwWidget handle) {
|
||||
MwForceRender(handle);
|
||||
}
|
||||
|
||||
static void mouse_up(MwWidget handle) {
|
||||
static void mouse_up(MwWidget handle, void* ptr) {
|
||||
MENU_LOOP_DECL;
|
||||
|
||||
if(((MwLLMouse*)ptr)->button != MwLLMouseLeft) return;
|
||||
|
||||
BEGIN_MENU_LOOP;
|
||||
if(in_area && m->sub[i]->wsub != NULL) {
|
||||
m->sub[i]->keep = 1;
|
||||
|
||||
@@ -95,12 +95,14 @@ static void mouse_move(MwWidget handle) {
|
||||
}
|
||||
}
|
||||
|
||||
static void mouse_up(MwWidget handle) {
|
||||
static void mouse_up(MwWidget handle, void* ptr) {
|
||||
MwEntry e = handle->internal;
|
||||
int w = MwGetInteger(handle, MwNwidth);
|
||||
int h = MwGetInteger(handle, MwNheight);
|
||||
const char* str = MwGetText(handle, MwNtext);
|
||||
|
||||
if(((MwLLMouse*)ptr)->button != MwLLMouseLeft) return;
|
||||
|
||||
if(e->mouse.x >= (w - e->right)) {
|
||||
char s[512];
|
||||
if(e->mouse.y >= (h / 2)) {
|
||||
@@ -114,9 +116,11 @@ static void mouse_up(MwWidget handle) {
|
||||
MwForceRender(handle);
|
||||
}
|
||||
|
||||
static void mouse_down(MwWidget handle) {
|
||||
static void mouse_down(MwWidget handle, void* ptr) {
|
||||
MwEntry e = handle->internal;
|
||||
|
||||
if(((MwLLMouse*)ptr)->button != MwLLMouseLeft) return;
|
||||
|
||||
e->mouse = handle->mouse_point;
|
||||
|
||||
MwForceRender(handle);
|
||||
|
||||
@@ -156,12 +156,14 @@ static void mouse_move(MwWidget handle) {
|
||||
}
|
||||
}
|
||||
|
||||
static void mouse_down(MwWidget handle) {
|
||||
static void mouse_down(MwWidget handle, void* ptr) {
|
||||
int ww = MwGetInteger(handle, MwNwidth);
|
||||
int wh = MwGetInteger(handle, MwNheight);
|
||||
int or = MwGetInteger(handle, MwNorientation);
|
||||
scrollbar_t* scr = handle->internal;
|
||||
|
||||
if(((MwLLMouse*)ptr)->button != MwLLMouseLeft) return;
|
||||
|
||||
scr->point = handle->mouse_point;
|
||||
scr->drag = 0;
|
||||
if(or == MwVERTICAL) {
|
||||
@@ -186,16 +188,16 @@ static void prop_change(MwWidget handle, const char* key) {
|
||||
}
|
||||
|
||||
MwClassRec MwScrollBarClassRec = {
|
||||
create, /* create */
|
||||
destroy, /* destroy */
|
||||
draw, /* draw */
|
||||
NULL, /* click */
|
||||
NULL, /* parent_resize */
|
||||
prop_change, /* prop_change */
|
||||
mouse_move, /* mouse_move */
|
||||
MwForceRender, /* mouse_up */
|
||||
mouse_down, /* mouse_down */
|
||||
NULL, /* key */
|
||||
create, /* create */
|
||||
destroy, /* destroy */
|
||||
draw, /* draw */
|
||||
NULL, /* click */
|
||||
NULL, /* parent_resize */
|
||||
prop_change, /* prop_change */
|
||||
mouse_move, /* mouse_move */
|
||||
MwForceRender2, /* mouse_up */
|
||||
mouse_down, /* mouse_down */
|
||||
NULL, /* key */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
@@ -147,16 +147,16 @@ static void click(MwWidget handle) {
|
||||
}
|
||||
|
||||
MwClassRec MwSubMenuClassRec = {
|
||||
create, /* create */
|
||||
destroy, /* destroy */
|
||||
draw, /* draw */
|
||||
click, /* click */
|
||||
NULL, /* parent_resize */
|
||||
NULL, /* prop_change */
|
||||
NULL, /* mouse_move */
|
||||
MwForceRender, /* mouse_up */
|
||||
MwForceRender, /* mouse_down */
|
||||
NULL, /* key */
|
||||
create, /* create */
|
||||
destroy, /* destroy */
|
||||
draw, /* draw */
|
||||
click, /* click */
|
||||
NULL, /* parent_resize */
|
||||
NULL, /* prop_change */
|
||||
NULL, /* mouse_move */
|
||||
MwForceRender2, /* mouse_up */
|
||||
MwForceRender2, /* mouse_down */
|
||||
NULL, /* key */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
Reference in New Issue
Block a user