22 #ifndef GUI_WIDGETS_GRID_H 23 #define GUI_WIDGETS_GRID_H 25 #include "gui/dialog.h" 26 #include "gui/widgets/scrollbar.h" 27 #include "common/str.h" 30 #include "image/png.h" 31 #include "graphics/svg.h" 35 class ScrollBarWidget;
41 kPlayButtonCmd =
'PLAY',
42 kEditButtonCmd =
'EDIT',
43 kLoadButtonCmd =
'LOAD',
44 kOpenTrayCmd =
'OPTR',
45 kItemClicked =
'LBX1',
46 kItemDoubleClickedCmd =
'LBX2',
52 bool isHeader, validEntry;
70 : entryID(
id), gameid(gid), engineid(eid), title(t), description(d), extra(e), language(l), platform(p), validEntry(v), canLoadGame(cl), isHeader(
false) {
75 isHeader(
true), validEntry(
true), entryID(groupID), language(Common::UNK_LANG), platform(Common::kPlatformUnknown) {
92 void enableLoadButton(
bool canLoad) { _loadButton->setEnabled(canLoad); }
94 void reflowLayout()
override;
96 void receivedFocus(
int x = -1,
int y = -1)
override;
97 void handleCommand(
CommandSender *sender, uint32 cmd, uint32 data)
override;
98 void handleMouseDown(
int x,
int y,
int button,
int clickCount)
override;
99 void handleMouseUp(
int x,
int y,
int button,
int clickCount)
override;
100 void handleMouseWheel(
int x,
int y,
int direction)
override;
101 void handleMouseMoved(
int x,
int y,
int button)
override;
141 int _scrollWindowHeight;
142 int _scrollWindowWidth;
147 int _thumbnailHeight;
151 int _platformIconHeight;
152 int _platformIconWidth;
153 int _extraIconHeight;
155 int _minGridXSpacing;
156 int _minGridYSpacing;
159 int _firstVisibleItem;
160 int _lastVisibleItem;
163 int _scrollWindowPaddingX;
164 int _scrollWindowPaddingY;
165 int _gridHeaderHeight;
166 int _gridHeaderWidth;
169 bool _multiSelectEnabled;
172 void *_filterMatcherArg;
177 bool _selectionPending;
178 int _dragStartY, _dragLastY;
179 uint32 _mouseDownTime;
180 static const int kDragThreshold = 5;
190 int _thumbnailMargin;
192 bool _isTitlesVisible;
208 bool calcVisibleEntries();
212 void setTitlesVisible(
bool vis);
213 void markGridAsInvalid() { _isGridInvalid =
true; }
218 bool groupExpanded(
int groupID) {
return _groupExpanded[groupID]; }
219 void toggleGroup(
int groupID);
223 void reloadThumbnails();
224 void loadFlagIcons();
225 void loadPlatformIcons();
226 void loadExtraIcons();
229 void calcInnerHeight();
230 void calcEntrySizes();
232 void move(
int x,
int y);
233 void scrollToEntry(
int id,
bool forceToTop);
234 void assignEntriesToItems();
236 int getItemPos(
int item);
237 int getNewSel(
int index);
238 int getVisualPos(
int entryID)
const;
239 void selectVisualRange(
int startPos,
int endPos);
240 float getScrollPos()
const {
return _scrollPos; }
241 int getSelected()
const {
return ((_selectedEntry ==
nullptr) ? -1 : _selectedEntry->entryID); }
242 int getThumbnailHeight()
const {
return _thumbnailHeight; }
243 int getThumbnailWidth()
const {
return _thumbnailWidth; }
245 void handleMouseWheel(
int x,
int y,
int direction)
override;
246 void handleMouseDown(
int x,
int y,
int button,
int clickCount)
override;
247 void handleMouseUp(
int x,
int y,
int button,
int clickCount)
override;
248 void handleMouseMoved(
int x,
int y,
int button)
override;
249 void handleTickle()
override;
250 void applyScrollPos();
251 void handleCommand(
CommandSender *sender, uint32 cmd, uint32 data)
override;
252 void reflowLayout()
override;
254 bool wantsFocus()
override {
return true; }
256 void lostFocusWidget()
override;
259 void openTrayAtSelected();
260 void scrollBarRecalc();
262 void setSelected(
int id);
264 void setFilterMatcher(FilterMatcher matcher,
void *arg) { _filterMatcher = matcher; _filterMatcherArg = arg; }
267 void setMultiSelectEnabled(
bool enabled) { _multiSelectEnabled = enabled; }
268 bool isMultiSelectEnabled()
const {
return _multiSelectEnabled; }
270 int _lastSelectedEntryID = -1;
271 bool isItemSelected(
int entryID)
const;
272 void markSelectedItem(
int entryID,
bool state);
273 void clearSelection();
281 Graphics::AlphaType _thumbAlpha;
290 void move(
int x,
int y);
295 void drawWidget()
override;
297 void handleMouseWheel(
int x,
int y,
int direction)
override;
298 void handleMouseEntered(
int button)
override;
299 void handleMouseLeft(
int button)
override;
300 void handleMouseDown(
int x,
int y,
int button,
int clickCount)
override;
301 void handleMouseUp(
int x,
int y,
int button,
int clickCount)
override;
302 void handleMouseMoved(
int x,
int y,
int button)
override;
static String format(MSVC_PRINTF const char *fmt,...) GCC_PRINTF(1
Definition: printman.h:30
Out move(In first, In last, Out dst)
Definition: algorithm.h:109
Definition: keyboard.h:294
Language
Definition: language.h:45