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;
40 kPlayButtonCmd =
'PLAY',
41 kEditButtonCmd =
'EDIT',
42 kLoadButtonCmd =
'LOAD',
43 kOpenTrayCmd =
'OPTR',
44 kItemClicked =
'LBX1',
45 kItemDoubleClickedCmd =
'LBX2',
51 bool isHeader, validEntry;
68 : entryID(
id), gameid(gid), engineid(eid), title(t), description(d), extra(e), language(l), platform(p), validEntry(v), isHeader(
false) {
73 isHeader(
true), validEntry(
true), entryID(groupID), language(Common::UNK_LANG), platform(Common::kPlatformUnknown) {
89 void reflowLayout()
override;
91 void handleCommand(
CommandSender *sender, uint32 cmd, uint32 data)
override;
92 void handleMouseDown(
int x,
int y,
int button,
int clickCount)
override;
93 void handleMouseUp(
int x,
int y,
int button,
int clickCount)
override;
94 void handleMouseWheel(
int x,
int y,
int direction)
override;
95 void handleMouseMoved(
int x,
int y,
int button)
override;
134 int _scrollWindowHeight;
135 int _scrollWindowWidth;
140 int _thumbnailHeight;
144 int _platformIconHeight;
145 int _platformIconWidth;
146 int _extraIconHeight;
148 int _minGridXSpacing;
149 int _minGridYSpacing;
152 int _firstVisibleItem;
153 int _lastVisibleItem;
156 int _scrollWindowPaddingX;
157 int _scrollWindowPaddingY;
158 int _gridHeaderHeight;
159 int _gridHeaderWidth;
162 bool _multiSelectEnabled;
165 void *_filterMatcherArg;
172 int _thumbnailMargin;
174 bool _isTitlesVisible;
193 bool calcVisibleEntries();
197 void setTitlesVisible(
bool vis);
198 void markGridAsInvalid() { _isGridInvalid =
true; }
203 bool groupExpanded(
int groupID) {
return _groupExpanded[groupID]; }
204 void toggleGroup(
int groupID);
208 void reloadThumbnails();
209 void loadFlagIcons();
210 void loadPlatformIcons();
211 void loadExtraIcons();
214 void calcInnerHeight();
215 void calcEntrySizes();
217 void move(
int x,
int y);
218 void scrollToEntry(
int id,
bool forceToTop);
219 void assignEntriesToItems();
221 int getItemPos(
int item);
222 int getNewSel(
int index);
223 int getVisualPos(
int entryID)
const;
224 void selectVisualRange(
int startPos,
int endPos);
225 int getScrollPos()
const {
return _scrollPos; }
226 int getSelected()
const {
return ((_selectedEntry ==
nullptr) ? -1 : _selectedEntry->entryID); }
227 int getThumbnailHeight()
const {
return _thumbnailHeight; }
228 int getThumbnailWidth()
const {
return _thumbnailWidth; }
230 void handleMouseWheel(
int x,
int y,
int direction)
override;
231 void handleCommand(
CommandSender *sender, uint32 cmd, uint32 data)
override;
232 void reflowLayout()
override;
234 bool wantsFocus()
override {
return true; }
238 void openTrayAtSelected();
239 void scrollBarRecalc();
241 void setSelected(
int id);
243 void setFilterMatcher(FilterMatcher matcher,
void *arg) { _filterMatcher = matcher; _filterMatcherArg = arg; }
246 void setMultiSelectEnabled(
bool enabled) { _multiSelectEnabled = enabled; }
247 bool isMultiSelectEnabled()
const {
return _multiSelectEnabled; }
249 int _lastSelectedEntryID = -1;
250 bool isItemSelected(
int entryID)
const;
251 void markSelectedItem(
int entryID,
bool state);
252 void clearSelection();
260 Graphics::AlphaType _thumbAlpha;
269 void move(
int x,
int y);
274 void drawWidget()
override;
276 void handleMouseWheel(
int x,
int y,
int direction)
override;
277 void handleMouseEntered(
int button)
override;
278 void handleMouseLeft(
int button)
override;
279 void handleMouseDown(
int x,
int y,
int button,
int clickCount)
override;
280 void handleMouseMoved(
int x,
int y,
int button)
override;
Definition: managed_surface.h:51
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