]> git.saurik.com Git - wxWidgets.git/blob - src/common/wincmn.cpp
wxStringList::copy ctor and assignment operator added (very inefficient
[wxWidgets.git] / src / common / wincmn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: windows.cpp
3 // Purpose: common (to all ports) wxWindow functions
4 // Author: Julian Smart, Vadim Zeitlin
5 // Modified by:
6 // Created: 13/07/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
14
15 // For compilers that support precompilation, includes "wx.h".
16 #include "wx/wxprec.h"
17
18 #ifdef __BORLANDC__
19 #pragma hdrstop
20 #endif
21
22 #include "wx/frame.h"
23 #include "wx/defs.h"
24 #include "wx/window.h"
25
26 // Do Update UI processing for child controls
27
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"
34
35 void wxWindow::UpdateWindowUI()
36 {
37 wxWindowID id = GetId();
38 if (id > 0)
39 {
40 wxUpdateUIEvent event(id);
41 event.m_eventObject = this;
42
43 if (this->GetEventHandler()->ProcessEvent(event))
44 {
45 if (event.GetSetEnabled())
46 this->Enable(event.GetEnabled());
47
48 if (event.GetSetText() && this->IsKindOf(CLASSINFO(wxControl)))
49 ((wxControl*)this)->SetLabel(event.GetText());
50
51 if (this->IsKindOf(CLASSINFO(wxCheckBox)))
52 {
53 if (event.GetSetChecked())
54 ((wxCheckBox *) this)->SetValue(event.GetChecked());
55 }
56 // @@@ No radio buttons in wxGTK yet
57 #ifndef __WXGTK__
58 else if (this->IsKindOf(CLASSINFO(wxRadioButton)))
59 {
60 if (event.GetSetChecked())
61 ((wxRadioButton *) this)->SetValue(event.GetChecked());
62 }
63 #endif
64 }
65 }
66 }
67
68 // Dialog units translations. Implemented in wincmn.cpp.
69 wxPoint wxWindow::ConvertPixelsToDialog(const wxPoint& pt)
70 {
71 int charWidth = GetCharWidth();
72 int charHeight = GetCharHeight();
73 wxPoint pt2;
74 pt2.x = (int) ((pt.x * 4) / charWidth) ;
75 pt2.y = (int) ((pt.y * 8) / charHeight) ;
76
77 return pt2;
78 }
79
80 wxPoint wxWindow::ConvertDialogToPixels(const wxPoint& pt)
81 {
82 int charWidth = GetCharWidth();
83 int charHeight = GetCharHeight();
84 wxPoint pt2;
85 pt2.x = (int) ((pt.x * charWidth) / 4) ;
86 pt2.y = (int) ((pt.y * charHeight) / 8) ;
87
88 return pt2;
89 }
90