This commit is contained in:
parent
c483c5f042
commit
a6adca6696
9 changed files with 105 additions and 9 deletions
|
|
@ -306,13 +306,13 @@ int main() {
|
||||||
f = frame("Separator", -PaddingContent, -PaddingContent, MwSeparatorClass, NULL);
|
f = frame("Separator", -PaddingContent, -PaddingContent, MwSeparatorClass, NULL);
|
||||||
add(f);
|
add(f);
|
||||||
|
|
||||||
#if 0
|
#if 1
|
||||||
f = frame("SubWindow", -PaddingContent, -PaddingContent, MwViewportClass,
|
f = frame("SubWindow", -PaddingContent, -PaddingContent, MwViewportClass,
|
||||||
MwNratio, 3,
|
MwNratio, 3,
|
||||||
NULL);
|
NULL);
|
||||||
w = child(f);
|
w = child(f);
|
||||||
MwViewportSetSize(w, 512, 512);
|
MwViewportSetSize(w, 512, 512);
|
||||||
MwVaCreateWidget(MwSubWindowClass, "swnd", MwViewportGetViewport(w), 0, 0, 512, 512,
|
MwVaCreateWidget(MwSubWindowClass, "swnd", MwViewportGetViewport(w), 32, 32, 128, 128,
|
||||||
MwNtitle, "Sub window",
|
MwNtitle, "Sub window",
|
||||||
NULL);
|
NULL);
|
||||||
add(f);
|
add(f);
|
||||||
|
|
|
||||||
|
|
@ -51,5 +51,6 @@
|
||||||
#include <Mw/Widget/ComboBox.h>
|
#include <Mw/Widget/ComboBox.h>
|
||||||
#include <Mw/Widget/TreeView.h>
|
#include <Mw/Widget/TreeView.h>
|
||||||
#include <Mw/Widget/Box.h>
|
#include <Mw/Widget/Box.h>
|
||||||
|
#include <Mw/Widget/SubWindow.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include <Mw/MachDep.h>
|
#include <Mw/MachDep.h>
|
||||||
#include <Mw/TypeDefs.h>
|
#include <Mw/TypeDefs.h>
|
||||||
|
#include <Mw/Core.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include <Mw/MachDep.h>
|
#include <Mw/MachDep.h>
|
||||||
#include <Mw/TypeDefs.h>
|
#include <Mw/TypeDefs.h>
|
||||||
|
#include <Mw/Core.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
||||||
25
include/Mw/Widget/SubWindow.h
Normal file
25
include/Mw/Widget/SubWindow.h
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*!
|
||||||
|
* @file Mw/Widget/SubWindow.h
|
||||||
|
* @brief SubWindow widget
|
||||||
|
*/
|
||||||
|
#ifndef __MW_WIDGET_SUBWINDOW_H__
|
||||||
|
#define __MW_WIDGET_SUBWINDOW_H__
|
||||||
|
|
||||||
|
#include <Mw/MachDep.h>
|
||||||
|
#include <Mw/TypeDefs.h>
|
||||||
|
#include <Mw/Core.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief SubWindow widget class
|
||||||
|
*/
|
||||||
|
MWDECL MwClass MwSubWindowClass;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -154,6 +154,7 @@ new_object("src/widget/radiobox.c");
|
||||||
new_object("src/widget/scrollbar.c");
|
new_object("src/widget/scrollbar.c");
|
||||||
new_object("src/widget/separator.c");
|
new_object("src/widget/separator.c");
|
||||||
new_object("src/widget/submenu.c");
|
new_object("src/widget/submenu.c");
|
||||||
|
new_object("src/widget/subwindow.c");
|
||||||
new_object("src/widget/treeview.c");
|
new_object("src/widget/treeview.c");
|
||||||
new_object("src/widget/viewport.c");
|
new_object("src/widget/viewport.c");
|
||||||
new_object("src/widget/window.c");
|
new_object("src/widget/window.c");
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,8 @@ static void detect_darktheme(MwLL handle) {
|
||||||
t = dw ? 0 : 1;
|
t = dw ? 0 : 1;
|
||||||
|
|
||||||
if(t && DwmSetWindowAttribute != NULL) {
|
if(t && DwmSetWindowAttribute != NULL) {
|
||||||
LPARAM style = GetWindowLongPtr(handle->gdi.hWnd, GWL_STYLE);
|
// LPARAM style = GetWindowLongPtr(handle->gdi.hWnd, GWL_STYLE);
|
||||||
if(!(style & WS_CHILD)) MwLLSetDarkTheme(handle, 1);
|
// if(!(style & WS_CHILD)) MwLLSetDarkTheme(handle, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
MwLLDispatch(handle, dark_theme, &t);
|
MwLLDispatch(handle, dark_theme, &t);
|
||||||
|
|
|
||||||
|
|
@ -173,6 +173,7 @@ static void lldarkthemehandler(MwLL handle, void* data) {
|
||||||
int s;
|
int s;
|
||||||
|
|
||||||
if(IsFirstVisible(h) && (shgeti(h->integer, MwNdarkTheme) == -1 || ((s = MwGetInteger(h, MwNdarkThemeAutomatic)) != MwDEFAULT && s))) {
|
if(IsFirstVisible(h) && (shgeti(h->integer, MwNdarkTheme) == -1 || ((s = MwGetInteger(h, MwNdarkThemeAutomatic)) != MwDEFAULT && s))) {
|
||||||
|
if(MwGetInteger(h, MwNmodernLook)){
|
||||||
MwVaApply(h,
|
MwVaApply(h,
|
||||||
MwNdarkTheme, *ptr,
|
MwNdarkTheme, *ptr,
|
||||||
MwNdarkThemeAutomatic, 1,
|
MwNdarkThemeAutomatic, 1,
|
||||||
|
|
@ -180,6 +181,7 @@ static void lldarkthemehandler(MwLL handle, void* data) {
|
||||||
|
|
||||||
MwDispatchUserHandler(h, MwNdarkThemeHandler, data);
|
MwDispatchUserHandler(h, MwNdarkThemeHandler, data);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static MwWidget MwCreateWidget_Internal(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height, int do_prop, va_list prop) {
|
static MwWidget MwCreateWidget_Internal(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height, int do_prop, va_list prop) {
|
||||||
|
|
|
||||||
65
src/widget/subwindow.c
Normal file
65
src/widget/subwindow.c
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
#include <Mw/Milsko.h>
|
||||||
|
|
||||||
|
#define TitleHeight 20
|
||||||
|
|
||||||
|
static int wcreate(MwWidget handle) {
|
||||||
|
MwSetDefault(handle);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void draw(MwWidget handle) {
|
||||||
|
MwLLColor c = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||||
|
MwLLColor c2 = MwParseColor(handle, MwGetText(handle, MwNsubBackground));
|
||||||
|
MwRect r, r2;
|
||||||
|
|
||||||
|
r.x = 0;
|
||||||
|
r.y = 0;
|
||||||
|
r.width = MwGetInteger(handle, MwNwidth);
|
||||||
|
r.height = MwGetInteger(handle, MwNheight);
|
||||||
|
|
||||||
|
MwDrawFrame(handle, &r, c, 0);
|
||||||
|
MwDrawRect(handle, &r, c);
|
||||||
|
|
||||||
|
r2 = r;
|
||||||
|
r2.height = TitleHeight;
|
||||||
|
MwDrawRect(handle, &r2, c2);
|
||||||
|
|
||||||
|
r.y += TitleHeight;
|
||||||
|
r.height -= TitleHeight;
|
||||||
|
MwDrawFrame(handle, &r, c, 1);
|
||||||
|
|
||||||
|
MwLLFreeColor(c2);
|
||||||
|
MwLLFreeColor(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void prop_change(MwWidget handle, const char* key) {
|
||||||
|
if(strcmp(key, MwNtitle) == 0) MwForceRender(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void func_handler(MwWidget handle, const char* name, void* out, va_list va) {
|
||||||
|
(void)out;
|
||||||
|
}
|
||||||
|
|
||||||
|
MwClassRec MwSubWindowClassRec = {
|
||||||
|
wcreate, /* create */
|
||||||
|
NULL, /* destroy */
|
||||||
|
draw, /* draw */
|
||||||
|
NULL, /* click */
|
||||||
|
NULL, /* parent_resize */
|
||||||
|
prop_change, /* prop_change */
|
||||||
|
NULL, /* mouse_move */
|
||||||
|
NULL, /* mouse_up */
|
||||||
|
NULL, /* mouse_down */
|
||||||
|
NULL, /* key */
|
||||||
|
func_handler, /* execute */
|
||||||
|
NULL, /* tick */
|
||||||
|
NULL, /* resize */
|
||||||
|
NULL, /* children_update */
|
||||||
|
NULL, /* children_prop_change */
|
||||||
|
NULL, /* clipboard */
|
||||||
|
NULL, /* props_change */
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL};
|
||||||
|
MwClass MwSubWindowClass = &MwSubWindowClassRec;
|
||||||
Loading…
Add table
Add a link
Reference in a new issue