mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-09 19:03:29 +00:00
add separator
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@733 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -47,6 +47,7 @@
|
||||
#include <Mw/Widget/ListBox.h>
|
||||
#include <Mw/Widget/ProgressBar.h>
|
||||
#include <Mw/Widget/RadioBox.h>
|
||||
#include <Mw/Widget/Separator.h>
|
||||
#include <Mw/Widget/ComboBox.h>
|
||||
|
||||
#endif
|
||||
|
||||
25
include/Mw/Widget/Separator.h
Normal file
25
include/Mw/Widget/Separator.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/* $Id$ */
|
||||
/*!
|
||||
* @file Mw/Widget/Separator.h
|
||||
* @brief Separator widget
|
||||
*/
|
||||
#ifndef __MW_WIDGET_SEPARATOR_H__
|
||||
#define __MW_WIDGET_SEPARATOR_H__
|
||||
|
||||
#include <Mw/MachDep.h>
|
||||
#include <Mw/TypeDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @brief Separator widget class
|
||||
*/
|
||||
MWDECL MwClass MwSeparatorClass;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -61,6 +61,7 @@ new_object("src/widget/numberentry.c");
|
||||
new_object("src/widget/progressbar.c");
|
||||
new_object("src/widget/radiobox.c");
|
||||
new_object("src/widget/scrollbar.c");
|
||||
new_object("src/widget/separator.c");
|
||||
new_object("src/widget/submenu.c");
|
||||
new_object("src/widget/viewport.c");
|
||||
new_object("src/widget/window.c");
|
||||
|
||||
54
src/widget/separator.c
Normal file
54
src/widget/separator.c
Normal file
@@ -0,0 +1,54 @@
|
||||
/* $Id$ */
|
||||
#include <Mw/Milsko.h>
|
||||
|
||||
static int create(MwWidget handle) {
|
||||
MwSetDefault(handle);
|
||||
|
||||
MwSetInteger(handle, MwNorientation, MwVERTICAL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void draw(MwWidget handle) {
|
||||
MwRect r;
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
r.width = MwGetInteger(handle, MwNwidth);
|
||||
r.height = MwGetInteger(handle, MwNheight);
|
||||
MwDrawRect(handle, &r, base);
|
||||
|
||||
if(MwGetInteger(handle, MwNorientation) == MwVERTICAL) {
|
||||
r.x = (r.width - MwDefaultBorderWidth(handle) * 2) / 2;
|
||||
r.width = MwDefaultBorderWidth(handle) * 2;
|
||||
} else if(MwGetInteger(handle, MwNorientation) == MwHORIZONTAL) {
|
||||
r.y = (r.height - MwDefaultBorderWidth(handle) * 2) / 2;
|
||||
r.height = MwDefaultBorderWidth(handle) * 2;
|
||||
}
|
||||
MwDrawWidgetBack(handle, &r, base, 0, 1);
|
||||
|
||||
MwLLFreeColor(base);
|
||||
}
|
||||
|
||||
static void prop_change(MwWidget handle, const char* key) {
|
||||
if(strcmp(key, MwNorientation) == 0) MwForceRender(handle);
|
||||
}
|
||||
|
||||
MwClassRec MwSeparatorClassRec = {
|
||||
create, /* create */
|
||||
NULL, /* destroy */
|
||||
draw, /* draw */
|
||||
NULL, /* click */
|
||||
NULL, /* parent_resize */
|
||||
prop_change, /* prop_change */
|
||||
NULL, /* mouse_move */
|
||||
NULL, /* mouse_up */
|
||||
NULL, /* mouse_down */
|
||||
NULL, /* key */
|
||||
NULL, /* execute */
|
||||
NULL, /* tick */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL};
|
||||
MwClass MwSeparatorClass = &MwSeparatorClassRec;
|
||||
Reference in New Issue
Block a user