tahoma2d/toonz/sources/include/ext/Selector.h

81 lines
1.5 KiB
C
Raw Normal View History

2016-05-17 03:04:11 +12:00
#pragma once
2016-03-19 06:57:51 +13:00
#ifndef SELECTOR_H
#define SELECTOR_H
/**
* @author Fabrizio Morciano <fabrizio.morciano@gmail.com>
*/
#include "tgeometry.h"
#include "tstroke.h"
#undef DVAPI
#undef DVVAR
#ifdef TNZEXT_EXPORTS
#define DVAPI DV_EXPORT_API
#define DVVAR DV_EXPORT_VAR
#else
#define DVAPI DV_IMPORT_API
#define DVVAR DV_IMPORT_VAR
#endif
#include "ext/Types.h"
#include "ext/Designer.h"
2016-06-15 18:43:10 +12:00
namespace ToonzExt {
class DVAPI Selector {
enum Selection { NONE = 0, POSITION = 1, LENGTH = 2 };
Selection isSelected_;
const TStroke *strokeRef_;
double w_, height_, stroke_length_, original_stroke_length_, signum_,
pixel_size_;
Selection getSelection(const TPointD &pos);
TPointD click_, curr_, prev_;
TPointD range_;
bool isVisible_;
void init();
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
Selector(double stroke_length, double min_val, double max_val);
virtual ~Selector();
virtual void draw(Designer *designer);
virtual void mouseDown(const TPointD &pos);
virtual void mouseUp(const TPointD &pos);
virtual void mouseMove(const TPointD &pos);
virtual void mouseDrag(const TPointD &pos);
void setStroke(const TStroke *ref);
const TStroke *getStroke() const { return strokeRef_; }
double getW() const { return w_; }
double getLength() const;
void setLength(double);
bool isSelected() const { return (isVisible_ && (isSelected_ != NONE)); }
void setVisibility(bool val) { isVisible_ = val; }
bool isVisible() const { return isVisible_; }
TPointD getUp() const;
2016-03-19 06:57:51 +13:00
};
}
#endif /* SELECTOR_H */