Overlay Input Element


// Overlay input element that provides text input capability.
class RVAPI InputElem
{
public:
    // Character validation callback. Return true to allow character.
    typedef bool (*FValidate)(wchar ch);

    // Get key from last update if any.
    Key GetKey() const;

    // Get meta position.
    const MetaPos &GetMetaPos() const;

    // Get resolution independent element rectangle using parent rectangle [pRect].
    B2i GetRect(const B2i &pRect) const;

    // Draw input element.
    void Draw(const B2i &pRect) const;

    // Show input element.
    void Show(bool show = true);

    // Update input element.
    void Update(const B2i &pRect);

    // Set meta position.
    void SetMetaPos(const MetaPos &metaPos);

    // Internal.
    void *operator () () const { return (void *)wobj; }

    // Construct input element. 
    InputElem(wcstr fontID, const Color &bColor, const Color &fColor,
        uint len, uint z, uint incr = 128, FValidate Validate = 0);

    // Destructor.
    ~InputElem();

private:
    byte wobj[384];
};