📄 gui.h
字号:
/*
*********************************************************************************************************
* uC/GUI V4.04
* Universal graphic software for embedded applications
*
* (c) Copyright 2002, Micrium Inc., Weston, FL
* (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH
*
* 礐/GUI 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 redistributed
* in any way. We appreciate your understanding and fairness.
*
----------------------------------------------------------------------
File : GUI.h
Purpose : GUI API include file
---------------------------END-OF-HEADER------------------------------
Attention : Do not modify this file ! If you do, you will not
be able do update to a later GUI version !
*/
#ifndef GUI_H
#define GUI_H
#include "GUI_ConfDefaults.h"
#include "GUIType.h"
#include "GUIVersion.h"
#if defined(__cplusplus)
extern "C" { /* Make sure we have C-declarations in C++ programs */
#endif
/*********************************************************************
*
* Limitations for certain C51 Keil (__C51__)
*/
#if defined (__C51__) && GUI_SUPPORT_MEMDEV
#error __C51__ (Keil) can not support function pointers sufficiently ! -> Disable memory devices -> GUI_SUPPORT_MEMDEV 0
#endif
/*********************************************************************
*
* Macros, function replacement
*/
#define GUI_COUNTOF(a) (sizeof(a) / sizeof(a[0]))
/*********************************************************************
*
* GUI_KEY_...
*
* These ID values are basically meant to be used with widgets
* Note that we have chosen the values to be close to existing
* "standards", so do not change them unless forced to.
*
*/
#define GUI_KEY_BACKSPACE 8 /* ASCII: BACKSPACE Crtl-H */
#define GUI_KEY_TAB 9 /* ASCII: TAB Crtl-I */
#define GUI_KEY_BACKTAB 10
#define GUI_KEY_ENTER 13 /* ASCII: ENTER Crtl-M */
#define GUI_KEY_LEFT 16
#define GUI_KEY_UP 17
#define GUI_KEY_RIGHT 18
#define GUI_KEY_DOWN 19
#define GUI_KEY_HOME 23
#define GUI_KEY_END 24
#define GUI_KEY_SHIFT 25
#define GUI_KEY_CONTROL 26
#define GUI_KEY_ESCAPE 27 /* ASCII: ESCAPE 0x1b */
#define GUI_KEY_INSERT 29
#define GUI_KEY_DELETE 30
#define GUI_KEY_SPACE 32
#define GUI_KEY_PGUP 33
#define GUI_KEY_PGDOWN 34
#define GUI_KEY_F1 40
#define GUI_KEY_F2 41
/*********************************************************************
*
* Dialog item IDs
*
* The IDs below are arbitrary values. They just have to be unique
* within the dialog.
*
* If you use your own Ids, we recommend to use values above GUI_ID_USER.
*/
#define GUI_ID_OK 1
#define GUI_ID_CANCEL 2
#define GUI_ID_YES 3
#define GUI_ID_NO 4
#define GUI_ID_CLOSE 5
#define GUI_ID_HELP 6
#define GUI_ID_MAXIMIZE 7
#define GUI_ID_MINIMIZE 8
#define GUI_ID_VSCROLL 0xFE
#define GUI_ID_HSCROLL 0xFF
#define GUI_ID_EDIT0 0x100
#define GUI_ID_EDIT1 0x101
#define GUI_ID_EDIT2 0x102
#define GUI_ID_EDIT3 0x103
#define GUI_ID_EDIT4 0x104
#define GUI_ID_EDIT5 0x105
#define GUI_ID_EDIT6 0x106
#define GUI_ID_EDIT7 0x107
#define GUI_ID_EDIT8 0x108
#define GUI_ID_EDIT9 0x109
#define GUI_ID_LISTBOX0 0x110
#define GUI_ID_LISTBOX1 0x111
#define GUI_ID_LISTBOX2 0x112
#define GUI_ID_LISTBOX3 0x113
#define GUI_ID_LISTBOX4 0x114
#define GUI_ID_LISTBOX5 0x115
#define GUI_ID_LISTBOX6 0x116
#define GUI_ID_LISTBOX7 0x117
#define GUI_ID_LISTBOX8 0x118
#define GUI_ID_LISTBOX9 0x119
#define GUI_ID_CHECK0 0x120
#define GUI_ID_CHECK1 0x121
#define GUI_ID_CHECK2 0x122
#define GUI_ID_CHECK3 0x123
#define GUI_ID_CHECK4 0x124
#define GUI_ID_CHECK5 0x125
#define GUI_ID_CHECK6 0x126
#define GUI_ID_CHECK7 0x127
#define GUI_ID_CHECK8 0x128
#define GUI_ID_CHECK9 0x129
#define GUI_ID_SLIDER0 0x130
#define GUI_ID_SLIDER1 0x131
#define GUI_ID_SLIDER2 0x132
#define GUI_ID_SLIDER3 0x133
#define GUI_ID_SLIDER4 0x134
#define GUI_ID_SLIDER5 0x135
#define GUI_ID_SLIDER6 0x136
#define GUI_ID_SLIDER7 0x137
#define GUI_ID_SLIDER8 0x138
#define GUI_ID_SLIDER9 0x139
#define GUI_ID_SCROLLBAR0 0x140
#define GUI_ID_SCROLLBAR1 0x141
#define GUI_ID_SCROLLBAR2 0x142
#define GUI_ID_SCROLLBAR3 0x142
#define GUI_ID_RADIO0 0x150
#define GUI_ID_RADIO1 0x151
#define GUI_ID_RADIO2 0x152
#define GUI_ID_RADIO3 0x153
#define GUI_ID_RADIO4 0x154
#define GUI_ID_RADIO5 0x155
#define GUI_ID_RADIO6 0x156
#define GUI_ID_RADIO7 0x157
#define GUI_ID_TEXT0 0x160
#define GUI_ID_TEXT1 0x161
#define GUI_ID_TEXT2 0x162
#define GUI_ID_TEXT3 0x163
#define GUI_ID_TEXT4 0x164
#define GUI_ID_TEXT5 0x165
#define GUI_ID_TEXT6 0x166
#define GUI_ID_TEXT7 0x167
#define GUI_ID_TEXT8 0x168
#define GUI_ID_TEXT9 0x169
#define GUI_ID_BUTTON0 0x170
#define GUI_ID_BUTTON1 0x171
#define GUI_ID_BUTTON2 0x172
#define GUI_ID_BUTTON3 0x173
#define GUI_ID_BUTTON4 0x174
#define GUI_ID_BUTTON5 0x175
#define GUI_ID_BUTTON6 0x176
#define GUI_ID_BUTTON7 0x177
#define GUI_ID_BUTTON8 0x178
#define GUI_ID_BUTTON9 0x179
#define GUI_ID_DROPDOWN0 0x180
#define GUI_ID_DROPDOWN1 0x181
#define GUI_ID_DROPDOWN2 0x182
#define GUI_ID_DROPDOWN3 0x183
#define GUI_ID_MULTIEDIT0 0x190
#define GUI_ID_MULTIEDIT1 0x191
#define GUI_ID_MULTIEDIT2 0x192
#define GUI_ID_MULTIEDIT3 0x193
#define GUI_ID_LISTVIEW0 0x200
#define GUI_ID_LISTVIEW1 0x201
#define GUI_ID_LISTVIEW2 0x202
#define GUI_ID_LISTVIEW3 0x203
#define GUI_ID_PROGBAR0 0x210
#define GUI_ID_PROGBAR1 0x211
#define GUI_ID_PROGBAR2 0x212
#define GUI_ID_PROGBAR3 0x213
#define GUI_ID_GRAPH0 0x220
#define GUI_ID_GRAPH1 0x221
#define GUI_ID_GRAPH2 0x222
#define GUI_ID_GRAPH3 0x223
#define GUI_ID_MULTIPAGE0 0x230
#define GUI_ID_MULTIPAGE1 0x231
#define GUI_ID_MULTIPAGE2 0x232
#define GUI_ID_MULTIPAGE3 0x233
#define GUI_ID_USER 0x800
/*********************************************************************
*
* Mouse buttons
*/
#define GUI_LBUTTON (1 << 0) /* Left button */
#define GUI_RBUTTON (1 << 1) /* Right button */
#define GUI_MBUTTON (1 << 2) /* Middle button */
#define GUI_DBUTTON (1 << 7) /* Double-click button */
/*********************************************************************
*
* Wrap modes
*/
typedef enum { GUI_WRAPMODE_NONE, GUI_WRAPMODE_WORD, GUI_WRAPMODE_CHAR } GUI_WRAPMODE;
/*********************************************************************
*
* Text styles
*/
#define GUI_TS_NORMAL (0)
#define GUI_TS_UNDERLINE (1 << 0)
#define GUI_TS_STRIKETHRU (1 << 1)
#define GUI_TS_OVERLINE (1 << 2)
/*********************************************************************
*
* Line styles
*/
#define GUI_LS_SOLID (0)
#define GUI_LS_DASH (1)
#define GUI_LS_DOT (2)
#define GUI_LS_DASHDOT (3)
#define GUI_LS_DASHDOTDOT (4)
/*********************************************************************
*
* Pen shapes
*/
#define GUI_PS_ROUND (0)
#define GUI_PS_FLAT (1)
#define GUI_PS_SQUARE (2)
/*********************************************************************
*
* Standard colors
*/
#define GUI_BLUE 0x00FF0000
#define GUI_GREEN 0x0000FF00
#define GUI_RED 0x000000FF
#define GUI_CYAN 0x00FFFF00
#define GUI_MAGENTA 0x00FF00FF
#define GUI_YELLOW 0x0000FFFF
#define GUI_LIGHTBLUE 0x00FF8080
#define GUI_LIGHTGREEN 0x0080FF80
#define GUI_LIGHTRED 0x008080FF
#define GUI_LIGHTCYAN 0x00FFFF80
#define GUI_LIGHTMAGENTA 0x00FF80FF
#define GUI_LIGHTYELLOW 0x0080FFFF
#define GUI_DARKBLUE 0x00800000
#define GUI_DARKGREEN 0x00008000
#define GUI_DARKRED 0x00000080
#define GUI_DARKCYAN 0x00808000
#define GUI_DARKMAGENTA 0x00800080
#define GUI_DARKYELLOW 0x00008080
#define GUI_WHITE 0x00FFFFFF
#define GUI_LIGHTGRAY 0x00D3D3D3
#define GUI_GRAY 0x00808080
#define GUI_DARKGRAY 0x00404040
#define GUI_BLACK 0x00000000
#define GUI_BROWN 0x002A2AA5
#define GUI_TRANSPARENT 0xFF000000
#define GUI_INVALID_COLOR 0xFFFFFFF /* Invalid color - more than 24 bits */
/*********************************************************************
*
* Coordinates
*/
#define GUI_COORD_X 0
#define GUI_COORD_Y 1
/*********************************************************************
*
* Standard Fonts
*
* Note: The external declarations for the fonts are now also included in
* this file.
*/
/* Proportional fonts */
extern GUI_CONST_STORAGE GUI_FONT GUI_Font8_ASCII, GUI_Font8_1;
extern GUI_CONST_STORAGE GUI_FONT GUI_Font10S_ASCII, GUI_Font10S_1;
extern GUI_CONST_STORAGE GUI_FONT GUI_Font10_ASCII, GUI_Font10_1;
extern GUI_CONST_STORAGE GUI_FONT GUI_Font13_ASCII, GUI_Font13_1;
extern GUI_CONST_STORAGE GUI_FONT GUI_Font13B_ASCII, GUI_Font13B_1;
extern GUI_CONST_STORAGE GUI_FONT GUI_Font13H_ASCII, GUI_Font13H_1;
extern GUI_CONST_STORAGE GUI_FONT GUI_Font13HB_ASCII, GUI_Font13HB_1;
extern GUI_CONST_STORAGE GUI_FONT GUI_Font16_ASCII, GUI_Font16_1, GUI_Font16_HK, GUI_Font16_1HK;
extern GUI_CONST_STORAGE GUI_FONT GUI_Font16B_ASCII, GUI_Font16B_1;
extern GUI_CONST_STORAGE GUI_FONT GUI_Font20_ASCII, GUI_Font20_1;
extern GUI_CONST_STORAGE GUI_FONT GUI_Font20B_ASCII, GUI_Font20B_1;
extern GUI_CONST_STORAGE GUI_FONT GUI_Font24_ASCII, GUI_Font24_1;
extern GUI_CONST_STORAGE GUI_FONT GUI_Font24B_ASCII, GUI_Font24B_1;
extern GUI_CONST_STORAGE GUI_FONT GUI_Font32_ASCII, GUI_Font32_1;
extern GUI_CONST_STORAGE GUI_FONT GUI_Font32B_ASCII, GUI_Font32B_1;
/* Monospaced */
extern GUI_CONST_STORAGE GUI_FONT GUI_Font4x6;
extern GUI_CONST_STORAGE GUI_FONT GUI_Font6x8, GUI_Font6x9;
extern GUI_CONST_STORAGE GUI_FONT GUI_Font8x8, GUI_Font8x9;
extern GUI_CONST_STORAGE GUI_FONT GUI_Font8x10_ASCII;
extern GUI_CONST_STORAGE GUI_FONT GUI_Font8x12_ASCII;
extern GUI_CONST_STORAGE GUI_FONT GUI_Font8x13_ASCII, GUI_Font8x13_1;
extern GUI_CONST_STORAGE GUI_FONT GUI_Font8x15B_ASCII, GUI_Font8x15B_1;
extern GUI_CONST_STORAGE GUI_FONT GUI_Font8x16, GUI_Font8x17, GUI_Font8x18;
extern GUI_CONST_STORAGE GUI_FONT GUI_Font8x16x1x2, GUI_Font8x16x2x2, GUI_Font8x16x3x3;
/* Digits */
extern GUI_CONST_STORAGE GUI_FONT GUI_FontD24x32;
extern GUI_CONST_STORAGE GUI_FONT GUI_FontD32;
extern GUI_CONST_STORAGE GUI_FONT GUI_FontD36x48;
extern GUI_CONST_STORAGE GUI_FONT GUI_FontD48;
extern GUI_CONST_STORAGE GUI_FONT GUI_FontD48x64;
extern GUI_CONST_STORAGE GUI_FONT GUI_FontD64;
extern GUI_CONST_STORAGE GUI_FONT GUI_FontD60x80;
extern GUI_CONST_STORAGE GUI_FONT GUI_FontD80;
/* Comic fonts */
extern GUI_CONST_STORAGE GUI_FONT GUI_FontComic18B_ASCII, GUI_FontComic18B_1;
extern GUI_CONST_STORAGE GUI_FONT GUI_FontComic24B_ASCII, GUI_FontComic24B_1;
/*********************************************************************
*
* Text and drawing modes
*
* These defines come in two flavors: the long version (.._DRAWMODE_..)
* and the short ones (.._DM_..). They are identical, feel free to use
* which ever one you like best.
*/
#define GUI_DRAWMODE_NORMAL LCD_DRAWMODE_NORMAL
#define GUI_DRAWMODE_XOR LCD_DRAWMODE_XOR
#define GUI_DRAWMODE_TRANS LCD_DRAWMODE_TRANS
#define GUI_DRAWMODE_REV LCD_DRAWMODE_REV
#define GUI_DM_NORMAL LCD_DRAWMODE_NORMAL
#define GUI_DM_XOR LCD_DRAWMODE_XOR
#define GUI_DM_TRANS LCD_DRAWMODE_TRANS
#define GUI_DM_REV LCD_DRAWMODE_REV
#define GUI_TEXTMODE_NORMAL LCD_DRAWMODE_NORMAL
#define GUI_TEXTMODE_XOR LCD_DRAWMODE_XOR
#define GUI_TEXTMODE_TRANS LCD_DRAWMODE_TRANS
#define GUI_TEXTMODE_REV LCD_DRAWMODE_REV
#define GUI_TM_NORMAL LCD_DRAWMODE_NORMAL
#define GUI_TM_XOR LCD_DRAWMODE_XOR
#define GUI_TM_TRANS LCD_DRAWMODE_TRANS
#define GUI_TM_REV LCD_DRAWMODE_REV
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -