高中生
最后登录1970-1-1
在线时间 小时
注册时间2015-5-10
|
楼主 |
发表于 2016-11-15 21:22:52
|
显示全部楼层
static void _cbCallback(WM_MESSAGE * pMsg) {
unsigned i;
int NCode;
int Id;
int Value;
WM_HWIN hDlg;
WM_HWIN hItem;
hDlg = pMsg->hWin;
switch (pMsg->MsgId) {
case WM_INIT_DIALOG: //3õê¼»ˉ¶Ô»°¿ò
//éèÖÃ×ÖìåÑÕé«μè
FRAMEWIN_SetText(hDlg, "WenDU_Window");
FRAMEWIN_SetFont(hDlg, GUI_FONT_10_ASCII);
FRAMEWIN_SetTextAlign(hDlg, GUI_TA_HCENTER | GUI_TA_TOP);
FRAMEWIN_SetTextColor(hDlg, 0x006262FF);
FRAMEWIN_SetDefaultSkin(FRAMEWIN_SKIN_FLEX);
/*======================================================*/
hItem = WM_GetDialogItem(hDlg, GUI_ID_GRAPH0);
_ahData[0] = GRAPH_DATA_YT_Create(_aColor[0], 400, 0, 0);
_ahData[1] = GRAPH_DATA_YT_Create(_aColor[1], 400, 0, 0);
_ahData[2] = GRAPH_DATA_YT_Create(_aColor[2], 400, 0, 0);
//Îa»æí¼¿Ø¼tìí¼ó¶ÔÏó
GRAPH_AttachData(WM_GetDialogItem(hItem, GUI_ID_GRAPH0), _ahData[0]);
GRAPH_AttachData(WM_GetDialogItem(hItem, GUI_ID_GRAPH0), _ahData[1]);
GRAPH_AttachData(WM_GetDialogItem(hItem, GUI_ID_GRAPH0), _ahData[2]);
//
// éèÖÃí¼DÎêôDÔ
//
GRAPH_SetGridDistY(hItem, 25);
GRAPH_SetGridVis(hItem, 1);
GRAPH_SetGridFixedX(hItem, 1);
GRAPH_SetUserDraw(hItem, _UserDraw);
//
// ′′½¨oíìí¼ó′1Ö±3߶è
//
_hScaleV = GRAPH_SCALE_Create( 25, GUI_TA_RIGHT, GRAPH_SCALE_CF_VERTICAL, 25);
GRAPH_DATA_XY_Clear(_hScaleV);
GRAPH_SCALE_SetTextColor(_hScaleV, GUI_YELLOW);
GRAPH_AttachScale(hItem, _hScaleV);
//
// ′′½¨oíìí¼óˮƽ3߶è
//
_hScaleH = GRAPH_SCALE_Create(90, GUI_TA_HCENTER, GRAPH_SCALE_CF_HORIZONTAL, 50);
GRAPH_DATA_XY_Clear(_hScaleH);
GRAPH_SCALE_SetTextColor(_hScaleH, GUI_DARKGREEN);
GRAPH_AttachScale(hItem, _hScaleH);
//
// 3õê¼»ˉ¸′Ñ¡¿ò
//
CHECKBOX_SetDefaultSkin(CHECKBOX_SKIN_FLEX);
hItem = WM_GetDialogItem(hDlg, GUI_ID_CHECK2);
CHECKBOX_SetText(hItem, "L");
hItem = WM_GetDialogItem(hDlg, GUI_ID_CHECK3);
CHECKBOX_SetText(hItem, "T");
hItem = WM_GetDialogItem(hDlg, GUI_ID_CHECK4);
CHECKBOX_SetText(hItem, "R");
hItem = WM_GetDialogItem(hDlg, GUI_ID_CHECK5);
CHECKBOX_SetText(hItem, "B");
hItem = WM_GetDialogItem(hDlg, GUI_ID_CHECK0);
CHECKBOX_SetText(hItem, "Stop");
hItem = WM_GetDialogItem(hDlg, GUI_ID_CHECK1);
CHECKBOX_SetText(hItem, "Grid");
CHECKBOX_SetState(hItem, 1);
hItem = WM_GetDialogItem(hDlg, GUI_ID_CHECK6);
CHECKBOX_SetText(hItem, "HScroll");
CHECKBOX_SetState(hItem, 1);
hItem = WM_GetDialogItem(hDlg, GUI_ID_CHECK7);
CHECKBOX_SetText(hItem, "VScroll");
hItem = WM_GetDialogItem(hDlg, GUI_ID_CHECK8);
CHECKBOX_SetText(hItem, "MirrorX");
//
// 3õê¼»ˉ»¬¿é
//
SLIDER_SetDefaultSkin(SLIDER_SKIN_FLEX);
hItem = WM_GetDialogItem(hDlg, GUI_ID_SLIDER0);
SLIDER_SetRange(hItem, 0, 10);
SLIDER_SetValue(hItem, 5);
SLIDER_SetNumTicks(hItem, 6);
hItem = WM_GetDialogItem(hDlg, GUI_ID_SLIDER1);
SLIDER_SetRange(hItem, 0, 20);
SLIDER_SetValue(hItem, 5);
SLIDER_SetNumTicks(hItem, 6);
//
// 3õê¼»ˉμ¥Ñ¡¿ò
//
RADIO_SetDefaultSkin(RADIO_SKIN_FLEX);
hItem = WM_GetDialogItem(hDlg, GUI_ID_RADIO0);
RADIO_SetText(hItem, "3D", 0);
RADIO_SetText(hItem, "flat", 1);
RADIO_SetText(hItem, "-", 2);
//
// 3õê¼»ˉ°′¼ü
//
BUTTON_SetDefaultSkin(BUTTON_SKIN_FLEX);
hItem = WM_GetDialogItem(hDlg, GUI_ID_BUTTON0);
WM_SetStayOnTop(hItem, 1);
hItem = WM_GetDialogItem(hDlg, GUI_ID_BUTTON9);
WM_SetStayOnTop(hItem, 1);
break;
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc); // Id of widget
NCode = pMsg->Data.v; // Notification code
switch (NCode) {
case WM_NOTIFICATION_CLICKED:
switch (Id) {
case GUI_ID_BUTTON0:
_ToggleFullScreenMode(hDlg);
break;
case GUI_ID_BUTTON9:
WM_DeleteWindow(hDlg_1);
break;
}
break;
case WM_NOTIFICATION_VALUE_CHANGED:
switch (Id) {
case GUI_ID_CHECK0:
_Stop ^= 1;
break;
case GUI_ID_CHECK1:
hItem = WM_GetDialogItem(hDlg, GUI_ID_GRAPH0);
GRAPH_SetGridVis(hItem, CHECKBOX_IsChecked(WM_GetDialogItem(hDlg, GUI_ID_CHECK1)));
break;
case GUI_ID_CHECK2:
case GUI_ID_CHECK3:
case GUI_ID_CHECK4:
case GUI_ID_CHECK5:
hItem = WM_GetDialogItem(hDlg, GUI_ID_GRAPH0);
GRAPH_SetBorder(hItem,
CHECKBOX_IsChecked(WM_GetDialogItem(hDlg, GUI_ID_CHECK2)) * 40,
CHECKBOX_IsChecked(WM_GetDialogItem(hDlg, GUI_ID_CHECK3)) * 5,
CHECKBOX_IsChecked(WM_GetDialogItem(hDlg, GUI_ID_CHECK4)) * 5,
CHECKBOX_IsChecked(WM_GetDialogItem(hDlg, GUI_ID_CHECK5)) * 5);
break;
case GUI_ID_SLIDER0:
hItem = WM_GetDialogItem(hDlg, GUI_ID_GRAPH0);
Value = SLIDER_GetValue(pMsg->hWinSrc) * 10;
GRAPH_SetGridDistX(hItem, Value);
GRAPH_SCALE_SetTickDist(_hScaleH, Value);
break;
case GUI_ID_SLIDER1:
hItem = WM_GetDialogItem(hDlg, GUI_ID_GRAPH0);
Value = SLIDER_GetValue(pMsg->hWinSrc) * 5;
GRAPH_SetGridDistY(hItem, Value);
GRAPH_SCALE_SetTickDist(_hScaleV, Value);
break;
case GUI_ID_RADIO0:
hItem = WM_GetDialogItem(hDlg, GUI_ID_GRAPH0);
switch (RADIO_GetValue(pMsg->hWinSrc)) {
case 0:
WIDGET_SetEffect(hItem, &WIDGET_Effect_3D);
break;
case 1:
WIDGET_SetEffect(hItem, &WIDGET_Effect_Simple);
break;
case 2:
WIDGET_SetEffect(hItem, &WIDGET_Effect_None);
break;
}
break;
case GUI_ID_CHECK6:
hItem = WM_GetDialogItem(hDlg, GUI_ID_GRAPH0);
if (CHECKBOX_IsChecked(WM_GetDialogItem(hDlg, GUI_ID_CHECK6))) {
GRAPH_SetVSizeX(hItem, 500);
} else {
GRAPH_SetVSizeX(hItem, 0);
}
break;
case GUI_ID_CHECK7:
hItem = WM_GetDialogItem(hDlg, GUI_ID_GRAPH0);
if (CHECKBOX_IsChecked(WM_GetDialogItem(hDlg, GUI_ID_CHECK7))) {
GRAPH_SetVSizeY(hItem, 300);
} else {
GRAPH_SetVSizeY(hItem, 0);
}
break;
case GUI_ID_CHECK8:
WM_GetDialogItem(hDlg, GUI_ID_GRAPH0);
for (i = 0; i < GUI_COUNTOF(_aColor); i++) {
if (CHECKBOX_IsChecked(WM_GetDialogItem(hDlg, GUI_ID_CHECK8))) {
GRAPH_DATA_YT_SetAlign(_ahData[i], GRAPH_ALIGN_LEFT);
GRAPH_DATA_YT_MirrorX (_ahData[i], 1);
} else {
GRAPH_DATA_YT_SetAlign(_ahData[i], GRAPH_ALIGN_LEFT);
GRAPH_DATA_YT_MirrorX (_ahData[i], 0);
}
}
break;
}
break;
}
break;
default:
WM_DefaultProc(pMsg);
}
} |
|