?? sim_hardkey.c
字號:
/*********************************************************************
* SEGGER MICROCONTROLLER SYSTEME GmbH *
* Solutions for real time microcontroller applications *
**********************************************************************
* *
* (c) 1996 - 2007 SEGGER Microcontroller Systeme GmbH *
* *
* Internet: www.segger.com Support: support@segger.com *
* *
**********************************************************************
** emWin V4.14 - Graphical user interface for embedded applications **
emWin is protected by international copyright laws. Knowledge of the
source code may not be used to write a similar product. This file may
only be used in accordance with a license and should not be re-
distributed in any way. We appreciate your understanding and fairness.
----------------------------------------------------------------------
File : SIM_Hardkey.c
Purpose : Example demonstrating the HARDKEY simulation
----------------------------------------------------------------------
*/
#include "GUI.h"
#include "SIM.h"
#include "FRAMEWIN.h"
#include "LISTBOX.h"
#include <stddef.h>
/*******************************************************************
*
* static variables
*
********************************************************************
*/
static const GUI_ConstString _aListBox[] = {
"English", "Deutsch", "Fran鏰is", "Japanese", "Italiano", "Espa駉l", NULL
};
/*******************************************************************
*
* static code
*
********************************************************************
*/
/*******************************************************************
*
* _DemoHardkey
Demonstrates HARDKEY simulation with a listbox
*/
static void _DemoHardkey(void) {
LISTBOX_Handle hListBox;
GUI_SetBkColor(GUI_BLACK);
GUI_Clear();
GUI_SetColor(GUI_WHITE);
GUI_SetTextAlign(GUI_TA_HCENTER);
GUI_SetFont(&GUI_Font24_ASCII);
GUI_DispStringAt("Hardkey - Sample", 160, 5);
GUI_SetFont(&GUI_Font8x8);
GUI_DispStringAt("Up", 5, 54);
GUI_DispStringAt("Down", 5, 78);
/* Create the listbox */
hListBox = LISTBOX_Create(_aListBox, 100, 100, 120, 75, WM_CF_SHOW);
WM_SetFocus(hListBox);
LISTBOX_SetFont(hListBox, &GUI_Font13B_1);
SCROLLBAR_CreateAttached(hListBox, SCROLLBAR_CF_VERTICAL);
/* Handle the listbox */
while (1) {
WM_Exec();
}
/* Delete listbox widget */
LISTBOX_Delete(hListBox);
GUI_Clear();
}
/*******************************************************************
*
* _cbKeyUp
Callback for the up-key
*/
static void _cbKeyUp(int key, int state) {
GUI_StoreKeyMsg(GUI_KEY_UP, state);
};
/*******************************************************************
*
* _cbKeyDown
Callback for the down-key
*/
static void _cbKeyDown(int key, int state) {
GUI_StoreKeyMsg(GUI_KEY_DOWN, state);
};
/*******************************************************************
*
* MainTask
*
* Demonstrates HARDKEY simulation
*
********************************************************************
*/
void MainTask(void) {
GUI_Init();
/* set callback routine for hardkey */
SIM_HARDKEY_SetCallback(1, &_cbKeyUp);
SIM_HARDKEY_SetCallback(2, &_cbKeyDown);
/* start demo */
_DemoHardkey();
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -