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;
191 int _thumbnailMargin;
193 bool _isTitlesVisible;
209 bool calcVisibleEntries();
213 void setTitlesVisible(
bool vis);
214 void markGridAsInvalid() { _isGridInvalid =
true; }
219 bool groupExpanded(
int groupID) {
return _groupExpanded[groupID]; }
220 void toggleGroup(
int groupID);
224 void reloadThumbnails();
225 void loadFlagIcons();
226 void loadPlatformIcons();
227 void loadExtraIcons();
230 void calcInnerHeight();
231 void calcEntrySizes();
233 void move(
int x,
int y);
234 void scrollToEntry(
int id,
bool forceToTop);
235 void assignEntriesToItems();
237 int getItemPos(
int item);
238 int getNewSel(
int index);
239 int getVisualPos(
int entryID)
const;
240 void selectVisualRange(
int startPos,
int endPos);
241 float getScrollPos()
const {
return _scrollPos; }
242 int getSelected()
const {
return ((_selectedEntry ==
nullptr) ? -1 : _selectedEntry->entryID); }
243 int getThumbnailHeight()
const {
return _thumbnailHeight; }
244 int getThumbnailWidth()
const {
return _thumbnailWidth; }
246 void handleMouseWheel(
int x,
int y,
int direction)
override;
247 void handleMouseDown(
int x,
int y,
int button,
int clickCount)
override;
248 void handleMouseUp(
int x,
int y,
int button,
int clickCount)
override;
249 void handleMouseMoved(
int x,
int y,
int button)
override;
250 void handleTickle()
override;
251 void applyScrollPos();
252 void handleCommand(
CommandSender *sender, uint32 cmd, uint32 data)
override;
253 void reflowLayout()
override;
255 bool wantsFocus()
override {
return true; }
257 void lostFocusWidget()
override;
260 void openTrayAtSelected();
261 void scrollBarRecalc();
263 void setSelected(
int id);
265 void setFilterMatcher(FilterMatcher matcher,
void *arg) { _filterMatcher = matcher; _filterMatcherArg = arg; }
268 void setMultiSelectEnabled(
bool enabled) { _multiSelectEnabled = enabled; }
269 bool isMultiSelectEnabled()
const {
return _multiSelectEnabled; }
271 int _lastSelectedEntryID = -1;
272 bool isItemSelected(
int entryID)
const;
273 void markSelectedItem(
int entryID,
bool state);
274 void clearSelection();
282 Graphics::AlphaType _thumbAlpha;
291 void move(
int x,
int y);
296 void drawWidget()
override;
298 void handleMouseWheel(
int x,
int y,
int direction)
override;
299 void handleMouseEntered(
int button)
override;
300 void handleMouseLeft(
int button)
override;
301 void handleMouseDown(
int x,
int y,
int button,
int clickCount)
override;
302 void handleMouseUp(
int x,
int y,
int button,
int clickCount)
override;
303 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