?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 * Progress Bar
5 *****************************************************************************
6 * FileName: ProgressBar.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 _PROGRESSBAR_H
42 #define _PROGRESSBAR_H
43  
44 #include <Graphics\GOL.h>
45  
46 /*********************************************************************
47 * Object States Definition:
48 *********************************************************************/
49 #define PB_DISABLED 0x0002 // Bit to indicate Progress Bar is in a disabled state.
50 #define PB_VERTICAL 0x0004 // Bit for orientation (0 - horizontal, 1 - vertical)
51 #define PB_HIDE 0x8000 // Bit to indicate Progress Bar must be hidden.
52 #define PB_DRAW_BAR 0x2000 // Bit to indicate Progress Bar must be redrawn.
53 #define PB_DRAW 0x4000 // Bit to indicate Progress Bar must be redrawn.
54  
55 /*****************************************************************************
56 * Overview: The structure contains data for the progress bar
57 *****************************************************************************/
58 typedef struct
59 {
60 OBJ_HEADER hdr; // Generic header for all Objects (see OBJ_HEADER).
61 WORD pos; // Current progress position.
62 WORD prevPos; // Previous progress position.
63 WORD range; // Sets the range of the object.
64 } PROGRESSBAR;
65  
66 /*********************************************************************
67 * Macros: PbGetPos(pPb)
68 *
69 * Overview: This macro returns the current progress bar position.
70 *
71 * PreCondition: none
72 *
73 * Input: pPb - Pointer to the object
74 *
75 * Output: Returns the progress bar position.
76 *
77 * Example:
78 * See PbSetPos() exmaple.
79 *
80 * Side Effects: none
81 *
82 ********************************************************************/
83 #define PbGetPos(pPb) pPb->pos
84  
85 /*********************************************************************
86 * Function: void PbSetPos(PROGRESSBAR *pPb, WORD position)
87 *
88 * Overview: This function sets the position of the progress bar.
89 * Position should be in the given range inclusive.
90 *
91 * PreCondition: none
92 *
93 * Input: pPb - Pointer to the object
94 * position - New position.
95 *
96 * Output: none
97 *
98 * Example:
99 * <CODE>
100 * PROGRESSBAR *pPb;
101 * BYTE direction = 1;
102 *
103 * // this code increments and decrements the progress bar by 1
104 * // assume progress bar was created and initialized before
105 * while (1) {
106 * if(direction) {
107 * if(pPb ->pos == pPb ->range)
108 * direction = 0;
109 * else
110 * PbSetPos(pPb,PbGetPos(pPb)+1);
111 * } else {
112 * if(pPb ->pos == 0)
113 * direction = 1;
114 * else
115 * PbSetPos(pPb,PbGetPos(pPb)-1);
116 * }
117 * }
118 * </CODE>
119 *
120 * Side Effects: none
121 *
122 ********************************************************************/
123 void PbSetPos(PROGRESSBAR *pPb, WORD position);
124  
125 /*********************************************************************
126 * Function: PROGRESSBAR *PbCreate( WORD ID, SHORT left, SHORT top,
127 * SHORT right, SHORT bottom, WORD state,
128 * WORD pos, WORD range, GOL_SCHEME *pScheme)
129 *
130 * Overview: This function creates a PROGRESSBAR object with the parameters
131 * given. It automatically attaches the new object into a global
132 * linked list of objects and returns the address of the object.
133 *
134 * PreCondition: none
135 *
136 * Input: ID - Unique user defined ID for the object instance.
137 * left - Left most position of the Object.
138 * top - Top most position of the Object.
139 * right - Right most position of the Object.
140 * bottom - Bottom most position of the Object.
141 * state - Sets the initial state of the Object.
142 * pos - Defines the initial position of the progress.
143 * range - This specifies the maximum value of the progress
144 * bar when the progress bar is at 100% position.
145 * pScheme - Pointer to the style scheme used for the object.
146 * Set to NULL if default style scheme is used.
147 *
148 * Output: Returns the pointer to the object created
149 *
150 * Example:
151 * <CODE>
152 * PROGRESSBAR *pPBar;
153 * void CreateProgressBar(){
154 * pPBar = PbCreate(ID_PROGRESSBAR1, // ID
155 * 50,90,270,140, // dimension
156 * PB_DRAW, // Draw the object
157 * 25, // position
158 * 50, // set the range
159 * NULL); // use default GOL scheme
160 * while(!PbDraw(pPBar));
161 * }
162 * </CODE>
163 *
164 * Side Effects: none
165 *
166 ********************************************************************/
167 PROGRESSBAR *PbCreate
168 (
169 WORD ID,
170 SHORT left,
171 SHORT top,
172 SHORT right,
173 SHORT bottom,
174 WORD state,
175 WORD pos,
176 WORD range,
177 GOL_SCHEME *pScheme
178 );
179  
180 /*********************************************************************
181 * Function: WORD PbTranslateMsg(PROGRESSBAR *pPb, GOL_MSG *pMsg)
182 *
183 * Overview: This function evaluates the message from a user if the
184 * message will affect the object or not. The table below
185 * enumerates the translated messages for each event of
186 * the touch screen inputs.
187 *
188 * <TABLE>
189 * Translated Message Input Source Events Description
190 * ################## ############ ###### ###########
191 * PB_MSG_SELECTED Touch Screen EVENT_PRESS, EVENT_RELEASE, EVENT_MOVE If events occurs and the x,y position falls in the area of the progress bar.
192 * OBJ_MSG_INVALID Any Any If the message did not affect the object.
193 * </TABLE>
194 *
195 * PreCondition: none
196 *
197 * Input: pPb - The pointer to the object where the message will be
198 * evaluated to check if the message will affect the object.
199 * pMsg - Pointer to the message struct containing the message from
200 * the user interface.
201 *
202 * Output: Returns the translated message depending on the received GOL message:
203 * - PB_MSG_SELECTED – Progress Bar is selected.
204 * - OBJ_MSG_INVALID – Progress Bar is not affected
205 *
206 * Example:
207 * Usage is similar to BtnTranslateMsg() example.
208 *
209 * Side Effects: none
210 *
211 ********************************************************************/
212 WORD PbTranslateMsg(PROGRESSBAR *pPb, GOL_MSG *pMsg);
213  
214 /*********************************************************************
215 * Function: WORD PbDraw(PROGRESSBAR *pPb)
216 *
217 * Overview: This function renders the object on the screen using
218 * the current parameter settings. Location of the object is
219 * determined by the left, top, right and bottom parameters.
220 * The colors used are dependent on the state of the object.
221 * The font used is determined by the style scheme set.
222 *
223 * When rendering objects of the same type, each object
224 * must be rendered completely before the rendering of the
225 * next object is started. This is to avoid incomplete
226 * object rendering.
227 *
228 * PreCondition: Object must be created before this function is called.
229 *
230 * Input: pPb - Pointer to the object to be rendered.
231 *
232 * Output: Returns the status of the drawing
233 * - 1 - If the rendering was completed and
234 * - 0 - If the rendering is not yet finished.
235 * Next call to the function will resume the
236 * rendering on the pending drawing state.
237 *
238 * Example:
239 * See PbCreate() example.
240 *
241 * Side Effects: none
242 *
243 ********************************************************************/
244 WORD PbDraw(PROGRESSBAR *pPb);
245  
246 /*********************************************************************
247 * Function: PbSetRange(PROGRESSBAR *pPb, WORD range)
248 *
249 * Overview: This function sets the range of the progress bar. Calling
250 * this function also resets the position equal to the new
251 * range value.
252 *
253 * PreCondition: none
254 *
255 * Input: pPb - Pointer to the object
256 *
257 * Output: none.
258 *
259 * Side Effects: Sets the position equal to the new range.
260 *
261 ********************************************************************/
262 void PbSetRange(PROGRESSBAR *pPb, WORD range);
263  
264 /*********************************************************************
265 * Macros: PbGetRange(pPb)
266 *
267 * Overview: This macro returns the current range of the progress bar.
268 *
269 * PreCondition: none
270 *
271 * Input: pPb - Pointer to the object
272 *
273 * Output: Returns the range value.
274 *
275 * Side Effects: none
276 *
277 ********************************************************************/
278 #define PbGetRange(pPb) (pPb->range)
279 #endif // _PROGRESSBAR_H
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3