mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2025-12-31 06:30:52 +00:00
rename
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@39 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include <Mw/Mw.h>
|
||||
#include <Mw/Milsko.h>
|
||||
|
||||
void handler(MwWidget handle, void* user_data, void* call_data){
|
||||
printf("hello world!\n");
|
||||
|
||||
@@ -11,19 +11,19 @@
|
||||
MWDECL MwWidget MwCreateWidget(MwClass class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height);
|
||||
MWDECL MwWidget MwVaCreateWidget(MwClass class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height, ...);
|
||||
MWDECL MwWidget MwVaListCreateWidget(MwClass class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height, va_list va);
|
||||
MWDECL void MwDestroyWidget(MwWidget handle);
|
||||
MWDECL void MwDestroyWidget(MwWidget handle);
|
||||
|
||||
MWDECL void MwLoop(MwWidget handle);
|
||||
MWDECL void MwStep(MwWidget handle);
|
||||
MWDECL int MwPending(MwWidget handle);
|
||||
MWDECL int MwPending(MwWidget handle);
|
||||
|
||||
MWDECL void MwSetInteger(MwWidget handle, const char* key, int n);
|
||||
MWDECL void MwSetText(MwWidget handle, const char* key, const char* value);
|
||||
MWDECL int MwGetInteger(MwWidget handle, const char* key);
|
||||
MWDECL void MwSetInteger(MwWidget handle, const char* key, int n);
|
||||
MWDECL void MwSetText(MwWidget handle, const char* key, const char* value);
|
||||
MWDECL int MwGetInteger(MwWidget handle, const char* key);
|
||||
MWDECL const char* MwGetText(MwWidget handle, const char* key);
|
||||
MWDECL void MwSetDefault(MwWidget handle);
|
||||
MWDECL void MwVaApply(MwWidget handle, ...);
|
||||
MWDECL void MwVaListApply(MwWidget handle, va_list va);
|
||||
MWDECL void MwSetDefault(MwWidget handle);
|
||||
MWDECL void MwVaApply(MwWidget handle, ...);
|
||||
MWDECL void MwVaListApply(MwWidget handle, va_list va);
|
||||
|
||||
MWDECL void MwAddUserHandler(MwWidget handle, const char* key, MwUserHandler handler, void* user_data);
|
||||
MWDECL void MwDispatchUserHandler(MwWidget handle, const char* key, void* handler_data);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <Mw/MachDep.h>
|
||||
|
||||
typedef struct _MwLL * MwLL, MwLLRec;
|
||||
typedef struct _MwLL * MwLL, MwLLRec;
|
||||
typedef struct _MwLLColor *MwLLColor, MwLLColorRec;
|
||||
|
||||
#include <Mw/TypeDefs.h>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
typedef struct _MwLLHandler *MwLLHandler, MwLLHandlerRec;
|
||||
#ifdef _MILSKO
|
||||
typedef struct _MwLL * MwLL, MwLLRec;
|
||||
typedef struct _MwLL * MwLL, MwLLRec;
|
||||
typedef struct _MwLLColor *MwLLColor, MwLLColorRec;
|
||||
#else
|
||||
typedef void* MwLL;
|
||||
@@ -38,12 +38,12 @@ MWDECL void MwLLDestroyCommon(MwLL handle);
|
||||
|
||||
/* driver-specific */
|
||||
MWDECL MwLL MwLLCreate(MwLL parent, int x, int y, int width, int height);
|
||||
MWDECL void MwLLDestroy(MwLL handle);
|
||||
MWDECL void MwLLDestroy(MwLL handle);
|
||||
|
||||
MWDECL void MwLLPolygon(MwLL handle, MwPoint* points, int points_count, MwLLColor color);
|
||||
|
||||
MWDECL MwLLColor MwLLAllocColor(MwLL handle, int r, int g, int b);
|
||||
MWDECL void MwLLFreeColor(MwLLColor color);
|
||||
MWDECL void MwLLFreeColor(MwLLColor color);
|
||||
|
||||
MWDECL void MwLLGetXYWH(MwLL handle, int* x, int* y, unsigned int* w, unsigned int* h);
|
||||
MWDECL void MwLLSetXY(MwLL handle, int x, int y);
|
||||
@@ -51,7 +51,7 @@ MWDECL void MwLLSetWH(MwLL handle, int w, int h);
|
||||
|
||||
MWDECL void MwLLSetTitle(MwLL handle, const char* title);
|
||||
|
||||
MWDECL int MwLLPending(MwLL handle);
|
||||
MWDECL int MwLLPending(MwLL handle);
|
||||
MWDECL void MwLLNextEvent(MwLL handle);
|
||||
MWDECL void MwLLSleep(int ms);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* $Id$ */
|
||||
#ifndef __MW_MW_H__
|
||||
#define __MW_MW_H__
|
||||
#ifndef __MW_MILSKO_H__
|
||||
#define __MW_MILSKO_H__
|
||||
|
||||
#include <Mw/MachDep.h>
|
||||
#include <Mw/LowLevel.h>
|
||||
@@ -4,11 +4,11 @@
|
||||
|
||||
#include <Mw/MachDep.h>
|
||||
|
||||
typedef struct _MwClass * MwClass, MwClassRec;
|
||||
typedef struct _MwPoint MwPoint;
|
||||
typedef struct _MwRect MwRect;
|
||||
typedef struct _MwIntegerKeyValue MwIntegerKeyValue;
|
||||
typedef struct _MwTextKeyValue MwTextKeyValue;
|
||||
typedef struct _MwClass * MwClass, MwClassRec;
|
||||
typedef struct _MwPoint MwPoint;
|
||||
typedef struct _MwRect MwRect;
|
||||
typedef struct _MwIntegerKeyValue MwIntegerKeyValue;
|
||||
typedef struct _MwTextKeyValue MwTextKeyValue;
|
||||
typedef struct _MwUserHandlerKeyValue MwUserHandlerKeyValue;
|
||||
#ifdef _MILSKO
|
||||
typedef struct _MwWidget *MwWidget, MwWidgetRec;
|
||||
@@ -45,8 +45,8 @@ struct _MwIntegerKeyValue {
|
||||
};
|
||||
|
||||
struct _MwUserHandlerKeyValue {
|
||||
char* key;
|
||||
void* user_data;
|
||||
char* key;
|
||||
void* user_data;
|
||||
MwUserHandler value;
|
||||
};
|
||||
|
||||
@@ -54,21 +54,21 @@ struct _MwUserHandlerKeyValue {
|
||||
struct _MwWidget {
|
||||
char* name;
|
||||
|
||||
MwLL lowlevel;
|
||||
MwLL lowlevel;
|
||||
MwWidget parent;
|
||||
MwWidget* children;
|
||||
MwClass class;
|
||||
|
||||
int pressed;
|
||||
|
||||
MwIntegerKeyValue* integer;
|
||||
MwTextKeyValue* text;
|
||||
MwIntegerKeyValue* integer;
|
||||
MwTextKeyValue* text;
|
||||
MwUserHandlerKeyValue* handler;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct _MwClass {
|
||||
void* opaque;
|
||||
void* opaque;
|
||||
MwHandler create;
|
||||
MwHandler destroy;
|
||||
MwHandler draw;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <Mw/MachDep.h>
|
||||
|
||||
typedef struct _MwLL * MwLL, MwLLRec;
|
||||
typedef struct _MwLL * MwLL, MwLLRec;
|
||||
typedef struct _MwLLColor *MwLLColor, MwLLColorRec;
|
||||
|
||||
#include <Mw/TypeDefs.h>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* $Id$ */
|
||||
#include <Mw/Mw.h>
|
||||
#include <Mw/Milsko.h>
|
||||
|
||||
static void create(MwWidget handle) {
|
||||
MwSetDefault(handle);
|
||||
|
||||
10
src/core.c
10
src/core.c
@@ -1,5 +1,5 @@
|
||||
/* $Id$ */
|
||||
#include <Mw/Mw.h>
|
||||
#include <Mw/Milsko.h>
|
||||
|
||||
#include "stb_ds.h"
|
||||
|
||||
@@ -10,14 +10,14 @@ static void lldrawhandler(MwLL handle) {
|
||||
|
||||
static void lluphandler(MwLL handle) {
|
||||
MwWidget h = (MwWidget)handle->user;
|
||||
h->pressed = 0;
|
||||
h->pressed = 0;
|
||||
|
||||
MwDispatch(h, click);
|
||||
}
|
||||
|
||||
static void lldownhandler(MwLL handle) {
|
||||
MwWidget h = (MwWidget)handle->user;
|
||||
h->pressed = 1;
|
||||
h->pressed = 1;
|
||||
}
|
||||
|
||||
MwWidget MwCreateWidget(MwClass class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height) {
|
||||
@@ -53,7 +53,7 @@ MwWidget MwCreateWidget(MwClass class, const char* name, MwWidget parent, int x,
|
||||
|
||||
MwWidget MwVaCreateWidget(MwClass class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height, ...) {
|
||||
MwWidget h;
|
||||
va_list va;
|
||||
va_list va;
|
||||
|
||||
va_start(va, height);
|
||||
h = MwVaListCreateWidget(class, name, parent, x, y, width, height, va);
|
||||
@@ -204,7 +204,7 @@ void MwVaListApply(MwWidget handle, va_list va) {
|
||||
MwSetText(handle, key, t);
|
||||
} else if(key[0] == 'C') {
|
||||
MwUserHandler h = va_arg(va, MwUserHandler);
|
||||
int ind;
|
||||
int ind;
|
||||
|
||||
shput(handle->handler, key, h);
|
||||
ind = shgeti(handle->handler, key);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id$ */
|
||||
#include <Mw/Mw.h>
|
||||
#include <Mw/Milsko.h>
|
||||
|
||||
const char* MwDefaultBackground = "#ddd";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* $Id$ */
|
||||
#include <Mw/Mw.h>
|
||||
#include <Mw/Milsko.h>
|
||||
|
||||
static int hex(const char* txt, int len) {
|
||||
int i;
|
||||
@@ -61,9 +61,9 @@ void MwDrawRect(MwWidget handle, MwRect* rect, MwLLColor color) {
|
||||
}
|
||||
|
||||
void MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int invert) {
|
||||
MwPoint p[6];
|
||||
const int diff = 128;
|
||||
const int border = 2;
|
||||
MwPoint p[6];
|
||||
const int diff = 128;
|
||||
const int border = 2;
|
||||
MwLLColor darker = MwLLAllocColor(handle->lowlevel, color->red - diff, color->green - diff, color->blue - diff);
|
||||
MwLLColor lighter = MwLLAllocColor(handle->lowlevel, color->red + diff, color->green + diff, color->blue + diff);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* $Id$ */
|
||||
#include <Mw/Mw.h>
|
||||
#include <Mw/Milsko.h>
|
||||
|
||||
void MwLLCreateCommon(MwLL handle) {
|
||||
handle->handler = malloc(sizeof(*handle->handler));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* $Id$ */
|
||||
#include <Mw/Mw.h>
|
||||
#include <Mw/Milsko.h>
|
||||
|
||||
static void create(MwWidget handle) {
|
||||
MwSetDefault(handle);
|
||||
@@ -7,7 +7,7 @@ static void create(MwWidget handle) {
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
MwLLColor c = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwRect r;
|
||||
MwRect r;
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/* $Id$ */
|
||||
#include <Mw/Mw.h>
|
||||
#include <Mw/Milsko.h>
|
||||
|
||||
static unsigned long mask = ExposureMask | StructureNotifyMask | ButtonPressMask | ButtonReleaseMask;
|
||||
|
||||
MwLL MwLLCreate(MwLL parent, int x, int y, int width, int height) {
|
||||
MwLL r;
|
||||
MwLL r;
|
||||
Window p;
|
||||
Window root;
|
||||
unsigned int border, depth;
|
||||
@@ -56,7 +56,7 @@ void MwLLPolygon(MwLL handle, MwPoint* points, int points_count, MwLLColor color
|
||||
|
||||
MwLLColor MwLLAllocColor(MwLL handle, int r, int g, int b) {
|
||||
MwLLColor c = malloc(sizeof(*c));
|
||||
XColor xc;
|
||||
XColor xc;
|
||||
|
||||
if(r > 255) r = 255;
|
||||
if(g > 255) g = 255;
|
||||
|
||||
Reference in New Issue
Block a user