// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
-#ifndef AUTOCAP_H
-#define AUTOCAP_H
+#ifndef _AUTOCAPTURE_H_
+#define _AUTOCAPTURE_H_
-#include <wx/notebook.h>
-#include <wx/settings.h>
#include <vector>
#include <ctime>
-// Global helper functions. to take screenshot for a rect region
-wxBitmap Capture(wxRect rect);
-wxBitmap Capture(int x, int y, int width, int height);
+#include <wx/notebook.h>
+
+// TODO: document what these flags mean
enum AdjustFlags
{
AJ_Normal = 0,
class AutoCaptureMechanism
{
public:
- AutoCaptureMechanism(wxNotebook * notebook,
+ AutoCaptureMechanism(wxNotebook *notebook,
wxString directory = wxT("screenshots"),
int border = 5)
: m_notebook(notebook), m_dir(directory), m_border(border) {}
m_controlList.push_back(Control(0, wxT(""), AJ_TurnPage));
}
+ // capture all controls of the associated notebook
void CaptureAll();
-protected: // internal utils
+ // take a screenshot only of the given rect
+ // delay is only useful for Mac, for fixing a delay bug
+ static wxBitmap Capture(wxRect rect, int delay = 0);
+ static wxBitmap Capture(int x, int y, int width, int height, int delay = 0);
+
+ static void Delay(int seconds);
+
+
+private: // internal utils
struct Control
{
Control() {}
wxBitmap Capture(Control & ctrl);
- //if AJ_RegionAdjust is specified, the following line will use the label trick to adjust
- //the region position and size
+ // if AJ_RegionAdjust is specified, the following line will use the label
+ // trick to adjust the region position and size
wxRect GetRect(wxWindow* ctrl, int flag);
- //put the control back after the label trick(Using reparent/resizer approach)
+ // put the control back after the label trick(Using reparent/resizer approach)
void PutBack(wxWindow * ctrl);
wxBitmap Union(wxBitmap pic1, wxBitmap pic2);
void Save(wxBitmap screenshot, wxString fileName);
-private:
typedef std::vector<Control> ControlList;
ControlList m_controlList;
int m_border;
};
-#endif // AUTOCAP_H
+#endif // _AUTOCAPTURE_H_