From a0d8161c2e10b8ec425b88b5d43b00bcca9e6e86 Mon Sep 17 00:00:00 2001 From: NishiOwO Date: Wed, 15 Oct 2025 19:05:32 +0000 Subject: [PATCH] add MwNleftPadding and update binding git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@346 b9cfdab3-6d41-4d17-bbe4-086880011989 --- doc/index.html | 10 ++++++++++ include/Mw/StringDefs.h | 1 + include/Mw/Widget/Label.h | 2 +- include/Mw/Widget/ListBox.h | 1 + include/Mw/Widget/Window.h | 2 +- include/MwOO/Widget/Label.h | 2 ++ include/MwOO/Widget/ListBox.h | 2 ++ include/MwOO/Widget/Window.h | 6 ++++++ oosrc/widget/label.cc | 8 ++++++++ oosrc/widget/listbox.cc | 8 ++++++++ oosrc/widget/window.cc | 24 ++++++++++++++++++++++++ src/widget/listbox.c | 8 +++++++- 12 files changed, 71 insertions(+), 3 deletions(-) diff --git a/doc/index.html b/doc/index.html index 4da1602..dc1ed40 100644 --- a/doc/index.html +++ b/doc/index.html @@ -23,6 +23,9 @@
MwDEFAULT
+
+ enum; +
MwMB_ICONMASK
@@ -528,6 +531,13 @@
+
enum;
+
+
+ Directory entry type. +
+
+
#define MwMB_ICONMASK 0xf
diff --git a/include/Mw/StringDefs.h b/include/Mw/StringDefs.h index 1d55809..69bb258 100644 --- a/include/Mw/StringDefs.h +++ b/include/Mw/StringDefs.h @@ -19,6 +19,7 @@ #define MwNalignment "Ialignment" #define MwNbold "Ibold" #define MwNmain "Imain" +#define MwNleftPadding "IleftPadding" #define MwNtitle "Stitle" #define MwNtext "Stext" diff --git a/include/Mw/Widget/Label.h b/include/Mw/Widget/Label.h index a1a31b9..59e1138 100644 --- a/include/Mw/Widget/Label.h +++ b/include/Mw/Widget/Label.h @@ -2,7 +2,7 @@ /*! * %file Mw/Widget/Label.h * %brief Label widget - * %prop MwNtext MwNalignment + * %prop MwNtext MwNalignment MwNbold */ #ifndef __MW_WIDGET_LABEL_H__ #define __MW_WIDGET_LABEL_H__ diff --git a/include/Mw/Widget/ListBox.h b/include/Mw/Widget/ListBox.h index 8cf2cee..5ac6182 100644 --- a/include/Mw/Widget/ListBox.h +++ b/include/Mw/Widget/ListBox.h @@ -2,6 +2,7 @@ /*! * %file Mw/Widget/ListBox.h * %brief ListBox widget + * %prop MwNleftPadding */ #ifndef __MW_WIDGET_LISTBOX_H__ #define __MW_WIDGET_LISTBOX_H__ diff --git a/include/Mw/Widget/Window.h b/include/Mw/Widget/Window.h index abc7e69..91f8160 100644 --- a/include/Mw/Widget/Window.h +++ b/include/Mw/Widget/Window.h @@ -2,7 +2,7 @@ /*! * %file Mw/Widget/Window.h * %brief Window widget - * %prop MwNtitle + * %prop MwNtitle MwNmain MwNiconPixmap MwNsizeHints */ #ifndef __MW_WIDGET_WINDOW_H__ #define __MW_WIDGET_WINDOW_H__ diff --git a/include/MwOO/Widget/Label.h b/include/MwOO/Widget/Label.h index 96c93bd..3da9c5c 100644 --- a/include/MwOO/Widget/Label.h +++ b/include/MwOO/Widget/Label.h @@ -12,6 +12,8 @@ class Label : public MwOO::Base { const char* GetText(void); void SetAlignment(int value); int GetAlignment(void); + void SetBold(int value); + int GetBold(void); void SetBackground(const char* value); const char* GetBackground(void); void SetForeground(const char* value); diff --git a/include/MwOO/Widget/ListBox.h b/include/MwOO/Widget/ListBox.h index 66a8e28..5a3b345 100644 --- a/include/MwOO/Widget/ListBox.h +++ b/include/MwOO/Widget/ListBox.h @@ -12,6 +12,8 @@ class ListBox : public MwOO::Base { void InsertMultiple(int index, char** text, int count); void Delete(int index); const char* Get(int index); + void SetLeftPadding(int value); + int GetLeftPadding(void); void SetBackground(const char* value); const char* GetBackground(void); void SetForeground(const char* value); diff --git a/include/MwOO/Widget/Window.h b/include/MwOO/Widget/Window.h index a248028..4135ffa 100644 --- a/include/MwOO/Widget/Window.h +++ b/include/MwOO/Widget/Window.h @@ -11,6 +11,12 @@ class Window : public MwOO::Base { void MakeBorderless(int toggle); void SetTitle(const char* value); const char* GetTitle(void); + void SetMain(int value); + int GetMain(void); + void SetIconPixmap(void* value); + void* GetIconPixmap(void); + void SetSizeHints(void* value); + void* GetSizeHints(void); void SetBackground(const char* value); const char* GetBackground(void); void SetForeground(const char* value); diff --git a/oosrc/widget/label.cc b/oosrc/widget/label.cc index 21b8618..506fa9e 100644 --- a/oosrc/widget/label.cc +++ b/oosrc/widget/label.cc @@ -21,6 +21,14 @@ int MwOO::Label::GetAlignment(void){ return MwGetInteger(this->widget, MwNalignment); } +void MwOO::Label::SetBold(int value){ + MwSetInteger(this->widget, MwNbold, value); +} + +int MwOO::Label::GetBold(void){ + return MwGetInteger(this->widget, MwNbold); +} + void MwOO::Label::SetBackground(const char* value){ MwSetText(this->widget, MwNbackground, value); } diff --git a/oosrc/widget/listbox.cc b/oosrc/widget/listbox.cc index d7b0fe9..b4236d3 100644 --- a/oosrc/widget/listbox.cc +++ b/oosrc/widget/listbox.cc @@ -17,6 +17,14 @@ void MwOO::ListBox::Delete(int index){ const char* MwOO::ListBox::Get(int index){ return MwListBoxGet(this->widget, index); } +void MwOO::ListBox::SetLeftPadding(int value){ + MwSetInteger(this->widget, MwNleftPadding, value); +} + +int MwOO::ListBox::GetLeftPadding(void){ + return MwGetInteger(this->widget, MwNleftPadding); +} + void MwOO::ListBox::SetBackground(const char* value){ MwSetText(this->widget, MwNbackground, value); } diff --git a/oosrc/widget/window.cc b/oosrc/widget/window.cc index 3d215f1..e1caa99 100644 --- a/oosrc/widget/window.cc +++ b/oosrc/widget/window.cc @@ -16,6 +16,30 @@ const char* MwOO::Window::GetTitle(void){ return MwGetText(this->widget, MwNtitle); } +void MwOO::Window::SetMain(int value){ + MwSetInteger(this->widget, MwNmain, value); +} + +int MwOO::Window::GetMain(void){ + return MwGetInteger(this->widget, MwNmain); +} + +void MwOO::Window::SetIconPixmap(void* value){ + MwSetVoid(this->widget, MwNiconPixmap, value); +} + +void* MwOO::Window::GetIconPixmap(void){ + return MwGetVoid(this->widget, MwNiconPixmap); +} + +void MwOO::Window::SetSizeHints(void* value){ + MwSetVoid(this->widget, MwNsizeHints, value); +} + +void* MwOO::Window::GetSizeHints(void){ + return MwGetVoid(this->widget, MwNsizeHints); +} + void MwOO::Window::SetBackground(const char* value){ MwSetText(this->widget, MwNbackground, value); } diff --git a/src/widget/listbox.c b/src/widget/listbox.c index 2eee743..a51f995 100644 --- a/src/widget/listbox.c +++ b/src/widget/listbox.c @@ -87,7 +87,7 @@ static void frame_draw(MwWidget handle) { r.width = MwGetInteger(handle, MwNwidth); r.height = MwGetInteger(handle, MwNheight); - p.x = MwDefaultBorderWidth; + p.x = MwDefaultBorderWidth + MwGetInteger(handle->parent, MwNleftPadding); p.y = MwDefaultBorderWidth; st = get_first_entry(lb); @@ -167,6 +167,8 @@ static int create(MwWidget handle) { lb->selected = -1; lb->click_time = 0; + MwSetInteger(handle, MwNleftPadding, 0); + return 0; } @@ -190,6 +192,10 @@ static void draw(MwWidget handle) { static void prop_change(MwWidget handle, const char* prop) { if(strcmp(prop, MwNwidth) == 0 || strcmp(prop, MwNheight) == 0) resize(handle); + if(strcmp(prop, MwNleftPadding) == 0) { + MwListBox lb = handle->internal; + MwForceRender(lb->frame); + } } MwClassRec MwListBoxClassRec = {