Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
HistoFrame.cpp
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003-2009 (see file CONTACT for details)
5 Multimediale Systeme der Informationsverarbeitung
6 Institut fuer Informatik
7 Christian-Albrechts-Universitaet Kiel
8 
9 
10 BIAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 BIAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with BIAS; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24 
25 #include <Base/Common/W32Compat.hh>
26 #include "HistoFrame.hh"
27 #include <Gui/HistoImageCanvas.hh>
28 
29 using namespace BIAS;
30 using namespace std;
31 
32 // icon
33 #if !defined(__WXPM__)
34 # include <img/biasviewwx.xpm>
35 #endif
36 
37 
38 
39 //Constructor
40 //additional WINDOWS-ONLY-styles were required specially for WINDOWS,
41 //because of several repaint-resize bugs
43 HistoFrame(wxWindow* parent, const wxString& title,
44  wxPoint pos, wxSize size)
45  : wxFrame(parent, -1, title, pos, size,
46  wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxFULL_REPAINT_ON_RESIZE)
47 {
48  SetIcon(wxIcon(biasviewwx_xpm));
49  Setup(size);
50  Show();
51 
52 #ifdef WIN32
53  Window_->Refresh();
54 #endif
55 }
56 
57 
58 void HistoFrame::
59 Setup(wxSize size)
60 {
61  int widths[] = {100, -1};
62 
63  CreateStatusBar(2);
64 
65  GetStatusBar()->SetStatusWidths(2, widths);
66  GetStatusBar()->SetStatusText(wxT("Histogramm"), 0);
67  GetStatusBar()->Show();
68 
69  SetMinSize(wxSize(300, 250));
70 
71  //GetStatusBar()->SetStatusStyles(2, wxSB_NORMAL);
72  //GetStatusBar()->SetMinHeight(30);
73 
74  //QuitButton_ = new wxButton(this, MIA_HistoQuitButton, wxT("Close"));
75  //Correct the size of the canvas (it's 6 pxl thinner and 31 pxl smaller)
76  wxSize size_canvas = wxSize(size.GetWidth()-6,
77  size.GetHeight()-31);
78  Window_ = new HistoImageCanvas(this, GetStatusBar(), 1, -1,
79  wxDefaultPosition, size_canvas);
80 
81  wxBoxSizer *box = new wxBoxSizer(wxVERTICAL);
82 
83  //box->Add(QuitButton_, 0, wxALL | wxGROW, 3);
84  box->Add(Window_, 1, wxALL | wxGROW, 3);
85  //box->SetSizeHints(this);
86 
87  SetSizer(box);
88 }
89 
90 
91 //Destructor
94 {}
95 
96 
97 BEGIN_EVENT_TABLE (HistoFrame, wxWindow)
98  EVT_CLOSE (HistoFrame::OnClose)
99  EVT_SIZE (HistoFrame::OnSize)
100  //EVT_BUTTON (MIA_HistoQuitButton, HistoFrame::OnQuit)
101  //EVT_MOTION (HistoImageCanvas::OnMouseMove)
102  //EVT_CHAR (HistoFrame::OnKey)
103  //EVT_SIZE (HistoImageCanvas::OnResize)
104  //EVT_LEAVE_WINDOW(HistoImageCanvas::OnMouseLeave)
105 END_EVENT_TABLE()
106 
107 
108 void HistoFrame::
109 NewImage(BIAS::ImageBase& im, const wxString& name)
110 {
111  if(!(Window_->SameName((wxString)name, true))){
112  Window_->NewImage(im);
113  }
114 }
115 
116 
117 void HistoFrame::
118 OnQuit(wxCommandEvent & event)
119 {
120  Close(true);
121 }
122 
123 
124 void HistoFrame::
125 OnClose(wxCloseEvent & event)
126 {
127  Hide();
128 }
129 
130 
131 void HistoFrame::
132 OnSize(wxSizeEvent& event)
133 {
134  //-28 in Height is for the StatusBar to be visible
135  Window_->SetSize(this->GetSize().GetWidth(), this->GetSize().GetHeight()-28);
136 }
137 
138 
HistoImageCanvas * Window_
Definition: HistoFrame.hh:69
It&#39;s a Frame used to have a Histogramm Canvas, which describes a histogramm of current image...
Definition: HistoFrame.hh:47
void Setup(wxSize size=wxSize(300, 250))
Definition: HistoFrame.cpp:59
void OnQuit(wxCommandEvent &event)
Definition: HistoFrame.cpp:118
It&#39;s a Canvas used to compute Histogram for current image working.
void OnSize(wxSizeEvent &event)
Definition: HistoFrame.cpp:132
void OnClose(wxCloseEvent &event)
Definition: HistoFrame.cpp:125
HistoFrame(wxWindow *parent, const wxString &title, wxPoint pos=wxPoint(10, 10), wxSize size=wxSize(300, 250))
Definition: HistoFrame.cpp:43
void NewImage(BIAS::ImageBase &im, const wxString &name)
Definition: HistoFrame.cpp:109
This is the base class for images in BIAS.
Definition: ImageBase.hh:102