ScummVM API documentation
macwindowborder.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef GRAPHICS_MACGUI_MACWINDOWBORDER_H
23 #define GRAPHICS_MACGUI_MACWINDOWBORDER_H
24 
25 #include "common/str.h"
26 #include "common/list.h"
27 
28 #include "graphics/managed_surface.h"
29 #include "graphics/primitives.h"
30 
31 #include "image/bmp.h"
32 
33 namespace Graphics {
34 
35 class MacWindow;
36 class MacWindowManager;
37 class NinePatchBitmap;
38 
39 enum {
40  kWindowBorderActive = 1 << 0,
41  kWindowBorderTitle = 1 << 1,
42  kWindowBorderScrollbar = 1 << 2,
43 
44  kWindowBorderMaxFlag = 1 << 3
45 };
46 
47 enum {
48  kBorderScroll = 1000
49 };
50 
51 enum {
52  kWinBorderWin95Scrollbar = kBorderScroll + 0x00,
53  kWindowBorderWin95NoBorderScrollbar,
54  kWindowBorderMacOSNoBorderScrollbar
55 };
56 
57 struct BorderOffsets {
58  int left;
59  int right;
60  int top;
61  int bottom;
62  int titleTop;
63  int titleBottom;
64  bool dark;
65  int titlePos;
66  int upperScrollHeight;
67  int lowerScrollHeight;
68 };
69 
76 public:
78  ~MacWindowBorder();
79 
85  bool hasBorder(uint32 flags);
86 
94  void addBorder(ManagedSurface *source, uint32 flags, int titlePos = 0);
95 
100  bool hasOffsets() const;
101 
114  void setOffsets(int left, int right, int top, int bottom);
115  void setOffsets(Common::Rect &rect);
116  void setOffsets(const BorderOffsets &offsets);
117 
125  BorderOffsets &getOffset();
126  const BorderOffsets &getOffset() const;
127 
135  void blitBorderInto(ManagedSurface &destination, uint32 flags, MacWindowManager *wm);
136 
137  void setTitle(const Common::String& title, int width, MacWindowManager *wm);
138 
139  void setScroll(int scrollPos, int scrollSize) { _scrollPos = scrollPos, _scrollSize = scrollSize; }
140 
141  void drawTitle(ManagedSurface *g, MacWindowManager *wm, int titleOffset);
142 
143  void drawScrollBar(ManagedSurface *g, MacWindowManager *wm);
144 
145  // we should call this method as soon as the macwindowborder is constructed
146  void setWindow(MacWindow *window) { _window = window; }
147 
148  void setBorderType(int type);
149 
150  void disableBorder();
151 
152  void loadBorder(Common::SeekableReadStream &file, uint32 flags, int lo = -1, int ro = -1, int to = -1, int bo = -1);
153  void loadBorder(Common::SeekableReadStream &file, uint32 flags, BorderOffsets offsets);
154  void loadInternalBorder(uint32 flags);
155 
156  void setBorder(Graphics::ManagedSurface *surface, uint32 flags, int lo = -1, int ro = -1, int to = -1, int bo = -1);
157  void setBorder(Graphics::ManagedSurface *surface, uint32 flags, BorderOffsets offsets);
158 private:
159  int _scrollPos, _scrollSize;
160  Common::String _title;
161 
163 
164  MacWindow *_window;
165 
166  BorderOffsets _borderOffsets;
167 
168  bool _useInternalBorder;
169 
170  int _borderType;
171 };
172 
173 } // End of namespace Graphics
174 #endif
Definition: managed_surface.h:51
Definition: str.h:59
Definition: array.h:52
Definition: macwindow.h:192
Definition: rect.h:144
Definition: stream.h:745
Definition: macwindowmanager.h:148
Definition: macwindowborder.h:57
Definition: formatinfo.h:28
Definition: macwindowborder.h:75