#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <minigui/common.h>
#include <minigui/minigui.h>
#include <minigui/gdi.h>
#include <minigui/window.h>
#include <minigui/control.h>
#define IDC_1 100
#define IDC_2 101
#define IDC_3 102
#define IDC_4 103
static DLGTEMPLATE DlgFistWin =
{
WS_BORDER | WS_CAPTION |WS_MINIMIZEBOX | WS_MAXIMIZEBOX, //WS_CAPTION有题栏 WS_BORDER有边框 WS_MINIMIZEBOX最小化
WS_EX_AUTOSECONDARYDC,
0, 0, 800, 480, //x y w h
"this is static demo", //标题
0, 0,
5, //窗口个数
NULL,
0
};
static CTRLDATA SetDialogArr[] =
{
{
"button",
WS_VISIBLE | BS_AUTORADIOBUTTON | BS_CHECKED | WS_TABSTOP | WS_GROUP, //BS_CHECKED 初始选中
20, 28, 200, 20,
IDC_1,
"1",
0
},
{
"button",
WS_VISIBLE | BS_AUTORADIOBUTTON, //WS_VISIBLE 初始化可见 BS_AUTORADIOBUTTON显示用户的选择
20, 48, 200, 20,
IDC_2,
"2",
0
},
{
"button",
WS_VISIBLE | BS_AUTORADIOBUTTON,
20, 68, 200, 20,
IDC_3,
"3",
0
},
{
"button",
WS_VISIBLE | BS_AUTORADIOBUTTON,
20, 88, 200, 20,
IDC_4 ,
"4",
0
},
{
"button",
WS_VISIBLE | BS_PUSHBUTTON | WS_TABSTOP, //BS_PUSHBUTTON 按下 WS_TABSTOP tab停止
120, 230, 100, 30,
IDCANCEL,
"Exit",
0
},
};
static int DialogBlackProc(HWND hDlg, int message, WPARAM wParam, LPARAM lParam)
{
struct _DepInfo *info;
switch (message) {
//定义自己的对话框回调函数时,需要处理 MSG_INITDIALOG 消息
case MSG_INITDIALOG:
info = (struct _DepInfo*)lParam;
//数据初始化对话框
SetWindowAdditionalData (hDlg, (DWORD)lParam);
break;
//窗口空闲无事件发生的时候,会一直不停的发送该消息给主窗口
case MSG_IDLE:
break;
//监控修改
case MSG_COMMAND:
switch (wParam) {
case IDOK:
// 使用 info 结构中的数据
case IDCANCEL:
EndDialog (hDlg, wParam);
break;
}
break;
}
return DefaultDialogProc (hDlg, message, wParam, lParam);
}
int MiniGUIMain (int argc, const char* argv[])
{
#ifdef _MGRM_PROCESSES
// MiniGUI-Processes 模式下加入层
JoinLayer(NAME_DEF_LAYER , "hello" , 0 , 0);
#endif
//设置为默认渲染器 一共四种渲染器classic、flat、fashion、skin
SetDefaultWindowElementRenderer ("skin");
//对话框 controls指向定义控件的数组
DlgFistWin.controls = SetDialogArr;
//创建托管窗口为桌面窗口的对话框
DialogBoxIndirectParam (&DlgFistWin, HWND_DESKTOP, DialogBlackProc, 0L);
return 0;
}
效果图