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 closeButtonTop;
67  int closeButtonLeft;
68  int closeButtonWidth;
69  int resizeButtonTop;
70  int resizeButtonHeight;
71  int upperScrollHeight;
72  int lowerScrollHeight;
73 };
74 
81 public:
83  ~MacWindowBorder();
84 
90  bool hasBorder(uint32 flags);
91 
99  void addBorder(ManagedSurface *source, uint32 flags, int titlePos = 0);
100 
105  bool hasOffsets() const;
106 
119  void setOffsets(int left, int right, int top, int bottom);
120  void setOffsets(Common::Rect &rect);
121  void setOffsets(const BorderOffsets &offsets);
122 
130  BorderOffsets &getOffset();
131  const BorderOffsets &getOffset() const;
132 
133  int getMinWidth(uint32 flags) const;
134  int getMinHeight(uint32 flags) const;
135 
143  void blitBorderInto(ManagedSurface &destination, uint32 flags);
144 
145  void setTitle(const Common::String& title, int width);
146 
147  void setScroll(int scrollPos, int scrollSize) { _scrollPos = scrollPos, _scrollSize = scrollSize; }
148 
149  void drawTitle(ManagedSurface *g, int titleOffset, int minWidth);
150 
151  void drawScrollBar(ManagedSurface *g);
152 
153  // we should call this method as soon as the macwindowborder is constructed
154  void setWindow(MacWindow *window) { _window = window; }
155  void setWindowManager(MacWindowManager *wm) { _wm = wm; }
156 
157  void setBorderType(int type);
158 
159  void disableBorder();
160 
161  void loadBorder(Common::SeekableReadStream &file, uint32 flags, int lo = -1, int ro = -1, int to = -1, int bo = -1);
162  void loadBorder(Common::SeekableReadStream &file, uint32 flags, const BorderOffsets &offsets);
163  void loadInternalBorder(uint32 flags);
164 
165  void setBorder(Graphics::ManagedSurface *surface, uint32 flags, int lo = -1, int ro = -1, int to = -1, int bo = -1);
166  void setBorder(Graphics::ManagedSurface *surface, uint32 flags, const BorderOffsets &offsets);
167 private:
168  int _scrollPos, _scrollSize;
169  Common::String _title;
170 
172 
173  MacWindow *_window;
174  MacWindowManager *_wm;
175  BorderOffsets _borderOffsets;
176 
177  bool _useInternalBorder;
178 
179  int _borderType;
180 };
181 
182 } // End of namespace Graphics
183 #endif
Definition: managed_surface.h:51
Definition: str.h:59
Definition: array.h:52
Definition: macwindow.h:192
Definition: rect.h:524
Definition: stream.h:745
Definition: macwindowmanager.h:147
Definition: macwindowborder.h:57
Definition: formatinfo.h:28
Definition: macwindowborder.h:80