| 1 |
#ifndef WXCBITMAPCODEGENERATOR_H |
| 2 |
#define WXCBITMAPCODEGENERATOR_H |
| 3 |
|
| 4 |
#include <asyncprocess.h> |
| 5 |
#include <macros.h> |
| 6 |
#include <wx/arrstr.h> |
| 7 |
#include <wx/event.h> |
| 8 |
#include <wx/filename.h> |
| 9 |
|
| 10 |
extern const wxEventType wxEVT_BITMAP_CODE_GENERATION_DONE; |
| 11 |
|
| 12 |
class TopLevelWinWrapper; |
| 13 |
class wxcCodeGeneratorHelper : public wxEvtHandler |
| 14 |
{ |
| 15 |
typedef std::map<wxString, wxString> MapString_t; |
| 16 |
|
| 17 |
protected: |
| 18 |
MapString_t m_bitmapMap; |
| 19 |
wxArrayString m_icons; |
| 20 |
wxFileName m_xrcFile; |
| 21 |
wxFileName m_cppFile; |
| 22 |
wxFileName m_destCPP; |
| 23 |
wxString m_wxrcOutput; |
| 24 |
wxStringSet_t m_winIds; |
| 25 |
|
| 26 |
protected: |
| 27 |
bool IsGenerateNeeded() const; |
| 28 |
|
| 29 |
private: |
| 30 |
wxcCodeGeneratorHelper(); |
| 31 |
virtual ~wxcCodeGeneratorHelper(); |
| 32 |
wxString GenerateTopLevelWindowIconCode() const; |
| 33 |
|
| 34 |
public: |
| 35 |
static wxcCodeGeneratorHelper& Get(); |
| 36 |
/** |
| 37 |
* @brief stop the worker thread |
| 38 |
*/ |
| 39 |
void UnInitialize(); |
| 40 |
|
| 41 |
void Clear(); |
| 42 |
void ClearWindowIds(); |
| 43 |
void AddIcon(const wxString& bitmapFile); |
| 44 |
void ClearIcons(); |
| 45 |
wxString AddBitmap(const wxString& bitmapFile, const wxString& name = wxEmptyString); |
| 46 |
void AddWindowId(const wxString& winid); |
| 47 |
bool CreateXRC(); |
| 48 |
wxString GenerateInitCode(TopLevelWinWrapper* tw) const; |
| 49 |
wxString GenerateExternCode() const; |
| 50 |
wxString GenerateWinIdEnum() const; |
| 51 |
wxString BitmapCode(const wxString& bmp, const wxString& bmpname = wxEmptyString) const; |
| 52 |
bool Contains(const wxString& bmp) const { return m_bitmapMap.count(bmp); } |
| 53 |
}; |
| 54 |
|
| 55 |
#endif // WXCBITMAPCODEGENERATOR_H |