?? widget.lst
字號:
C51 COMPILER V8.05a WIDGET 04/11/2008 14:19:39 PAGE 1
C51 COMPILER V8.05a, COMPILATION OF MODULE WIDGET
OBJECT MODULE PLACED IN Widget.obj
COMPILER INVOKED BY: D:\Program Files\keil\C51\BIN\C51.EXE gui\Widget\Widget.c LARGE BROWSE MDU_F120 DEBUG OBJECTEXTEND
-PRINT(.\Widget.lst) OBJECT(Widget.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 : BUTTON.c
16 Purpose : emWin GSC button widget
17 ---------------------------END-OF-HEADER------------------------------
18 */
19
20 #include <stdlib.h>
21 #include <string.h>
22
23 #include "WIDGET.h"
24 #include "gui\Core\GUIDebug.h"
25 #include "gui\Core\GUI.h"
26 #include "gui\Core\GUI_Protected.h"
27 #include "gui\WM\WM_Intern.h"
28
29 #if GUI_WINSUPPORT
/*********************************************************************
*
* Private config defaults
*
**********************************************************************
*/
/*********************************************************************
*
* Object definition
*
**********************************************************************
*/
/*********************************************************************
*
* Static data
*
**********************************************************************
*/
const WIDGET_EFFECT* _pEffectDefault = &WIDGET_Effect_3D;
C51 COMPILER V8.05a WIDGET 04/11/2008 14:19:39 PAGE 2
/*********************************************************************
*
* Macros for internal use
*
**********************************************************************
*/
#define WIDGET_H2P(hWin) ((WIDGET*)WM_HMEM2Ptr(hWin))
/*********************************************************************
*
* Static routines
*
**********************************************************************
*/
static void _RotateRect90(WIDGET* pWidget, GUI_RECT* pDest, const GUI_RECT* pRect) {
int XSize;
XSize = pWidget->Win.Rect.x1 - pWidget->Win.Rect.x0;
pDest->x0 = XSize - pRect->y1;
pDest->x1 = XSize - pRect->y0;
pDest->y0 = pRect->x0;
pDest->y1 = pRect->x1;
}
/*********************************************************************
*
* Public routines
*
**********************************************************************
*/
/*********************************************************************
*
* WIDGET__GetClientRect
Returns the logical client rectangle, which means the normal
client rectangle for widgets with their standard orientation
and the rotated one for rotated widgets.
*/
void WIDGET__GetClientRect(WIDGET* pWidget, GUI_RECT* pRect) {
if (pWidget->State & WIDGET_STATE_VERTICAL) {
GUI_RECT Rect;
WM_GetClientRect(&Rect);
pRect->x0 = Rect.y0;
pRect->x1 = Rect.y1;
pRect->y0 = Rect.x0;
pRect->y1 = Rect.x1;
} else {
WM_GetClientRect(pRect);
}
}
GUI_COLOR WIDGET__GetBkColor(WM_HWIN hObj) {
GUI_COLOR BkColor = WM_GetBkColor(WM_GetParent(hObj));
if (BkColor == GUI_INVALID_COLOR) {
BkColor = DIALOG_GetBkColor();
}
return BkColor;
}
C51 COMPILER V8.05a WIDGET 04/11/2008 14:19:39 PAGE 3
/*********************************************************************
*
* WIDGET__GetInsideRect
*/
void WIDGET__GetInsideRect(WIDGET* pWidget, GUI_RECT* pRect) {
WM__GetClientRectWin(&pWidget->Win, pRect);
GUI__ReduceRect(pRect, pRect, pWidget->pEffect->EffectSize);
}
int WIDGET__GetXSize(const WIDGET* pWidget) {
int r;
if (pWidget->State & WIDGET_STATE_VERTICAL) {
r = pWidget->Win.Rect.y1 - pWidget->Win.Rect.y0;
} else {
r = pWidget->Win.Rect.x1 - pWidget->Win.Rect.x0;
}
return r + 1;
}
int WIDGET__GetYSize(const WIDGET* pWidget) {
int r;
if (pWidget->State & WIDGET_STATE_VERTICAL) {
r = pWidget->Win.Rect.x1 - pWidget->Win.Rect.x0;
} else {
r = pWidget->Win.Rect.y1 - pWidget->Win.Rect.y0;
}
return r + 1;
}
/*******************************************************************
*
* WIDGET__GetWindowSizeX
Return width (or height in case of rotation) of window in pixels
*/
int WIDGET__GetWindowSizeX(WM_HWIN hWin) {
WIDGET* pWidget = WIDGET_H2P(hWin);
if (pWidget->State & WIDGET_STATE_VERTICAL) {
return WM_GetWindowSizeY(hWin);
} else {
return WM_GetWindowSizeX(hWin);
}
}
/*********************************************************************
*
* WIDGET_SetState
*/
void WIDGET_SetState(WM_HWIN hObj, int State) {
WIDGET* pWidget = WIDGET_H2P(hObj);
if (State != pWidget->State) {
pWidget->State = State;
WM_Invalidate(hObj);
}
}
/*********************************************************************
*
* WIDGET__IsEnabled
C51 COMPILER V8.05a WIDGET 04/11/2008 14:19:39 PAGE 4
Returns:
1 if Widget is enabled
0 else
*/
int WIDGET__IsEnabled(WIDGET* pWidget) {
return pWidget->State & WIDGET_STATE_ENABLED ? 1 : 0;
}
/*********************************************************************
*
* WIDGET_OrState
*/
void WIDGET_OrState(WM_HWIN hObj, int State) {
WIDGET* pWidget = WIDGET_H2P(hObj);
if (State != (pWidget->State & State)) {
pWidget->State |= State;
WM_Invalidate(hObj);
}
}
/*********************************************************************
*
* WIDGET_AndState
Purpose:
Clear flags in the State element of the widget.
The bits to be cleared are set.
Example:
...(..., 3); // Clears bit 0, 1 int the state member
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -