?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{BLAME START}

library

?curdirlinks? -

Blame information for rev 32

Line No. Rev Author Line
1 32 kaklik /*****************************************************************************
2 * Module for Microchip Graphics Library
3 * GOL Layer
4 * Check box
5 *****************************************************************************
6 * FileName: CheckBox.h
7 * Dependencies: None
8 * Processor: PIC24F, PIC24H, dsPIC, PIC32
9 * Compiler: MPLAB C30 V3.00, MPLAB C32
10 * Linker: MPLAB LINK30, MPLAB LINK32
11 * Company: Microchip Technology Incorporated
12 *
13 * Software License Agreement
14 *
15 * Copyright © 2008 Microchip Technology Inc. All rights reserved.
16 * Microchip licenses to you the right to use, modify, copy and distribute
17 * Software only when embedded on a Microchip microcontroller or digital
18 * signal controller, which is integrated into your product or third party
19 * product (pursuant to the sublicense terms in the accompanying license
20 * agreement).
21 *
22 * You should refer to the license agreement accompanying this Software
23 * for additional information regarding your rights and obligations.
24 *
25 * SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY
26 * KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY
27 * OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR
28 * PURPOSE. IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR
29 * OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION,
30 * BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT
31 * DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL,
32 * INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA,
33 * COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY
34 * CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF),
35 * OR OTHER SIMILAR COSTS.
36 *
37 * Author Date Comment
38 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
39 * Anton Alkhimenok 11/12/07 Version 1.0 release
40 *****************************************************************************/
41 #ifndef _CHECKBOX_H
42 #define _CHECKBOX_H
43  
44 #include <Graphics\GOL.h>
45  
46 // This is indent from outside borders
47 #define CB_INDENT 2
48  
49 /*********************************************************************
50 * Object States Definition:
51 *********************************************************************/
52 #define CB_FOCUSED 0x0001 // Focus state
53 #define CB_DISABLED 0x0002 // Disabled state
54 #define CB_CHECKED 0x0004 // Checked state
55 #define CB_HIDE 0x8000 // Check box must be removed from screen
56 #define CB_DRAW_FOCUS 0x2000 // Focus must be redrawn
57 #define CB_DRAW 0x4000 // Whole check box must be redrawn
58 #define CB_DRAW_CHECK 0x1000 // Check box mark should be redrawn
59  
60 /*********************************************************************
61 * Overview: The structure contains check box data
62 *********************************************************************/
63 typedef struct
64 {
65 OBJ_HEADER hdr; // Generic header for all Objects (see OBJ_HEADER).
66 SHORT textHeight; // Pre-computed text height
67 XCHAR *pText; // Pointer to text
68 } CHECKBOX;
69  
70 /*********************************************************************
71 * Macros: CbGetText(pCb)
72 *
73 * Overview: This macro returns the location of the text
74 * used for the check box.
75 *
76 * PreCondition: none
77 *
78 * Input: pCb - Pointer to the object
79 *
80 * Output: Returns the location of the text used.
81 *
82 * Side Effects: none
83 *
84 ********************************************************************/
85 #define CbGetText(pCb) pCb->pText
86  
87 /*********************************************************************
88 * Function: CbSetText(CHECKBOX *pCb, XCHAR *pText)
89 *
90 * Overview: This function sets the text that will be used.
91 *
92 * PreCondition: none
93 *
94 * Input: pCb - The pointer to the check box whose text will be modified.
95 * pText - The pointer to the text that will be used.
96 *
97 * Output: none
98 *
99 * Side Effects: none
100 *
101 ********************************************************************/
102 void CbSetText(CHECKBOX *pCb, XCHAR *pText);
103  
104 /*********************************************************************
105 * Function: CHECKBOX *CbCreate(WORD ID, SHORT left, SHORT top, SHORT right,
106 * SHORT bottom, WORD state, XCHAR *pText,
107 * GOL_SCHEME *pScheme)
108 *
109 * Overview: This function creates a CHECKBOX object with the parameters
110 * given. It automatically attaches the new object into a
111 * global linked list of objects and returns the address
112 * of the object.
113 *
114 * PreCondition: none
115 *
116 * Input: ID - Unique user defined ID for the object instance.
117 * left - Left most position of the Object.
118 * top - Top most position of the Object.
119 * right - Right most position of the Object
120 * bottom - Bottom most position of the object
121 * state - Sets the initial state of the object
122 * pText - Pointer to the text of the check box.
123 * pScheme - Pointer to the style scheme
124 *
125 * Output: Returns the pointer to the object created
126 *
127 * Example:
128 * <CODE>
129 * GOL_SCHEME *pScheme;
130 * CHECKBOX *pCb[2];
131 *
132 * pScheme = GOLCreateScheme();
133 * pCb = CbCreate(ID_CHECKBOX1, // ID
134 * 20,135,150,175, // dimension
135 * CB_DRAW, // Draw the object
136 * "Scale", // text
137 * pScheme); // use this scheme
138 *
139 * pCb = CbCreate(ID_CHECKBOX2, // ID
140 * 170,135,300,175, // dimension
141 * CB_DRAW, // Draw the object
142 * "Animate", // text
143 * pScheme); // use this scheme
144 *
145 * while(!CbDraw(pCb[0])); // draw the objects
146 * while(!CbDraw(pCb[1]));
147 * </CODE>
148 *
149 * Side Effects: none
150 *
151 ********************************************************************/
152 CHECKBOX *CbCreate
153 (
154 WORD ID,
155 SHORT left,
156 SHORT top,
157 SHORT right,
158 SHORT bottom,
159 WORD state,
160 XCHAR *pText,
161 GOL_SCHEME *pScheme
162 );
163  
164 /*********************************************************************
165 * Function: WORD CbTranslateMsg(CHECKBOX *pCb, GOL_MSG *pMsg)
166 *
167 * Overview: This function evaluates the message from a user if
168 * the message will affect the object or not. The table
169 * below enumerates the translated messages for each event
170 * of the touch screen and keyboard inputs.
171 *
172 * <TABLE>
173 * Translated Message Input Source Events Description
174 * ################## ############ ###### ###########
175 * CB_MSG_CHECKED Touch Screen EVENT_PRESS If events occurs and the x,y position falls in the area of the check box while the check box is unchecked.
176 * Keyboard EVENT_KEYSCAN If event occurs and parameter1 passed matches the object’s ID and parameter 2 passed matches SCAN_CR_PRESSED or SCAN_SPACE_PRESSED while the check box is unchecked.
177 * CB_MSG_UNCHECKED Touch Screen EVENT_PRESS If events occurs and the x,y position falls in the area of the check box while the check box is checked.
178 * Keyboard EVENT_KEYSCAN If event occurs and parameter1 passed matches the object’s ID and parameter 2 passed matches SCAN_CR_PRESSED or SCAN_SPACE_PRESSED while the check box is checked.
179 * OBJ_MSG_INVALID Any Any If the message did not affect the object.
180 * </TABLE>
181 *
182 * PreCondition: none
183 *
184 * Input: pMsg - pointer to the message struct containing the message the user
185 * pCb - the pointer to the object where the message will be
186 * evaluated to check if the message will affect the object
187 *
188 * Output: Returns the translated message depending on the received GOL message:
189 * - CB_MSG_CHECKED – Check Box is checked.
190 * - CB_MSG_UNCHECKED – Check Box is unchecked.
191 * - OBJ_MSG_INVALID – Check Box is not affected.
192 *
193 * Example:
194 * Usage is similar to BtnTranslateMsg() example.
195 *
196 * Side Effects: none
197 *
198 ********************************************************************/
199 WORD CbTranslateMsg(CHECKBOX *pCb, GOL_MSG *pMsg);
200  
201 /*********************************************************************
202 * Function: CbMsgDefault(WORD translatedMsg, CHECKBOX *pCb, GOL_MSG* pMsg)
203 *
204 * Overview: This function performs the actual state change
205 * based on the translated message given. The following state changes
206 * are supported:
207 * <TABLE>
208 * Translated Message Input Source Set/Clear State Bit Description
209 * ################## ############ ###### ###########
210 * CB_MSG_CHECKED Touch Screen, Set CB_CHECKED Check Box will be redrawn in checked state.
211 * Keyboard
212 * CB_MSG_UNCHECKED Touch Screen, Clear CB_CHECKED Check Box will be redrawn in un-checked state.
213 * Keyboard
214 * </TABLE>
215 *
216 * PreCondition: none
217 *
218 * Input: translatedMsg - The translated message
219 * pCb - The pointer to the object whose state will be modified
220 * pMsg - The pointer to the GOL message
221 *
222 * Output: none
223 *
224 * Side Effects: none
225 *
226 ********************************************************************/
227 void CbMsgDefault(WORD translatedMsg, CHECKBOX *pCb, GOL_MSG *pMsg);
228  
229 /*********************************************************************
230 * Function: WORD CbDraw(CHECKBOX *pCb)
231 *
232 * Overview: This function renders the object on the screen using
233 * the current parameter settings. Location of the object
234 * is determined by the left, top, right and bottom parameters.
235 * The colors used are dependent on the state of the object.
236 * The font used is determined by the style scheme set.
237 *
238 * When rendering objects of the same type, each object must
239 * be rendered completely before the rendering of the next
240 * object is started. This is to avoid incomplete object rendering.
241 *
242 * PreCondition: Object must be created before this function is called.
243 *
244 * Input: pCb - Pointer to the object to be rendered.
245 *
246 * Output: Returns the status of the drawing
247 * - 1 - If the rendering was completed and
248 * - 0 - If the rendering is not yet finished.
249 *
250 * Next call to the function will resume the
251 * rendering on the pending drawing state.
252 *
253 * Example:
254 * See CbCreate() Example.
255 *
256 * Side Effects: none
257 *
258 ********************************************************************/
259 WORD CbDraw(CHECKBOX *pCb);
260 #endif // _CHECKBOX_H
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3