Fix for disabled controls
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7280 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -66,6 +66,8 @@ public:
|
||||
// MSW only
|
||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||
long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
|
||||
protected:
|
||||
virtual void DoSetItemClientData( int n, void* clientData );
|
||||
|
@@ -80,6 +80,8 @@ public:
|
||||
// implementation only from now on
|
||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||
bool MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam);
|
||||
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
|
||||
WXHWND GetEditHWND() const;
|
||||
|
||||
|
@@ -81,6 +81,8 @@ public:
|
||||
virtual bool SetFont(const wxFont& font);
|
||||
|
||||
long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
WXHWND *GetRadioButtons() const { return m_radioButtons; }
|
||||
bool ContainsHWND(WXHWND hWnd) const;
|
||||
void SendNotificationEvent();
|
||||
|
@@ -48,6 +48,9 @@ class WXDLLEXPORT wxRadioButton: public wxControl
|
||||
virtual bool GetValue(void) const ;
|
||||
|
||||
bool MSWCommand(WXUINT param, WXWORD id);
|
||||
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
|
||||
void Command(wxCommandEvent& event);
|
||||
};
|
||||
|
||||
|
@@ -115,6 +115,8 @@ public:
|
||||
|
||||
virtual void Command(wxCommandEvent& event);
|
||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
|
||||
#if wxUSE_RICHEDIT
|
||||
bool IsRich() const { return m_isRich; }
|
||||
|
@@ -140,6 +140,7 @@ public:
|
||||
void OnFileLoad(wxCommandEvent& event);
|
||||
|
||||
void OnSetEditable(wxCommandEvent& event);
|
||||
void OnSetEnabled(wxCommandEvent& event);
|
||||
|
||||
void OnIdle( wxIdleEvent& event );
|
||||
|
||||
@@ -178,7 +179,8 @@ enum
|
||||
// text menu
|
||||
TEXT_MOVE_ENDTEXT = 400,
|
||||
TEXT_MOVE_ENDENTRY,
|
||||
TEXT_SET_EDITABLE
|
||||
TEXT_SET_EDITABLE,
|
||||
TEXT_SET_ENABLED
|
||||
};
|
||||
|
||||
bool MyApp::OnInit()
|
||||
@@ -226,7 +228,9 @@ bool MyApp::OnInit()
|
||||
menuText->Append(TEXT_MOVE_ENDTEXT, "Move cursor to the end of &text");
|
||||
menuText->Append(TEXT_MOVE_ENDENTRY, "Move cursor to the end of &entry");
|
||||
menuText->Append(TEXT_SET_EDITABLE, "Toggle &editable state", "", TRUE);
|
||||
menuText->Append(TEXT_SET_ENABLED, "Toggle e&nabled state", "", TRUE);
|
||||
menuText->Check(TEXT_SET_EDITABLE, TRUE);
|
||||
menuText->Check(TEXT_SET_ENABLED, TRUE);
|
||||
menu_bar->Append(menuText, "&Text");
|
||||
|
||||
frame->SetMenuBar(menu_bar);
|
||||
@@ -770,6 +774,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU(TEXT_MOVE_ENDENTRY, MyFrame::OnMoveToEndOfEntry)
|
||||
|
||||
EVT_MENU(TEXT_SET_EDITABLE, MyFrame::OnSetEditable)
|
||||
EVT_MENU(TEXT_SET_ENABLED, MyFrame::OnSetEnabled)
|
||||
|
||||
EVT_IDLE(MyFrame::OnIdle)
|
||||
END_EVENT_TABLE()
|
||||
@@ -850,6 +855,21 @@ void MyFrame::OnSetEditable(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
s_editable = !s_editable;
|
||||
m_panel->m_text->SetEditable(s_editable);
|
||||
m_panel->m_password->SetEditable(s_editable);
|
||||
m_panel->m_multitext->SetEditable(s_editable);
|
||||
m_panel->m_textrich->SetEditable(s_editable);
|
||||
}
|
||||
|
||||
void MyFrame::OnSetEnabled(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
bool enabled = m_panel->m_text->IsEnabled();
|
||||
enabled = !enabled;
|
||||
|
||||
m_panel->m_text->Enable(enabled);
|
||||
m_panel->m_password->Enable(enabled);
|
||||
m_panel->m_multitext->Enable(enabled);
|
||||
m_panel->m_readonly->Enable(enabled);
|
||||
m_panel->m_textrich->Enable(enabled);
|
||||
}
|
||||
|
||||
void MyFrame::OnFileSave(wxCommandEvent& event)
|
||||
|
@@ -337,3 +337,36 @@ bool wxChoice::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
WXHBRUSH wxChoice::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
WXUINT message,
|
||||
WXWPARAM wParam,
|
||||
WXLPARAM lParam)
|
||||
{
|
||||
#if wxUSE_CTL3D
|
||||
if ( m_useCtl3D )
|
||||
{
|
||||
HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam);
|
||||
return (WXHBRUSH) hbrush;
|
||||
}
|
||||
#endif // wxUSE_CTL3D
|
||||
|
||||
HDC hdc = (HDC)pDC;
|
||||
if (GetParent()->GetTransparentBackground())
|
||||
SetBkMode(hdc, TRANSPARENT);
|
||||
else
|
||||
SetBkMode(hdc, OPAQUE);
|
||||
|
||||
wxColour& colBack = GetBackgroundColour();
|
||||
|
||||
if (!IsEnabled())
|
||||
colBack = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
|
||||
|
||||
::SetBkColor(hdc, wxColourToRGB(colBack));
|
||||
::SetTextColor(hdc, wxColourToRGB(GetForegroundColour()));
|
||||
|
||||
wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID);
|
||||
|
||||
return (WXHBRUSH)brush->GetResourceHandle();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -139,6 +139,38 @@ LRESULT APIENTRY _EXPORT wxComboEditWndProc(HWND hWnd,
|
||||
return ::CallWindowProc(CASTWNDPROC gs_wndprocEdit, hWnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
WXHBRUSH wxComboBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
WXUINT message,
|
||||
WXWPARAM wParam,
|
||||
WXLPARAM lParam)
|
||||
{
|
||||
#if wxUSE_CTL3D
|
||||
if ( m_useCtl3D )
|
||||
{
|
||||
HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam);
|
||||
return (WXHBRUSH) hbrush;
|
||||
}
|
||||
#endif // wxUSE_CTL3D
|
||||
|
||||
HDC hdc = (HDC)pDC;
|
||||
if (GetParent()->GetTransparentBackground())
|
||||
SetBkMode(hdc, TRANSPARENT);
|
||||
else
|
||||
SetBkMode(hdc, OPAQUE);
|
||||
|
||||
wxColour& colBack = GetBackgroundColour();
|
||||
|
||||
if (!IsEnabled())
|
||||
colBack = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
|
||||
|
||||
::SetBkColor(hdc, wxColourToRGB(colBack));
|
||||
::SetTextColor(hdc, wxColourToRGB(GetForegroundColour()));
|
||||
|
||||
wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID);
|
||||
|
||||
return (WXHBRUSH)brush->GetResourceHandle();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxComboBox
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -239,7 +239,8 @@ WXHBRUSH wxControl::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
else
|
||||
SetBkMode(hdc, OPAQUE);
|
||||
|
||||
const wxColour& colBack = GetBackgroundColour();
|
||||
wxColour& colBack = GetBackgroundColour();
|
||||
|
||||
::SetBkColor(hdc, wxColourToRGB(colBack));
|
||||
::SetTextColor(hdc, wxColourToRGB(GetForegroundColour()));
|
||||
|
||||
|
@@ -773,6 +773,39 @@ long wxRadioBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
||||
return wxControl::MSWWindowProc(nMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
WXHBRUSH wxRadioBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
WXUINT message,
|
||||
WXWPARAM wParam,
|
||||
WXLPARAM lParam)
|
||||
{
|
||||
#if wxUSE_CTL3D
|
||||
if ( m_useCtl3D )
|
||||
{
|
||||
HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam);
|
||||
return (WXHBRUSH) hbrush;
|
||||
}
|
||||
#endif // wxUSE_CTL3D
|
||||
|
||||
HDC hdc = (HDC)pDC;
|
||||
if (GetParent()->GetTransparentBackground())
|
||||
SetBkMode(hdc, TRANSPARENT);
|
||||
else
|
||||
SetBkMode(hdc, OPAQUE);
|
||||
|
||||
wxColour& colBack = GetBackgroundColour();
|
||||
|
||||
if (!IsEnabled())
|
||||
colBack = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
|
||||
|
||||
::SetBkColor(hdc, wxColourToRGB(colBack));
|
||||
::SetTextColor(hdc, wxColourToRGB(GetForegroundColour()));
|
||||
|
||||
wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID);
|
||||
|
||||
return (WXHBRUSH)brush->GetResourceHandle();
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// window proc for radio buttons
|
||||
// ---------------------------------------------------------------------------
|
||||
|
@@ -163,6 +163,37 @@ void wxRadioButton::Command (wxCommandEvent & event)
|
||||
ProcessCommand (event);
|
||||
}
|
||||
|
||||
WXHBRUSH wxRadioButton::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
WXUINT message,
|
||||
WXWPARAM wParam,
|
||||
WXLPARAM lParam)
|
||||
{
|
||||
#if wxUSE_CTL3D
|
||||
if ( m_useCtl3D )
|
||||
{
|
||||
HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam);
|
||||
return (WXHBRUSH) hbrush;
|
||||
}
|
||||
#endif // wxUSE_CTL3D
|
||||
|
||||
HDC hdc = (HDC)pDC;
|
||||
if (GetParent()->GetTransparentBackground())
|
||||
SetBkMode(hdc, TRANSPARENT);
|
||||
else
|
||||
SetBkMode(hdc, OPAQUE);
|
||||
|
||||
wxColour& colBack = GetBackgroundColour();
|
||||
|
||||
if (!IsEnabled())
|
||||
colBack = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
|
||||
|
||||
::SetBkColor(hdc, wxColourToRGB(colBack));
|
||||
::SetTextColor(hdc, wxColourToRGB(GetForegroundColour()));
|
||||
|
||||
wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID);
|
||||
|
||||
return (WXHBRUSH)brush->GetResourceHandle();
|
||||
}
|
||||
|
||||
// Not implemented
|
||||
#if 0
|
||||
|
@@ -355,10 +355,10 @@ void wxTextCtrl::AdoptAttributesFromHWND()
|
||||
void wxTextCtrl::SetupColours()
|
||||
{
|
||||
wxColour bkgndColour;
|
||||
if (IsEditable() || (m_windowStyle & wxTE_MULTILINE))
|
||||
// if (IsEditable() || (m_windowStyle & wxTE_MULTILINE))
|
||||
bkgndColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW);
|
||||
else
|
||||
bkgndColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
|
||||
// else
|
||||
// bkgndColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
|
||||
|
||||
SetBackgroundColour(bkgndColour);
|
||||
SetForegroundColour(GetParent()->GetForegroundColour());
|
||||
@@ -530,12 +530,13 @@ void wxTextCtrl::SetEditable(bool editable)
|
||||
|
||||
HWND hWnd = GetHwnd();
|
||||
SendMessage(hWnd, EM_SETREADONLY, (WPARAM)!editable, (LPARAM)0L);
|
||||
|
||||
/*
|
||||
if (editable != isEditable)
|
||||
{
|
||||
SetupColours();
|
||||
Refresh();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void wxTextCtrl::SetInsertionPoint(long pos)
|
||||
@@ -962,6 +963,38 @@ bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
WXHBRUSH wxTextCtrl::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
WXUINT message,
|
||||
WXWPARAM wParam,
|
||||
WXLPARAM lParam)
|
||||
{
|
||||
#if wxUSE_CTL3D
|
||||
if ( m_useCtl3D )
|
||||
{
|
||||
HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam);
|
||||
return (WXHBRUSH) hbrush;
|
||||
}
|
||||
#endif // wxUSE_CTL3D
|
||||
|
||||
HDC hdc = (HDC)pDC;
|
||||
if (GetParent()->GetTransparentBackground())
|
||||
SetBkMode(hdc, TRANSPARENT);
|
||||
else
|
||||
SetBkMode(hdc, OPAQUE);
|
||||
|
||||
wxColour& colBack = GetBackgroundColour();
|
||||
|
||||
if (!IsEnabled() && (GetWindowStyle() & wxTE_MULTILINE) == 0)
|
||||
colBack = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
|
||||
|
||||
::SetBkColor(hdc, wxColourToRGB(colBack));
|
||||
::SetTextColor(hdc, wxColourToRGB(GetForegroundColour()));
|
||||
|
||||
wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID);
|
||||
|
||||
return (WXHBRUSH)brush->GetResourceHandle();
|
||||
}
|
||||
|
||||
void wxTextCtrl::AdjustSpaceLimit()
|
||||
{
|
||||
#ifndef __WIN16__
|
||||
|
Reference in New Issue
Block a user