mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-09-02 16:22:40 -06:00
reference: FileSelPreview example
git-svn-id: svn://ultimatepp.org/upp/trunk@2895 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
7f44542326
commit
b8453d976c
3 changed files with 44 additions and 0 deletions
13
reference/FileSelPreview/FileSelPreview.upp
Normal file
13
reference/FileSelPreview/FileSelPreview.upp
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
description "Demonstrates the file preview option of FileSel\377";
|
||||
|
||||
uses
|
||||
CtrlLib,
|
||||
plugin\jpg,
|
||||
plugin\gif;
|
||||
|
||||
file
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
6
reference/FileSelPreview/init
Normal file
6
reference/FileSelPreview/init
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef _FileSelPreview_icpp_init_stub
|
||||
#define _FileSelPreview_icpp_init_stub
|
||||
#include "CtrlLib/init"
|
||||
#include "plugin\jpg/init"
|
||||
#include "plugin\gif/init"
|
||||
#endif
|
||||
25
reference/FileSelPreview/main.cpp
Normal file
25
reference/FileSelPreview/main.cpp
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#include <CtrlLib/CtrlLib.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
class PreviewImage : public ImageCtrl {
|
||||
void SetData(const Value& val) {
|
||||
String path = val;
|
||||
if(IsNull(path.IsEmpty()))
|
||||
SetImage(Null);
|
||||
else
|
||||
SetImage(StreamRaster::LoadFileAny(~path));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
PreviewImage img;
|
||||
FileSel fs;
|
||||
|
||||
fs.Type("Image file(s)", "*.jpg *.gif *.png *.bmp");
|
||||
fs.Preview(img);
|
||||
|
||||
fs.ExecuteOpen();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue