Browse Source

cmUi.h/c and cmUiDrvr.h/c: Many changes and additions.

master
kevin 11 years ago
parent
commit
cb693a1c8e
4 changed files with 820 additions and 483 deletions
  1. 664
    366
      cmUi.c
  2. 112
    88
      cmUi.h
  3. 6
    2
      cmUiDrvr.c
  4. 38
    27
      cmUiDrvr.h

+ 664
- 366
cmUi.c
File diff suppressed because it is too large
View File


+ 112
- 88
cmUi.h View File

@@ -61,8 +61,13 @@ extern "C" {
61 61
     and all callbacks from the cmUi to the master app. 
62 62
     use the cmUiDriverArg_t structure 
63 63
 
64
+    3) The panel tabs act like radio buttons.  When a tab is
65
+    selected the clicked tab generates one event for each
66
+    tab (cId=kPanelUiCId usrId=panelId) w/ ival=1 for the 
67
+    selected tab and ival=0 for all other tabs.
68
+
64 69
     TODO:
65
-    0) Remove the 'cbArg' from the cmUiDriverArg_t record and 
70
+    0) [DONE] Remove the 'cbArg' from the cmUiDriverArg_t record and 
66 71
     pass it as a separate paramenter in the cmUiDriverFunc_t calls.
67 72
 
68 73
     1) The controls should be based on a multilevel tree model
@@ -93,9 +98,9 @@ extern "C" {
93 98
     Many of the fields are not use for event callbacks.
94 99
     Which fields are used under which circumstances should
95 100
     be documented. This would allow decreasing the size
96
-    of the record during serialization.7
101
+    of the record during serialization.
97 102
 
98
-    6) Write a serialization/deserialization routines for cmUiDriverArg_t.
103
+    6) [DONE] Write a serialization/deserialization routines for cmUiDriverArg_t.
99 104
     unsigned cmUiDriverArgSerialBufByteCount(const cmUiDriverArg_t* a);
100 105
     cmUiRC_t cmUiDriverArgSerialize( const cmUiDriverArg_t* a, char* buf, bufByteCnt );
101 106
     cmUiRC_t cmUiDriverArgDeserialize( cmUiDriverArg_t* a, const char* buf, bufByteCnt );
@@ -153,7 +158,11 @@ extern "C" {
153 158
   // Automatically sets and restores the ambient appId.
154 159
   // In a plug-in context this function is generally called 
155 160
   // just prior a instantiating a plug-in object.
156
-  cmUiRC_t cmUiCreateApp(  cmUiH_t uiH, unsigned appId );
161
+  cmUiRC_t cmUiCreateApp(  cmUiH_t uiH, unsigned appId, unsigned asSubIdx );
162
+
163
+  // Return true if 'appId' is active.
164
+  bool     cmUiAppIsActive( cmUiH_t uiH, unsigned appId );
165
+
157 166
 
158 167
   // Notify the cmUi manager that the resources associated
159 168
   // with a client application can be released.
@@ -170,7 +179,10 @@ extern "C" {
170 179
   // 'appId' an ambient parameter the User API calls are slightly
171 180
   // simplified because they do not have to include it in each of the
172 181
   // function calls.
173
-  cmUiRC_t cmUiSetAppId( cmUiH_t uiH, unsigned appId );
182
+  //cmUiRC_t cmUiSetAppId( cmUiH_t uiH, unsigned appId );
183
+  //unsigned cmUiAppId(    cmUiH_t uiH );
184
+
185
+  unsigned cmUiAppIdToAsSubIndex( cmUiH_t uiH, unsigned appId );
174 186
 
175 187
   // Return the count of app's.
176 188
   unsigned cmUiAppCount( cmUiH_t uiH );
@@ -185,46 +197,59 @@ extern "C" {
185 197
   // Client Application API
186 198
   //
187 199
 
188
-
189
-  cmUiRC_t cmUiCreatePanel(   cmUiH_t uiH, unsigned newPanelId, const cmChar_t* label );
190
-
191
-  cmUiRC_t cmUiCreateBtn(         cmUiH_t uiH, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags );
192
-  cmUiRC_t cmUiCreateCheck(       cmUiH_t uiH, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, bool dflt );
193
-  cmUiRC_t cmUiCreateLabel(       cmUiH_t uiH, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags );
194
-  cmUiRC_t cmUiCreateText(        cmUiH_t uiH, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, const cmChar_t* text );  
195
-  cmUiRC_t cmUiCreateNumber(      cmUiH_t uiH, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, double min, double max, double incr, double dflt );
196
-  cmUiRC_t cmUiCreateHSlider(     cmUiH_t uiH, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, double min, double max, double incr, double dflt );
197
-  cmUiRC_t cmUiCreateVSlider(     cmUiH_t uiH, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, double min, double max, double incr, double dflt );
198
-  cmUiRC_t cmUiCreateProgress(    cmUiH_t uiH, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, int    min, int    max, int    dflt );
199
-  cmUiRC_t cmUiCreateHMeter(      cmUiH_t uiH, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, int    min, int    max, int    dflt ); 
200
-  cmUiRC_t cmUiCreateVMeter(      cmUiH_t uiH, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, int    min, int    max, int    dflt ); 
201
-  cmUiRC_t cmUiCreateFileBtn(     cmUiH_t uiH, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, const cmChar_t* dfltDir, const cmChar_t* patStr );
202
-  cmUiRC_t cmUiCreateDirBtn(      cmUiH_t uiH, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, const cmChar_t* dfltDir );
203
-  cmUiRC_t cmUiCreateMenuBtn(     cmUiH_t uiH, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags );
204
-  cmUiRC_t cmUiCreateMenuBtnV(    cmUiH_t uiH, unsigned panelId, unsigned id, const cmChar_t* lavel, unsigned flags, const cmChar_t* label0, unsigned id0, va_list vl );
205
-  cmUiRC_t cmUiCreateMenuBtnA(    cmUiH_t uiH, unsigned panelId, unsigned id, const cmChar_t* lavel, unsigned flags, const cmChar_t* label0, unsigned id0, ... );
206
-  cmUiRC_t cmUiCreateMenuBtnJson( cmUiH_t uiH, unsigned panelId, unsigned id, const cmChar_t* lavel, unsigned flags, const cmJsonNode_t* root, const cmChar_t* memberLabel );
207
-  cmUiRC_t cmUiCreateList(        cmUiH_t uiH, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, unsigned visibleRowCnt );
208
-  cmUiRC_t cmUiCreateListV(       cmUiH_t uiH, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, unsigned visibleRowCnt, const cmChar_t* label0, unsigned id0, va_list vl );
209
-  cmUiRC_t cmUiCreateListA(       cmUiH_t uiH, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, unsigned visibleRowCnt, const cmChar_t* label0, unsigned id0, ... );
210
-  cmUiRC_t cmUiCreateListJson(    cmUiH_t uiH, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, unsigned visibleRowCnt, const cmJsonNode_t* root, const cmChar_t* memberLabel );
200
+  // See above note on panel tabs acting like radio buttons.
201
+  cmUiRC_t cmUiCreatePanel(   cmUiH_t uiH, unsigned appId, unsigned newPanelId, const cmChar_t* label, unsigned flags );
202
+
203
+  cmUiRC_t cmUiCreateBtn(         cmUiH_t uiH, unsigned appId, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags );
204
+  cmUiRC_t cmUiCreateCheck(       cmUiH_t uiH, unsigned appId, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, bool dflt );
205
+  cmUiRC_t cmUiCreateLabel(       cmUiH_t uiH, unsigned appId, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags );
206
+  cmUiRC_t cmUiCreateString(      cmUiH_t uiH, unsigned appId, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, const cmChar_t* text );  
207
+  cmUiRC_t cmUiCreateConsole(     cmUiH_t uiH, unsigned appId, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, const cmChar_t* text );
208
+  cmUiRC_t cmUiCreateNumber(      cmUiH_t uiH, unsigned appId, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, double min, double max, double incr, double dflt );
209
+  cmUiRC_t cmUiCreateHSlider(     cmUiH_t uiH, unsigned appId, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, double min, double max, double incr, double dflt );
210
+  cmUiRC_t cmUiCreateVSlider(     cmUiH_t uiH, unsigned appId, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, double min, double max, double incr, double dflt );
211
+  cmUiRC_t cmUiCreateProgress(    cmUiH_t uiH, unsigned appId, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, int    min, int    max, int    dflt );
212
+  cmUiRC_t cmUiCreateHMeter(      cmUiH_t uiH, unsigned appId, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, int    min, int    max, int    dflt ); 
213
+  cmUiRC_t cmUiCreateVMeter(      cmUiH_t uiH, unsigned appId, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, int    min, int    max, int    dflt ); 
214
+  cmUiRC_t cmUiCreateFileBtn(     cmUiH_t uiH, unsigned appId, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, const cmChar_t* dfltDir, const cmChar_t* patStr );
215
+  cmUiRC_t cmUiCreateDirBtn(      cmUiH_t uiH, unsigned appId, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, const cmChar_t* dfltDir );
216
+  cmUiRC_t cmUiCreateMenuBtn(     cmUiH_t uiH, unsigned appId, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags );
217
+  cmUiRC_t cmUiCreateMenuBtnV(    cmUiH_t uiH, unsigned appId, unsigned panelId, unsigned id, const cmChar_t* lavel, unsigned flags, const cmChar_t* label0, unsigned id0, va_list vl );
218
+  cmUiRC_t cmUiCreateMenuBtnA(    cmUiH_t uiH, unsigned appId, unsigned panelId, unsigned id, const cmChar_t* lavel, unsigned flags, const cmChar_t* label0, unsigned id0, ... );
219
+  cmUiRC_t cmUiCreateMenuBtnJson( cmUiH_t uiH, unsigned appId, unsigned panelId, unsigned id, const cmChar_t* lavel, unsigned flags, const cmJsonNode_t* root, const cmChar_t* memberLabel );
220
+  cmUiRC_t cmUiCreateList(        cmUiH_t uiH, unsigned appId, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, unsigned visibleRowCnt );
221
+  cmUiRC_t cmUiCreateListV(       cmUiH_t uiH, unsigned appId, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, unsigned visibleRowCnt, const cmChar_t* label0, unsigned id0, va_list vl );
222
+  cmUiRC_t cmUiCreateListA(       cmUiH_t uiH, unsigned appId, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, unsigned visibleRowCnt, const cmChar_t* label0, unsigned id0, ... );
223
+  cmUiRC_t cmUiCreateListJson(    cmUiH_t uiH, unsigned appId, unsigned panelId, unsigned id, const cmChar_t* label, unsigned flags, unsigned visibleRowCnt, const cmJsonNode_t* root, const cmChar_t* memberLabel );
211 224
 
212 225
   // If 'id' identifies a 'list' control use tabs as column separators.
213
-  cmUiRC_t cmUiAppendListEle(    cmUiH_t uiH, unsigned panelId, unsigned id, const cmChar_t* text, unsigned eleId );
226
+  cmUiRC_t cmUiAppendListEle(    cmUiH_t uiH, unsigned appId, unsigned panelId, unsigned id, const cmChar_t* text, unsigned eleId );
227
+
228
+  // Remove all the elements of a list control.
229
+  cmUiRC_t cmUiClearList(        cmUiH_t uiH, unsigned appId, unsigned panelId, unsigned id );
230
+
231
+  // Enable/Disable a control
232
+  cmUiRC_t cmUiEnableCtl( cmUiH_t uiH, unsigned appId, unsigned panelId, unsigned id, bool enableFl );
233
+  
234
+  // Enable/disable all controls on a panel except those included in the var args list.
235
+  // Terminate the var args list with cmInvalidId.
236
+  cmUiRC_t cmUiEnableAllExceptV( cmUiH_t uiH, unsigned appId, unsigned panelId, bool enableFl, va_list vl );
237
+  cmUiRC_t cmUiEnableAllExcept( cmUiH_t uiH, unsigned appId, unsigned panelId, bool enableFl, ... );
214 238
 
215 239
   // If 'id' identifies a panel then all control belonging to the panel
216 240
   // will also be destroyed.
217
-  cmUiRC_t cmUiDestroyCtl(    cmUiH_t uiH, unsigned id );
241
+  cmUiRC_t cmUiDestroyCtl(    cmUiH_t uiH, unsigned appId, unsigned id );
218 242
 
219 243
   // Returns true if the control exists.
220 244
   // For panels set id=panelId.
221
-  bool     cmUiCtlExists(     cmUiH_t uiH, unsigned panelId, unsigned id );
245
+  //bool     cmUiCtlExists(     cmUiH_t uiH, unsigned appId, unsigned panelId, unsigned id );
222 246
 
223 247
   // Destroy all the controls in a panel.
224
-  cmUiRC_t cmUiClearPanel( cmUiH_t uiH, unsigned panelId );
225
-
248
+  cmUiRC_t cmUiClearPanel( cmUiH_t uiH, unsigned appId, unsigned panelId );
226 249
 
250
+  //------------------------------------------------------------------------------------------
227 251
   // Location: 
252
+
228 253
   // 1) If a 'next rect' is set the control will be placed according to it.
229 254
   // 2) If cmUiSetBaseCol() was set then the control will be placed at the
230 255
   //    base col and base row.
@@ -242,29 +267,29 @@ extern "C" {
242 267
   // Get/Set the fill directions. If the 'fill columns' flag is enabled
243 268
   // then the next control is placed below the previous control otherwise
244 269
   // the next control is placed to the right of the next control.
245
-  bool    cmUiFillRows( cmUiH_t uiH, unsigned panelId );
246
-  bool    cmUiSetFillRows( cmUiH_t uiH, unsigned panelId, bool enableFl );
270
+  bool    cmUiFillRows( cmUiH_t uiH, unsigned appId, unsigned panelId );
271
+  bool    cmUiSetFillRows( cmUiH_t uiH, unsigned appId, unsigned panelId, bool enableFl );
247 272
 
248 273
   
249 274
   // Place the next control to the right/below of the previous ctl.
250 275
   // These flags override the current fill row/col setting.
251 276
   // Note that 'place right' and 'place below' are mutually
252 277
   // exclusive. Enabling one disables the other.
253
-  void     cmUiPlaceRight( cmUiH_t uiH, unsigned panelId );          
254
-  void     cmUiPlaceBelow( cmUiH_t uiH, unsigned panelId );
278
+  void     cmUiPlaceRight( cmUiH_t uiH, unsigned appId, unsigned panelId );          
279
+  void     cmUiPlaceBelow( cmUiH_t uiH, unsigned appId, unsigned panelId );
255 280
 
256 281
   // Place the next control at the base column below the previous ctl.
257
-  void     cmUiNewLine(    cmUiH_t uiH, unsigned panelId );
282
+  void     cmUiNewLine(    cmUiH_t uiH, unsigned appId, unsigned panelId );
258 283
 
259 284
   // Set/Get current base col and return previous value. Place the next
260 285
   // control on the base row.
261
-  int      cmUiBaseCol(       cmUiH_t uiH, unsigned panelId );
262
-  int      cmUiSetBaseCol(    cmUiH_t uiH, unsigned panelId, int x );   
286
+  int      cmUiBaseCol(       cmUiH_t uiH, unsigned appId, unsigned panelId );
287
+  int      cmUiSetBaseCol(    cmUiH_t uiH, unsigned appId, unsigned panelId, int x );   
263 288
 
264 289
 
265 290
   // Set/Get current base row and return previous value.
266
-  int      cmUiBaseRow(       cmUiH_t uiH, unsigned panelId );
267
-  int      cmUiSetBaseRow(    cmUiH_t uiH, unsigned panelId, int y );   
291
+  int      cmUiBaseRow(       cmUiH_t uiH, unsigned appId, unsigned panelId );
292
+  int      cmUiSetBaseRow(    cmUiH_t uiH, unsigned appId, unsigned panelId, int y );   
268 293
 
269 294
   // Size:
270 295
   // 1) If a 'next rect' is set the control will be placed according
@@ -277,81 +302,80 @@ extern "C" {
277 302
 
278 303
   // Get/Set the default control width and height.
279 304
   // Set returns previous value.
280
-  int      cmUiW(      cmUiH_t uiH, unsigned panelId );         
281
-  int      cmUiH(      cmUiH_t uiH, unsigned panelId );
282
-  int      cmUiSetW(   cmUiH_t uiH, unsigned panelId, int w );
283
-  int      cmUiSetH(   cmUiH_t uiH, unsigned panelId, int h );
284
-  void     cmUiSetWH(  cmUiH_t uiH, unsigned panelId, int w, int h );
305
+  int      cmUiW(      cmUiH_t uiH, unsigned appId, unsigned panelId );         
306
+  int      cmUiH(      cmUiH_t uiH, unsigned appId, unsigned panelId );
307
+  int      cmUiSetW(   cmUiH_t uiH, unsigned appId, unsigned panelId, int w );
308
+  int      cmUiSetH(   cmUiH_t uiH, unsigned appId, unsigned panelId, int h );
309
+  void     cmUiSetWH(  cmUiH_t uiH, unsigned appId, unsigned panelId, int w, int h );
285 310
 
286 311
   // Get/Set the control width and height for only the next control.
287 312
   // Set returns previous value.
288
-  int      cmUiNextW(     cmUiH_t uiH, unsigned panelId );
289
-  int      cmUiNextH(     cmUiH_t uiH, unsigned panelId );
290
-  void     cmUiSetNextW(  cmUiH_t uiH, unsigned panelId, int w );
291
-  void     cmUiSetNextH(  cmUiH_t uiH, unsigned panelId, int h );
292
-  void     cmUiSetNextWH( cmUiH_t uiH, unsigned panelId, int w, int h );
313
+  int      cmUiNextW(     cmUiH_t uiH, unsigned appId, unsigned panelId );
314
+  int      cmUiNextH(     cmUiH_t uiH, unsigned appId, unsigned panelId );
315
+  void     cmUiSetNextW(  cmUiH_t uiH, unsigned appId, unsigned panelId, int w );
316
+  void     cmUiSetNextH(  cmUiH_t uiH, unsigned appId, unsigned panelId, int h );
317
+  void     cmUiSetNextWH( cmUiH_t uiH, unsigned appId, unsigned panelId, int w, int h );
293 318
 
294 319
   // Get/Set the default inter-control borders
295 320
   // Set returns previous value.
296
-  int      cmUiHBorder( cmUiH_t uiH, unsigned panelId );
297
-  int      cmUiVBorder( cmUiH_t uiH, unsigned panelId );
298
-  int      cmUiSetHBorder( cmUiH_t uiH, unsigned panelId, int w );
299
-  int      cmUiSetVBorder( cmUiH_t uiH, unsigned panelId, int h );
321
+  int      cmUiHBorder( cmUiH_t uiH, unsigned appId, unsigned panelId );
322
+  int      cmUiVBorder( cmUiH_t uiH, unsigned appId, unsigned panelId );
323
+  int      cmUiSetHBorder( cmUiH_t uiH, unsigned appId, unsigned panelId, int w );
324
+  int      cmUiSetVBorder( cmUiH_t uiH, unsigned appId, unsigned panelId, int h );
300 325
 
301 326
   // Get/Set the 'next' inter-control borders
302 327
   // Set returns previous value.
303
-  int      cmUiNextHBorder( cmUiH_t uiH, unsigned panelId );
304
-  int      cmUiNextVBorder( cmUiH_t uiH, unsigned panelId );
305
-  int      cmUiSetNextHBorder( cmUiH_t uiH, unsigned panelId, int w );
306
-  int      cmUiSetNextVBorder( cmUiH_t uiH, unsigned panelId, int h );
328
+  int      cmUiNextHBorder( cmUiH_t uiH, unsigned appId, unsigned panelId );
329
+  int      cmUiNextVBorder( cmUiH_t uiH, unsigned appId, unsigned panelId );
330
+  int      cmUiSetNextHBorder( cmUiH_t uiH, unsigned appId, unsigned panelId, int w );
331
+  int      cmUiSetNextVBorder( cmUiH_t uiH, unsigned appId, unsigned panelId, int h );
307 332
 
308 333
   // Place the next control at the following coordinates. The 
309 334
   // specified coordinates are only active during the next
310 335
   // cmUiCreateXXX() call. Setting the 'next rect' overrides all
311 336
   // other layout directives.
312
-  cmUiRC_t cmUiNextRect( cmUiH_t uiH, unsigned panelId, int x, int y, int w, int h );
337
+  cmUiRC_t cmUiNextRect( cmUiH_t uiH, unsigned appId, unsigned panelId, int x, int y, int w, int h );
313 338
   
314 339
   // Get the location/size of the previously created control.
315 340
   // All ref. args are optional.
316
-  cmUiRC_t cmUiPrevRect( cmUiH_t uiH, unsigned panelId, int* xRef, int* yRef, int* wRef, int* hRef );
317
-  int      cmUiPrevL(    cmUiH_t uiH, unsigned panelId );
318
-  int      cmUiPrevT(    cmUiH_t uiH, unsigned panelId );
319
-  int      cmUiPrevR(    cmUiH_t uiH, unsigned panelId );
320
-  int      cmUiPrevB(    cmUiH_t uiH, unsigned panelId );
321
-  int      cmUiPrevW(    cmUiH_t uiH, unsigned panelId );
322
-  int      cmUiPrevH(    cmUiH_t uiH, unsigned panelId );
323
-
324
-
341
+  cmUiRC_t cmUiPrevRect( cmUiH_t uiH, unsigned appId, unsigned panelId, int* xRef, int* yRef, int* wRef, int* hRef );
342
+  int      cmUiPrevL(    cmUiH_t uiH, unsigned appId, unsigned panelId );
343
+  int      cmUiPrevT(    cmUiH_t uiH, unsigned appId, unsigned panelId );
344
+  int      cmUiPrevR(    cmUiH_t uiH, unsigned appId, unsigned panelId );
345
+  int      cmUiPrevB(    cmUiH_t uiH, unsigned appId, unsigned panelId );
346
+  int      cmUiPrevW(    cmUiH_t uiH, unsigned appId, unsigned panelId );
347
+  int      cmUiPrevH(    cmUiH_t uiH, unsigned appId, unsigned panelId );
348
+
349
+  //------------------------------------------------------------------------------------------
325 350
   //
326 351
   // Get/set the value of UI control.  
327 352
   //
328 353
 
329 354
   // TODO:
330
-  // 1) Still need functions for setting auxilliary values like
355
+  // +  Need functions for setting auxilliary values like
331 356
   //    min,max,etc..
332
-  // 2) A coherent model needs to be selected for determining
333
-  //    how local values get set.  As it is local values are
334
-  //    only set via callbacs from the UI driver.
335 357
 
336 358
   // Set the value associated with a control.   
337
-  // These functions would be better named 'cmUiSendXXX()' since
338
-  // they don't actually set the local value but rather call the
339
-  // driver to set the UI value. The driver may then respond with
340
-  // a callback which will set the local value. One advantage of
341
-  // this is that the value will be filtered according to the
342
-  // ui's rules (e.g. min, max .... ) 
343
-  cmUiRC_t  cmUiSetInt(    cmUiH_t uiH,  unsigned id, int v );
344
-  cmUiRC_t  cmUiSetUInt(   cmUiH_t uiH,  unsigned id, unsigned v );
345
-  cmUiRC_t  cmUiSetDouble( cmUiH_t uiH,  unsigned id, double v );
346
-  cmUiRC_t  cmUiSetString( cmUiH_t uiH,  unsigned id, const cmChar_t* v );
359
+  // Set the local value of the specified control and then 
360
+  // send the value to the UI driver so that the UI reflects this value.
361
+  cmUiRC_t  cmUiSetInt(    cmUiH_t uiH,  unsigned appId, unsigned id, int v );
362
+  cmUiRC_t  cmUiSetUInt(   cmUiH_t uiH,  unsigned appId, unsigned id, unsigned v );
363
+  cmUiRC_t  cmUiSetDouble( cmUiH_t uiH,  unsigned appId, unsigned id, double v );
364
+  cmUiRC_t  cmUiSetString( cmUiH_t uiH,  unsigned appId, unsigned id, const cmChar_t* v );
365
+  cmUiRC_t  cmUiSetVPrintf(cmUiH_t uiH,  unsigned appId, unsigned id, const cmChar_t* fmt, va_list vl );
366
+  cmUiRC_t  cmUiSetPrintf( cmUiH_t uiH,  unsigned appId, unsigned id, const cmChar_t* fmt, ... );
347 367
 
348 368
   // Get the value associated with a control. These functions return
349 369
   // the control value cached in the local control, they do not need 
350 370
   // to call the driver and are therefore very fast.
351
-  int             cmUiInt(    cmUiH_t uiH,  unsigned id );
352
-  unsigned        cmUiUInt(   cmUiH_t uiH,  unsigned id );
353
-  double          cmUiDouble( cmUiH_t uiH,  unsigned id );
354
-  const cmChar_t* cmUiString( cmUiH_t uiH,  unsigned id );
371
+  int             cmUiInt(    cmUiH_t uiH, unsigned appId,  unsigned id );
372
+  unsigned        cmUiUInt(   cmUiH_t uiH, unsigned appId,  unsigned id );
373
+  double          cmUiDouble( cmUiH_t uiH, unsigned appId,  unsigned id );
374
+  const cmChar_t* cmUiString( cmUiH_t uiH, unsigned appId,  unsigned id );
375
+
376
+  unsigned        cmUiListEleCount( cmUiH_t uiH, unsigned appId, unsigned id );
377
+  unsigned        cmUiListEleId(    cmUiH_t uiH, unsigned appId, unsigned id, unsigned index );
378
+  const cmChar_t* cmUiListEleLabel( cmUiH_t uiH, unsigned appId, unsigned id, unsigned index );
355 379
 
356 380
   // Query/set the current error state.
357 381
   cmUiRC_t   cmUiLastRC( cmUiH_t uiH );

+ 6
- 2
cmUiDrvr.c View File

@@ -1,7 +1,10 @@
1 1
 #include "cmGlobal.h"
2
+#include "cmRtSysMsg.h"
2 3
 #include "cmUiDrvr.h"
3 4
 
4 5
 void cmUiDriverArgSetup( cmUiDriverArg_t* a, 
6
+  unsigned  rtSubIdx,
7
+  unsigned  selId,
5 8
   cmUiDId_t dId,
6 9
   unsigned  appId,
7 10
   unsigned  usrId,
@@ -19,7 +22,8 @@ void cmUiDriverArgSetup( cmUiDriverArg_t* a,
19 22
 {
20 23
   
21 24
   flags = cmEnaFlag(flags,kSvalUiFl,sval!=NULL);
22
-
25
+  a->hdr.rtSubIdx= rtSubIdx;
26
+  a->hdr.selId   = selId;
23 27
   a->dId     = dId;
24 28
   a->appId   = appId;
25 29
   a->usrId   = usrId;
@@ -56,7 +60,7 @@ cmUiRC_t cmUiDriverArgSerialize( const cmUiDriverArg_t* a, void* buf, unsigned b
56 60
   return kOkUiRC;  
57 61
 }
58 62
 
59
-cmUiRC_t cmUiDriverArgDeserialize( cmUiDriverArg_t* a, void* buf, unsigned bufByteCnt )
63
+cmUiRC_t cmUiDriverArgDeserialize( cmUiDriverArg_t* a, const void* buf, unsigned bufByteCnt )
60 64
 {
61 65
   bool fl = bufByteCnt >= sizeof(*a);
62 66
   assert( fl );

+ 38
- 27
cmUiDrvr.h View File

@@ -14,6 +14,7 @@ extern "C" {
14 14
     kAppNotFoundUiRC,
15 15
     kCtlNotFoundUiRC,
16 16
     kPanelNotFoundUiRC,
17
+    kInvalidAppIdUiRC,
17 18
     kPanelFullUiRC,
18 19
     kDrvrErrUiRC,    
19 20
     kInvalidCtlOpUiRC,
@@ -21,7 +22,8 @@ extern "C" {
21 22
     kInvalidIdUiRC,
22 23
     kSubSysFailUiRC,
23 24
     kBufTooSmallUiRC,
24
-    kBufCorruptUiRC
25
+    kBufCorruptUiRC,
26
+    kNotImplementedUiRC
25 27
   };
26 28
 
27 29
   // Built-in control types.
@@ -34,7 +36,8 @@ extern "C" {
34 36
     kMenuBtnUiCId,
35 37
     kListUiCId,
36 38
     kLabelUiCId,
37
-    kTextUiCId,
39
+    kStringUiCId,
40
+    kConsoleUiCId,
38 41
     kNumberUiCId,
39 42
     kSliderUiCId,
40 43
     kProgressUiCId,
@@ -51,7 +54,7 @@ extern "C" {
51 54
     kCreateCtlDId,
52 55
     kDestroyCtlDId,
53 56
     kSetValDId,
54
-    kDestroyAllDId,
57
+    kEnableDId,       // ival holds new enable state
55 58
     kMaxDId
56 59
   } cmUiDId_t;
57 60
 
@@ -59,38 +62,43 @@ extern "C" {
59 62
   enum
60 63
   {
61 64
     // All controls recognize kValUiFl and kLblUiFl
62
-    kValUiFl   = 0x0000001,
63
-    kLblUiFl   = 0x0000002,
65
+    kValUiFl       = 0x00000001,
66
+    kLblUiFl       = 0x00000002,
64 67
 
65 68
     // Flags for Number,Progress,Meter
66
-    kMinUiFl   = 0x000004,
67
-    kMaxUiFl   = 0x000010,
68
-    kIncUiFl   = 0x000020,
69
-    kNumMask   = kValUiFl | kMinUiFl | kMaxUiFl | kIncUiFl,
70
-    kHorzUiFl  = 0x000040,
71
-    kVertUiFl  = 0x000080,
69
+    kMinUiFl       = 0x00000004,
70
+    kMaxUiFl       = 0x00000010,
71
+    kIncUiFl       = 0x00000020,
72
+    kNumMask       = kValUiFl | kMinUiFl | kMaxUiFl | kIncUiFl,
73
+
74
+    kHorzUiFl      = 0x00000040,
75
+    kVertUiFl      = 0x00000080,
72 76
 
73 77
     // Flags for Filename and Dir
74
-    kFnPatUiFl = 0x000100, // file pattern string
75
-    kFnDirUiFl = 0x000200, // toggle file btn type 
76
-    kFnMask    = kFnPatUiFl | kFnDirUiFl,
78
+    kFnPatUiFl     = 0x00000100, // file pattern string
79
+    kFnDirUiFl     = 0x00000200, // toggle file btn type 
80
+    kFnMask        = kFnPatUiFl | kFnDirUiFl,
77 81
 
78 82
     // Append list or menu element.
79
-    kAppendUiFl = 0x000400,
80
-
81
-    kLeftUiFl   = 0x001000,
82
-    kTopUiFl    = 0x002000,
83
-    kRightUiFl  = 0x004000,
84
-    kBottomUiFl = 0x008000,
85
-    kHCtrUiFl   = 0x010000,
86
-    kVCtrUiFl   = 0x020000,
87
-    kInsideUiFl = 0x040000,
83
+    kAppendUiFl    = 0x00000400,
84
+    kPrependUiFl   = 0x00000800,
85
+    kClearUiFl     = 0x00001000, // clear all ele' from a list or menu
86
+
87
+    kLeftUiFl      = 0x00002000,
88
+    kTopUiFl       = 0x00004000,
89
+    kRightUiFl     = 0x00008000,
90
+    kBottomUiFl    = 0x00010000,
91
+    kHCtrUiFl      = 0x00020000,
92
+    kVCtrUiFl      = 0x00040000,
93
+    kInsideUiFl    = 0x00080000,
88 94
 
89 95
     // Value flags indicate which value fields are valid
90
-    kIvalUiFl   = 0x100000,
91
-    kFvalUiFl   = 0x200000,
92
-    kSvalUiFl   = 0x400000
96
+    kIvalUiFl      = 0x00100000,
97
+    kFvalUiFl      = 0x00200000,
98
+    kSvalUiFl      = 0x00400000,
93 99
 
100
+    kNoReflectUiFl = 0x01000000, // do not reflect event to the client
101
+    
94 102
   };
95 103
 
96 104
 
@@ -101,6 +109,7 @@ extern "C" {
101 109
   // because they are used internally as indexes.
102 110
   typedef struct
103 111
   {
112
+    cmRtSysMsgHdr_t hdr;
104 113
     cmUiDId_t       dId;        // function selector id
105 114
     unsigned        appId;      // app id (plug-in instance id)
106 115
     unsigned        usrId;      // ctl id
@@ -119,6 +128,8 @@ extern "C" {
119 128
   typedef cmUiRC_t (*cmUiDriverFunc_t)( void* arg, const cmUiDriverArg_t* a );
120 129
 
121 130
   void cmUiDriverArgSetup( cmUiDriverArg_t* a, 
131
+    unsigned  rtSubIdx,
132
+    unsigned  selId,
122 133
     cmUiDId_t dId,
123 134
     unsigned  appId,
124 135
     unsigned  usrId,
@@ -144,7 +155,7 @@ extern "C" {
144 155
   // Return kBufTooSmallUiRC or kBufCorruptUiRC if buffer corruption is detected 
145 156
   // otherwise returns kOkUiRC.  This function does not call cmErrMsg() on error
146 157
   // the caller is therefore responsible for generating errors.
147
-  cmUiRC_t cmUiDriverArgDeserialize( cmUiDriverArg_t* a, void* buf, unsigned bufByteCnt );
158
+  cmUiRC_t cmUiDriverArgDeserialize( cmUiDriverArg_t* a, const void* buf, unsigned bufByteCnt );
148 159
 
149 160
   // Return an arg. value converted to the requiested type.
150 161
   // Note that numeric values will be automatically converted but

Loading…
Cancel
Save