mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-03 16:10:50 +00:00
numberentry
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@246 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -1,12 +1,8 @@
|
||||
/* $Id$ */
|
||||
#include <Mw/Milsko.h>
|
||||
|
||||
typedef struct text {
|
||||
int cursor;
|
||||
} text_t;
|
||||
|
||||
static int create(MwWidget handle) {
|
||||
text_t* t = malloc(sizeof(*t));
|
||||
MwEntry t = malloc(sizeof(*t));
|
||||
|
||||
t->cursor = 0;
|
||||
handle->internal = t;
|
||||
@@ -24,7 +20,7 @@ static void destroy(MwWidget handle) {
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
MwRect r;
|
||||
text_t* t = handle->internal;
|
||||
MwEntry t = handle->internal;
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
const char* str = MwGetText(handle, MwNtext);
|
||||
@@ -79,7 +75,7 @@ static void draw(MwWidget handle) {
|
||||
}
|
||||
|
||||
static void key(MwWidget handle, int code) {
|
||||
text_t* t = handle->internal;
|
||||
MwEntry t = handle->internal;
|
||||
const char* str = MwGetText(handle, MwNtext);
|
||||
char* out;
|
||||
if(str == NULL) str = "";
|
||||
|
||||
40
src/widget/numberentry.c
Normal file
40
src/widget/numberentry.c
Normal file
@@ -0,0 +1,40 @@
|
||||
/* $Id$ */
|
||||
#include <Mw/Milsko.h>
|
||||
|
||||
static int create(MwWidget handle) {
|
||||
int st;
|
||||
|
||||
if((st = MwEntryClass->create(handle)) != 0) return st;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void destroy(MwWidget handle) {
|
||||
MwEntryClass->destroy(handle);
|
||||
}
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
MwEntryClass->draw(handle);
|
||||
}
|
||||
|
||||
static void key(MwWidget handle, int code) {
|
||||
MwEntryClass->key(handle, code);
|
||||
}
|
||||
|
||||
MwClassRec MwNumberEntryClassRec = {
|
||||
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 */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL};
|
||||
MwClass MwNumberEntryClass = &MwNumberEntryClassRec;
|
||||
Reference in New Issue
Block a user