Added ability to call wxWindow::OnPaint under Windows (experimental).

Added wxTR_NO_LINES to remove lines from tree control (MSW only).


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7925 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2000-08-03 16:11:51 +00:00
parent bfc38e4363
commit 63da7df701
7 changed files with 39 additions and 1 deletions

View File

@@ -22,6 +22,10 @@ To intercept events from a tree control, use the event table macros described in
\begin{twocollist}\itemsep=0pt \begin{twocollist}\itemsep=0pt
\twocolitem{\windowstyle{wxTR\_HAS\_BUTTONS}}{Use this style to show + and - buttons to the \twocolitem{\windowstyle{wxTR\_HAS\_BUTTONS}}{Use this style to show + and - buttons to the
left of parent items. Win32 only. } left of parent items. Win32 only. }
\twocolitem{\windowstyle{wxTR\_NO\_LINES}}{Use this style to hide vertical lines.
Win32 only. }
\twocolitem{\windowstyle{wxTR\_LINES\_AT\_ROOT}}{Use this style to show lines at the
tree root. Win32 only.}
\twocolitem{\windowstyle{wxTR\_EDIT\_LABELS}}{Use this style if you wish the user to be \twocolitem{\windowstyle{wxTR\_EDIT\_LABELS}}{Use this style if you wish the user to be
able to edit labels in the tree control.} able to edit labels in the tree control.}
\twocolitem{\windowstyle{wxTR\_MULTIPLE}}{Use this style to allow the user to \twocolitem{\windowstyle{wxTR\_MULTIPLE}}{Use this style to allow the user to

View File

@@ -1087,6 +1087,7 @@ enum wxStretch
#define wxTR_MULTIPLE 0x0020 #define wxTR_MULTIPLE 0x0020
#define wxTR_EXTENDED 0x0040 #define wxTR_EXTENDED 0x0040
#define wxTR_HAS_VARIABLE_ROW_HEIGHT 0x0080 #define wxTR_HAS_VARIABLE_ROW_HEIGHT 0x0080
#define wxTR_NO_LINES 0x0100
/* /*
* wxListCtrl flags * wxListCtrl flags

View File

@@ -74,6 +74,9 @@ public:
virtual ~wxPaintDC(); virtual ~wxPaintDC();
// find the entry for this DC in the cache (keyed by the window)
static WXHDC FindDCInCache(wxWindow* win);
protected: protected:
static wxArrayDCInfo ms_cache; static wxArrayDCInfo ms_cache;

View File

@@ -185,6 +185,7 @@ public:
void OnSetFocus(wxFocusEvent& event); void OnSetFocus(wxFocusEvent& event);
void OnEraseBackground(wxEraseEvent& event); void OnEraseBackground(wxEraseEvent& event);
void OnIdle(wxIdleEvent& event); void OnIdle(wxIdleEvent& event);
void OnPaint(wxPaintEvent& event);
public: public:
// For implementation purposes - sometimes decorations make the client area // For implementation purposes - sometimes decorations make the client area

View File

@@ -262,3 +262,20 @@ wxPaintDCInfo *wxPaintDC::FindInCache(size_t *index) const
return info; return info;
} }
// find the entry for this DC in the cache (keyed by the window)
WXHDC wxPaintDC::FindDCInCache(wxWindow* win)
{
wxPaintDCInfo *info = NULL;
size_t nCache = ms_cache.GetCount();
for ( size_t n = 0; n < nCache; n++ )
{
info = &ms_cache[n];
if ( info->hwnd == win->GetHWND() )
{
return info->hdc;
}
}
return 0;
}

View File

@@ -519,8 +519,10 @@ bool wxTreeCtrl::Create(wxWindow *parent,
return FALSE; return FALSE;
DWORD wstyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP | DWORD wstyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP |
TVS_HASLINES | TVS_SHOWSELALWAYS /* | WS_CLIPSIBLINGS */; TVS_SHOWSELALWAYS /* | WS_CLIPSIBLINGS */;
if ((m_windowStyle & wxTR_NO_LINES) == 0)
wstyle |= TVS_HASLINES;
if ( m_windowStyle & wxTR_HAS_BUTTONS ) if ( m_windowStyle & wxTR_HAS_BUTTONS )
wstyle |= TVS_HASBUTTONS; wstyle |= TVS_HASBUTTONS;

View File

@@ -2952,6 +2952,16 @@ bool wxWindow::HandlePaint()
return GetEventHandler()->ProcessEvent(event); return GetEventHandler()->ProcessEvent(event);
} }
// Can be called from an application's OnPaint handler
void wxWindow::OnPaint(wxPaintEvent& event)
{
HDC hDC = (HDC) wxPaintDC::FindDCInCache((wxWindow*) event.GetEventObject());
if (hDC != 0)
{
MSWDefWindowProc(WM_PAINT, (WPARAM) hDC, 0);
}
}
bool wxWindow::HandleEraseBkgnd(WXHDC hdc) bool wxWindow::HandleEraseBkgnd(WXHDC hdc)
{ {
// Prevents flicker when dragging // Prevents flicker when dragging