add MwNhideInput

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@531 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-31 17:40:16 +00:00
parent 1e1f9653ea
commit b1abe76aeb
5 changed files with 13 additions and 3 deletions

View File

@@ -26,6 +26,7 @@
#define MwNinverted "Iinverted" #define MwNinverted "Iinverted"
#define MwNmodernLook "ImodernLook" #define MwNmodernLook "ImodernLook"
#define MwNwaitMS "IwaitMS" #define MwNwaitMS "IwaitMS"
#define MwNhideInput "IhideInput"
#define MwNtitle "Stitle" #define MwNtitle "Stitle"
#define MwNtext "Stext" #define MwNtext "Stext"

View File

@@ -62,6 +62,7 @@
<integer name="inverted" /> <integer name="inverted" />
<integer name="modernLook" /> <integer name="modernLook" />
<integer name="waitMS" /> <integer name="waitMS" />
<integer name="hideInput" />
<string name="title" /> <string name="title" />
<string name="text" /> <string name="text" />
@@ -425,6 +426,7 @@
<widget name="Entry"> <widget name="Entry">
<properties> <properties>
<property name="text" /> <property name="text" />
<property name="hideInput" />
</properties> </properties>
</widget> </widget>
<widget name="Frame" /> <widget name="Frame" />

View File

@@ -681,6 +681,8 @@ void MwLLDetach(MwLL handle, MwPoint* point) {
void MwLLShow(MwLL handle, int show) { void MwLLShow(MwLL handle, int show) {
if(show) { if(show) {
XMapWindow(handle->display, handle->window); XMapWindow(handle->display, handle->window);
wait_map(handle);
XSetInputFocus(handle->display, handle->window, RevertToNone, CurrentTime); XSetInputFocus(handle->display, handle->window, RevertToNone, CurrentTime);
} else { } else {
XUnmapWindow(handle->display, handle->window); XUnmapWindow(handle->display, handle->window);

View File

@@ -42,6 +42,7 @@ static void draw(MwWidget handle) {
int i; int i;
int start; int start;
int textlen; int textlen;
int attr;
MwRect currc; MwRect currc;
p.x = (r.width - (r.width / w * w)) / 2; p.x = (r.width - (r.width / w * w)) / 2;
@@ -54,7 +55,11 @@ static void draw(MwWidget handle) {
start = (t->cursor - 1) / len; start = (t->cursor - 1) / len;
start *= len; start *= len;
MwUTF8Copy(str, start, show, 0, len); if((attr = MwGetInteger(handle, MwNhideInput)) == MwDEFAULT || !attr) {
MwUTF8Copy(str, start, show, 0, len);
} else {
for(i = 0; i < MwUTF8Length(str) - start; i++) show[i] = '*';
}
MwDrawText(handle, &p, show, 0, MwALIGNMENT_BEGINNING, text); MwDrawText(handle, &p, show, 0, MwALIGNMENT_BEGINNING, text);
@@ -119,7 +124,7 @@ static void key(MwWidget handle, int code) {
} }
static void prop_change(MwWidget handle, const char* prop) { static void prop_change(MwWidget handle, const char* prop) {
if(strcmp(prop, MwNtext) == 0) MwForceRender(handle); if(strcmp(prop, MwNtext) == 0 || strcmp(prop, MwNhideInput) == 0) MwForceRender(handle);
} }
MwClassRec MwEntryClassRec = { MwClassRec MwEntryClassRec = {

View File

@@ -27,7 +27,7 @@ static void draw(MwWidget handle) {
} }
static void click(MwWidget handle) { static void click(MwWidget handle) {
MwSetInteger(handle, MwNchecked, MwGetInteger(handle, MwNchecked) ? 0 : 1); if(!MwGetInteger(handle, MwNchecked)) MwSetInteger(handle, MwNchecked, 1);
if(MwGetInteger(handle, MwNchecked) && handle->parent != NULL) { if(MwGetInteger(handle, MwNchecked) && handle->parent != NULL) {
int i; int i;
for(i = 0; i < arrlen(handle->parent->children); i++) { for(i = 0; i < arrlen(handle->parent->children); i++) {