LightWrap++
AC++wrapperfortheLightWave3DSDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
presets.h
Go to the documentation of this file.
1
#ifndef LWPP_PRESETS_H
2
#define LWPP_PRESETS_H
3
4
#include <
lwpp/io.h
>
5
#include <
lwpp/wrapper.h
>
6
#include <
lwpp/message.h
>
7
#include <
lwpp/file_request.h
>
8
9
namespace
lwpp
10
{
11
class
PresetHandler
12
{
13
public
:
14
virtual
~PresetHandler
() {}
15
virtual
LWError
LoadPreset
(
lwpp::LoadState
& ss) = 0;
16
virtual
LWError
SavePreset
(
lwpp::SaveState
& ls) = 0;
17
};
18
19
class
PresetEntry
20
{
21
std::string name;
22
std::string filename;
23
std::string gui_name;
24
std::string catName;
25
public
:
26
static
int
longest
;
27
PresetEntry
(
const
char
*f,
const
char
*n, std::string tName);
28
const
char
*
GetName
() {
return
name.c_str();}
29
const
char
*
GetGuiName
();
30
const
char
*
GetFileName
() {
return
filename.c_str();}
31
};
32
33
class
PresetCollection
:
public
PopUpCallback
,
public
std::vector<PresetEntry>
34
{
35
protected
:
36
virtual
size_t
popCount
(
void
);
37
virtual
const
char
*
popName
(
int
n);
38
public
:
39
static
bool
showDecorated
;
40
void
AddEntry
(
const
char
*file,
const
char
*name, std::string type)
41
{
42
push_back(
PresetEntry
(file, name, type));
43
}
44
const
char
*
GetName
(
int
n) {
return
popName
(n);}
45
};
46
47
class
SimplePreset
:
public
PopUpCallback
,
public
PopCmdCallback
<SimplePreset>
48
{
49
const
char
*plug_name;
50
const
char
*plug_type;
51
PresetHandler
*handler;
52
int
controlID;
53
PresetCollection
Presets;
54
XPanel
xpanel;
55
FileRequest2
loadReq, saveReq;
56
bool
isPreset(std::string filename);
57
protected
:
58
virtual
size_t
popCount
(
void
);
59
virtual
const
char
*
popName
(
int
n);
60
void
ScanPresets
(std::string path);
61
void
doLoadPreset
(
const
char
*filename,
bool
quiet =
false
);
62
void
doSavePreset
();
63
void
doDeletePreset
();
64
void
doSaveAsPreset
();
65
void
doLoadFromPreset
();
66
LWError
LoadPreset
(
lwpp::LoadState
& ss, std::string &name);
67
LWError
SavePreset
(
lwpp::SaveState
& ls, std::string name);
68
std::string
makeFileName
(std::string name,
int
type);
69
std::string
makeFilePath
(std::string name);
70
std::string
grabPresetName
(std::string filename, std::string name);
71
public
:
72
SimplePreset
(
const
char
*type,
const
char
*name);
73
void
SetHandler
(
PresetHandler
*inst);
74
LWError
Setup
(
XPanel
& panel,
int
control);
75
virtual
void
popCommand
(
int
cid,
int
cmd);
76
};
77
}
78
79
#endif // LWPP_PRESETS_H
include
lwpp
presets.h
Generated on Wed Sep 19 2012 18:30:23 for LightWrap++ by
1.8.1.1