mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-10 03:13:28 +00:00
stuff
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@206 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* %file Mw/Widget/Button.h
|
* %file Mw/Widget/Button.h
|
||||||
* %brief Button widget
|
* %brief Button widget
|
||||||
|
* %prop MwNpixmap
|
||||||
*/
|
*/
|
||||||
#ifndef __MW_WIDGET_BUTTON_H__
|
#ifndef __MW_WIDGET_BUTTON_H__
|
||||||
#define __MW_WIDGET_BUTTON_H__
|
#define __MW_WIDGET_BUTTON_H__
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* %file Mw/Widget/Image.h
|
* %file Mw/Widget/Image.h
|
||||||
* %brief Image widget
|
* %brief Image widget
|
||||||
|
* %prop MwNpixmap
|
||||||
*/
|
*/
|
||||||
#ifndef __MW_WIDGET_IMAGE_H__
|
#ifndef __MW_WIDGET_IMAGE_H__
|
||||||
#define __MW_WIDGET_IMAGE_H__
|
#define __MW_WIDGET_IMAGE_H__
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* %file Mw/Widget/ScrollBar.h
|
* %file Mw/Widget/ScrollBar.h
|
||||||
* %brief ScrollBar widget
|
* %brief ScrollBar widget
|
||||||
|
* %prop MwNareaShown MwNvalue MwNminValue MwNmaxValue MwNorientation
|
||||||
*/
|
*/
|
||||||
#ifndef __MW_WIDGET_SCROLLBAR_H__
|
#ifndef __MW_WIDGET_SCROLLBAR_H__
|
||||||
#define __MW_WIDGET_SCROLLBAR_H__
|
#define __MW_WIDGET_SCROLLBAR_H__
|
||||||
|
|||||||
@@ -18,6 +18,14 @@ class Base {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
void Loop(void);
|
void Loop(void);
|
||||||
|
void SetX(int value);
|
||||||
|
void SetY(int value);
|
||||||
|
void SetWidth(int value);
|
||||||
|
void SetHeight(int value);
|
||||||
|
int GetX(void);
|
||||||
|
int GetY(void);
|
||||||
|
int GetWidth(void);
|
||||||
|
int GetHeight(void);
|
||||||
/* BEGIN AUTOGENERATE */
|
/* BEGIN AUTOGENERATE */
|
||||||
virtual void OnActivate(void*) {};
|
virtual void OnActivate(void*) {};
|
||||||
virtual void OnResize(void*) {};
|
virtual void OnResize(void*) {};
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ namespace MwOO {
|
|||||||
class Button : public MwOO::Base {
|
class Button : public MwOO::Base {
|
||||||
public:
|
public:
|
||||||
Button(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h);
|
Button(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h);
|
||||||
|
void SetPixmap(void* value);
|
||||||
|
void* GetPixmap(void);
|
||||||
};
|
};
|
||||||
} // namespace MwOO
|
} // namespace MwOO
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ namespace MwOO {
|
|||||||
class Image : public MwOO::Base {
|
class Image : public MwOO::Base {
|
||||||
public:
|
public:
|
||||||
Image(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h);
|
Image(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h);
|
||||||
|
void SetPixmap(void* value);
|
||||||
|
void* GetPixmap(void);
|
||||||
};
|
};
|
||||||
} // namespace MwOO
|
} // namespace MwOO
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,16 @@ namespace MwOO {
|
|||||||
class ScrollBar : public MwOO::Base {
|
class ScrollBar : public MwOO::Base {
|
||||||
public:
|
public:
|
||||||
ScrollBar(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h);
|
ScrollBar(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h);
|
||||||
|
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);
|
||||||
};
|
};
|
||||||
} // namespace MwOO
|
} // namespace MwOO
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,38 @@ void MwOO::Base::Loop(void){
|
|||||||
MwLoop(this->widget);
|
MwLoop(this->widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MwOO::Base::SetX(int value){
|
||||||
|
MwSetInteger(this->widget, MwNx, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MwOO::Base::SetY(int value){
|
||||||
|
MwSetInteger(this->widget, MwNy, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MwOO::Base::SetWidth(int value){
|
||||||
|
MwSetInteger(this->widget, MwNwidth, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MwOO::Base::SetHeight(int value){
|
||||||
|
MwSetInteger(this->widget, MwNheight, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
int MwOO::Base::GetX(void){
|
||||||
|
return MwGetInteger(this->widget, MwNx);
|
||||||
|
}
|
||||||
|
|
||||||
|
int MwOO::Base::GetY(void){
|
||||||
|
return MwGetInteger(this->widget, MwNy);
|
||||||
|
}
|
||||||
|
|
||||||
|
int MwOO::Base::GetWidth(void){
|
||||||
|
return MwGetInteger(this->widget, MwNwidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
int MwOO::Base::GetHeight(void){
|
||||||
|
return MwGetInteger(this->widget, MwNheight);
|
||||||
|
}
|
||||||
|
|
||||||
/* BEGIN AUTOGENERATE */
|
/* BEGIN AUTOGENERATE */
|
||||||
static void __OnActivate(MwWidget widget, void* user, void* call){
|
static void __OnActivate(MwWidget widget, void* user, void* call){
|
||||||
MwOO::Base* c = (MwOO::Base*)user;
|
MwOO::Base* c = (MwOO::Base*)user;
|
||||||
|
|||||||
@@ -4,3 +4,12 @@
|
|||||||
|
|
||||||
MwOO::Button::Button(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h) : MwOO::Base(MwButtonClass, widget_name, parent, x, y, w, h){
|
MwOO::Button::Button(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h) : MwOO::Base(MwButtonClass, widget_name, parent, x, y, w, h){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MwOO::Button::SetPixmap(void* value){
|
||||||
|
MwSetVoid(this->widget, MwNpixmap, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void* MwOO::Button::GetPixmap(void){
|
||||||
|
return MwGetVoid(this->widget, MwNpixmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,3 +4,4 @@
|
|||||||
|
|
||||||
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){
|
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){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,3 +4,12 @@
|
|||||||
|
|
||||||
MwOO::Image::Image(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h) : MwOO::Base(MwImageClass, widget_name, parent, x, y, w, h){
|
MwOO::Image::Image(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h) : MwOO::Base(MwImageClass, widget_name, parent, x, y, w, h){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MwOO::Image::SetPixmap(void* value){
|
||||||
|
MwSetVoid(this->widget, MwNpixmap, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void* MwOO::Image::GetPixmap(void){
|
||||||
|
return MwGetVoid(this->widget, MwNpixmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,3 +4,4 @@
|
|||||||
|
|
||||||
MwOO::Menu::Menu(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h) : MwOO::Base(MwMenuClass, widget_name, parent, x, y, w, h){
|
MwOO::Menu::Menu(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h) : MwOO::Base(MwMenuClass, widget_name, parent, x, y, w, h){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,3 +4,4 @@
|
|||||||
|
|
||||||
MwOO::OpenGL::OpenGL(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h) : MwOO::Base(MwOpenGLClass, widget_name, parent, x, y, w, h){
|
MwOO::OpenGL::OpenGL(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h) : MwOO::Base(MwOpenGLClass, widget_name, parent, x, y, w, h){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,3 +4,44 @@
|
|||||||
|
|
||||||
MwOO::ScrollBar::ScrollBar(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h) : MwOO::Base(MwScrollBarClass, widget_name, parent, x, y, w, h){
|
MwOO::ScrollBar::ScrollBar(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h) : MwOO::Base(MwScrollBarClass, widget_name, parent, x, y, w, h){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MwOO::ScrollBar::SetAreaShown(int value){
|
||||||
|
MwSetInteger(this->widget, MwNareaShown, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
int MwOO::ScrollBar::GetAreaShown(void){
|
||||||
|
return MwGetInteger(this->widget, MwNareaShown);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MwOO::ScrollBar::SetValue(int value){
|
||||||
|
MwSetInteger(this->widget, MwNvalue, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
int MwOO::ScrollBar::GetValue(void){
|
||||||
|
return MwGetInteger(this->widget, MwNvalue);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MwOO::ScrollBar::SetMinValue(int value){
|
||||||
|
MwSetInteger(this->widget, MwNminValue, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
int MwOO::ScrollBar::GetMinValue(void){
|
||||||
|
return MwGetInteger(this->widget, MwNminValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MwOO::ScrollBar::SetMaxValue(int value){
|
||||||
|
MwSetInteger(this->widget, MwNmaxValue, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
int MwOO::ScrollBar::GetMaxValue(void){
|
||||||
|
return MwGetInteger(this->widget, MwNmaxValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MwOO::ScrollBar::SetOrientation(int value){
|
||||||
|
MwSetInteger(this->widget, MwNorientation, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
int MwOO::ScrollBar::GetOrientation(void){
|
||||||
|
return MwGetInteger(this->widget, MwNorientation);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,3 +4,4 @@
|
|||||||
|
|
||||||
MwOO::SubMenu::SubMenu(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h) : MwOO::Base(MwSubMenuClass, widget_name, parent, x, y, w, h){
|
MwOO::SubMenu::SubMenu(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h) : MwOO::Base(MwSubMenuClass, widget_name, parent, x, y, w, h){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,3 +4,4 @@
|
|||||||
|
|
||||||
MwOO::Vulkan::Vulkan(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h) : MwOO::Base(MwVulkanClass, widget_name, parent, x, y, w, h){
|
MwOO::Vulkan::Vulkan(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h) : MwOO::Base(MwVulkanClass, widget_name, parent, x, y, w, h){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,3 +4,4 @@
|
|||||||
|
|
||||||
MwOO::Window::Window(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h) : MwOO::Base(MwWindowClass, widget_name, parent, x, y, w, h){
|
MwOO::Window::Window(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h) : MwOO::Base(MwWindowClass, widget_name, parent, x, y, w, h){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ my $objs = "";
|
|||||||
|
|
||||||
my $decl = "";
|
my $decl = "";
|
||||||
my @calls = ();
|
my @calls = ();
|
||||||
|
my %ints = ();
|
||||||
|
my %texts = ();
|
||||||
|
my %voids = ();
|
||||||
open(IN, "<", "include/Mw/StringDefs.h");
|
open(IN, "<", "include/Mw/StringDefs.h");
|
||||||
while (my $hl = <IN>) {
|
while (my $hl = <IN>) {
|
||||||
$hl =~ s/\r?\n$//;
|
$hl =~ s/\r?\n$//;
|
||||||
@@ -20,8 +23,17 @@ while (my $hl = <IN>) {
|
|||||||
|
|
||||||
push(@calls, [@c]);
|
push(@calls, [@c]);
|
||||||
}
|
}
|
||||||
|
elsif ($hl =~ /^#define[ \t]+([^ ]+)[ \t]+"I(.+)"$/) {
|
||||||
|
$ints{$1} = uc(substr($2, 0, 1)) . substr($2, 1);
|
||||||
}
|
}
|
||||||
close(HIN);
|
elsif ($hl =~ /^#define[ \t]+([^ ]+)[ \t]+"S(.+)"$/) {
|
||||||
|
$texts{$1} = uc(substr($2, 0, 1)) . substr($2, 1);
|
||||||
|
}
|
||||||
|
elsif ($hl =~ /^#define[ \t]+([^ ]+)[ \t]+"V(.+)"$/) {
|
||||||
|
$voids{$1} = uc(substr($2, 0, 1)) . substr($2, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close(IN);
|
||||||
|
|
||||||
opendir(DIR, "include/Mw/Widget");
|
opendir(DIR, "include/Mw/Widget");
|
||||||
my @files = readdir(DIR);
|
my @files = readdir(DIR);
|
||||||
@@ -33,6 +45,17 @@ foreach my $f (@files) {
|
|||||||
$f =~ /^(.+)\.h$/;
|
$f =~ /^(.+)\.h$/;
|
||||||
|
|
||||||
my $name = $1;
|
my $name = $1;
|
||||||
|
my @props = ();
|
||||||
|
|
||||||
|
open(IN, "include/Mw/Widget/$f");
|
||||||
|
while (my $l = <IN>) {
|
||||||
|
$l =~ s/\r?\n$//g;
|
||||||
|
|
||||||
|
if ($l =~ /%prop[ \t]+(.+)$/) {
|
||||||
|
@props = split(/[ \t]+/, $1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close(IN);
|
||||||
|
|
||||||
open(OUT, ">", "include/MwOO/Widget/$f");
|
open(OUT, ">", "include/MwOO/Widget/$f");
|
||||||
print(OUT "/* \$Id\$ */\n");
|
print(OUT "/* \$Id\$ */\n");
|
||||||
@@ -47,6 +70,27 @@ foreach my $f (@files) {
|
|||||||
print(OUT
|
print(OUT
|
||||||
" ${name}(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h);\n"
|
" ${name}(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h);\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
foreach my $prop (@props) {
|
||||||
|
my $type = "";
|
||||||
|
my %hash = ();
|
||||||
|
if (defined($ints{$prop})) {
|
||||||
|
$type = "int";
|
||||||
|
%hash = %ints;
|
||||||
|
}
|
||||||
|
elsif (defined($texts{$prop})) {
|
||||||
|
$type = "const char*";
|
||||||
|
%hash = %texts;
|
||||||
|
}
|
||||||
|
elsif (defined($voids{$prop})) {
|
||||||
|
$type = "void*";
|
||||||
|
%hash = %voids;
|
||||||
|
}
|
||||||
|
if (length($type) > 0) {
|
||||||
|
print(OUT " void Set" . $hash{$prop} . "($type value);\n");
|
||||||
|
print(OUT " $type Get" . $hash{$prop} . "(void);\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
print(OUT " };\n");
|
print(OUT " };\n");
|
||||||
print(OUT "}\n");
|
print(OUT "}\n");
|
||||||
print(OUT "\n");
|
print(OUT "\n");
|
||||||
@@ -62,6 +106,40 @@ foreach my $f (@files) {
|
|||||||
"MwOO::${name}::${name}(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h) : MwOO::Base(Mw${name}Class, widget_name, parent, x, y, w, h){\n"
|
"MwOO::${name}::${name}(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h) : MwOO::Base(Mw${name}Class, widget_name, parent, x, y, w, h){\n"
|
||||||
);
|
);
|
||||||
print(OUT "}\n");
|
print(OUT "}\n");
|
||||||
|
print(OUT "\n");
|
||||||
|
|
||||||
|
foreach my $prop (@props) {
|
||||||
|
my $type = "";
|
||||||
|
my $typename = "";
|
||||||
|
my %hash = ();
|
||||||
|
if (defined($ints{$prop})) {
|
||||||
|
$type = "int";
|
||||||
|
$typename = "Integer";
|
||||||
|
%hash = %ints;
|
||||||
|
}
|
||||||
|
elsif (defined($texts{$prop})) {
|
||||||
|
$type = "const char*";
|
||||||
|
$typename = "Text";
|
||||||
|
%hash = %texts;
|
||||||
|
}
|
||||||
|
elsif (defined($voids{$prop})) {
|
||||||
|
$type = "void*";
|
||||||
|
$typename = "Void";
|
||||||
|
%hash = %voids;
|
||||||
|
}
|
||||||
|
if (length($type) > 0) {
|
||||||
|
print( OUT "void MwOO::${name}::Set"
|
||||||
|
. $hash{$prop}
|
||||||
|
. "($type value){\n");
|
||||||
|
print(OUT " MwSet$typename(this->widget, $prop, value);\n");
|
||||||
|
print(OUT "}\n");
|
||||||
|
print(OUT "\n");
|
||||||
|
print(OUT "$type MwOO::${name}::Get" . $hash{$prop} . "(void){\n");
|
||||||
|
print(OUT " return MwGet$typename(this->widget, $prop);\n");
|
||||||
|
print(OUT "}\n");
|
||||||
|
print(OUT "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
close(OUT);
|
close(OUT);
|
||||||
|
|
||||||
if (!($name eq 'Vulkan' || $name eq 'OpenGL')) {
|
if (!($name eq 'Vulkan' || $name eq 'OpenGL')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user