Blame toonz/sources/include/tw/expressionfield.h
|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef TNZ_EXPRESSIONFIELD_INCLUDED
|
|
Toshihiro Shimizu |
890ddd |
#define TNZ_EXPRESSIONFIELD_INCLUDED
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tw/textfield.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#undef DVAPI
|
|
Toshihiro Shimizu |
890ddd |
#undef DVVAR
|
|
Toshihiro Shimizu |
890ddd |
#ifdef TWIN_EXPORTS
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_EXPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_EXPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_IMPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_IMPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifdef WIN32
|
|
Toshihiro Shimizu |
890ddd |
#pragma warning(push)
|
|
Toshihiro Shimizu |
890ddd |
#pragma warning(disable : 4251)
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// forward declaration
|
|
Shinya Kitaoka |
120a6e |
namespace TSyntax {
|
|
Toshihiro Shimizu |
890ddd |
class Parser;
|
|
Toshihiro Shimizu |
890ddd |
class Grammar;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
class DVAPI TExpressionField : public TTextField {
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
class Listener {
|
|
Shinya Kitaoka |
120a6e |
public:
|
|
Shinya Kitaoka |
120a6e |
virtual void onExpressionChange(string s, bool isValid) = 0;
|
|
Shinya Kitaoka |
120a6e |
virtual ~Listener() {}
|
|
Shinya Kitaoka |
120a6e |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TSyntax::Parser *m_parser;
|
|
Shinya Kitaoka |
120a6e |
Listener *m_listener;
|
|
Shinya Kitaoka |
120a6e |
void apply();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
TExpressionField(TWidget *parent, string name = "expressionField");
|
|
Shinya Kitaoka |
120a6e |
~TExpressionField();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setGrammar(TSyntax::Grammar *grammar);
|
|
Shinya Kitaoka |
120a6e |
TSyntax::Grammar *getGrammar() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setListener(Listener *listener) { m_listener = listener; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void keyDown(int key, TUINT32 status, const TPoint &p);
|
|
Shinya Kitaoka |
120a6e |
void drawFieldText(const TPoint &origin, wstring text);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
string getError() const;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifdef WIN32
|
|
Toshihiro Shimizu |
890ddd |
#pragma warning(pop)
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|