Kodi Development 22.0
for Binary and Script based Add-Ons
 
Loading...
Searching...
No Matches
WindowXML.h
1/*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#pragma once
10
11#include "Window.h"
12#include "WindowDialogMixin.h"
13#include "swighelper.h"
14#include "windows/GUIMediaWindow.h"
15
16#include <limits.h>
17#include <vector>
18
19namespace XBMCAddon
20{
21 namespace xbmcgui
22 {
23 class ListItem;
24 class WindowXMLInterceptor;
25
26 //
89 //
90 class WindowXML : public Window
91 {
92 std::string sFallBackPath;
93
94 protected:
95#ifndef SWIG
101
102 WindowXMLInterceptor* interceptor;
103#endif
104
105 public:
106 WindowXML(const String& xmlFilename, const String& scriptPath,
107 const String& defaultSkin = "Default",
108 const String& defaultRes = "720p",
109 bool isMedia = false);
110 ~WindowXML() override;
111
112#ifdef DOXYGEN_SHOULD_USE_THIS
134#else
135 SWIGHIDDENVIRTUAL void addItem(const Alternative<String, const ListItem*>& item, int position = INT_MAX);
136#endif
137
138#ifdef DOXYGEN_SHOULD_USE_THIS
158#else
159 SWIGHIDDENVIRTUAL void addItems(const std::vector<Alternative<String, const XBMCAddon::xbmcgui::ListItem* > > & items);
160#endif
161
162#ifdef DOXYGEN_SHOULD_USE_THIS
182#else
183 SWIGHIDDENVIRTUAL void removeItem(int position);
184#endif
185
186#ifdef DOXYGEN_SHOULD_USE_THIS
204#else
205 SWIGHIDDENVIRTUAL int getCurrentListPosition();
206#endif
207
208#ifdef DOXYGEN_SHOULD_USE_THIS
228#else
229 SWIGHIDDENVIRTUAL void setCurrentListPosition(int position);
230#endif
231
232#ifdef DOXYGEN_SHOULD_USE_THIS
252#else
253 SWIGHIDDENVIRTUAL ListItem* getListItem(int position);
254#endif
255
256#ifdef DOXYGEN_SHOULD_USE_THIS
274#else
275 SWIGHIDDENVIRTUAL int getListSize();
276#endif
277
278#ifdef DOXYGEN_SHOULD_USE_THIS
294#else
295 SWIGHIDDENVIRTUAL void clearList();
296#endif
297
298#ifdef DOXYGEN_SHOULD_USE_THIS
324#else
325 SWIGHIDDENVIRTUAL void setContainerProperty(const String &strProperty, const String &strValue);
326#endif
327
328#ifdef DOXYGEN_SHOULD_USE_THIS
373#else
374 SWIGHIDDENVIRTUAL void setContent(const String &strValue);
375#endif
376
377#ifdef DOXYGEN_SHOULD_USE_THIS
394#else
395 SWIGHIDDENVIRTUAL int getCurrentContainerId();
396#endif
397
398#ifndef SWIG
399 // CGUIWindow
400 bool OnMessage(CGUIMessage& message) override;
401 bool OnAction(const CAction& action) override;
402 SWIGHIDDENVIRTUAL void AllocResources(bool forceLoad = false);
403 SWIGHIDDENVIRTUAL void FreeResources(bool forceUnLoad = false);
404 SWIGHIDDENVIRTUAL bool OnClick(int iItem);
405 SWIGHIDDENVIRTUAL bool OnDoubleClick(int iItem);
406 SWIGHIDDENVIRTUAL void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions);
407
408 bool IsMediaWindow() const override
409 {
410 XBMC_TRACE;
411 return m_isMedia;
412 };
413
414 // This method is identical to the Window::OnDeinitWindow method
415 // except it passes the message on to their respective parents.
416 // Since the respective parent differences are handled by the
417 // interceptor there's no reason to define this one here.
418// SWIGHIDDENVIRTUAL void OnDeinitWindow(int nextWindowID);
419
420
421 protected:
422 // CGUIWindow
423 SWIGHIDDENVIRTUAL bool LoadXML(const String &strPath, const String &strPathLower);
424
425 // CGUIMediaWindow
426 SWIGHIDDENVIRTUAL void GetContextButtons(int itemNumber, CContextButtons &buttons);
427 SWIGHIDDENVIRTUAL bool Update(const String &strPath);
428
429 void SetupShares();
430 String m_scriptPath;
431 String m_mediaDir;
432 bool m_isMedia;
433
434 friend class WindowXMLInterceptor;
435#endif
436 };
438
439 // Ideally what we want here is a Dialog/Media Window. The problem is that these
440 // are two orthogonal discriminations of CGUIWindow and there wasn't a previous
441 // accounting for this possibility through the use of making CGUIWindow a
442 // virtual base class of the pertinent subclasses. So now we're left with
443 // no good solution.
444 //
445 // <strike>So here we're going to have the 'main' hierarchy (the one visible to SWIG)
446 // go the way intended - through WindowXML, but we're going to borrow dialog
447 // functionality from CGUIDialog by using it as a Mixin.</strike>
448 //
449 // jmarshall says that this class has no reason to inherit from CGUIMediaWindow.
450 // At some point this entire hierarchy needs to be reworked. The XML handling
451 // routines should be put in a mixin.
452 //
506 //
507 class WindowXMLDialog : public WindowXML, private WindowDialogMixin
508 {
509 public:
510 WindowXMLDialog(const String& xmlFilename, const String& scriptPath,
511 const String& defaultSkin = "Default",
512 const String& defaultRes = "720p");
513
514 ~WindowXMLDialog() override;
515
516#ifndef SWIG
517 bool OnMessage(CGUIMessage& message) override;
518 bool IsDialogRunning() const override
519 {
520 XBMC_TRACE;
521 return WindowDialogMixin::IsDialogRunning();
522 }
523 bool IsDialog() const override
524 {
525 XBMC_TRACE;
526 return true;
527 };
528 bool IsModalDialog() const override
529 {
530 XBMC_TRACE;
531 return true;
532 };
533 bool IsMediaWindow() const override
534 {
535 XBMC_TRACE;
536 return false;
537 };
538 bool OnAction(const CAction& action) override;
539 void OnDeinitWindow(int nextWindowID) override;
540
541 bool LoadXML(const String& strPath, const String& strPathLower) override;
542
543 inline void show() override
544 {
545 XBMC_TRACE;
546 WindowDialogMixin::show();
547 }
548 inline void close() override
549 {
550 XBMC_TRACE;
551 WindowDialogMixin::close();
552 }
553
554 friend class DialogJumper;
555#endif
556 };
558 }
559}
Definition ListItem.h:54
Definition Window.h:187
Definition WindowXML.h:508
Definition WindowXML.h:91
static int lockingGetNextAvailableWindowId()
addItem(...)
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
getListSize()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
clearList()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
getCurrentContainerId(...)
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
getCurrentListPosition()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
setContent(...)
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
removeItem(...)
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
setCurrentListPosition(...)
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
getListItem(...)
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
setContainerProperty(...)
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
addItems(...)
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...