]> git.saurik.com Git - wxWidgets.git/commitdiff
Added ability to call wxWindow::OnPaint under Windows (experimental).
authorJulian Smart <julian@anthemion.co.uk>
Thu, 3 Aug 2000 16:11:51 +0000 (16:11 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 3 Aug 2000 16:11:51 +0000 (16:11 +0000)
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

docs/latex/wx/treectrl.tex
include/wx/defs.h
include/wx/msw/dcclient.h
include/wx/msw/window.h
src/msw/dcclient.cpp
src/msw/treectrl.cpp
src/msw/window.cpp

index 0bd2bdc467d3fcd1b6ae279bdc4b4a97ce09a3de..90244948cc0d8577cc0dd05c51b8b8d057e7ae6e 100644 (file)
@@ -22,6 +22,10 @@ To intercept events from a tree control, use the event table macros described in
 \begin{twocollist}\itemsep=0pt
 \twocolitem{\windowstyle{wxTR\_HAS\_BUTTONS}}{Use this style to show + and - buttons to the
 left of parent items. Win32 only. }
 \begin{twocollist}\itemsep=0pt
 \twocolitem{\windowstyle{wxTR\_HAS\_BUTTONS}}{Use this style to show + and - buttons to the
 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
 able to edit labels in the tree control.}
 \twocolitem{\windowstyle{wxTR\_MULTIPLE}}{Use this style to allow the user to
 \twocolitem{\windowstyle{wxTR\_EDIT\_LABELS}}{Use this style if you wish the user to be
 able to edit labels in the tree control.}
 \twocolitem{\windowstyle{wxTR\_MULTIPLE}}{Use this style to allow the user to
index d1ecfe8ca29efb8cafbee1466200c607df8b2bb9..4629929b53ae6f1d273b859c0d3f439aa4c5362b 100644 (file)
@@ -1087,6 +1087,7 @@ enum wxStretch
 #define wxTR_MULTIPLE        0x0020
 #define wxTR_EXTENDED        0x0040
 #define wxTR_HAS_VARIABLE_ROW_HEIGHT 0x0080
 #define wxTR_MULTIPLE        0x0020
 #define wxTR_EXTENDED        0x0040
 #define wxTR_HAS_VARIABLE_ROW_HEIGHT 0x0080
+#define wxTR_NO_LINES        0x0100
 
 /*
  * wxListCtrl flags
 
 /*
  * wxListCtrl flags
index 997f2cfc6e41dd8bdd01378733716f1b4bc5d1f7..5568f0a6a24dfa7c88b001249a9bc8ca8685ee6b 100644 (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:
     static wxArrayDCInfo ms_cache;
 
 protected:
     static wxArrayDCInfo ms_cache;
 
index 72126d5668f84205f2bd823b50cae51fee57fc56..f440f5652a72b2508c7fb6ad960fef4b607c6548 100644 (file)
@@ -185,6 +185,7 @@ public:
     void OnSetFocus(wxFocusEvent& event);
     void OnEraseBackground(wxEraseEvent& event);
     void OnIdle(wxIdleEvent& event);
     void OnSetFocus(wxFocusEvent& event);
     void OnEraseBackground(wxEraseEvent& event);
     void OnIdle(wxIdleEvent& event);
+    void OnPaint(wxPaintEvent& event);
 
 public:
     // For implementation purposes - sometimes decorations make the client area
 
 public:
     // For implementation purposes - sometimes decorations make the client area
index 483fd553762576b24d53739529127397b9aff109..46642e078fc4fc2421bd5e08d049f2409669e7f0 100644 (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;
+}
+
index 73e8d4d856afa540d49d51acd1336aea14d2fbf3..0d54480eb5cdd21ba301c9f997eb30ebf90ff026 100644 (file)
@@ -519,8 +519,10 @@ bool wxTreeCtrl::Create(wxWindow *parent,
         return FALSE;
 
     DWORD wstyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP |
         return FALSE;
 
     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 )
         wstyle |= TVS_HASBUTTONS;
 
     if ( m_windowStyle & wxTR_HAS_BUTTONS )
         wstyle |= TVS_HASBUTTONS;
 
index c238a8b21c1ae6578f18cb5279e6e31c811a3a7d..6aa913b6b2266302ebd62ec02be038f2b7e655ee 100644 (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)
 {
     // Prevents flicker when dragging
 bool wxWindow::HandleEraseBkgnd(WXHDC hdc)
 {
     // Prevents flicker when dragging