This commit is contained in:
parent
845be77805
commit
8d91a97dad
39 changed files with 154 additions and 137 deletions
|
|
@ -31,10 +31,10 @@ static void MWAPI resize(MwWidget handle, void* client, void* user) {
|
|||
}
|
||||
|
||||
static void MWAPI activate(MwWidget handle, void* client, void* user) {
|
||||
const char* n = MwGetText(handle, MwNtext);
|
||||
const char* n = MwGetString(handle, MwNtext);
|
||||
|
||||
if(('0' <= n[0] && n[0] <= '9') || n[0] == '.') {
|
||||
const char* s = MwGetText(inp, MwNtext);
|
||||
const char* s = MwGetString(inp, MwNtext);
|
||||
char* r;
|
||||
|
||||
if(n[0] == '.' && s != NULL) {
|
||||
|
|
@ -52,7 +52,7 @@ static void MWAPI activate(MwWidget handle, void* client, void* user) {
|
|||
NULL);
|
||||
free(r);
|
||||
} else if(n[0] == 'E') {
|
||||
const char* s = MwGetText(inp, MwNtext);
|
||||
const char* s = MwGetString(inp, MwNtext);
|
||||
|
||||
if(s != NULL) {
|
||||
stack[sp++] = atof(s);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ void MWAPI file_callback(MwWidget handle, void* user_data, void* call_data) {
|
|||
rgb->green &= 0xff;
|
||||
rgb->blue &= 0xff;
|
||||
MwStringPrintIntoBuffer(hexColor, 8, "#%02X%02X%02X", rgb->red, rgb->green, rgb->blue);
|
||||
MwSetText(window, MwNbackground, hexColor);
|
||||
MwSetString(window, MwNbackground, hexColor);
|
||||
}
|
||||
|
||||
void MWAPI file_picker(MwWidget handle, void* user_data, void* call_data) {
|
||||
|
|
@ -27,7 +27,7 @@ void MWAPI file_picker(MwWidget handle, void* user_data, void* call_data) {
|
|||
|
||||
MwAddUserHandler(cpicker, MwNcolorChosenHandler, file_callback, NULL);
|
||||
|
||||
MwSetText(cpicker, MwNbackground, MwGetInteger(cpicker, MwNdarkTheme) ? MwDefaultDarkBackground : MwDefaultBackground);
|
||||
MwSetString(cpicker, MwNbackground, MwGetInteger(cpicker, MwNdarkTheme) ? MwDefaultDarkBackground : MwDefaultBackground);
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
|
@ -35,14 +35,14 @@ int main() {
|
|||
|
||||
window = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT,
|
||||
MwDEFAULT, 640, 480, MwNtitle, "color picker", NULL);
|
||||
MwSetText(window, MwNbackground, MwGetInteger(window, MwNdarkTheme) ? MwDefaultDarkBackground : MwDefaultBackground);
|
||||
MwSetText(window, MwNforeground, MwGetInteger(window, MwNdarkTheme) ? MwDefaultDarkForeground : MwDefaultForeground);
|
||||
MwSetString(window, MwNbackground, MwGetInteger(window, MwNdarkTheme) ? MwDefaultDarkBackground : MwDefaultBackground);
|
||||
MwSetString(window, MwNforeground, MwGetInteger(window, MwNdarkTheme) ? MwDefaultDarkForeground : MwDefaultForeground);
|
||||
|
||||
button = MwVaCreateWidget(MwButtonClass, "button", window, 160, 180, 320, 120,
|
||||
MwNtext, "change window background",
|
||||
NULL);
|
||||
MwSetText(button, MwNbackground, MwGetInteger(window, MwNdarkTheme) ? MwDefaultDarkBackground : MwDefaultBackground);
|
||||
MwSetText(button, MwNforeground, MwGetInteger(window, MwNdarkTheme) ? MwDefaultDarkForeground : MwDefaultForeground);
|
||||
MwSetString(button, MwNbackground, MwGetInteger(window, MwNdarkTheme) ? MwDefaultDarkBackground : MwDefaultBackground);
|
||||
MwSetString(button, MwNforeground, MwGetInteger(window, MwNdarkTheme) ? MwDefaultDarkForeground : MwDefaultForeground);
|
||||
|
||||
MwAddUserHandler(button, MwNactivateHandler, file_picker, NULL);
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ void MWAPI file_picker(MwWidget handle, void* user_data, void* call_data) {
|
|||
|
||||
MwAddUserHandler(fpicker, MwNfileChosenHandler, file_callback, NULL);
|
||||
|
||||
MwSetText(fpicker, MwNbackground, MwGetInteger(fpicker, MwNdarkTheme) ? MwDefaultDarkBackground : MwDefaultBackground);
|
||||
MwSetString(fpicker, MwNbackground, MwGetInteger(fpicker, MwNdarkTheme) ? MwDefaultDarkBackground : MwDefaultBackground);
|
||||
|
||||
#ifdef BUG
|
||||
fpicker_wait = MwTRUE;
|
||||
|
|
|
|||
|
|
@ -354,9 +354,9 @@ int main() {
|
|||
|
||||
f = frame("Tab", -PaddingContent, -PaddingContent, MwTabClass, NULL);
|
||||
w = child(f);
|
||||
MwSetText(MwTabAdd(w, "ABC"), MwNbackground, "#f00");
|
||||
MwSetText(MwTabAdd(w, "DEF"), MwNbackground, "#0f0");
|
||||
MwSetText(MwTabAdd(w, "GHI"), MwNbackground, "#00f");
|
||||
MwSetString(MwTabAdd(w, "ABC"), MwNbackground, "#f00");
|
||||
MwSetString(MwTabAdd(w, "DEF"), MwNbackground, "#0f0");
|
||||
MwSetString(MwTabAdd(w, "GHI"), MwNbackground, "#00f");
|
||||
|
||||
f = frame("TreeView", -PaddingContent, -PaddingContent, MwTreeViewClass, NULL);
|
||||
w = child(f);
|
||||
|
|
|
|||
|
|
@ -33,10 +33,10 @@ void MWAPI tick(MwWidget handle, void* user, void* call) {
|
|||
tm = localtime(&t);
|
||||
|
||||
MwStringPrintIntoBuffer(buf, 512, "%s %02d %s", mon[tm->tm_mon], tm->tm_mday, wday[tm->tm_wday]);
|
||||
MwSetText(ldate, MwNtext, buf);
|
||||
MwSetString(ldate, MwNtext, buf);
|
||||
|
||||
MwStringPrintIntoBuffer(buf, 512, "%02d:%02d %s", tm->tm_hour % 12, tm->tm_min, tm->tm_hour >= 12 ? "PM" : "AM");
|
||||
MwSetText(ltime, MwNtext, buf);
|
||||
MwSetString(ltime, MwNtext, buf);
|
||||
|
||||
render = 1;
|
||||
|
||||
|
|
@ -141,10 +141,10 @@ int main() {
|
|||
MwNtitle, "clock",
|
||||
NULL);
|
||||
|
||||
bgcolor = MwParseColor(window, MwGetText(window, MwNbackground));
|
||||
bgcolor = MwParseColor(window, MwGetString(window, MwNbackground));
|
||||
MwColorGet(bgcolor, &br, &bg, &bb);
|
||||
|
||||
fgcolor = MwParseColor(window, MwGetText(window, MwNforeground));
|
||||
fgcolor = MwParseColor(window, MwGetString(window, MwNforeground));
|
||||
MwColorGet(fgcolor, &fr, &fg, &fb);
|
||||
|
||||
opengl = MwCreateWidget(MwOpenGLClass, "clock", window, 0, 0, 100, 100);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue