mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2025-12-31 06:30:52 +00:00
stuff
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@9 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -2,17 +2,26 @@
|
||||
#ifndef __MILSKO_CORE_H__
|
||||
#define __MILSKO_CORE_H__
|
||||
|
||||
#include <Milsko/MachDep.h>
|
||||
|
||||
#ifdef _MILSKO
|
||||
#include <Milsko/LowLevel.h>
|
||||
|
||||
typedef struct _Milsko* HMILSKO;
|
||||
|
||||
typedef struct _Milsko {
|
||||
HMILSKOLL lowlevel;
|
||||
HMILSKO parent;
|
||||
HMILSKO* children;
|
||||
}* HMILSKO;
|
||||
#else
|
||||
typedef void* HMILSKO;
|
||||
#endif
|
||||
|
||||
HMILSKO MilskoCreateWidget(HMILSKO parent, int x, int y, unsigned int width, unsigned int height);
|
||||
void MilskoDestroyWidget(HMILSKO handle);
|
||||
typedef struct _MilskoClass {
|
||||
}* MilskoClass;
|
||||
|
||||
MILSKODECL HMILSKO MilskoCreateWidget(MilskoClass class, HMILSKO parent, int x, int y, unsigned int width, unsigned int height);
|
||||
MILSKODECL void MilskoDestroyWidget(HMILSKO handle);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#ifndef __MILSKO_LL_H__
|
||||
#define __MILSKO_LL_H__
|
||||
|
||||
#include <Milsko/MachDep.h>
|
||||
#include <Milsko/TypeDef.h>
|
||||
|
||||
#ifdef _MILSKO
|
||||
@@ -16,12 +17,12 @@ typedef void* HMILSKOLL;
|
||||
typedef void* HMILSKOCOLOR;
|
||||
#endif
|
||||
|
||||
HMILSKOLL MilskoLLCreate(HMILSKOLL parent, int x, int y, int width, int height);
|
||||
void MilskoLLDestroy(HMILSKOLL handle);
|
||||
void MilskoLLPolygon(HMILSKOLL handle, MilskoPoint* points, int points_count, HMILSKOCOLOR color);
|
||||
HMILSKOCOLOR MilskoLLAllocColor(HMILSKOLL handle, int r, int g, int b);
|
||||
void MilskoLLGetXYWH(HMILSKOLL handle, int* x, int* y, unsigned int* w, unsigned int* h);
|
||||
int MilskoLLPending(HMILSKOLL handle);
|
||||
void MilskoLLNextEvent(HMILSKOLL handle);
|
||||
MILSKODECL HMILSKOLL MilskoLLCreate(HMILSKOLL parent, int x, int y, int width, int height);
|
||||
MILSKODECL void MilskoLLDestroy(HMILSKOLL handle);
|
||||
MILSKODECL void MilskoLLPolygon(HMILSKOLL handle, MilskoPoint* points, int points_count, HMILSKOCOLOR color);
|
||||
MILSKODECL HMILSKOCOLOR MilskoLLAllocColor(HMILSKOLL handle, int r, int g, int b);
|
||||
MILSKODECL void MilskoLLGetXYWH(HMILSKOLL handle, int* x, int* y, unsigned int* w, unsigned int* h);
|
||||
MILSKODECL int MilskoLLPending(HMILSKOLL handle);
|
||||
MILSKODECL void MilskoLLNextEvent(HMILSKOLL handle);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,4 +6,12 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(_MILSKO) && defined(_WIN32)
|
||||
#define MILSKODECL extern __declsped(dllexport)
|
||||
#elif defined(_WIN32)
|
||||
#define MILSKODECL extern __declsped(dllimport)
|
||||
#else
|
||||
#define MILSKODECL extern
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#ifndef __MILSKO_TYPEDEF_H__
|
||||
#define __MILSKO_TYPEDEF_H__
|
||||
|
||||
#include <Milsko/MachDep.h>
|
||||
|
||||
typedef struct _MilskoPoint {
|
||||
int x;
|
||||
int y;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#ifndef __MILSKO_X11_H__
|
||||
#define __MILSKO_X11_H__
|
||||
|
||||
#include <Milsko/MachDep.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
|
||||
33
src/core.c
33
src/core.c
@@ -1,10 +1,41 @@
|
||||
/* $Id$ */
|
||||
#include <Milsko/Milsko.h>
|
||||
|
||||
HMILSKO MilskoCreateWidget(HMILSKO parent, int x, int y, unsigned int width, unsigned int height) {
|
||||
#include "stb_ds.h"
|
||||
|
||||
HMILSKO MilskoCreateWidget(MilskoClass class, HMILSKO parent, int x, int y, unsigned int width, unsigned int height) {
|
||||
HMILSKO h = malloc(sizeof(*h));
|
||||
|
||||
h->parent = parent;
|
||||
h->children = NULL;
|
||||
h->lowlevel = MilskoLLCreate(parent->lowlevel, x, y, width, height);
|
||||
|
||||
arrput(parent->children, h);
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
void MilskoDestroyWidget(HMILSKO handle) {
|
||||
int i;
|
||||
|
||||
if(handle->children != NULL) {
|
||||
for(i = 0; i < arrlen(handle->children); i++) {
|
||||
if(handle->children[i] == handle) {
|
||||
MilskoDestroyWidget(handle->children[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
arrfree(handle->children);
|
||||
}
|
||||
|
||||
if(handle->parent != NULL) {
|
||||
for(i = 0; i < arrlen(handle->parent->children); i++) {
|
||||
if(handle->parent->children[i] == handle) {
|
||||
arrdel(handle->parent->children, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
MilskoLLDestroy(handle->lowlevel);
|
||||
free(handle);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user