76 lines
1.6 KiB
C++
76 lines
1.6 KiB
C++
#ifndef _COMMON_RUBBERCONTROL_HPP_
|
|
#define _COMMON_RUBBERCONTROL_HPP_
|
|
#ifndef _COMMON_WINDOWS_HPP_
|
|
#include <common/windows.hpp>
|
|
#endif
|
|
|
|
class GUIWindow;
|
|
|
|
class RubberControl
|
|
{
|
|
public:
|
|
RubberControl(void);
|
|
RubberControl(const RubberControl &someRubberControl);
|
|
virtual ~RubberControl();
|
|
RubberControl &operator=(const RubberControl &someRubberControl);
|
|
void initControl(GUIWindow &parentWindow);
|
|
void moveControl(GUIWindow &parentWindow,int width,int height);
|
|
void alignControl(GUIWindow &parentWindow);
|
|
protected:
|
|
virtual GUIWindow &controlWindow(void)=0;
|
|
private:
|
|
enum{Left,Top,Right,Bottom};
|
|
enum{VectorPoints=4};
|
|
void calcRatios(GUIWindow &parentWindow);
|
|
void zeroInit(void);
|
|
|
|
float mRatios[VectorPoints];
|
|
int mControlID;
|
|
};
|
|
|
|
inline
|
|
RubberControl::RubberControl(void)
|
|
{
|
|
zeroInit();
|
|
}
|
|
|
|
inline
|
|
RubberControl::RubberControl(const RubberControl &someRubberControl)
|
|
{
|
|
*this=someRubberControl;
|
|
}
|
|
|
|
inline
|
|
RubberControl &RubberControl::operator=(const RubberControl &someRubberControl)
|
|
{
|
|
mRatios[Left]=someRubberControl.mRatios[Left];
|
|
mRatios[Top]=someRubberControl.mRatios[Top];
|
|
mRatios[Right]=someRubberControl.mRatios[Right];
|
|
mRatios[Bottom]=someRubberControl.mRatios[Bottom];
|
|
mControlID=someRubberControl.mControlID;
|
|
return *this;
|
|
}
|
|
|
|
inline
|
|
void RubberControl::initControl(GUIWindow &parentWindow)
|
|
{
|
|
calcRatios(parentWindow);
|
|
}
|
|
|
|
inline
|
|
void RubberControl::alignControl(GUIWindow &parentWindow)
|
|
{
|
|
calcRatios(parentWindow);
|
|
}
|
|
|
|
inline
|
|
void RubberControl::zeroInit(void)
|
|
{
|
|
mRatios[Left]=0.00;
|
|
mRatios[Top]=0.00;
|
|
mRatios[Right]=0.00;
|
|
mRatios[Bottom]=0.00;
|
|
mControlID=-1;
|
|
}
|
|
#endif
|