1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-30 12:32:36 +00:00
OpenMW/apps/openmw/mwgui/itemview.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

53 lines
1.4 KiB
C++
Raw Normal View History

2013-05-11 18:38:27 +02:00
#ifndef MWGUI_ITEMVIEW_H
#define MWGUI_ITEMVIEW_H
#include <MyGUI_Widget.h>
#include "itemmodel.hpp"
namespace MWGui
{
2020-02-13 21:36:56 +01:00
class ItemView final : public MyGUI::Widget
2013-05-11 18:38:27 +02:00
{
MYGUI_RTTI_DERIVED(ItemView)
public:
ItemView();
/// Register needed components with MyGUI's factory manager
static void registerComponents();
/// Takes ownership of \a model
2022-08-31 19:03:45 +02:00
void setModel(std::unique_ptr<ItemModel> model);
2013-05-11 18:38:27 +02:00
typedef MyGUI::delegates::MultiDelegate<ItemModel::ModelIndex> EventHandle_ModelIndex;
typedef MyGUI::delegates::MultiDelegate<> EventHandle_Void;
2013-05-11 18:38:27 +02:00
/// Fired when an item was clicked
EventHandle_ModelIndex eventItemClicked;
/// Fired when the background was clicked (useful for drag and drop)
EventHandle_Void eventBackgroundClicked;
void update();
void resetScrollBars();
2013-05-11 18:38:27 +02:00
private:
void initialiseOverride() override;
2013-05-11 18:38:27 +02:00
void layoutWidgets();
void setSize(const MyGUI::IntSize& _value) override;
void setCoord(const MyGUI::IntCoord& _value) override;
2013-05-11 18:38:27 +02:00
void onSelectedItem(MyGUI::Widget* sender);
void onSelectedBackground(MyGUI::Widget* sender);
void onMouseWheelMoved(MyGUI::Widget* _sender, int _rel);
2013-05-11 18:38:27 +02:00
2022-08-31 19:03:45 +02:00
std::unique_ptr<ItemModel> mModel;
2013-05-11 18:38:27 +02:00
MyGUI::ScrollView* mScrollView;
};
}
#endif