mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-08 18:33:30 +00:00
working on scrollbar, wip
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@163 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
18
src/draw.c
18
src/draw.c
@@ -48,6 +48,21 @@ MwLLColor MwParseColor(MwWidget handle, const char* text) {
|
||||
return MwLLAllocColor(handle->lowlevel, r, g, b);
|
||||
}
|
||||
|
||||
MwLLColor MwLightenColor(MwWidget handle, MwLLColor color, int r, int g, int b) {
|
||||
int cr = color->red + r;
|
||||
int cg = color->green + g;
|
||||
int cb = color->blue + b;
|
||||
|
||||
if(cr < 0) cr = 0;
|
||||
if(cg < 0) cg = 0;
|
||||
if(cb < 0) cb = 0;
|
||||
if(cr > 255) cr = 255;
|
||||
if(cg > 255) cg = 255;
|
||||
if(cb > 255) cb = 255;
|
||||
|
||||
return MwLLAllocColor(handle->lowlevel, cr, cg, cb);
|
||||
}
|
||||
|
||||
void MwDrawRect(MwWidget handle, MwRect* rect, MwLLColor color) {
|
||||
MwPoint p[4];
|
||||
|
||||
@@ -177,3 +192,6 @@ MwLLPixmap MwLoadImage(MwWidget handle, const char* path) {
|
||||
|
||||
return px;
|
||||
}
|
||||
|
||||
void MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int direction) {
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* $Id$ */
|
||||
#include <Mw/Milsko.h>
|
||||
#include <Mw/OpenGL.h>
|
||||
#include <Mw/Widget/OpenGL.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
/* nothing */
|
||||
|
||||
38
src/widget/scrollbar.c
Normal file
38
src/widget/scrollbar.c
Normal file
@@ -0,0 +1,38 @@
|
||||
/* $Id $*/
|
||||
#include <Mw/Milsko.h>
|
||||
|
||||
static int create(MwWidget handle) {
|
||||
MwSetDefault(handle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
MwRect r, rt;
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwLLColor dark = MwLightenColor(handle, base, -64, -64, -64);
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
r.width = MwGetInteger(handle, MwNwidth);
|
||||
r.height = MwGetInteger(handle, MwNheight);
|
||||
|
||||
MwDrawFrame(handle, &r, dark, 1);
|
||||
MwDrawRect(handle, &r, dark);
|
||||
|
||||
rt = r;
|
||||
rt.height = rt.width;
|
||||
MwDrawTriangle(handle, &r, base, 0, MwNORTH);
|
||||
|
||||
MwLLFreeColor(dark);
|
||||
MwLLFreeColor(base);
|
||||
}
|
||||
|
||||
MwClassRec MwScrollBarClassRec = {
|
||||
create, /* create */
|
||||
NULL, /* destroy */
|
||||
draw, /* draw */
|
||||
NULL, /* click */
|
||||
NULL /* parent_resize */
|
||||
};
|
||||
MwClass MwScrollBarClass = &MwScrollBarClassRec;
|
||||
@@ -1,6 +1,6 @@
|
||||
/* $Id$ */
|
||||
#include <Mw/Milsko.h>
|
||||
#include <Mw/Vulkan.h>
|
||||
#include <Mw/Widget/Vulkan.h>
|
||||
|
||||
#include "../error_internal.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user