cwIo.h/cpp : Changes to support cwUi API changes.

This commit is contained in:
kevin 2021-11-05 22:21:44 -04:00
parent 15f64c7493
commit 10e6cac8d1
2 changed files with 178 additions and 20 deletions

162
cwIo.cpp
View File

@ -2539,34 +2539,33 @@ cw::rc_t cw::io::socketSend( handle_t h, unsigned sockIdx, const void* data,
// //
// UI // UI
// //
/* unsigned cw::io::parentAndNameToAppId( handle_t h, unsigned parentAppId, const char* eleName )
unsigned cw::io::uiFindElementAppId( handle_t h, unsigned parentUuId, const char* eleName )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
return ui::findElementAppId(uiH, parentUuId, eleName ); return ui::parentAndNameToAppId(uiH,parentAppId,eleName);
return kInvalidId; return kInvalidId;
} }
unsigned cw::io::uiFindElementUuId( handle_t h, unsigned parentUuId, const char* eleName ) unsigned cw::io::parentAndNameToUuId( handle_t h, unsigned parentAppId, const char* eleName )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
return ui::parentAndNameToUuId(uiH, parentUuId, eleName ); return ui::parentAndNameToUuId(uiH,parentAppId,eleName);
return kInvalidId; return kInvalidId;
} }
const char* cw::io::uiFindElementName( handle_t h, unsigned uuId ) unsigned cw::io::parentAndAppIdToUuId( handle_t h, unsigned parentAppId, unsigned appId )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
return ui::findElementName(uiH, uuId ); return ui::parentAndAppIdToUuId(uiH,parentAppId,appId);
return nullptr; return kInvalidId;
} }
*/
unsigned cw::io::uiFindElementAppId( handle_t h, unsigned uuId ) unsigned cw::io::uiFindElementAppId( handle_t h, unsigned uuId )
{ {
rc_t rc; rc_t rc;
@ -2576,24 +2575,43 @@ unsigned cw::io::uiFindElementAppId( handle_t h, unsigned uuId )
return kInvalidId; return kInvalidId;
} }
unsigned cw::io::uiFindElementUuId( handle_t h, const char* eleName ) unsigned cw::io::uiFindElementUuId( handle_t h, const char* eleName, unsigned chanId )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
return ui::findElementUuId(uiH, eleName ); return ui::findElementUuId(uiH, eleName, chanId );
return kInvalidId; return kInvalidId;
} }
unsigned cw::io::uiFindElementUuId( handle_t h, unsigned appId ) unsigned cw::io::uiFindElementUuId( handle_t h, unsigned appId, unsigned chanId )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
return ui::findElementUuId(uiH, appId ); return ui::findElementUuId(uiH, kInvalidId, appId, chanId );
return kInvalidId; return kInvalidId;
} }
unsigned cw::io::uiFindElementUuId( handle_t h, unsigned parentUuId, const char* eleName, unsigned chanId )
{
rc_t rc;
ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
return ui::findElementUuId(uiH, parentUuId, eleName, chanId );
return kInvalidId;
}
unsigned cw::io::uiFindElementUuId( handle_t h, unsigned parentUuId, unsigned appId, unsigned chanId )
{
rc_t rc;
ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
return ui::findElementUuId(uiH, parentUuId, appId, chanId );
return kInvalidId;
}
cw::rc_t cw::io::uiCreateFromObject( handle_t h, const object_t* o, unsigned parentUuId, unsigned chanId, const char* eleName) cw::rc_t cw::io::uiCreateFromObject( handle_t h, const object_t* o, unsigned parentUuId, unsigned chanId, const char* eleName)
{ {
rc_t rc; rc_t rc;
@ -2783,6 +2801,124 @@ cw::rc_t cw::io::uiSetProgRange( handle_t h, unsigned uuId, double minValue, dou
return rc; return rc;
} }
cw::rc_t cw::io::uiSetLogLine( handle_t h, unsigned uuId, const char* text )
{
rc_t rc;
ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::setLogLine(uiH,uuId,text);
return rc;
}
cw::rc_t cw::io::uiSetClickable( handle_t h, unsigned uuId, bool clickableFl )
{
rc_t rc;
ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::setClickable(uiH,uuId,clickableFl);
return rc;
}
cw::rc_t cw::io::uiClearClickable( handle_t h, unsigned uuId )
{
rc_t rc;
ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::clearClickable(uiH,uuId);
return rc;
}
bool cw::io::uiIsClickable( handle_t h, unsigned uuId )
{
rc_t rc;
ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
return ui::isClickable(uiH,uuId);
return false;
}
cw::rc_t cw::io::uiSetSelect( handle_t h, unsigned uuId, bool enableFl )
{
rc_t rc;
ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::setSelect(uiH,uuId,enableFl);
return rc;
}
cw::rc_t cw::io::uiClearSelect( handle_t h, unsigned uuId )
{
rc_t rc;
ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::clearSelect(uiH,uuId);
return rc;
}
bool cw::io::uiIsSelected( handle_t h, unsigned uuId )
{
rc_t rc;
ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
return ui::isSelected(uiH,uuId);
return false;
}
cw::rc_t cw::io::uiSetVisible( handle_t h, unsigned uuId, bool enableFl )
{
rc_t rc;
ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::setVisible(uiH,uuId,enableFl);
return rc;
}
cw::rc_t cw::io::uiClearVisible( handle_t h, unsigned uuId )
{
rc_t rc;
ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::clearVisible(uiH,uuId);
return rc;
}
bool cw::io::uiIsVisible( handle_t h, unsigned uuId )
{
rc_t rc;
ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
return ui::isVisible(uiH,uuId);
return false;
}
cw::rc_t cw::io::uiSetEnable( handle_t h, unsigned uuId, bool enableFl )
{
rc_t rc;
ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::setEnable(uiH,uuId,enableFl);
return rc;
}
cw::rc_t cw::io::uiClearEnable( handle_t h, unsigned uuId )
{
rc_t rc;
ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::clearEnable(uiH,uuId);
return rc;
}
bool cw::io::uiIsEnabled( handle_t h, unsigned uuId )
{ rc_t rc;
ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
return ui::isEnabled(uiH,uuId);
return false;
}
cw::rc_t cw::io::uiRegisterAppIdMap( handle_t h, const ui::appIdMap_t* map, unsigned mapN ) cw::rc_t cw::io::uiRegisterAppIdMap( handle_t h, const ui::appIdMap_t* map, unsigned mapN )
{ {

32
cwIo.h
View File

@ -266,15 +266,19 @@ namespace cw
// Find id's associated with elements. // Find id's associated with elements.
//unsigned uiFindElementAppId( handle_t h, unsigned parentUuId, const char* eleName ); unsigned parentAndNameToAppId( handle_t h, unsigned parentAppId, const char* eleName );
//unsigned uiFindElementUuId( handle_t h, unsigned parentUuId, const char* eleName ); unsigned parentAndNameToUuId( handle_t h, unsigned parentAppId, const char* eleName );
//unsigned uiFindElementUuId( handle_t h, unsigned parentUuId, unsigned appId ); unsigned parentAndAppIdToUuId( handle_t h, unsigned parentAppId, unsigned appId );
const char* uiFindElementName( handle_t h, unsigned uuId ); const char* uiFindElementName( handle_t h, unsigned uuId );
unsigned uiFindElementAppId( handle_t h, unsigned uuId ); unsigned uiFindElementAppId( handle_t h, unsigned uuId );
// Return the uuid of the first matching 'eleName' or 'appId'. // Return the uuid of the first matching 'eleName' or 'appId'.
unsigned uiFindElementUuId( handle_t h, const char* eleName ); unsigned uiFindElementUuId( handle_t h, const char* eleName, unsigned chanId=kInvalidId );
unsigned uiFindElementUuId( handle_t h, unsigned appId ); unsigned uiFindElementUuId( handle_t h, unsigned appId, unsigned chanId=kInvalidId );
unsigned uiFindElementUuId( handle_t h, unsigned parentUuId, const char* eleName, unsigned chanId=kInvalidId );
unsigned uiFindElementUuId( handle_t h, unsigned parentUuId, unsigned appId, unsigned chanId=kInvalidId );
rc_t uiCreateFromObject( handle_t h, const object_t* o, unsigned parentUuId=kInvalidId, unsigned chanId=kInvalidId, const char* eleName=nullptr); rc_t uiCreateFromObject( handle_t h, const object_t* o, unsigned parentUuId=kInvalidId, unsigned chanId=kInvalidId, const char* eleName=nullptr);
rc_t uiCreateFromFile( handle_t h, const char* fn, unsigned parentUuId=kInvalidId, unsigned chanId=kInvalidId ); rc_t uiCreateFromFile( handle_t h, const char* fn, unsigned parentUuId=kInvalidId, unsigned chanId=kInvalidId );
@ -309,6 +313,24 @@ namespace cw
rc_t uiSetNumbRange( handle_t h, unsigned uuId, double minValue, double maxValue, double stepValue, unsigned decPl, double value ); rc_t uiSetNumbRange( handle_t h, unsigned uuId, double minValue, double maxValue, double stepValue, unsigned decPl, double value );
rc_t uiSetProgRange( handle_t h, unsigned uuId, double minValue, double maxValue, double value ); rc_t uiSetProgRange( handle_t h, unsigned uuId, double minValue, double maxValue, double value );
rc_t uiSetLogLine( handle_t h, unsigned uuId, const char* text );
rc_t uiSetClickable( handle_t h, unsigned uuId, bool clickableFl=true );
rc_t uiClearClickable( handle_t h, unsigned uuId );
bool uiIsClickable( handle_t h, unsigned uuId );
rc_t uiSetSelect( handle_t h, unsigned uuId, bool enableFl=true );
rc_t uiClearSelect( handle_t h, unsigned uuId );
bool uiIsSelected( handle_t h, unsigned uuId );
rc_t uiSetVisible( handle_t h, unsigned uuId, bool enableFl=true );
rc_t uiClearVisible( handle_t h, unsigned uuId );
bool uiIsVisible( handle_t h, unsigned uuId );
rc_t uiSetEnable( handle_t h, unsigned uuId, bool enableFl=true );
rc_t uiClearEnable( handle_t h, unsigned uuId );
bool uiIsEnabled( handle_t h, unsigned uuId );
// Register parent/child/name app id's // Register parent/child/name app id's
rc_t uiRegisterAppIdMap( handle_t h, const ui::appIdMap_t* map, unsigned mapN ); rc_t uiRegisterAppIdMap( handle_t h, const ui::appIdMap_t* map, unsigned mapN );