00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012 #ifndef _WX_IA_H_
00013 #define _WX_IA_H_
00014
00015 #ifdef __GNUG__
00016 #pragma interface "ia.h"
00017 #endif
00018
00019 #include "wx/confbase.h"
00020
00024
00025
00027 enum wxIAReturnCode
00028 {
00030 wxIA_RC_SUCCESS = 0,
00032 wxIA_RC_UNKNOWNERROR,
00034 wxIA_RC_NOTSUPPORTED,
00036 wxIA_RC_CANCELLED,
00038 wxIA_RC_NOTREADY,
00040 wxIA_RC_DEVICEBUSY,
00042 wxIA_RC_INVAL,
00044 wxIA_RC_JAMMED,
00046 wxIA_RC_NODOCS,
00048 wxIA_RC_COVEROPEN,
00050 wxIA_RC_IOERROR,
00052 wxIA_RC_NOMEM,
00054 wxIA_RC_ACCESSDENIED,
00056 wxIA_RC_NOSOURCE,
00058 wxIA_RC_NOTINITIALIZED,
00059 };
00060
00062
00064 enum wxIASourceType
00065 {
00067 wxIA_SOURCE_UNKNOWN = 0,
00069 wxIA_SOURCE_SCANNER,
00071 wxIA_SOURCE_FLATBEDSCANNER,
00073 wxIA_SOURCE_FILMSCANNER,
00075 wxIA_SOURCE_STILLCAMERA,
00077 wxIA_SOURCE_VIDEOCAMERA,
00079 wxIA_SOURCE_FILE,
00081 wxIA_SOURCE_IMAGEBASE,
00083 wxIA_SOURCE_FRAMEGRABBER,
00085 wxIA_SOURCE_MULTIFUNCTION,
00087 wxIA_SOURCE_SHEETFEDSCANNER,
00089 wxIA_SOURCE_HANDHELDSCANNER,
00090 };
00091
00093
00095 enum wxIAUIMode
00096 {
00098 wxIA_UIMODE_NONE = 0,
00100 wxIA_UIMODE_NORMAL,
00101 };
00102
00104
00106 enum wxIATransferMode
00107 {
00109
00114 wxIA_TRANSFERMODE_NATIVE = 0,
00116
00119 wxIA_TRANSFERMODE_BUFFER,
00121 wxIA_TRANSFERMODE_FILE,
00122 };
00123
00125 enum wxIATransferFileType
00126 {
00128 wxIA_FILETYPE_JPG = 0,
00130 wxIA_FILETYPE_TIFF,
00132 wxIA_FILETYPE_BMP,
00133 };
00134
00136
00138 class wxIASourceInfo
00139 {
00140 public:
00142
00144 wxIASourceInfo();
00145
00147
00152 wxIASourceInfo(const wxString& name, const wxString& model,
00153 const wxString& vendor, wxIASourceType type);
00154
00155
00156
00157
00159
00160 \param name name of the source
00161 */
00162 void SetName(const wxString& name);
00164
00166 wxString GetName() const;
00168
00171 void SetModel(const wxString& model);
00173
00175 wxString GetModel() const;
00177
00179 void SetVendor(const wxString& vendor);
00181
00183 wxString GetVendor() const;
00185
00187 void SetType(wxIASourceType type);
00189
00191 wxIASourceType GetType() const;
00192
00193 protected:
00194 wxString m_name;
00195 wxString m_model;
00196 wxString m_vendor;
00197 wxIASourceType m_type;
00198 };
00199
00201 extern wxIASourceInfo wxNullIASourceInfo;
00202
00204
00215 class wxIAMonitor
00216 {
00217 public:
00219
00221 wxIAMonitor() {}
00223 virtual ~wxIAMonitor() {}
00224
00226
00241 virtual bool Update(const wxString& text, const off_t quantum, const off_t span) = 0;
00242 };
00243
00245
00257 class wxIAProvider : public wxObject
00258 {
00259 public:
00261
00263 wxIAProvider();
00264
00266 virtual ~wxIAProvider();
00267
00273 virtual bool Ok();
00274
00276
00278 virtual wxString GetName();
00279
00281
00286 virtual int GetSourceCount();
00287
00295 virtual wxIASourceInfo GetSourceInfo(int i);
00296
00313 virtual wxIAReturnCode SelectSource(const wxString& name = _T(""),
00314 wxIAUIMode uiMode = wxIA_UIMODE_NORMAL,
00315 wxWindow* parent = NULL);
00316
00322 virtual wxIAReturnCode SelectDefaultSource();
00323
00327 virtual bool IsSourceSelected();
00328
00333 virtual wxIASourceInfo GetSelSourceInfo();
00334
00336
00344 virtual wxIAReturnCode SetSelSourceConfig(const wxString& configString);
00345
00347
00351 virtual wxString GetSelSourceConfig();
00352
00354
00367 virtual wxIAReturnCode AcquireImage(wxIAUIMode uiMode = wxIA_UIMODE_NORMAL,
00368 wxWindow* parent = NULL,
00369 wxIAMonitor *mon = NULL);
00370
00372
00387 virtual wxIAReturnCode AcquireImages(int numImages,
00388 wxIAUIMode uiMode = wxIA_UIMODE_NORMAL,
00389 wxWindow *parent = NULL,
00390 wxIAMonitor* mon = NULL);
00391
00393
00403 virtual void SetEvtHandler(wxEvtHandler* evtHandler);
00404
00405
00407
00412 virtual wxIAReturnCode SetTransferMode(wxIATransferMode mode);
00413
00415
00417 virtual wxIATransferMode GetTransferMode();
00418
00420
00426 virtual wxIAReturnCode SetTransferFilename(const wxString& filename,
00427 wxIATransferFileType type);
00428
00430 virtual wxString GetTransferFilename();
00431
00433 virtual wxIATransferFileType GetTransferFileType();
00434
00436
00444 virtual wxIAReturnCode SetTransferBuffer(void* buffer, size_t size);
00445
00447
00449 virtual void* GetTransferBuffer();
00450
00452 virtual size_t GetTransferBufferSize();
00453
00455
00457 wxEvtHandler* GetEvtHandler();
00458
00460
00463 virtual wxImage GetImage();
00464
00466
00469 virtual wxBitmap GetBitmap();
00470
00472
00477 virtual bool SaveSettings(wxConfigBase* config);
00478
00480
00485 virtual bool LoadSettings(wxConfigBase* config);
00486
00487 protected:
00488 wxEvtHandler* m_evtHandler;
00489 wxIATransferMode m_transferMode;
00490 void *m_transferBuffer;
00491 size_t m_transferBufferSize;
00492 wxString m_transferFilename;
00493 wxIATransferFileType m_transferFileType;
00494
00495 private:
00496 DECLARE_CLASS(wxIAProvider)
00497 };
00498
00500 WX_DEFINE_ARRAY(wxIAProvider*, wxIAProviderPtrArray);
00501
00503
00511 class wxIAManager : public wxObject
00512 {
00513 public:
00515
00521 static wxIAManager& Get();
00522
00524
00528 void AddProvider(wxIAProvider* provider);
00529
00532 wxIAProviderPtrArray& GetProviders();
00533
00535
00541 wxIAProvider* GetDefaultProvider();
00542
00543
00544
00545
00546
00547 wxString GetReturnCodeDesc(wxIAReturnCode rc);
00548
00549 private:
00551 wxIAManager();
00553 ~wxIAManager();
00554
00555 static bool s_init;
00556 wxIAProviderPtrArray m_providers;
00557 static wxIAProvider* s_defaultProvider;
00558
00559 DECLARE_CLASS(wxIAManager)
00560 };
00561
00562 BEGIN_DECLARE_EVENT_TYPES()
00563 DECLARE_EVENT_TYPE(wxEVT_IA_GETIMAGE, 0)
00564 DECLARE_EVENT_TYPE(wxEVT_IA_UPDATE, 0)
00565 END_DECLARE_EVENT_TYPES()
00566
00568
00570 class wxIAEvent : public wxEvent
00571 {
00572 public:
00574 wxIAEvent(wxEventType type, wxIAProvider* provider);
00576 wxIAEvent(wxEventType type, wxIAProvider* provider, const wxString& text,
00577 size_t quantum, size_t span);
00578
00579 wxIAEvent(const wxIAEvent& event);
00580
00583 virtual wxIAProvider* GetProvider() { return m_provider; }
00586 virtual void SetProvider(wxIAProvider* provider) { m_provider = provider; }
00589 virtual wxString GetText() { return m_text; }
00592 virtual void SetText(const wxString& text) { m_text = text; }
00596 virtual size_t GetQuantum() { return m_quantum; }
00599 virtual void SetQuantum(size_t quantum) { m_quantum = quantum; }
00602 virtual size_t GetSpan() { return m_span; }
00605 virtual void SetSpan(size_t span) { m_span = span; }
00608 virtual bool ShouldAbort() { return m_abort; }
00613 virtual void Abort(bool val = TRUE) { m_abort = val; }
00614
00616 wxEvent *Clone(void) const { return new wxIAEvent(*this); }
00617
00618 private:
00619 wxIAProvider* m_provider;
00620 wxString m_text;
00621 size_t m_quantum;
00622 size_t m_span;
00623 bool m_abort;
00624
00625 DECLARE_DYNAMIC_CLASS(wxIAProvider)
00626 };
00627
00628 typedef void (wxEvtHandler::*wxIAEventFunction)(wxIAEvent&);
00629
00630 #define EVT_IA_GETIMAGE(func) \
00631 DECLARE_EVENT_TABLE_ENTRY(wxEVT_IA_GETIMAGE, -1, -1, \
00632 (wxObjectEventFunction) \
00633 (wxEventFunction) \
00634 (wxIAEventFunction)&func, \
00635 NULL),
00636 #define EVT_IA_UPDATE(func) \
00637 DECLARE_EVENT_TABLE_ENTRY(wxEVT_IA_UPDATE, -1, -1, \
00638 (wxObjectEventFunction) \
00639 (wxEventFunction) \
00640 (wxIAEventFunction)&func, \
00641 NULL),
00642
00643 #endif // _WX_IA_H_