diff options
Diffstat (limited to 'win32/common/droplet.h')
-rw-r--r-- | win32/common/droplet.h | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/win32/common/droplet.h b/win32/common/droplet.h new file mode 100644 index 0000000..e98725e --- /dev/null +++ b/win32/common/droplet.h @@ -0,0 +1,98 @@ +/* + * AUTHOR + * N. Nielsen + * + * LICENSE + * This software is in the public domain. + * + * The software is provided "as is", without warranty of any kind, + * express or implied, including but not limited to the warranties + * of merchantability, fitness for a particular purpose, and + * noninfringement. In no event shall the author(s) be liable for any + * claim, damages, or other liability, whether in an action of + * contract, tort, or otherwise, arising from, out of, or in connection + * with the software or the use or other dealings in the software. + * + * SUPPORT + * Send bug reports to: <nielsen@memberwebs.com> + */ + + +#ifndef __DROPLET_H__ +#define __DROPLET_H__ + + +// The resources in the droplet +#define DROP_RESOURCE_TYPE _T("REP") +#define DROP_RESOURCE_ID _T("SCRIPT") +#define DROP_RESOURCE_FILE _T("DROPLET") + +// Some extra binfile tags +#define DROPVAL_TITLE 0x0101 +#define DROPVAL_BACKUPS 0x0102 + +#include "lib/rlib.h" +#include "lib/rep.h" + + +// Droplet: --------------------------------------------------------------- +// A droplet provides the saving/loading/loaded functionality of the +// droplet. Replaces are not done here + +class Droplet +{ +public: + Droplet(); + ~Droplet(); + + // Load a droplet from a file + bool load(LPCTSTR fileName); + + // Load a droplet from a loaded executable + bool load(HMODULE module); + + // Save a droplet out to an existing executable + bool save(LPCTSTR fileName); + + + // Get the internal rlib stream + r_context& getContext() + { return m_ctx; } + + // Is there a valid script loaded + bool hasScript() + { return m_ctx.script.ops != NULL; } + + // Get dialog title stored in droplet + string getTitle() + { return m_title; } + + // Set dialog title stored in droplet + void setTitle(astring& title) + { m_title = title; } + + // Get the buffer size stored in droplet + // 0 = process entire file + size_t getBuffSize() + { return m_ctx.block; } + + // Set the buffer size to be stored in droplet + void setBuffSize(size_t buffSize) + { m_ctx.block = buffSize; } + + // Should backups be kept? + bool keepBackups() + { return m_keepBackups; } + + // Set backup options for droplet + void setBackups(bool backups) + { m_keepBackups = backups; } + +protected: + r_context m_ctx; + + astring m_title; // The dialog title + bool m_keepBackups; // Should backups be kept? +}; + +#endif //__DROPLET_H__
\ No newline at end of file |