mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-10 19:33:28 +00:00
numberentry
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@246 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -28,7 +28,7 @@ L_LIBS = $(LIBS)
|
|||||||
|
|
||||||
L_OBJS = src/core.o src/default.o src/draw.o src/lowlevel.o src/font.o src/boldfont.o src/error.o src/unicode.o
|
L_OBJS = src/core.o src/default.o src/draw.o src/lowlevel.o src/font.o src/boldfont.o src/error.o src/unicode.o
|
||||||
L_OBJS += src/external/ds.o src/external/image.o
|
L_OBJS += src/external/ds.o src/external/image.o
|
||||||
L_OBJS += src/widget/window.o src/widget/button.o src/widget/frame.o src/widget/menu.o src/widget/submenu.o src/widget/image.o src/widget/scrollbar.o src/widget/checkbox.o src/widget/label.o src/widget/entry.o
|
L_OBJS += src/widget/window.o src/widget/button.o src/widget/frame.o src/widget/menu.o src/widget/submenu.o src/widget/image.o src/widget/scrollbar.o src/widget/checkbox.o src/widget/label.o src/widget/entry.o src/widget/numberentry.o
|
||||||
L_OBJS += src/cursor/default.o src/cursor/cross.o src/cursor/text.o
|
L_OBJS += src/cursor/default.o src/cursor/cross.o src/cursor/text.o
|
||||||
|
|
||||||
OOL_CXXFLAGS = $(DEPINC) $(CFLAGS) -std=c++98 -fPIC
|
OOL_CXXFLAGS = $(DEPINC) $(CFLAGS) -std=c++98 -fPIC
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
CC = cl
|
CC = cl
|
||||||
LD = link
|
LD = link
|
||||||
|
|
||||||
OBJS = src\core.obj src\draw.obj src\default.obj src\lowlevel.obj src\error.obj src\unicode.obj src\font.obj src\boldfont.obj src\widget\button.obj src\widget\frame.obj src\widget\opengl.obj src\widget\window.obj src\widget\menu.obj src\widget\entry.obj src\widget\submenu.obj src\widget\image.obj src\widget\scrollbar.obj src\widget\checkbox.obj src\widget\label.obj src\external\ds.obj src\external\image.obj src\cursor\default.obj src\cursor\cross.obj src\cursor\text.obj src\backend\gdi.obj
|
OBJS = src\core.obj src\draw.obj src\default.obj src\lowlevel.obj src\error.obj src\unicode.obj src\font.obj src\boldfont.obj src\widget\button.obj src\widget\frame.obj src\widget\opengl.obj src\widget\window.obj src\widget\menu.obj src\widget\entry.obj src\widget\submenu.obj src\widget\image.obj src\widget\scrollbar.obj src\widget\checkbox.obj src\widget\label.obj src\widget\numberentry.obj src\external\ds.obj src\external\image.obj src\cursor\default.obj src\cursor\cross.obj src\cursor\text.obj src\backend\gdi.obj
|
||||||
OOOBJS = oosrc\base.obj oosrc\widget\button.obj oosrc\widget\frame.obj oosrc\widget\image.obj oosrc\widget\menu.obj oosrc\widget\opengl.obj oosrc\widget\scrollbar.obj oosrc\widget\submenu.obj oosrc\widget\window.obj oosrc\widget\checkbox.obj oosrc\widget\label.obj oosrc\widget\entry.obj
|
OOOBJS = oosrc\base.obj oosrc\widget\button.obj oosrc\widget\frame.obj oosrc\widget\image.obj oosrc\widget\menu.obj oosrc\widget\opengl.obj oosrc\widget\scrollbar.obj oosrc\widget\submenu.obj oosrc\widget\window.obj oosrc\widget\checkbox.obj oosrc\widget\label.obj oosrc\widget\entry.obj oosrc\widget\numberentry.obj
|
||||||
CFLAGS = /nologo /DSTBI_NO_SIMD /D_MILSKO /DUSE_GDI /DUSE_STB_IMAGE /Iinclude
|
CFLAGS = /nologo /DSTBI_NO_SIMD /D_MILSKO /DUSE_GDI /DUSE_STB_IMAGE /Iinclude
|
||||||
CXXFLAGS = /nologo /Iinclude
|
CXXFLAGS = /nologo /Iinclude
|
||||||
LDFLAGS = /nologo /DLL /LIBPATH:src /LIBPATH:oosrc
|
LDFLAGS = /nologo /DLL /LIBPATH:src /LIBPATH:oosrc
|
||||||
|
|||||||
@@ -164,6 +164,9 @@
|
|||||||
<dd>
|
<dd>
|
||||||
<a href="#Mw_Draw_h__MwTextHeight">MwTextHeight</a>
|
<a href="#Mw_Draw_h__MwTextHeight">MwTextHeight</a>
|
||||||
</dd>
|
</dd>
|
||||||
|
<dd>
|
||||||
|
<a href="#Mw_Draw_h__MwGetColor">MwGetColor</a>
|
||||||
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
<a href="#Mw_Error_h">Mw/Error.h</a>
|
<a href="#Mw_Error_h">Mw/Error.h</a>
|
||||||
</dt>
|
</dt>
|
||||||
@@ -263,6 +266,12 @@
|
|||||||
<dd>
|
<dd>
|
||||||
<a href="#Mw_Widget_Menu_h__MwMenuAdd">MwMenuAdd</a>
|
<a href="#Mw_Widget_Menu_h__MwMenuAdd">MwMenuAdd</a>
|
||||||
</dd>
|
</dd>
|
||||||
|
<dt>
|
||||||
|
<a href="#Mw_Widget_NumberEntry_h">Mw/Widget/NumberEntry.h</a>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
<a href="#Mw_Widget_NumberEntry_h__MwNumberEntryClass">MwNumberEntryClass</a>
|
||||||
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
<a href="#Mw_Widget_OpenGL_h">Mw/Widget/OpenGL.h</a>
|
<a href="#Mw_Widget_OpenGL_h">Mw/Widget/OpenGL.h</a>
|
||||||
</dt>
|
</dt>
|
||||||
@@ -278,9 +287,6 @@
|
|||||||
<dd>
|
<dd>
|
||||||
<a href="#Mw_Widget_OpenGL_h__MwOpenGLSwapBuffer">MwOpenGLSwapBuffer</a>
|
<a href="#Mw_Widget_OpenGL_h__MwOpenGLSwapBuffer">MwOpenGLSwapBuffer</a>
|
||||||
</dd>
|
</dd>
|
||||||
<dd>
|
|
||||||
<a href="#Mw_Widget_OpenGL_h__MwOpenGLSetColor">MwOpenGLSetColor</a>
|
|
||||||
</dd>
|
|
||||||
<dt>
|
<dt>
|
||||||
<a href="#Mw_Widget_ScrollBar_h">Mw/Widget/ScrollBar.h</a>
|
<a href="#Mw_Widget_ScrollBar_h">Mw/Widget/ScrollBar.h</a>
|
||||||
</dt>
|
</dt>
|
||||||
@@ -1577,6 +1583,42 @@
|
|||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<hr>
|
<hr>
|
||||||
|
<pre id="Mw_Draw_h__MwGetColor">MWDECL <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwGetColor</FONT></B> (
|
||||||
|
MwLLColor color,
|
||||||
|
<B><FONT COLOR="#228B22">int</FONT></B>* red,
|
||||||
|
<B><FONT COLOR="#228B22">int</FONT></B>* green,
|
||||||
|
<B><FONT COLOR="#228B22">int</FONT></B>* blue
|
||||||
|
);</pre>
|
||||||
|
<dl>
|
||||||
|
<dd>
|
||||||
|
Get color components.
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
Parameter <code>color</code>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
Color.
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
Parameter <code>red</code>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
Pointer to red color.
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
Parameter <code>green</code>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
Pointer to green color.
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
Parameter <code>blue</code>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
Pointer to blue color.
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<hr>
|
||||||
<h2 align="center" id="Mw_Error_h">Mw/Error.h</h2>
|
<h2 align="center" id="Mw_Error_h">Mw/Error.h</h2>
|
||||||
<dl>
|
<dl>
|
||||||
<dt>
|
<dt>
|
||||||
@@ -1879,6 +1921,20 @@
|
|||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<hr>
|
<hr>
|
||||||
|
<h2 align="center" id="Mw_Widget_NumberEntry_h">Mw/Widget/NumberEntry.h</h2>
|
||||||
|
<dl>
|
||||||
|
<dt>
|
||||||
|
NumberEntry widget.
|
||||||
|
</dt>
|
||||||
|
</dl>
|
||||||
|
<hr>
|
||||||
|
<pre id="Mw_Widget_NumberEntry_h__MwNumberEntryClass">MWDECL MwClass MwNumberEntryClass;</pre>
|
||||||
|
<dl>
|
||||||
|
<dd>
|
||||||
|
NumberEntry widget class.
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<hr>
|
||||||
<h2 align="center" id="Mw_Widget_OpenGL_h">Mw/Widget/OpenGL.h</h2>
|
<h2 align="center" id="Mw_Widget_OpenGL_h">Mw/Widget/OpenGL.h</h2>
|
||||||
<dl>
|
<dl>
|
||||||
<dt>
|
<dt>
|
||||||
@@ -1951,28 +2007,6 @@
|
|||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<hr>
|
<hr>
|
||||||
<pre id="Mw_Widget_OpenGL_h__MwOpenGLSetColor">MWDECL <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwOpenGLSetColor</FONT></B> (
|
|
||||||
MwWidget handle,
|
|
||||||
MwLLColor color
|
|
||||||
);</pre>
|
|
||||||
<dl>
|
|
||||||
<dd>
|
|
||||||
Set color using glColor3f.
|
|
||||||
</dd>
|
|
||||||
<dt>
|
|
||||||
Parameter <code>handle</code>
|
|
||||||
</dt>
|
|
||||||
<dd>
|
|
||||||
Widget.
|
|
||||||
</dd>
|
|
||||||
<dt>
|
|
||||||
Parameter <code>color</code>
|
|
||||||
</dt>
|
|
||||||
<dd>
|
|
||||||
Color.
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
<hr>
|
|
||||||
<h2 align="center" id="Mw_Widget_ScrollBar_h">Mw/Widget/ScrollBar.h</h2>
|
<h2 align="center" id="Mw_Widget_ScrollBar_h">Mw/Widget/ScrollBar.h</h2>
|
||||||
<dl>
|
<dl>
|
||||||
<dt>
|
<dt>
|
||||||
|
|||||||
@@ -29,5 +29,6 @@
|
|||||||
#include <Mw/Widget/Image.h>
|
#include <Mw/Widget/Image.h>
|
||||||
#include <Mw/Widget/Entry.h>
|
#include <Mw/Widget/Entry.h>
|
||||||
#include <Mw/Widget/ScrollBar.h>
|
#include <Mw/Widget/ScrollBar.h>
|
||||||
|
#include <Mw/Widget/NumberEntry.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ typedef struct _MwVoidKeyValue MwVoidKeyValue;
|
|||||||
typedef struct _MwFont MwFont;
|
typedef struct _MwFont MwFont;
|
||||||
typedef struct _MwMenu* MwMenu;
|
typedef struct _MwMenu* MwMenu;
|
||||||
typedef struct _MwCursor MwCursor;
|
typedef struct _MwCursor MwCursor;
|
||||||
|
typedef struct _MwEntry* MwEntry;
|
||||||
#ifdef _MILSKO
|
#ifdef _MILSKO
|
||||||
typedef struct _MwWidget* MwWidget;
|
typedef struct _MwWidget* MwWidget;
|
||||||
#else
|
#else
|
||||||
@@ -100,6 +101,10 @@ struct _MwMenu {
|
|||||||
MwMenu* sub;
|
MwMenu* sub;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct _MwEntry {
|
||||||
|
int cursor;
|
||||||
|
};
|
||||||
|
|
||||||
#define MwCursorDataHeight 16
|
#define MwCursorDataHeight 16
|
||||||
struct _MwCursor {
|
struct _MwCursor {
|
||||||
int width;
|
int width;
|
||||||
|
|||||||
26
include/Mw/Widget/NumberEntry.h
Normal file
26
include/Mw/Widget/NumberEntry.h
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
/* $Id$ */
|
||||||
|
/*!
|
||||||
|
* %file Mw/Widget/NumberEntry.h
|
||||||
|
* %brief NumberEntry widget
|
||||||
|
* %prop MwNtext
|
||||||
|
*/
|
||||||
|
#ifndef __MW_WIDGET_NUMBERENTRY_H__
|
||||||
|
#define __MW_WIDGET_NUMBERENTRY_H__
|
||||||
|
|
||||||
|
#include <Mw/MachDep.h>
|
||||||
|
#include <Mw/TypeDefs.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* %brief NumberEntry widget class
|
||||||
|
*/
|
||||||
|
MWDECL MwClass MwNumberEntryClass;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
20
include/MwOO/Widget/NumberEntry.h
Normal file
20
include/MwOO/Widget/NumberEntry.h
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/* $Id$ */
|
||||||
|
#ifndef __MWOO_WIDGET_NUMBERENTRY_H__
|
||||||
|
#define __MWOO_WIDGET_NUMBERENTRY_H__
|
||||||
|
|
||||||
|
#include <MwOO/Base.h>
|
||||||
|
|
||||||
|
namespace MwOO {
|
||||||
|
class NumberEntry : public MwOO::Base {
|
||||||
|
public:
|
||||||
|
NumberEntry(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h);
|
||||||
|
void SetText(const char* value);
|
||||||
|
const char* GetText(void);
|
||||||
|
void SetBackground(const char* value);
|
||||||
|
const char* GetBackground(void);
|
||||||
|
void SetForeground(const char* value);
|
||||||
|
const char* GetForeground(void);
|
||||||
|
};
|
||||||
|
} // namespace MwOO
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -11,7 +11,6 @@ class OpenGL : public MwOO::Base {
|
|||||||
void MakeCurrent(void);
|
void MakeCurrent(void);
|
||||||
void* GetProcAddress(const char* name);
|
void* GetProcAddress(const char* name);
|
||||||
void SwapBuffer(void);
|
void SwapBuffer(void);
|
||||||
void SetColor(MwLLColor color);
|
|
||||||
void SetBackground(const char* value);
|
void SetBackground(const char* value);
|
||||||
const char* GetBackground(void);
|
const char* GetBackground(void);
|
||||||
void SetForeground(const char* value);
|
void SetForeground(const char* value);
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
OOL_OBJS += oosrc/widget/button.o oosrc/widget/frame.o oosrc/widget/image.o oosrc/widget/menu.o oosrc/widget/scrollbar.o oosrc/widget/submenu.o oosrc/widget/window.o oosrc/widget/checkbox.o oosrc/widget/label.o oosrc/widget/entry.o
|
OOL_OBJS += oosrc/widget/button.o oosrc/widget/frame.o oosrc/widget/image.o oosrc/widget/menu.o oosrc/widget/scrollbar.o oosrc/widget/submenu.o oosrc/widget/window.o oosrc/widget/checkbox.o oosrc/widget/label.o oosrc/widget/entry.o oosrc/widget/numberentry.o
|
||||||
|
|||||||
31
oosrc/widget/numberentry.cc
Normal file
31
oosrc/widget/numberentry.cc
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
/* $Id$ */
|
||||||
|
#include <MwOO/Widget/NumberEntry.h>
|
||||||
|
#include <Mw/Widget/NumberEntry.h>
|
||||||
|
|
||||||
|
MwOO::NumberEntry::NumberEntry(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h) : MwOO::Base(MwNumberEntryClass, widget_name, parent, x, y, w, h){
|
||||||
|
}
|
||||||
|
|
||||||
|
void MwOO::NumberEntry::SetText(const char* value){
|
||||||
|
MwSetText(this->widget, MwNtext, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* MwOO::NumberEntry::GetText(void){
|
||||||
|
return MwGetText(this->widget, MwNtext);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MwOO::NumberEntry::SetBackground(const char* value){
|
||||||
|
MwSetText(this->widget, MwNbackground, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* MwOO::NumberEntry::GetBackground(void){
|
||||||
|
return MwGetText(this->widget, MwNbackground);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MwOO::NumberEntry::SetForeground(const char* value){
|
||||||
|
MwSetText(this->widget, MwNforeground, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* MwOO::NumberEntry::GetForeground(void){
|
||||||
|
return MwGetText(this->widget, MwNforeground);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -14,9 +14,6 @@ void* MwOO::OpenGL::GetProcAddress(const char* name){
|
|||||||
void MwOO::OpenGL::SwapBuffer(void){
|
void MwOO::OpenGL::SwapBuffer(void){
|
||||||
MwOpenGLSwapBuffer(this->widget);
|
MwOpenGLSwapBuffer(this->widget);
|
||||||
}
|
}
|
||||||
void MwOO::OpenGL::SetColor(MwLLColor color){
|
|
||||||
MwOpenGLSetColor(this->widget, color);
|
|
||||||
}
|
|
||||||
void MwOO::OpenGL::SetBackground(const char* value){
|
void MwOO::OpenGL::SetBackground(const char* value){
|
||||||
MwSetText(this->widget, MwNbackground, value);
|
MwSetText(this->widget, MwNbackground, value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
#include <Mw/Milsko.h>
|
#include <Mw/Milsko.h>
|
||||||
|
|
||||||
typedef struct text {
|
|
||||||
int cursor;
|
|
||||||
} text_t;
|
|
||||||
|
|
||||||
static int create(MwWidget handle) {
|
static int create(MwWidget handle) {
|
||||||
text_t* t = malloc(sizeof(*t));
|
MwEntry t = malloc(sizeof(*t));
|
||||||
|
|
||||||
t->cursor = 0;
|
t->cursor = 0;
|
||||||
handle->internal = t;
|
handle->internal = t;
|
||||||
@@ -24,7 +20,7 @@ static void destroy(MwWidget handle) {
|
|||||||
|
|
||||||
static void draw(MwWidget handle) {
|
static void draw(MwWidget handle) {
|
||||||
MwRect r;
|
MwRect r;
|
||||||
text_t* t = handle->internal;
|
MwEntry t = handle->internal;
|
||||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||||
MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||||
const char* str = MwGetText(handle, MwNtext);
|
const char* str = MwGetText(handle, MwNtext);
|
||||||
@@ -79,7 +75,7 @@ static void draw(MwWidget handle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void key(MwWidget handle, int code) {
|
static void key(MwWidget handle, int code) {
|
||||||
text_t* t = handle->internal;
|
MwEntry t = handle->internal;
|
||||||
const char* str = MwGetText(handle, MwNtext);
|
const char* str = MwGetText(handle, MwNtext);
|
||||||
char* out;
|
char* out;
|
||||||
if(str == NULL) str = "";
|
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