aboutsummaryrefslogtreecommitdiffstats
path: root/include/views
diff options
context:
space:
mode:
Diffstat (limited to 'include/views')
-rw-r--r--include/views/SkApplication.h26
-rw-r--r--include/views/SkBGViewArtist.h41
-rw-r--r--include/views/SkBorderView.h48
-rw-r--r--include/views/SkEvent.h257
-rw-r--r--include/views/SkEventSink.h103
-rw-r--r--include/views/SkImageView.h75
-rw-r--r--include/views/SkKey.h63
-rw-r--r--include/views/SkMetaData.h164
-rw-r--r--include/views/SkOSMenu.h55
-rw-r--r--include/views/SkOSWindow_Mac.h62
-rw-r--r--include/views/SkOSWindow_SDL.h52
-rw-r--r--include/views/SkOSWindow_Unix.h60
-rw-r--r--include/views/SkOSWindow_Win.h79
-rw-r--r--include/views/SkOSWindow_wxwidgets.h52
-rw-r--r--include/views/SkProgressBarView.h57
-rw-r--r--include/views/SkScrollBarView.h52
-rw-r--r--include/views/SkStackViewLayout.h96
-rw-r--r--include/views/SkSystemEventTypes.h32
-rw-r--r--include/views/SkView.h370
-rw-r--r--include/views/SkViewInflate.h79
-rw-r--r--include/views/SkWidget.h476
-rw-r--r--include/views/SkWidgetViews.h310
-rw-r--r--include/views/SkWindow.h123
23 files changed, 0 insertions, 2732 deletions
diff --git a/include/views/SkApplication.h b/include/views/SkApplication.h
deleted file mode 100644
index 4c4a4fb..0000000
--- a/include/views/SkApplication.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef SkApplication_DEFINED
-#define SkApplication_DEFINED
-
-class SkOSWindow;
-
-extern SkOSWindow* create_sk_window(void* hwnd);
-extern void application_init();
-extern void application_term();
-
-#endif // SkApplication_DEFINED
diff --git a/include/views/SkBGViewArtist.h b/include/views/SkBGViewArtist.h
deleted file mode 100644
index 1bca42f..0000000
--- a/include/views/SkBGViewArtist.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef SkBGViewArtist_DEFINED
-#define SkBGViewArtist_DEFINED
-
-#include "SkView.h"
-#include "SkPaint.h"
-
-class SkBGViewArtist : public SkView::Artist {
-public:
- SkBGViewArtist(SkColor c = SK_ColorWHITE);
- virtual ~SkBGViewArtist();
-
- const SkPaint& paint() const { return fPaint; }
- SkPaint& paint() { return fPaint; }
-
-protected:
- // overrides
- virtual void onDraw(SkView*, SkCanvas*);
- virtual void onInflate(const SkDOM&, const SkDOM::Node*);
-
-private:
- SkPaint fPaint;
-};
-
-#endif
-
diff --git a/include/views/SkBorderView.h b/include/views/SkBorderView.h
deleted file mode 100644
index 94ccc1f..0000000
--- a/include/views/SkBorderView.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef SkBorderView_DEFINED
-#define SkBorderView_DEFINED
-
-#include "SkView.h"
-#include "SkWidgetViews.h"
-#include "SkAnimator.h"
-
-class SkBorderView : public SkWidgetView {
-public:
- SkBorderView();
- ~SkBorderView();
- void setSkin(const char skin[]);
- SkScalar getLeft() const { return fLeft; }
- SkScalar getRight() const { return fRight; }
- SkScalar getTop() const { return fTop; }
- SkScalar getBottom() const { return fBottom; }
-protected:
- //overrides
- virtual void onInflate(const SkDOM& dom, const SkDOM::Node* node);
- virtual void onSizeChange();
- virtual void onDraw(SkCanvas* canvas);
- virtual bool onEvent(const SkEvent& evt);
-private:
- SkAnimator fAnim;
- SkScalar fLeft, fRight, fTop, fBottom; //margin on each side
- SkRect fMargin;
-
- typedef SkWidgetView INHERITED;
-};
-
-#endif
-
diff --git a/include/views/SkEvent.h b/include/views/SkEvent.h
deleted file mode 100644
index f6719d6..0000000
--- a/include/views/SkEvent.h
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef SkEvent_DEFINED
-#define SkEvent_DEFINED
-
-#include "SkDOM.h"
-#include "SkMetaData.h"
-#include "SkString.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,
- its doEvent() method is called with the event.
-*/
-typedef uint32_t SkEventSinkID;
-
-/** \class SkEvent
-
- SkEvents are used to communicate type-safe information to SkEventSinks.
- SkEventSinks (including SkViews) each have a unique ID, which is stored
- in an event. This ID is used to target the event once it has been "posted".
-*/
-class SkEvent {
-public:
- /** Default construct, creating an empty event.
- */
- SkEvent();
- /** Construct a new event with the specified type.
- */
- explicit SkEvent(const SkString& type);
- /** Construct a new event with the specified type.
- */
- explicit SkEvent(const char type[]);
- /** Construct a new event by copying the fields from the src event.
- */
- SkEvent(const SkEvent& src);
- ~SkEvent();
-
-// /** Return the event's type (will never be null) */
-// const char* getType() const;
- /** Copy the event's type into the specified SkString parameter */
- void getType(SkString* str) const;
- /** Returns true if the event's type matches exactly the specified type (case sensitive) */
- bool isType(const SkString& str) const;
- /** Returns true if the event's type matches exactly the specified type (case sensitive) */
- bool isType(const char type[], size_t len = 0) const;
- /** Set the event's type to the specified string.
- In XML, use the "type" attribute.
- */
- void setType(const SkString&);
- /** Set the event's type to the specified string.
- In XML, use the "type" attribute.
- */
- void setType(const char type[], size_t len = 0);
-
- /** Return the event's unnamed 32bit field. Default value is 0 */
- uint32_t getFast32() const { return f32; }
- /** Set the event's unnamed 32bit field. In XML, use
- the subelement <data fast32=... />
- */
- void setFast32(uint32_t x) { f32 = x; }
-
- /** Return true if the event contains the named 32bit field, and return the field
- in value (if value is non-null). If there is no matching named field, return false
- and ignore the value parameter.
- */
- bool findS32(const char name[], int32_t* value = NULL) const { return fMeta.findS32(name, value); }
- /** Return true if the event contains the named SkScalar field, and return the field
- in value (if value is non-null). If there is no matching named field, return false
- and ignore the value parameter.
- */
- bool findScalar(const char name[], SkScalar* value = NULL) const { return fMeta.findScalar(name, value); }
- /** Return true if the event contains the named SkScalar field, and return the fields
- in value[] (if value is non-null), and return the number of SkScalars in count (if count is non-null).
- If there is no matching named field, return false and ignore the value and count parameters.
- */
- const SkScalar* findScalars(const char name[], int* count, SkScalar values[] = NULL) const { return fMeta.findScalars(name, count, values); }
- /** Return the value of the named string field, or if no matching named field exists, return null.
- */
- const char* findString(const char name[]) const { return fMeta.findString(name); }
- /** Return true if the event contains the named pointer field, and return the field
- in value (if value is non-null). If there is no matching named field, return false
- and ignore the value parameter.
- */
- bool findPtr(const char name[], void** value) const { return fMeta.findPtr(name, value); }
- bool findBool(const char name[], bool* value) const { return fMeta.findBool(name, value); }
- const void* findData(const char name[], size_t* byteCount = NULL) const {
- return fMeta.findData(name, byteCount);
- }
-
- /** Returns true if ethe event contains the named 32bit field, and if it equals the specified value */
- bool hasS32(const char name[], int32_t value) const { return fMeta.hasS32(name, value); }
- /** Returns true if ethe event contains the named SkScalar field, and if it equals the specified value */
- bool hasScalar(const char name[], SkScalar value) const { return fMeta.hasScalar(name, value); }
- /** Returns true if ethe event contains the named string field, and if it equals (using strcmp) the specified value */
- bool hasString(const char name[], const char value[]) const { return fMeta.hasString(name, value); }
- /** Returns true if ethe event contains the named pointer field, and if it equals the specified value */
- bool hasPtr(const char name[], void* value) const { return fMeta.hasPtr(name, value); }
- bool hasBool(const char name[], bool value) const { return fMeta.hasBool(name, value); }
- bool hasData(const char name[], const void* data, size_t byteCount) const {
- return fMeta.hasData(name, data, byteCount);
- }
-
- /** Add/replace the named 32bit field to the event. In XML use the subelement <data name=... s32=... /> */
- void setS32(const char name[], int32_t value) { fMeta.setS32(name, value); }
- /** Add/replace the named SkScalar field to the event. In XML use the subelement <data name=... scalar=... /> */
- void setScalar(const char name[], SkScalar value) { fMeta.setScalar(name, value); }
- /** Add/replace the named SkScalar[] field to the event. */
- SkScalar* setScalars(const char name[], int count, const SkScalar values[] = NULL) { return fMeta.setScalars(name, count, values); }
- /** Add/replace the named string field to the event. In XML use the subelement <data name=... string=... */
- void setString(const char name[], const SkString& value) { fMeta.setString(name, value.c_str()); }
- /** Add/replace the named string field to the event. In XML use the subelement <data name=... string=... */
- void setString(const char name[], const char value[]) { fMeta.setString(name, value); }
- /** Add/replace the named pointer field to the event. There is no XML equivalent for this call */
- void setPtr(const char name[], void* value) { fMeta.setPtr(name, value); }
- void setBool(const char name[], bool value) { fMeta.setBool(name, value); }
- void setData(const char name[], const void* data, size_t byteCount) {
- fMeta.setData(name, data, byteCount);
- }
-
- /** Return the underlying metadata object */
- SkMetaData& getMetaData() { return fMeta; }
- /** Return the underlying metadata object */
- const SkMetaData& getMetaData() const { return fMeta; }
-
- void tron() { SkDEBUGCODE(fDebugTrace = true;) }
- void troff() { SkDEBUGCODE(fDebugTrace = false;) }
- bool isDebugTrace() const
- {
-#ifdef SK_DEBUG
- return fDebugTrace;
-#else
- return false;
-#endif
- }
-
- /** Call this to initialize the event from the specified XML node */
- void inflate(const SkDOM&, const SkDOM::Node*);
-
- SkDEBUGCODE(void dump(const char title[] = NULL);)
-
- /** Post the specified event to the event queue, targeting the specified eventsink, with an optional
- delay. The event must be dynamically allocated for this. It cannot be a global or on the stack.
- After this call, ownership is transfered to the system, so the caller must not retain
- the event's ptr. Returns false if the event could not be posted (which means it will have been deleted).
- */
- static bool Post(SkEvent* evt, SkEventSinkID targetID, SkMSec delay = 0);
- /** Post the specified event to the event queue, targeting the specified eventsink, to be delivered on/after the
- specified millisecond time. The event must be dynamically allocated for this. It cannot be a global or on the stack.
- After this call, ownership is transfered to the system, so the caller must not retain
- the event's ptr. Returns false if the event could not be posted (which means it will have been deleted).
- */
- static bool PostTime(SkEvent* evt, SkEventSinkID targetID, SkMSec time);
-
- /** Helper method for calling SkEvent::PostTime(this, ...), where the caller specifies a delay.
- The real "time" will be computed automatically by sampling the clock and adding its value
- to delay.
- */
- bool post(SkEventSinkID sinkID, SkMSec delay = 0)
- {
- return SkEvent::Post(this, sinkID, delay);
- }
-
- void postTime(SkEventSinkID sinkID, SkMSec time)
- {
- SkEvent::PostTime(this, sinkID, time);
- }
-
- ///////////////////////////////////////////////
- /** Porting layer must call these functions **/
- ///////////////////////////////////////////////
-
- /** Global initialization function for the SkEvent system. Should be called exactly
- once before any other event method is called, and should be called after the
- call to SkGraphics::Init().
- */
- static void Init();
- /** Global cleanup function for the SkEvent system. Should be called exactly once after
- all event methods have been called, and should be called before calling SkGraphics::Term().
- */
- static void Term();
-
- /** Call this to process one event from the queue. If it returns true, there are more events
- to process.
- */
- static bool ProcessEvent();
- /** Call this whenever the requested timer has expired (requested by a call to SetQueueTimer).
- It will post any delayed events whose time as "expired" onto the event queue.
- It may also call SignalQueueTimer() and SignalNonEmptyQueue().
- */
- static void ServiceQueueTimer();
-
- /** Return the number of queued events. note that this value may be obsolete
- upon return, since another thread may have called ProcessEvent() or
- Post() after the count was made.
- */
- static int CountEventsOnQueue();
-
- ////////////////////////////////////////////////////
- /** Porting layer must implement these functions **/
- ////////////////////////////////////////////////////
-
- /** Called whenever an SkEvent is posted to an empty queue, so that the OS
- can be told to later call Dequeue().
- */
- static void SignalNonEmptyQueue();
- /** Called whenever the delay until the next delayed event changes. If zero is
- passed, then there are no more queued delay events.
- */
- static void SignalQueueTimer(SkMSec delay);
-
-#ifndef SK_USE_WXWIDGETS
-#ifdef SK_BUILD_FOR_WIN
- static bool WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
-#elif defined(SK_BUILD_FOR_UNIXx)
- static uint32_t HandleTimer(uint32_t, void*);
- static bool WndProc(Display*, Window, XEvent&);
-#endif
-#else
- // Don't know yet what this will be
- //static bool CustomEvent();
-#endif
-
-private:
- SkMetaData fMeta;
- mutable char* fType; // may be characters with low bit set to know that it is not a pointer
- uint32_t f32;
- SkDEBUGCODE(bool fDebugTrace;)
-
- // these are for our implementation of the event queue
- SkEventSinkID fTargetID;
- SkMSec fTime;
- SkEvent* fNextEvent; // either in the delay or normal event queue
- void initialize(const char* type, size_t typeLen);
-
- static bool Enqueue(SkEvent* evt);
- static SkMSec EnqueueTime(SkEvent* evt, SkMSec time);
- static SkEvent* Dequeue(SkEventSinkID* targetID);
- static bool QHasEvents();
-};
-
-#endif
-
diff --git a/include/views/SkEventSink.h b/include/views/SkEventSink.h
deleted file mode 100644
index 27a6743..0000000
--- a/include/views/SkEventSink.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef SkEventSink_DEFINED
-#define SkEventSink_DEFINED
-
-#include "SkRefCnt.h"
-#include "SkEvent.h"
-
-struct SkTagList;
-
-/** \class SkEventSink
-
- SkEventSink is the base class for all objects that receive SkEvents.
-*/
-class SkEventSink : public SkRefCnt {
-public:
- SkEventSink();
- virtual ~SkEventSink();
-
- /** Returns this eventsink's unique ID. Use this to post SkEvents to
- this eventsink.
- */
- SkEventSinkID getSinkID() const { return fID; }
-
- /** Call this to pass an event to this object for processing. Returns true if the
- event was handled.
- */
- bool doEvent(const SkEvent&);
- /** Returns true if the sink (or one of its subclasses) understands the event as a query.
- If so, the sink may modify the event to communicate its "answer".
- */
- bool doQuery(SkEvent* query);
-
- /** Add sinkID to the list of listeners, to receive events from calls to sendToListeners()
- and postToListeners(). If sinkID already exists in the listener list, no change is made.
- */
- void addListenerID(SkEventSinkID sinkID);
- /** Copy listeners from one event sink to another, typically from parent to child.
- @param from the event sink to copy the listeners from
- */
- void copyListeners(const SkEventSink& from);
- /** Remove sinkID from the list of listeners. If sinkID does not appear in the list,
- no change is made.
- */
- void removeListenerID(SkEventSinkID);
- /** Returns true if there are 1 or more listeners attached to this eventsink
- */
- bool hasListeners() const;
- /** Posts a copy of evt to each of the eventsinks in the lisener list.
- */
- void postToListeners(const SkEvent& evt, SkMSec delay = 0);
-
- enum EventResult {
- kHandled_EventResult, //!< the eventsink returned true from its doEvent method
- kNotHandled_EventResult, //!< the eventsink returned false from its doEvent method
- kSinkNotFound_EventResult //!< no matching eventsink was found for the event's getSink().
- };
- /** DoEvent handles searching for an eventsink object that matches the targetID.
- If one is found, it calls the sink's doEvent method, returning
- either kHandled_EventResult or kNotHandled_EventResult. If no matching
- eventsink is found, kSinkNotFound_EventResult is returned.
- */
- static EventResult DoEvent(const SkEvent&, SkEventSinkID targetID);
-
- /** Returns the matching eventsink, or null if not found
- */
- static SkEventSink* FindSink(SkEventSinkID);
-
-protected:
- /** Override this to handle events in your subclass. Be sure to call the inherited version
- for events that you don't handle.
- */
- virtual bool onEvent(const SkEvent&);
- virtual bool onQuery(SkEvent*);
-
- SkTagList* findTagList(U8CPU tag) const;
- void addTagList(SkTagList*);
- void removeTagList(U8CPU tag);
-
-private:
- SkEventSinkID fID;
- SkTagList* fTagHead;
-
- // for our private link-list
- SkEventSink* fNextSink;
-};
-
-#endif
-
diff --git a/include/views/SkImageView.h b/include/views/SkImageView.h
deleted file mode 100644
index 57215c9..0000000
--- a/include/views/SkImageView.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef SkImageView_DEFINED
-#define SkImageView_DEFINED
-
-#include "SkView.h"
-#include "SkString.h"
-
-class SkAnimator;
-class SkBitmap;
-class SkMatrix;
-
-class SkImageView : public SkView {
-public:
- SkImageView();
- virtual ~SkImageView();
-
- void getUri(SkString*) const;
- void setUri(const char []);
- void setUri(const SkString&);
-
-
- enum ScaleType {
- kMatrix_ScaleType,
- kFitXY_ScaleType,
- kFitStart_ScaleType,
- kFitCenter_ScaleType,
- kFitEnd_ScaleType
- };
- ScaleType getScaleType() const { return (ScaleType)fScaleType; }
- void setScaleType(ScaleType);
-
- bool getImageMatrix(SkMatrix*) const;
- void setImageMatrix(const SkMatrix*);
-
-protected:
- // overrides
- virtual bool onEvent(const SkEvent&);
- virtual void onDraw(SkCanvas*);
- virtual void onInflate(const SkDOM&, const SkDOMNode*);
-
-private:
- SkString fUri;
- SkMatrix* fMatrix; // null or copy of caller's matrix ,,,,,
- union {
- SkAnimator* fAnim;
- SkBitmap* fBitmap;
- } fData;
- uint8_t fScaleType;
- SkBool8 fDataIsAnim; // as opposed to bitmap
- SkBool8 fUriIsValid;
-
- void onUriChange();
- bool getDataBounds(SkRect* bounds);
- bool freeData();
- bool ensureUriIsLoaded();
-
- typedef SkView INHERITED;
-};
-
-#endif
diff --git a/include/views/SkKey.h b/include/views/SkKey.h
deleted file mode 100644
index 3fd5114..0000000
--- a/include/views/SkKey.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef SkKey_DEFINED
-#define SkKey_DEFINED
-
-#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
-};
-
-#endif
-
diff --git a/include/views/SkMetaData.h b/include/views/SkMetaData.h
deleted file mode 100644
index 9509710..0000000
--- a/include/views/SkMetaData.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef SkMetaData_DEFINED
-#define SkMetaData_DEFINED
-
-#include "SkScalar.h"
-
-class SkMetaData {
-public:
- SkMetaData();
- SkMetaData(const SkMetaData& src);
- ~SkMetaData();
-
- SkMetaData& operator=(const SkMetaData& src);
-
- void reset();
-
- bool findS32(const char name[], int32_t* value = NULL) const;
- bool findScalar(const char name[], SkScalar* value = NULL) const;
- const SkScalar* findScalars(const char name[], int* count, SkScalar values[] = NULL) const;
- const char* findString(const char name[]) const;
- bool findPtr(const char name[], void** value = NULL) const;
- bool findBool(const char name[], bool* value = NULL) const;
- const void* findData(const char name[], size_t* byteCount = NULL) const;
-
- bool hasS32(const char name[], int32_t value) const
- {
- int32_t v;
- return this->findS32(name, &v) && v == value;
- }
- bool hasScalar(const char name[], SkScalar value) const
- {
- SkScalar v;
- return this->findScalar(name, &v) && v == value;
- }
- bool hasString(const char name[], const char value[]) const
- {
- const char* v = this->findString(name);
- return v == NULL && value == NULL ||
- v != NULL && value != NULL && !strcmp(v, value);
- }
- bool hasPtr(const char name[], void* value) const
- {
- void* v;
- return this->findPtr(name, &v) && v == value;
- }
- bool hasBool(const char name[], bool value) const
- {
- bool v;
- return this->findBool(name, &v) && v == value;
- }
- bool hasData(const char name[], const void* data, size_t byteCount) const {
- size_t len;
- const void* ptr = this->findData(name, &len);
- return NULL != ptr && len == byteCount && !memcmp(ptr, data, len);
- }
-
- void setS32(const char name[], int32_t value);
- void setScalar(const char name[], SkScalar value);
- SkScalar* setScalars(const char name[], int count, const SkScalar values[] = NULL);
- void setString(const char name[], const char value[]);
- void setPtr(const char name[], void* value);
- void setBool(const char name[], bool value);
- // the data is copied from the input pointer.
- void setData(const char name[], const void* data, size_t byteCount);
-
- bool removeS32(const char name[]);
- bool removeScalar(const char name[]);
- bool removeString(const char name[]);
- bool removePtr(const char name[]);
- bool removeBool(const char name[]);
- bool removeData(const char name[]);
-
- SkDEBUGCODE(static void UnitTest();)
-
- enum Type {
- kS32_Type,
- kScalar_Type,
- kString_Type,
- kPtr_Type,
- kBool_Type,
- kData_Type,
-
- kTypeCount
- };
-
- struct Rec;
- class Iter;
- friend class Iter;
-
- class Iter {
- public:
- Iter() : fRec(NULL) {}
- Iter(const SkMetaData&);
-
- /** Reset the iterator, so that calling next() will return the first
- data element. This is done implicitly in the constructor.
- */
- void reset(const SkMetaData&);
-
- /** Each time next is called, it returns the name of the next data element,
- or null when there are no more elements. If non-null is returned, then the
- element's type is returned (if not null), and the number of data values
- is returned in count (if not null).
- */
- const char* next(Type*, int* count);
-
- private:
- Rec* fRec;
- };
-
-public:
- struct Rec {
- Rec* fNext;
- uint16_t fDataCount; // number of elements
- uint8_t fDataLen; // sizeof a single element
-#ifdef SK_DEBUG
- Type fType;
-#else
- uint8_t fType;
-#endif
-
-#ifdef SK_DEBUG
- const char* fName;
- union {
- int32_t fS32;
- SkScalar fScalar;
- const char* fString;
- void* fPtr;
- bool fBool;
- } fData;
-#endif
-
- const void* data() const { return (this + 1); }
- void* data() { return (this + 1); }
- const char* name() const { return (const char*)this->data() + fDataLen * fDataCount; }
- char* name() { return (char*)this->data() + fDataLen * fDataCount; }
-
- static Rec* Alloc(size_t);
- static void Free(Rec*);
- };
- Rec* fRec;
-
- const Rec* find(const char name[], Type) const;
- void* set(const char name[], const void* data, size_t len, Type, int count);
- bool remove(const char name[], Type);
-};
-
-#endif
-
diff --git a/include/views/SkOSMenu.h b/include/views/SkOSMenu.h
deleted file mode 100644
index 433a601..0000000
--- a/include/views/SkOSMenu.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef SkOSMenu_DEFINED
-#define SkOSMenu_DEFINED
-
-#include "SkEvent.h"
-#include "SkTDArray.h"
-
-class SkOSMenu {
-public:
- explicit SkOSMenu(const char title[]);
- ~SkOSMenu();
-
- const char* getTitle() const { return fTitle; }
-
- void appendItem(const char title[], const char eventType[], int32_t eventData);
-
- // called by SkOSWindow when it receives an OS menu event
- int countItems() const;
- const char* getItem(int index, uint32_t* cmdID) const;
-
- SkEvent* createEvent(uint32_t os_cmd);
-
-private:
- const char* fTitle;
-
- struct Item {
- const char* fTitle;
- const char* fEventType;
- uint32_t fEventData;
- uint32_t fOSCmd; // internal
- };
- SkTDArray<Item> fItems;
-
- // illegal
- SkOSMenu(const SkOSMenu&);
- SkOSMenu& operator=(const SkOSMenu&);
-};
-
-#endif
-
diff --git a/include/views/SkOSWindow_Mac.h b/include/views/SkOSWindow_Mac.h
deleted file mode 100644
index 3a26d5a..0000000
--- a/include/views/SkOSWindow_Mac.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef SkOSWindow_Mac_DEFINED
-#define SkOSWindow_Mac_DEFINED
-
-#include <Carbon/Carbon.h>
-#include "SkWindow.h"
-
-class SkOSWindow : public SkWindow {
-public:
- SkOSWindow(void* hwnd);
-
- void* getHWND() const { return fHWND; }
- void* getHVIEW() const { return fHVIEW; }
- void updateSize();
-
- static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay);
-
- static OSStatus EventHandler(EventHandlerCallRef inHandler,
- EventRef inEvent, void* userData);
-
- void doPaint(void* ctx);
-
-
- bool attachGL(const SkBitmap* offscreen);
- void detachGL();
- void presentGL();
-
-protected:
- // overrides from SkEventSink
- virtual bool onEvent(const SkEvent& evt);
- // overrides from SkWindow
- virtual void onHandleInval(const SkIRect&);
- // overrides from SkView
- virtual void onAddMenu(const SkOSMenu*);
- virtual void onSetTitle(const char[]);
-
-
-private:
- void* fHWND;
- void* fHVIEW;
- void* fAGLCtx;
-
- typedef SkWindow INHERITED;
-};
-
-#endif
-
diff --git a/include/views/SkOSWindow_SDL.h b/include/views/SkOSWindow_SDL.h
deleted file mode 100644
index 0ff24f3..0000000
--- a/include/views/SkOSWindow_SDL.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef SkOSWindow_SDL_DEFINED
-#define SkOSWindow_SDL_DEFINED
-
-#include "SDL.h"
-#include "SkWindow.h"
-
-class SkGLCanvas;
-
-class SkOSWindow : public SkWindow {
-public:
- SkOSWindow(void* screen);
- virtual ~SkOSWindow();
-
- static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay);
-
- void handleSDLEvent(const SDL_Event& event);
-
-protected:
- // overrides from SkWindow
- virtual void onHandleInval(const SkIRect&);
- // overrides from SkView
- virtual void onAddMenu(const SkOSMenu*);
- virtual void onSetTitle(const char[]);
-
-private:
- SDL_Surface* fScreen;
- SDL_Surface* fSurface;
- SkGLCanvas* fGLCanvas;
-
- void doDraw();
-
- typedef SkWindow INHERITED;
-};
-
-#endif
-
diff --git a/include/views/SkOSWindow_Unix.h b/include/views/SkOSWindow_Unix.h
deleted file mode 100644
index 26f51be..0000000
--- a/include/views/SkOSWindow_Unix.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef SkOSWindow_Unix_DEFINED
-#define SkOSWindow_Unix_DEFINED
-
-#include "SkWindow.h"
-#include <X11/Xlib.h>
-
-struct SkUnixWindow {
- Display* fDisplay;
- Window fWin;
- size_t fOSWin;
-};
-
-class SkOSWindow : public SkWindow {
-public:
- SkOSWindow(Display* display, Window win);
-
- void* getHWND() const { return (void*)fUnixWindow.fWin; }
- void* getDisplay() const { return (void*)fUnixWindow.fDisplay; }
- void* getUnixWindow() const { return (void*)&fUnixWindow; }
- void setSize(int width, int height);
- void updateSize();
-
- static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay);
-
- static bool WndProc(SkUnixWindow* w, XEvent &e);
-
-protected:
- // overrides from SkWindow
- virtual void onHandleInval(const SkIRect&);
- // overrides from SkView
- virtual void onAddMenu(const SkOSMenu*);
-
-private:
- SkUnixWindow fUnixWindow;
-
- void doPaint();
-
- void* fMBar;
-
- typedef SkWindow INHERITED;
-};
-
-#endif
-
diff --git a/include/views/SkOSWindow_Win.h b/include/views/SkOSWindow_Win.h
deleted file mode 100644
index 09f0c5c..0000000
--- a/include/views/SkOSWindow_Win.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef SkOSWindow_Win_DEFINED
-#define SkOSWindow_Win_DEFINED
-
-#include "SkWindow.h"
-
-class SkOSWindow : public SkWindow {
-public:
- SkOSWindow(void* hwnd);
- virtual ~SkOSWindow();
-
- void* getHWND() const { return fHWND; }
- void setSize(int width, int height);
- void updateSize();
-
- static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay);
-
- bool attachGL(const SkBitmap* offscreen);
- void detachGL();
- void presentGL();
-
- bool attachD3D9();
- void detachD3D9();
- void presentD3D9();
-
- void* d3d9Device() { return fD3D9Device; }
-
- bool wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
- static bool QuitOnDeactivate(HWND hWnd);
-
- enum {
- SK_WM_SkEvent = WM_APP + 1000,
- SK_WM_SkTimerID = 0xFFFF // just need a non-zero value
- };
-
-protected:
- virtual bool quitOnDeactivate() { return true; }
-
- // overrides from SkWindow
- virtual void onHandleInval(const SkIRect&);
- // overrides from SkView
- virtual void onAddMenu(const SkOSMenu*);
-
- virtual void onSetTitle(const char title[]);
-
-private:
- void* fHWND;
-
- void doPaint(void* ctx);
-
- void* fHGLRC;
-
- bool fGLAttached;
-
- void* fD3D9Device;
- bool fD3D9Attached;
-
- HMENU fMBar;
-
- typedef SkWindow INHERITED;
-};
-
-#endif
-
diff --git a/include/views/SkOSWindow_wxwidgets.h b/include/views/SkOSWindow_wxwidgets.h
deleted file mode 100644
index c5dfc7c..0000000
--- a/include/views/SkOSWindow_wxwidgets.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * SkOSWindow_wxwidgets.h
- * wxwidgets
- *
- * Copyright 2005 __MyCompanyName__. All rights reserved.
- *
- */
-
-#ifndef SkOSWindow_wxwidgets_DEFINED
-#define SkOSWindow_wxwidgets_DEFINED
-
-#include "SkWindow.h"
-#include "wx/frame.h"
-
-class SkOSWindow: public SkWindow
-{
-public:
- SkOSWindow();
- SkOSWindow(const wxString& title, int x, int y, int width, int height);
- ~SkOSWindow();
-
- wxFrame* getWXFrame() const { return fFrame; }
-
- void updateSize();
-
-protected:
- virtual void onHandleInval(const SkIRect&);
- virtual void onAddMenu(const SkOSMenu*);
-
-private:
- wxFrame* fFrame;
- typedef SkWindow INHERITED;
-
-};
-
-#endifpedef SkWindow INHERITED;
diff --git a/include/views/SkProgressBarView.h b/include/views/SkProgressBarView.h
deleted file mode 100644
index 6341fcb..0000000
--- a/include/views/SkProgressBarView.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef SkProgressBarView_DEFINED
-#define SkProgressBarView_DEFINED
-
-#include "SkView.h"
-#include "SkWidgetViews.h"
-#include "SkAnimator.h"
-
-class SkProgressBarView : public SkWidgetView {
- public:
- SkProgressBarView();
- //SkProgressBarView(int max);
-
- //inflate: "sk-progress"
-
- void reset(); //reset progress to zero
- void setProgress(int progress);
- void changeProgress(int diff);
- void setMax(int max);
-
- int getProgress() const { return fProgress; }
- int getMax() const { return fMax; }
-
- protected:
- //overrides
- virtual void onInflate(const SkDOM& dom, const SkDOM::Node* node);
- virtual void onSizeChange();
- virtual void onDraw(SkCanvas* canvas);
- virtual bool onEvent(const SkEvent& evt);
-
- private:
- SkAnimator fAnim;
- int fProgress;
- int fMax;
-
- typedef SkWidgetView INHERITED;
-};
-
-
-
-
-#endif
diff --git a/include/views/SkScrollBarView.h b/include/views/SkScrollBarView.h
deleted file mode 100644
index b8a5209..0000000
--- a/include/views/SkScrollBarView.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef SkScrollBarView_DEFINED
-#define SkScrollBarView_DEFINED
-
-#include "SkView.h"
-#include "SkWidgetViews.h"
-#include "SkAnimator.h"
-
-class SkScrollBarView : public SkWidgetView {
-public:
- SkScrollBarView();
-
- unsigned getStart() const { return fStartPoint; }
- unsigned getShown() const { return fShownLength; }
- unsigned getTotal() const { return fTotalLength; }
-
- void setStart(unsigned start);
- void setShown(unsigned shown);
- void setTotal(unsigned total);
-
-protected:
- //overrides
- virtual void onInflate(const SkDOM& dom, const SkDOM::Node* node);
- virtual void onSizeChange();
- virtual void onDraw(SkCanvas* canvas);
- virtual bool onEvent(const SkEvent& evt);
-
-private:
- SkAnimator fAnim;
- unsigned fTotalLength, fStartPoint, fShownLength;
-
- void adjust();
-
- typedef SkWidgetView INHERITED;
-};
-#endif
-
diff --git a/include/views/SkStackViewLayout.h b/include/views/SkStackViewLayout.h
deleted file mode 100644
index 8000319..0000000
--- a/include/views/SkStackViewLayout.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef SkStackViewLayout_DEFINED
-#define SkStackViewLayout_DEFINED
-
-#include "SkView.h"
-
-class SkStackViewLayout : public SkView::Layout {
-public:
- SkStackViewLayout();
-
- enum Orient {
- kHorizontal_Orient,
- kVertical_Orient,
-
- kOrientCount
- };
- Orient getOrient() const { return (Orient)fOrient; }
- void setOrient(Orient);
-
- void getMargin(SkRect*) const;
- void setMargin(const SkRect&);
-
- SkScalar getSpacer() const { return fSpacer; }
- void setSpacer(SkScalar);
-
- /** Controls the posititioning in the same direction as the orientation
- */
- enum Pack {
- kStart_Pack,
- kCenter_Pack,
- kEnd_Pack,
-
- kPackCount
- };
- Pack getPack() const { return (Pack)fPack; }
- void setPack(Pack);
-
- /** Controls the posititioning at right angles to the orientation
- */
- enum Align {
- kStart_Align,
- kCenter_Align,
- kEnd_Align,
- kStretch_Align,
-
- kAlignCount
- };
- Align getAlign() const { return (Align)fAlign; }
- void setAlign(Align);
-
- bool getRound() const { return SkToBool(fRound); }
- void setRound(bool);
-
-protected:
- virtual void onLayoutChildren(SkView* parent);
- virtual void onInflate(const SkDOM&, const SkDOM::Node*);
-
-private:
- SkRect fMargin;
- SkScalar fSpacer;
- uint8_t fOrient, fPack, fAlign, fRound;
-};
-
-class SkFillViewLayout : public SkView::Layout {
-public:
- SkFillViewLayout();
- void getMargin(SkRect*) const;
- void setMargin(const SkRect&);
-
-protected:
- // overrides;
- virtual void onLayoutChildren(SkView* parent);
- virtual void onInflate(const SkDOM& dom, const SkDOM::Node* node);
-
-private:
- SkRect fMargin;
- typedef SkView::Layout INHERITED;
-};
-
-#endif
-
diff --git a/include/views/SkSystemEventTypes.h b/include/views/SkSystemEventTypes.h
deleted file mode 100644
index 8dfe8be..0000000
--- a/include/views/SkSystemEventTypes.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#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
deleted file mode 100644
index d3633db..0000000
--- a/include/views/SkView.h
+++ /dev/null
@@ -1,370 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef SkView_DEFINED
-#define SkView_DEFINED
-
-#include "SkEventSink.h"
-#include "SkRect.h"
-#include "SkDOM.h"
-#include "SkTDict.h"
-
-class SkCanvas;
-class SkLayerView;
-
-/** \class SkView
-
- SkView is the base class for screen management. All widgets and controls inherit
- from SkView.
-*/
-class SkView : public SkEventSink {
-public:
- enum Flag_Shift {
- kVisible_Shift,
- kEnabled_Shift,
- kFocusable_Shift,
- kFlexH_Shift,
- kFlexV_Shift,
- kNoClip_Shift,
-
- kFlagShiftCount
- };
- enum Flag_Mask {
- kVisible_Mask = 1 << kVisible_Shift, //!< set if the view is visible
- kEnabled_Mask = 1 << kEnabled_Shift, //!< set if the view is enabled
- kFocusable_Mask = 1 << kFocusable_Shift, //!< set if the view can receive focus
- kFlexH_Mask = 1 << kFlexH_Shift, //!< set if the view's width is stretchable
- kFlexV_Mask = 1 << kFlexV_Shift, //!< set if the view's height is stretchable
- kNoClip_Mask = 1 << kNoClip_Shift, //!< set if the view is not clipped to its bounds
-
- kAllFlagMasks = (uint32_t)(0 - 1) >> (32 - kFlagShiftCount)
- };
-
- SkView(uint32_t flags = 0);
- virtual ~SkView();
-
- /** Return the flags associated with the view
- */
- uint32_t getFlags() const { return fFlags; }
- /** Set the flags associated with the view
- */
- void setFlags(uint32_t flags);
-
- /** Helper that returns non-zero if the kVisible_Mask bit is set in the view's flags
- */
- int isVisible() const { return fFlags & kVisible_Mask; }
- int isEnabled() const { return fFlags & kEnabled_Mask; }
- int isFocusable() const { return fFlags & kFocusable_Mask; }
- int isClipToBounds() const { return !(fFlags & kNoClip_Mask); }
- /** Helper to set/clear the view's kVisible_Mask flag */
- void setVisibleP(bool);
- void setEnabledP(bool);
- void setFocusableP(bool);
- void setClipToBounds(bool);
-
- /** Return the view's width */
- SkScalar width() const { return fWidth; }
- /** Return the view's height */
- SkScalar height() const { return fHeight; }
- /** Set the view's width and height. These must both be >= 0. This does not affect the view's loc */
- void setSize(SkScalar width, SkScalar height);
- 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;
-
- /** 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); }
- /** 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 {
- 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,
- kUp_State
- };
- SkPoint fOrig, fPrev, fCurr;
- SkIPoint fIOrig, fIPrev, fICurr;
- State fState;
- private:
- SkEventSinkID fTargetID;
- char* fType;
- bool fWeOwnTheType;
-
- void resetType();
-
- friend class SkView;
- };
- Click* findClickHandler(SkScalar x, SkScalar y);
-
- static void DoClickDown(Click*, int x, int y);
- static void DoClickMoved(Click*, int x, int y);
- static void DoClickUp(Click*, int x, int y);
-
- /** 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*);
-
- /** Depricated helper function. Just call event->post(sinkID, delay);
- */
- bool postEvent(SkEvent* evt, SkEventSinkID sinkID, SkMSec delay) { return evt->post(sinkID, delay); }
-
- // 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
- */
- void globalToLocal(SkPoint* pt) const { if (pt) this->globalToLocal(pt->fX, pt->fY, pt); }
- /** Convert the specified x,y from global coordinates into view-local coordinates, returning
- the answer in the local parameter.
- */
- void 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;
- };
-
- /** \class Artist
-
- Install a subclass of this in a view (calling setArtist()), and then the
- default implementation of that view's onDraw() will invoke this object
- automatically.
- */
- class Artist : public SkRefCnt {
- public:
- void draw(SkView*, SkCanvas*);
- void inflate(const SkDOM&, const SkDOM::Node*);
- protected:
- virtual void onDraw(SkView*, SkCanvas*) = 0;
- virtual void onInflate(const SkDOM&, const SkDOM::Node*);
- };
- /** Return the artist attached to this view (or null). The artist's reference
- count is not affected.
- */
- Artist* getArtist() const;
- /** Attach the specified artist (or null) to the view, replacing any existing
- artist. If the new artist is not null, its reference count is incremented.
- The artist parameter is returned.
- */
- Artist* setArtist(Artist* artist);
-
- /** \class Layout
-
- Install a subclass of this in a view (calling setLayout()), and then the
- default implementation of that view's onLayoutChildren() will invoke
- this object automatically.
- */
- class Layout : public SkRefCnt {
- public:
- void layoutChildren(SkView* parent);
- void inflate(const SkDOM&, const SkDOM::Node*);
- protected:
- virtual void onLayoutChildren(SkView* parent) = 0;
- virtual void onInflate(const SkDOM&, const SkDOM::Node*);
- };
-
- /** Return the layout attached to this view (or null). The layout's reference
- count is not affected.
- */
- Layout* getLayout() const;
- /** Attach the specified layout (or null) to the view, replacing any existing
- layout. If the new layout is not null, its reference count is incremented.
- The layout parameter is returned.
- */
- Layout* setLayout(Layout*, bool invokeLayoutNow = true);
- /** If a layout is attached to this view, call its layoutChildren() method
- */
- void invokeLayout();
-
- /** Call this to initialize this view based on the specified XML node
- */
- void inflate(const SkDOM& dom, const SkDOM::Node* node);
- /** After a view hierarchy is inflated, this may be called with a dictionary
- containing pairs of <name, view*>, where the name string was the view's
- "id" attribute when it was inflated.
-
- This will call the virtual onPostInflate for this view, and the recursively
- call postInflate on all of the view's children.
- */
- void postInflate(const SkTDict<SkView*>& ids);
-
- 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* orig) {}
-
- //! called right before this child's onDraw is called
- virtual void beforeChild(SkView* child, SkCanvas* canvas) {}
- //! called right after this child's onDraw is called
- virtual void afterChild(SkView* child, SkCanvas* canvas) {}
-
- /** Override this if you might handle the click
- */
- virtual Click* onFindClickHandler(SkScalar x, SkScalar y);
- /** 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);
- /** 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 SkDOM::Node* 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.
- */
- virtual void onPostInflate(const SkTDict<SkView*>&);
-
-public:
- // 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;
- 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();
-};
-
-#endif
-
diff --git a/include/views/SkViewInflate.h b/include/views/SkViewInflate.h
deleted file mode 100644
index 3ec65a6..0000000
--- a/include/views/SkViewInflate.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef SkViewInflate_DEFINED
-#define SkViewInflate_DEFINED
-
-#include "SkDOM.h"
-#include "SkTDict.h"
-#include "SkEvent.h"
-
-class SkView;
-
-class SkViewInflate {
-public:
- SkViewInflate();
- virtual ~SkViewInflate();
-
- /** Return the tree of inflated views. If root is null, create the root element
- as a view, otherwise assume root is that view, and just "inflate" it.
-
- Returns null if the tree cannot be built.
- */
- SkView* inflate(const SkDOM& dom, const SkDOM::Node* node, SkView* root = NULL);
- SkView* inflate(const char xml[], size_t len, SkView* root = NULL);
-
- /** Given an id attribute value, return the corresponding view, or null
- if no match is found.
- */
- SkView* findViewByID(const char id[]) const;
-
- SkDEBUGCODE(void dump() const;)
-
-protected:
- /* Override this in your subclass to handle instantiating views
- Call the inherited version for nodes you don't recognize.
-
- Do not call "inflate" on the view, just return it. This will
- get called automatically after createView returns.
- */
- virtual SkView* createView(const SkDOM& dom, const SkDOM::Node* node);
- /** Base implementation calls view->inflate(dom, node). Subclasses may override this
- to perform additional initializations to view, either before or after calling
- the inherited version.
- */
- virtual void inflateView(SkView* view, const SkDOM& dom, const SkDOM::Node* node);
-
-private:
- enum {
- kMinIDStrAlloc = 64
- };
- SkTDict<SkView*> fIDs;
-
- struct IDStr {
- SkView* fView;
- char* fStr;
- };
- SkTDArray<IDStr> fListenTo, fBroadcastTo;
- SkChunkAlloc fStrings;
-
- void addIDStr(SkTDArray<IDStr>* list, SkView*, const char* str);
-
- void rInflate(const SkDOM& dom, const SkDOM::Node* node, SkView* parent);
-};
-
-#endif
-
diff --git a/include/views/SkWidget.h b/include/views/SkWidget.h
deleted file mode 100644
index db85f01..0000000
--- a/include/views/SkWidget.h
+++ /dev/null
@@ -1,476 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef SkWidget_DEFINED
-#define SkWidget_DEFINED
-
-#include "SkView.h"
-#include "SkBitmap.h"
-#include "SkDOM.h"
-#include "SkPaint.h"
-#include "SkString.h"
-#include "SkTDArray.h"
-
-//////////////////////////////////////////////////////////////////////////////
-
-class SkWidget : public SkView {
-public:
- SkWidget(uint32_t flags = 0) : SkView(flags | kFocusable_Mask | kEnabled_Mask) {}
-
- /** Call this to post the widget's event to its listeners */
- void postWidgetEvent();
-
- static void Init();
- static void Term();
-protected:
- // override to add slots to an event before posting
- virtual void prepareWidgetEvent(SkEvent*);
- virtual void onEnabledChange();
-
- // <event ...> to initialize the event from XML
- virtual void onInflate(const SkDOM& dom, const SkDOM::Node* node);
-
-private:
- SkEvent fEvent;
- typedef SkView INHERITED;
-};
-
-class SkHasLabelWidget : public SkWidget {
-public:
- SkHasLabelWidget(uint32_t flags = 0) : SkWidget(flags) {}
-
- size_t getLabel(SkString* label = NULL) const;
- size_t getLabel(char lable[] = NULL) const;
- void setLabel(const SkString&);
- void setLabel(const char label[]);
- void setLabel(const char label[], size_t len);
-
-protected:
- // called when the label changes
- virtual void onLabelChange();
-
- // overrides
- virtual void onInflate(const SkDOM& dom, const SkDOM::Node*);
-
-private:
- SkString fLabel;
- typedef SkWidget INHERITED;
-};
-
-class SkButtonWidget : public SkHasLabelWidget {
-public:
- SkButtonWidget(uint32_t flags = 0) : SkHasLabelWidget(flags), fState(kOff_State) {}
-
- enum State {
- kOff_State, //!< XML: buttonState="off"
- kOn_State, //!< XML: buttonState="on"
- kUnknown_State //!< XML: buttonState="unknown"
- };
- State getButtonState() const { return fState; }
- void setButtonState(State);
-
-protected:
- /** called when the label changes. default behavior is to inval the widget */
- virtual void onButtonStateChange();
-
- // overrides
- virtual void onInflate(const SkDOM& dom, const SkDOM::Node*);
-
-private:
- State fState;
- typedef SkHasLabelWidget INHERITED;
-};
-
-class SkPushButtonWidget : public SkButtonWidget {
-public:
- SkPushButtonWidget(uint32_t flags = 0) : SkButtonWidget(flags) {}
-
-protected:
- virtual bool onEvent(const SkEvent&);
- virtual void onDraw(SkCanvas*);
- virtual Click* onFindClickHandler(SkScalar x, SkScalar y);
- virtual bool onClick(Click* click);
-
-private:
- typedef SkButtonWidget INHERITED;
-};
-
-class SkCheckBoxWidget : public SkButtonWidget {
-public:
- SkCheckBoxWidget(uint32_t flags = 0);
-
-protected:
- virtual bool onEvent(const SkEvent&);
- virtual void onDraw(SkCanvas*);
- virtual void onInflate(const SkDOM& dom, const SkDOM::Node*);
-
-private:
- typedef SkButtonWidget INHERITED;
-};
-
-#include "SkTextBox.h"
-
-class SkStaticTextView : public SkView {
-public:
- SkStaticTextView(uint32_t flags = 0);
- virtual ~SkStaticTextView();
-
- enum Mode {
- kFixedSize_Mode,
- kAutoWidth_Mode,
- kAutoHeight_Mode,
-
- kModeCount
- };
- Mode getMode() const { return (Mode)fMode; }
- void setMode(Mode);
-
- SkTextBox::SpacingAlign getSpacingAlign() const { return (SkTextBox::SpacingAlign)fSpacingAlign; }
- void setSpacingAlign(SkTextBox::SpacingAlign);
-
- void getMargin(SkPoint* margin) const;
- void setMargin(SkScalar dx, SkScalar dy);
-
- size_t getText(SkString* text = NULL) const;
- size_t getText(char text[] = NULL) const;
- void setText(const SkString&);
- void setText(const char text[]);
- void setText(const char text[], size_t len);
-
- void getPaint(SkPaint*) const;
- void setPaint(const SkPaint&);
-
-protected:
- // overrides
- virtual void onDraw(SkCanvas*);
- virtual void onInflate(const SkDOM& dom, const SkDOM::Node*);
-
-private:
- SkPoint fMargin;
- SkString fText;
- SkPaint fPaint;
- uint8_t fMode;
- uint8_t fSpacingAlign;
-
- void computeSize();
-
- typedef SkView INHERITED;
-};
-
-class SkBitmapView : public SkView {
-public:
- SkBitmapView(uint32_t flags = 0);
- virtual ~SkBitmapView();
-
- bool getBitmap(SkBitmap*) const;
- void setBitmap(const SkBitmap*, bool viewOwnsPixels);
- bool loadBitmapFromFile(const char path[]);
-
-protected:
- virtual void onDraw(SkCanvas*);
- virtual void onInflate(const SkDOM&, const SkDOM::Node*);
-
-private:
- SkBitmap fBitmap;
- typedef SkView INHERITED;
-};
-
-/////////////////////////////////////////////////////////////////////////////
-
-class SkShader;
-class SkInterpolator;
-
-class SkWidgetView : public SkView {
-public:
- SkWidgetView(uint32_t flags = 0);
- virtual ~SkWidgetView();
-
- static const char* GetEventType();
-};
-
-class SkSliderView : public SkWidgetView {
-public:
- SkSliderView(uint32_t flags = 0);
-
- uint16_t getValue() const { return fValue; }
- uint16_t getMax() const { return fMax; }
-
- void setMax(U16CPU max);
- void setValue(U16CPU value);
-
-protected:
- virtual void onDraw(SkCanvas*);
- virtual Click* onFindClickHandler(SkScalar x, SkScalar y);
- virtual bool onClick(Click*);
-
-private:
- uint16_t fValue, fMax;
-
- typedef SkWidgetView INHERITED;
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-class SkHasLabelView : public SkView {
-public:
- void getLabel(SkString*) const;
- void setLabel(const SkString&);
- void setLabel(const char label[]);
-
-protected:
- SkString fLabel;
-
- // called when the label changes
- virtual void onLabelChange();
-
- // overrides
- virtual void onInflate(const SkDOM& dom, const SkDOM::Node*);
-};
-
-class SkPushButtonView : public SkHasLabelView {
-public:
- SkPushButtonView(uint32_t flags = 0);
-
-protected:
- virtual void onDraw(SkCanvas*);
- virtual void onInflate(const SkDOM& dom, const SkDOM::Node*);
-};
-
-class SkCheckBoxView : public SkHasLabelView {
-public:
- SkCheckBoxView(uint32_t flags = 0);
-
- enum State {
- kOff_State,
- kOn_State,
- kMaybe_State
- };
- State getState() const { return fState; }
- void setState(State);
-
-protected:
- virtual void onDraw(SkCanvas*);
- virtual void onInflate(const SkDOM& dom, const SkDOM::Node*);
-
-private:
- State fState;
-};
-
-class SkProgressView : public SkView {
-public:
- SkProgressView(uint32_t flags = 0);
- virtual ~SkProgressView();
-
- uint16_t getValue() const { return fValue; }
- uint16_t getMax() const { return fMax; }
-
- void setMax(U16CPU max);
- void setValue(U16CPU value);
-
-protected:
- virtual void onDraw(SkCanvas*);
- virtual void onInflate(const SkDOM& dom, const SkDOM::Node* node);
-
-private:
- uint16_t fValue, fMax;
- SkShader* fOnShader, *fOffShader;
- SkInterpolator* fInterp;
- bool fDoInterp;
-
- typedef SkView INHERITED;
-};
-
-class SkTextView : public SkView {
-public:
- SkTextView(uint32_t flags = 0);
- virtual ~SkTextView();
-
- enum AnimaDir {
- kNeutral_AnimDir,
- kForward_AnimDir,
- kBackward_AnimDir,
- kAnimDirCount
- };
-
- void getText(SkString*) const;
- void setText(const SkString&, AnimaDir dir = kNeutral_AnimDir);
- void setText(const char text[], AnimaDir dir = kNeutral_AnimDir);
- void setText(const char text[], size_t len, AnimaDir dir = kNeutral_AnimDir);
-
- void getMargin(SkPoint* margin) const;
- void setMargin(const SkPoint&);
-
- SkPaint& paint() { return fPaint; }
-
-protected:
- virtual void onDraw(SkCanvas*);
- virtual void onInflate(const SkDOM& dom, const SkDOM::Node* node);
-
-private:
- SkString fText;
- SkPaint fPaint;
- SkPoint fMargin;
-
- class Interp;
- Interp* fInterp;
- bool fDoInterp;
- // called by the other setText methods. This guy does not check for !=
- // before doing the assign, so the caller must check for us
- void privSetText(const SkString&, AnimaDir dir);
-
- typedef SkView INHERITED;
-};
-
-//////////////////////////////////////////////////////////
-
-class SkEvent;
-
-class SkListSource : public SkEventSink {
-public:
- virtual int countRows() = 0;
- virtual void getRow(int index, SkString* left, SkString* right) = 0;
- virtual SkEvent* getEvent(int index);
-
- static SkListSource* CreateFromDir(const char path[], const char suffix[],
- const char targetPrefix[]);
- static SkListSource* CreateFromDOM(const SkDOM& dom, const SkDOM::Node* node);
-};
-
-class SkListView : public SkWidgetView {
-public:
- SkListView(uint32_t flags = 0);
- virtual ~SkListView();
-
- SkScalar getRowHeight() const { return fRowHeight; }
- void setRowHeight(SkScalar);
-
- /** Return the index of the selected row, or -1 if none
- */
- int getSelection() const { return fCurrIndex; }
- /** Set the index of the selected row, or -1 for none
- */
- void setSelection(int);
-
- void moveSelectionUp();
- void moveSelectionDown();
-
- enum Attr {
- kBG_Attr,
- kNormalText_Attr,
- kHiliteText_Attr,
- kHiliteCell_Attr,
- kAttrCount
- };
- SkPaint& paint(Attr);
-
- SkListSource* getListSource() const { return fSource; }
- SkListSource* setListSource(SkListSource*);
-
-#if 0
- enum Action {
- kSelectionChange_Action,
- kSelectionPicked_Action,
- kActionCount
- };
- /** If event is not null, it is retained by the view, and a copy
- of the event will be posted to its listeners when the specified
- action occurs. If event is null, then no event will be posted for
- the specified action.
- */
- void setActionEvent(Action, SkEvent* event);
-#endif
-
-protected:
- virtual void onDraw(SkCanvas*);
- virtual void onSizeChange();
- virtual bool onEvent(const SkEvent&);
- virtual void onInflate(const SkDOM& dom, const SkDOM::Node* node);
-
-private:
- SkPaint fPaint[kAttrCount];
- SkListSource* fSource;
- SkScalar fRowHeight;
- int fCurrIndex; // logical index
- int fScrollIndex; // logical index of top-most visible row
- int fVisibleRowCount;
- SkString* fStrCache;
-
- void dirtyStrCache();
- void ensureStrCache(int visibleCount);
-
- int logicalToVisualIndex(int index) const { return index - fScrollIndex; }
- void invalSelection();
- bool getRowRect(int index, SkRect*) const;
- void ensureSelectionIsVisible();
-
- typedef SkWidgetView INHERITED;
-};
-
-//////////////////////////////////////////////////////////
-
-class SkGridView : public SkWidgetView {
-public:
- SkGridView(uint32_t flags = 0);
- virtual ~SkGridView();
-
- void getCellSize(SkPoint*) const;
- void setCellSize(SkScalar x, SkScalar y);
-
- /** Return the index of the selected item, or -1 if none
- */
- int getSelection() const { return fCurrIndex; }
- /** Set the index of the selected row, or -1 for none
- */
- void setSelection(int);
-
- void moveSelectionUp();
- void moveSelectionDown();
-
- enum Attr {
- kBG_Attr,
- kHiliteCell_Attr,
- kAttrCount
- };
- SkPaint& paint(Attr);
-
- SkListSource* getListSource() const { return fSource; }
- SkListSource* setListSource(SkListSource*);
-
-protected:
- virtual void onDraw(SkCanvas*);
- virtual void onSizeChange();
- virtual bool onEvent(const SkEvent&);
- virtual void onInflate(const SkDOM& dom, const SkDOM::Node* node);
-
-private:
- SkView* fScrollBar;
- SkPaint fPaint[kAttrCount];
- SkListSource* fSource;
- int fCurrIndex; // logical index
-
- SkPoint fCellSize;
- SkIPoint fVisibleCount;
-
- int logicalToVisualIndex(int index) const { return index; }
- void invalSelection();
- bool getCellRect(int index, SkRect*) const;
- void ensureSelectionIsVisible();
-
- typedef SkWidgetView INHERITED;
-};
-
-#endif
-
diff --git a/include/views/SkWidgetViews.h b/include/views/SkWidgetViews.h
deleted file mode 100644
index 4dd8866..0000000
--- a/include/views/SkWidgetViews.h
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef SkWidgetViews_DEFINED
-#define SkWidgetViews_DEFINED
-
-#include "SkView.h"
-
-
-enum SkWidgetEnum {
- kBorder_WidgetEnum, //!< <sk-border>
- kButton_WidgetEnum, //!< <sk-button>
- kImage_WidgetEnum, //!< <sk-image>
- kList_WidgetEnum, //!< <sk-list>
- kProgress_WidgetEnum, //!< <sk-progress>
- kScroll_WidgetEnum, //!< <sk-scroll>
- kText_WidgetEnum, //!< <sk-text>
-
- kWidgetEnumCount
-};
-
-//determines which skin to use
-enum SkinEnum {
- kBorder_SkinEnum,
- kButton_SkinEnum,
- kProgress_SkinEnum,
- kScroll_SkinEnum,
- kStaticText_SkinEnum,
-
- kSkinEnumCount
-};
-
-#include "SkAnimator.h"
-//used for inflates
-const char* get_skin_enum_path(SkinEnum se);
-void init_skin_anim(const char path[], SkAnimator* anim);
-void init_skin_anim(SkinEnum se, SkAnimator* anim);
-void init_skin_paint(SkinEnum se, SkPaint* paint);
-void inflate_paint(const SkDOM& dom, const SkDOM::Node* node, SkPaint* paint);
-
-/** Given an enum value, return an instance of the specified widget.
- If the enum is out of range, returns null
-*/
-SkView* SkWidgetFactory(SkWidgetEnum);
-/** Given the inflate/element name of a widget, return an instance of
- the specified widget, or null if name does not match any known
- widget type.
-*/
-SkView* SkWidgetFactory(const char name[]);
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-
-class SkWidgetView : public SkView {
-public:
- SkWidgetView();
-
- const char* getLabel() const;
- void getLabel(SkString* label) const;
-
- void setLabel(const char[]);
- void setLabel(const char[], size_t len);
- void setLabel(const SkString&);
-
- SkEvent& event() { return fEvent; }
- const SkEvent& event() const { return fEvent; }
-
- /** Returns true if the widget can post its event to its listeners.
- */
- bool postWidgetEvent();
-
- /** Returns the sinkID of the widgetview that posted the event, or 0
- */
- static SkEventSinkID GetWidgetEventSinkID(const SkEvent&);
-
-protected:
- /** called when the label changes. override in subclasses. default action invals the view's bounds.
- called with the old and new labels, before the label has actually changed.
- */
- virtual void onLabelChange(const char oldLabel[], const char newLabel[]);
- /** called before posting the event to our listeners. Override to add slots to the event
- before posting. Return true to proceed with posting, or false to not post the event to any
- listener. Note: the event passed in may not be the same as calling this->event().
- Be sure to call your INHERITED method as well, so that all classes in the hierarchy get a shot
- at modifying the event (and possibly returning false to abort).
- */
- virtual bool onPrepareWidgetEvent(SkEvent* evt);
-
- // overrides
- virtual void onInflate(const SkDOM& dom, const SkDOM::Node*);
-
-private:
- SkString fLabel;
- SkEvent fEvent;
-
- typedef SkView INHERITED;
-};
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-
-class SkButtonView : public SkWidgetView {
-public:
- // inflate: "sk-button"
-
-protected:
- // overrides
- virtual bool onEvent(const SkEvent&);
-};
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-
-class SkCheckButtonView : public SkWidgetView {
-public:
- SkCheckButtonView();
-
- // inflate: "sk-checkbutton"
-
- enum CheckState {
- kOff_CheckState, //!< inflate: check-state="off"
- kOn_CheckState, //!< inflate: check-state="on"
- kUnknown_CheckState //!< inflate: check-state="unknown"
- };
- CheckState getCheckState() const { return (CheckState)fCheckState; }
- void setCheckState(CheckState);
-
- /** use this to extract the CheckState from an event (i.e. one that as posted
- by a SkCheckButtonView). Returns true if the proper slot was present in the event,
- and sets state to that value. If no proper slot is found, returns false and does not
- modify state.
- */
- static bool GetWidgetEventCheckState(const SkEvent&, CheckState* state);
-
-protected:
- // called when the check-state is about to change, but before it actually has
- virtual void onCheckStateChange(CheckState oldState, CheckState newState);
-
- // overrides
- virtual void onInflate(const SkDOM& dom, const SkDOM::Node*);
- virtual bool onPrepareWidgetEvent(SkEvent* evt);
-
-private:
- uint8_t fCheckState;
-
- typedef SkWidgetView INHERITED;
-};
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-#include "SkTextBox.h"
-
-class SkStaticTextView : public SkView {
-public:
- SkStaticTextView();
- virtual ~SkStaticTextView();
-
- enum Mode {
- kFixedSize_Mode,
- kAutoWidth_Mode,
- kAutoHeight_Mode,
-
- kModeCount
- };
- Mode getMode() const { return (Mode)fMode; }
- void setMode(Mode);
-
- SkTextBox::SpacingAlign getSpacingAlign() const { return (SkTextBox::SpacingAlign)fSpacingAlign; }
- void setSpacingAlign(SkTextBox::SpacingAlign);
-
- void getMargin(SkPoint* margin) const;
- void setMargin(SkScalar dx, SkScalar dy);
-
- size_t getText(SkString* text = NULL) const;
- size_t getText(char text[] = NULL) const;
- void setText(const SkString&);
- void setText(const char text[]);
- void setText(const char text[], size_t len);
-
- void getPaint(SkPaint*) const;
- void setPaint(const SkPaint&);
-
-protected:
- // overrides
- virtual void onDraw(SkCanvas*);
- virtual void onInflate(const SkDOM& dom, const SkDOM::Node*);
-
-private:
- SkPoint fMargin;
- SkString fText;
- SkPaint fPaint;
- uint8_t fMode;
- uint8_t fSpacingAlign;
-
- void computeSize();
-
- typedef SkView INHERITED;
-};
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-
-class SkAnimator;
-class SkListSource;
-class SkScrollBarView;
-
-class SkListView : public SkWidgetView {
-public:
- SkListView();
- virtual ~SkListView();
-
- bool hasScrollBar() const { return fScrollBar != NULL; }
- void setHasScrollBar(bool);
-
- /** Return the number of visible rows
- */
- int getVisibleRowCount() const { return fVisibleRowCount; }
- /** Return the index of the selected row, or -1 if none
- */
- int getSelection() const { return fCurrIndex; }
- /** Set the index of the selected row, or -1 for none
- */
- void setSelection(int);
- /** If possible, move the selection up and return true,
- else do nothing and return false
- If nothing is selected, select the last item (unless there are no items).
- */
- bool moveSelectionUp();
- /** If possible, move the selection down and return true,
- else do nothing and return false.
- If nothing is selected, select the first item (unless there are no items).
- */
- bool moveSelectionDown();
-
- SkListSource* getListSource() const { return fSource; }
- SkListSource* setListSource(SkListSource*);
-
- /** Call this in your event handler. If the specified event is from a SkListView,
- then it returns the index of the selected item in this list, otherwise it
- returns -1
- */
- static int GetWidgetEventListIndex(const SkEvent&);
-
-protected:
- // overrides
- virtual void onDraw(SkCanvas*);
- virtual void onSizeChange();
- virtual bool onEvent(const SkEvent&);
- virtual void onInflate(const SkDOM& dom, const SkDOM::Node* node);
- virtual bool onPrepareWidgetEvent(SkEvent*);
-
-private:
- enum DirtyFlags {
- kAnimCount_DirtyFlag = 0x01,
- kAnimContent_DirtyFlag = 0x02
- };
- void dirtyCache(unsigned dirtyFlags);
- bool ensureCache();
-
- int logicalToVisualIndex(int index) const { return index - fScrollIndex; }
- void invalSelection();
- SkScalar getContentWidth() const;
- bool getRowRect(int index, SkRect*) const;
- void ensureSelectionIsVisible();
- void ensureVisibleRowCount();
-
- struct BindingRec;
-
- enum Heights {
- kNormal_Height,
- kSelected_Height
- };
- SkListSource* fSource;
- SkScrollBarView* fScrollBar;
- SkAnimator* fAnims;
- BindingRec* fBindings;
- SkString fSkinName;
- SkScalar fHeights[2];
- int16_t fScrollIndex, fCurrIndex;
- uint16_t fVisibleRowCount, fBindingCount;
- SkBool8 fAnimContentDirty;
- SkBool8 fAnimFocusDirty;
-
- typedef SkWidgetView INHERITED;
-};
-
-class SkListSource : public SkRefCnt {
-public:
- virtual int countFields();
- virtual void getFieldName(int index, SkString* field);
- /** Return the index of the named field, or -1 if not found */
- virtual int findFieldIndex(const char field[]);
-
- virtual int countRecords();
- virtual void getRecord(int rowIndex, int fieldIndex, SkString* data);
-
- virtual bool prepareWidgetEvent(SkEvent*, int rowIndex);
-
- static SkListSource* Factory(const char name[]);
-};
-
-#endif
diff --git a/include/views/SkWindow.h b/include/views/SkWindow.h
deleted file mode 100644
index 5deefd5..0000000
--- a/include/views/SkWindow.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef SkWindow_DEFINED
-#define SkWindow_DEFINED
-
-#include "SkView.h"
-#include "SkBitmap.h"
-#include "SkMatrix.h"
-#include "SkRegion.h"
-#include "SkEvent.h"
-#include "SkKey.h"
-#include "SkTDArray.h"
-
-#ifdef SK_BUILD_FOR_WINCEx
- #define SHOW_FPS
-#endif
-//#define USE_GX_SCREEN
-
-class SkCanvas;
-
-class SkOSMenu;
-
-class SkWindow : public SkView {
-public:
- SkWindow();
- virtual ~SkWindow();
-
- const SkBitmap& getBitmap() const { return fBitmap; }
-
- void setConfig(SkBitmap::Config);
- void resize(int width, int height, SkBitmap::Config config = SkBitmap::kNo_Config);
- void eraseARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b);
- void eraseRGB(U8CPU r, U8CPU g, U8CPU b);
-
- bool isDirty() const { return !fDirtyRgn.isEmpty(); }
- bool update(SkIRect* updateArea, SkCanvas* = NULL);
- // does not call through to onHandleInval(), but does force the fDirtyRgn
- // to be wide open. Call before update() to ensure we redraw everything.
- void forceInvalAll();
- // return the bounds of the dirty/inval rgn, or [0,0,0,0] if none
- const SkIRect& getDirtyBounds() const { return fDirtyRgn.getBounds(); }
-
- bool handleClick(int x, int y, Click::State);
- bool handleChar(SkUnichar);
- bool handleKey(SkKey);
- bool handleKeyUp(SkKey);
- bool handleMenu(uint32_t os_cmd);
-
- void addMenu(SkOSMenu*);
-
- const char* getTitle() const { return fTitle.c_str(); }
- void setTitle(const char title[]);
-
- const SkMatrix& getMatrix() const { return fMatrix; }
- void setMatrix(const SkMatrix&);
- void preConcat(const SkMatrix&);
- void postConcat(const SkMatrix&);
-
-protected:
- virtual bool onEvent(const SkEvent&);
-
- // called if part of our bitmap is invalidated
- virtual void onHandleInval(const SkIRect&);
- virtual bool onHandleChar(SkUnichar);
- virtual bool onHandleKey(SkKey);
- virtual bool onHandleKeyUp(SkKey);
- virtual void onAddMenu(const SkOSMenu*) {}
- virtual void onSetTitle(const char title[]) {}
-
- // overrides from SkView
- virtual bool handleInval(const SkRect*);
- virtual bool onGetFocusView(SkView** focus) const;
- virtual bool onSetFocusView(SkView* focus);
-
-private:
- SkBitmap::Config fConfig;
- SkBitmap fBitmap;
- SkRegion fDirtyRgn;
- Click* fClick; // to track clicks
-
- SkTDArray<SkOSMenu*> fMenus;
-
- SkView* fFocusView;
- bool fWaitingOnInval;
-
- SkString fTitle;
- SkMatrix fMatrix;
-
- typedef SkView INHERITED;
-};
-
-///////////////////////////////////////////////////////////
-
-#ifdef SK_USE_WXWIDGETS
- #include "SkOSWindow_wxwidgets.h"
-#elif defined(SK_BUILD_FOR_MAC)
- #include "SkOSWindow_Mac.h"
-#elif defined(SK_BUILD_FOR_WIN)
- #include "SkOSWindow_Win.h"
-#elif defined(SK_BUILD_FOR_UNIXx)
- #include "SkOSWindow_Unix.h"
-#elif defined(SK_BUILD_FOR_SDL)
- #include "SkOSWindow_SDL.h"
-#elif defined(SK_BUILD_FOR_IOS)
- #include "SkOSWindow_iOS.h"
-#endif
-
-#endif
-