fixed redraw problems in wxStaticText

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13083 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-12-19 01:27:26 +00:00
parent 5b96a71a56
commit 1e3a888e72
3 changed files with 26 additions and 36 deletions

View File

@@ -63,9 +63,16 @@ Unix ports:
2.3.3
-----
All:
- fixes to the command line parsing error and usage messages
- modified wxFileName::CreateTempFileName() to open the file atomically
(if possible) and, especially, not to leak the file descriptors under Unix
wxMSW:
- fixed flicker in wxTreeCtrl::SetItemXXX()
- fixed redraw problems in dynamically resized wxStaticText
2.3.2
-----

View File

@@ -16,12 +16,8 @@
#pragma interface "stattext.h"
#endif
#include "wx/control.h"
class WXDLLEXPORT wxStaticText : public wxControl
class WXDLLEXPORT wxStaticText : public wxStaticTextBase
{
DECLARE_DYNAMIC_CLASS(wxStaticText)
public:
wxStaticText() { }
@@ -44,18 +40,16 @@ public:
long style = 0,
const wxString& name = wxStaticTextNameStr);
// accessors
void SetLabel(const wxString& label);
bool SetFont( const wxFont &font );
// overriden base class virtuals
virtual bool AcceptsFocus() const { return FALSE; }
// callbacks
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
// override some methods to resize the window properly
virtual void SetLabel(const wxString& label);
virtual bool SetFont( const wxFont &font );
protected:
virtual void DoSetSize(int x, int y, int w, int h,
int sizeFlags = wxSIZE_AUTO);
virtual wxSize DoGetBestSize() const;
DECLARE_DYNAMIC_CLASS(wxStaticText)
};
#endif

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: stattext.cpp
// Name: src/msw/stattext.cpp
// Purpose: wxStaticText
// Author: Julian Smart
// Modified by:
@@ -82,13 +82,6 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
wxCHECK_MSG( m_hWnd, FALSE, wxT("Failed to create static ctrl") );
#if wxUSE_CTL3D
/*
if (!(GetParent()->GetWindowStyleFlag() & wxUSER_COLOURS))
Ctl3dSubclassCtl(static_item);
*/
#endif
SubclassWin(m_hWnd);
wxControl::SetFont(parent->GetFont());
@@ -141,17 +134,24 @@ wxSize wxStaticText::DoGetBestSize() const
return wxSize(widthTextMax, heightTextTotal);
}
void wxStaticText::DoSetSize(int x, int y, int w, int h, int sizeFlags)
{
// we need to refresh the window after changing its size as the standard
// control doesn't always update itself properly
wxStaticTextBase::DoSetSize(x, y, w, h, sizeFlags);
Refresh();
}
void wxStaticText::SetLabel(const wxString& label)
{
SetWindowText(GetHwnd(), label);
wxStaticTextBase::SetLabel(label);
// adjust the size of the window to fit to the label unless autoresizing is
// disabled
if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
{
DoSetSize(-1, -1, -1, -1, wxSIZE_AUTO_WIDTH | wxSIZE_AUTO_HEIGHT);
Refresh();
}
}
@@ -170,15 +170,4 @@ bool wxStaticText::SetFont(const wxFont& font)
return ret;
}
long wxStaticText::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
// Ensure that static items get messages. Some controls don't like this
// message to be intercepted (e.g. RichEdit), hence the tests.
if (nMsg == WM_NCHITTEST)
return (long)HTCLIENT;
return wxWindow::MSWWindowProc(nMsg, wParam, lParam);
}
#endif // wxUSE_STATTEXT