Window.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * This source file is part of RmlUi, the HTML/CSS Interface Middleware
  3. *
  4. * For the latest information, see http://github.com/mikke89/RmlUi
  5. *
  6. * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
  7. * Copyright (c) 2019 The RmlUi Team, and contributors
  8. *
  9. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10. * of this software and associated documentation files (the "Software"), to deal
  11. * in the Software without restriction, including without limitation the rights
  12. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13. * copies of the Software, and to permit persons to whom the Software is
  14. * furnished to do so, subject to the following conditions:
  15. *
  16. * The above copyright notice and this permission notice shall be included in
  17. * all copies or substantial portions of the Software.
  18. *
  19. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  23. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  24. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  25. * THE SOFTWARE.
  26. *
  27. */
  28. #ifndef RMLUI_TESTS_VISUALTESTS_WINDOW_H
  29. #define RMLUI_TESTS_VISUALTESTS_WINDOW_H
  30. #include <RmlUi/Core/EventListener.h>
  31. #include <RmlUi/Core/Types.h>
  32. #include "XmlNodeHandlers.h"
  33. namespace Rml { class Context; class ElementDocument; }
  34. struct TestSuite {
  35. Rml::String directory;
  36. Rml::StringList files;
  37. };
  38. using TestSuiteList = Rml::Vector<TestSuite>;
  39. class Window : public Rml::EventListener, Rml::NonCopyMoveable
  40. {
  41. public:
  42. Window(Rml::Context* context, TestSuiteList test_suites);
  43. ~Window();
  44. private:
  45. const TestSuite& GetCurrentTestSuite() const;
  46. Rml::String GetCurrentPath() const;
  47. Rml::String GetReferencePath() const;
  48. void OpenSource(const Rml::String& file_path);
  49. void OpenSource();
  50. void SwitchSource();
  51. void CloseSource();
  52. void ReloadDocument();
  53. void ProcessEvent(Rml::Event& event) override;
  54. Rml::Context* context;
  55. int goto_id = -1;
  56. int current_id = 0;
  57. Rml::ElementDocument* document = nullptr;
  58. Rml::ElementDocument* document_description = nullptr;
  59. Rml::ElementDocument* document_source = nullptr;
  60. Rml::ElementDocument* document_match = nullptr;
  61. Rml::String reference_file;
  62. bool viewing_reference_source = false;
  63. const TestSuiteList test_suites;
  64. int current_test_suite = 0;
  65. MetaList meta_list;
  66. LinkList link_list;
  67. };
  68. #endif