GUI window callback functions.
Functions to handle control callbacks from Kodi
Go back to normal functions from CWindow
◆ OnInit()
OnInit method.
- Returns
- Return true if initialize was done successful
◆ OnFocus()
virtual bool OnFocus |
( |
int | controlId | ) |
|
|
inlinevirtual |
OnFocus method.
- Parameters
-
[in] | controlId | GUI control identifier |
- Returns
- Return true if focus condition was handled there or false to handle them by Kodi itself
◆ OnClick()
virtual bool OnClick |
( |
int | controlId | ) |
|
|
inlinevirtual |
OnClick method.
- Parameters
-
[in] | controlId | GUI control identifier |
- Returns
- Return true if click was handled there or false to handle them by Kodi itself
◆ OnAction()
OnAction method.
- Parameters
-
[in] | actionId | The action id to perform, see kodi_key_action_ids to get list of them |
- Returns
- Return true if action was handled there or false to handle them by Kodi itself
This method will receive all actions that the main program will send to this window.
- Note
- By default, only the
ADDON_ACTION_PREVIOUS_MENU
and ADDON_ACTION_NAV_BACK
actions are handled.
- Overwrite this method to let your code handle all actions.
- Don't forget to capture ADDON_ACTION_PREVIOUS_MENU or ADDON_ACTION_NAV_BACK, else the user can't close this window.
Example:
..
{
switch (action)
{
printf("action received: previous");
return true;
printf("action received: show info");
break;
printf("action received: stop");
break;
printf("action received: pause");
break;
default:
break;
}
return false;
}
..
ADDON_ACTION
Definition action_ids.h:19
@ ADDON_ACTION_PREVIOUS_MENU
10: Previous menu.
Definition action_ids.h:54
@ ADDON_ACTION_NAV_BACK
90: Nav back.
Definition action_ids.h:286
@ ADDON_ACTION_SHOW_INFO
11: Show info.
Definition action_ids.h:57
@ ADDON_ACTION_STOP
13: Stop.
Definition action_ids.h:63
@ ADDON_ACTION_PAUSE
12: Pause.
Definition action_ids.h:60
void Close()
Closes this window.
Definition Window.h:183
◆ GetContextButtons()
virtual void GetContextButtons |
( |
int | itemNumber, |
|
|
std::vector< std::pair< unsigned int, std::string > > & | buttons ) |
|
inlinevirtual |
Get context menu buttons for list entry.
- Parameters
-
[in] | itemNumber | Selected list item entry |
[in] | buttons | List where context menus becomes added with his identifier and name |
◆ OnContextButton()
virtual bool OnContextButton |
( |
int | itemNumber, |
|
|
unsigned int | button ) |
|
inlinevirtual |
Called after selection in context menu.
- Parameters
-
[in] | itemNumber | Selected list item entry |
[in] | button | The pressed button id |
- Returns
- true if handled, otherwise false
◆ SetIndependentCallbacks()
void SetIndependentCallbacks |
( |
kodi::gui::ClientHandle | cbhdl, |
|
|
bool(* | CBOnInit )(kodi::gui::ClientHandle cbhdl), |
|
|
bool(* | CBOnFocus )(kodi::gui::ClientHandle cbhdl, int controlId), |
|
|
bool(* | CBOnClick )(kodi::gui::ClientHandle cbhdl, int controlId), |
|
|
bool(* | CBOnAction )(kodi::gui::ClientHandle cbhdl, ADDON_ACTION actionId), |
|
|
void(* | CBGetContextButtons )(kodi::gui::ClientHandle cbhdl, int itemNumber, gui_context_menu_pair *buttons, unsigned int *size) = nullptr, |
|
|
bool(* | CBOnContextButton )(kodi::gui::ClientHandle cbhdl, int itemNumber, unsigned int button) = nullptr ) |
|
inline |
Set independent callbacks
If the class is used independent (with "new CWindow") and not as parent (with "cCLASS_own : public kodi::gui::CWindow") from own must be the callback from Kodi to add-on overdriven with own functions!
- Parameters
-
[in] | cbhdl | The pointer to own handle data structure / class |
[in] | CBOnInit | Own defined window init function |
[in] | CBOnFocus | Own defined focus function |
[in] | CBOnClick | Own defined click function |
[in] | CBOnAction | Own defined action function |
[in] | CBGetContextButtons | [opt] To get context menu entries for lists function |
[in] | CBOnContextButton | [opt] Used context menu entry function |
Example:
...
{
...
return true;
}
{
...
return true;
}
{
...
return true;
}
{
...
return true;
}
...
...
KODI_GUI_CLIENT_HANDLE ClientHandle
Handler for addon-sided processing class If the callback functions used by the window are not used di...
Definition Window.h:43
virtual bool OnAction(ADDON_ACTION actionId)
OnAction method.
Definition Window.h:740
virtual bool OnInit()
OnInit method.
Definition Window.h:661
virtual bool OnFocus(int controlId)
OnFocus method.
Definition Window.h:673
virtual bool OnClick(int controlId)
OnClick method.
Definition Window.h:685
CWindow(const std::string &xmlFilename, const std::string &defaultSkin, bool asDialog, bool isMedia=false)
Class constructor with needed values for window / dialog.
Definition Window.h:126