mirror of
https://github.com/VincentWei/minigui-docs.git
synced 2025-10-18 00:33:15 +08:00
142 lines
2.9 KiB
C
142 lines
2.9 KiB
C
/*
|
|
* ** ledlabel.c: Sample program for mGNCS Programming Guide
|
|
* ** A mGNCS application for mLEDLabel.
|
|
* **
|
|
* ** Copyright (C) 2009 ~ 2019 FMSoft Technologies.
|
|
* */
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include <minigui/common.h>
|
|
#include <minigui/minigui.h>
|
|
#include <minigui/gdi.h>
|
|
#include <minigui/window.h>
|
|
#include <minigui/control.h>
|
|
#include <mgncs/mgncs.h>
|
|
|
|
#define IDC_LEDLBL1 100
|
|
#define IDC_SATAICN 107
|
|
|
|
static BOOL mymain_onCreate(mWidget* self, DWORD add_data)
|
|
{
|
|
//TODO : initialize
|
|
return TRUE;
|
|
}
|
|
|
|
static void mymain_onClose(mWidget* self, int message)
|
|
{
|
|
DestroyMainWindow(self->hwnd);
|
|
PostQuitMessage(0);
|
|
}
|
|
|
|
|
|
//Propties for
|
|
static NCS_PROP_ENTRY static1_props [] = {
|
|
{ NCSP_LEDLBL_COLOR, 0xFF0000FF},
|
|
{ NCSP_LEDLBL_WIDTH, 10},
|
|
{ NCSP_LEDLBL_HEIGHT, 15},
|
|
{ NCSP_STATIC_ALIGN, NCS_ALIGN_RIGHT },
|
|
{ NCSP_STATIC_AUTOWRAP, 0 },
|
|
{0, 0}
|
|
};
|
|
|
|
static NCS_PROP_ENTRY static2_props [] = {
|
|
{ NCSP_LEDLBL_COLOR, 0xFF0000FF},
|
|
{ NCSP_LEDLBL_WIDTH, 60},
|
|
{ NCSP_LEDLBL_HEIGHT, 90},
|
|
{ NCSP_STATIC_VALIGN, NCS_VALIGN_CENTER },
|
|
{ NCSP_STATIC_ALIGN, NCS_ALIGN_CENTER },
|
|
{0, 0}
|
|
};
|
|
|
|
//Controls
|
|
static NCS_WND_TEMPLATE _ctrl_templ[] = {
|
|
{
|
|
NCSCTRL_LEDLABEL ,
|
|
IDC_LEDLBL1+0,
|
|
10, 10, 160, 50,
|
|
WS_BORDER | WS_VISIBLE,
|
|
WS_EX_NONE,
|
|
"ABC 123",
|
|
NULL, //props,
|
|
NULL, //rdr_info
|
|
NULL, //handlers,
|
|
NULL, //controls
|
|
0,
|
|
0 //add data
|
|
},
|
|
{
|
|
NCSCTRL_LEDLABEL ,
|
|
IDC_LEDLBL1+2,
|
|
10, 70, 160, 30,
|
|
WS_BORDER | WS_VISIBLE,
|
|
WS_EX_NONE,
|
|
"2 4 6 8 0 ",
|
|
static1_props, //props,
|
|
NULL, //rdr_info
|
|
NULL, //handlers,
|
|
NULL, //controls
|
|
0,
|
|
0 //add data
|
|
},
|
|
{
|
|
NCSCTRL_LEDLABEL ,
|
|
IDC_LEDLBL1+5,
|
|
180, 10, 100, 100,
|
|
WS_BORDER | WS_VISIBLE,
|
|
WS_EX_NONE,
|
|
"4",
|
|
static2_props, //props,
|
|
NULL, //rdr_info
|
|
NULL, //handlers,
|
|
NULL, //controls
|
|
0,
|
|
0 //add data
|
|
},
|
|
|
|
};
|
|
|
|
|
|
static NCS_EVENT_HANDLER mymain_handlers[] = {
|
|
{MSG_CREATE, mymain_onCreate},
|
|
{MSG_CLOSE, mymain_onClose},
|
|
{0, NULL}
|
|
};
|
|
|
|
//define the main window template
|
|
static NCS_MNWND_TEMPLATE mymain_templ = {
|
|
NCSCTRL_DIALOGBOX,
|
|
1,
|
|
0, 0, 300, 150,
|
|
WS_CAPTION | WS_BORDER | WS_VISIBLE,
|
|
WS_EX_NONE,
|
|
"LEDLabel Test ....",
|
|
NULL,
|
|
NULL,
|
|
mymain_handlers,
|
|
_ctrl_templ,
|
|
sizeof(_ctrl_templ)/sizeof(NCS_WND_TEMPLATE),
|
|
0,
|
|
0, 0,
|
|
};
|
|
|
|
int MiniGUIMain(int argc, const char* argv[])
|
|
{
|
|
ncsInitialize();
|
|
mDialogBox* mydlg = (mDialogBox *)ncsCreateMainWindowIndirect
|
|
(&mymain_templ, HWND_DESKTOP);
|
|
|
|
_c(mydlg)->doModal(mydlg, TRUE);
|
|
|
|
|
|
MainWindowThreadCleanup(mydlg->hwnd);
|
|
return 0;
|
|
}
|
|
|
|
#ifdef _MGRM_THREADS
|
|
#include <minigui/dti.c>
|
|
#endif
|
|
|