2
* Copyright (C) 2006 The Android Open Source Project
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
17
#ifndef SkWindow_DEFINED
18
#define SkWindow_DEFINED
25
#include "SkTDArray.h"
27
#ifdef SK_BUILD_FOR_WINCEx
30
//#define USE_GX_SCREEN
34
class SkWindow : public SkView {
39
const SkBitmap& getBitmap() const { return fBitmap; }
41
void setConfig(SkBitmap::Config);
42
void resize(int width, int height, SkBitmap::Config config = SkBitmap::kNo_Config);
43
void eraseARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b);
44
void eraseRGB(U8CPU r, U8CPU g, U8CPU b);
46
bool isDirty() const { return !fDirtyRgn.isEmpty(); }
47
bool update(SkIRect* updateArea);
48
bool handleClick(int x, int y, Click::State);
49
bool handleChar(SkUnichar);
50
bool handleKey(SkKey);
51
bool handleKeyUp(SkKey);
52
bool handleMenu(uint32_t os_cmd);
54
void addMenu(SkOSMenu*);
56
const char* getTitle() const { return fTitle.c_str(); }
57
void setTitle(const char title[]);
60
virtual bool onEvent(const SkEvent&);
62
// called if part of our bitmap is invalidated
63
virtual void onHandleInval(const SkIRect&);
64
virtual bool onHandleChar(SkUnichar);
65
virtual bool onHandleKey(SkKey);
66
virtual bool onHandleKeyUp(SkKey);
67
virtual void onAddMenu(const SkOSMenu*) {}
68
virtual void onSetTitle(const char title[]) {}
70
// overrides from SkView
71
virtual bool handleInval(const SkRect&);
72
virtual bool onGetFocusView(SkView** focus) const;
73
virtual bool onSetFocusView(SkView* focus);
76
SkBitmap::Config fConfig;
79
Click* fClick; // to track clicks
81
SkTDArray<SkOSMenu*> fMenus;
88
typedef SkView INHERITED;
91
///////////////////////////////////////////////////////////
93
#ifndef SK_USE_WXWIDGETS
94
#ifdef SK_BUILD_FOR_MAC
95
#include "SkOSWindow_Mac.h"
96
#elif defined(SK_BUILD_FOR_WIN)
97
#include "SkOSWindow_Win.h"
98
#elif defined(SK_BUILD_FOR_UNIXx)
99
#include "SkOSWindow_Unix.h"
102
#include "SkOSWindow_wxwidgets.h"