Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CPImagesComboBox.h
Go to the documentation of this file.
1 // -*- c-basic-offset: 4 -*-
12 /* This is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public
14  * License as published by the Free Software Foundation; either
15  * version 2 of the License, or (at your option) any later version.
16  *
17  * This software is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  * Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public
23  * License along with this software. If not, see
24  * <http://www.gnu.org/licenses/>.
25  *
26  */
27 
28 #ifndef _CPIMAGESCOMBOBOX_H
29 #define _CPIMAGESCOMBOBOX_H
30 
31 // standard wx include
32 #include "panoinc.h"
33 #include "panoinc_WX.h"
34 #include "wx/odcombo.h"
35 #include "wx/xrc/xh_odcombo.h"
36 
38 class CPImagesComboBox : public wxOwnerDrawnComboBox
39 {
40 public:
42  bool Create(wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size,
43  long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxComboBoxNameStr));
45  virtual void OnDrawItem(wxDC& dc,
46  const wxRect& rect,
47  int item,
48  int WXUNUSED(flags)) const;
52  void SetRefImage(HuginBase::Panorama * pano, unsigned int newRefImg)
53  {
54  refImage=newRefImg;
55  CalcCPDistance(pano);
56  };
58  const unsigned int GetRefImage()
59  {
60  return refImage;
61  };
62 protected:
64  void OnMouseWheel(wxMouseEvent & e);
66  void OnKeyDown(wxKeyEvent & e);
67 private:
68  unsigned int refImage;
69  std::vector<double> CPConnection;
70  std::vector<unsigned int> CPCount;
71  void Init();
72  void SelectNext(int step = 1);
73  void SelectPrev(int step = 1);
74  void NotifyParent();
75 
76  DECLARE_DYNAMIC_CLASS(CPImagesComboBox)
77 };
78 
80 class CPImagesComboBoxXmlHandler : public wxOwnerDrawnComboBoxXmlHandler
81 {
82  DECLARE_DYNAMIC_CLASS(CPImagesComboBoxXmlHandler)
83 
84 public:
88  virtual wxObject *DoCreateResource();
90  virtual bool CanHandle(wxXmlNode *node);
91 };
92 
93 #endif
void CalcCPDistance(HuginBase::Panorama *pano)
Get maximum CP distance for all images pairs containing the reference image.
void SelectPrev(int step=1)
std::vector< double > CPConnection
void OnKeyDown(wxKeyEvent &e)
Key handler to mimic wxChoice behavior.
include file for the hugin project
Owner Drawn ComboBox for showing connected images on CP tab.
virtual void OnDrawItem(wxDC &dc, const wxRect &rect, int item, int WXUNUSED(flags)) const
Paint method for drawing text and indication bar of combo box.
Model for a panorama.
Definition: Panorama.h:152
virtual bool CanHandle(wxXmlNode *node)
Internal use to identify right xml handler.
void OnMouseWheel(wxMouseEvent &e)
Mouse wheel handler to mimic wxChoice behavior.
virtual wxObject * DoCreateResource()
Create CPImagesComboBox from resource.
CPImagesComboBoxXmlHandler()
Constructor.
xrc handler for CPImagesComboBox
include file for the hugin project
const unsigned int GetRefImage()
Returns the reference image number.
bool Create(wxWindow *parent, wxWindowID id, const wxString &value, const wxPoint &pos, const wxSize &size, long style=0, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxASCII_STR(wxComboBoxNameStr))
create control, bind events
static uint16_t flags
std::vector< unsigned int > CPCount
unsigned int refImage
void SelectNext(int step=1)
void SetRefImage(HuginBase::Panorama *pano, unsigned int newRefImg)
Set new reference image.