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>
|
<dd>
|
||||||
<a href="#Mw_Draw_h__MwDrawText">MwDrawText</a>
|
<a href="#Mw_Draw_h__MwDrawText">MwDrawText</a>
|
||||||
</dd>
|
</dd>
|
||||||
|
<dd>
|
||||||
|
<a href="#Mw_Draw_h__MwDrawTextEx">MwDrawTextEx</a>
|
||||||
|
</dd>
|
||||||
<dd>
|
<dd>
|
||||||
<a href="#Mw_Draw_h__MwLoadImage">MwLoadImage</a>
|
<a href="#Mw_Draw_h__MwLoadImage">MwLoadImage</a>
|
||||||
</dd>
|
</dd>
|
||||||
@@ -335,6 +338,12 @@
|
|||||||
<dd>
|
<dd>
|
||||||
<a href="#Mw_Widget_ListBox_h__MwListBoxClass">MwListBoxClass</a>
|
<a href="#Mw_Widget_ListBox_h__MwListBoxClass">MwListBoxClass</a>
|
||||||
</dd>
|
</dd>
|
||||||
|
<dd>
|
||||||
|
<a href="#Mw_Widget_ListBox_h__MwListBoxInsert">MwListBoxInsert</a>
|
||||||
|
</dd>
|
||||||
|
<dd>
|
||||||
|
<a href="#Mw_Widget_ListBox_h__MwListBoxDelete">MwListBoxDelete</a>
|
||||||
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
<a href="#Mw_Widget_Menu_h">Mw/Widget/Menu.h</a>
|
<a href="#Mw_Widget_Menu_h">Mw/Widget/Menu.h</a>
|
||||||
</dt>
|
</dt>
|
||||||
@@ -1684,6 +1693,63 @@
|
|||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<hr>
|
<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> (
|
<pre id="Mw_Draw_h__MwLoadImage">MWDECL MwLLPixmap <B><FONT COLOR="#0000FF">MwLoadImage</FONT></B> (
|
||||||
MwWidget handle,
|
MwWidget handle,
|
||||||
<B><FONT COLOR="#228B22">const</FONT></B> <B><FONT COLOR="#228B22">char</FONT></B>* path
|
<B><FONT COLOR="#228B22">const</FONT></B> <B><FONT COLOR="#228B22">char</FONT></B>* path
|
||||||
@@ -2289,6 +2355,57 @@
|
|||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<hr>
|
<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>
|
<h2 align="center" id="Mw_Widget_Menu_h">Mw/Widget/Menu.h</h2>
|
||||||
<dl>
|
<dl>
|
||||||
<dt>
|
<dt>
|
||||||
|
|||||||
@@ -26,6 +26,13 @@ MWDECL MwClass MwListBoxClass;
|
|||||||
*/
|
*/
|
||||||
MWDECL void MwListBoxInsert(MwWidget handle, int index, const char* text);
|
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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ namespace MwOO {
|
|||||||
class ListBox : public MwOO::Base {
|
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 Delete(int index);
|
||||||
void SetBackground(const char* value);
|
void SetBackground(const char* value);
|
||||||
const char* GetBackground(void);
|
const char* GetBackground(void);
|
||||||
void SetForeground(const char* value);
|
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){
|
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){
|
void MwOO::ListBox::SetBackground(const char* value){
|
||||||
MwSetText(this->widget, MwNbackground, 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,20 +20,22 @@ static void vscroll_changed(MwWidget handle, void* user, void* call) {
|
|||||||
static void frame_mouse_down(MwWidget handle, void* user, void* call) {
|
static void frame_mouse_down(MwWidget handle, void* user, void* call) {
|
||||||
MwListBox lb = handle->parent->internal;
|
MwListBox lb = handle->parent->internal;
|
||||||
MwLLMouse* m = call;
|
MwLLMouse* m = call;
|
||||||
int st = 0;
|
if(m->button == MwLLMouseLeft) {
|
||||||
int i;
|
int st = 0;
|
||||||
int y = MwDefaultBorderWidth;
|
int i;
|
||||||
int h = MwGetInteger(handle, MwNheight);
|
int y = MwDefaultBorderWidth;
|
||||||
|
int h = MwGetInteger(handle, MwNheight);
|
||||||
|
|
||||||
st = get_first_entry(lb);
|
st = get_first_entry(lb);
|
||||||
for(i = 0; i < (h - MwDefaultBorderWidth * 2) / MwTextHeight(handle, "M"); i++) {
|
for(i = 0; i < (h - MwDefaultBorderWidth * 2) / MwTextHeight(handle, "M"); i++) {
|
||||||
if(y <= m->point.y && m->point.y <= (y + MwTextHeight(handle, "M"))) {
|
if(y <= m->point.y && m->point.y <= (y + MwTextHeight(handle, "M"))) {
|
||||||
lb->selected = st + i;
|
lb->selected = st + i;
|
||||||
|
}
|
||||||
|
y += MwTextHeight(handle, "M");
|
||||||
}
|
}
|
||||||
y += MwTextHeight(handle, "M");
|
|
||||||
}
|
|
||||||
|
|
||||||
MwForceRender(lb->frame);
|
MwForceRender(lb->frame);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void frame_draw(MwWidget handle) {
|
static void frame_draw(MwWidget handle) {
|
||||||
@@ -107,6 +109,7 @@ static void resize(MwWidget handle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ih = arrlen(lb->list);
|
ih = arrlen(lb->list);
|
||||||
|
if(ih == 0) ih = 1;
|
||||||
|
|
||||||
MwVaApply(lb->vscroll,
|
MwVaApply(lb->vscroll,
|
||||||
MwNareaShown, h / MwTextHeight(handle, "M"),
|
MwNareaShown, h / MwTextHeight(handle, "M"),
|
||||||
@@ -183,3 +186,22 @@ void MwListBoxInsert(MwWidget handle, int index, const char* text) {
|
|||||||
MwForceRender(lb->frame);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||