OSDN Git Service

PATCH: [ 1157859 ] Add LVS_SHOWSELALWAYS style to dirview
authorPerry Rapp <elsapo@users.sourceforge.net>
Sun, 6 Mar 2005 19:36:08 +0000 (19:36 +0000)
committerPerry Rapp <elsapo@users.sourceforge.net>
Sun, 6 Mar 2005 19:36:08 +0000 (19:36 +0000)
  Src: DirView.cpp
  Common new files: WindowStyle.cpp WindowStyle.h

Src/Common/WindowStyle.cpp [new file with mode: 0644]
Src/Common/WindowStyle.h [new file with mode: 0644]
Src/DirView.cpp
Src/readme.txt

diff --git a/Src/Common/WindowStyle.cpp b/Src/Common/WindowStyle.cpp
new file mode 100644 (file)
index 0000000..986c8e7
--- /dev/null
@@ -0,0 +1,28 @@
+/** 
+ * @file  WindowStyle.cpp
+ *
+ * @brief Utilities (trivial) for manipulating window style
+ */
+// RCS ID line follows -- this is updated by CVS
+// $Id$
+
+#include "StdAfx.h"
+#include "WindowStyle.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+
+/**
+ * @brief Add requested style(s) to windows current style
+ */
+void
+WindowStyle_Add(CWnd * pwnd, DWORD newStyle)
+{
+       DWORD style = pwnd->GetStyle();
+       style |= newStyle;
+       SetWindowLong(pwnd->m_hWnd, GWL_STYLE, style);
+}
diff --git a/Src/Common/WindowStyle.h b/Src/Common/WindowStyle.h
new file mode 100644 (file)
index 0000000..9f7824d
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef WindowStyle_h_included
+#define WindowStyle_h_included
+
+void WindowStyle_Add(CWnd * pwnd, DWORD newStyle);
+
+#endif // WindowStyle_h_included
index 7b4921f..d5a4d8d 100644 (file)
@@ -43,6 +43,7 @@
 #include "7zCommon.h"
 #include "OptionsDef.h"
 #include "BCMenu.h"
+#include "WindowStyle.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -289,16 +290,20 @@ void CDirView::OnInitialUpdate()
        // Display column headers (in appropriate order)
        ReloadColumns();
 
+       // Show selection all the time, so user can see current item even when
+       // focus is elsewhere (ie, on file edit window)
+       WindowStyle_Add(m_pList, LVS_SHOWSELALWAYS);
+
        // Show selection across entire row.
        // Also allow user to rearrange columns via drag&drop of headers
        // if they have a new enough common controls
-       DWORD newstyle = LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP;
+       DWORD exstyle = LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP;
        // Also enable infotips if they have new enough version for our
        // custom draw code
        // LPNMLVCUSTOMDRAW->iSubItem not supported before comctl32 4.71
        if (GetDllVersion(_T("comctl32.dll")) >= PACKVERSION(4,71))
-               newstyle |= LVS_EX_INFOTIP;
-       m_pList->SetExtendedStyle(newstyle);
+               exstyle |= LVS_EX_INFOTIP;
+       m_pList->SetExtendedStyle(exstyle);
 
        // Disable CListViewEx's full row selection which only causes problems
        // (tooltips and custom draw do not work!)
index 6d0761a..97868c6 100644 (file)
    cregexp.cpp csharp.cpp dcl.cpp filesup.cpp fortran.cpp html.cpp js.cpp
    java.cpp list.cpp pascal.cpp perl.cpp php.cpp python.cpp rexx.cpp rsrc.cpp
    sgml.cpp sh.cpp siod.cpp sql.cpp tcl.cpp tex.cpp xml.cpp
+ PATCH: [ 1157859 ] Add LVS_SHOWSELALWAYS style to dirview
+  Src: DirView.cpp
+  Common new files: WindowStyle.cpp WindowStyle.h
+
 
 2005-03-05 Perry
  Rename CDirFrame::SetFilter to CDirFrame::SetFilterStatusDisplay for easier greps.