Class ImagePanel

Inheritance Relationships

Base Type

Class Documentation

class ImagePanel : public nanogui::Widget

Image panel widget which shows a number of square-shaped icons.

Public Types

typedef std::vector<std::pair<int, std::string>> Images

Public Functions

ImagePanel(Widget *parent)
void setImages(const Images &data)
const Images &images() const
std::function<void(int)> callback() const
void setCallback(const std::function<void(int)> &callback)
virtual bool mouseMotionEvent(const Vector2i &p, const Vector2i &rel, int button, int modifiers)

Handle a mouse motion event (default implementation: propagate to children)

virtual bool mouseButtonEvent(const Vector2i &p, int button, bool down, int modifiers)

Handle a mouse button event (default implementation: propagate to children)

virtual Vector2i preferredSize(NVGcontext *ctx) const

Compute the preferred size of the widget.

virtual void draw(NVGcontext *ctx)

Draw the widget (and all child widgets)

Protected Functions

Vector2i gridSize() const
int indexForPosition(const Vector2i &p) const

Protected Attributes

Images mImages
std::function<void(int)> mCallback
int mThumbSize
int mSpacing
int mMargin
int mMouseIndex