From 5834771c753287285df70e6a119b86b07a3e5dda Mon Sep 17 00:00:00 2001 From: NishiOwO Date: Tue, 14 Oct 2025 18:36:31 +0000 Subject: [PATCH] more methods git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@332 b9cfdab3-6d41-4d17-bbe4-086880011989 --- doc/index.html | 31 +++++++++++++++++++++++++++++++ include/Mw/Widget/ListBox.h | 8 ++++++++ include/MwOO/Widget/ListBox.h | 1 + oosrc/widget/listbox.cc | 3 +++ resource/icon/error.png | Bin 663 -> 663 bytes resource/icon/info.png | Bin 434 -> 434 bytes resource/icon/news.png | Bin 542 -> 542 bytes resource/icon/note.png | Bin 594 -> 594 bytes resource/icon/question.png | Bin 529 -> 529 bytes resource/icon/warning.png | Bin 498 -> 498 bytes src/widget/listbox.c | 9 +++++++++ 11 files changed, 52 insertions(+) diff --git a/doc/index.html b/doc/index.html index 0edc75d..6b253b7 100644 --- a/doc/index.html +++ b/doc/index.html @@ -344,6 +344,9 @@
MwListBoxDelete
+
+ MwListBoxGet +
Mw/Widget/Menu.h
@@ -2406,6 +2409,34 @@
+
MWDECL const char* MwListBoxGet (
+	MwWidget handle,
+	int index
+);
+
+
+ Gets item from the listbox. +
+
+ Parameter handle +
+
+ Widget. +
+
+ Parameter index +
+
+ Index. +
+
+ Returns +
+
+ Item. +
+
+

Mw/Widget/Menu.h

diff --git a/include/Mw/Widget/ListBox.h b/include/Mw/Widget/ListBox.h index d152eeb..675f737 100644 --- a/include/Mw/Widget/ListBox.h +++ b/include/Mw/Widget/ListBox.h @@ -33,6 +33,14 @@ MWDECL void MwListBoxInsert(MwWidget handle, int index, const char* text); */ MWDECL void MwListBoxDelete(MwWidget handle, int index); +/*! + * %brief Gets item from the listbox + * %param handle Widget + * %param index Index + * %return Item + */ +MWDECL const char* MwListBoxGet(MwWidget handle, int index); + #ifdef __cplusplus } #endif diff --git a/include/MwOO/Widget/ListBox.h b/include/MwOO/Widget/ListBox.h index 345a09b..665a37a 100644 --- a/include/MwOO/Widget/ListBox.h +++ b/include/MwOO/Widget/ListBox.h @@ -10,6 +10,7 @@ class ListBox : public MwOO::Base { ListBox(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h); void Insert(int index, const char* text); void Delete(int index); + const char* Get(int index); void SetBackground(const char* value); const char* GetBackground(void); void SetForeground(const char* value); diff --git a/oosrc/widget/listbox.cc b/oosrc/widget/listbox.cc index accafbe..47b4561 100644 --- a/oosrc/widget/listbox.cc +++ b/oosrc/widget/listbox.cc @@ -11,6 +11,9 @@ void MwOO::ListBox::Insert(int index, const char* text){ void MwOO::ListBox::Delete(int index){ MwListBoxDelete(this->widget, index); } +const char* MwOO::ListBox::Get(int index){ + return MwListBoxGet(this->widget, index); +} void MwOO::ListBox::SetBackground(const char* value){ MwSetText(this->widget, MwNbackground, value); } diff --git a/resource/icon/error.png b/resource/icon/error.png index bf2726c1473d76a86469e8a79ed604ca4730426e..9566cab88e1779b42a99a678dda1da44392badb6 100644 GIT binary patch delta 48 zcmbQvI-PaGbao*XzBne6;~VGQVU)G7GB&d^G|@INure^P*|CM00SG)@{an^LB{Ts5 DRACK^ delta 48 zcmbQvI-PaGbap{bmE~6@mv5YRhf&tt%D~df*i75Nz{gTe~DWM4f Df6)&& diff --git a/resource/icon/info.png b/resource/icon/info.png index 5b5e0432dbed69bc80bcefa5f753e50a110032f1..8e18420ed752d0762a1f9f83d74590e8ada158fb 100644 GIT binary patch delta 48 zcmdnQyoq^2H@lDuza}e7;KoVJjItJ1#%5NArrHJuRt5&M&hOvO00f?{elF{r5}E)p C#|PC98D%Z3jLobJO|=aStPBiho!`Hm0SG)@{an^LB{Ts5 DIa3XG delta 48 zcmbQoGLL1#M0P<=mE~6@mv5Yr$tY`XWngJ#Y^H5sU}a#iY_``s1|aZs^>bP0l+XkK Dao-Na diff --git a/resource/icon/note.png b/resource/icon/note.png index 0a3f6f0e60ea2e8b1631b3ded03daa97fbf7ebd5..aac84921a7d139f8edc4ce2b38e9e3ebe625a9fe 100644 GIT binary patch delta 48 zcmcb_a*1Wabao*Xeoa=Ez>V{!Gs;?68Jk%dnra&uSQ!}1I=_EA0}yz+`njxgN@xNA DQ}YfO delta 48 zcmcb_a*1Wabap{bmE~6@mv5Xmol(}@%D~df*i75Nz{gTe~DWM4f DjDHVi diff --git a/resource/icon/question.png b/resource/icon/question.png index ae7b994c4d690a359ee6024f62c4e85222060aec..ecfa227ba7c0d55152e143a1f0e1da21f9598003 100644 GIT binary patch delta 48 zcmbQpGLdD%M0Oz+eoa=Ez>PCv7-cQ2jLobJO|=aStPBiho!`Hm0SG)@{an^LB{Ts5 DGVKjd delta 48 zcmbQpGLdD%M0P<=mE~6@mv5XA!zgQRWngJ#Y^H5sU}a#iY_``s1|aZs^>bP0l+XkK DYk3Zx diff --git a/resource/icon/warning.png b/resource/icon/warning.png index 77b11673bc0985a6252aa4c1543d995b18c544a6..d619a8598f37073e17634685d880cadb0f84a1b0 100644 GIT binary patch delta 48 zcmeyw{E2zOM0Oz+eoa=Ez>PC(8D%Z3jLobJO|=aStPBiho!`Hm0SG)@{an^LB{Ts5 DQcn%= delta 48 zcmeyw{E2zOM0P<=mE~6@mv5Y5%P4DZWngJ#Y^H5sU}a#iY_``s1|aZs^>bP0l+XkK DirWu9 diff --git a/src/widget/listbox.c b/src/widget/listbox.c index bf2c290..270c67f 100644 --- a/src/widget/listbox.c +++ b/src/widget/listbox.c @@ -211,3 +211,12 @@ void MwListBoxDelete(MwWidget handle, int index) { MwForceRender(lb->frame); } } + +const char* MwListBoxGet(MwWidget handle, int index) { + MwListBox lb = handle->internal; + + if(index < 0) return NULL; + if(index >= arrlen(lb->list)) return NULL; + + return lb->list[index]; +}