ASPiK SDK
application.h
1 // This file is part of VSTGUI. It is subject to the license terms
2 // in the LICENSE file found in the top-level directory of this
3 // distribution and at http://github.com/steinbergmedia/vstgui/LICENSE
4 
5 #pragma once
6 
7 #include "../include/ialertbox.h"
8 #include "../include/iapplication.h"
9 #include "../include/icommand.h"
10 #include "../include/iwindowlistener.h"
11 #include "platform/iplatformwindow.h"
12 #include <functional>
13 #include <vector>
14 
15 namespace VSTGUI {
16 namespace Standalone {
17 namespace Detail {
18 
19 //------------------------------------------------------------------------
21 {
22  char16_t defaultKey;
23  uint16_t id;
24 };
25 
26 //------------------------------------------------------------------------
28 {
29  using OnCommandUpdateFunc = std::function<void ()>;
30  using QuitFunc = std::function<void ()>;
31  using AlertFunc = std::function<AlertResult (const AlertBoxConfig&)>;
32  using AlertForWindowFunc = std::function<void (const AlertBoxForWindowConfig&)>;
33 
34  QuitFunc quit;
35  OnCommandUpdateFunc onCommandUpdate;
36  AlertFunc showAlert;
37  AlertForWindowFunc showAlertForWindow;
38 };
39 
40 //------------------------------------------------------------------------
42 {
43 public:
44  using CommandWithKeyList = std::vector<CommandWithKey>;
45  using CommandListPair = std::pair<UTF8String, CommandWithKeyList>;
46  using CommandList = std::vector<CommandListPair>;
47 
48  struct InitParams
49  {
50  IPreference& preferences;
51  ICommonDirectories& commonDirectories;
52  IApplication::CommandLineArguments&& cmdArgs;
53  PlatformCallbacks&& callbacks;
54  };
55 
56  virtual void init (const InitParams& params) = 0;
57 
58  virtual CommandList getCommandList (const Platform::IWindow* window = nullptr) = 0;
59  virtual const CommandList& getKeyCommandList () = 0;
60  virtual bool canQuit () = 0;
61 
62  virtual bool dontClosePopupOnDeactivation (Platform::IWindow* window) = 0;
63 };
64 
65 //------------------------------------------------------------------------
66 inline IPlatformApplication* getApplicationPlatformAccess ()
67 {
68  return static_cast<IPlatformApplication*> (&IApplication::instance ());
69 }
70 
71 //------------------------------------------------------------------------
73 {
74 public:
75  PreventPopupClose (IWindow& window);
76  ~PreventPopupClose () noexcept;
77 
78 private:
79  std::shared_ptr<Platform::IWindow> platformWindow;
80 };
81 
82 //------------------------------------------------------------------------
83 } // Detail
84 } // Standalone
85 } // VSTGUI
Definition: icommondirectories.h:25
Definition: icommand.h:47
Definition: iapplication.h:22
Definition: iplatformwindow.h:32
Definition: customcontrols.cpp:8
Definition: iwindow.h:142
static IApplication & instance()
Definition: application.cpp:451
Definition: icommand.h:24
Definition: iwindowlistener.h:20
Definition: application.h:20
Definition: ipreference.h:22