From c6c3a591f0fcf767c242b326a1a36106e0d592c1 Mon Sep 17 00:00:00 2001 From: NishiOwO Date: Tue, 14 Oct 2025 18:48:06 +0000 Subject: [PATCH] optimize git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@333 b9cfdab3-6d41-4d17-bbe4-086880011989 --- doc/index.html | 39 ++++++++++++++++++++++++++++++++++ include/Mw/Widget/ListBox.h | 9 ++++++++ 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 | 21 ++++++++++++++++++ 11 files changed, 73 insertions(+) diff --git a/doc/index.html b/doc/index.html index 6b253b7..d2f8d75 100644 --- a/doc/index.html +++ b/doc/index.html @@ -341,6 +341,9 @@
MwListBoxInsert
+
+ MwListBoxInsertMultiple +
MwListBoxDelete
@@ -2387,6 +2390,42 @@
+
MWDECL void MwListBoxInsertMultiple (
+	MwWidget handle,
+	int index,
+	char* const* text,
+	int count
+);
+
+
+ Inserts multiple items on the listbox. +
+
+ Parameter handle +
+
+ Widget. +
+
+ Parameter index +
+
+ Index. +
+
+ Parameter text +
+
+ Text. +
+
+ Parameter count +
+
+ Count. +
+
+
MWDECL void MwListBoxDelete (
 	MwWidget handle,
 	int index
diff --git a/include/Mw/Widget/ListBox.h b/include/Mw/Widget/ListBox.h
index 675f737..4ab19b2 100644
--- a/include/Mw/Widget/ListBox.h
+++ b/include/Mw/Widget/ListBox.h
@@ -26,6 +26,15 @@ MWDECL MwClass MwListBoxClass;
  */
 MWDECL void MwListBoxInsert(MwWidget handle, int index, const char* text);
 
+/*!
+ * %brief Inserts multiple items on the listbox
+ * %param handle Widget
+ * %param index Index
+ * %param text Text
+ * %param count Count
+ */
+MWDECL void MwListBoxInsertMultiple(MwWidget handle, int index, char* const* text, int count);
+
 /*!
  * %brief Deletes item from the listbox
  * %param handle Widget
diff --git a/include/MwOO/Widget/ListBox.h b/include/MwOO/Widget/ListBox.h
index 665a37a..fe0b4fc 100644
--- a/include/MwOO/Widget/ListBox.h
+++ b/include/MwOO/Widget/ListBox.h
@@ -9,6 +9,7 @@ class ListBox : public MwOO::Base {
       public:
 	ListBox(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h);
 	void	    Insert(int index, const char* text);
+	void	    InsertMultiple(int index, char* const* text, int count);
 	void	    Delete(int index);
 	const char* Get(int index);
 	void	    SetBackground(const char* value);
diff --git a/oosrc/widget/listbox.cc b/oosrc/widget/listbox.cc
index 47b4561..c78979b 100644
--- a/oosrc/widget/listbox.cc
+++ b/oosrc/widget/listbox.cc
@@ -8,6 +8,9 @@ MwOO::ListBox::ListBox(const char* widget_name, MwOO::Base* parent, int x, int y
 void MwOO::ListBox::Insert(int index, const char* text){
 	MwListBoxInsert(this->widget, index, text);
 }
+void MwOO::ListBox::InsertMultiple(int index, char* const* text, int count){
+	MwListBoxInsertMultiple(this->widget, index, text, count);
+}
 void MwOO::ListBox::Delete(int index){
 	MwListBoxDelete(this->widget, index);
 }
diff --git a/resource/icon/error.png b/resource/icon/error.png
index 9566cab88e1779b42a99a678dda1da44392badb6..3a8d1ba083d96ffb2b8bcbf1b3c10034d3b87cd6 100644
GIT binary patch
delta 45
zcmbQvI-PaG3^sl9N1sz!HqN`pC~abHWooKzU|?lnaHHn@2L>SUboFyt=akR{0CLX{
AjQ{`u

delta 45
zcmbQvI-PaG3^oSUboFyt=akR{0Dh|v
AyZ`_I

delta 45
zcmcb_a*1Wa3^o;hO;(n`jq_$QN*kM58JcPv7+4t?%sRh+I|C4Sy85}Sb4q9e05)L_
AlmGw#

diff --git a/resource/icon/question.png b/resource/icon/question.png
index ecfa227ba7c0d55152e143a1f0e1da21f9598003..abc23f98369716289145063b38d61cab816905d6 100644
GIT binary patch
delta 45
zcmbQpGLdD%BsP7EBA<$>8)w8ZN}HHlnVM-E7+4t?yqt11mjMVoUHx3vIVCg!07}9R
AE&u=k

delta 45
zcmbQpGLdD%BsLX(O;(n`jWgmHrH#$33{ABS46F8)w)vN}HHlnVM-E7+4t?yqt11mjMVoUHx3vIVCg!0B9l(
A&j0`b

delta 45
zcmeyw{E2zOBsLX(O;(n`jWg^SrH#$33{ABS46Finternal;
+	int	  old;
+	if(index == -1) index = arrlen(lb->list);
+	old = index;
+
+	for(i = 0; i < count; i++) {
+		char* str = malloc(strlen(text[i]) + 1);
+		strcpy(str, text[i]);
+
+		arrins(lb->list, index, str);
+		index++;
+	}
+
+	resize(handle);
+	if(old < (MwGetInteger(lb->vscroll, MwNvalue) + MwGetInteger(lb->vscroll, MwNareaShown))) {
+		MwForceRender(lb->frame);
+	}
+}
+
 void MwListBoxDelete(MwWidget handle, int index) {
 	MwListBox lb = handle->internal;