ソースを参照

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

master
kevin 10年前
コミット
02f9bceaac
2個のファイルの変更41行の追加2行の削除
  1. 37
    1
      cmUi.c
  2. 4
    1
      cmUi.h

+ 37
- 1
cmUi.c ファイルの表示

@@ -618,7 +618,7 @@ cmUiRC_t _cmUiCreateCtl( cmUi_t* p, unsigned appId, unsigned panelId, cmUiCId_t
618 618
   else
619 619
   {
620 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 622
     else
623 623
     {
624 624
       ctl = cmArrayPtr(cmUiCtl_t,ap->ctlArrH,usrId);
@@ -1501,6 +1501,19 @@ cmUiRC_t cmUiClearPanel( cmUiH_t uiH, unsigned appId, unsigned panelId )
1501 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 1517
 cmUiRC_t cmUiNextRect(    cmUiH_t uiH, unsigned appId, unsigned panelId, int x, int y, int w, int h )
1505 1518
 {
1506 1519
   cmUi_t*      p  = _cmUiHandleToPtr(uiH);
@@ -2095,6 +2108,29 @@ const cmChar_t* cmUiListEleLabel( cmUiH_t uiH, unsigned appId, unsigned id, unsi
2095 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 2136
 cmUiRC_t   cmUiLastRC( cmUiH_t uiH )

+ 4
- 1
cmUi.h ファイルの表示

@@ -88,7 +88,7 @@ extern "C" {
88 88
     
89 89
     4) Come up with a threading model. For example maybe 
90 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 92
     anyway.  If the control flow generated from driver event
93 93
     callbacks then allows value, but not structural changes,
94 94
     then non blocking will be necessary.
@@ -247,6 +247,8 @@ extern "C" {
247 247
   // Destroy all the controls in a panel.
248 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 253
   // Location: 
252 254
 
@@ -376,6 +378,7 @@ extern "C" {
376 378
   unsigned        cmUiListEleCount( cmUiH_t uiH, unsigned appId, unsigned id );
377 379
   unsigned        cmUiListEleId(    cmUiH_t uiH, unsigned appId, unsigned id, unsigned index );
378 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 383
   // Query/set the current error state.
381 384
   cmUiRC_t   cmUiLastRC( cmUiH_t uiH );

読み込み中…
キャンセル
保存