?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 *
3 * Module for Microchip Graphics Library
4 * GOL Layer
5 * This template can be used to create additional controls
6 *
7 *****************************************************************************
8 * FileName: Template.c
9 * Dependencies: none
10 * Processor: PIC24F, PIC24H, dsPIC, PIC32
11 * Compiler: MPLAB C30 V3.00
12 * Linker: MPLAB LINK30
13 * Company: Microchip Technology Incorporated
14 *
15 * Software License Agreement
16 *
17 * Copyright © 2008 Microchip Technology Inc. All rights reserved.
18 * Microchip licenses to you the right to use, modify, copy and distribute
19 * Software only when embedded on a Microchip microcontroller or digital
20 * signal controller, which is integrated into your product or third party
21 * product (pursuant to the sublicense terms in the accompanying license
22 * agreement).
23 *
24 * You should refer to the license agreement accompanying this Software
25 * for additional information regarding your rights and obligations.
26 *
27 * SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY
28 * KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY
29 * OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR
30 * PURPOSE. IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR
31 * OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION,
32 * BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT
33 * DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL,
34 * INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA,
35 * COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY
36 * CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF),
37 * OR OTHER SIMILAR COSTS.
38 *
39 * Author Date Comment
40 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41 * Anton Alkhimenok 11/12/07 Version 1.0 release
42 *****************************************************************************/
43 #ifdef USE_CUSTOM
44  
45 #include "Graphics\Graphics.h"
46  
47 /*********************************************************************
48 * Function: CUSTOM* CcCreate(WORD ID, SHORT left, SHORT top, SHORT right,
49 * SHORT bottom, WORD state, GOL_SCHEME *pScheme)
50 *
51 * PreCondition: none
52 *
53 * Input: ID - user defined ID for the object
54 * left, top, right, bottom - location of the left,top and
55 * right, bottom corners of the object
56 * state - state of the object
57 * pScheme - pointer to the color scheme and font used for the object
58 *
59 * Output: returns the pointer to the object created
60 *
61 * Overview: creates the object and initialize with the passed parameters and
62 * default settings
63 *
64 * Note: none
65 *
66 ********************************************************************/
67 CUSTOM *CcCreate(WORD ID, SHORT left, SHORT top, SHORT right, SHORT bottom, WORD state, GOL_SCHEME *pScheme)
68 {
69 CUSTOM *pCc = NULL;
70  
71 pCc = GFX_malloc(sizeof(CUSTOM));
72 if(pCc == NULL)
73 return (pCc);
74  
75 pCc->ID = ID; // unique id assigned for referencing
76 pCc->pNxtObj = NULL; // initialize pointer to NULL
77 pCc->type = OBJ_CUSTOM; // set object type
78 pCc->left = left; // left,top corner
79 pCc->top = top;
80 pCc->right = right; // right buttom corner
81 pCc->bottom = bottom;
82 pCc->state = state; // set state
83  
84 // Set the color scheme to be used
85 if(pScheme == NULL)
86 pCc->pGolScheme = _pDefaultGolScheme;
87 else
88 pCc->pGolScheme = (GOL_SCHEME *)pScheme;
89  
90 GOLAddObject((OBJ_HEADER *)pCc);
91  
92 return (pCc);
93 }
94  
95 /*********************************************************************
96 * Function: WORD CcTranslateMsg(CUSTOM *pCc, GOL_MSG *pMsg)
97 *
98 * PreCondition: none
99 *
100 * Input: pMsg - pointer to the message struct containing the message from
101 * the user interface
102 * pCc - the pointer to the object where the message will be tested
103 * to check if the message will affect the object
104 *
105 * Output: returns the action that the object will be performing
106 *
107 * Overview: evaluates the message if the object will be affected by the
108 * message or not
109 *
110 * Note: THIS FUNCTION CALL SHOULD BE ADDED INTO GOLMsg() FUNCTION IN
111 * GOL.C FILE
112 *
113 ********************************************************************/
114 WORD CcTranslateMsg(CUSTOM *pCc, GOL_MSG *pMsg)
115 {
116  
117 // Check if disabled first
118 if(GetState(pCc, CC_DISABLED))
119 return (OBJ_MSG_INVALID);
120  
121 // TRANSLATE MESSAGE FOR THE INPUT DEVICES
122 // TRANSLATED MESSAGES SHOULD BE ADDED INTO TRANS_MSG ENUMERATION IN GOL.H FILE
123 #ifdef USE_TOUCHSCREEN
124 #endif
125 #ifdef USE_KEYBOARD
126 #endif
127 #ifdef USE_MOUSE
128 #endif
129 return (OBJ_MSG_INVALID);
130 }
131  
132 /*********************************************************************
133 * Function: void CcMsgDefault(CUSTOM* pCc, GOL_MSG* pMsg)
134 *
135 * PreCondition: None
136 *
137 * Input: pMsg - pointer to the message struct containing the message the user
138 * pCc - the pointer to the object whose state will be modified
139 *
140 * Output: none
141 *
142 * Side Effects:
143 *
144 * Overview: changes the state of the object
145 *
146 * Note: THIS FUNCTION CALL SHOULD BE ADDED INTO GOLMsg() FUNCTION IN
147 * GOL.C FILE
148 *
149 ********************************************************************/
150 void CcMsgDefault(CUSTOM *pCc, GOL_MSG *pMsg)
151 {
152  
153 // IMPLEMENT DEFAULT ACTIONS FOR TRANSLATED MESSAGES HERE
154 }
155  
156 /*********************************************************************
157 * Function: WORD CcDraw(CUSTOM *pCc)
158 *
159 * PreCondition: object must be created before this is called
160 *
161 * Input: pCc - pointer to struct CUSTOM with data
162 *
163 * Output: returns the status of the drawing
164 * 0 - not complete
165 * 1 - done
166 *
167 * Overview: draws control
168 *
169 * Note: THIS FUNCTION CALL SHOULD BE ADDED INTO GOLDraw() FUNCTION IN
170 * GOL.C FILE
171 *
172 ********************************************************************/
173 WORD CcDraw(CUSTOM *pCc)
174 {
175 typedef enum
176 {
177 REMOVE,
178 BOX_DRAW,
179 RUN_DRAW
180 } CC_DRAW_STATES;
181  
182 static CC_DRAW_STATES state = REMOVE;
183  
184 switch(state)
185 {
186 case REMOVE:
187 if(GetState(pCc, CC_HIDE))
188 {
189 SetColor(pCc->pGolScheme->CommonBkColor);
190 if(!Bar(pCc->left, pCc->top, pCc->right, pCc->bottom))
191 return (0);
192 return (1);
193 }
194  
195 state = BOX_DRAW;
196  
197 case BOX_DRAW:
198 if(GetState(pCc, CC_DRAW))
199 {
200 GOLPanelDraw
201 (
202 pCc->left,
203 pCc->top,
204 pCc->right,
205 pCc->bottom,
206 pCc->pGolScheme->Color0,
207 pCc->pGolScheme->EmbossDkColor,
208 pCc->pGolScheme->EmbossLtColor,
209 NULL,
210 GOL_EMBOSS_SIZE
211 );
212 }
213 else
214 {
215 state = BAR_DRAW;
216 goto bar_draw;
217 }
218  
219 state = RUN_DRAW;
220  
221 case RUN_DRAW:
222 if(!GOLPanelDrawTsk())
223 {
224 return (0);
225 }
226  
227 // DRAWING IS DONE
228 state = REMOVE;
229 return (1);
230 }
231 }
232  
233 #endif // USE_CUSTOM
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3