ZFFramework
 
Loading...
Searching...
No Matches
ZFAppSkin.h File Reference

helper for quickly update app skin More...

#include "ZFAppUtilDef.h"

Go to the source code of this file.

Classes

class  ZFAppSkinData
 skin info for ZFAppSkinList More...
 

Functions

zfautoT< ZFArrayZFAppSkinList (const ZFPathInfo &base=(zft_zfnull), zfbool enableCache=(_ZFT_t_zftrue))
 get a list of supported skin
 
zfautoT< ZFTaskIdZFAppSkinLoad (const zfstring &skinId=(zft_zfnull), const ZFListener &finishCallback=(zft_zfnull), const ZFPathInfo &base=(zft_zfnull), zfbool enableCache=(_ZFT_t_zftrue))
 see ZFAppSkinList
 
zfstring ZFAppSkin ()
 see ZFAppSkinList
 
zfautoT< ZFTaskZFAppSkinLoadTask (const zfstring &skinId=(zft_zfnull), const ZFPathInfo &base=(zft_zfnull), zfbool enableCache=(_ZFT_t_zftrue))
 util to create a task for ZFAppSkinLoad
 

Detailed Description

helper for quickly update app skin

Function Documentation

◆ ZFAppSkinList()

zfautoT< ZFArray > ZFAppSkinList ( const ZFPathInfo & base = (zft_zfnull),
zfbool enableCache = (_ZFT_t_zftrue) )
extern

get a list of supported skin

how it works:

  1. you should prepare your skin files in skin dir of ZFPathType_res
  2. the skin files' file name should match this rule:
    • <skinId>.* file, e.g. skin/your_skin_id.xml or skin/your_skin_id.xxx.xml
    • <skinId>.* dir, e.g. skin/your_skin_id/ or skin/your_skin_id.xxx/
    • specially:
      • skin/default.* file or skin/default.* dir would be loaded before loading each skin
      • skin/config.* file would be loaded to detect each skin names for display, with this format:
        <zfstring prop="skinName_<skinId>" value="<skinName>" />
        <zfstring prop="skinName_your_skin_id" value="YourSkinName" />
        ...
        zft_zfstring< zfchar > zfstring
        see zft_zfstring
        Definition ZFCoreTypeDef_StringType.h:15
        see ZFStyleLoad
        Definition ZFStyleLoad.h:44
  3. ZFStyleLoadAsync would be called to load the skin files

typical usage:

// list available skin
// get current skin, empty for default
// let user to choose,
// or fallback to use default
zfstring desired = xxx;
// change skin, empty for default skin
// the desired skin would be saved to #ZFState,
// and would be applied when next time app launch with #ZFAppSkinInit
ZFAppSkinLoad(desired);
// use the skin as #ZFStyleable::propStyle
ZFUITextView *v = xxx;
v->propStyle("text", "some_style_key");
zfautoT< ZFArray > ZFAppSkinList(const ZFPathInfo &base=(zft_zfnull), zfbool enableCache=(_ZFT_t_zftrue))
get a list of supported skin
zfstring ZFAppSkin()
see ZFAppSkinList
zfautoT< ZFTaskId > ZFAppSkinLoad(const zfstring &skinId=(zft_zfnull), const ZFListener &finishCallback=(zft_zfnull), const ZFPathInfo &base=(zft_zfnull), zfbool enableCache=(_ZFT_t_zftrue))
see ZFAppSkinList
void propStyle(const zfstring &propertyName, const zfstring &styleKey)
see ZFStyleSet
view to display plain text
Definition ZFUITextView.h:21
type restrict version of zfauto
Definition zfautoFwd.h:108

◆ ZFAppSkinLoad()

zfautoT< ZFTaskId > ZFAppSkinLoad ( const zfstring & skinId = (zft_zfnull),
const ZFListener & finishCallback = (zft_zfnull),
const ZFPathInfo & base = (zft_zfnull),
zfbool enableCache = (_ZFT_t_zftrue) )
extern

see ZFAppSkinList

empty skinId would load previous ZFAppSkin stored in ZFState
finishCallback's param0 would be a v_ZFResultType indicates result