📄 radio.lst
字号:
C51 COMPILER V8.05a RADIO 04/11/2008 14:19:37 PAGE 1
C51 COMPILER V8.05a, COMPILATION OF MODULE RADIO
OBJECT MODULE PLACED IN Radio.obj
COMPILER INVOKED BY: D:\Program Files\keil\C51\BIN\C51.EXE gui\Widget\Radio.c LARGE BROWSE MDU_F120 DEBUG OBJECTEXTEND P
-RINT(.\Radio.lst) OBJECT(Radio.obj)
line level source
1 /*
2 *********************************************************************************************************
3 * uC/GUI
4 * Universal graphic software for embedded applications
5 *
6 * (c) Copyright 2002, Micrium Inc., Weston, FL
7 * (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH
8 *
9 * 礐/GUI is protected by international copyright laws. Knowledge of the
10 * source code may not be used to write a similar product. This file may
11 * only be used in accordance with a license and should not be redistributed
12 * in any way. We appreciate your understanding and fairness.
13 *
14 ----------------------------------------------------------------------
15 File : RADIO.c
16 Purpose : Template for new emWin GSC widgets
17 ---------------------------END-OF-HEADER------------------------------
18 */
19
20 #include <stdlib.h>
21 #include <string.h>
22 #include "gui\Core\GUI_Private.h"
23 #include "RADIO.h"
24 #include "Widget.h"
25
26 #if GUI_WINSUPPORT
/*********************************************************************
*
* Private config defaults
*
**********************************************************************
*/
/* Define colors */
#ifndef RADIO_BKCOLOR0_DEFAULT
#define RADIO_BKCOLOR0_DEFAULT 0xc0c0c0 /* Inactive color */
#endif
#ifndef RADIO_BKCOLOR1_DEFAULT
#define RADIO_BKCOLOR1_DEFAULT GUI_WHITE /* Active color */
#endif
/*********************************************************************
*
* Object definition
*
**********************************************************************
*/
typedef struct {
WIDGET Widget;
GUI_COLOR aBkColor[2];
C51 COMPILER V8.05a RADIO 04/11/2008 14:19:37 PAGE 2
I16 Sel; /* current selection */
I16 Spacing;
I16 Height;
I16 NumItems;
#if GUI_DEBUG_LEVEL >1
int DebugId;
#endif
} RADIO_Obj;
/*********************************************************************
*
* Static data
*
**********************************************************************
*/
static GUI_COLOR _aColor[] = {
0xC0C0C0,0x808080,0x000000,0xFFFFFF
};
/*********************************************************************
*
* Static const data
*
**********************************************************************
*/
const GUI_LOGPALETTE PalRadio0 = {
4, /* number of entries */
0, /* No transparency */
&_aColor[0]
};
const unsigned char acRadio0[] = {
0x00, 0x55, 0x00,
0x05, 0xAA, 0x50,
0x1A, 0xFF, 0xAC,
0x1B, 0xFF, 0xCC,
0x6F, 0xFF, 0xF3,
0x6F, 0xFF, 0xF3,
0x6F, 0xFF, 0xF3,
0x6F, 0xFF, 0xF3,
0x1B, 0xFF, 0xCC,
0x10, 0xFF, 0x0C,
0x0F, 0x00, 0xF0,
0x00, 0xFF, 0x00
};
const GUI_BITMAP _bmRadio0 = {
12, /* XSize */
12, /* YSize */
3, /* BytesPerLine */
2, /* BitsPerPixel */
acRadio0, /* Pointer to picture data (indices) */
&PalRadio0 /* Pointer to palette */
};
const GUI_COLOR ColorsCheck1[] = {
0xFFFFFF,0x000000
};
C51 COMPILER V8.05a RADIO 04/11/2008 14:19:37 PAGE 3
const GUI_LOGPALETTE PalCheck1 = {
2, /* number of entries */
1, /* No transparency */
&ColorsCheck1[0]
};
const unsigned char acCheck1[] = {
_XX_____,
XXXX____,
XXXX____,
_XX_____
};
const GUI_BITMAP _bmCheck1 = {
4, /* XSize */
4, /* YSize */
1, /* BytesPerLine */
1, /* BitsPerPixel */
acCheck1, /* Pointer to picture data (indices) */
&PalCheck1 /* Pointer to palette */
};
/*********************************************************************
*
* Macros for internal use
*
**********************************************************************
*/
#define RADIO_ID 0x4544 /* Magic numer, should be unique if possible */
#define RADIO_H2P(h) (RADIO_Obj*) WM_H2P(h)
#ifdef _DEBUG
#define RADIO_ASSERT_IS_VALID_PTR(p) DEBUG_ERROROUT_IF(p->DebugId != RADIO_ID, "xxx.c: Wrong handle type
- or Object not init'ed")
#define RADIO_INIT_ID(p) p->DebugId = RADIO_ID
#define RADIO_DEINIT_ID(p) p->DebugId = RADIO_ID+1
#else
#define RADIO_ASSERT_IS_VALID_PTR(p)
#define RADIO_INIT_ID(p)
#define RADIO_DEINIT_ID(p)
#endif
/*********************************************************************
*
* Static routines
*
**********************************************************************
*/
/*********************************************************************
*
* _Paint
*/
static void _Paint(RADIO_Handle hObj, RADIO_Obj* pObj) {
int IsEnabled;
int i;
IsEnabled = WIDGET__IsEnabled(&pObj->Widget);
/* Clear inside ... Just in case */
/* Fill with parents background color */
C51 COMPILER V8.05a RADIO 04/11/2008 14:19:37 PAGE 4
GUI_SetBkColor(WIDGET__GetBkColor(hObj));
GUI_Clear();
for (i = 0; i < pObj->NumItems; i++) {
int y = i* pObj->Spacing;
_aColor[3] = pObj->aBkColor[IsEnabled];
GUI_DrawBitmap(&_bmRadio0, 2, 2 + y);
if (pObj->Sel == i) {
GUI_DrawBitmap(&_bmCheck1, 6, 6 + y);
}
}
if (pObj->Widget.State & WIDGET_STATE_FOCUS) {
GUI_RECT r;
WIDGET__GetClientRect(&pObj->Widget, &r);
GUI_SetColor(GUI_BLACK);
WIDGET__DrawFocusRect(&pObj->Widget, &r, 0);
}
}
/*********************************************************************
*
* _OnTouch
*/
static void _OnTouch(RADIO_Handle hObj, RADIO_Obj* pObj, WM_MESSAGE*pMsg) {
int Notification;
int Hit = 0;
GUI_TOUCH_tState* pState = (GUI_TOUCH_tState*)pMsg->Data.p;
if (pMsg->Data.p) { /* Something happened in our area (pressed or released) */
if (pState->Pressed) {
int y = pState->y;
int Sel = y / pObj->Spacing;
y -= Sel * pObj->Spacing;
if (pObj->Widget.State & WIDGET_STATE_ENABLED) {
if (y < pObj->Height) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -