Class: kodi::gui::CWindow
Main window control class
The addon uses its own skin xml file and displays it in Kodi using this class.
The with #include <kodi/gui/Window.h> included file brings support to create a window or dialog on Kodi.
The add-on has to integrate its own callback functions in order to process the necessary user access to its window.
Window header example:
<?xml version="1.0" encoding="UTF-8"?>
<window>
<onload>RunScript(script.foobar)</onload>
<onunload>SetProperty(foo,bar)</onunload>
<defaultcontrol always="false">2</defaultcontrol>
<menucontrol>9000</menucontrol>
<backgroundcolor>0xff00ff00</backgroundcolor>
<views>50,51,509,510</views>
<visible>Window.IsActive(Home)</visible>
<animation effect="fade" time="100">WindowOpen</animation>
<animation effect="slide" end="0,576" time="100">WindowClose</animation>
<zorder>1</zorder>
<coordinates>
<left>40</left>
<top>50</top>
<origin x="100" y="50">Window.IsActive(Home)</origin>
</coordinates>
<previouswindow>MyVideos</previouswindow>
<controls>
<control>
</control>
....
</controls>
</window>
On functions defined input variable controlId
(GUI control identifier) is the on window.xml defined value behind type added with id="..."
and used to identify for changes there and on callbacks.
<control type="label" id="31">
<description>Title Label</description>
...
</control>
<control type="progress" id="32">
<description>progress control</description>
...
</control>
◆ CWindow()
CWindow |
( |
const std::string & |
xmlFilename, |
|
|
const std::string & |
defaultSkin, |
|
|
bool |
asDialog, |
|
|
bool |
isMedia = false |
|
) |
| |
|
inline |
Class constructor with needed values for window / dialog.
Creates a new Window class.
- Parameters
-
[in] | xmlFilename | XML file for the skin |
[in] | defaultSkin | Default skin to use if needed not available |
[in] | asDialog | Use window as dialog if set |
[in] | isMedia | [opt] bool - if False, create a regular window. if True, create a mediawindow. (default=false) |
- Note
isMedia
value as true only usable for windows not for dialogs.
◆ Show()
Show this window.
Shows this window by activating it, calling close() after it wil activate the current window again.
- Note
- If your Add-On ends this window will be closed to. To show it forever, make a loop at the end of your Add-On or use DoModal() instead.
- Warning
- If used must be the class be global present until Kodi becomes closed. The creation can be done before "Show" becomes called, but not delete class after them.
- Returns
- Return true if call and show is successed, if false was something failed to get needed skin parts.
◆ Close()
Closes this window.
Closes this window by activating the old window.
- Note
- The window is not deleted with this method.
◆ DoModal()
Display this window until close() is called.
◆ SetFocusId()
bool SetFocusId |
( |
int |
controlId | ) |
|
|
inline |
Gives the control with the supplied focus.
- Parameters
-
[in] | controlId | On skin defined id of control |
- Returns
- Return true if call and focus is successed, if false was something failed to get needed skin parts
◆ GetFocusId()
Returns the id of the control which is focused.
- Returns
- Focused control id
◆ SetControlLabel()
void SetControlLabel |
( |
int |
controlId, |
|
|
const std::string & |
label |
|
) |
| |
|
inline |
To set the used label on given control id.
- Parameters
-
[in] | controlId | Control id where label need to set |
[in] | label | Label to use |
◆ SetControlVisible()
void SetControlVisible |
( |
int |
controlId, |
|
|
bool |
visible |
|
) |
| |
|
inline |
To set the visibility on given control id.
- Parameters
-
[in] | controlId | Control id where visibility is changed |
[in] | visible | Boolean value with true for visible, false for hidden |
◆ SetControlSelected()
void SetControlSelected |
( |
int |
controlId, |
|
|
bool |
selected |
|
) |
| |
|
inline |
To set the selection on given control id.
- Parameters
-
[in] | controlId | Control id where selection is changed |
[in] | selected | Boolean value with true for selected, false for not |
◆ SetProperty()
void SetProperty |
( |
const std::string & |
key, |
|
|
const std::string & |
value |
|
) |
| |
|
inline |
Sets a window property, similar to an infolabel.
- Parameters
-
[in] | key | string - property name. |
[in] | value | string or unicode - value of property. |
- Note
- Key is NOT case sensitive. Setting value to an empty string is equivalent to clearProperty(key).
You can use the above as keywords for arguments and skip certain optional arguments.
Once you use a keyword, all following arguments require the keyword.
◆ GetProperty()
std::string GetProperty |
( |
const std::string & |
key | ) |
const |
|
inline |
Returns a window property as a string, similar to an infolabel.
- Parameters
-
[in] | key | string - property name. |
- Returns
- The property as string (if present)
- Note
- Key is NOT case sensitive. Setting value to an empty string is equivalent to clearProperty(key).
You can use the above as keywords for arguments and skip certain optional arguments.
Once you use a keyword, all following arguments require the keyword.
◆ SetPropertyInt()
void SetPropertyInt |
( |
const std::string & |
key, |
|
|
int |
value |
|
) |
| |
|
inline |
Sets a window property with integer value.
- Parameters
-
[in] | key | string - property name. |
[in] | value | integer value to set |
◆ GetPropertyInt()
int GetPropertyInt |
( |
const std::string & |
key | ) |
const |
|
inline |
Returns a window property with integer value.
- Parameters
-
[in] | key | string - property name. |
- Returns
- integer value of property
◆ SetPropertyBool()
void SetPropertyBool |
( |
const std::string & |
key, |
|
|
bool |
value |
|
) |
| |
|
inline |
Sets a window property with boolean value.
- Parameters
-
[in] | key | string - property name. |
[in] | value | boolean value to set |
◆ GetPropertyBool()
bool GetPropertyBool |
( |
const std::string & |
key | ) |
const |
|
inline |
Returns a window property with boolean value.
- Parameters
-
[in] | key | string - property name. |
- Returns
- boolean value of property
◆ SetPropertyDouble()
void SetPropertyDouble |
( |
const std::string & |
key, |
|
|
double |
value |
|
) |
| |
|
inline |
Sets a window property with double value.
- Parameters
-
[in] | key | string - property name. |
[in] | value | double value to set |
◆ GetPropertyDouble()
double GetPropertyDouble |
( |
const std::string & |
key | ) |
const |
|
inline |
Returns a window property with double value.
- Parameters
-
[in] | key | string - property name. |
- Returns
- double value of property
◆ ClearProperties()
Remove all present properties from window.
◆ ClearProperty()
void ClearProperty |
( |
const std::string & |
key | ) |
|
|
inline |
Clears the specific window property.
- Parameters
-
[in] | key | string - property name. |
- Note
- Key is NOT case sensitive. Equivalent to SetProperty(key, "") You can use the above as keywords for arguments and skip certain optional arguments. Once you use a keyword, all following arguments require the keyword.
Example:
..
..
void ClearProperty(const std::string &key)
Clears the specific window property.
Definition: Window.h:429
◆ ClearList()
Function delete all entries in integrated list.
◆ AddListItem() [1/2]
void AddListItem |
( |
const std::shared_ptr< CListItem > & |
item, |
|
|
int |
itemPosition = -1 |
|
) |
| |
|
inline |
To add a list item in the on window integrated list.
- Parameters
-
[in] | item | List item to add |
[in] | itemPosition | [opt] The position for item, default is on end |
◆ AddListItem() [2/2]
void AddListItem |
( |
const std::string & |
item, |
|
|
int |
itemPosition = -1 |
|
) |
| |
|
inline |
To add a list item based upon string in the on window integrated list.
- Parameters
-
[in] | item | List item to add |
[in] | itemPosition | [opt] The position for item, default is on end |
◆ RemoveListItem() [1/2]
void RemoveListItem |
( |
int |
itemPosition | ) |
|
|
inline |
Remove list item on position.
- Parameters
-
[in] | itemPosition | List position to remove |
◆ RemoveListItem() [2/2]
void RemoveListItem |
( |
const std::shared_ptr< CListItem > & |
item | ) |
|
|
inline |
Remove item with given control class from list.
- Parameters
-
[in] | item | List item control class to remove |
◆ GetListItem()
std::shared_ptr<CListItem> GetListItem |
( |
int |
listPos | ) |
|
|
inline |
To get list item control class on wanted position.
- Parameters
-
[in] | listPos | Position from where control is needed |
- Returns
- The list item control class or null if not found
- Warning
- Function returns a new generated CListItem class!
◆ SetCurrentListPosition()
void SetCurrentListPosition |
( |
int |
listPos | ) |
|
|
inline |
To set position of selected part in list.
- Parameters
-
[in] | listPos | Position to use |
◆ GetCurrentListPosition()
int GetCurrentListPosition |
( |
| ) |
|
|
inline |
To get current selected position in list.
- Returns
- Current list position
◆ GetListSize()
To get the amount of entries in the list.
- Returns
- Size of in window integrated control class
◆ SetContainerProperty()
void SetContainerProperty |
( |
const std::string & |
key, |
|
|
const std::string & |
value |
|
) |
| |
|
inline |
Sets a container property, similar to an infolabel.
- Parameters
-
[in] | key | string - property name. |
[in] | value | string or unicode - value of property. |
- Note
- Key is NOT case sensitive.
You can use the above as keywords for arguments and skip certain optional arguments.
Once you use a keyword, all following arguments require the keyword.
◆ SetContainerContent()
void SetContainerContent |
( |
const std::string & |
value | ) |
|
|
inline |
Sets the content type of the container.
- Parameters
-
[in] | value | string or unicode - content value. |
Available content types
Name | Media |
actors | Videos |
addons | Addons, Music, Pictures, Programs, Videos |
albums | Music, Videos |
artists | Music, Videos |
countries | Music, Videos |
directors | Videos |
files | Music, Videos |
games | Games |
genres | Music, Videos |
images | Pictures |
mixed | Music, Videos |
movies | Videos |
Musicvideos | Music, Videos |
playlists | Music, Videos |
seasons | Videos |
sets | Videos |
songs | Music |
studios | Music, Videos |
tags | Music, Videos |
tvshows | Videos |
videos | Videos |
years | Music, Videos |
◆ GetCurrentContainerId()
int GetCurrentContainerId |
( |
| ) |
|
|
inline |
Get the id of the currently visible container.
- Returns
- currently visible container id
◆ MarkDirtyRegion()
To inform Kodi that it need to render region new.