Browse Source

cmUi.h/c : Added cmUiListEleLabelToIndex() and shell for cmUiSelectPanel().

master
kevin 10 years ago
parent
commit
02f9bceaac
2 changed files with 41 additions and 2 deletions
  1. 37
    1
      cmUi.c
  2. 4
    1
      cmUi.h

+ 37
- 1
cmUi.c View File

618
   else
618
   else
619
   {
619
   {
620
     if( cmArrayIsValid(ap->ctlArrH) == false || usrId >= cmArrayCount(ap->ctlArrH) )
620
     if( cmArrayIsValid(ap->ctlArrH) == false || usrId >= cmArrayCount(ap->ctlArrH) )
621
-      ctl                            = cmArrayClr(cmUiCtl_t,ap->ctlArrH,usrId);
621
+      ctl = cmArrayClr(cmUiCtl_t,ap->ctlArrH,usrId);
622
     else
622
     else
623
     {
623
     {
624
       ctl = cmArrayPtr(cmUiCtl_t,ap->ctlArrH,usrId);
624
       ctl = cmArrayPtr(cmUiCtl_t,ap->ctlArrH,usrId);
1501
   return rc;
1501
   return rc;
1502
 }
1502
 }
1503
 
1503
 
1504
+cmUiRC_t cmUiSelectPanel( cmUiH_t uiH, const cmChar_t* label )
1505
+{
1506
+  cmUiRC_t rc = kOkUiRC;
1507
+  cmUi_t*  p  = _cmUiHandleToPtr(uiH);
1508
+
1509
+  
1510
+
1511
+
1512
+  return rc;
1513
+  
1514
+}
1515
+
1516
+
1504
 cmUiRC_t cmUiNextRect(    cmUiH_t uiH, unsigned appId, unsigned panelId, int x, int y, int w, int h )
1517
 cmUiRC_t cmUiNextRect(    cmUiH_t uiH, unsigned appId, unsigned panelId, int x, int y, int w, int h )
1505
 {
1518
 {
1506
   cmUi_t*      p  = _cmUiHandleToPtr(uiH);
1519
   cmUi_t*      p  = _cmUiHandleToPtr(uiH);
2095
   return cmArrayPtr(cmUiListEle_t, ctl->idArrH, index )->label;
2108
   return cmArrayPtr(cmUiListEle_t, ctl->idArrH, index )->label;
2096
 }
2109
 }
2097
 
2110
 
2111
+unsigned cmUiListEleLabelToIndex( cmUiH_t uiH, unsigned appId, unsigned id, const cmChar_t* label )
2112
+{
2113
+  cmUi_t*      p  = _cmUiHandleToPtr(uiH);
2114
+  cmUiCtl_t*   ctl;
2115
+  cmUiRC_t     rc;
2116
+  unsigned     i,n;
2117
+
2118
+  if( label == NULL )
2119
+    return cmInvalidIdx;
2120
+
2121
+  if((rc = _cmUiFastFindCtl(p,appId,id,&ctl,true)) != kOkUiRC )
2122
+    return cmInvalidIdx;
2123
+
2124
+  if( cmArrayIsValid( ctl->idArrH )==false || (n = cmArrayCount( ctl->idArrH))==0 )
2125
+    return cmInvalidIdx;
2126
+
2127
+  for(i=0; i<n; ++i)
2128
+    if( cmTextCmp(cmArrayPtr(cmUiListEle_t, ctl->idArrH, i )->label,label) == 0 )
2129
+      return i;
2130
+
2131
+  return cmInvalidIdx;
2132
+}
2133
+
2098
 
2134
 
2099
 
2135
 
2100
 cmUiRC_t   cmUiLastRC( cmUiH_t uiH )
2136
 cmUiRC_t   cmUiLastRC( cmUiH_t uiH )

+ 4
- 1
cmUi.h View File

88
     
88
     
89
     4) Come up with a threading model. For example maybe 
89
     4) Come up with a threading model. For example maybe 
90
     control creation should use a blocking scheme since it is
90
     control creation should use a blocking scheme since it is
91
-    generally to time consuming to do during real-time operation
91
+    generally too time consuming to do during real-time operation
92
     anyway.  If the control flow generated from driver event
92
     anyway.  If the control flow generated from driver event
93
     callbacks then allows value, but not structural changes,
93
     callbacks then allows value, but not structural changes,
94
     then non blocking will be necessary.
94
     then non blocking will be necessary.
247
   // Destroy all the controls in a panel.
247
   // Destroy all the controls in a panel.
248
   cmUiRC_t cmUiClearPanel( cmUiH_t uiH, unsigned appId, unsigned panelId );
248
   cmUiRC_t cmUiClearPanel( cmUiH_t uiH, unsigned appId, unsigned panelId );
249
 
249
 
250
+  cmUiRC_t cmUiSelectPanel( cmUiH_t uiH, const cmChar_t* label );
251
+
250
   //------------------------------------------------------------------------------------------
252
   //------------------------------------------------------------------------------------------
251
   // Location: 
253
   // Location: 
252
 
254
 
376
   unsigned        cmUiListEleCount( cmUiH_t uiH, unsigned appId, unsigned id );
378
   unsigned        cmUiListEleCount( cmUiH_t uiH, unsigned appId, unsigned id );
377
   unsigned        cmUiListEleId(    cmUiH_t uiH, unsigned appId, unsigned id, unsigned index );
379
   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 );
380
   const cmChar_t* cmUiListEleLabel( cmUiH_t uiH, unsigned appId, unsigned id, unsigned index );
381
+  unsigned        cmUiListEleLabelToIndex( cmUiH_t uiH, unsigned appId, unsigned id, const cmChar_t* label );
379
 
382
 
380
   // Query/set the current error state.
383
   // Query/set the current error state.
381
   cmUiRC_t   cmUiLastRC( cmUiH_t uiH );
384
   cmUiRC_t   cmUiLastRC( cmUiH_t uiH );

Loading…
Cancel
Save