ASPiK SDK
uidialogcontroller.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 #ifndef __uidialogcontroller__
6 #define __uidialogcontroller__
7 
8 #include "../uidescription.h"
9 
10 #if VSTGUI_LIVE_EDITING
11 
12 #include "../delegationcontroller.h"
13 #include "../../lib/cframe.h"
14 #include "../../lib/iviewlistener.h"
15 #include "../../lib/copenglview.h"
16 #include <string>
17 #include <list>
18 
19 namespace VSTGUI {
20 
21 //----------------------------------------------------------------------------------------------------
22 class UIDialogController : public CBaseObject, public DelegationController, public IKeyboardHook, public IViewListenerAdapter
23 {
24 public:
25  UIDialogController (IController* baseController, CFrame* frame);
26  ~UIDialogController () override = default;
27 
28  void run (UTF8StringPtr templateName, UTF8StringPtr dialogTitle, UTF8StringPtr button1, UTF8StringPtr button2, IController* controller, UIDescription* description);
29 
30  static IdStringPtr kMsgDialogButton1Clicked;
31  static IdStringPtr kMsgDialogButton2Clicked;
32  static IdStringPtr kMsgDialogShow;
33 protected:
34  void valueChanged (CControl* pControl) override;
35  IControlListener* getControlListener (UTF8StringPtr controlTagName) override;
36  CView* verifyView (CView* view, const UIAttributes& attributes, const IUIDescription* description) override;
37  CMessageResult notify (CBaseObject* sender, IdStringPtr message) override;
38 
39  void viewSizeChanged (CView* view, const CRect& oldSize) override;
40  void viewRemoved (CView* view) override;
41 
42  void close ();
43  void layoutButtons ();
44  void collectOpenGLViews (CViewContainer* container);
45  void setOpenGLViewsVisible (bool state);
46 
47  int32_t onKeyDown (const VstKeyCode& code, CFrame* frame) override;
48  int32_t onKeyUp (const VstKeyCode& code, CFrame* frame) override;
49 
50  CFrame* frame;
51  SharedPointer<CBaseObject> dialogController;
52  UIDescription* dialogDescription;
53  SharedPointer<CControl> button1;
54  SharedPointer<CControl> button2;
55  CPoint sizeDiff;
56  std::string templateName;
57  std::string dialogTitle;
58  std::string dialogButton1;
59  std::string dialogButton2;
60 
61 #if VSTGUI_OPENGL_SUPPORT
62  std::list<SharedPointer<COpenGLView> > openglViews;
63 #endif
64 
65  enum {
66  kButton1Tag,
67  kButton2Tag,
68  kTitleTag
69  };
70 };
71 
72 } // namespace
73 
74 #endif // VSTGUI_LIVE_EDITING
75 
76 #endif // __uidialogcontroller__
Definition: vstkeycode.h:12
Definition: customcontrols.cpp:8