Ember
Loading...
Searching...
No Matches
BlackboardScene.h
Go to the documentation of this file.
1#pragma once
2
4#include "Interfaces/IScene.h"
5#include <map>
6#include <memory>
7#include <set>
8#include <string>
9#include <vector>
10#include <wx/scrolwin.h>
11#include <wx/timer.h>
12#include <wx/wx.h>
13
14class BlackboardScene : public IScene {
15 public:
16 BlackboardScene(wxWindow *parent);
17 ~BlackboardScene() override;
18
19 wxPanel *GetPanel() override { return m_panel; }
20 wxString GetTitle() const override { return "Blackboard"; }
21 wxString GetSceneType() const override { return "Blackboard"; }
22 bool IsClosable() const override { return false; }
23
24 void SetBlackboards(const std::map<std::string, std::shared_ptr<EmberCore::Blackboard>> &bbs,
25 const std::map<std::string, std::vector<std::string>> &includesMap);
26
27 void ScrollToBlackboard(const std::string &bbId);
28 void ClearBlackboards();
29
30 private:
31 void CreateLayout();
32 void DrawBlackboardCards(wxDC &dc);
33 void OnPaint(wxPaintEvent &event);
34 void OnLeftDown(wxMouseEvent &event);
35 void OnMouseWheel(wxMouseEvent &event);
36 void OnScrollTimer(wxTimerEvent &event);
37
38 wxPanel *m_panel;
39 wxScrolledWindow *m_scrollPanel;
40
41 std::map<std::string, std::shared_ptr<EmberCore::Blackboard>> m_blackboards;
42 std::map<std::string, std::vector<std::string>> m_includesMap;
43
44 std::vector<std::string> m_sortedBBIds;
45 std::set<std::string> m_collapsedBlackboards;
46 std::map<std::string, int> m_bbYPositions;
47
48 wxTimer *m_scrollTimer = nullptr;
49 double m_scrollVelocity = 0.0;
50 double m_scrollY = 0.0;
51
52 static const int CARD_HEADER_H = 26;
53 static const int ROW_H = 24;
54 static constexpr double SCROLL_FRICTION = 0.82;
55 static constexpr double SCROLL_PIXELS_PER_NOTCH = 60.0;
56};
wxTimer * m_scrollTimer
void ScrollToBlackboard(const std::string &bbId)
wxString GetTitle() const override
Returns the display title of the scene.
static const int ROW_H
wxScrolledWindow * m_scrollPanel
std::map< std::string, std::shared_ptr< EmberCore::Blackboard > > m_blackboards
static constexpr double SCROLL_FRICTION
void OnMouseWheel(wxMouseEvent &event)
wxPanel * GetPanel() override
Returns the wxPanel used as the scene content.
void OnScrollTimer(wxTimerEvent &event)
void OnLeftDown(wxMouseEvent &event)
bool IsClosable() const override
Returns true if the scene can be closed.
void DrawBlackboardCards(wxDC &dc)
static const int CARD_HEADER_H
BlackboardScene(wxWindow *parent)
static constexpr double SCROLL_PIXELS_PER_NOTCH
void SetBlackboards(const std::map< std::string, std::shared_ptr< EmberCore::Blackboard > > &bbs, const std::map< std::string, std::vector< std::string > > &includesMap)
std::map< std::string, int > m_bbYPositions
void OnPaint(wxPaintEvent &event)
std::map< std::string, std::vector< std::string > > m_includesMap
std::vector< std::string > m_sortedBBIds
wxString GetSceneType() const override
Returns the scene type identifier.
std::set< std::string > m_collapsedBlackboards
~BlackboardScene() override
Interface for scene-based UI components (e.g., views or screens).
Definition IScene.h:7