From 7e11ac5d3c345f0f1227a070a1c10eee885bcfce Mon Sep 17 00:00:00 2001 From: Vojtech Bocek Date: Thu, 5 Mar 2015 23:21:49 +0100 Subject: Add UI for entering pattern for device decryption Change-Id: Ia2d3268a96423e9ca3846500c57e674c4f8fa60b Signed-off-by: Vojtech Bocek --- gui/objects.hpp | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'gui/objects.hpp') diff --git a/gui/objects.hpp b/gui/objects.hpp index 261141134..d26b0c2ed 100644 --- a/gui/objects.hpp +++ b/gui/objects.hpp @@ -1058,6 +1058,58 @@ private: bool m_present; }; +class GUIPatternPassword : public GUIObject, public RenderObject, public ActionObject +{ +public: + GUIPatternPassword(xml_node<>* node); + virtual ~GUIPatternPassword(); + +public: + virtual int Render(void); + virtual int Update(void); + virtual int NotifyTouch(TOUCH_STATE state, int x, int y); + virtual int SetRenderPos(int x, int y, int w = 0, int h = 0); + +protected: + void CalculateDotPositions(); + void ResetActiveDots(); + void ConnectDot(int dot_idx); + void ConnectIntermediateDots(int dot_idx); + int InDot(int x, int y); + bool DotUsed(int dot_idx); + static bool IsInRect(int x, int y, int rx, int ry, int rw, int rh); + void PatternDrawn(); + + struct Dot { + int x; + int y; + bool active; + }; + + Dot mDots[9]; + int mConnectedDots[9]; + size_t mConnectedDotsLen; + int mCurLineX; + int mCurLineY; + bool mTrackingTouch; + bool mNeedRender; + + COLOR mDotColor; + COLOR mActiveDotColor; + COLOR mLineColor; + ImageResource *mDotImage; + ImageResource *mActiveDotImage; + gr_surface mDotCircle; + gr_surface mActiveDotCircle; + int mDotRadius; + int mLineWidth; + + std::string mPassVar; + GUIAction *mAction; + int mUpdate; +}; + + // Helper APIs xml_node<>* FindNode(xml_node<>* parent, const char* nodename, int depth = 0); std::string LoadAttrString(xml_node<>* element, const char* attrname, const char* defaultvalue = ""); -- cgit v1.2.3