Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ZoomFrame.cpp
1 #include <Base/Common/W32Compat.hh>
2 #include "ZoomFrame.hh"
3 #include <Base/Image/Image.hh>
4 #include <Gui/ZoomImageCanvas.hh>
5 #include <Gui/StringConv.hh>
6 
7 
8 using namespace BIAS;
9 using namespace std;
10 
13 {}
14 
15 
17 ZoomFrame(wxWindow* parent, const wxString& title)
18  : wxFrame(parent, -1, title)
19 {
20  Setup();
21  Show();
22 }
23 
24 
25 void ZoomFrame::
27 {
28  int widths[] = { -1, 280 };
29  CreateStatusBar(2);
30  SetStatusWidths(2, widths);
31 
32  QuitButton_ = new wxButton(this, MIA_ZoomQuitButton, wxT("Close"));
33 
34  Window_ = new ZoomImageCanvas(this, GetStatusBar(), 1);
35 
36  SLScale_ = new wxSlider(this, -1, 10, 1, 25, wxDefaultPosition,
37  wxSize(-1, -1), wxSL_HORIZONTAL);
38 
39  wxBoxSizer *box = new wxBoxSizer(wxVERTICAL);
40  wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL);
41 
42  box->Add(QuitButton_, 0, wxALL | wxGROW, 3);
43  box->Add(Window_, 1, wxALL | wxGROW, 3);
44  hbox->Add(new wxStaticText( this, -1, _T("Zoom") ), 0, wxALL, 5);
45  hbox->Add(SLScale_, 1, wxALL | wxGROW, 5);
46  box->Add(hbox, 0, wxGROW, 0);
47 
48  box->SetSizeHints(this);
49  SetSizer(box);
50 }
51 
52 void ZoomFrame::
55  const wxString& name)
56 {
57  Window_->NewImage(im, ucim);
58  if(GetStatusBar()!=NULL)
59  SetStatusText(name, 0);
60 }
61 
62 
63 void ZoomFrame::
64 NewCoo(unsigned x, unsigned y)
65 { Window_->NewCoo(x, y); }
66 
67 
68 
69 BEGIN_EVENT_TABLE (ZoomFrame, wxFrame)
70 EVT_BUTTON (MIA_ZoomQuitButton, ZoomFrame::OnQuit)
71 EVT_SCROLL (ZoomFrame::OnZoomFactor)
72 EVT_CLOSE (ZoomFrame::OnClose)
73 //EVT_KEY_DOWN (ZoomFrame::OnKeyPress)
74 END_EVENT_TABLE()
75 
76 //void ZoomFrame::OnQuit(wxCommandEvent & event)
77 void ZoomFrame::OnQuit(wxCommandEvent &)
78 {
79  Close(true);
80 }
81 
82 //void ZoomFrame::OnClose(wxCloseEvent & event)
83 void ZoomFrame::OnClose(wxCloseEvent &)
84 {
85  /*
86  ((ImageCanvas*)GetParent())->SetZoomed(false);
87  Destroy();
88  */
89  Hide();
90 }
91 
92 void ZoomFrame::SetZoom(unsigned z)
93 {
94  BIASASSERT(z>=1);
95  BIASASSERT(z<=25);
96  SLScale_->SetValue(z);
97  Window_->NewZoom(SLScale_->GetValue());
98 }
99 
100 //void ZoomFrame::OnZoomFactor(wxScrollEvent & event)
101 void ZoomFrame::OnZoomFactor(wxScrollEvent&)
102 { Window_->NewZoom(SLScale_->GetValue()); }
103 
104 // void ZoomFrame::OnKeyPress(wxKeyEvent &event)
105 // {
106 // cerr <<"ZoomFrame::OnKeyPress\n";
107 // event.Skip();
108 // }
109 
void OnZoomFactor(wxScrollEvent &event)
Definition: ZoomFrame.cpp:101
void SetZoom(unsigned z)
Definition: ZoomFrame.cpp:92
void NewCoo(unsigned x, unsigned y)
ZoomFrame(wxWindow *parent, const wxString &title)
Definition: ZoomFrame.cpp:17
void OnClose(wxCloseEvent &event)
Definition: ZoomFrame.cpp:83
void NewImage(BIAS::ImageBase &im, BIAS::Image< unsigned char > &ucim)
wxButton * QuitButton_
Definition: ZoomFrame.hh:46
used by ImageCanvas and ScaledImageCanvas, should not be used directly
Definition: ZoomFrame.hh:23
ZoomImageCanvas * Window_
Definition: ZoomFrame.hh:47
void NewImage(BIAS::ImageBase &im, BIAS::Image< unsigned char > &ucim, const wxString &name)
Definition: ZoomFrame.cpp:53
wxSlider * SLScale_
Definition: ZoomFrame.hh:48
void NewCoo(unsigned x, unsigned y)
Definition: ZoomFrame.cpp:64
This is the base class for images in BIAS.
Definition: ImageBase.hh:102