add cursor

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@230 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-08 17:34:14 +00:00
parent d6c787f1a7
commit 795bb2d03f
30 changed files with 350 additions and 33 deletions

View File

@@ -29,7 +29,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
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/text.o
L_OBJS += src/cursor/default.o src/cursor/cross.o
L_OBJS += src/cursor/default.o src/cursor/cross.o src/cursor/text.o
OOL_CXXFLAGS = $(DEPINC) $(CFLAGS) -std=c++98 -fPIC
OOL_LDFLAGS = $(LDFLAGS) -L src

View File

@@ -2,7 +2,7 @@
CC = cl
LD = link
OBJS = src\core.obj src\draw.obj src\default.obj src\lowlevel.obj src\error.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\submenu.obj src\widget\image.obj src\widget\scrollbar.obj src\widget\checkbox.obj src\widget\label.obj src\widget\text.obj src\external\ds.obj src\external\image.obj src\cursor\default.obj src\cursor\cross.obj src\backend\gdi.obj
OBJS = src\core.obj src\draw.obj src\default.obj src\lowlevel.obj src\error.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\submenu.obj src\widget\image.obj src\widget\scrollbar.obj src\widget\checkbox.obj src\widget\label.obj src\widget\text.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\text.obj oosrc\widget\label.obj
CFLAGS = /nologo /DSTBI_NO_SIMD /D_MILSKO /DUSE_GDI /DUSE_STB_IMAGE /Iinclude
CXXFLAGS = /nologo /Iinclude

View File

@@ -34,6 +34,16 @@ MWDECL MwCursor MwCursorCross;
*/
MWDECL MwCursor MwCursorCrossMask;
/*!
* %brief Text cursor
*/
MWDECL MwCursor MwCursorText;
/*!
* %brief Text cursor mask
*/
MWDECL MwCursor MwCursorTextMask;
#ifdef __cplusplus
}
#endif

View File

@@ -12,6 +12,10 @@ class Button : public MwOO::Base {
void* GetPixmap(void);
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

View File

@@ -8,8 +8,12 @@ namespace MwOO {
class CheckBox : public MwOO::Base {
public:
CheckBox(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h);
void SetChecked(int value);
int GetChecked(void);
void SetChecked(int value);
int GetChecked(void);
void SetBackground(const char* value);
const char* GetBackground(void);
void SetForeground(const char* value);
const char* GetForeground(void);
};
} // namespace MwOO

View File

@@ -8,6 +8,10 @@ namespace MwOO {
class Frame : public MwOO::Base {
public:
Frame(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h);
void SetBackground(const char* value);
const char* GetBackground(void);
void SetForeground(const char* value);
const char* GetForeground(void);
};
} // namespace MwOO

View File

@@ -8,8 +8,12 @@ namespace MwOO {
class Image : public MwOO::Base {
public:
Image(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h);
void SetPixmap(void* value);
void* GetPixmap(void);
void SetPixmap(void* value);
void* GetPixmap(void);
void SetBackground(const char* value);
const char* GetBackground(void);
void SetForeground(const char* value);
const char* GetForeground(void);
};
} // namespace MwOO

View File

@@ -12,6 +12,10 @@ class Label : public MwOO::Base {
const char* GetText(void);
void SetAlignment(int value);
int GetAlignment(void);
void SetBackground(const char* value);
const char* GetBackground(void);
void SetForeground(const char* value);
const char* GetForeground(void);
};
} // namespace MwOO

View File

@@ -8,7 +8,11 @@ namespace MwOO {
class Menu : public MwOO::Base {
public:
Menu(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h);
MwMenu Add(MwMenu menu, const char* name);
MwMenu Add(MwMenu menu, const char* name);
void SetBackground(const char* value);
const char* GetBackground(void);
void SetForeground(const char* value);
const char* GetForeground(void);
};
} // namespace MwOO

View File

@@ -8,9 +8,13 @@ namespace MwOO {
class OpenGL : public MwOO::Base {
public:
OpenGL(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h);
void MakeCurrent(void);
void* GetProcAddress(const char* name);
void SwapBuffer(void);
void MakeCurrent(void);
void* GetProcAddress(const char* name);
void SwapBuffer(void);
void SetBackground(const char* value);
const char* GetBackground(void);
void SetForeground(const char* value);
const char* GetForeground(void);
};
} // namespace MwOO

View File

@@ -8,17 +8,21 @@ namespace MwOO {
class ScrollBar : public MwOO::Base {
public:
ScrollBar(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h);
int GetVisibleLength(void);
void SetAreaShown(int value);
int GetAreaShown(void);
void SetValue(int value);
int GetValue(void);
void SetMinValue(int value);
int GetMinValue(void);
void SetMaxValue(int value);
int GetMaxValue(void);
void SetOrientation(int value);
int GetOrientation(void);
int GetVisibleLength(void);
void SetAreaShown(int value);
int GetAreaShown(void);
void SetValue(int value);
int GetValue(void);
void SetMinValue(int value);
int GetMinValue(void);
void SetMaxValue(int value);
int GetMaxValue(void);
void SetOrientation(int value);
int GetOrientation(void);
void SetBackground(const char* value);
const char* GetBackground(void);
void SetForeground(const char* value);
const char* GetForeground(void);
};
} // namespace MwOO

View File

@@ -8,7 +8,11 @@ namespace MwOO {
class SubMenu : public MwOO::Base {
public:
SubMenu(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h);
void Appear(MwMenu menu, MwPoint* point);
void Appear(MwMenu menu, MwPoint* point);
void SetBackground(const char* value);
const char* GetBackground(void);
void SetForeground(const char* value);
const char* GetForeground(void);
};
} // namespace MwOO

View File

@@ -8,8 +8,12 @@ namespace MwOO {
class Text : public MwOO::Base {
public:
Text(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h);
void SetChecked(int value);
int GetChecked(void);
void SetChecked(int value);
int GetChecked(void);
void SetBackground(const char* value);
const char* GetBackground(void);
void SetForeground(const char* value);
const char* GetForeground(void);
};
} // namespace MwOO

View File

@@ -8,11 +8,15 @@ namespace MwOO {
class Vulkan : public MwOO::Base {
public:
Vulkan(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h);
void EnableExtension(void);
void EnableLayer(void);
void Configure(void);
void* GetField(MwVulkanField field, MwErrorEnum* out);
VkBool32 Supported(void);
void EnableExtension(void);
void EnableLayer(void);
void Configure(void);
void* GetField(MwVulkanField field, MwErrorEnum* out);
VkBool32 Supported(void);
void SetBackground(const char* value);
const char* GetBackground(void);
void SetForeground(const char* value);
const char* GetForeground(void);
};
} // namespace MwOO

View File

@@ -10,6 +10,10 @@ class Window : public MwOO::Base {
Window(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h);
void SetTitle(const char* value);
const char* GetTitle(void);
void SetBackground(const char* value);
const char* GetBackground(void);
void SetForeground(const char* value);
const char* GetForeground(void);
};
} // namespace MwOO

View File

@@ -21,3 +21,19 @@ const char* MwOO::Button::GetText(void){
return MwGetText(this->widget, MwNtext);
}
void MwOO::Button::SetBackground(const char* value){
MwSetText(this->widget, MwNbackground, value);
}
const char* MwOO::Button::GetBackground(void){
return MwGetText(this->widget, MwNbackground);
}
void MwOO::Button::SetForeground(const char* value){
MwSetText(this->widget, MwNforeground, value);
}
const char* MwOO::Button::GetForeground(void){
return MwGetText(this->widget, MwNforeground);
}

View File

@@ -13,3 +13,19 @@ int MwOO::CheckBox::GetChecked(void){
return MwGetInteger(this->widget, MwNchecked);
}
void MwOO::CheckBox::SetBackground(const char* value){
MwSetText(this->widget, MwNbackground, value);
}
const char* MwOO::CheckBox::GetBackground(void){
return MwGetText(this->widget, MwNbackground);
}
void MwOO::CheckBox::SetForeground(const char* value){
MwSetText(this->widget, MwNforeground, value);
}
const char* MwOO::CheckBox::GetForeground(void){
return MwGetText(this->widget, MwNforeground);
}

View File

@@ -5,3 +5,19 @@
MwOO::Frame::Frame(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h) : MwOO::Base(MwFrameClass, widget_name, parent, x, y, w, h){
}
void MwOO::Frame::SetBackground(const char* value){
MwSetText(this->widget, MwNbackground, value);
}
const char* MwOO::Frame::GetBackground(void){
return MwGetText(this->widget, MwNbackground);
}
void MwOO::Frame::SetForeground(const char* value){
MwSetText(this->widget, MwNforeground, value);
}
const char* MwOO::Frame::GetForeground(void){
return MwGetText(this->widget, MwNforeground);
}

View File

@@ -13,3 +13,19 @@ void* MwOO::Image::GetPixmap(void){
return MwGetVoid(this->widget, MwNpixmap);
}
void MwOO::Image::SetBackground(const char* value){
MwSetText(this->widget, MwNbackground, value);
}
const char* MwOO::Image::GetBackground(void){
return MwGetText(this->widget, MwNbackground);
}
void MwOO::Image::SetForeground(const char* value){
MwSetText(this->widget, MwNforeground, value);
}
const char* MwOO::Image::GetForeground(void){
return MwGetText(this->widget, MwNforeground);
}

View File

@@ -21,3 +21,19 @@ int MwOO::Label::GetAlignment(void){
return MwGetInteger(this->widget, MwNalignment);
}
void MwOO::Label::SetBackground(const char* value){
MwSetText(this->widget, MwNbackground, value);
}
const char* MwOO::Label::GetBackground(void){
return MwGetText(this->widget, MwNbackground);
}
void MwOO::Label::SetForeground(const char* value){
MwSetText(this->widget, MwNforeground, value);
}
const char* MwOO::Label::GetForeground(void){
return MwGetText(this->widget, MwNforeground);
}

View File

@@ -8,3 +8,19 @@ MwOO::Menu::Menu(const char* widget_name, MwOO::Base* parent, int x, int y, int
MwMenu MwOO::Menu::Add(MwMenu menu, const char* name){
return MwMenuAdd(this->widget, menu, name);
}
void MwOO::Menu::SetBackground(const char* value){
MwSetText(this->widget, MwNbackground, value);
}
const char* MwOO::Menu::GetBackground(void){
return MwGetText(this->widget, MwNbackground);
}
void MwOO::Menu::SetForeground(const char* value){
MwSetText(this->widget, MwNforeground, value);
}
const char* MwOO::Menu::GetForeground(void){
return MwGetText(this->widget, MwNforeground);
}

View File

@@ -14,3 +14,19 @@ void* MwOO::OpenGL::GetProcAddress(const char* name){
void MwOO::OpenGL::SwapBuffer(void){
MwOpenGLSwapBuffer(this->widget);
}
void MwOO::OpenGL::SetBackground(const char* value){
MwSetText(this->widget, MwNbackground, value);
}
const char* MwOO::OpenGL::GetBackground(void){
return MwGetText(this->widget, MwNbackground);
}
void MwOO::OpenGL::SetForeground(const char* value){
MwSetText(this->widget, MwNforeground, value);
}
const char* MwOO::OpenGL::GetForeground(void){
return MwGetText(this->widget, MwNforeground);
}

View File

@@ -48,3 +48,19 @@ int MwOO::ScrollBar::GetOrientation(void){
return MwGetInteger(this->widget, MwNorientation);
}
void MwOO::ScrollBar::SetBackground(const char* value){
MwSetText(this->widget, MwNbackground, value);
}
const char* MwOO::ScrollBar::GetBackground(void){
return MwGetText(this->widget, MwNbackground);
}
void MwOO::ScrollBar::SetForeground(const char* value){
MwSetText(this->widget, MwNforeground, value);
}
const char* MwOO::ScrollBar::GetForeground(void){
return MwGetText(this->widget, MwNforeground);
}

View File

@@ -8,3 +8,19 @@ MwOO::SubMenu::SubMenu(const char* widget_name, MwOO::Base* parent, int x, int y
void MwOO::SubMenu::Appear(MwMenu menu, MwPoint* point){
MwSubMenuAppear(this->widget, menu, point);
}
void MwOO::SubMenu::SetBackground(const char* value){
MwSetText(this->widget, MwNbackground, value);
}
const char* MwOO::SubMenu::GetBackground(void){
return MwGetText(this->widget, MwNbackground);
}
void MwOO::SubMenu::SetForeground(const char* value){
MwSetText(this->widget, MwNforeground, value);
}
const char* MwOO::SubMenu::GetForeground(void){
return MwGetText(this->widget, MwNforeground);
}

View File

@@ -13,3 +13,19 @@ int MwOO::Text::GetChecked(void){
return MwGetInteger(this->widget, MwNchecked);
}
void MwOO::Text::SetBackground(const char* value){
MwSetText(this->widget, MwNbackground, value);
}
const char* MwOO::Text::GetBackground(void){
return MwGetText(this->widget, MwNbackground);
}
void MwOO::Text::SetForeground(const char* value){
MwSetText(this->widget, MwNforeground, value);
}
const char* MwOO::Text::GetForeground(void){
return MwGetText(this->widget, MwNforeground);
}

View File

@@ -20,3 +20,19 @@ void* MwOO::Vulkan::GetField(MwVulkanField field, MwErrorEnum* out){
VkBool32 MwOO::Vulkan::Supported(void){
return MwVulkanSupported(this->widget);
}
void MwOO::Vulkan::SetBackground(const char* value){
MwSetText(this->widget, MwNbackground, value);
}
const char* MwOO::Vulkan::GetBackground(void){
return MwGetText(this->widget, MwNbackground);
}
void MwOO::Vulkan::SetForeground(const char* value){
MwSetText(this->widget, MwNforeground, value);
}
const char* MwOO::Vulkan::GetForeground(void){
return MwGetText(this->widget, MwNforeground);
}

View File

@@ -13,3 +13,19 @@ const char* MwOO::Window::GetTitle(void){
return MwGetText(this->widget, MwNtitle);
}
void MwOO::Window::SetBackground(const char* value){
MwSetText(this->widget, MwNbackground, value);
}
const char* MwOO::Window::GetBackground(void){
return MwGetText(this->widget, MwNbackground);
}
void MwOO::Window::SetForeground(const char* value){
MwSetText(this->widget, MwNforeground, value);
}
const char* MwOO::Window::GetForeground(void){
return MwGetText(this->widget, MwNforeground);
}

66
src/cursor/text.c Normal file
View File

@@ -0,0 +1,66 @@
/* $Id$ */
#include <Mw/Milsko.h>
/**
* Copyright notice:
* Copyright (c) Digital Equipment Corporation,1988. All Rights Reserved.
*/
/**
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notices appear in all copies and
* that both those copyright notices and this permission notice appear
* in supporting documentation, and that the name
* Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the software without
* specific, written prior permission. Digital
* Equipment Corporation makes no representations about the suitability
* of this software for any purpose. It is provided "as is" without
* express or implied warranty.
* DIGITAL EQUIPMENT CORPORATION DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY SPECIAL,
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
* CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
MwCursor MwCursorText = {
7, 16, -3, -7, {
0, /* ....... */
68, /* #...#.. */
40, /* .#.#... */
16, /* ..#.... */
16, /* ..#.... */
16, /* ..#.... */
16, /* ..#.... */
16, /* ..#.... */
16, /* ..#.... */
16, /* ..#.... */
16, /* ..#.... */
16, /* ..#.... */
16, /* ..#.... */
40, /* .#.#... */
68, /* #...#.. */
0 /* ....... */
}};
MwCursor MwCursorTextMask = {
7, 16, -3, -7, {
0, /* ....... */
102, /* ##..##. */
60, /* .####.. */
24, /* ..##... */
24, /* ..##... */
24, /* ..##... */
24, /* ..##... */
24, /* ..##... */
24, /* ..##... */
24, /* ..##... */
24, /* ..##... */
24, /* ..##... */
24, /* ..##... */
60, /* .####.. */
102, /* ##..##. */
0 /* ....... */
}};

View File

@@ -4,6 +4,8 @@
static int create(MwWidget handle) {
MwSetDefault(handle);
MwLLSetCursor(handle->lowlevel, &MwCursorText, &MwCursorTextMask);
return 0;
}

View File

@@ -1,10 +1,6 @@
#!/usr/bin/env perl
# $Id$
use Config::Tiny;
my $conf = Config::Tiny->read("resource/widget.ini");
my $objs = "";
my $decl = "";
@@ -89,6 +85,9 @@ foreach my $f (@files) {
}
close(IN);
push(@props, "MwNbackground");
push(@props, "MwNforeground");
open(OUT, ">", "include/MwOO/Widget/$f");
print(OUT "/* \$Id\$ */\n");
print(OUT "#ifndef __MWOO_WIDGET_" . uc($name) . "_H__\n");