optimize
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@333 b9cfdab3-6d41-4d17-bbe4-086880011989
|
|
@ -341,6 +341,9 @@
|
||||||
<dd>
|
<dd>
|
||||||
<a href="#Mw_Widget_ListBox_h__MwListBoxInsert">MwListBoxInsert</a>
|
<a href="#Mw_Widget_ListBox_h__MwListBoxInsert">MwListBoxInsert</a>
|
||||||
</dd>
|
</dd>
|
||||||
|
<dd>
|
||||||
|
<a href="#Mw_Widget_ListBox_h__MwListBoxInsertMultiple">MwListBoxInsertMultiple</a>
|
||||||
|
</dd>
|
||||||
<dd>
|
<dd>
|
||||||
<a href="#Mw_Widget_ListBox_h__MwListBoxDelete">MwListBoxDelete</a>
|
<a href="#Mw_Widget_ListBox_h__MwListBoxDelete">MwListBoxDelete</a>
|
||||||
</dd>
|
</dd>
|
||||||
|
|
@ -2387,6 +2390,42 @@
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<hr>
|
<hr>
|
||||||
|
<pre id="Mw_Widget_ListBox_h__MwListBoxInsertMultiple">MWDECL <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwListBoxInsertMultiple</FONT></B> (
|
||||||
|
MwWidget handle,
|
||||||
|
<B><FONT COLOR="#228B22">int</FONT></B> index,
|
||||||
|
<B><FONT COLOR="#228B22">char</FONT></B>* <B><FONT COLOR="#228B22">const</FONT></B>* text,
|
||||||
|
<B><FONT COLOR="#228B22">int</FONT></B> count
|
||||||
|
);</pre>
|
||||||
|
<dl>
|
||||||
|
<dd>
|
||||||
|
Inserts multiple items on the listbox.
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
Parameter <code>handle</code>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
Widget.
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
Parameter <code>index</code>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
Index.
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
Parameter <code>text</code>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
Text.
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
Parameter <code>count</code>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
Count.
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<hr>
|
||||||
<pre id="Mw_Widget_ListBox_h__MwListBoxDelete">MWDECL <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwListBoxDelete</FONT></B> (
|
<pre id="Mw_Widget_ListBox_h__MwListBoxDelete">MWDECL <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwListBoxDelete</FONT></B> (
|
||||||
MwWidget handle,
|
MwWidget handle,
|
||||||
<B><FONT COLOR="#228B22">int</FONT></B> index
|
<B><FONT COLOR="#228B22">int</FONT></B> index
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,15 @@ MWDECL MwClass MwListBoxClass;
|
||||||
*/
|
*/
|
||||||
MWDECL void MwListBoxInsert(MwWidget handle, int index, const char* text);
|
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
|
* %brief Deletes item from the listbox
|
||||||
* %param handle Widget
|
* %param handle Widget
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ class ListBox : public MwOO::Base {
|
||||||
public:
|
public:
|
||||||
ListBox(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h);
|
ListBox(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h);
|
||||||
void Insert(int index, const char* text);
|
void Insert(int index, const char* text);
|
||||||
|
void InsertMultiple(int index, char* const* text, int count);
|
||||||
void Delete(int index);
|
void Delete(int index);
|
||||||
const char* Get(int index);
|
const char* Get(int index);
|
||||||
void SetBackground(const char* value);
|
void SetBackground(const char* value);
|
||||||
|
|
|
||||||
|
|
@ -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){
|
void MwOO::ListBox::Insert(int index, const char* text){
|
||||||
MwListBoxInsert(this->widget, index, 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){
|
void MwOO::ListBox::Delete(int index){
|
||||||
MwListBoxDelete(this->widget, index);
|
MwListBoxDelete(this->widget, index);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 663 B After Width: | Height: | Size: 663 B |
|
Before Width: | Height: | Size: 434 B After Width: | Height: | Size: 434 B |
|
Before Width: | Height: | Size: 542 B After Width: | Height: | Size: 542 B |
|
Before Width: | Height: | Size: 594 B After Width: | Height: | Size: 594 B |
|
Before Width: | Height: | Size: 529 B After Width: | Height: | Size: 529 B |
|
Before Width: | Height: | Size: 498 B After Width: | Height: | Size: 498 B |
|
|
@ -193,6 +193,27 @@ void MwListBoxInsert(MwWidget handle, int index, const char* text) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MwListBoxInsertMultiple(MwWidget handle, int index, char* const* text, int count) {
|
||||||
|
int i;
|
||||||
|
MwListBox lb = handle->internal;
|
||||||
|
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) {
|
void MwListBoxDelete(MwWidget handle, int index) {
|
||||||
MwListBox lb = handle->internal;
|
MwListBox lb = handle->internal;
|
||||||
|
|
||||||
|
|
|
||||||