| 1 |
#ifndef __designer_panel__ |
| 2 |
#define __designer_panel__ |
| 3 |
|
| 4 |
#include "menu_bar.h" |
| 5 |
#include <map> |
| 6 |
#include <wx/aui/auibook.h> |
| 7 |
#include <wx/choicebk.h> |
| 8 |
#include <wx/collpane.h> |
| 9 |
#include <wx/listbook.h> |
| 10 |
#include <wx/notebook.h> |
| 11 |
#include <wx/ribbon/bar.h> |
| 12 |
#include <wx/scrolwin.h> |
| 13 |
#include <wx/toolbook.h> |
| 14 |
#include <wx/treebook.h> |
| 15 |
|
| 16 |
class DesignerContainerPanel; |
| 17 |
class HintFrame; |
| 18 |
|
| 19 |
struct SizeritemData { |
| 20 |
SizeritemData(wxWindow* win, wxSizerItem* item) |
| 21 |
: m_parentWin(win) |
| 22 |
, m_sizeritem(item) |
| 23 |
{ |
| 24 |
} |
| 25 |
wxWindow* m_parentWin; |
| 26 |
wxSizerItem* m_sizeritem; |
| 27 |
}; |
| 28 |
|
| 29 |
class DesignerPanel : public wxScrolledWindow |
| 30 |
{ |
| 31 |
bool m_constructing; |
| 32 |
wxString m_xrcLoaded; |
| 33 |
DesignerContainerPanel* m_mainPanel = nullptr; |
| 34 |
wxWindow* m_hintedWin; |
| 35 |
wxWindow* m_parentWin; |
| 36 |
wxSizerItem* m_hintedSizeritem; |
| 37 |
wxWindow* m_hintedContainer; |
| 38 |
wxString m_selecteItem; |
| 39 |
std::map<wxString, wxWindow*> m_windows; |
| 40 |
std::map<int, SizeritemData> m_sizeritems; |
| 41 |
|
| 42 |
protected: |
| 43 |
void RecurseConnectEvents(wxWindow* pclComponent); |
| 44 |
void RecurseDisconnectEvents(wxWindow* pclComponent); |
| 45 |
void StoreSizersRecursively(wxSizer* sizer, wxWindow* container); |
| 46 |
void DoDrawSurroundingMarker(wxWindow* win); |
| 47 |
void DoMarkSizeritem(wxSizerItem* szitem, wxWindow* container); |
| 48 |
void ClearStaleOutlines() const; |
| 49 |
void MarkOutline(wxDC& dc, wxRect* rect = NULL) const; |
| 50 |
void MarkBorders(wxDC& dc) const; |
| 51 |
void DoMarkBorders(wxDC& dc, wxRect rr, int bdrwidth, int flags) const; |
| 52 |
wxPoint GetOutlineOffset() const; // Needed for pages in a wxNotebook with top/left tabs |
| 53 |
void DoNotebookPageChangeEvent(wxEvent& e); |
| 54 |
void DoAuiBookChanged(wxAuiNotebookEvent& e); |
| 55 |
void DoClear(); |
| 56 |
void DoLoadXRC(int topLeveWinType); |
| 57 |
void DoControlSelected(wxEvent& e); |
| 58 |
|
| 59 |
public: |
| 60 |
void OnTreeListCtrlFocus(wxFocusEvent& e); |
| 61 |
|
| 62 |
public: |
| 63 |
DesignerPanel(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& position = wxDefaultPosition, |
| 64 |
const wxSize& size = wxDefaultSize, long style = 0); |
| 65 |
virtual ~DesignerPanel(); |
| 66 |
|
| 67 |
DECLARE_EVENT_TABLE() |
| 68 |
void OnUpdatePreview(wxCommandEvent& e); |
| 69 |
void OnClearPreview(wxCommandEvent& e); |
| 70 |
void OnLoadPreview(wxCommandEvent& e); |
| 71 |
void OnMouseLeftDown(wxMouseEvent& e); |
| 72 |
void OnControlFocus(wxFocusEvent& event); |
| 73 |
void OnNotebookPageChanged(wxNotebookEvent& e); |
| 74 |
void OnListbookPageChanged(wxListbookEvent& e); |
| 75 |
void OnToolbookPageChanged(wxToolbookEvent& e); |
| 76 |
void OnChoicebookPageChanged(wxChoicebookEvent& e); |
| 77 |
void OnTreebookPageChanged(wxTreebookEvent& e); |
| 78 |
void OnAuiPageChanged(wxAuiNotebookEvent& e); |
| 79 |
void OnAuiPageChanging(wxAuiNotebookEvent& e); |
| 80 |
void OnAuiToolClicked(wxCommandEvent& e); |
| 81 |
void OnHighlightControl(wxCommandEvent& e); |
| 82 |
void OnRadioBox(wxCommandEvent& e); |
| 83 |
void OnRibbonPageChanged(wxRibbonBarEvent& e); |
| 84 |
void OnSize(wxSizeEvent& event); |
| 85 |
}; |
| 86 |
|
| 87 |
#endif // __designer_panel__ |