?? event.c
字號:
/*
* Event Handler for emGUI
*
*
* COPYRIGHT (c) 2001 - 2010.
* emTech System Corporation.
*
* The license and distribution terms for this file may be
* found in found in the file LICENSE.
*/
/* Huangf emcore@263.net
*/
#include "emGUI.h"
#include <stdlib.h>
static unsigned32 _previousbutton;
void EventInitialize()
{
}
void SysHandleEvent()
{
while(1){
if (SysGetEvent(50)){
SysSendAppMessage();
}
}
}
void AppHandleEvent(Application *app)
{
int x, y, button;
Window *wnd;
int type;
unsigned16 msg;
unsigned16 nParam;
unsigned32 lParam;
RECT rect;
type = app->msgBuf[0];
switch(type){
case EVS_MOUSE:
x = app->msgBuf[1];
y = app->msgBuf[2];
button = app->msgBuf[3];
wnd = FindWindow(
app,
x,
y
);
if (wnd == NULL){
/* cannot find window */
return;
}
if ((button & BUTTON_LEFT) == (_previousbutton & BUTTON_LEFT)){
msg = MOUSEMOVE;
}
else{
if (_previousbutton & BUTTON_LEFT){
msg = LBUTTONUP;
}
else{
msg = LBUTTONDOWN;
}
}
_previousbutton = button;
nParam = button; /* current button status */
lParam = (x << 16) | (y & 0x0000FFFF);
break;
case EVS_SYSTEM:
wnd = (WndID)app->msgBuf[1];
msg = (app->msgBuf[2] >> 16);
nParam = (app->msgBuf[2] & 0x0000FFFF);
lParam = (app->msgBuf[3]);
if (wnd == NULL){
/* Application message */
if (app->appProc){
app->appProc(
app,
msg,
nParam,
lParam
);
}
return;
}
switch(msg){
case WM_PAINT:
wnd->paint_count--;
if (wnd->paint_count){
return;
}
rect.left = wnd->invalid_l;
rect.top = wnd->invalid_t;
rect.right = wnd->invalid_r;
rect.bottom = wnd->invalid_b;
wnd->invalid_l = 0;
wnd->invalid_t = 0;
wnd->invalid_r = 0;
wnd->invalid_b = 0;
nParam = 0;
lParam = (unsigned32)▭
break;
}
default:
return;
/* add other event here*/
}
wnd->wndProc(
wnd, /* wndID */
msg, /* message */
nParam, /* parameter 1 */
lParam /* parameter 2 */
);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -