mirror of
https://github.com/tribes2/engine.git
synced 2026-01-20 03:34:48 +00:00
78 lines
1.6 KiB
C++
78 lines
1.6 KiB
C++
//-----------------------------------------------------------------------------
|
|
// V12 Engine
|
|
//
|
|
// Copyright (c) 2001 GarageGames.Com
|
|
// Portions Copyright (c) 2001 by Sierra Online, Inc.
|
|
//-----------------------------------------------------------------------------
|
|
|
|
#ifndef _GUIFILTERCTRL_H_
|
|
#define _GUIFILTERCTRL_H_
|
|
|
|
#ifndef _GUICONTROL_H_
|
|
#include "GUI/guiControl.h"
|
|
#endif
|
|
|
|
|
|
|
|
//--------------------------------------
|
|
// helper class
|
|
class Filter: public Vector<F32>
|
|
{
|
|
public:
|
|
Filter() : Vector<F32>(__FILE__, __LINE__) { }
|
|
|
|
void set(S32 argc, const char *argv[]);
|
|
F32 getValue(F32 t) const;
|
|
};
|
|
|
|
|
|
//--------------------------------------
|
|
class GuiFilterCtrl : public GuiControl
|
|
{
|
|
private:
|
|
typedef GuiControl Parent;
|
|
|
|
S32 mControlPointRequest;
|
|
S32 mCurKnot;
|
|
Filter mFilter;
|
|
|
|
public:
|
|
//creation methods
|
|
DECLARE_CONOBJECT(GuiFilterCtrl);
|
|
GuiFilterCtrl();
|
|
static void initPersistFields();
|
|
static void consoleInit();
|
|
|
|
//Parental methods
|
|
bool onWake();
|
|
|
|
void onMouseDown(const GuiEvent &event);
|
|
void onMouseDragged(const GuiEvent &event);
|
|
void onMouseUp(const GuiEvent &);
|
|
|
|
F32 getValue(S32 n);
|
|
const Filter* get() { return &mFilter; }
|
|
void set(const Filter &f);
|
|
S32 getNumControlPoints() {return mFilter.size(); }
|
|
void identity();
|
|
|
|
void onPreRender();
|
|
void onRender(Point2I offset, const RectI &updateRect, GuiControl *firstResponder);
|
|
};
|
|
|
|
|
|
inline F32 GuiFilterCtrl::getValue(S32 n)
|
|
{
|
|
S32 index = getMin(getMax(n,0), (S32)mFilter.size()-1);
|
|
return mFilter[n];
|
|
}
|
|
|
|
|
|
inline void GuiFilterCtrl::set(const Filter &f)
|
|
{
|
|
mControlPointRequest = f.size();
|
|
mFilter = f;
|
|
}
|
|
|
|
#endif
|