From ede860e91c2a0021266907885ea2c9b4be09e121 Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Wed, 22 Nov 2017 16:36:07 -0500 Subject: Delete even more unused views code Bug: skia: Change-Id: I41480aa89dfcd8cb7e016e477cbabe354f35ce8a Reviewed-on: https://skia-review.googlesource.com/75480 Reviewed-by: Mike Reed Commit-Queue: Brian Osman --- include/views/SkEvent.h | 14 --- include/views/SkKey.h | 40 -------- include/views/SkSystemEventTypes.h | 25 ----- include/views/SkView.h | 205 ------------------------------------- 4 files changed, 284 deletions(-) delete mode 100644 include/views/SkSystemEventTypes.h (limited to 'include/views') diff --git a/include/views/SkEvent.h b/include/views/SkEvent.h index 0efc19a6ea..aad3f58f3a 100644 --- a/include/views/SkEvent.h +++ b/include/views/SkEvent.h @@ -11,11 +11,6 @@ #include "SkMetaData.h" #include "SkString.h" -class SkDOM; -struct SkDOMNode; - -#include "../private/SkLeanWindows.h" - /** Unique 32bit id used to identify an instance of SkEventSink. When events are posted, they are posted to a specific sinkID. When it is time to dispatch the event, the sinkID is used to find the specific SkEventSink object. If it is found, @@ -143,11 +138,6 @@ public: /** Return the underlying metadata object */ const SkMetaData& getMetaData() const { return fMeta; } - /** Call this to initialize the event from the specified XML node */ - void inflate(const SkDOM&, const SkDOMNode*); - - SkDEBUGCODE(void dump(const char title[] = nullptr);) - /////////////////////////////////////////////////////////////////////////// private: @@ -155,10 +145,6 @@ private: mutable char* fType; // may be characters with low bit set to know that it is not a pointer uint32_t f32; - // these are for our implementation of the event queue - SkMSec fTime; - SkEvent* fNextEvent; // either in the delay or normal event queue - void initialize(const char* type, size_t typeLen); }; diff --git a/include/views/SkKey.h b/include/views/SkKey.h index 036e2c3176..d4575a56ca 100644 --- a/include/views/SkKey.h +++ b/include/views/SkKey.h @@ -12,46 +12,6 @@ #include "SkTypes.h" -enum SkKey { - //reordering these to match android.app.KeyEvent - kNONE_SkKey, //corresponds to android's UNKNOWN - - kLeftSoftKey_SkKey, - kRightSoftKey_SkKey, - - kHome_SkKey, //!< the home key - added to match android - kBack_SkKey, //!< (CLR) - kSend_SkKey, //!< the green (talk) key - kEnd_SkKey, //!< the red key - - k0_SkKey, - k1_SkKey, - k2_SkKey, - k3_SkKey, - k4_SkKey, - k5_SkKey, - k6_SkKey, - k7_SkKey, - k8_SkKey, - k9_SkKey, - kStar_SkKey, //!< the * key - kHash_SkKey, //!< the # key - - kUp_SkKey, - kDown_SkKey, - kLeft_SkKey, - kRight_SkKey, - - kOK_SkKey, //!< the center key - - kVolUp_SkKey, //!< volume up - match android - kVolDown_SkKey, //!< volume down - same - kPower_SkKey, //!< power button - same - kCamera_SkKey, //!< camera - same - - kSkKeyCount -}; - enum SkModifierKeys { kShift_SkModifierKey = 1 << 0, kControl_SkModifierKey = 1 << 1, diff --git a/include/views/SkSystemEventTypes.h b/include/views/SkSystemEventTypes.h deleted file mode 100644 index bb2b5d5279..0000000000 --- a/include/views/SkSystemEventTypes.h +++ /dev/null @@ -1,25 +0,0 @@ - -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - -#ifndef SkSystemEventTypes_DEFINED -#define SkSystemEventTypes_DEFINED - -/* - The goal of these strings is two-fold: - 1) make funny strings (containing at least one char < 32) to avoid colliding with "user" strings - 2) keep them <= 4 bytes, so we can avoid an allocation in SkEvent::setType() -*/ -#define SK_EventType_Delay "\xd" "lay" -#define SK_EventType_Inval "nv" "\xa" "l" -#define SK_EventType_Key "key" "\x1" -#define SK_EventType_OnEnd "on" "\xe" "n" -#define SK_EventType_Unichar "\xc" "har" -#define SK_EventType_KeyUp "key" "\xf" - -#endif diff --git a/include/views/SkView.h b/include/views/SkView.h index 5a61d9e521..9a84af832d 100644 --- a/include/views/SkView.h +++ b/include/views/SkView.h @@ -16,9 +16,6 @@ #include "SkMetaData.h" class SkCanvas; -class SkLayerView; -class SkDOM; -struct SkDOMNode; /** \class SkView @@ -79,62 +76,10 @@ public: void setSize(const SkPoint& size) { this->setSize(size.fX, size.fY); } void setWidth(SkScalar width) { this->setSize(width, fHeight); } void setHeight(SkScalar height) { this->setSize(fWidth, height); } - /** Return a rectangle set to [0, 0, width, height] */ - void getLocalBounds(SkRect* bounds) const; - - /** Loc - the view's offset with respect to its parent in its view hiearchy. - NOTE: For more complex transforms, use Local Matrix. The tranformations - are applied in the following order: - canvas->translate(fLoc.fX, fLoc.fY); - canvas->concat(fMatrix); - */ - /** Return the view's left edge */ - SkScalar locX() const { return fLoc.fX; } - /** Return the view's top edge */ - SkScalar locY() const { return fLoc.fY; } - /** Set the view's left and top edge. This does not affect the view's size */ - void setLoc(SkScalar x, SkScalar y); - void setLoc(const SkPoint& loc) { this->setLoc(loc.fX, loc.fY); } - void setLocX(SkScalar x) { this->setLoc(x, fLoc.fY); } - void setLocY(SkScalar y) { this->setLoc(fLoc.fX, y); } - - /** Local Matrix - matrix used to tranform the view with respect to its - parent in its view hiearchy. Use setLocalMatrix to apply matrix - transformations to the current view and in turn affect its children. - NOTE: For simple offsets, use Loc. The transformations are applied in - the following order: - canvas->translate(fLoc.fX, fLoc.fY); - canvas->concat(fMatrix); - */ - const SkMatrix& getLocalMatrix() const { return fMatrix; } - void setLocalMatrix(const SkMatrix& matrix); - - /** Offset (move) the view by the specified dx and dy. This does not affect the view's size */ - void offset(SkScalar dx, SkScalar dy); /** Call this to have the view draw into the specified canvas. */ virtual void draw(SkCanvas* canvas); - /** Call this to invalidate part of all of a view, requesting that the view's - draw method be called. The rectangle parameter specifies the part of the view - that should be redrawn. If it is null, it specifies the entire view bounds. - */ - void inval(SkRect* rectOrNull); - - // Focus management - - SkView* getFocusView() const; - bool hasFocus() const; - - enum FocusDirection { - kNext_FocusDirection, - kPrev_FocusDirection, - - kFocusDirectionCount - }; - bool acceptFocus(); - SkView* moveFocus(FocusDirection); - // Click handling class Click { @@ -142,11 +87,6 @@ public: Click(SkView* target); virtual ~Click(); - const char* getType() const { return fType; } - bool isType(const char type[]) const; - void setType(const char type[]); // does NOT make a copy of the string - void copyType(const char type[]); // makes a copy of the string - enum State { kDown_State, kMoved_State, @@ -155,16 +95,11 @@ public: SkPoint fOrig, fPrev, fCurr; SkIPoint fIOrig, fIPrev, fICurr; State fState; - void* fOwner; unsigned fModifierKeys; SkMetaData fMeta; private: SkEventSinkID fTargetID; - char* fType; - bool fWeOwnTheType; - - void resetType(); friend class SkView; }; @@ -174,163 +109,23 @@ public: static void DoClickMoved(Click*, int x, int y, unsigned modi); static void DoClickUp(Click*, int x, int y, unsigned modi); - /** Send the event to the view's parent, and its parent etc. until one of them - returns true from its onEvent call. This view is returned. If no parent handles - the event, null is returned. - */ - SkView* sendEventToParents(const SkEvent&); - /** Send the query to the view's parent, and its parent etc. until one of them - returns true from its onQuery call. This view is returned. If no parent handles - the query, null is returned. - */ - SkView* sendQueryToParents(SkEvent*); - - // View hierarchy management - - /** Return the view's parent, or null if it has none. This does not affect the parent's reference count. */ - SkView* getParent() const { return fParent; } - SkView* attachChildToFront(SkView* child); - /** Attach the child view to this view, and increment the child's reference count. The child view is added - such that it will be drawn before all other child views. - The child view parameter is returned. - */ - SkView* attachChildToBack(SkView* child); - /** If the view has a parent, detach the view from its parent and decrement the view's reference count. - If the parent was the only owner of the view, this will cause the view to be deleted. - */ - void detachFromParent(); - /** Attach the child view to this view, and increment the child's reference count. The child view is added - such that it will be drawn after all other child views. - The child view parameter is returned. - */ - /** Detach all child views from this view. */ - void detachAllChildren(); - - /** Convert the specified point from global coordinates into view-local coordinates - * Return true on success; false on failure - */ - bool globalToLocal(SkPoint* pt) const { - if (pt) { - return this->globalToLocal(pt->fX, pt->fY, pt); - } - return true; // nothing to do so return true - } - /** Convert the specified x,y from global coordinates into view-local coordinates, returning - the answer in the local parameter. - */ - bool globalToLocal(SkScalar globalX, SkScalar globalY, SkPoint* local) const; - - /** \class F2BIter - - Iterator that will return each of this view's children, in - front-to-back order (the order used for clicking). The first - call to next() returns the front-most child view. When - next() returns null, there are no more child views. - */ - class F2BIter { - public: - F2BIter(const SkView* parent); - SkView* next(); - private: - SkView* fFirstChild, *fChild; - }; - - /** \class B2FIter - - Iterator that will return each of this view's children, in - back-to-front order (the order they are drawn). The first - call to next() returns the back-most child view. When - next() returns null, there are no more child views. - */ - class B2FIter { - public: - B2FIter(const SkView* parent); - SkView* next(); - private: - SkView* fFirstChild, *fChild; - }; - - /** Call this to initialize this view based on the specified XML node - */ - void inflate(const SkDOM& dom, const SkDOMNode* node); - - SkDEBUGCODE(void dump(bool recurse) const;) - protected: /** Override this to draw inside the view. Be sure to call the inherited version too */ virtual void onDraw(SkCanvas*); /** Override this to be notified when the view's size changes. Be sure to call the inherited version too */ virtual void onSizeChange(); - /** Override this if you want to handle an inval request from this view or one of its children. - Tyically this is only overridden by the by the "window". If your subclass does handle the - request, return true so the request will not continue to propogate to the parent. - */ - virtual bool handleInval(const SkRect*); - //! called once before all of the children are drawn (or clipped/translated) - virtual SkCanvas* beforeChildren(SkCanvas* c) { return c; } - //! called once after all of the children are drawn (or clipped/translated) - virtual void afterChildren(SkCanvas*) {} - - //! called right before this child's onDraw is called - virtual void beforeChild(SkView* /*child*/, SkCanvas*) {} - //! called right after this child's onDraw is called - virtual void afterChild(SkView* /*child*/, SkCanvas*) {} /** Override this if you might handle the click */ virtual Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi); - /** Override this to decide if your children are targets for a click. - The default returns true, in which case your children views will be - candidates for onFindClickHandler. Returning false wil skip the children - and just call your onFindClickHandler. - */ - virtual bool onSendClickToChildren(SkScalar x, SkScalar y, unsigned modi); /** Override this to track clicks, returning true as long as you want to track the pen/mouse. */ virtual bool onClick(Click*); - /** Override this to initialize your subclass from the XML node. Be sure to call the inherited version too */ - virtual void onInflate(const SkDOM& dom, const SkDOMNode* node); - /** Override this if you want to perform post initialization work based on the ID dictionary built - during XML parsing. Be sure to call the inherited version too. - */ - -public: -#ifdef SK_DEBUG - void validate() const; -#else - void validate() const {} -#endif - // default action is to inval the view - virtual void onFocusChange(bool gainFocusP); - -protected: - - // override these if you're acting as a layer/host - virtual bool onGetFocusView(SkView**) const { return false; } - virtual bool onSetFocusView(SkView*) { return false; } private: SkScalar fWidth, fHeight; - SkMatrix fMatrix; - SkPoint fLoc; - SkView* fParent; - SkView* fFirstChild; - SkView* fNextSibling; - SkView* fPrevSibling; uint8_t fFlags; - uint8_t fContainsFocus; - - friend class B2FIter; - friend class F2BIter; - - friend class SkLayerView; - - bool setFocusView(SkView* fvOrNull); - SkView* acceptFocus(FocusDirection); - void detachFromParent_NoLayout(); - /** Compute the matrix to transform view-local coordinates into global ones */ - void localToGlobal(SkMatrix* matrix) const; }; #endif -- cgit v1.2.3