Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ImageCanvasRectangularSelection.hh
1 #ifndef __ImageCanvasRectangularSelection_hh__
2 #define __ImageCanvasRectangularSelection_hh__
3 
4 #include "ImageCanvas.hh"
5 #include <Gui/StringConv.hh>
6 
7 namespace BIAS {
8 
9  /** @class ICECallbackInterface
10  @ingroup g_gui
11  @brief callback interface for ImageCanvasExtended
12 
13  instructions:
14  derive your class e.g. MyFrame from ICECallBackInterface
15  and override the method RectangleSelected(...)to react to a finished
16  selection of a rectangle
17 
18  also declare a pointer to ImageCanvas Enhanced, e.g.
19  ImageCanvasRectangularSelection *_ic;
20 
21 
22  to select a rectangle then call
23  _ic->SelectRectangle(*this);
24  where *this is a reference to a ICECallBackInterface
25  (if your class is derived from ICECallBackInterface this is *this)
26 
27  @author woelk 08/2004*/
28  class BIASGui_EXPORT ICECallbackInterface{
29  public:
31  virtual ~ICECallbackInterface();
32  /// this function should be overloaded
33  virtual void RectangleSelected(int tl[2], int br[2]);
34  };
35 
36  /** @class ImageCanvasRectangularSelection
37  @ingroup g_gui
38  @brief provides functionality for selection of rectangle, point, ...
39 
40 
41 
42  @author woelk 08/2004 */
43  class BIASGui_EXPORT ImageCanvasRectangularSelection : public ImageCanvas
44  {
45  public:
46  ImageCanvasRectangularSelection(wxWindow* parent, wxStatusBar* sbar=NULL,
47  int sbarid=0, wxWindowID id = -1,
48  const wxPoint& pos = wxDefaultPosition,
49  const wxSize& size = wxSize(320, 240),
50  long style = wxHSCROLL | wxVSCROLL,
51  const wxString& name = AsciiToWx("ScrolledWindow"));
53 
54  /** Call SelectRectangle with an object derived from ICECallbackInterface.
55  The function RectangleSelected() should be overloaded in this object.
56  After rectangle selection is finished (2 clicks with left mouse,
57  right button cancels) the function obj.RectangleSelected() is called
58  with top left (tl) and bottom right (br) coordinates.
59  @author woelk 08/2004 */
60  void SelectRectangle(ICECallbackInterface& obj);
61 
62  virtual void OnLeftMouseButton(wxMouseEvent &event);
63  virtual void OnMouseMove(wxMouseEvent &event);
64  virtual void OnRightMouseButton(wxMouseEvent &event);
65  virtual void OnPaint(wxPaintEvent& event);
66 
67  protected:
69  int TopLeft_[2], BottomRight_[2];
71 
73 
74  void DrawRectangle_(int tl[2], int br[2]);
75 
76  void RefreshDrawImage_();
77 
78  DECLARE_EVENT_TABLE()
79  }; // class
80 
81 } // namespace
82 
83 #endif // __ImageCanvasRectangularSelection_hh__
wxString AsciiToWx(const char *thestring)
Converts a C string to a wxString.
Definition: StringConv.hh:32
provides functionality for selection of rectangle, point, ...
display image in wx application, provides zoom and investigation functionality
Definition: ImageCanvas.hh:38
callback interface for ImageCanvasExtended