add MwNleftPadding and update binding

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@346 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-15 19:05:32 +00:00
parent 39c09b1fb7
commit a0d8161c2e
12 changed files with 71 additions and 3 deletions

View File

@@ -23,6 +23,9 @@
<dd>
<a href="#Mw_Constants_h__MwDEFAULT">MwDEFAULT</a>
</dd>
<dd>
<a href="#Mw_Constants_h__enum_">enum;</a>
</dd>
<dd>
<a href="#Mw_Constants_h__MwMB_ICONMASK">MwMB_ICONMASK</a>
</dd>
@@ -528,6 +531,13 @@
</dd>
</dl>
<hr>
<pre id="Mw_Constants_h__enum_"><B><FONT COLOR="#228B22">enum</FONT></B>;</pre>
<dl>
<dd>
Directory entry type.
</dd>
</dl>
<hr>
<pre id="Mw_Constants_h__MwMB_ICONMASK">#<B><FONT COLOR="#5F9EA0">define</FONT></B> <FONT COLOR="#B8860B">MwMB_ICONMASK</FONT> 0xf</pre>
<dl>
<dd>

View File

@@ -19,6 +19,7 @@
#define MwNalignment "Ialignment"
#define MwNbold "Ibold"
#define MwNmain "Imain"
#define MwNleftPadding "IleftPadding"
#define MwNtitle "Stitle"
#define MwNtext "Stext"

View File

@@ -2,7 +2,7 @@
/*!
* %file Mw/Widget/Label.h
* %brief Label widget
* %prop MwNtext MwNalignment
* %prop MwNtext MwNalignment MwNbold
*/
#ifndef __MW_WIDGET_LABEL_H__
#define __MW_WIDGET_LABEL_H__

View File

@@ -2,6 +2,7 @@
/*!
* %file Mw/Widget/ListBox.h
* %brief ListBox widget
* %prop MwNleftPadding
*/
#ifndef __MW_WIDGET_LISTBOX_H__
#define __MW_WIDGET_LISTBOX_H__

View File

@@ -2,7 +2,7 @@
/*!
* %file Mw/Widget/Window.h
* %brief Window widget
* %prop MwNtitle
* %prop MwNtitle MwNmain MwNiconPixmap MwNsizeHints
*/
#ifndef __MW_WIDGET_WINDOW_H__
#define __MW_WIDGET_WINDOW_H__

View File

@@ -12,6 +12,8 @@ class Label : public MwOO::Base {
const char* GetText(void);
void SetAlignment(int value);
int GetAlignment(void);
void SetBold(int value);
int GetBold(void);
void SetBackground(const char* value);
const char* GetBackground(void);
void SetForeground(const char* value);

View File

@@ -12,6 +12,8 @@ class ListBox : public MwOO::Base {
void InsertMultiple(int index, char** text, int count);
void Delete(int index);
const char* Get(int index);
void SetLeftPadding(int value);
int GetLeftPadding(void);
void SetBackground(const char* value);
const char* GetBackground(void);
void SetForeground(const char* value);

View File

@@ -11,6 +11,12 @@ class Window : public MwOO::Base {
void MakeBorderless(int toggle);
void SetTitle(const char* value);
const char* GetTitle(void);
void SetMain(int value);
int GetMain(void);
void SetIconPixmap(void* value);
void* GetIconPixmap(void);
void SetSizeHints(void* value);
void* GetSizeHints(void);
void SetBackground(const char* value);
const char* GetBackground(void);
void SetForeground(const char* value);

View File

@@ -21,6 +21,14 @@ int MwOO::Label::GetAlignment(void){
return MwGetInteger(this->widget, MwNalignment);
}
void MwOO::Label::SetBold(int value){
MwSetInteger(this->widget, MwNbold, value);
}
int MwOO::Label::GetBold(void){
return MwGetInteger(this->widget, MwNbold);
}
void MwOO::Label::SetBackground(const char* value){
MwSetText(this->widget, MwNbackground, value);
}

View File

@@ -17,6 +17,14 @@ void MwOO::ListBox::Delete(int index){
const char* MwOO::ListBox::Get(int index){
return MwListBoxGet(this->widget, index);
}
void MwOO::ListBox::SetLeftPadding(int value){
MwSetInteger(this->widget, MwNleftPadding, value);
}
int MwOO::ListBox::GetLeftPadding(void){
return MwGetInteger(this->widget, MwNleftPadding);
}
void MwOO::ListBox::SetBackground(const char* value){
MwSetText(this->widget, MwNbackground, value);
}

View File

@@ -16,6 +16,30 @@ const char* MwOO::Window::GetTitle(void){
return MwGetText(this->widget, MwNtitle);
}
void MwOO::Window::SetMain(int value){
MwSetInteger(this->widget, MwNmain, value);
}
int MwOO::Window::GetMain(void){
return MwGetInteger(this->widget, MwNmain);
}
void MwOO::Window::SetIconPixmap(void* value){
MwSetVoid(this->widget, MwNiconPixmap, value);
}
void* MwOO::Window::GetIconPixmap(void){
return MwGetVoid(this->widget, MwNiconPixmap);
}
void MwOO::Window::SetSizeHints(void* value){
MwSetVoid(this->widget, MwNsizeHints, value);
}
void* MwOO::Window::GetSizeHints(void){
return MwGetVoid(this->widget, MwNsizeHints);
}
void MwOO::Window::SetBackground(const char* value){
MwSetText(this->widget, MwNbackground, value);
}

View File

@@ -87,7 +87,7 @@ static void frame_draw(MwWidget handle) {
r.width = MwGetInteger(handle, MwNwidth);
r.height = MwGetInteger(handle, MwNheight);
p.x = MwDefaultBorderWidth;
p.x = MwDefaultBorderWidth + MwGetInteger(handle->parent, MwNleftPadding);
p.y = MwDefaultBorderWidth;
st = get_first_entry(lb);
@@ -167,6 +167,8 @@ static int create(MwWidget handle) {
lb->selected = -1;
lb->click_time = 0;
MwSetInteger(handle, MwNleftPadding, 0);
return 0;
}
@@ -190,6 +192,10 @@ static void draw(MwWidget handle) {
static void prop_change(MwWidget handle, const char* prop) {
if(strcmp(prop, MwNwidth) == 0 || strcmp(prop, MwNheight) == 0) resize(handle);
if(strcmp(prop, MwNleftPadding) == 0) {
MwListBox lb = handle->internal;
MwForceRender(lb->frame);
}
}
MwClassRec MwListBoxClassRec = {