---++!! !AppTaskBar %TOC{title="Contents:"}% %STARTINCLUDE% ---++ Application Task Bar for paraworld | *Title* | Application Task Bar for paraworld | | *Author(s)* | LiXizhi | | *Date* | 2008/5/13 | | *File* | script/kids/3DMapSystemUI/Desktop/AppTaskBar.lua | ---+++ Description App task bar is docked at the bottom of the screen and has four functional area from left to right. 1. App start icon: It will toggle on/off the application lists at the bottom of the display. When application list is displayed, users can also drag applications to the quick launch bar. 1. App quick launch bar: Users can quickly switch to a frequently used application exclusive desktop mode. application exclusive desktop mode is a mode where only windows of the given application are shown and application specific toolbars are displayed on the task bar. This allows the applications to make full use of the entire rectangle display area without worrying about UI overlay from other applications' windows. Content is left aligned. overflow toolbar items can be accessed via extension button ">>". 1. App toolbar: When in an application desktop mode, it displays the application specific toolbar. Application specific toolbar icons are by default displayed with text and an optional icon to help both new and old user to quickly identify the most important tasks relavent to an application. The app toolbar will by default display all application menu items, unless an application explicitly specifies its display content via AppTaskBar.AddCommand in its APP_ACTIVATE_DESKTOP message handler. The app toolbar is by default a fixed-width (512px) region and centered (or float to the left of quick launch bar). Content is left aligned. overflow toolbar items can be accessed via extension button ">>". 1. CommonStatusBar: This section on the task bar provides a place to place common icons (functions) that are always shown regardless of the current application desktop. E.g. social content, chat users, mini-feed. Content is right aligned. overflow toolbar items can be accessed via extension button "<<". %T% __Sample Code__ <verbatim> NPL.load("(gl)script/kids/3DMapSystemUI/Desktop/AppTaskBar.lua"); Map3DSystem.UI.AppTaskBar.InitAppTaskBar(); Map3DSystem.UI.AppTaskBar.SendMessage({type = Map3DSystem.UI.AppTaskBar.MSGTYPE.SHOW_TASKBAR, bShow = true}); Map3DSystem.UI.AppTaskBar.SendMessage({type = Map3DSystem.UI.AppTaskBar.MSGTYPE.SWITCH_APP_DESKTOP, appKey = Map3DSystem.App.AppKeys["worlds"]}); --Map3DSystem.UI.AppTaskBar.SendMessage({type = Map3DSystem.UI.AppTaskBar.MSGTYPE.SWITCH_APP_DESKTOP, appKey = Map3DSystem.App.AppKeys["profiles"]}); </verbatim> ---+++ Member Functions ---++++ !AppTaskBar.InitAppTaskBar <verbatim> automaticly load the status bar NPL.load("(gl)script/kids/3DMapSystemUI/Desktop/StatusBar.lua"); the start app page. NPL.load("(gl)script/kids/3DMapSystemUI/Desktop/StartAppPage.lua"); -- attributes -- the default app to load at start up. AppTaskBar.DefaultApp = Map3DSystem.App.AppKeys["MyDesktop"]; app_key of the current app desktop. AppTaskBar.CurrentAppDesktop = AppTaskBar.DefaultApp; app list window name AppTaskBar.AppListName = libName..".applist"; some theme related things, replace this table to change theme. local theme = { -- left most start bar background. it just contains the start app button StartBar = "Texture/3DMapSystem/Desktop/AppTaskBar.png;0 15 80 49", -- the start button on start bar StartBarButton = "Texture/3DMapSystem/Desktop/AppTaskBar.png;216 24 40 40", -- quick action bar bg QuickActionBar = "Texture/3DMapSystem/Desktop/AppTaskBar.png;81 32 58 32:19 0 37 0", -- application tool bar bg AppToolBar = "Texture/3DMapSystem/Desktop/AppTaskBar.png;140 26 41 38:17 0 17 0", -- application toolbar button hover style. ToolBarBtnHoverBG = "Texture/3DMapSystem/common/href.png:2 2 2 2"; -- right most common status bar bg CommonStatusBar = "Texture/3DMapSystem/Desktop/AppTaskBar.png;182 32 34 32:31 0 2 0", -- The app start page bg. AppStartPage = "Texture/3DMapSystem/Desktop/AppStartPage.png:13 85 13 13", -- default application icon if none is provided. DefaultAppIcon = "Texture/3DMapSystem/common/info.png"; -- whether to play animation to popup application list and fade the background. bUseAnimation = false, -- if bUseAnimation is true, this is the background fade animation file BackgroundGreyOutSlowMotionData = "script/kids/3DMapSystemUI/styles/BackgroundGreyOutSlowMotionData.xml", -- if bUseAnimation is true, this is the start page popup animation file TaskBarAppListPopupMotionData = "script/kids/3DMapSystemUI/styles/TaskBarAppListPopupMotionData.xml", }; messge types AppTaskBar.MSGTYPE = { -- toggle on/off the application lists at the bottom of the display. When application list is displayed, users can also drag applications to the quick launch bar. -- msg = {bShow = true, bUseAnim = true} SHOW_APP_LIST = 1000, -- show/hide the task bar, -- msg = {bShow = true} SHOW_TASKBAR = 1001, -- switch to an given application exclusive desktop, we can save last screen to buffer for switching back. -- msg = {appKey = "XXX", bSaveLastScreen = false, } SWITCH_APP_DESKTOP = 1002, }; default quick launch bar app_keys, we will only show quick launch icons if their app_key is installed on the target computer. AppTaskBar.DefaultQuickLaunchApps = { { nLineIndex=1, app_key = Map3DSystem.App.AppKeys["Creator"],}, { nLineIndex=1, app_key = Map3DSystem.App.AppKeys["MyDesktop"],}, { nLineIndex=1, app_key = Map3DSystem.App.AppKeys["Env"],}, { nLineIndex=1, app_key = Map3DSystem.App.AppKeys["CCS"],}, { nLineIndex=1, app_key = Map3DSystem.App.AppKeys["chat"],}, --{ nLineIndex=1, app_key = Map3DSystem.App.AppKeys["profiles"],}, { nLineIndex=2, app_key = Map3DSystem.App.AppKeys["profiles"],}, { nLineIndex=2, app_key = Map3DSystem.App.AppKeys["worlds"],}, --{ nLineIndex=2, app_key = Map3DSystem.App.AppKeys["EBook"],}, { nLineIndex=2, app_key = Map3DSystem.App.AppKeys["Blueprint"],}, { nLineIndex=2, app_key = Map3DSystem.App.AppKeys["screenshot"],}, { nLineIndex=2, app_key = Map3DSystem.App.AppKeys["Developers"],}, }</verbatim>; call this only once at the beginning of the game. init main bar: this does not show the task bar, it just builds the data structure and messaging system. __syntax__ <verbatim>function AppTaskBar.InitAppTaskBar()</verbatim> ---++++ !AppTaskBar.AddCommand add a task bar command at given position. the parent folders must be created beforehand, otherwise it will be inserted to the first unfound folder. if there is already an object at the position, the add command will do nothing. * _param_ __command__ :; type of Map3DSystem.App.Command, or it can be string of existing command name. * _param_ __position__ : this is a tree path string of folder names separated by dot. There are some predefined categories which correspond to the four display sections on the task bar. See following. e.g. "applist.APP_GUID", "quicklaunchbar.APP_GUID", "toolbar.CreateWorld", "statusbar.minifeed". If this is nil, it will be the same as "toolbar." plus the last name of command.name. * _param_ __posIndex__ : if position is a item in another folder, this is the index at which to add the item. if nil, it is added to end, if 1 it is the beginning. Please note, for right aligned section(common status bar), the first position is the right most position. * _return_ ____ : return the command object if added successfully. __syntax__ <verbatim>function AppTaskBar.AddCommand(command, position, posIndex)</verbatim> __parameters__ | *command* | ; type of Map3DSystem.App.Command, or it can be string of existing command name. | | *position* | | | *posIndex* | if position is a item in another folder, this is the index at which to add the item. if nil, it is added to end, if 1 it is the beginning. Please note, for right aligned section(common status bar), the first position is the right most position. | ---++++ !AppTaskBar.GetItemIndex return a task item index by its position. This function is mosted called before AddMenuCommand to determine where to insert a new command. * _param_ __position__ : this is a tree path string of folder names separated by dot. There are some predefined categories which correspond to the four display sections on the task bar. See following. e.g. "applist.APP_GUID", "quicklaunchbar.APP_GUID", "toolbar.CreateWorld", "statusbar.minifeed" * _return_ __nil__ : if not found, other the item index integer is returned. please note that the index may change when new items are added later on. __syntax__ <verbatim>function AppTaskBar.GetItemIndex(position)</verbatim> __parameters__ | *position* | this is a tree path string of folder names separated by dot. There are some predefined categories which correspond to the four display sections on the task bar. See following. e.g. "applist.APP_GUID", "quicklaunchbar.APP_GUID", "toolbar.CreateWorld", "statusbar.minifeed" | ---++++ !AppTaskBar.OnClickCommand call the task bar command __syntax__ <verbatim>function AppTaskBar.OnClickCommand(treeNode)</verbatim> __parameters__ | *treeNode* | | ---++++ !AppTaskBar.SendMessage send a message to AppTaskBar:main window handler AppTaskBar.SendMessage({type = AppTaskBar.MSGTYPE.MENU_SHOW}); __syntax__ <verbatim>function AppTaskBar.SendMessage(msg)</verbatim> __parameters__ | *msg* | | ---++++ !AppTaskBar.MSGProc AppTaskBar window handler __syntax__ <verbatim>function AppTaskBar.MSGProc(window, msg)</verbatim> __parameters__ | *window* | | | *msg* | | ---++++ !AppTaskBar.Show ------------------------- protected ------------------------- the alpha value of all task bar backgrounds AppTaskBar.BG_alpha = "220"; show or hide task bar UI __syntax__ <verbatim>function AppTaskBar.Show(bShow)</verbatim> __parameters__ | *bShow* | | ---++++ !AppTaskBar.SwitchAppDesktop switch to a given application exclusive desktop mode. We can optionally save last screen to texture for switching back display. internally it just send APP_DEACTIVATE_DESKTOP message to the old app, and APP_ACTIVATE_DESKTOP message to the new application. The new application is expected to add commands to app toolbar via AppTaskBar.AddCommand() before the message returns. Note1: The app toolbar will by default display all application menu items, unless an application explicitly specifies its toolbar content inside APP_ACTIVATE_DESKTOP message handler. Note2: The application can change the toolbar content at any time, by calling AppTaskBar.ClearToolBar(), adding new commands and then calling AppTaskBar.RefreshToolbar() * _param_ __appKey__ : the application key. if key is the same as current, it will refresh anyway. if nil, it will clear desktop(but not refreshing its UI). * _param_ __bSaveLastScreen__ : whether saving screen to texture __syntax__ <verbatim>function AppTaskBar.SwitchAppDesktop(appKey, bSaveLastScreen)</verbatim> __parameters__ | *appKey* | the application key. if key is the same as current, it will refresh anyway. if nil, it will clear desktop(but not refreshing its UI). | | *bSaveLastScreen* | | ---++++ !AppTaskBar.AddAppMenuItemsToToolBar extract all menu commands related to this application and add them to toolbar. this function can be called to automatically add the menu items to toolbar for the given app. * _param_ __appKey__ : it will search the current menu and append all menu items whose application key is appKey to the current app toolbar. __syntax__ <verbatim>function AppTaskBar.AddAppMenuItemsToToolBar(appKey)</verbatim> __parameters__ | *appKey* | it will search the current menu and append all menu items whose application key is appKey to the current app toolbar. | ---++++ !AppTaskBar.ToggleAppList toggle on/off the application lists at the bottom of the display. When application list is displayed, users can also drag applications to the quick launch bar. * _param_ __bShow__ : toggle on/off the application lists * _param_ __bUseAnim__ : true to play a popup animation. * _param_ __destoryUI__ :_ID: ui object to destroy. only used when bShow is false. __syntax__ <verbatim>function AppTaskBar.ToggleAppList(bShow, bUseAnim, destoryUI_ID)</verbatim> __parameters__ | *bShow* | toggle on/off the application lists | | *bUseAnim* | | | *destoryUI* | _ID: ui object to destroy. only used when bShow is false. | | *ID* | | ---++++ !AppTaskBar.CancelAppList toggle off app list * _param_ __destoryUIID__ : nil or the id of the UI object to delete __syntax__ <verbatim>function AppTaskBar.CancelAppList(destoryUI_ID)</verbatim> __parameters__ | *destoryUI* | | | *ID* | | ---++++ !AppTaskBar.ClearAppList it simply clear application list causing the next AppTaskBar.ToggleAppList() method to rebuilt its UI this function is rarely used, unless user has newly installed applications and do not want to restart ParaEngine to see it takes effect. __syntax__ <verbatim>function AppTaskBar.ClearAppList()</verbatim> ---++++ !AppTaskBar.ClearToolBar ------------------------- methods ------------------------- clear the tool bar. The application can change the toolbar content at any time, by adding commands and then calling AppTaskBar.RefreshToolbar() * _param_ __ClearToolBar__ : if true, UI is refreshed. __syntax__ <verbatim>function AppTaskBar.ClearToolBar(bRefreshUI)</verbatim> __parameters__ | *bRefreshUI* | | ---++++ !AppTaskBar.RefreshToolbar refresh application toolbar according to the current toolbar data a toolbar item may contain icon, text or both. __syntax__ <verbatim>function AppTaskBar.RefreshToolbar()</verbatim> ---++++ !Map3DSystem.UI.AppTaskBar.OnClickToolbar clicks a toolbar item. __syntax__ <verbatim>function Map3DSystem.UI.AppTaskBar.OnClickToolbar(index)</verbatim> __parameters__ | *index* | | ---++++ !AppTaskBar.RefreshQuickLaunchBar this function is called when quick launch bar is recreated or new item is added to it. TODO: If user made changes to it, remember to save to "MyDesktop" app's config file. __syntax__ <verbatim>function AppTaskBar.RefreshQuickLaunchBar()</verbatim> ---++++ !AppTaskBar.OnClickQuickLaunchBar callback __syntax__ <verbatim>function AppTaskBar.OnClickQuickLaunchBar(nLineIndex, index)</verbatim> __parameters__ | *nLineIndex* | | | *index* | | ---++++ !AppTaskBar.AddStatusBarCommand ------------ DEPARACATED ------------ add a status bar item. * _param_ __command__ :; type of Map3DSystem.App.Command * _param_ __priority__ : number Priority defines the position of the given command in the status bar. Higher priority shown on the right. For those items with the same priority, the more recent added has lower priority which shows on the left. Here are some default priorities for official applications: Feed: 10, ChatWindow: 3, OfficalAppStatus: 8, DefaultPriority: 5 __syntax__ <verbatim>function AppTaskBar.AddStatusBarCommand(command, priority)</verbatim> __parameters__ | *command* | ; type of Map3DSystem.App.Command | | *priority* | | ---++++ !AppTaskBar.RemoveStatusBarCommand remove command from the status bar * _param_ __command__ : the command to be removed from the status bar __syntax__ <verbatim>function AppTaskBar.RemoveStatusBarCommand(command)</verbatim> __parameters__ | *command* | the command to be removed from the status bar | ---++++ !AppTaskBar.ClearStatusBarCommands remove all commands in status bar __syntax__ <verbatim>function AppTaskBar.ClearStatusBarCommands()</verbatim> ---++++ !AppTaskBar.RefreshStatusBar ------------ DEPARACATED ------------ this function is called when status bar is recreated or new item is added to it. __syntax__ <verbatim>function AppTaskBar.RefreshStatusBar()</verbatim> ---++++ !AppTaskBar.ShowQuickLaunchExtensionMenu bring up a context menu for selecting extension items. __syntax__ <verbatim>function AppTaskBar.ShowQuickLaunchExtensionMenu(nLineIndex)</verbatim> __parameters__ | *nLineIndex* | | ---++++ !AppTaskBar.ShowToolbarExtensionMenu bring up a context menu for selecting extension items. __syntax__ <verbatim>function AppTaskBar.ShowToolbarExtensionMenu()</verbatim> ---++++ !AppTaskBar.ShowStatusBarExtensionMenu bring up a context menu for selecting extension items. __syntax__ <verbatim>function AppTaskBar.ShowStatusBarExtensionMenu()</verbatim> %STOPINCLUDE%
E
dit
|
A
ttach
|
P
rint version
|
H
istory
: r1
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r1 - 2008-02-29
-
LiXizhi
Home
Site map
CCWeb web
HaqiTeen web
Main web
ParaEngine web
TWiki web
Main Web
Users
Groups
Index
Search
Changes
Notifications
RSS Feed
Statistics
导航页WebTopMenu
Preferences
开发指南
Getting Started
ParacraftSDK
NPL
MCML
NPL Reference Manual
美术Mod
Account
Log In
English
简体中文
簡體中文
E
dit
A
ttach
Copyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback