Ctrl: FileSel::NoExeIcons

This commit is contained in:
Mirek Fidler 2022-05-19 10:26:09 +02:00
parent 87c6a9396c
commit a066fe7773
5 changed files with 34 additions and 1 deletions

View file

@ -922,7 +922,8 @@ void FileSel::SearchLoad()
SortBy(list, ~sortby);
Update();
#ifdef GUI_WIN
lazyicons.Start(list, d, WhenIcon);
if(!noexeicons)
lazyicons.Start(list, d, WhenIcon);
#endif
StartLI();
}
@ -2374,6 +2375,7 @@ FileSel::FileSel()
multi = false;
bidname = false;
appmodal = true;
noexeicons = false;
AddChildBefore(GetFirstChild(), &sizegrip);

View file

@ -224,6 +224,7 @@ protected:
bool bidname;
bool appmodal;
bool loaded;
bool noexeicons;
Ctrl *file_ctrl = NULL;
int file_ctrl_cx;
@ -355,6 +356,7 @@ public:
FileSel& FileCtrl(Ctrl& ext, int cx) { file_ctrl = &ext; file_ctrl_cx = cx; return *this; }
FileSel& FileCtrl(Ctrl& ext) { return FileCtrl(ext, ext.GetMinSize().cx); }
FileSel& DefaultName(const String& s) { default_name = s; return *this; }
FileSel& NoExeIcons(bool b = true) { noexeicons = b; return *this; }
FileSel();
virtual ~FileSel();

View file

@ -332,4 +332,11 @@ the width from GetMinSize().&]
]_[*@3 s])&]
[s2;%% Specifies the default name for Save As operation.&]
[s3;%% &]
[s4; &]
[s5;:Upp`:`:FileSel`:`:NoExeIcons`(bool`): [_^Upp`:`:FileSel^ FileSel][@(0.0.255) `&]_[* No
ExeIcons]([@(0.0.255) bool]_[*@3 b]_`=_[@(0.0.255) true])&]
[s2;%% In Win32 environment, FileSel is using background thread to
load icons from .exe files. In some contexts, this can be causing
problems. NoExeIcons suppresses loading of this information.&]
[s3;%% &]
[s3;%% ]]

View file

@ -0,0 +1,9 @@
uses
CtrlLib;
file
main.cpp;
mainconfig
"" = "GUI";

View file

@ -0,0 +1,13 @@
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
GUI_APP_MAIN
{
FileSel sel;
sel.Type("all", "*.*");
sel.NoExeIcons();
sel.ExecuteSaveAs();
sel.NoExeIcons(false);
sel.ExecuteSaveAs();
}