more methods
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@330 b9cfdab3-6d41-4d17-bbe4-086880011989
117
doc/index.html
@@ -188,6 +188,9 @@
|
||||
<dd>
|
||||
<a href="#Mw_Draw_h__MwDrawText">MwDrawText</a>
|
||||
</dd>
|
||||
<dd>
|
||||
<a href="#Mw_Draw_h__MwDrawTextEx">MwDrawTextEx</a>
|
||||
</dd>
|
||||
<dd>
|
||||
<a href="#Mw_Draw_h__MwLoadImage">MwLoadImage</a>
|
||||
</dd>
|
||||
@@ -335,6 +338,12 @@
|
||||
<dd>
|
||||
<a href="#Mw_Widget_ListBox_h__MwListBoxClass">MwListBoxClass</a>
|
||||
</dd>
|
||||
<dd>
|
||||
<a href="#Mw_Widget_ListBox_h__MwListBoxInsert">MwListBoxInsert</a>
|
||||
</dd>
|
||||
<dd>
|
||||
<a href="#Mw_Widget_ListBox_h__MwListBoxDelete">MwListBoxDelete</a>
|
||||
</dd>
|
||||
<dt>
|
||||
<a href="#Mw_Widget_Menu_h">Mw/Widget/Menu.h</a>
|
||||
</dt>
|
||||
@@ -1684,6 +1693,63 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Draw_h__MwDrawTextEx">MWDECL <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwDrawTextEx</FONT></B> (
|
||||
MwWidget handle,
|
||||
MwPoint* point,
|
||||
<B><FONT COLOR="#228B22">const</FONT></B> <B><FONT COLOR="#228B22">char</FONT></B>* text,
|
||||
<B><FONT COLOR="#228B22">int</FONT></B> bold,
|
||||
<B><FONT COLOR="#228B22">int</FONT></B> align,
|
||||
MwLLColor color,
|
||||
MwLLColor bgcolor
|
||||
);</pre>
|
||||
<dl>
|
||||
<dd>
|
||||
Draws a text.
|
||||
</dd>
|
||||
<dt>
|
||||
Parameter <code>handle</code>
|
||||
</dt>
|
||||
<dd>
|
||||
Widget.
|
||||
</dd>
|
||||
<dt>
|
||||
Parameter <code>point</code>
|
||||
</dt>
|
||||
<dd>
|
||||
Center point of the text.
|
||||
</dd>
|
||||
<dt>
|
||||
Parameter <code>text</code>
|
||||
</dt>
|
||||
<dd>
|
||||
Text.
|
||||
</dd>
|
||||
<dt>
|
||||
Parameter <code>bold</code>
|
||||
</dt>
|
||||
<dd>
|
||||
Bold.
|
||||
</dd>
|
||||
<dt>
|
||||
Parameter <code>align</code>
|
||||
</dt>
|
||||
<dd>
|
||||
Align.
|
||||
</dd>
|
||||
<dt>
|
||||
Parameter <code>color</code>
|
||||
</dt>
|
||||
<dd>
|
||||
Color.
|
||||
</dd>
|
||||
<dt>
|
||||
Parameter <code>bgcolor</code>
|
||||
</dt>
|
||||
<dd>
|
||||
Background color.
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Draw_h__MwLoadImage">MWDECL MwLLPixmap <B><FONT COLOR="#0000FF">MwLoadImage</FONT></B> (
|
||||
MwWidget handle,
|
||||
<B><FONT COLOR="#228B22">const</FONT></B> <B><FONT COLOR="#228B22">char</FONT></B>* path
|
||||
@@ -2289,6 +2355,57 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Widget_ListBox_h__MwListBoxInsert">MWDECL <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwListBoxInsert</FONT></B> (
|
||||
MwWidget handle,
|
||||
<B><FONT COLOR="#228B22">int</FONT></B> index,
|
||||
<B><FONT COLOR="#228B22">const</FONT></B> <B><FONT COLOR="#228B22">char</FONT></B>* text
|
||||
);</pre>
|
||||
<dl>
|
||||
<dd>
|
||||
Inserts item 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>
|
||||
</dl>
|
||||
<hr>
|
||||
<pre id="Mw_Widget_ListBox_h__MwListBoxDelete">MWDECL <B><FONT COLOR="#228B22">void</FONT></B> <B><FONT COLOR="#0000FF">MwListBoxDelete</FONT></B> (
|
||||
MwWidget handle,
|
||||
<B><FONT COLOR="#228B22">int</FONT></B> index
|
||||
);</pre>
|
||||
<dl>
|
||||
<dd>
|
||||
Deletes item from the listbox.
|
||||
</dd>
|
||||
<dt>
|
||||
Parameter <code>handle</code>
|
||||
</dt>
|
||||
<dd>
|
||||
Widget.
|
||||
</dd>
|
||||
<dt>
|
||||
Parameter <code>index</code>
|
||||
</dt>
|
||||
<dd>
|
||||
Index.
|
||||
</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<h2 align="center" id="Mw_Widget_Menu_h">Mw/Widget/Menu.h</h2>
|
||||
<dl>
|
||||
<dt>
|
||||
|
||||
@@ -26,6 +26,13 @@ MWDECL MwClass MwListBoxClass;
|
||||
*/
|
||||
MWDECL void MwListBoxInsert(MwWidget handle, int index, const char* text);
|
||||
|
||||
/*!
|
||||
* %brief Deletes item from the listbox
|
||||
* %param handle Widget
|
||||
* %param index Index
|
||||
*/
|
||||
MWDECL void MwListBoxDelete(MwWidget handle, int index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -8,6 +8,8 @@ namespace MwOO {
|
||||
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 Delete(int index);
|
||||
void SetBackground(const char* value);
|
||||
const char* GetBackground(void);
|
||||
void SetForeground(const char* value);
|
||||
|
||||
@@ -5,6 +5,12 @@
|
||||
MwOO::ListBox::ListBox(const char* widget_name, MwOO::Base* parent, int x, int y, int w, int h) : MwOO::Base(MwListBoxClass, widget_name, parent, x, y, w, h){
|
||||
}
|
||||
|
||||
void MwOO::ListBox::Insert(int index, const char* text){
|
||||
MwListBoxInsert(this->widget, index, text);
|
||||
}
|
||||
void MwOO::ListBox::Delete(int index){
|
||||
MwListBoxDelete(this->widget, index);
|
||||
}
|
||||
void MwOO::ListBox::SetBackground(const char* value){
|
||||
MwSetText(this->widget, MwNbackground, value);
|
||||
}
|
||||
|
||||
|
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 |
@@ -20,6 +20,7 @@ static void vscroll_changed(MwWidget handle, void* user, void* call) {
|
||||
static void frame_mouse_down(MwWidget handle, void* user, void* call) {
|
||||
MwListBox lb = handle->parent->internal;
|
||||
MwLLMouse* m = call;
|
||||
if(m->button == MwLLMouseLeft) {
|
||||
int st = 0;
|
||||
int i;
|
||||
int y = MwDefaultBorderWidth;
|
||||
@@ -34,6 +35,7 @@ static void frame_mouse_down(MwWidget handle, void* user, void* call) {
|
||||
}
|
||||
|
||||
MwForceRender(lb->frame);
|
||||
}
|
||||
}
|
||||
|
||||
static void frame_draw(MwWidget handle) {
|
||||
@@ -107,6 +109,7 @@ static void resize(MwWidget handle) {
|
||||
}
|
||||
|
||||
ih = arrlen(lb->list);
|
||||
if(ih == 0) ih = 1;
|
||||
|
||||
MwVaApply(lb->vscroll,
|
||||
MwNareaShown, h / MwTextHeight(handle, "M"),
|
||||
@@ -183,3 +186,22 @@ void MwListBoxInsert(MwWidget handle, int index, const char* text) {
|
||||
MwForceRender(lb->frame);
|
||||
}
|
||||
}
|
||||
|
||||
void MwListBoxDelete(MwWidget handle, int index) {
|
||||
MwListBox lb = handle->internal;
|
||||
|
||||
if(index == -1) index = arrlen(lb->list) - 1;
|
||||
arrdel(lb->list, index);
|
||||
|
||||
if(lb->selected >= arrlen(lb->list)) {
|
||||
lb->selected = arrlen(lb->list) - 1;
|
||||
}
|
||||
if(lb->selected < 0) {
|
||||
lb->selected = -1;
|
||||
}
|
||||
|
||||
resize(handle);
|
||||
if(index < (MwGetInteger(lb->vscroll, MwNvalue) + MwGetInteger(lb->vscroll, MwNareaShown))) {
|
||||
MwForceRender(lb->frame);
|
||||
}
|
||||
}
|
||||
|
||||