wxIA  0.0.3
SANE / TWAIN Add-on class library for wxWidgets.
 All Classes Files Functions Variables Enumerations Enumerator Pages
ia.h
Go to the documentation of this file.
1 // Name: ia.h
3 // Purpose: wxIA - Image Acquisition Classes
4 // Author: Derry Bryson, Technology Associates, Inc.
5 // Modified by:
6 // Created: 01/08/2003
7 // RCS-ID: $Id: ia.h,v 1.2 2003/04/03 03:53:40 dbryson Exp $
8 // Copyright: (c) 2003 Derry Bryson
9 // Licence: wxWindows license
11 
12 #ifndef _WX_IA_H_
13 #define _WX_IA_H_
14 
15 #ifdef __GNUG__
16 #pragma interface "ia.h"
17 #endif
18 
19 #include "wx/confbase.h"
20 
24 
28 {
59 };
60 
62 
65 {
90 };
91 
93 
96 {
101 };
102 
104 
107 {
109 
116 
122 };
123 
126 {
133 };
134 
136 
139 {
140 public:
142 
144  wxIASourceInfo();
145 
147 
152  wxIASourceInfo(const wxString &name, const wxString &model,
153  const wxString &vendor, wxIASourceType type);
154 
155  //
156  // Accessors
157  //
159 
162  void SetName(const wxString &name);
164 
166  wxString GetName() const;
168 
171  void SetModel(const wxString &model);
173 
175  wxString GetModel() const;
177 
179  void SetVendor(const wxString &vendor);
181 
183  wxString GetVendor() const;
185 
187  void SetType(wxIASourceType type);
189 
191  wxIASourceType GetType() const;
192 
193 protected:
194  wxString m_name;
195  wxString m_model;
196  wxString m_vendor;
197  wxIASourceType m_type;
198 };
199 
202 
204 
216 {
217 public:
219 
223  virtual ~wxIAMonitor() {}
224 
226 
241  virtual bool Update(const wxString &text, const off_t quantum, const off_t span) = 0;
242 };
243 
245 
257 class wxIAProvider : public wxObject
258 {
259 public:
261 
263  wxIAProvider();
264 
266  virtual ~wxIAProvider();
267 
273  virtual bool Ok();
274 
276 
278  virtual wxString GetName();
279 
281 
286  virtual int GetSourceCount();
287 
295  virtual wxIASourceInfo GetSourceInfo(int i);
296 
313  virtual wxIAReturnCode SelectSource(const wxString& name = wxEmptyString,
314  wxIAUIMode uiMode = wxIA_UIMODE_NORMAL, wxWindow *parent = NULL);
315 
322 
326  virtual bool IsSourceSelected();
327 
333 
335 
343  virtual wxIAReturnCode SetSelSourceConfig(const wxString &configString);
344 
346 
350  virtual wxString GetSelSourceConfig();
351 
353 
367  wxWindow *parent = NULL, wxIAMonitor *mon = NULL);
368 
370 
385  virtual wxIAReturnCode AcquireImages(int numImages,
386  wxIAUIMode uiMode = wxIA_UIMODE_NORMAL, wxWindow *parent = NULL,
387  wxIAMonitor *mon = NULL);
388 
390 
400  virtual void SetEvtHandler(wxEvtHandler *evtHandler);
401 
402 
404 
410 
412 
415 
417 
423  virtual wxIAReturnCode SetTransferFilename(const wxString &filename,
424  wxIATransferFileType type);
425 
427  virtual wxString GetTransferFilename();
428 
431 
433 
441  virtual wxIAReturnCode SetTransferBuffer(void *buffer, size_t size);
442 
444 
446  virtual void *GetTransferBuffer();
447 
449  virtual size_t GetTransferBufferSize();
450 
452 
454  wxEvtHandler *GetEvtHandler();
455 
457 
460  virtual wxImage GetImage();
461 
463 
466  virtual wxBitmap GetBitmap();
467 
469 
474  virtual bool SaveSettings(wxConfigBase *config);
475 
477 
482  virtual bool LoadSettings(wxConfigBase *config);
483 
484 protected:
485  wxEvtHandler *m_evtHandler;
486  wxIATransferMode m_transferMode;
487  void *m_transferBuffer;
488  size_t m_transferBufferSize;
489  wxString m_transferFilename;
490  wxIATransferFileType m_transferFileType;
491 
492 private:
493  DECLARE_CLASS(wxIAProvider)
494 };
495 
497 WX_DEFINE_ARRAY(wxIAProvider*, wxIAProviderPtrArray);
498 
500 
508 class wxIAManager : public wxObject
509 {
510 public:
512 
518  static wxIAManager &Get();
519 
521 
525  void AddProvider(wxIAProvider *provider);
526 
529  wxIAProviderPtrArray &GetProviders();
530 
532 
539 
541 
544  wxString GetReturnCodeDesc(wxIAReturnCode rc);
545 
546 private:
548  wxIAManager();
550  ~wxIAManager();
551 
552  static bool s_init;
553  wxIAProviderPtrArray m_providers;
554  static wxIAProvider *s_defaultProvider;
555 
556  DECLARE_CLASS(wxIAManager)
557 };
558 
559 BEGIN_DECLARE_EVENT_TYPES()
560  DECLARE_EVENT_TYPE(wxEVT_IA_GETIMAGE, 0)
561  DECLARE_EVENT_TYPE(wxEVT_IA_UPDATE, 0)
562 END_DECLARE_EVENT_TYPES()
563 
565 
567 class wxIAEvent : public wxEvent
568 {
569 public:
571  wxIAEvent(wxEventType type, wxIAProvider *provider);
573  wxIAEvent(wxEventType type, wxIAProvider *provider, const wxString &text,
574  size_t quantum, size_t span);
576  wxIAEvent(const wxIAEvent& event);
577 
580  virtual wxIAProvider *GetProvider() { return m_provider; }
583  virtual void SetProvider(wxIAProvider *provider) { m_provider = provider; }
586  virtual wxString GetText() { return m_text; }
589  virtual void SetText(const wxString &text) { m_text = text; }
593  virtual size_t GetQuantum() { return m_quantum; }
596  virtual void SetQuantum(size_t quantum) { m_quantum = quantum; }
599  virtual size_t GetSpan() { return m_span; }
602  virtual void SetSpan(size_t span) { m_span = span; }
605  virtual bool ShouldAbort() { return m_abort; }
610  virtual void Abort(bool val = TRUE) { m_abort = val; }
611 
613  wxEvent *Clone(void) const { return new wxIAEvent(*this); }
614 
615 private:
616  wxIAProvider *m_provider;
617  wxString m_text;
618  size_t m_quantum;
619  size_t m_span;
620  bool m_abort;
621 };
622 
623 typedef void (wxEvtHandler::*wxIAEventFunction)(wxIAEvent&);
624 
625 #define EVT_IA_GETIMAGE(func) \
626  DECLARE_EVENT_TABLE_ENTRY(wxEVT_IA_GETIMAGE, -1, -1, \
627  (wxObjectEventFunction) \
628  (wxEventFunction) \
629  (wxIAEventFunction)&func, \
630  NULL),
631 #define EVT_IA_UPDATE(func) \
632  DECLARE_EVENT_TABLE_ENTRY(wxEVT_IA_UPDATE, -1, -1, \
633  (wxObjectEventFunction) \
634  (wxEventFunction) \
635  (wxIAEventFunction)&func, \
636  NULL),
637 
638 #endif // _WX_IA_H_
virtual bool Ok()
virtual void SetText(const wxString &text)
Definition: ia.h:589
wxIAProvider * GetDefaultProvider()
Gets the default provider.
virtual wxString GetTransferFilename()
Get the transfer file name.
virtual bool SaveSettings(wxConfigBase *config)
Save the current settings.
Operation was cancelled by user.
Definition: ia.h:36
virtual size_t GetQuantum()
Definition: ia.h:593
No source selected.
Definition: ia.h:56
wxString GetReturnCodeDesc(wxIAReturnCode rc)
Returns a string description.
void SetVendor(const wxString &vendor)
Set vendor.
Device is not ready.
Definition: ia.h:38
virtual wxIAReturnCode SetTransferBuffer(void *buffer, size_t size)
Set the transfer buffer.
TIFF.
Definition: ia.h:130
Invalid data or argument.
Definition: ia.h:42
Transfer image data by storing data in a file.
Definition: ia.h:121
virtual void SetEvtHandler(wxEvtHandler *evtHandler)
Set event handler.
virtual bool IsSourceSelected()
Multifunction device - fax/scanner/printer etc.
Definition: ia.h:85
Flatbed scanner.
Definition: ia.h:71
virtual wxString GetName()
Get name.
virtual wxIASourceInfo GetSelSourceInfo()
wxIASourceType
IA Source Types.
Definition: ia.h:64
virtual size_t GetTransferBufferSize()
Get the transfer buffer size.
wxIASourceType GetType() const
Get type.
Film scanner.
Definition: ia.h:73
wxIATransferFileType
Image transfer file type.
Definition: ia.h:125
virtual void SetProvider(wxIAProvider *provider)
Definition: ia.h:583
virtual wxIAReturnCode AcquireImages(int numImages, wxIAUIMode uiMode=wxIA_UIMODE_NORMAL, wxWindow *parent=NULL, wxIAMonitor *mon=NULL)
Acquire one or more images.
JPG - JPEG.
Definition: ia.h:128
wxIASourceInfo wxNullIASourceInfo
Null source info.
wxIATransferMode
Source Image Transfer Mode.
Definition: ia.h:106
virtual wxIATransferFileType GetTransferFileType()
Get the transfer file type.
virtual wxIAReturnCode SelectSource(const wxString &name=wxEmptyString, wxIAUIMode uiMode=wxIA_UIMODE_NORMAL, wxWindow *parent=NULL)
void AddProvider(wxIAProvider *provider)
Add a provider.
Out of memory.
Definition: ia.h:52
Sheetfed scanner.
Definition: ia.h:87
virtual void SetQuantum(size_t quantum)
Definition: ia.h:596
wxIAProviderPtrArray & GetProviders()
Video camera.
Definition: ia.h:77
virtual void Abort(bool val=TRUE)
Definition: ia.h:610
Image Acquisition Manager.
Definition: ia.h:508
Normal user interface. Provides a dialog or whatever is appropriate.
Definition: ia.h:100
static wxIAManager & Get()
Get the Image Acquistion Manager.
virtual wxIAReturnCode SetTransferMode(wxIATransferMode mode)
Set transfer mode.
wxString GetName() const
Get name.
Document feeder jammed.
Definition: ia.h:44
Image Acquisition Monitor.
Definition: ia.h:215
virtual wxIASourceInfo GetSourceInfo(int i)
Native image transfer mode.
Definition: ia.h:114
virtual void SetSpan(size_t span)
Definition: ia.h:602
virtual wxIAReturnCode SelectDefaultSource()
Provider not initialized.
Definition: ia.h:58
Image Acquisition event.
Definition: ia.h:567
Generic scanner - exact type is unknown, but it is a scanner.
Definition: ia.h:69
wxIASourceInfo()
Constructor.
virtual wxIAProvider * GetProvider()
Definition: ia.h:580
BMP - Windows/OS2 bitmap.
Definition: ia.h:132
Image file.
Definition: ia.h:79
No user interface if possible.
Definition: ia.h:98
wxEvtHandler * GetEvtHandler()
Get current event handler.
Image Acquisition Source Info.
Definition: ia.h:138
virtual ~wxIAMonitor()
Destructor.
Definition: ia.h:223
virtual wxBitmap GetBitmap()
Get the last image acquired as a wxBitmap.
Frame grabber.
Definition: ia.h:83
Scanner cover is open.
Definition: ia.h:48
WX_DEFINE_ARRAY(wxIAProvider *, wxIAProviderPtrArray)
Image Acquisition Provider Array.
virtual int GetSourceCount()
Get source count.
virtual size_t GetSpan()
Definition: ia.h:599
virtual wxIAReturnCode SetTransferFilename(const wxString &filename, wxIATransferFileType type)
Set the transfer file name.
virtual wxIAReturnCode AcquireImage(wxIAUIMode uiMode=wxIA_UIMODE_NORMAL, wxWindow *parent=NULL, wxIAMonitor *mon=NULL)
Acquire an image.
Unknown.
Definition: ia.h:67
virtual wxString GetSelSourceConfig()
Get the current configuration of the selected source.
virtual bool LoadSettings(wxConfigBase *config)
Load settings.
wxString GetModel() const
Get model.
Error during device I/O.
Definition: ia.h:50
wxString GetVendor() const
Get vendor.
virtual ~wxIAProvider()
Destructor.
virtual wxIAReturnCode SetSelSourceConfig(const wxString &configString)
Set selected source configuration.
Still camera.
Definition: ia.h:75
Unknown error.
Definition: ia.h:32
wxIAReturnCode
IA Return Codes.
Definition: ia.h:27
virtual void * GetTransferBuffer()
Get the transfer buffer.
void SetType(wxIASourceType type)
Set Type.
virtual wxIATransferMode GetTransferMode()
Get the current transfer mode.
virtual bool ShouldAbort()
Definition: ia.h:605
wxEvent * Clone(void) const
Clone.
Definition: ia.h:613
Image Acquisition Provider.
Definition: ia.h:257
Access to resource has been denied.
Definition: ia.h:54
wxIAMonitor()
Constructor.
Definition: ia.h:221
Document feeder out of documents.
Definition: ia.h:46
Handheld scanner.
Definition: ia.h:89
void SetModel(const wxString &model)
Set model.
void SetName(const wxString &name)
Set name.
wxIAUIMode
User Interface Mode.
Definition: ia.h:95
virtual bool Update(const wxString &text, const off_t quantum, const off_t span)=0
Update method.
virtual wxImage GetImage()
Get the last image aqcuired as a wxImage.
Device is busy.
Definition: ia.h:40
Transfer raw data a buffer at a time.
Definition: ia.h:119
wxIAProvider()
Constructor.
virtual wxString GetText()
Definition: ia.h:586
Operation completed successfully.
Definition: ia.h:30
ImageBase - Image data base.
Definition: ia.h:81
Operation, mode, or value not supported.
Definition: ia.h:34