MwSetVoid/MwGetVoid to Pointer
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
This commit is contained in:
parent
e591577801
commit
845be77805
19 changed files with 42 additions and 42 deletions
|
|
@ -118,7 +118,7 @@ static MwWidget frame(const char* name, int width, int height, MwClass cl, ...)
|
|||
MwAddUserHandler(frame, MwNresizeHandler, resize_content, NULL);
|
||||
|
||||
MwVaApply(f,
|
||||
"VhandledWidget", w,
|
||||
"PhandledWidget", w,
|
||||
MwNcolumnSpan, MwGetInteger(w, MwNcolumnSpan),
|
||||
MwNrowSpan, MwGetInteger(w, MwNrowSpan),
|
||||
NULL);
|
||||
|
|
@ -132,7 +132,7 @@ static MwWidget frame(const char* name, int width, int height, MwClass cl, ...)
|
|||
}
|
||||
|
||||
static MwWidget child(MwWidget w) {
|
||||
return MwGetVoid(w, "VhandledWidget");
|
||||
return MwGetPointer(w, "PhandledWidget");
|
||||
}
|
||||
|
||||
static void MWAPI menu_handler(MwWidget handle, void* user, void* call) {
|
||||
|
|
|
|||
|
|
@ -162,12 +162,12 @@ MWDECL void MWAPI MwSetInteger(MwWidget handle, const char* key, int n);
|
|||
MWDECL void MWAPI MwSetText(MwWidget handle, const char* key, const char* value);
|
||||
|
||||
/*!
|
||||
* @brief Sets a void pointer property
|
||||
* @brief Sets a pointer property
|
||||
* @param handle Widget
|
||||
* @param key Key
|
||||
* @param value Value
|
||||
*/
|
||||
MWDECL void MWAPI MwSetVoid(MwWidget handle, const char* key, void* value);
|
||||
MWDECL void MWAPI MwSetPointer(MwWidget handle, const char* key, void* value);
|
||||
|
||||
/*!
|
||||
* @brief Gets the integer property
|
||||
|
|
@ -186,12 +186,12 @@ MWDECL int MWAPI MwGetInteger(MwWidget handle, const char* key);
|
|||
MWDECL const char* MWAPI MwGetText(MwWidget handle, const char* key);
|
||||
|
||||
/*!
|
||||
* @brief Gets the void pointer property
|
||||
* @brief Gets the pointer property
|
||||
* @param handle Widget
|
||||
* @param key Key
|
||||
* @return Value
|
||||
*/
|
||||
MWDECL void* MWAPI MwGetVoid(MwWidget handle, const char* key);
|
||||
MWDECL void* MWAPI MwGetPointer(MwWidget handle, const char* key);
|
||||
|
||||
/*!
|
||||
* @brief Sets the default property
|
||||
|
|
|
|||
|
|
@ -72,16 +72,16 @@
|
|||
|
||||
#define MwNvulkanExtension "SEvulkanExtension"
|
||||
#define MwNvulkanLayer "SEvulkanLayer"
|
||||
#define MwNvulkanConfig "VEvulkanConfig"
|
||||
#define MwNvulkanConfig "PEvulkanConfig"
|
||||
|
||||
#define MwNpixmap "Vpixmap"
|
||||
#define MwNiconPixmap "ViconPixmap"
|
||||
#define MwNsizeHints "VsizeHints"
|
||||
#define MwNfont "Vfont"
|
||||
#define MwNboldFont "VboldFont"
|
||||
#define MwNbackgroundPixmap "VbackgroundPixmap"
|
||||
#define MwNmonospaceFont "VmonospaceFont"
|
||||
#define MwNboldMonospaceFont "VboldMonospaceFont"
|
||||
#define MwNpixmap "Ppixmap"
|
||||
#define MwNiconPixmap "PiconPixmap"
|
||||
#define MwNsizeHints "PsizeHints"
|
||||
#define MwNfont "Pfont"
|
||||
#define MwNboldFont "PboldFont"
|
||||
#define MwNbackgroundPixmap "PbackgroundPixmap"
|
||||
#define MwNmonospaceFont "PmonospaceFont"
|
||||
#define MwNboldMonospaceFont "PboldMonospaceFont"
|
||||
|
||||
#define MwNactivateHandler "Cactivate"
|
||||
#define MwNlistBoxActivateHandler "ClistBoxActivate"
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@
|
|||
Integer properties must be prefixed with I.
|
||||
String properties must be prefixed with S.
|
||||
Handler properties must be prefixed with C.
|
||||
Other properties must be prefixed with V.
|
||||
Other properties must be prefixed with P.
|
||||
|
||||
"Early" properties must have letter "E" as 2nd letter.
|
||||
e.g. vulkanExtension would be SEvulkanExtension
|
||||
|
|
@ -383,7 +383,7 @@
|
|||
<string name="value" />
|
||||
</arguments>
|
||||
</function>
|
||||
<function name="MwSetVoid">
|
||||
<function name="MwSetPointer">
|
||||
<arguments>
|
||||
<widget name="handle" />
|
||||
<string name="key" />
|
||||
|
|
@ -408,7 +408,7 @@
|
|||
<string name="key" />
|
||||
</arguments>
|
||||
</function>
|
||||
<function name="MwGetVoid">
|
||||
<function name="MwGePointer">
|
||||
<return>
|
||||
<pointer />
|
||||
</return>
|
||||
|
|
|
|||
10
src/core.c
10
src/core.c
|
|
@ -745,7 +745,7 @@ void MwSetText(MwWidget handle, const char* key, const char* value) {
|
|||
}
|
||||
}
|
||||
|
||||
void MwSetVoid(MwWidget handle, const char* key, void* value) {
|
||||
void MwSetPointer(MwWidget handle, const char* key, void* value) {
|
||||
if(IsFirstVisible(handle) && strcmp(key, MwNiconPixmap) == 0) {
|
||||
MwLLSetIcon(handle->lowlevel, value);
|
||||
} else if(strcmp(key, MwNsizeHints) == 0) {
|
||||
|
|
@ -851,14 +851,14 @@ const char* MwGetText(MwWidget handle, const char* key) {
|
|||
static void* inherit_void(MwWidget handle, const char* key) {
|
||||
void* v;
|
||||
|
||||
if(handle->parent != NULL && (v = MwGetVoid(handle->parent, key)) != NULL) {
|
||||
if(handle->parent != NULL && (v = MwGetPointer(handle->parent, key)) != NULL) {
|
||||
return v;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
void* MwGetVoid(MwWidget handle, const char* key) {
|
||||
void* MwGetPointer(MwWidget handle, const char* key) {
|
||||
void* v = shget(handle->data, key);
|
||||
|
||||
if(v != NULL) return v;
|
||||
|
|
@ -936,10 +936,10 @@ static void MwVaListApply_Internal(MwWidget handle, va_list va, int only_early)
|
|||
if(only_early && key[1] != 'E') continue;
|
||||
|
||||
MwAddUserHandler(handle, key, h, NULL);
|
||||
} else if(key[0] == 'V') {
|
||||
} else if(key[0] == 'P') {
|
||||
void* v = va_arg(va, void*);
|
||||
if(only_early && key[1] != 'E') continue;
|
||||
MwSetVoid(handle, key, v);
|
||||
MwSetPointer(handle, key, v);
|
||||
}
|
||||
}
|
||||
if(x != MwDEFAULT && y != MwDEFAULT) {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ static void spawn_button(MwWidget handle, int x, int y, int id, const char* text
|
|||
static void messagebox_destroy_inject(MwWidget handle) {
|
||||
void* px;
|
||||
|
||||
if((px = MwGetVoid(handle, MwNpixmap)) != NULL) MwDestroyPixmap(px);
|
||||
if((px = MwGetPointer(handle, MwNpixmap)) != NULL) MwDestroyPixmap(px);
|
||||
}
|
||||
|
||||
static void MWAPI messagebox_close(MwWidget handle, void* user, void* call) {
|
||||
|
|
@ -109,7 +109,7 @@ MwWidget MwMessageBox(MwWidget handle, const char* text, const char* title, unsi
|
|||
|
||||
px = MwLoadIcon(icon, data);
|
||||
|
||||
MwSetVoid(icon, MwNpixmap, px);
|
||||
MwSetPointer(icon, MwNpixmap, px);
|
||||
|
||||
left = 8 + 48 + 8;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@ static int is_monospace(MwWidget handle, MwFLFont ttf) {
|
|||
static MwFLFont assume_ttf(MwWidget handle, MwFLFont ttf) {
|
||||
if(is_bitmap(handle, ttf)) return NULL;
|
||||
|
||||
if(is_monospace(handle, ttf)) return is_bold(handle, ttf) ? MwGetVoid(handle, MwNboldMonospaceFont) : MwGetVoid(handle, MwNmonospaceFont);
|
||||
return is_bold(handle, ttf) ? MwGetVoid(handle, MwNboldFont) : MwGetVoid(handle, MwNfont);
|
||||
if(is_monospace(handle, ttf)) return is_bold(handle, ttf) ? MwGetPointer(handle, MwNboldMonospaceFont) : MwGetPointer(handle, MwNmonospaceFont);
|
||||
return is_bold(handle, ttf) ? MwGetPointer(handle, MwNboldFont) : MwGetPointer(handle, MwNfont);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ static void draw(MwWidget handle) {
|
|||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
const char* str = MwGetText(handle, MwNtext);
|
||||
MwPixmap px = MwGetVoid(handle, MwNpixmap);
|
||||
MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
MwPixmap px = MwGetPointer(handle, MwNpixmap);
|
||||
MwPixmap bgpx = MwGetPointer(handle, MwNbackgroundPixmap);
|
||||
int inv;
|
||||
|
||||
if(str == NULL) str = "";
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ static void draw(MwWidget handle) {
|
|||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwColor base2 = MwParseColor(handle, MwGetText(handle, MwNsubBackground));
|
||||
MwColor text2 = MwParseColor(handle, MwGetText(handle, MwNsubForeground));
|
||||
MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
MwPixmap bgpx = MwGetPointer(handle, MwNbackgroundPixmap);
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ static void draw(MwWidget handle) {
|
|||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
const char* str = MwGetText(handle, MwNtext);
|
||||
MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
MwPixmap bgpx = MwGetPointer(handle, MwNbackgroundPixmap);
|
||||
MwFLFont font = MwFLBuildFont(MwFLFlagMonospace);
|
||||
if(str == NULL) str = "";
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ static void draw(MwWidget handle) {
|
|||
MwRect rr;
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
int inverted;
|
||||
MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
MwPixmap bgpx = MwGetPointer(handle, MwNbackgroundPixmap);
|
||||
|
||||
if(MwGetInteger(handle, MwNhasBorder)) {
|
||||
inverted = MwGetInteger(handle, MwNinverted);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ static int wcreate(MwWidget handle) {
|
|||
|
||||
static void draw(MwWidget handle) {
|
||||
MwRect r;
|
||||
MwPixmap px = MwGetVoid(handle, MwNpixmap);
|
||||
MwPixmap px = MwGetPointer(handle, MwNpixmap);
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
|
||||
r.x = 0;
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ static void draw_seven_segment(MwWidget handle) {
|
|||
MwColor shadow = MwLightenColor(handle, base, MwDefaultShadow, MwDefaultShadow, MwDefaultShadow);
|
||||
int align;
|
||||
const char* str = MwGetText(handle, MwNtext);
|
||||
MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
MwPixmap bgpx = MwGetPointer(handle, MwNbackgroundPixmap);
|
||||
MwLabel lab = handle->internal;
|
||||
int l_one = MwGetInteger(handle, MwNlength) - (MwGetInteger(handle, MwNlength) % 2);
|
||||
int s_one = (l_one * 3 / 4) - ((l_one * 3 / 4) % 2) + 1;
|
||||
|
|
@ -320,7 +320,7 @@ static void draw_normal(MwWidget handle) {
|
|||
MwColor shadow = MwLightenColor(handle, base, MwDefaultShadow, MwDefaultShadow, MwDefaultShadow);
|
||||
int align;
|
||||
const char* str = MwGetText(handle, MwNtext);
|
||||
MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
MwPixmap bgpx = MwGetPointer(handle, MwNbackgroundPixmap);
|
||||
|
||||
if(str == NULL) str = "";
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ static void draw(MwWidget handle) {
|
|||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwColor fill = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
double w;
|
||||
MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
MwPixmap bgpx = MwGetPointer(handle, MwNbackgroundPixmap);
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ static int wcreate(MwWidget handle) {
|
|||
static void draw(MwWidget handle) {
|
||||
MwRect r;
|
||||
MwColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
MwPixmap bgpx = MwGetPointer(handle, MwNbackgroundPixmap);
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ static void draw(MwWidget handle) {
|
|||
MwScrollBar scr = handle->internal;
|
||||
int or ;
|
||||
int uy, dy, ux, dx;
|
||||
MwPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
MwPixmap bgpx = MwGetPointer(handle, MwNbackgroundPixmap);
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ static void draw(MwWidget handle) {
|
|||
MwRect r, r2, r3;
|
||||
const char* title = MwGetText(handle, MwNtitle);
|
||||
int incr = 0;
|
||||
MwPixmap px = MwGetVoid(handle, MwNiconPixmap);
|
||||
MwPixmap px = MwGetPointer(handle, MwNiconPixmap);
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ static int icon_width(MwWidget handle, const char* text) {
|
|||
|
||||
for(i = 0; i < arrlen(t->names); i++) {
|
||||
if(strcmp(t->names[i], text) == 0) {
|
||||
MwPixmap px = MwGetVoid(t->frames[i], MwNiconPixmap);
|
||||
MwPixmap px = MwGetPointer(t->frames[i], MwNiconPixmap);
|
||||
|
||||
if(px == NULL) return 0;
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ static void draw(MwWidget handle) {
|
|||
x += r2.width;
|
||||
|
||||
if(iw > 0) {
|
||||
MwPixmap px = MwGetVoid(t->frames[i], MwNiconPixmap);
|
||||
MwPixmap px = MwGetPointer(t->frames[i], MwNiconPixmap);
|
||||
MwRect rp;
|
||||
|
||||
rp = r2;
|
||||
|
|
|
|||
|
|
@ -576,7 +576,7 @@ static void prop_change(MwWidget handle, const char* prop) {
|
|||
|
||||
arrput(o->enabledLayers, str);
|
||||
} else if(strcmp(prop, MwNvulkanConfig) == 0) {
|
||||
memcpy(&o->vulkan_config, MwGetVoid(handle, MwNvulkanConfig), sizeof(MwVulkanConfig));
|
||||
memcpy(&o->vulkan_config, MwGetPointer(handle, MwNvulkanConfig), sizeof(MwVulkanConfig));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue