MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / onMouseUp

Method onMouseUp

src/openrct2-ui/windows/LoadSave.cpp:799–901  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

797 }
798
799 void onMouseUp(WidgetIndex widgetIndex) override
800 {
801 bool isSave = action == LoadSaveAction::save;
802 switch (widgetIndex)
803 {
804 case WIDX_CLOSE:
805 InvokeCallback(ModalResult::cancel, "");
806 close();
807 break;
808
809 case WIDX_PARENT_FOLDER:
810 PopulateList(_parentDirectory, _extensionPattern);
811 initScrollWidgets();
812 numListItems = static_cast<uint16_t>(_listItems.size());
813 break;
814
815 case WIDX_NEW_FOLDER:
816 WindowTextInputRawOpen(
817 this, WIDX_NEW_FOLDER, STR_FILEBROWSER_ACTION_NEW_FOLDER, STR_FILEBROWSER_FOLDER_NAME_PROMPT, {}, "",
818 64);
819 break;
820
821 case WIDX_SYSTEM_BROWSER:
822 {
823 u8string path = OpenSystemFileBrowser(isSave, type, _directory, _defaultPath, _trackDesign);
824 if (!path.empty())
825 {
826 Select(path.c_str(), action, type, _trackDesign);
827 }
828 else
829 {
830 // If user cancels file dialog, refresh list
831 PopulateList(_directory, _extensionPattern);
832 initScrollWidgets();
833 numListItems = static_cast<uint16_t>(_listItems.size());
834 }
835 }
836 break;
837
838 case WIDX_SORT_NAME:
839 if (Config::Get().general.loadSaveSort == FileBrowserSort::nameAscending)
840 {
841 Config::Get().general.loadSaveSort = FileBrowserSort::nameDescending;
842 }
843 else
844 {
845 Config::Get().general.loadSaveSort = FileBrowserSort::nameAscending;
846 }
847 Config::Save();
848 SortList();
849 invalidate();
850 break;
851
852 case WIDX_SORT_SIZE:
853 if (Config::Get().general.loadSaveSort == FileBrowserSort::sizeDescending)
854 {
855 Config::Get().general.loadSaveSort = FileBrowserSort::sizeAscending;
856 }

Callers 1

WindowLoadSaveInputKeyFunction · 0.45

Calls 15

InvokeCallbackFunction · 0.85
WindowTextInputRawOpenFunction · 0.85
OpenSystemFileBrowserFunction · 0.85
SelectFunction · 0.85
SaveFunction · 0.85
WindowStartTextboxFunction · 0.85
WithExtensionFunction · 0.85
RemovePatternWildcardFunction · 0.85
ExistsFunction · 0.85
invalidateFunction · 0.50

Tested by

no test coverage detected