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
33namespace Graphics {
34
35class MacWindow;
36class MacWindowManager;
37class NinePatchBitmap;
38
39enum {
40 kWindowBorderActive = 1 << 0,
41 kWindowBorderTitle = 1 << 1,
42 kWindowBorderScrollbar = 1 << 2,
43
44 kWindowBorderMaxFlag = 1 << 3
45};
46
47enum {
48 kBorderScroll = 1000
49};
50
51enum {
52 kWinBorderWin95Scrollbar = kBorderScroll + 0x00,
53 kWindowBorderWin95NoBorderScrollbar,
54 kWindowBorderMacOSNoBorderScrollbar
55};
56
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 closeButtonTop;
67 int closeButtonLeft;
68 int closeButtonWidth;
69 int resizeButtonTop;
70 int resizeButtonHeight;
71 int upperScrollHeight;
72 int lowerScrollHeight;
73 int titlePadding;
74};
75
82public:
85
91 bool hasBorder(uint32 flags);
92
100 void addBorder(ManagedSurface *source, uint32 flags, int titlePos = 0);
101
106 bool hasOffsets() const;
107
120 void setOffsets(int left, int right, int top, int bottom);
121 void setOffsets(Common::Rect &rect);
122 void setOffsets(const BorderOffsets &offsets);
123
132 const BorderOffsets &getOffset() const;
133
134 int getMinWidth(uint32 flags) const;
135 int getMinHeight(uint32 flags) const;
136
144 void blitBorderInto(ManagedSurface &destination, uint32 flags, bool maskOnly = false, uint32 maskColor = 0);
145
146 void setTitle(const Common::String& title, int width);
147
148 void setScroll(int scrollPos, int scrollSize) { _scrollPos = scrollPos, _scrollSize = scrollSize; }
149
150 void drawTitle(ManagedSurface *g, int titleOffset, int minWidth);
151
152 void drawScrollBar(ManagedSurface *g);
153
154 // we should call this method as soon as the macwindowborder is constructed
155 void setWindow(MacWindow *window) { _window = window; }
156 void setWindowManager(MacWindowManager *wm) { _wm = wm; }
157
158 void setBorderType(int type);
159
160 void disableBorder();
161
162 void loadBorder(Common::SeekableReadStream &file, uint32 flags, int lo = -1, int ro = -1, int to = -1, int bo = -1);
163 void loadBorder(Common::SeekableReadStream &file, uint32 flags, const BorderOffsets &offsets);
164 void loadInternalBorder(uint32 flags);
165
166 void setBorder(Graphics::ManagedSurface *surface, uint32 flags, int lo = -1, int ro = -1, int to = -1, int bo = -1);
167 void setBorder(Graphics::ManagedSurface *surface, uint32 flags, const BorderOffsets &offsets);
168private:
169 int _scrollPos, _scrollSize;
170 Common::String _title;
171
173
174 MacWindow *_window;
175 MacWindowManager *_wm;
176 BorderOffsets _borderOffsets;
177
178 bool _useInternalBorder;
179
180 int _borderType;
181};
182
183} // End of namespace Graphics
184#endif
Definition: array.h:52
Definition: stream.h:745
Definition: str.h:59
Definition: macwindowborder.h:81
void setOffsets(int left, int right, int top, int bottom)
void blitBorderInto(ManagedSurface &destination, uint32 flags, bool maskOnly=false, uint32 maskColor=0)
bool hasBorder(uint32 flags)
BorderOffsets & getOffset()
void addBorder(ManagedSurface *source, uint32 flags, int titlePos=0)
Definition: macwindow.h:205
Definition: managed_surface.h:51
Definition: formatinfo.h:28
Definition: rect.h:536
Definition: macwindowborder.h:57