1 // Copyright 2001-2019 Crytek GmbH / Crytek Group. All rights reserved.
7 #include <CrySerialization/Forward.h>
9 struct BlockPaletteContent
;
10 struct BlockPaletteLayout
;
11 struct BlockPaletteItem
;
13 struct BlockPaletteSelectedId
21 BlockPaletteSelectedId()
26 typedef std::vector
<BlockPaletteSelectedId
> BlockPaletteSelectedIds
;
28 class BlockPalette
: public QWidget
32 BlockPalette(QWidget
* parent
);
35 void SetContent(const BlockPaletteContent
& content
);
36 void SetAddEventWithSingleClick(bool addWithSingleClick
);
37 const BlockPaletteContent
& Content() const { return *m_content
.get(); }
39 void GetSelectedIds(BlockPaletteSelectedIds
* ids
) const;
40 const BlockPaletteItem
* GetItemByHotkey(int hotkey
) const;
41 void Serialize(Serialization::IArchive
& ar
);
44 void SignalSelectionChanged();
45 void SignalItemClicked(const BlockPaletteItem
& item
);
49 void OnMenuAddWithSingleClick();
50 void OnMenuAssignHotkey();
53 struct SelectionHandler
;
57 void ItemClicked(int mouseButton
);
58 void AssignHotkey(int hotkey
);
60 void paintEvent(QPaintEvent
* ev
) override
;
61 void mousePressEvent(QMouseEvent
* ev
) override
;
62 void mouseMoveEvent(QMouseEvent
* ev
) override
;
63 void mouseReleaseEvent(QMouseEvent
* ev
) override
;
64 void mouseDoubleClickEvent(QMouseEvent
* ev
) override
;
65 void keyPressEvent(QKeyEvent
* ev
) override
;
66 void resizeEvent(QResizeEvent
* ev
) override
;
67 void wheelEvent(QWheelEvent
* ev
) override
;
69 std::unique_ptr
<BlockPaletteContent
> m_content
;
70 std::unique_ptr
<BlockPaletteLayout
> m_layout
;
71 std::unique_ptr
<MouseHandler
> m_mouseHandler
;
73 std::vector
<int> m_selectedItems
;
74 std::vector
<int> m_draggedItems
;
75 std::vector
<int> m_hotkeys
;
76 bool m_addWithSingleClick
;