Mercurial > dwindows
comparison win/dw.c @ 2090:cdb94c6fd611
Added initial implmentation of dw_feature_get/set() on all platforms.
Only tested on Windows.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 11 Jun 2020 01:11:23 +0000 |
parents | bcc7877dcdac |
children | 68f1924fdd13 |
comparison
equal
deleted
inserted
replaced
2089:bcc7877dcdac | 2090:cdb94c6fd611 |
---|---|
13348 return _myWideToUTF8(wstring, malloc(WideCharToMultiByte(CP_UTF8, 0, wstring, -1, NULL, 0, NULL, NULL))); | 13348 return _myWideToUTF8(wstring, malloc(WideCharToMultiByte(CP_UTF8, 0, wstring, -1, NULL, 0, NULL, NULL))); |
13349 #else | 13349 #else |
13350 return NULL; | 13350 return NULL; |
13351 #endif | 13351 #endif |
13352 } | 13352 } |
13353 | |
13354 /* | |
13355 * Gets the state of the requested library feature. | |
13356 * Parameters: | |
13357 * feature: The requested feature for example DW_FEATURE_DARK_MODE | |
13358 * Returns: | |
13359 * DW_FEATURE_UNSUPPORTED if the library or OS does not support the feature. | |
13360 * DW_FEATURE_DISABLED if the feature is supported but disabled. | |
13361 * DW_FEATURE_ENABLED if the feature is supported and enabled. | |
13362 * Other value greater than 1, same as enabled but with extra info. | |
13363 */ | |
13364 int API dw_feature_get(DWFEATURE feature) | |
13365 { | |
13366 switch(feature) | |
13367 { | |
13368 #ifdef BUILD_HTML | |
13369 case DW_FEATURE_HTML: | |
13370 case DW_FEATURE_HTML_RESULT: | |
13371 #endif | |
13372 #ifdef AEROGLASS | |
13373 case DW_FEATURE_WINDOW_TRANSPARENCY: | |
13374 #endif | |
13375 #ifdef BUILD_TOAST | |
13376 case DW_FEATURE_NOTIFICATION: | |
13377 #endif | |
13378 case DW_FEATURE_CONTAINER_STRIPE: | |
13379 case DW_FEATURE_MDI: | |
13380 return DW_FEATURE_ENABLED; | |
13381 #ifdef AEROGLASS | |
13382 case DW_FEATURE_DARK_MODE: | |
13383 { | |
13384 if(_DW_DARK_MODE_SUPPORTED) | |
13385 return _DW_DARK_MODE_ALLOWED; | |
13386 break; | |
13387 } | |
13388 #endif | |
13389 } | |
13390 return DW_FEATURE_UNSUPPORTED; | |
13391 } | |
13392 | |
13393 /* | |
13394 * Sets the state of the requested library feature. | |
13395 * Parameters: | |
13396 * feature: The requested feature for example DW_FEATURE_DARK_MODE | |
13397 * state: DW_FEATURE_DISABLED, DW_FEATURE_ENABLED or any value greater than 1. | |
13398 * Returns: | |
13399 * DW_FEATURE_UNSUPPORTED if the library or OS does not support the feature. | |
13400 * DW_ERROR_NONE if the feature is supported and successfully configured. | |
13401 * DW_ERROR_GENERAL if the feature is supported but could not be configured. | |
13402 * Remarks: | |
13403 * These settings are typically used during dw_init() so issue before | |
13404 * setting up the library with dw_init(). | |
13405 */ | |
13406 int API dw_feature_set(DWFEATURE feature, int state) | |
13407 { | |
13408 switch(feature) | |
13409 { | |
13410 /* These features are supported but not configurable */ | |
13411 #ifdef BUILD_HTML | |
13412 case DW_FEATURE_HTML: | |
13413 case DW_FEATURE_HTML_RESULT: | |
13414 #endif | |
13415 #ifdef AEROGLASS | |
13416 case DW_FEATURE_WINDOW_TRANSPARENCY: | |
13417 #endif | |
13418 #ifdef BUILD_TOAST | |
13419 case DW_FEATURE_NOTIFICATION: | |
13420 #endif | |
13421 case DW_FEATURE_CONTAINER_STRIPE: | |
13422 case DW_FEATURE_MDI: | |
13423 return DW_ERROR_GENERAL; | |
13424 /* These features are supported and configurable */ | |
13425 #ifdef AEROGLASS | |
13426 case DW_FEATURE_DARK_MODE: | |
13427 { | |
13428 _DW_DARK_MODE_ALLOWED = state; | |
13429 return DW_ERROR_NONE; | |
13430 } | |
13431 #endif | |
13432 } | |
13433 return DW_FEATURE_UNSUPPORTED; | |
13434 } | |
13435 |