]>
git.saurik.com Git - wxWidgets.git/blob - src/common/wincmn.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: common (to all ports) wxWindow functions
4 // Author: Julian Smart, Vadim Zeitlin
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
15 // For compilers that support precompilation, includes "wx.h".
16 #include "wx/wxprec.h"
24 #include "wx/window.h"
26 // Do Update UI processing for child controls
28 // TODO: should this be implemented for the child window rather
29 // than the parent? Then you can override it e.g. for wxCheckBox
30 // to do the Right Thing rather than having to assume a fixed number
31 // of control classes.
32 #include "wx/checkbox.h"
33 #include "wx/radiobut.h"
35 void wxWindow::UpdateWindowUI()
37 wxWindowID id
= GetId();
40 wxUpdateUIEvent
event(id
);
41 event
.m_eventObject
= this;
43 if (this->GetEventHandler()->ProcessEvent(event
))
45 if (event
.GetSetEnabled())
46 this->Enable(event
.GetEnabled());
48 if (event
.GetSetText() && this->IsKindOf(CLASSINFO(wxControl
)))
49 ((wxControl
*)this)->SetLabel(event
.GetText());
51 if (this->IsKindOf(CLASSINFO(wxCheckBox
)))
53 if (event
.GetSetChecked())
54 ((wxCheckBox
*) this)->SetValue(event
.GetChecked());
56 // @@@ No radio buttons in wxGTK yet
58 else if (this->IsKindOf(CLASSINFO(wxRadioButton
)))
60 if (event
.GetSetChecked())
61 ((wxRadioButton
*) this)->SetValue(event
.GetChecked());
68 // Dialog units translations. Implemented in wincmn.cpp.
69 wxPoint
wxWindow::ConvertPixelsToDialog(const wxPoint
& pt
)
71 int charWidth
= GetCharWidth();
72 int charHeight
= GetCharHeight();
74 pt2
.x
= (int) ((pt
.x
* 4) / charWidth
) ;
75 pt2
.y
= (int) ((pt
.y
* 8) / charHeight
) ;
80 wxPoint
wxWindow::ConvertDialogToPixels(const wxPoint
& pt
)
82 int charWidth
= GetCharWidth();
83 int charHeight
= GetCharHeight();
85 pt2
.x
= (int) ((pt
.x
* charWidth
) / 4) ;
86 pt2
.y
= (int) ((pt
.y
* charHeight
) / 8) ;