Rigs of Rods 2023.09
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
GUI_MainSelector.h
Go to the documentation of this file.
1/*
2 This source file is part of Rigs of Rods
3 Copyright 2005-2012 Pierre-Michel Ricordel
4 Copyright 2007-2012 Thomas Fischer
5 Copyright 2013-2020 Petr Ohlidal
6
7 For more information, see http://www.rigsofrods.org/
8
9 Rigs of Rods is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License version 3, as
11 published by the Free Software Foundation.
12
13 Rigs of Rods is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
20*/
21
25
26#pragma once
27
28#include "Application.h" // Str
29#include "SimData.h" // ActorSpawnRequest
30#include "CacheSystem.h" // CacheSearchMethod
31#include "ForwardDeclarations.h"
32
33#include <map>
34
35namespace RoR {
36namespace GUI {
37
39{
40public:
41 const float LEFT_PANE_WIDTH = 250.f;
42 const float PREVIEW_SIZE_RATIO = 0.7f;
43
46
47 void Show(LoaderType type, std::string const& filter_guid = "", CacheEntryPtr advertised_entry = nullptr);
48 bool IsVisible() { return m_loader_type != LT_None; };
49 bool IsHovered() { return IsVisible() && m_is_hovered; }
50 bool m_kb_focused = true;
51 void Draw();
52 void Close();
53
54private:
56 {
57 DisplayCategory(int id, std::string const& name, size_t usage);
58
61 };
62
64 {
66
68 Str<50> sde_filetime_str; // pre-formatted
69 Str<50> sde_addtime_str; // pre-formatted
70 Str<50> sde_driveable_str; // pre-formatted
71 };
72
73 typedef std::vector<DisplayCategory> DisplayCategoryVec;
74 typedef std::vector<DisplayEntry> DisplayEntryVec;
75
76 void UpdateDisplayLists();
77 void UpdateSearchParams();
78 void Apply();
79 void Cancel();
80 void DrawAttrInt(const char* desc, int val) const;
81 void DrawAttrFloat(const char* desc, float val) const;
82 void DrawAttrSpecial(bool val, const char* label) const;
83 void DrawAttrStr(const char* desc, std::string const& str) const;
84
85 static bool ScComboItemGetter(void* data, int idx, const char** out_text);
86 static bool CatComboItemGetter(void* data, int idx, const char** out_text);
87
92 std::string m_search_string;
93 std::string m_filter_guid;
95 bool m_show_details = false;
98 bool m_is_hovered = false;
99
104
105 std::map<LoaderType, int> m_last_selected_category;
106 std::map<LoaderType, int> m_last_selected_cid;
107 std::map<LoaderType, int> m_last_selected_entry;
108};
109
110} // namespace GUI
111} // namespace RoR
Central state/object manager and communications hub.
A database of user-installed content alias 'mods' (vehicles, terrains...)
Global forward declarations.
Core data structures for simulation; Everything affected by by either physics, network or user intera...
std::map< LoaderType, int > m_last_selected_category
Last category-combobox position for each loader type.
std::string m_filter_guid
Used for skins.
std::map< LoaderType, int > m_last_selected_entry
Stores the last manually selected entry index for each loader type.
static bool CatComboItemGetter(void *data, int idx, const char **out_text)
CacheEntryPtr m_advertised_entry
Always shown on top, even if not existing in modcache (i.e. dummy default skin)
DisplayEntryVec m_display_entries
CacheSearchMethod m_search_method
int m_selected_cid
Category ID.
DisplayCategoryVec m_display_categories
void DrawAttrInt(const char *desc, int val) const
void DrawAttrStr(const char *desc, std::string const &str) const
void DrawAttrFloat(const char *desc, float val) const
std::map< LoaderType, int > m_last_selected_cid
Last selected category-ID for each loader type.
static bool ScComboItemGetter(void *data, int idx, const char **out_text)
std::vector< DisplayEntry > DisplayEntryVec
void DrawAttrSpecial(bool val, const char *label) const
void Show(LoaderType type, std::string const &filter_guid="", CacheEntryPtr advertised_entry=nullptr)
int m_selected_category
Combobox position (uses display list)
std::vector< DisplayCategory > DisplayCategoryVec
Wrapper for classic c-string (local buffer) Refresher: strlen() excludes '\0' terminator; strncat() A...
Definition Str.h:36
LoaderType
< Search mode for ModCache::Query() & Operation mode for GUI::MainSelector
@ LT_None
CacheSearchMethod
@ NONE
Ignore the search string and find all.
Str< 50 > sde_addtime_str
CacheEntryPtr sde_entry
Str< 50 > sde_filetime_str
Str< 50 > sde_driveable_str