30 #include "wx/msw/wrapwin.h"
47 if(e.GetWheelRotation()<0)
63 switch (e.GetKeyCode()){
67 case WXK_NUMPAD_RIGHT:
77 case WXK_NUMPAD_PAGEDOWN:
81 case WXK_NUMPAD_PAGEUP:
107 int index=std::min<int>(GetSelection()+step,GetCount()-1);
108 if(index!=GetSelection())
118 int index=std::max<int>(GetSelection()-step,0);
119 if(index!=GetSelection())
131 wxCommandEvent ne(wxEVT_COMMAND_COMBOBOX_SELECTED);
132 ne.SetEventObject(
this);
133 ne.SetId(this->GetId());
134 ne.SetInt(GetSelection());
147 int WXUNUSED(
flags))
const
149 if ( item == wxNOT_FOUND )
153 GetTextExtent(GetString(item), &w, &h);
154 wxCoord maxWidth=0.73*rect.width-3;
160 wxString qty_cp = wxT(
"");
163 qty_cp = wxString::Format(wxT(
" %d"),
CPCount[item]);
164 GetTextExtent(qty_cp, &qty_w, &h);
168 if (w +qty_w <= maxWidth)
171 dc.DrawText(GetString(item),rect.x + 3,rect.y + ((rect.height - dc.GetCharHeight())/2));
177 wxString ellipsis(wxT(
"..."));
179 GetTextExtent(ellipsis, &base_w, &h);
182 wxString drawntext = GetString(item);
183 while (drawntext.length() > 1)
185 drawntext.RemoveLast();
186 GetTextExtent(drawntext,&w,&h);
187 if (w + base_w + qty_w <= maxWidth)
192 dc.DrawText(drawntext, rect.x + 3, rect.y + ((rect.height - dc.GetCharHeight())/2));
193 dc.DrawText(ellipsis, rect.x + 3 + w, rect.y + ((rect.height - dc.GetCharHeight())/2));
200 x=rect.width / 5 *(1-std::min<double>(
CPConnection[item],10)/10);
202 x=std::max<wxCoord>(5,x);
203 const wxPen * oldPen = & dc.GetPen();
204 const wxBrush * oldBrush= & dc.GetBrush();
206 wxPen MyPen(wxColour(255, 0, 0), 1, wxPENSTYLE_SOLID);
207 wxBrush MyBrush(wxColour(255,0,0), wxBRUSHSTYLE_SOLID);
208 double red, green, blue;
216 MyPen.SetColour(wxColour(red,green,0));
217 MyBrush.SetColour(wxColour(red,green,0));
219 dc.SetBrush(MyBrush);
220 dc.DrawRectangle(rect.x+0.75*rect.width,rect.y+rect.height/6+1,x,2*rect.height/3);
251 MyPen.SetColour(dc.GetTextForeground());
253 dc.SetBrush(*wxTRANSPARENT_BRUSH);
254 dc.DrawRectangle(rect.x+0.75*rect.width,rect.y+rect.height/6+1,rect.width/5,2*rect.height/3);
256 dc.SetBrush(*oldBrush);
259 dc.DrawText(qty_cp, rect.x - 3 - qty_w +0.75*rect.width , rect.y + ((rect.height - dc.GetCharHeight())/2));
269 CPCount.resize(this->GetCount(),0);
272 for (
unsigned int ptIdx = 0 ; ptIdx < noPts ; ptIdx++)
292 CPImagesComboBoxXmlHandler::CPImagesComboBoxXmlHandler()
293 : wxOwnerDrawnComboBoxXmlHandler()
302 cp->Create(m_parentAsWindow,
303 GetID(), wxEmptyString,
304 GetPosition(), GetSize(),
305 GetStyle(wxT(
"style")), wxDefaultValidator,
315 return IsOfClass(node, wxT(
"CPImagesComboBox"));
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.
Definition of CPImagesComboBox and CPImagesComboBoxXmlHandler class.
std::size_t getNrOfCtrlPoints() const
number of control points
Owner Drawn ComboBox for showing connected images on CP tab.
represents a control point
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.
virtual bool CanHandle(wxXmlNode *node)
Internal use to identify right xml handler.
const ControlPoint & getCtrlPoint(std::size_t nr) const
get a control point, counting starts with 0
IMPLEMENT_DYNAMIC_CLASS(wxTreeListHeaderWindow, wxWindow)
virtual wxObject * DoCreateResource()
Create CPImagesComboBox from resource.
xrc handler for CPImagesComboBox
void ControlPointErrorColour(const double cperr, double &r, double &g, double &b)
std::vector< unsigned int > CPCount
void SelectNext(int step=1)