20 #ifndef PAWS_SKETCH_WINDOW_HEADER 21 #define PAWS_SKETCH_WINDOW_HEADER 28 #define SKETCHBEZIER_SEGMENTS 20 38 float *precomputedBezierWeights;
44 inline float Get(
int segmentIndex,
int controlpointNum)
52 inline float Get(
int offset)
55 return precomputedBezierWeights[offset];
69 const char *GetStr() {
return str; }
70 virtual void SetStr(
const char *s) { str=s; }
71 SketchObject() { x=0; y=0; selected=
false; color=-1; colorSet=
false; }
72 virtual ~SketchObject() {};
75 virtual void WriteXml(csString& xml) = 0;
76 virtual void Draw()=0;
77 virtual bool IsHit(
int mouseX,
int mouseY)=0;
78 virtual void Select(
bool _selected) { selected=_selected; colorSet=
false; frame=0; }
80 virtual void UpdatePosition(
int _x,
int _y) { x = _x; y = _y; }
81 virtual void SetColor(
int _color) { color = _color; colorSet=
true; }
83 struct SketchIcon :
public SketchObject
85 csRef<iPawsImage> iconImage;
86 SketchIcon() : SketchObject() {}
88 virtual ~SketchIcon() {};
91 virtual void WriteXml(csString& xml);
93 virtual bool IsHit(
int mouseX,
int mouseY);
94 virtual void SetStr(
const char *s);
96 virtual void UpdatePosition(
int _x,
int _y);
98 struct SketchText :
public SketchObject
110 virtual ~SketchText() {};
112 virtual void WriteXml(csString& xml);
114 virtual bool IsHit(
int mouseX,
int mouseY);
116 virtual void UpdatePosition(
int _x,
int _y);
118 struct SketchLine :
public SketchObject
121 int offsetX, offsetY;
132 virtual ~SketchLine() {};
134 virtual void WriteXml(csString& xml);
136 virtual bool IsHit(
int mouseX,
int mouseY);
138 virtual void UpdatePosition(
int _x,
int _y);
140 struct SketchBezier :
public SketchObject
158 SketchBezier(
int x,
int y,
int x1,
int y1,
int x2,
int y2,
int x3,
int y3,
pawsSketchWindow *_parent)
163 p0p1.parent = _parent;
169 p0p3.parent = _parent;
175 p3p2.parent = _parent;
182 virtual ~SketchBezier() {};
184 virtual void WriteXml(csString& xml);
186 virtual bool IsHit(
int mouseX,
int mouseY);
188 virtual void UpdatePosition(
int _x,
int _y);
224 bool ParseSketch(
const char *xml,
bool checklimits =
false);
269 virtual bool OnMouseDown(
int button,
int modifiers,
int x,
int y );
270 virtual bool OnMouseUp(
int button,
int modifiers,
int x,
int y );
271 virtual bool OnKeyDown( utf32_char keyCode, utf32_char key,
int modifiers );
void HandleMessage(MsgEntry *message)
pawsWidget * RightArrowTool
void MoveObject(int dx, int dy)
A specific MathEnvironment to be used in a MathScript.
csRef< iPawsImage > blackBox
pawsWidget * LeftArrowTool
csString filenameSafe(const csString &original)
The structure of 1 queue entry (pointer to a message)
void DrawBlackBox(int x, int y)
void OnColorEntered(const char *name, int param, int color)
inherited from iOnColorEnteredAction
void NextPrevIcon(int delta)
bool ParseLimits(const char *xmlstr)
void OnStringEntered(const char *name, int param, const char *value)
inherited from iOnStringEnteredAction
virtual void Hide()
Makes widget invisible and removes focus if widget has current focus.
BezierWeights bezierWeights
virtual bool GetFocusOverridesControls() const
Test if the widget should intercept all key presses.
virtual bool OnMouseDown(int button, int modifiers, int x, int y)
Manage mouse down event to test for and apply window changes.
double CalcFunction(MathEnvironment *env, const char *functionName, const double *params)
inherited from iScriptableVar from pawsWidget
csRef< iPawsImage > sketchBgImage
Background image.
csPDelArray< SketchObject > objlist
virtual ~pawsSketchWindow()
bool PostSetup()
This is called after the widget and all of it's children have been created.
#define SKETCHBEZIER_SEGMENTS
void DrawColorWidgetText(const char *text, int x, int y, int color)
This interface defines the callback used by pawsStringPromptWindow to notify another window of a supp...
virtual bool OnMouseUp(int button, int modifiers, int x, int y)
Manage mouse up event.
virtual void Draw()
Draws the widget and all of it's children.
CREATE_PAWS_FACTORY(pawsSketchWindow)
virtual bool OnKeyDown(utf32_char keyCode, utf32_char key, int modifiers)
Process keydown messages.
bool ParseSketch(const char *xml, bool checklimits=false)
A window that shows a map or picture.