ofxOui - UI Components for OpenFrameworks

Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
ofxOui::ShapeEditor Class Reference

Shape editor. More...

#include <ofxOuiShapeEditor.hpp>

Classes

class  EditEvent
 Event arguments for shape editing events. More...
 

Public Types

enum  Selector {
  Selector::None, Selector::Shape, Selector::TopLeft, Selector::TopCenter,
  Selector::TopRight, Selector::MiddleLeft, Selector::MiddleCenter, Selector::MiddleRight,
  Selector::BottomLeft, Selector::BottomCenter, Selector::BottomRight
}
 Index of the selector of the shape. More...
 
enum  MouseDraggingMode { MouseDraggingMode::Normal, MouseDraggingMode::Symmetric, MouseDraggingMode::Rotation }
 Type of mouse interaction mode. More...
 

Public Member Functions

template<typename T , typename args , class ListenerClass >
void onEditShape (T *owner, void(ListenerClass::*listenerMethod)(args))
 Set callback function for shape editing events. More...
 
 ShapeEditor (float x_=0, float y_=0, float width_=0, float height_=0, float angle_=0)
 Constructor. More...
 
virtual ~ShapeEditor ()
 Destructor. More...
 
virtual void draw ()
 OF-like draw function. More...
 
virtual bool inside (float x_, float y_)
 checks if a point is inside the shape editor More...
 
virtual ShapeEditor::Selector insideSelector (float x_, float y_)
 checks if a point is inside a selector of the shape editor (corner or mid-edge) More...
 

Public Attributes

float x
 x position (left) More...
 
float y
 y position(top) More...
 
float width
 editor width More...
 
float height
 editor height More...
 
float angle
 editor angle More...
 
float frame_width
 width of the editor frame More...
 
ofColor color
 color of the editor frame More...
 
float selector_size
 size of the corner and edge selectors More...
 

Protected Member Functions

virtual void mouseDragged (ofMouseEventArgs &e)
 
virtual void mousePressed (ofMouseEventArgs &e)
 
virtual void mouseReleased (ofMouseEventArgs &e)
 
virtual void keyPressed (ofKeyEventArgs &e)
 
virtual void keyReleased (ofKeyEventArgs &e)
 
virtual void mouseDraggedNormal (ofMouseEventArgs &e)
 
virtual void mouseDraggedSymmetric (ofMouseEventArgs &e)
 
virtual void mouseDraggedRotation (ofMouseEventArgs &e)
 

Protected Attributes

Selector dragging_
 
MouseDraggingMode dragging_mode_
 
ofPoint mouse_offset_
 
float reference_angle_
 
std::function< void(ofxOui::ShapeEditor::EditEvent &)> shape_editor_event_callback_
 

Detailed Description

Shape editor.

Member Enumeration Documentation

§ MouseDraggingMode

Type of mouse interaction mode.

Enumerator
Normal 
Symmetric 
Rotation 

§ Selector

Index of the selector of the shape.

Enumerator
None 
Shape 
TopLeft 
TopCenter 
TopRight 
MiddleLeft 
MiddleCenter 
MiddleRight 
BottomLeft 
BottomCenter 
BottomRight 

Constructor & Destructor Documentation

§ ShapeEditor()

ofxOui::ShapeEditor::ShapeEditor ( float  x_ = 0,
float  y_ = 0,
float  width_ = 0,
float  height_ = 0,
float  angle_ = 0 
)

Constructor.

Parameters
x_x position (left)
y_y position (top)
width_component width
height_component height
angle_component angle

§ ~ShapeEditor()

ofxOui::ShapeEditor::~ShapeEditor ( )
virtual

Destructor.

Member Function Documentation

§ draw()

void ofxOui::ShapeEditor::draw ( )
virtual

OF-like draw function.

§ inside()

bool ofxOui::ShapeEditor::inside ( float  x_,
float  y_ 
)
virtual

checks if a point is inside the shape editor

Parameters
x_x position (in pixels)
y_y position (in pixels)
Returns
true if a point is inside the shape editor

§ insideSelector()

ofxOui::ShapeEditor::Selector ofxOui::ShapeEditor::insideSelector ( float  x_,
float  y_ 
)
virtual

checks if a point is inside a selector of the shape editor (corner or mid-edge)

Parameters
x_x position (in pixels)
y_y position (in pixels)
Returns
true if a point is inside a selector the shape editor

§ keyPressed()

void ofxOui::ShapeEditor::keyPressed ( ofKeyEventArgs &  e)
protectedvirtual

§ keyReleased()

void ofxOui::ShapeEditor::keyReleased ( ofKeyEventArgs &  e)
protectedvirtual

§ mouseDragged()

void ofxOui::ShapeEditor::mouseDragged ( ofMouseEventArgs &  e)
protectedvirtual

§ mouseDraggedNormal()

void ofxOui::ShapeEditor::mouseDraggedNormal ( ofMouseEventArgs &  e)
protectedvirtual

§ mouseDraggedRotation()

void ofxOui::ShapeEditor::mouseDraggedRotation ( ofMouseEventArgs &  e)
protectedvirtual

§ mouseDraggedSymmetric()

void ofxOui::ShapeEditor::mouseDraggedSymmetric ( ofMouseEventArgs &  e)
protectedvirtual

§ mousePressed()

void ofxOui::ShapeEditor::mousePressed ( ofMouseEventArgs &  e)
protectedvirtual

§ mouseReleased()

void ofxOui::ShapeEditor::mouseReleased ( ofMouseEventArgs &  e)
protectedvirtual

§ onEditShape()

template<typename T , typename args , class ListenerClass >
void ofxOui::ShapeEditor::onEditShape ( T *  owner,
void(ListenerClass::*)(args)  listenerMethod 
)
inline

Set callback function for shape editing events.

Parameters
ownerpointer to the owner object
listenerMethodmethod to be called on eaech event
Template Parameters
Ttype of the owner object
argsarguments of the callback function
ListenerClassclass to which the listener method belongs

Member Data Documentation

§ angle

float ofxOui::ShapeEditor::angle

editor angle

§ color

ofColor ofxOui::ShapeEditor::color

color of the editor frame

§ dragging_

Selector ofxOui::ShapeEditor::dragging_
protected

§ dragging_mode_

MouseDraggingMode ofxOui::ShapeEditor::dragging_mode_
protected

§ frame_width

float ofxOui::ShapeEditor::frame_width

width of the editor frame

§ height

float ofxOui::ShapeEditor::height

editor height

§ mouse_offset_

ofPoint ofxOui::ShapeEditor::mouse_offset_
protected

§ reference_angle_

float ofxOui::ShapeEditor::reference_angle_
protected

§ selector_size

float ofxOui::ShapeEditor::selector_size

size of the corner and edge selectors

§ shape_editor_event_callback_

std::function<void(ofxOui::ShapeEditor::EditEvent &)> ofxOui::ShapeEditor::shape_editor_event_callback_
protected

§ width

float ofxOui::ShapeEditor::width

editor width

§ x

float ofxOui::ShapeEditor::x

x position (left)

§ y

float ofxOui::ShapeEditor::y

y position(top)


The documentation for this class was generated from the following files: