From d1a4a6ecdac4f118cfea47ecf751e205e160f0be Mon Sep 17 00:00:00 2001 From: aschoen Date: Wed, 24 Jan 2018 13:38:04 +0100 Subject: [PATCH 1/2] Updating WTL version --- thirdparty/wtl/CPL.TXT | 94 - thirdparty/wtl/MS-PL.txt | 22 + thirdparty/wtl/ReadMe.html | 2555 ++++++++++++++++++ thirdparty/wtl/atlapp.h | 1274 ++------- thirdparty/wtl/atlcrack.h | 247 +- thirdparty/wtl/atlctrls.h | 5109 ++++++++++++++++-------------------- thirdparty/wtl/atlctrlw.h | 1054 ++++---- thirdparty/wtl/atlctrlx.h | 1247 ++++----- thirdparty/wtl/atlddx.h | 106 +- thirdparty/wtl/atldlgs.h | 1065 ++++---- thirdparty/wtl/atldwm.h | 165 +- thirdparty/wtl/atlfind.h | 265 +- thirdparty/wtl/atlframe.h | 708 ++--- thirdparty/wtl/atlgdi.h | 634 +---- thirdparty/wtl/atlmisc.h | 3019 +-------------------- thirdparty/wtl/atlprint.h | 78 +- thirdparty/wtl/atlres.h | 44 +- thirdparty/wtl/atlresce.h | 93 - thirdparty/wtl/atlribbon.h | 409 +-- thirdparty/wtl/atlscrl.h | 612 +++-- thirdparty/wtl/atlsplit.h | 475 +++- thirdparty/wtl/atltheme.h | 152 +- thirdparty/wtl/atluser.h | 257 +- thirdparty/wtl/atlwince.h | 2987 --------------------- thirdparty/wtl/atlwinx.h | 394 +-- thirdparty/wtl/readme.htm | 3347 ----------------------- 26 files changed, 8523 insertions(+), 17889 deletions(-) delete mode 100644 thirdparty/wtl/CPL.TXT create mode 100644 thirdparty/wtl/MS-PL.txt create mode 100644 thirdparty/wtl/ReadMe.html delete mode 100644 thirdparty/wtl/atlresce.h delete mode 100644 thirdparty/wtl/atlwince.h delete mode 100644 thirdparty/wtl/readme.htm diff --git a/thirdparty/wtl/CPL.TXT b/thirdparty/wtl/CPL.TXT deleted file mode 100644 index 5207f81..0000000 --- a/thirdparty/wtl/CPL.TXT +++ /dev/null @@ -1,94 +0,0 @@ -Common Public License Version 1.0 - -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and - -b) in the case of each subsequent Contributor: - -i) changes to the Program, and - -ii) additions to the Program; - -where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this Agreement. - -"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. - - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. - -b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. - -c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. - -d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. - - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and - -b) its license agreement: - -i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; - -ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; - -iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and - -iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and - -b) a copy of this Agreement must be included with each copy of the Program. - -Contributors may not remove or alter any copyright notices contained within the Program. - -Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. - - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. - -For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. - - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. - - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. - -Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. diff --git a/thirdparty/wtl/MS-PL.txt b/thirdparty/wtl/MS-PL.txt new file mode 100644 index 0000000..6d2577a --- /dev/null +++ b/thirdparty/wtl/MS-PL.txt @@ -0,0 +1,22 @@ +Microsoft Public License (MS-PL) + +This license governs use of the accompanying software. If you use the software, you +accept this license. If you do not accept the license, do not use the software. + +1. Definitions +The terms "reproduce," "reproduction," "derivative works," and "distribution" have the +same meaning here as under U.S. copyright law. +A "contribution" is the original software, or any additions or changes to the software. +A "contributor" is any person that distributes its contribution under this license. +"Licensed patents" are a contributor's patent claims that read directly on its contribution. + +2. Grant of Rights +(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. +(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. + +3. Conditions and Limitations +(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. +(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. +(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. +(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. +(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. diff --git a/thirdparty/wtl/ReadMe.html b/thirdparty/wtl/ReadMe.html new file mode 100644 index 0000000..ea6268c --- /dev/null +++ b/thirdparty/wtl/ReadMe.html @@ -0,0 +1,2555 @@ + + + + + + Windows Template Library + + + + + + + + + + + + + + + + + + + + + + + + +
+ Windows Template Library - WTL 10 +                + version 10.0.7336 (2017-12-02) +

Copyright © 2017 Microsoft Corporation, WTL Team. All rights reserved.

+ This file is a part of the Windows Template Library.
+ The use and distribution terms for this software are covered by the
+ Microsoft Public License (http://opensource.org/licenses/MS-PL)
+ which can be found in the file MS-PL.txt at the root folder. +

+


+ +

Welcome to the Windows Template Library, version 10. This document contains the following topics:

+ + +


+ +

Introduction

+

+ Windows Template Library, or WTL, is a set of + classes that extend ATL to support more complex user interfaces for either + applications or various UI components, while maintaining the big advantage of + ATL - small and fast code. WTL classes were designed to be the best and the + easiest way to implement rich Win32 based UI for ATL based applications, + servers, components, and controls. +

+ +

+ WTL provides support for implementing many + user interface elements, from frame and popup windows, to MDI, standard and + common controls, common dialogs, property sheets and pages, GDI objects, UI + updating, scrollable windows, splitter windows, command bars, etc. The WTL + classes are mostly templated and use minimal instance data and inline functions. + They were not designed as a framework, so they do not force a particular + application model, and can accommodate any. The classes do not use hooks or + thread local storage, so they have no restrictions that those techniques impose. + They also have no inter-dependencies and can be freely mixed with straight SDK + code. In summary, WTL delivers very small and efficient code, very close in size + and speed to SDK programs, while presenting a more logical, object oriented + model to a programmer. +

+


+ +

Features and Installation

+ +

+ This is the ningth public release of WTL. This version is released + under the Microsoft Public License, enabling developers from the WTL community to + contribute to the library. +

+

+ WTL classes can be used with all versions of VC++ from 2005 to the newest, 2017. + AppWizard for Visual Studio is included. +

+

+ The WTL classes are provided in header files located in the include directory. + The only header files that must be included is atlapp.h, while others can be used when needed. + The name of the file doesn't mean that you have to create an application, just that + atlapp.h contains base definitions required for WTL projects. +

+

+ To install WTL, just copy the whole directory structure, or unpack the archive file, + to the location of your choice. Please be sure to add the WTL\include directory + to the list of include directories in VC++, so that the compiler + can find them when you include them in your projects. +

+

+ Setup programs for the AppWizard are provided. After executing the setup script, + ATL/WTL AppWizard will appear in the list of AppWizards when you select File.New.Project + in VC++ IDE. The file AppWiz\setup.js is the setup script for all supported versions of Visual Studio. +

+

+ To manually install AppWizard for VC++ 2005, copy all WTLAppWiz.* files from AppWiz\Files to VC++ + projects directory, %VCDIR%\VC\vcprojects, where %VCDIR% is the directory + where VC++ 2005 is installed. After that, open WTL10AppWiz.vsz and modify the + line that contains ABSOLUTE_PATH to contain %WTLDIR%\AppWiz\Files, where + %WTLDIR% is the directory where WTL files are. +

+ +

Compiler/IDE/ATL support:

+ +


+ +

Windows SDK support (optional):

+ +


+


+ +

Packing List

+


+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
File Name:Description:

readme.htmlthis file
MS-PL.txtMicrosoft Public License
 
include\
    atlapp.hmessage loop, interfaces, + general app stuff
    atlcrack.hmessage cracker macros
    atlctrls.hstandard and common control + classes
    atlctrlw.hcommand bar class
    atlctrlx.hbitmap button, check list view, + and other controls
    atlddx.hdata exchange for dialogs and + windows
    atldlgs.hcommon dialog classes, property + sheet and page classes
    atldwm.hDWM support classes
    atlfind.hFind/Replace support for Edit + and RichEdit
    atlframe.hframe window classes, MDI, + update UI classes
    atlgdi.hDC classes, GDI object classes
    atlmisc.hWTL ports of CPoint, CRect, + CSize, CString, etc.
    atlprint.hprinting and print preview
    atlres.hstandard resource IDs
    atlribbon.hRibbonUI support
    atlscrl.hscrollable windows
    atlsplit.hsplitter windows
    atltheme.hWindows XP theme classes
    atluser.hmenu class, USER object classes
    atlwinx.hextensions of ATL windowing + support
 
Samples\
    Aero\...Vista Aero glass showcase
    Alpha\...Windows XP 32-bit (alpha) + toolbar images
    BmpView\...bitmap file view sample
    GuidGen\...WTL version of the GuidGen + sample
    MDIDocVw\...WTL version of the MDI sample
    MemDlg\...In-memory dialog sample
    MTPad\...multithreaded notepad sample
    MTPad7\...MTPad with RibbonUI
    TabBrowser\...Web browser using TabView
    Wizard97Test\...Wizard97 showcase + sample
    WTLExplorer\...Explorer-like application + sample
 
AppWiz\
    setup.jsAppWizard setup program for all versions of + Visual Studio
    Files\...WTL AppWizard files
+


+


+ +

Class Overview

+


+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
usage:       mi base   -   a base class (multiple inheritance)
 client   -   wrapper class for a handle
 as-is   -   to be used directly
 impl   -   implements a window (has + WindowProc) or other support
 helper   -   a helper class
 base   -   implementation base class
+


+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
class name:usage:description:

App/module support
CAppModuleas-isapp support, CComModule derived
CServerAppModuleas-ismodule for COM servers
CMessageLoopas-ismessage loop
CMessageFiltermi basemessage filter interface
CIdleHandlermi baseidle time handler interface

Frame windows
CFrameWindowImplBasebase 
CFrameWindowImplimplframe window support
COwnerDrawimpl mi baseowner-draw msg map and handlers
CDialogResize + impl mi basesupport for resizing dialogs
CDoubleBufferImpl + impl midouble-buffer painting support
CDoubleBufferWindowImpl + impldouble-buffer painting window

MDI windows
CMDIWindowclientMDI methods
CMDIFrameWindowImplimplMDI frame window
CMDIChildWindowImplimplMDI child window

Update UI
CUpdateUIBasebase 
CUpdateUImi base classprovides support for UI update
CDynamicUpdateUImi base classprovides dynamic support for UI update

Standard controls
CStaticclientstatic ctrl
CButtonclientbutton ctrl
CListBoxclientlist box ctrl
CComboBoxclientcombo box ctrl
CEditclientedit ctrl
CEditCommandsmistandard edit command support
CScrollBarclientscroll bar ctrl

Common controls
CImageListclientimage list
CListViewCtrlclientlist view ctrl
CTreeViewCtrlclienttree view ctrl
CTreeItemhelper 
CTreeViewCtrlExclientuses CTreeItem
CHeaderCtrlclientheader bar ctrl
CToolBarCtrlclienttoolbar ctrl
CStatusBarCtrlclientstatus bar ctrl
CTabCtrlclienttab ctrl
CToolTipCtrlclienttool tip ctrl
CToolInfohelper 
CTrackBarCtrlclienttrackbar ctrl
CUpDownCtrlclientup-down ctrl
CProgressBarCtrlclientprogress bar ctrl
CHotKeyCtrlclienthot key ctrl
CAnimateCtrlclientanimation ctrl
CRichEditCtrlclientrich edit ctrl
CRichEditCommandsmistd rich edit commands support
CDragListBoxclientdrag list box
CDragListNotifyImplimpl mi classsupport for notifications
CReBarCtrlclientrebar ctrl
CComboBoxExclientextended combo box
CDateTimePickerCtrlclientdate-time ctrl
CFlatScrollBarImplmi implflat scroll bars support
CFlatScrollBaras-isflat scroll bars support
CIPAddressCtrlclientIP address ctrl
CMonthCalendarCtrlclientmonth calendar ctrl
CCustomDrawimpl mi classcustom draw handling support

Property sheet & page
CPropertySheetWindowclient 
CPropertySheetImplimplproperty sheet
CPropertySheetas-is 
CPropertyPageWindowclient 
CPropertyPageImplimplproperty page
CPropertyPageas-is 
CAxPropertyPageImplimplproperty page with ActiveX
CAxPropertyPageas-is 
CWizard97SheetWindowclient 
CWizard97SheetImplimplWizard97 property sheet
CWizard97Sheetas-is 
CWizard97PageWindowclient 
CWizard97PageImplimplWizard97 property page
CWizard97ExteriorPageImplimplWizard97 exterior page
CWizard97InteriorPageImplimplWizard97 interior page
CAeroWizardFrameWindowclient 
CAeroWizardFrameImplimplAero Wizard frame
CAeroWizardFrameas-is 
CAeroWizardPageWindowclient 
CAeroWizardPageImplimplAero Wizard page
CAeroWizardPageas-is 
CAeroWizardAxPageImplimplAero Wizard page with ActiveX
CAeroWizardAxPageas-is 

Common dialogs
CFileDialogImplimplGetOpenFileName/GetSaveFileName
CFileDialogas-is 
CSimpleFileDialogas-isno customization
CMultiFileDialogImplimplMulti-select GetOpenFileName
CMultiFileDialogas-is 
CShellFileDialogImplbase 
CShellFileOpenDialogImplimplShell File Open dialog
CShellFileOpenDialogas-is 
CShellFileSaveDialogImplimplShell File Save dialog
CShellFileSaveDialogas-is 
CFolderDialogImplimpldirectory picker
CFolderDialogas-is 
CFontDialogImplimplChooseFont common dialog
CFontDialogas-is 
CRichEditFontDialogImplimplChooseFont for rich edit
CRichEditFontDialogas-is 
CColorDialogImplimplChooseColor common dialog
CColorDialogas-is 
CPrintDialogImplimplPrintDlg common dialog
CPrintDialogas-is 
CPrintDialogExImplimplnew Win2000 print dialog
CPrintDialogExas-is 
CPageSetupDialogImplimplPageSetupDlg common dialog
CPageSetupDialogas-is 
CFindReplaceDialogImplimplFindText/ReplaceText
CFindReplaceDialogas-is 

User support
CMenuclientmenu support
CMenuItemInfoas-isMENUITEMINFO wrapper
CAcceleratorclientaccelerator table
CIconclienticon object
CCursorclientcursor object
CResourceclientgeneric resource object

GDI support
CDCclientDC support
CPaintDCclientfor handling WM_PAINT
CClientDCclientfor GetDC
CWindowDCclientfor GetWindowDC
CMemoryDCclientin-memory DC
CPenclientGDI pen object
CBrushclientGDI brush object
CLogFontas-isLOGFONT wrapper
CFontclientGDI font object
CBitmapclientGDI bitmap object
CPaletteclientGDI palette object
CRgnclientGDI region object

Enhanced controls
CCommandBarCtrlImplimplcommand bar
CCommandBarCtrlas-is 
CBitmapButtonImplimplbitmap button
CBitmapButtonas-is 
CCheckListViewCtrlImplimplcheck list box
CCheckListViewCtrlas-is 
CHyperLinkImplimplhyper link control
CHyperLinkas-is 
CWaitCursoras-iswait cursor
CCustomWaitCursoras-iscustom and animated wait cursor
CMultiPaneStatusBarCtrlImplimplstatus bar with multiple panes
CMultiPaneStatusBarCtrlas-is 
CPaneContainerImplimplpane window container
CPaneContaineras-is 
CSortListViewImplimplsorting list view control
CSortListViewCtrlImplimpl 
CSortListViewCtrlas-is 
CTabViewImpl;impltab view window
CTabViewas-is 

Scrolling window support
CScrollImplimpl miscrolling support
CScrollWindowImplimplscrollable window
CMapScrollImplimpl miscrolling support with map modes
CMapScrollWindowImplimplscrollable window with map modes
CZoomScrollImplimpl mizooming support
CZoomScrollWindowImplimplzooming window
CScrollContainerImplimplscroll container window
CScrollContaineras-is 

Splitter window support
CSplitterImplimpl misplitter support
CSplitterWindowImplimplsplitter window
CSplitterWindowas-is 

Theming support
CThemeclientWindows XP theme
CThemeImplimpltheming support for a window

Buffered paint and animation support
CBufferedPaintas-isbuffered paint
CBufferedPaintImplimpl mibuffered paint support
CBufferedPaintWindowImplimplwindow with buffered paint
CBufferedAnimationas-isbuffered animation
CBufferedAnimationImplimpl mibuffered animation support
CBufferedAnimationWindowImplimplwindow with buffered animation

Edit and RichEdit Find/Replace support
CEditFindReplaceImplBasebase 
CEditFindReplaceImplmiEdit Find/Replace support
CRichEditFindReplaceImplmiRichEdit Find/Replace support

Printing support
CPrinterInfoas-isprint info support
CPrinterclientprinter handle wrapper
CDevModeclientDEVMODE wrapper
CPrinterDCclientprinting DC support
CPrintJobInfoclientprint job info
CPrintJobclientprint job support
CPrintPreviewmiprint preview support
CPrintPreviewWindowImplimplprint preview window
CPrintPreviewWindowas-is 
CZoomPrintPreviewWindowImplimplzooming print preview window
CZoomPrintPreviewWindowas-is 

Miscellaneous
CWinDataExchangemidata exchange for controls
CRecentDocumentListmi or as-issupport for MRU list
CFindFileas-isfile search support

In-memory dialog
CDialogBaseUnitshelperdialog units helper
CMemDlgTemplateas-isIn-memory dialog template
CIndirectDialogImplimplIn-memory dialog class

Task dialog
CTaskDialogImplimplTask Dialog in Vista
CTaskDialogas-is 

DWM classes
CDwmclientDWM handle warapper
CDwmImplimpl baseDWM support
CDwmWindowimplDWM window support
CDwmThumbnailclientDWM thumbnail wrapper
CAeroControlImplimplsupport for Aero controls

Ribbon classes
CRibbonUpdateUImi baseautomatic mapping of ribbon UI elements
RibbonUI::CtrlImplbase implbase class for all ribbon controls
RibbonUI::CommandCtrlImplbase implbase class for ribbon controls
RibbonUI::CollectionImplBasebasebase class for all RibbonUI collections
RibbonUI::CollectionImplimplRibbonUI collections
RibbonUI::CollectionCtrlImplimplspecializable class for ribbon collection controls
RibbonUI::ToolbarGalleryCtrlImplbase implbase class for ribbon toolbar gallery controls
RibbonUI::CRibbonImplimplRibbon implementation class
CRibbonFrameWindowImplBasebasebase frame class for Ribbon
CRibbonFrameWindowImplimplRibbon frame window class
CRibbonMDIFrameWindowImplimplRibbon MDI frame window class
CRibbonPersistas-isRibbon persistance support
+


+


+ +

ATL/WTL AppWizard

+ +

ATL/WTL AppWizard generates starting code for a WTL application. It has options to create code for different application types and features.

+

You can choose the following options:

+ +


+ +

ATL/WTL AppWizard supports VC++ 2005, 2008, 2010, 2012, 2013, 2015, and 2017.

+


+


+ +


+ +

WTL Releases

+


+ +

History

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
WTL 10?
WTL 9.12015
WTL 9.02014
WTL 8.02007
WTL 7.52005
WTL 7.12003
WTL 7.02002
WTL 3.12000
WTL 3.01999
+


+ +

Changes Between WTL 10 and 9.1

+

TODO

+


+ +

Changes Between WTL 9.1 and 9.0

+

New and improved:

+
+

+ Full compatibility with VS2015
+ NuGet support and package
+ Microsoft Public License (MS-PL)
+ New sample: MemDlg - demonstrates use of in-memory dialogs +

+
+


+ +

Fixes and enhancements:

+
+

+ Fixes for code analysis warnings
+ Fixes for strict const-qualification conformance (/Zc:strictStrings)
+ CEditFindReplaceImpl::UseShadowBuffer(): Use AtlGetCommCtrlVersion() instead of GetProcAddress()
+ Misc improvements: missing initialization, undefined messages, better #ifdefs
+ CFrameWndClassInfo: Use GetSystemMetrics() for icon sizes
+ BEGIN_MSG_MAP_EX and BEGIN_DDX_MAP: Fix for C4555: expression has no effect
+ CResource::LoadEx(): Fix for the wrong order for parameters to ::FindResourceEx()
+ CPaneContainerImpl: +

+ +

+ CImageListManaged: Fix for assert when using attach or operator =
+ WTLExplorer sample cleanup
+ GenericWndClass::Register(): Fix for Windows CE
+ App Wizard: Improved code for generating project configurations
+ CSplitterImpl::OnCaptureChanged(): Fixed so it moves splitter bar only if move was in progress
+ CDynamicUpdateUI::UIRemoveUpdateElement() leaks memory if UPDUI_TEXT is set
+ CToolInfo and CToolTipCtrl: nIDTool argument should be UINT_PTR instead of UINT
+ CSplitterImpl: Added GetSplitterPosPct()
+ CCommandBarCtrlImpl: Fixed incorrect use of m_wndParent when AttachToWindow() is used +

+
+


+ +

Changes Between WTL 9.0 and 8.0

+

New and improved:

+
+

+ Full compatibility with VS2008, VS2010, VS2012, and VS2013
+ New CRegKeyEx class for uniform support for registry
+ New MinCrtHelper functions for uniform support for _ATL_MIN_CRT
+ New DWM classes in atldwm.h
+ New Ribbon classes in atlribbon.h
+ New CDialogBaseUnits class
+ Extended DDX support to TabCtrl, ComboBox, ListBox and ListView selection index
+ Improved font handling in CHyperLink, CPaneContainer, CTabView
+ CHyperlink: Added options for auto-create link font and single-line mode
+ CBitmapButtonImpl: Added checked state, GetCheck()/SetCheck(), and check mode extended styles
+ UpdateUI: Added support for radio menu items for popup menus
+ Added support for new VersionHelpers.h in WinSDK 8.1 - GetVersionEx() is now deprecated
+ Improved global support for old SDK headers, and for original headers in VC6 and VC7.x
+ Global support for builds with NOMINMAX defined
+ Global support for builds with STRICT_TYPED_ITEMIDS defined
+ Global support for builds with _ATL_ALL_USER_WARNINGS defined
+ Splitter Window: +

+ +

+ Added CImageListManaged to manage the lifetime of wrapped image list
+ Added Vista standard menu bar look option for Command bar
+ Added new Rich Edit wrappers for _RICHEDIT_VER >= 0x0800
+ Added new Win8 methods to Theme classes
+ Added override of SubclassWindow() to CSplitterWindowImpl, CPaneContainerImpl, CTabViewImpl,
+   CScrollImpl, CMapScrollImpl, CZoomScrollImpl, and CScrollContainerImpl
+ CZoomScrollImpl: +

+ +

+ AppWizard: +

+ +

+ Updated samples and added VS2005 project files
+ New sample: MTPad7 - demonstrates Ribbon UI +

+
+


+ +

Fixes and enhancements:

+
+

General:

+ +


+

Controls:

+ +


+

Cracked Handlers:

+ +


+

App Wizard:

+ +


+

App Wizard CE / App Wizard Mobile:

+ +


+

Misc:

+ +
+


+ +

Changes Between WTL 8.0 and 7.5

+

New and improved:

+
+

RunTimeHelper functions for + correct struct sizes on different versions of Windows
ModuleHelper functions for uniform support of ATL3 and ATL7 module classes
SecureHelper functions for support of secure and non-secure run-time + functions
Support for new Vista features:

+ +

+ New TabView classes
New dialog class that uses in-memory dialog templates
New CMultiFileDialogImpl and CMultiFileDialog classes that support + multi-select file dialogs
Added message cracker handler prototypes for all handlers
Replaced use of _alloca with CTempBuffer everywhere (and added CTempBuffer + version for ATL3)
New classes for find/replace support for Edit or RichEdit
New class CFileDialogEx that supports GetOpenFileNameEx for Windows Mobile 5
+ New features for the App Wizard: +

+ +

Updates for the desktop App Wizard:

+ +

Support for VC2005 Express:

+ +

New AppWizard for Mobile 2003 and 2005 platforms
+ New samples:

+ +

MTPad sample updated to show usage of CRichEditFindReplaceImpl and CEditCommands/CRichEditCommands

+
+


+ +

Fixes and enhancements:

+
+

Command Bar:

+ +


+

CFolderDialog:

+ +


+

Scroll Windows:

+ +


+

App Wizard:

+ +


+

App Wizard CE:

+ +


+

Cracked Handlers:

+ +


+

CDialogResize:

+ +


+

CFrameWindowImpl:

+ +


+

Windows CE:

+ +


+

CFindFile:

+ +


+

General:

+ +


+

Misc:

+ +
+


+


+ +

Changes Between WTL 7.5 and 7.1

+


+

New and improved:

+
+

+ VS2005 Compatibility: + Added support for Visual Studio 2005 - both desktop and Windows CE
+ Classes for icons, cursors, accelerator tables
+ CSortListViewImpl, CSortListViewCtrlImpl, and CSortListViewCtrl classes
+ Impl classes for Wizard 97 style wizards: CWizard97Sheet, + CWizard97Page, CWizard97ExteriorPage, CWizard97InteriorPage
+ CMemoryDC and CDoubleBufferWindowImpl classes
+ Windows CE specific classes in new header, atlwince.h
+ CScrollContainer class
+ CZoomScrollImpl and CZoomScrollWindowImpl classes
+ CZoomPrintPreviewWindowImpl and CZoomPrintPreviewWindow classes
+ Global functions: AtlGetBitmapResourceInfo, + AtlGetBitmapResourceBitsPerPixel
+ New REFLECT_* macros to enable selective reflection of messages
+ App Wizard: Added App Wizard for VS2005
+ App Wizard: Added App Wizard for Windows CE for VS2005
+ New samples: WTLExplorer, ImageView, SPControls
+

+
+


+ +

Fixes and enhancements:

+
+

Command Bar:

+ +


+

MDI Command Bar:

+ +

CString:

+ +

CScrollImpl:

+ +


+

CMapScrollImpl:

+ +


+

CTheme:

+ +


+

CFrameWindowImpl:

+ +


+

CDialogResize:

+ +


+

CReBarCtrl:

+ +


+

CRichEdit:

+ +


+

CHyperLink:

+ +

CPropertySheetImpl:

+ +


+

CFolderDialog:

+ +


+

Update UI:

+ +


+

CDC:

+ +


+

Printing:

+ +


+

AppWizard:

+ +


+

General:

+ +


+

Misc:

+ +
+


+ +

Changes Between WTL 7.1 and 7.0

+

New and improved:

+
+

VC7 Compatibility: Support for ATL7 Module classes and critical sections and AppWizard setup for VC++ 7.1

+

Windows CE Support: Full compatibility with Windows CE platforms and AppWizard for eMbedded Visual C++

+

Namespace Support: Automatic "using ATL" (ATL7 only) or "using WTL" can now be turned off

+

CHyperLink New Features: not underlined, underlined when hover, command button, link tags

+

CCustomWaitCursor class supports custom and animated wait cursors

+

AtlCreateBoldFont() for creating bold version of an existing font

+
+


+

Fixes and enhancements:

+
+

CFrameWindowImpl:

+ +


+

UpdateUI:

+ +


+

DDX:

+ +


+

Command Bar:

+ +


+

MDI Command Bar:

+ +


+

AppWizard:

+ +


+

CTreeViewCtrl:

+ +


+

CThemeImpl:

+ +


+

CFolderDialog:

+ +


+

CDialogResize:

+ +


+

CAppModule:

+ +


+

CString:

+ +


+

CRecentDocumentList:

+ +


+

Misc:

+ +


+

General:

+ +
+


+ +

Changes Between WTL 7.0 and 3.1

+

New classes and features:

+
+

Support for new Common Controls v6 messages

+

Support for Visual Studio .NET and ATL 7.0

+

WTLApp70 - new AppWizard for Visual Studio .NET

+

CThemeImpl - implements support for Windows XP themes

+

CMDICommandBarCtrl - implements Command Bar for MDI applications

+
+


+

Fixes and enhancements:

+
+

Command Bar:

+ +


+

CFrameWindowImpl:

+ +


+

Update UI:

+ +


+

CString:

+ +


+

CDC:

+ +


+

CListViewCtrl:

+ +


+

CRichEditCtrl:

+ +


+

CHyperLink:

+ +


+

CColorDialog:

+ +


+

atlcrack.h:

+ +


+

atlapp.h:

+ +


+

atlctrls.h:

+ +


+

CRecentDocumentList:

+ +


+

CSplitterWindow:

+ +


+

Printing:

+ +


+

Misc:

+ +


+

AppWizard:

+ +


+

Samples:

+ +
+


+ +

Changes Between WTL 3.1 and 3.0

+

New classes:

+
+

+ CPaneContainer - implements a window that provides a title bar and a close button (like Explorer) +

+

+ CDialogResize - an MI class that allows resizing of dialogs (or any windows with child windows/controls) +

+

+ CAxPropertyPageImpl - implements a property page that can host ActiveX controls +

+
+


+

Fixes and enhancements:

+
+

+ CServerAppModule now clears m_hEventShutdown to avoid calling CloseHandle twice +

+


+

CString:

+ +


+

+ CEdit and CRichEditCtrl: SetSelAll and SetSelNone had reversed implementation +

+


+

+ atlres.h: Changed IDs so that they are compatible with MFC's afxres.h +

+


+

Command Bar:

+ +


+

CBitmapButton:

+ +


+

CDC:

+ +


+

CMenu:

+ +


+

+ GDI and USER classes should destroy the GDI/USER objects in Attach if GDI/USER resource is managed +

+


+

CFrameWindowImpl:

+ +


+

CRecentDocumentList:

+ +


+

Update UI:

+ +


+

CSplitterWindow:

+ +


+

+ atlcrack.h: Added handlers for following new + messages:
+     WM_APPCOMMAND
+     WM_NCXBUTTONDOWN
+     WM_NCXBUTTONUP
+     WM_NCXBUTTONDBLCLK
+     WM_XBUTTONDOWN
+     WM_XBUTTONUP
+     WM_XBUTTONDBLCLK +

+


+

Win64:

+ +


+

Misc:

+ +


+

AppWizard:

+ +
+


+ +

- end of readme.html -

+ + + + diff --git a/thirdparty/wtl/atlapp.h b/thirdparty/wtl/atlapp.h index 05078d9..433c090 100644 --- a/thirdparty/wtl/atlapp.h +++ b/thirdparty/wtl/atlapp.h @@ -1,13 +1,10 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. +// Windows Template Library - WTL version 10.0 +// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. +// Microsoft Public License (http://opensource.org/licenses/MS-PL) +// which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLAPP_H__ #define __ATLAPP_H__ @@ -22,60 +19,65 @@ #error atlapp.h requires atlbase.h to be included first #endif -#ifndef _WIN32_WCE - #if (WINVER < 0x0400) - #error WTL requires Windows version 4.0 or higher - #endif - - #if (_WIN32_IE < 0x0300) - #error WTL requires IE version 3.0 or higher - #endif +#ifdef _WIN32_WCE + #error WTL10 doesn't support Windows CE #endif #ifdef _ATL_NO_COMMODULE #error WTL requires that _ATL_NO_COMMODULE is not defined #endif -#if (_ATL_VER >= 0x0900) && defined(_ATL_MIN_CRT) - #error _ATL_MIN_CRT is not supported with ATL 9.0 and higher +#if (_MSC_VER < 1400) + #error WTL10 requires C++ compiler version 14 (Visual C++ 2005) or higher #endif -#if defined(_WIN32_WCE) && defined(_ATL_MIN_CRT) - #pragma message("Warning: WTL for Windows CE doesn't use _ATL_MIN_CRT") +#if (WINVER < 0x0501) + #error WTL requires WINVER >= 0x0501 #endif -#include -#if !defined(_ATL_MIN_CRT) && defined(_MT) && !defined(_WIN32_WCE) - #include // for _beginthreadex +#if (_WIN32_WINNT < 0x0501) + #error WTL requires _WIN32_WINNT >= 0x0501 #endif -#if (_ATL_VER < 0x0800) && !defined(_DEBUG) - #include +#if (_WIN32_IE < 0x0600) + #error WTL requires _WIN32_IE >= 0x0600 #endif -#include -#ifndef _WIN32_WCE - #pragma comment(lib, "comctl32.lib") +#if (_ATL_VER < 0x0800) + #error WTL10 requires ATL version 8 or higher +#endif + +#ifdef _ATL_MIN_CRT + #error WTL10 doesn't support _ATL_MIN_CRT +#endif + +#include +#ifdef _MT + #include // for _beginthreadex #endif -#ifndef _WIN32_WCE - #include "atlres.h" -#else // CE specific - #include "atlresce.h" -#endif // _WIN32_WCE +#include +#pragma comment(lib, "comctl32.lib") + +// Check for VS2005 without newer WinSDK +#if (_MSC_VER == 1400) && !defined(RB_GETEXTENDEDSTYLE) + #error WTL10 requires WinSDK 6.0 ot higher +#endif -// We need to disable this warning because of template class arguments -#pragma warning(disable: 4127) +#include +#pragma comment(lib, "uxtheme.lib") -#if (_ATL_VER >= 0x0900) && !defined(_SECURE_ATL) - #define _SECURE_ATL 1 +#if defined(_SYSINFOAPI_H_) && defined(NOT_BUILD_WINDOWS_DEPRECATE) + #include #endif +#include "atlres.h" + /////////////////////////////////////////////////////////////////////////////// // WTL version number -#define _WTL_VER 0x0810 +#define _WTL_VER 0x1000 // version 10.0 /////////////////////////////////////////////////////////////////////////////// @@ -88,8 +90,6 @@ // CAppModule // CServerAppModule // -// CRegKeyEx -// // Global functions: // AtlGetDefaultGuiFont() // AtlCreateControlFont() @@ -97,341 +97,6 @@ // AtlInitCommonControls() -/////////////////////////////////////////////////////////////////////////////// -// Global support for Windows CE - -#ifdef _WIN32_WCE - -#ifndef SW_SHOWDEFAULT - #define SW_SHOWDEFAULT SW_SHOWNORMAL -#endif // !SW_SHOWDEFAULT - -// These get's OR-ed in a constant and will have no effect. -// Defining them reduces the number of #ifdefs required for CE. -#define LR_DEFAULTSIZE 0 -#define LR_LOADFROMFILE 0 - -#ifndef SM_CXCURSOR - #define SM_CXCURSOR 13 -#endif -#ifndef SM_CYCURSOR - #define SM_CYCURSOR 14 -#endif - -inline BOOL IsMenu(HMENU hMenu) -{ - MENUITEMINFO mii = { sizeof(MENUITEMINFO) }; - ::SetLastError(0); - BOOL bRet = ::GetMenuItemInfo(hMenu, 0, TRUE, &mii); - if(!bRet) - bRet = (::GetLastError() != ERROR_INVALID_MENU_HANDLE) ? TRUE : FALSE; - return bRet; -} - -#if (_WIN32_WCE >= 410) -extern "C" void WINAPI ListView_SetItemSpacing(HWND hwndLV, int iHeight); -#endif // (_WIN32_WCE >= 410) - -inline int MulDiv(IN int nNumber, IN int nNumerator, IN int nDenominator) -{ - __int64 multiple = nNumber * nNumerator; - return static_cast(multiple / nDenominator); -} - -#if (_ATL_VER >= 0x0800) - -#ifndef _WTL_KEEP_WS_OVERLAPPEDWINDOW - #ifdef WS_OVERLAPPEDWINDOW - #undef WS_OVERLAPPEDWINDOW - #define WS_OVERLAPPEDWINDOW 0 - #endif // WS_OVERLAPPEDWINDOW -#endif // !_WTL_KEEP_WS_OVERLAPPEDWINDOW - -#ifndef RDW_FRAME - #define RDW_FRAME 0 -#endif // !RDW_FRAME - -#ifndef WM_WINDOWPOSCHANGING - #define WM_WINDOWPOSCHANGING 0 -#endif // !WM_WINDOWPOSCHANGING - -#define FreeResource(x) -#define UnlockResource(x) - -namespace ATL -{ - inline HRESULT CComModule::RegisterClassObjects(DWORD /*dwClsContext*/, DWORD /*dwFlags*/) throw() - { return E_NOTIMPL; } - inline HRESULT CComModule::RevokeClassObjects() throw() - { return E_NOTIMPL; } -}; // namespace ATL - -#ifndef lstrlenW - #define lstrlenW (int)ATL::lstrlenW -#endif // lstrlenW - -inline int WINAPI lstrlenA(LPCSTR lpszString) -{ return ATL::lstrlenA(lpszString); } - -#ifdef lstrcpyn - #undef lstrcpyn - #define lstrcpyn ATL::lstrcpynW -#endif // lstrcpyn - -#ifndef SetWindowLongPtrW - inline LONG_PTR tmp_SetWindowLongPtrW( HWND hWnd, int nIndex, LONG_PTR dwNewLong ) - { - return( ::SetWindowLongW( hWnd, nIndex, LONG( dwNewLong ) ) ); - } - #define SetWindowLongPtrW tmp_SetWindowLongPtrW -#endif - -#ifndef GetWindowLongPtrW - inline LONG_PTR tmp_GetWindowLongPtrW( HWND hWnd, int nIndex ) - { - return( ::GetWindowLongW( hWnd, nIndex ) ); - } - #define GetWindowLongPtrW tmp_GetWindowLongPtrW -#endif - -#ifndef LongToPtr - #define LongToPtr(x) ((void*)x) -#endif - -#ifndef PtrToInt - #define PtrToInt( p ) ((INT)(INT_PTR) (p) ) -#endif - -#else // !(_ATL_VER >= 0x0800) - -#ifdef lstrlenW - #undef lstrlenW - #define lstrlenW (int)::wcslen -#endif // lstrlenW - -#define lstrlenA (int)strlen - -#ifndef lstrcpyn - inline LPTSTR lstrcpyn(LPTSTR lpstrDest, LPCTSTR lpstrSrc, int nLength) - { - if(lpstrDest == NULL || lpstrSrc == NULL || nLength <= 0) - return NULL; - int nLen = min(lstrlen(lpstrSrc), nLength - 1); - LPTSTR lpstrRet = (LPTSTR)memcpy(lpstrDest, lpstrSrc, nLen * sizeof(TCHAR)); - lpstrDest[nLen] = 0; - return lpstrRet; - } -#endif // !lstrcpyn - -#ifndef lstrcpynW - inline LPWSTR lstrcpynW(LPWSTR lpstrDest, LPCWSTR lpstrSrc, int nLength) - { - return lstrcpyn(lpstrDest, lpstrSrc, nLength); // WinCE is Unicode only - } -#endif // !lstrcpynW - -#ifndef lstrcpynA - inline LPSTR lstrcpynA(LPSTR lpstrDest, LPCSTR lpstrSrc, int nLength) - { - if(lpstrDest == NULL || lpstrSrc == NULL || nLength <= 0) - return NULL; - int nLen = min(lstrlenA(lpstrSrc), nLength - 1); - LPSTR lpstrRet = (LPSTR)memcpy(lpstrDest, lpstrSrc, nLen * sizeof(char)); - lpstrDest[nLen] = 0; - return lpstrRet; - } -#endif // !lstrcpyn - -#ifdef TrackPopupMenu - #undef TrackPopupMenu -#endif // TrackPopupMenu - -#define DECLARE_WND_CLASS_EX(WndClassName, style, bkgnd) \ -static CWndClassInfo& GetWndClassInfo() \ -{ \ - static CWndClassInfo wc = \ - { \ - { style, StartWindowProc, \ - 0, 0, NULL, NULL, NULL, (HBRUSH)(bkgnd + 1), NULL, WndClassName }, \ - NULL, NULL, IDC_ARROW, TRUE, 0, _T("") \ - }; \ - return wc; \ -} - -#ifndef _MAX_FNAME - #define _MAX_FNAME _MAX_PATH -#endif // _MAX_FNAME - -#if (_WIN32_WCE < 400) - #define MAKEINTATOM(i) (LPTSTR)((ULONG_PTR)((WORD)(i))) -#endif // (_WIN32_WCE < 400) - -#if (_WIN32_WCE < 410) - #define WHEEL_PAGESCROLL (UINT_MAX) - #define WHEEL_DELTA 120 -#endif // (_WIN32_WCE < 410) - -#ifdef DrawIcon - #undef DrawIcon -#endif - -#ifndef VARCMP_LT - #define VARCMP_LT 0 -#endif -#ifndef VARCMP_EQ - #define VARCMP_EQ 1 -#endif -#ifndef VARCMP_GT - #define VARCMP_GT 2 -#endif -#ifndef VARCMP_NULL - #define VARCMP_NULL 3 -#endif - -#ifndef RDW_ALLCHILDREN - #define RDW_ALLCHILDREN 0 -#endif - -#endif // !(_ATL_VER >= 0x0800) - -#endif // _WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// Global support for using original VC++ 6.0 headers with WTL - -#ifndef _ATL_NO_OLD_HEADERS_WIN64 -#if !defined(_WIN64) && (_ATL_VER < 0x0700) - - #ifndef PSM_INSERTPAGE - #define PSM_INSERTPAGE (WM_USER + 119) - #endif // !PSM_INSERTPAGE - - #ifndef GetClassLongPtr - #define GetClassLongPtrA GetClassLongA - #define GetClassLongPtrW GetClassLongW - #ifdef UNICODE - #define GetClassLongPtr GetClassLongPtrW - #else - #define GetClassLongPtr GetClassLongPtrA - #endif // !UNICODE - #endif // !GetClassLongPtr - - #ifndef GCLP_HICONSM - #define GCLP_HICONSM (-34) - #endif // !GCLP_HICONSM - - #ifndef GetWindowLongPtr - #define GetWindowLongPtrA GetWindowLongA - #define GetWindowLongPtrW GetWindowLongW - #ifdef UNICODE - #define GetWindowLongPtr GetWindowLongPtrW - #else - #define GetWindowLongPtr GetWindowLongPtrA - #endif // !UNICODE - #endif // !GetWindowLongPtr - - #ifndef SetWindowLongPtr - #define SetWindowLongPtrA SetWindowLongA - #define SetWindowLongPtrW SetWindowLongW - #ifdef UNICODE - #define SetWindowLongPtr SetWindowLongPtrW - #else - #define SetWindowLongPtr SetWindowLongPtrA - #endif // !UNICODE - #endif // !SetWindowLongPtr - - #ifndef GWLP_WNDPROC - #define GWLP_WNDPROC (-4) - #endif - #ifndef GWLP_HINSTANCE - #define GWLP_HINSTANCE (-6) - #endif - #ifndef GWLP_HWNDPARENT - #define GWLP_HWNDPARENT (-8) - #endif - #ifndef GWLP_USERDATA - #define GWLP_USERDATA (-21) - #endif - #ifndef GWLP_ID - #define GWLP_ID (-12) - #endif - - #ifndef DWLP_MSGRESULT - #define DWLP_MSGRESULT 0 - #endif - - typedef long LONG_PTR; - typedef unsigned long ULONG_PTR; - typedef ULONG_PTR DWORD_PTR; - - #ifndef HandleToUlong - #define HandleToUlong( h ) ((ULONG)(ULONG_PTR)(h) ) - #endif - #ifndef HandleToLong - #define HandleToLong( h ) ((LONG)(LONG_PTR) (h) ) - #endif - #ifndef LongToHandle - #define LongToHandle( h) ((HANDLE)(LONG_PTR) (h)) - #endif - #ifndef PtrToUlong - #define PtrToUlong( p ) ((ULONG)(ULONG_PTR) (p) ) - #endif - #ifndef PtrToLong - #define PtrToLong( p ) ((LONG)(LONG_PTR) (p) ) - #endif - #ifndef PtrToUint - #define PtrToUint( p ) ((UINT)(UINT_PTR) (p) ) - #endif - #ifndef PtrToInt - #define PtrToInt( p ) ((INT)(INT_PTR) (p) ) - #endif - #ifndef PtrToUshort - #define PtrToUshort( p ) ((unsigned short)(ULONG_PTR)(p) ) - #endif - #ifndef PtrToShort - #define PtrToShort( p ) ((short)(LONG_PTR)(p) ) - #endif - #ifndef IntToPtr - #define IntToPtr( i ) ((VOID *)(INT_PTR)((int)i)) - #endif - #ifndef UIntToPtr - #define UIntToPtr( ui ) ((VOID *)(UINT_PTR)((unsigned int)ui)) - #endif - #ifndef LongToPtr - #define LongToPtr( l ) ((VOID *)(LONG_PTR)((long)l)) - #endif - #ifndef ULongToPtr - #define ULongToPtr( ul ) ((VOID *)(ULONG_PTR)((unsigned long)ul)) - #endif - -#endif // !defined(_WIN64) && (_ATL_VER < 0x0700) -#endif // !_ATL_NO_OLD_HEADERS_WIN64 - - -/////////////////////////////////////////////////////////////////////////////// -// Global support for SecureHelper functions - -#ifndef _TRUNCATE - #define _TRUNCATE ((size_t)-1) -#endif - -#ifndef _ERRCODE_DEFINED - #define _ERRCODE_DEFINED - typedef int errno_t; -#endif - -#ifndef _SECURECRT_ERRCODE_VALUES_DEFINED - #define _SECURECRT_ERRCODE_VALUES_DEFINED - #define EINVAL 22 - #define STRUNCATE 80 -#endif - -#ifndef _countof - #define _countof(_Array) (sizeof(_Array) / sizeof(_Array[0])) -#endif - - /////////////////////////////////////////////////////////////////////////////// // Miscellaneous global support @@ -454,25 +119,14 @@ static CWndClassInfo& GetWndClassInfo() \ #endif // Dummy structs for compiling with /CLR -#if (_MSC_VER >= 1300) && defined(_MANAGED) +#ifdef _MANAGED __if_not_exists(_IMAGELIST::_IMAGELIST) { struct _IMAGELIST { }; } __if_not_exists(_TREEITEM::_TREEITEM) { struct _TREEITEM { }; } __if_not_exists(_PSP::_PSP) { struct _PSP { }; } #endif -// Define ATLVERIFY macro for ATL3 -#if (_ATL_VER < 0x0700) - #ifndef ATLVERIFY - #ifdef _DEBUG - #define ATLVERIFY(expr) ATLASSERT(expr) - #else - #define ATLVERIFY(expr) (expr) - #endif // DEBUG - #endif // ATLVERIFY -#endif // (_ATL_VER < 0x0700) - -// Forward declaration for ATL3 and ATL11 fix -#if (((_ATL_VER < 0x0700) && defined(_ATL_DLL)) || (_ATL_VER >= 0x0B00)) && !defined(_WIN32_WCE) +// Forward declaration for ATL11 fix +#if (_ATL_VER >= 0x0B00) namespace ATL { HRESULT AtlGetCommCtrlVersion(LPDWORD pdwMajor, LPDWORD pdwMinor); }; #endif @@ -480,53 +134,35 @@ static CWndClassInfo& GetWndClassInfo() \ #define WM_MOUSEHWHEEL 0x020E #endif +// Used for stack allocations with ATL::CTempBuffer +#ifndef _WTL_STACK_ALLOC_THRESHOLD + #define _WTL_STACK_ALLOC_THRESHOLD 512 +#endif + namespace WTL { -#if (_ATL_VER >= 0x0700) - DECLARE_TRACE_CATEGORY(atlTraceUI); - #ifdef _DEBUG - __declspec(selectany) ATL::CTraceCategory atlTraceUI(_T("atlTraceUI")); - #endif // _DEBUG -#else // !(_ATL_VER >= 0x0700) - enum wtlTraceFlags - { - atlTraceUI = 0x10000000 - }; -#endif // !(_ATL_VER >= 0x0700) - -// Windows version helper -inline bool AtlIsOldWindows() -{ - OSVERSIONINFO ovi = { sizeof(OSVERSIONINFO) }; - BOOL bRet = ::GetVersionEx(&ovi); - return (!bRet || !((ovi.dwMajorVersion >= 5) || (ovi.dwMajorVersion == 4 && ovi.dwMinorVersion >= 90))); -} +DECLARE_TRACE_CATEGORY(atlTraceUI); +#ifdef _DEBUG + __declspec(selectany) ATL::CTraceCategory atlTraceUI(_T("atlTraceUI")); +#endif // _DEBUG // Default GUI font helper - "MS Shell Dlg" stock font inline HFONT AtlGetDefaultGuiFont() { -#ifndef _WIN32_WCE return (HFONT)::GetStockObject(DEFAULT_GUI_FONT); -#else // CE specific - return (HFONT)::GetStockObject(SYSTEM_FONT); -#endif // _WIN32_WCE } // Control font helper - default font for controls not in a dialog // (NOTE: Caller owns the font, and should destroy it when it's no longer needed) inline HFONT AtlCreateControlFont() { -#ifndef _WIN32_WCE LOGFONT lf = { 0 }; ATLVERIFY(::SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, 0) != FALSE); HFONT hFont = ::CreateFontIndirect(&lf); ATLASSERT(hFont != NULL); return hFont; -#else // CE specific - return (HFONT)::GetStockObject(SYSTEM_FONT); -#endif // _WIN32_WCE } // Bold font helper @@ -534,16 +170,10 @@ inline HFONT AtlCreateControlFont() inline HFONT AtlCreateBoldFont(HFONT hFont = NULL) { LOGFONT lf = { 0 }; -#ifndef _WIN32_WCE if(hFont == NULL) ATLVERIFY(::SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, 0) != FALSE); else ATLVERIFY(::GetObject(hFont, sizeof(LOGFONT), &lf) == sizeof(LOGFONT)); -#else // CE specific - if(hFont == NULL) - hFont = (HFONT)::GetStockObject(SYSTEM_FONT); - ATLVERIFY(::GetObject(hFont, sizeof(LOGFONT), &lf) == sizeof(LOGFONT)); -#endif // _WIN32_WCE lf.lfWeight = FW_BOLD; HFONT hFontBold = ::CreateFontIndirect(&lf); ATLASSERT(hFontBold != NULL); @@ -563,11 +193,6 @@ inline BOOL AtlInitCommonControls(DWORD dwFlags) /////////////////////////////////////////////////////////////////////////////// // RunTimeHelper - helper functions for Windows version and structure sizes -// Not for Windows CE -#if defined(_WIN32_WCE) && !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) - #define _WTL_NO_RUNTIME_STRUCT_SIZE -#endif - #ifndef _WTL_NO_RUNTIME_STRUCT_SIZE #ifndef _SIZEOF_STRUCT @@ -590,15 +215,18 @@ inline BOOL AtlInitCommonControls(DWORD dwFlags) #define MCHITTESTINFO_V1_SIZE _SIZEOF_STRUCT(MCHITTESTINFO, st) #endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) && !defined(MCHITTESTINFO_V1_SIZE) -#if !defined(_WIN32_WCE) && (WINVER >= 0x0600) && !defined(NONCLIENTMETRICS_V1_SIZE) +#if (WINVER >= 0x0600) && !defined(NONCLIENTMETRICS_V1_SIZE) #define NONCLIENTMETRICS_V1_SIZE _SIZEOF_STRUCT(NONCLIENTMETRICS, lfMessageFont) -#endif // !defined(_WIN32_WCE) && (WINVER >= 0x0600) && !defined(NONCLIENTMETRICS_V1_SIZE) +#endif // (WINVER >= 0x0600) && !defined(NONCLIENTMETRICS_V1_SIZE) + +#ifndef TTTOOLINFO_V2_SIZE + #define TTTOOLINFO_V2_SIZE _SIZEOF_STRUCT(TTTOOLINFO, lParam) +#endif #endif // !_WTL_NO_RUNTIME_STRUCT_SIZE namespace RunTimeHelper { -#ifndef _WIN32_WCE inline bool IsCommCtrl6() { DWORD dwMajor = 0, dwMinor = 0; @@ -608,44 +236,29 @@ namespace RunTimeHelper inline bool IsVista() { +#ifdef _versionhelpers_H_INCLUDED_ + return ::IsWindowsVistaOrGreater(); +#else // !_versionhelpers_H_INCLUDED_ OSVERSIONINFO ovi = { sizeof(OSVERSIONINFO) }; BOOL bRet = ::GetVersionEx(&ovi); return ((bRet != FALSE) && (ovi.dwMajorVersion >= 6)); +#endif // _versionhelpers_H_INCLUDED_ } inline bool IsThemeAvailable() { - bool bRet = false; - - if(IsCommCtrl6()) - { - HMODULE hThemeDLL = ::LoadLibrary(_T("uxtheme.dll")); - if(hThemeDLL != NULL) - { - typedef BOOL (STDAPICALLTYPE *PFN_IsThemeActive)(); - PFN_IsThemeActive pfnIsThemeActive = (PFN_IsThemeActive)::GetProcAddress(hThemeDLL, "IsThemeActive"); - ATLASSERT(pfnIsThemeActive != NULL); - bRet = (pfnIsThemeActive != NULL) && (pfnIsThemeActive() != FALSE); - if(bRet) - { - typedef BOOL (STDAPICALLTYPE *PFN_IsAppThemed)(); - PFN_IsAppThemed pfnIsAppThemed = (PFN_IsAppThemed)::GetProcAddress(hThemeDLL, "IsAppThemed"); - ATLASSERT(pfnIsAppThemed != NULL); - bRet = (pfnIsAppThemed != NULL) && (pfnIsAppThemed() != FALSE); - } - - ::FreeLibrary(hThemeDLL); - } - } - - return bRet; + return IsCommCtrl6() && (::IsThemeActive() != FALSE) && (::IsAppThemed() != FALSE); } inline bool IsWin7() { +#ifdef _versionhelpers_H_INCLUDED_ + return ::IsWindows7OrGreater(); +#else // !_versionhelpers_H_INCLUDED_ OSVERSIONINFO ovi = { sizeof(OSVERSIONINFO) }; BOOL bRet = ::GetVersionEx(&ovi); return ((bRet != FALSE) && (ovi.dwMajorVersion == 6) && (ovi.dwMinorVersion >= 1)); +#endif // _versionhelpers_H_INCLUDED_ } inline bool IsRibbonUIAvailable() @@ -676,134 +289,109 @@ namespace RunTimeHelper return (iRibbonUI == 1); } -#endif // !_WIN32_WCE - - inline int SizeOf_REBARBANDINFO() + inline UINT SizeOf_REBARBANDINFO() { - int nSize = sizeof(REBARBANDINFO); + UINT uSize = sizeof(REBARBANDINFO); #if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) if(!(IsVista() && IsCommCtrl6())) - nSize = REBARBANDINFO_V6_SIZE; + uSize = REBARBANDINFO_V6_SIZE; #endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) - return nSize; + return uSize; } -#if (_WIN32_WINNT >= 0x501) - inline int SizeOf_LVGROUP() + inline UINT SizeOf_LVGROUP() { - int nSize = sizeof(LVGROUP); + UINT uSize = sizeof(LVGROUP); #if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) if(!IsVista()) - nSize = LVGROUP_V5_SIZE; + uSize = LVGROUP_V5_SIZE; #endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) - return nSize; + return uSize; } - inline int SizeOf_LVTILEINFO() + inline UINT SizeOf_LVTILEINFO() { - int nSize = sizeof(LVTILEINFO); + UINT uSize = sizeof(LVTILEINFO); #if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) if(!IsVista()) - nSize = LVTILEINFO_V5_SIZE; + uSize = LVTILEINFO_V5_SIZE; #endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) - return nSize; + return uSize; } -#endif // (_WIN32_WINNT >= 0x501) - inline int SizeOf_MCHITTESTINFO() + inline UINT SizeOf_MCHITTESTINFO() { - int nSize = sizeof(MCHITTESTINFO); + UINT uSize = sizeof(MCHITTESTINFO); #if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) if(!(IsVista() && IsCommCtrl6())) - nSize = MCHITTESTINFO_V1_SIZE; + uSize = MCHITTESTINFO_V1_SIZE; #endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) - return nSize; + return uSize; } -#ifndef _WIN32_WCE - inline int SizeOf_NONCLIENTMETRICS() + inline UINT SizeOf_NONCLIENTMETRICS() { - int nSize = sizeof(NONCLIENTMETRICS); + UINT uSize = sizeof(NONCLIENTMETRICS); #if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (WINVER >= 0x0600) if(!IsVista()) - nSize = NONCLIENTMETRICS_V1_SIZE; + uSize = NONCLIENTMETRICS_V1_SIZE; #endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (WINVER >= 0x0600) - return nSize; + return uSize; + } + + inline UINT SizeOf_TOOLINFO() + { + UINT uSize = sizeof(TOOLINFO); +#ifndef _WTL_NO_RUNTIME_STRUCT_SIZE + if(!IsVista()) + uSize = TTTOOLINFO_V2_SIZE; +#endif + return uSize; } -#endif // !_WIN32_WCE }; /////////////////////////////////////////////////////////////////////////////// -// ModuleHelper - helper functions for ATL3 and ATL7 module classes +// ModuleHelper - helper functions for ATL (deprecated) namespace ModuleHelper { inline HINSTANCE GetModuleInstance() { -#if (_ATL_VER >= 0x0700) return ATL::_AtlBaseModule.GetModuleInstance(); -#else // !(_ATL_VER >= 0x0700) - return ATL::_pModule->GetModuleInstance(); -#endif // !(_ATL_VER >= 0x0700) } inline HINSTANCE GetResourceInstance() { -#if (_ATL_VER >= 0x0700) return ATL::_AtlBaseModule.GetResourceInstance(); -#else // !(_ATL_VER >= 0x0700) - return ATL::_pModule->GetResourceInstance(); -#endif // !(_ATL_VER >= 0x0700) } inline void AddCreateWndData(ATL::_AtlCreateWndData* pData, void* pObject) { -#if (_ATL_VER >= 0x0700) ATL::_AtlWinModule.AddCreateWndData(pData, pObject); -#else // !(_ATL_VER >= 0x0700) - ATL::_pModule->AddCreateWndData(pData, pObject); -#endif // !(_ATL_VER >= 0x0700) } inline void* ExtractCreateWndData() { -#if (_ATL_VER >= 0x0700) return ATL::_AtlWinModule.ExtractCreateWndData(); -#else // !(_ATL_VER >= 0x0700) - return ATL::_pModule->ExtractCreateWndData(); -#endif // !(_ATL_VER >= 0x0700) } }; /////////////////////////////////////////////////////////////////////////////// -// SecureHelper - helper functions for VS2005 secure CRT +// SecureHelper - WTL10 requires use if secure functions +// these are here only for compatibility with existing projects namespace SecureHelper { inline void strcpyA_x(char* lpstrDest, size_t cchDest, const char* lpstrSrc) { -#if _SECURE_ATL ATL::Checked::strcpy_s(lpstrDest, cchDest, lpstrSrc); -#else - if(cchDest > (size_t)lstrlenA(lpstrSrc)) - ATLVERIFY(lstrcpyA(lpstrDest, lpstrSrc) != NULL); - else - ATLASSERT(FALSE); -#endif } inline void strcpyW_x(wchar_t* lpstrDest, size_t cchDest, const wchar_t* lpstrSrc) { -#if _SECURE_ATL ATL::Checked::wcscpy_s(lpstrDest, cchDest, lpstrSrc); -#else - if(cchDest > (size_t)lstrlenW(lpstrSrc)) - ATLVERIFY(lstrcpyW(lpstrDest, lpstrSrc) != NULL); - else - ATLASSERT(FALSE); -#endif } inline void strcpy_x(LPTSTR lpstrDest, size_t cchDest, LPCTSTR lpstrSrc) @@ -817,56 +405,12 @@ namespace SecureHelper inline errno_t strncpyA_x(char* lpstrDest, size_t cchDest, const char* lpstrSrc, size_t cchCount) { -#if _SECURE_ATL return ATL::Checked::strncpy_s(lpstrDest, cchDest, lpstrSrc, cchCount); -#else - errno_t nRet = 0; - if(lpstrDest == NULL || cchDest == 0 || lpstrSrc == NULL) - { - nRet = EINVAL; - } - else if(cchCount == _TRUNCATE) - { - cchCount = min(cchDest - 1, size_t(lstrlenA(lpstrSrc))); - nRet = STRUNCATE; - } - else if(cchDest <= cchCount) - { - lpstrDest[0] = 0; - nRet = EINVAL; - } - if(nRet == 0 || nRet == STRUNCATE) - nRet = (lstrcpynA(lpstrDest, lpstrSrc, (int)cchCount + 1) != NULL) ? nRet : EINVAL; - ATLASSERT(nRet == 0 || nRet == STRUNCATE); - return nRet; -#endif } inline errno_t strncpyW_x(wchar_t* lpstrDest, size_t cchDest, const wchar_t* lpstrSrc, size_t cchCount) { -#if _SECURE_ATL return ATL::Checked::wcsncpy_s(lpstrDest, cchDest, lpstrSrc, cchCount); -#else - errno_t nRet = 0; - if(lpstrDest == NULL || cchDest == 0 || lpstrSrc == NULL) - { - nRet = EINVAL; - } - else if(cchCount == _TRUNCATE) - { - cchCount = min(cchDest - 1, size_t(lstrlenW(lpstrSrc))); - nRet = STRUNCATE; - } - else if(cchDest <= cchCount) - { - lpstrDest[0] = 0; - nRet = EINVAL; - } - if(nRet == 0 || nRet == STRUNCATE) - nRet = (lstrcpynW(lpstrDest, lpstrSrc, (int)cchCount + 1) != NULL) ? nRet : EINVAL; - ATLASSERT(nRet == 0 || nRet == STRUNCATE); - return nRet; -#endif } inline errno_t strncpy_x(LPTSTR lpstrDest, size_t cchDest, LPCTSTR lpstrSrc, size_t cchCount) @@ -880,26 +424,12 @@ namespace SecureHelper inline void strcatA_x(char* lpstrDest, size_t cchDest, const char* lpstrSrc) { -#if _SECURE_ATL ATL::Checked::strcat_s(lpstrDest, cchDest, lpstrSrc); -#else - if(cchDest > (size_t)lstrlenA(lpstrSrc)) - ATLVERIFY(lstrcatA(lpstrDest, lpstrSrc) != NULL); - else - ATLASSERT(FALSE); -#endif } inline void strcatW_x(wchar_t* lpstrDest, size_t cchDest, const wchar_t* lpstrSrc) { -#if _SECURE_ATL ATL::Checked::wcscat_s(lpstrDest, cchDest, lpstrSrc); -#else - if(cchDest > (size_t)lstrlenW(lpstrSrc)) - ATLVERIFY(lstrcatW(lpstrDest, lpstrSrc) != NULL); - else - ATLASSERT(FALSE); -#endif } inline void strcat_x(LPTSTR lpstrDest, size_t cchDest, LPCTSTR lpstrSrc) @@ -913,48 +443,22 @@ namespace SecureHelper inline void memcpy_x(void* pDest, size_t cbDest, const void* pSrc, size_t cbSrc) { -#if _SECURE_ATL ATL::Checked::memcpy_s(pDest, cbDest, pSrc, cbSrc); -#else - if(cbDest >= cbSrc) - memcpy(pDest, pSrc, cbSrc); - else - ATLASSERT(FALSE); -#endif } inline void memmove_x(void* pDest, size_t cbDest, const void* pSrc, size_t cbSrc) { -#if _SECURE_ATL ATL::Checked::memmove_s(pDest, cbDest, pSrc, cbSrc); -#else - if(cbDest >= cbSrc) - memmove(pDest, pSrc, cbSrc); - else - ATLASSERT(FALSE); -#endif } inline int vsprintf_x(LPTSTR lpstrBuff, size_t cchBuff, LPCTSTR lpstrFormat, va_list args) { -#if _SECURE_ATL && !defined(_ATL_MIN_CRT) && !defined(_WIN32_WCE) return _vstprintf_s(lpstrBuff, cchBuff, lpstrFormat, args); -#else - cchBuff; // Avoid unused argument warning -#pragma warning(disable: 4996) - return _vstprintf(lpstrBuff, lpstrFormat, args); -#pragma warning(default: 4996) -#endif } inline int wvsprintf_x(LPTSTR lpstrBuff, size_t cchBuff, LPCTSTR lpstrFormat, va_list args) { -#if _SECURE_ATL && !defined(_ATL_MIN_CRT) && !defined(_WIN32_WCE) return _vstprintf_s(lpstrBuff, cchBuff, lpstrFormat, args); -#else - cchBuff; // Avoid unused argument warning - return ::wvsprintf(lpstrBuff, lpstrFormat, args); -#endif } inline int sprintf_x(LPTSTR lpstrBuff, size_t cchBuff, LPCTSTR lpstrFormat, ...) @@ -978,90 +482,71 @@ namespace SecureHelper /////////////////////////////////////////////////////////////////////////////// -// MinCrtHelper - helper functions for using _ATL_MIN_CRT +// MinCrtHelper - WTL10 doesn't support _ATL_MIN_CRT, +// these are here only for compatibility with existing projects namespace MinCrtHelper { inline int _isspace(TCHAR ch) { -#ifndef _ATL_MIN_CRT return _istspace(ch); -#else // _ATL_MIN_CRT - WORD type = 0; - ::GetStringTypeEx(::GetThreadLocale(), CT_CTYPE1, &ch, 1, &type); - return (type & C1_SPACE) == C1_SPACE; -#endif // _ATL_MIN_CRT } inline int _isdigit(TCHAR ch) { -#ifndef _ATL_MIN_CRT return _istdigit(ch); -#else // _ATL_MIN_CRT - WORD type = 0; - ::GetStringTypeEx(::GetThreadLocale(), CT_CTYPE1, &ch, 1, &type); - return (type & C1_DIGIT) == C1_DIGIT; -#endif // _ATL_MIN_CRT } inline int _atoi(LPCTSTR str) { -#ifndef _ATL_MIN_CRT return _ttoi(str); -#else // _ATL_MIN_CRT - while(_isspace(*str) != 0) - ++str; - - TCHAR ch = *str++; - TCHAR sign = ch; // save sign indication - if(ch == _T('-') || ch == _T('+')) - ch = *str++; // skip sign - - int total = 0; - while(_isdigit(ch) != 0) - { - total = 10 * total + (ch - '0'); // accumulate digit - ch = *str++; // get next char - } - - return (sign == '-') ? -total : total; // return result, negated if necessary -#endif // _ATL_MIN_CRT } inline LPCTSTR _strrchr(LPCTSTR str, TCHAR ch) { -#ifndef _ATL_MIN_CRT return _tcsrchr(str, ch); -#else // _ATL_MIN_CRT - LPCTSTR lpsz = NULL; - while(*str != 0) - { - if(*str == ch) - lpsz = str; - str = ::CharNext(str); - } - return lpsz; -#endif // _ATL_MIN_CRT } inline LPTSTR _strrchr(LPTSTR str, TCHAR ch) { -#ifndef _ATL_MIN_CRT return _tcsrchr(str, ch); -#else // _ATL_MIN_CRT - LPTSTR lpsz = NULL; - while(*str != 0) - { - if(*str == ch) - lpsz = str; - str = ::CharNext(str); - } - return lpsz; -#endif // _ATL_MIN_CRT } }; // namespace MinCrtHelper +/////////////////////////////////////////////////////////////////////////////// +// GenericWndClass - generic window class usable for subclassing + +// Use in dialog templates to specify a placeholder to be subclassed +// Specify as a custom control with class name WTL_GenericWindow +// Call Rregister() before creating dialog (for example, in WinMain) +namespace GenericWndClass +{ + inline LPCTSTR GetName() + { + return _T("WTL_GenericWindow"); + } + + inline ATOM Register() + { + WNDCLASSEX wc = { sizeof(WNDCLASSEX) }; + wc.lpfnWndProc = ::DefWindowProc; + wc.hInstance = ModuleHelper::GetModuleInstance(); + wc.hCursor = ::LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); + wc.lpszClassName = GetName(); + ATOM atom = ::RegisterClassEx(&wc); + ATLASSERT(atom != 0); + return atom; + } + + inline BOOL Unregister() // only needed for DLLs or tmp use + { + return ::UnregisterClass(GetName(), ModuleHelper::GetModuleInstance()); + } +}; // namespace GenericWndClass + + /////////////////////////////////////////////////////////////////////////////// // CMessageFilter - Interface for message filter support @@ -1081,12 +566,6 @@ class CIdleHandler virtual BOOL OnIdle() = 0; }; -#ifndef _ATL_NO_OLD_NAMES - // for compatilibility with old names only - typedef CIdleHandler CUpdateUIObject; - #define DoUpdate OnIdle -#endif // !_ATL_NO_OLD_NAMES - /////////////////////////////////////////////////////////////////////////////// // CMessageLoop - message loop implementation @@ -1120,21 +599,6 @@ class CMessageLoop return m_aIdleHandler.Remove(pIdleHandler); } -#ifndef _ATL_NO_OLD_NAMES - // for compatilibility with old names only - BOOL AddUpdateUI(CIdleHandler* pIdleHandler) - { - ATLTRACE2(atlTraceUI, 0, _T("CUpdateUIObject and AddUpdateUI are deprecated. Please change your code to use CIdleHandler and OnIdle\n")); - return AddIdleHandler(pIdleHandler); - } - - BOOL RemoveUpdateUI(CIdleHandler* pIdleHandler) - { - ATLTRACE2(atlTraceUI, 0, _T("CUpdateUIObject and RemoveUpdateUI are deprecated. Please change your code to use CIdleHandler and OnIdle\n")); - return RemoveIdleHandler(pIdleHandler); - } -#endif // !_ATL_NO_OLD_NAMES - // message loop int Run() { @@ -1185,9 +649,7 @@ class CMessageLoop switch(pMsg->message) { case WM_MOUSEMOVE: -#ifndef _WIN32_WCE case WM_NCMOUSEMOVE: -#endif // !_WIN32_WCE case WM_PAINT: case 0x0118: // WM_SYSTIMER (caret blink) return FALSE; @@ -1204,7 +666,7 @@ class CMessageLoop for(int i = m_aMsgFilter.GetSize() - 1; i >= 0; i--) { CMessageFilter* pMessageFilter = m_aMsgFilter[i]; - if(pMessageFilter != NULL && pMessageFilter->PreTranslateMessage(pMsg)) + if((pMessageFilter != NULL) && pMessageFilter->PreTranslateMessage(pMsg)) return TRUE; } return FALSE; // not translated @@ -1226,35 +688,24 @@ class CMessageLoop /////////////////////////////////////////////////////////////////////////////// // CStaticDataInitCriticalSectionLock and CWindowCreateCriticalSectionLock -// internal classes to manage critical sections for both ATL3 and ATL7 +// internal classes to manage critical sections for ATL (deprecated) class CStaticDataInitCriticalSectionLock { public: -#if (_ATL_VER >= 0x0700) ATL::CComCritSecLock m_cslock; CStaticDataInitCriticalSectionLock() : m_cslock(ATL::_pAtlModule->m_csStaticDataInitAndTypeInfo, false) { } -#endif // (_ATL_VER >= 0x0700) HRESULT Lock() { -#if (_ATL_VER >= 0x0700) return m_cslock.Lock(); -#else // !(_ATL_VER >= 0x0700) - ::EnterCriticalSection(&ATL::_pModule->m_csStaticDataInit); - return S_OK; -#endif // !(_ATL_VER >= 0x0700) } void Unlock() { -#if (_ATL_VER >= 0x0700) m_cslock.Unlock(); -#else // !(_ATL_VER >= 0x0700) - ::LeaveCriticalSection(&ATL::_pModule->m_csStaticDataInit); -#endif // !(_ATL_VER >= 0x0700) } }; @@ -1262,117 +713,32 @@ class CStaticDataInitCriticalSectionLock class CWindowCreateCriticalSectionLock { public: -#if (_ATL_VER >= 0x0700) ATL::CComCritSecLock m_cslock; CWindowCreateCriticalSectionLock() : m_cslock(ATL::_AtlWinModule.m_csWindowCreate, false) { } -#endif // (_ATL_VER >= 0x0700) HRESULT Lock() { -#if (_ATL_VER >= 0x0700) return m_cslock.Lock(); -#else // !(_ATL_VER >= 0x0700) - ::EnterCriticalSection(&ATL::_pModule->m_csWindowCreate); - return S_OK; -#endif // !(_ATL_VER >= 0x0700) } void Unlock() { -#if (_ATL_VER >= 0x0700) m_cslock.Unlock(); -#else // !(_ATL_VER >= 0x0700) - ::LeaveCriticalSection(&ATL::_pModule->m_csWindowCreate); -#endif // !(_ATL_VER >= 0x0700) } }; /////////////////////////////////////////////////////////////////////////////// -// CTempBuffer - helper class for stack allocations for ATL3 - -#ifndef _WTL_STACK_ALLOC_THRESHOLD - #define _WTL_STACK_ALLOC_THRESHOLD 512 -#endif - -#if (_ATL_VER >= 0x0700) - -using ATL::CTempBuffer; - -#else // !(_ATL_VER >= 0x0700) +// CAppModule - module class for an application -#ifndef SIZE_MAX - #ifdef _WIN64 - #define SIZE_MAX _UI64_MAX - #else - #define SIZE_MAX UINT_MAX - #endif +#if (_MSC_VER == 1400) // VS2005 + #pragma warning(push) + #pragma warning(disable : 4244) + #pragma warning(disable : 4312) #endif -#pragma warning(disable: 4284) // warning for operator -> - -template -class CTempBuffer -{ -public: - CTempBuffer() : m_p(NULL) - { - } - - CTempBuffer(size_t nElements) : m_p(NULL) - { - Allocate(nElements); - } - - ~CTempBuffer() - { - if(m_p != reinterpret_cast(m_abFixedBuffer)) - free(m_p); - } - - operator T*() const - { - return m_p; - } - - T* operator ->() const - { - ATLASSERT(m_p != NULL); - return m_p; - } - - T* Allocate(size_t nElements) - { - ATLASSERT(nElements <= (SIZE_MAX / sizeof(T))); - return AllocateBytes(nElements * sizeof(T)); - } - - T* AllocateBytes(size_t nBytes) - { - ATLASSERT(m_p == NULL); - if(nBytes > t_nFixedBytes) - m_p = static_cast(malloc(nBytes)); - else - m_p = reinterpret_cast(m_abFixedBuffer); - - return m_p; - } - -private: - T* m_p; - BYTE m_abFixedBuffer[t_nFixedBytes]; -}; - -#pragma warning(default: 4284) - -#endif // !(_ATL_VER >= 0x0700) - - -/////////////////////////////////////////////////////////////////////////////// -// CAppModule - module class for an application - class CAppModule : public ATL::CComModule { public: @@ -1480,7 +846,7 @@ class CAppModule : public ATL::CComModule } BOOL bRet = (m_pSettingChangeNotify != NULL); - if(bRet && m_pSettingChangeNotify->GetSize() == 0) + if(bRet && (m_pSettingChangeNotify->GetSize() == 0)) { // init everything _ATL_EMPTY_DLGTEMPLATE templ; @@ -1488,12 +854,7 @@ class CAppModule : public ATL::CComModule ATLASSERT(::IsWindow(hNtfWnd)); if(::IsWindow(hNtfWnd)) { -// need conditional code because types don't match in winuser.h -#ifdef _WIN64 ::SetWindowLongPtr(hNtfWnd, GWLP_USERDATA, (LONG_PTR)this); -#else - ::SetWindowLongPtr(hNtfWnd, GWLP_USERDATA, PtrToLong(this)); -#endif bRet = m_pSettingChangeNotify->Add(hNtfWnd); } else @@ -1517,7 +878,7 @@ class CAppModule : public ATL::CComModule return; } - if(m_pSettingChangeNotify != NULL && m_pSettingChangeNotify->GetSize() > 0) + if((m_pSettingChangeNotify != NULL) && (m_pSettingChangeNotify->GetSize() > 0)) ::DestroyWindow((*m_pSettingChangeNotify)[0]); delete m_pSettingChangeNotify; m_pSettingChangeNotify = NULL; @@ -1575,40 +936,28 @@ class CAppModule : public ATL::CComModule WORD wMenu, wClass, wTitle; }; -#ifdef _WIN64 static INT_PTR CALLBACK _SettingChangeDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -#else - static BOOL CALLBACK _SettingChangeDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -#endif { if(uMsg == WM_SETTINGCHANGE) { -// need conditional code because types don't match in winuser.h -#ifdef _WIN64 CAppModule* pModule = (CAppModule*)::GetWindowLongPtr(hWnd, GWLP_USERDATA); -#else - CAppModule* pModule = (CAppModule*)LongToPtr(::GetWindowLongPtr(hWnd, GWLP_USERDATA)); -#endif ATLASSERT(pModule != NULL); ATLASSERT(pModule->m_pSettingChangeNotify != NULL); const UINT uTimeout = 1500; // ms for(int i = 1; i < pModule->m_pSettingChangeNotify->GetSize(); i++) - { -#if !defined(_WIN32_WCE) ::SendMessageTimeout((*pModule->m_pSettingChangeNotify)[i], uMsg, wParam, lParam, SMTO_ABORTIFHUNG, uTimeout, NULL); -#elif(_WIN32_WCE >= 400) // CE specific - ::SendMessageTimeout((*pModule->m_pSettingChangeNotify)[i], uMsg, wParam, lParam, SMTO_NORMAL, uTimeout, NULL); -#else // _WIN32_WCE < 400 specific - uTimeout; - ::SendMessage((*pModule->m_pSettingChangeNotify)[i], uMsg, wParam, lParam); -#endif - } + return TRUE; } + return FALSE; } }; +#if (_MSC_VER == 1400) // VS2005 + #pragma warning(pop) +#endif + /////////////////////////////////////////////////////////////////////////////// // CServerAppModule - module class for a COM server application @@ -1631,13 +980,13 @@ class CServerAppModule : public CAppModule void Term() { - if(m_hEventShutdown != NULL && ::CloseHandle(m_hEventShutdown)) + if((m_hEventShutdown != NULL) && ::CloseHandle(m_hEventShutdown)) m_hEventShutdown = NULL; CAppModule::Term(); } // COM Server methods - LONG Unlock() + LONG Unlock() throw() { LONG lRet = CComModule::Unlock(); if(lRet == 0) @@ -1661,11 +1010,11 @@ class CServerAppModule : public CAppModule } while(dwWait == WAIT_OBJECT_0); // timed out - if(!m_bActivity && m_nLockCnt == 0) // if no activity let's really bail + if(!m_bActivity && (m_nLockCnt == 0)) // if no activity let's really bail { -#if ((_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM)) && defined(_ATL_FREE_THREADED) && !defined(_WIN32_WCE) +#if defined(_WIN32_DCOM) && defined(_ATL_FREE_THREADED) ::CoSuspendClassObjects(); - if(!m_bActivity && m_nLockCnt == 0) + if(!m_bActivity && (m_nLockCnt == 0)) #endif break; } @@ -1683,7 +1032,7 @@ class CServerAppModule : public CAppModule if(m_hEventShutdown == NULL) return false; DWORD dwThreadID = 0; -#if !defined(_ATL_MIN_CRT) && defined(_MT) && !defined(_WIN32_WCE) +#ifdef _MT HANDLE hThread = (HANDLE)_beginthreadex(NULL, 0, (UINT (WINAPI*)(void*))MonitorProc, this, 0, (UINT*)&dwThreadID); #else HANDLE hThread = ::CreateThread(NULL, 0, MonitorProc, this, 0, &dwThreadID); @@ -1700,320 +1049,35 @@ class CServerAppModule : public CAppModule p->MonitorShutdown(); return 0; } - -#if (_ATL_VER < 0x0700) - // search for an occurence of string p2 in string p1 - static LPCTSTR FindOneOf(LPCTSTR p1, LPCTSTR p2) - { - while(p1 != NULL && *p1 != NULL) - { - LPCTSTR p = p2; - while(p != NULL && *p != NULL) - { - if(*p1 == *p) - return ::CharNext(p1); - p = ::CharNext(p); - } - p1 = ::CharNext(p1); - } - return NULL; - } -#endif // (_ATL_VER < 0x0700) }; /////////////////////////////////////////////////////////////////////////////// -// CRegKeyEx - adds type-specific methods to ATL3 CRegKey - -#if (_ATL_VER < 0x0700) - -class CRegKeyEx : public ATL::CRegKey -{ -public: -// Constructors and operators - CRegKeyEx(HKEY hKey = NULL) - { - m_hKey = hKey; - } - - CRegKeyEx(CRegKeyEx& key) - { - Attach(key.Detach()); - } - - CRegKeyEx& operator =(CRegKeyEx& key) - { - Close(); - Attach(key.Detach()); - return *this; - } - -// Methods - LONG SetValue(LPCTSTR pszValueName, DWORD dwType, const void* pValue, ULONG nBytes) - { - ATLASSERT(m_hKey != NULL); - return ::RegSetValueEx(m_hKey, pszValueName, NULL, dwType, static_cast(pValue), nBytes); - } - - LONG SetGUIDValue(LPCTSTR pszValueName, REFGUID guidValue) - { - ATLASSERT(m_hKey != NULL); - - OLECHAR szGUID[64] = { 0 }; - ::StringFromGUID2(guidValue, szGUID, 64); - - USES_CONVERSION; - LPCTSTR lpstr = OLE2CT(szGUID); -#ifndef _UNICODE - if(lpstr == NULL) - return E_OUTOFMEMORY; -#endif - return SetStringValue(pszValueName, lpstr); - } - - LONG SetBinaryValue(LPCTSTR pszValueName, const void* pValue, ULONG nBytes) - { - ATLASSERT(m_hKey != NULL); - return ::RegSetValueEx(m_hKey, pszValueName, NULL, REG_BINARY, reinterpret_cast(pValue), nBytes); - } - - LONG SetDWORDValue(LPCTSTR pszValueName, DWORD dwValue) - { - ATLASSERT(m_hKey != NULL); - return ::RegSetValueEx(m_hKey, pszValueName, NULL, REG_DWORD, reinterpret_cast(&dwValue), sizeof(DWORD)); - } - -#ifndef _WIN32_WCE - LONG SetQWORDValue(LPCTSTR pszValueName, ULONGLONG qwValue) - { - ATLASSERT(m_hKey != NULL); - return ::RegSetValueEx(m_hKey, pszValueName, NULL, REG_QWORD, reinterpret_cast(&qwValue), sizeof(ULONGLONG)); - } -#endif - - LONG SetStringValue(LPCTSTR pszValueName, LPCTSTR pszValue, DWORD dwType = REG_SZ) - { - ATLASSERT(m_hKey != NULL); - if(pszValue == NULL) - { - ATLASSERT(FALSE); - return ERROR_INVALID_DATA; - } - ATLASSERT((dwType == REG_SZ) || (dwType == REG_EXPAND_SZ)); - - return ::RegSetValueEx(m_hKey, pszValueName, NULL, dwType, reinterpret_cast(pszValue), (lstrlen(pszValue) + 1) * sizeof(TCHAR)); - } - - LONG SetMultiStringValue(LPCTSTR pszValueName, LPCTSTR pszValue) - { - ATLASSERT(m_hKey != NULL); - if(pszValue == NULL) - { - ATLASSERT(FALSE); - return ERROR_INVALID_DATA; - } - - ULONG nBytes = 0; - ULONG nLength = 0; - LPCTSTR pszTemp = pszValue; - do - { - nLength = lstrlen(pszTemp) + 1; - pszTemp += nLength; - nBytes += nLength * sizeof(TCHAR); - } while (nLength != 1); - - return ::RegSetValueEx(m_hKey, pszValueName, NULL, REG_MULTI_SZ, reinterpret_cast(pszValue), nBytes); - } - - LONG QueryValue(LPCTSTR pszValueName, DWORD* pdwType, void* pData, ULONG* pnBytes) - { - ATLASSERT(m_hKey != NULL); - return ::RegQueryValueEx(m_hKey, pszValueName, NULL, pdwType, static_cast(pData), pnBytes); - } - - LONG QueryGUIDValue(LPCTSTR pszValueName, GUID& guidValue) - { - ATLASSERT(m_hKey != NULL); - - guidValue = GUID_NULL; - - TCHAR szGUID[64] = { 0 }; - ULONG nCount = 64; - LONG lRes = QueryStringValue(pszValueName, szGUID, &nCount); - - if (lRes != ERROR_SUCCESS) - return lRes; - - if(szGUID[0] != _T('{')) - return ERROR_INVALID_DATA; - - USES_CONVERSION; - LPOLESTR lpstr = T2OLE(szGUID); -#ifndef _UNICODE - if(lpstr == NULL) - return E_OUTOFMEMORY; -#endif - - HRESULT hr = ::CLSIDFromString(lpstr, &guidValue); - if (FAILED(hr)) - return ERROR_INVALID_DATA; - - return ERROR_SUCCESS; - } - - LONG QueryBinaryValue(LPCTSTR pszValueName, void* pValue, ULONG* pnBytes) - { - ATLASSERT(pnBytes != NULL); - ATLASSERT(m_hKey != NULL); - - DWORD dwType = 0; - LONG lRes = ::RegQueryValueEx(m_hKey, pszValueName, NULL, &dwType, reinterpret_cast(pValue), pnBytes); - if (lRes != ERROR_SUCCESS) - return lRes; - if (dwType != REG_BINARY) - return ERROR_INVALID_DATA; - - return ERROR_SUCCESS; - } - - LONG QueryDWORDValue(LPCTSTR pszValueName, DWORD& dwValue) - { - ATLASSERT(m_hKey != NULL); - - ULONG nBytes = sizeof(DWORD); - DWORD dwType = 0; - LONG lRes = ::RegQueryValueEx(m_hKey, pszValueName, NULL, &dwType, reinterpret_cast(&dwValue), &nBytes); - if (lRes != ERROR_SUCCESS) - return lRes; - if (dwType != REG_DWORD) - return ERROR_INVALID_DATA; - - return ERROR_SUCCESS; - } - - LONG QueryQWORDValue(LPCTSTR pszValueName, ULONGLONG& qwValue) - { - ATLASSERT(m_hKey != NULL); - - ULONG nBytes = sizeof(ULONGLONG); - DWORD dwType = 0; - LONG lRes = ::RegQueryValueEx(m_hKey, pszValueName, NULL, &dwType, reinterpret_cast(&qwValue), &nBytes); - if (lRes != ERROR_SUCCESS) - return lRes; - if (dwType != REG_QWORD) - return ERROR_INVALID_DATA; - - return ERROR_SUCCESS; - } - - LONG QueryStringValue(LPCTSTR pszValueName, LPTSTR pszValue, ULONG* pnChars) - { - ATLASSERT(m_hKey != NULL); - ATLASSERT(pnChars != NULL); - - ULONG nBytes = (*pnChars) * sizeof(TCHAR); - DWORD dwType = 0; - *pnChars = 0; - LONG lRes = ::RegQueryValueEx(m_hKey, pszValueName, NULL, &dwType, reinterpret_cast(pszValue), &nBytes); - - if (lRes != ERROR_SUCCESS) - { - return lRes; - } - - if(dwType != REG_SZ && dwType != REG_EXPAND_SZ) - { - return ERROR_INVALID_DATA; - } - - if (pszValue != NULL) - { - if(nBytes != 0) - { - if ((nBytes % sizeof(TCHAR) != 0) || (pszValue[nBytes / sizeof(TCHAR) -1] != 0)) - return ERROR_INVALID_DATA; - } - else - { - pszValue[0] = _T('\0'); - } - } - - *pnChars = nBytes / sizeof(TCHAR); - - return ERROR_SUCCESS; - } - - LONG QueryMultiStringValue(LPCTSTR pszValueName, LPTSTR pszValue, ULONG* pnChars) - { - ATLASSERT(m_hKey != NULL); - ATLASSERT(pnChars != NULL); - - if (pszValue != NULL && *pnChars < 2) - return ERROR_INSUFFICIENT_BUFFER; - - ULONG nBytes = (*pnChars) * sizeof(TCHAR); - DWORD dwType = 0; - *pnChars = 0; - LONG lRes = ::RegQueryValueEx(m_hKey, pszValueName, NULL, &dwType, reinterpret_cast(pszValue), &nBytes); - if (lRes != ERROR_SUCCESS) - return lRes; - if (dwType != REG_MULTI_SZ) - return ERROR_INVALID_DATA; - if (pszValue != NULL && (nBytes % sizeof(TCHAR) != 0 || nBytes / sizeof(TCHAR) < 1 || pszValue[nBytes / sizeof(TCHAR) - 1] != 0 || ((nBytes / sizeof(TCHAR)) > 1 && pszValue[nBytes / sizeof(TCHAR) - 2] != 0))) - return ERROR_INVALID_DATA; - - *pnChars = nBytes / sizeof(TCHAR); - - return ERROR_SUCCESS; - } -}; - -#else // !(_ATL_VER < 0x0700) +// CRegKeyEx - not used any more, here only for compatibility with old projects typedef ATL::CRegKey CRegKeyEx; -#endif // !(_ATL_VER < 0x0700) +}; // namespace WTL /////////////////////////////////////////////////////////////////////////////// // CString forward reference (enables CString use in atluser.h and atlgdi.h) -#if defined(_WTL_FORWARD_DECLARE_CSTRING) && !defined(_WTL_USE_CSTRING) - #define _WTL_USE_CSTRING -#endif // defined(_WTL_FORWARD_DECLARE_CSTRING) && !defined(_WTL_USE_CSTRING) - -#ifdef _WTL_USE_CSTRING - class CString; // forward declaration (include atlmisc.h for the whole class) -#endif // _WTL_USE_CSTRING +#if (defined(_WTL_USE_CSTRING) || defined(_WTL_FORWARD_DECLARE_CSTRING)) && !defined(__ATLSTR_H__) + #include +#endif // CString namespace -#ifndef _CSTRING_NS - #ifdef __ATLSTR_H__ - #define _CSTRING_NS ATL - #else - #define _CSTRING_NS WTL - #endif -#endif // _CSTRING_NS +#define _CSTRING_NS ATL // Type classes namespace -#ifndef _WTYPES_NS - #ifdef __ATLTYPES_H__ - #define _WTYPES_NS - #else - #define _WTYPES_NS WTL - #endif -#endif // _WTYPES_NS - -}; // namespace WTL +#define _WTYPES_NS /////////////////////////////////////////////////////////////////////////////// -// General DLL version helpers -// (ATL3: excluded from atlbase.h if _ATL_DLL is defined; ATL11: removed) +// General DLL version helpers (removed in ATL11) -#if (((_ATL_VER < 0x0700) && defined(_ATL_DLL)) || (_ATL_VER >= 0x0B00)) && !defined(_WIN32_WCE) +#if (_ATL_VER >= 0x0B00) namespace ATL { @@ -2048,8 +1112,8 @@ inline HRESULT AtlGetDllVersion(LPCTSTR lpstrDllName, DLLVERSIONINFO* pDllVersio // IE 4.0 maj=4 min=71 inline HRESULT AtlGetCommCtrlVersion(LPDWORD pdwMajor, LPDWORD pdwMinor) { - ATLASSERT(pdwMajor != NULL && pdwMinor != NULL); - if(pdwMajor == NULL || pdwMinor == NULL) + ATLASSERT((pdwMajor != NULL) && (pdwMinor != NULL)); + if((pdwMajor == NULL) || (pdwMinor == NULL)) return E_INVALIDARG; DLLVERSIONINFO dvi; @@ -2081,8 +1145,8 @@ inline HRESULT AtlGetCommCtrlVersion(LPDWORD pdwMajor, LPDWORD pdwMinor) // IE 4.01 with Web Integrated Desktop maj=4 min=72 inline HRESULT AtlGetShellVersion(LPDWORD pdwMajor, LPDWORD pdwMinor) { - ATLASSERT(pdwMajor != NULL && pdwMinor != NULL); - if(pdwMajor == NULL || pdwMinor == NULL) + ATLASSERT((pdwMajor != NULL) && (pdwMinor != NULL)); + if((pdwMajor == NULL) || (pdwMinor == NULL)) return E_INVALIDARG; DLLVERSIONINFO dvi; @@ -2109,7 +1173,7 @@ inline HRESULT AtlGetShellVersion(LPDWORD pdwMajor, LPDWORD pdwMinor) }; // namespace ATL -#endif // (_ATL_VER < 0x0700) && defined(_ATL_DLL) && !defined(_WIN32_WCE) +#endif // (_ATL_VER >= 0x0B00) // These are always included diff --git a/thirdparty/wtl/atlcrack.h b/thirdparty/wtl/atlcrack.h index 7f4a2ba..5053250 100644 --- a/thirdparty/wtl/atlcrack.h +++ b/thirdparty/wtl/atlcrack.h @@ -1,13 +1,10 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. +// Windows Template Library - WTL version 10.0 +// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. +// Microsoft Public License (http://opensource.org/licenses/MS-PL) +// which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLCRACK_H__ #define __ATLCRACK_H__ @@ -49,12 +46,12 @@ public: \ BOOL _ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID) \ { \ BOOL bHandled = TRUE; \ - hWnd; \ - uMsg; \ - wParam; \ - lParam; \ - lResult; \ - bHandled; \ + (hWnd); \ + (uMsg); \ + (wParam); \ + (lParam); \ + (lResult); \ + (bHandled); \ switch(dwMsgMapID) \ { \ case 0: @@ -109,7 +106,7 @@ public: \ if (uMsg == WM_MOVE) \ { \ SetMsgHandled(TRUE); \ - func(_WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func(::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -120,7 +117,7 @@ public: \ if (uMsg == WM_SIZE) \ { \ SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func((UINT)wParam, ::CSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -565,7 +562,7 @@ public: \ if (uMsg == WM_NCHITTEST) \ { \ SetMsgHandled(TRUE); \ - lResult = (LRESULT)func(_WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = (LRESULT)func(::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ if(IsMsgHandled()) \ return TRUE; \ } @@ -606,7 +603,7 @@ public: \ if (uMsg == WM_NCMOUSEMOVE) \ { \ SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -617,7 +614,7 @@ public: \ if (uMsg == WM_NCLBUTTONDOWN) \ { \ SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -628,7 +625,7 @@ public: \ if (uMsg == WM_NCLBUTTONUP) \ { \ SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -639,7 +636,7 @@ public: \ if (uMsg == WM_NCLBUTTONDBLCLK) \ { \ SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -650,7 +647,7 @@ public: \ if (uMsg == WM_NCRBUTTONDOWN) \ { \ SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -661,7 +658,7 @@ public: \ if (uMsg == WM_NCRBUTTONUP) \ { \ SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -672,7 +669,7 @@ public: \ if (uMsg == WM_NCRBUTTONDBLCLK) \ { \ SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -683,7 +680,7 @@ public: \ if (uMsg == WM_NCMBUTTONDOWN) \ { \ SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -694,7 +691,7 @@ public: \ if (uMsg == WM_NCMBUTTONUP) \ { \ SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -705,7 +702,7 @@ public: \ if (uMsg == WM_NCMBUTTONDBLCLK) \ { \ SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -716,7 +713,7 @@ public: \ if (uMsg == WM_KEYDOWN) \ { \ SetMsgHandled(TRUE); \ - func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ + func((UINT)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -727,13 +724,13 @@ public: \ if (uMsg == WM_KEYUP) \ { \ SetMsgHandled(TRUE); \ - func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ + func((UINT)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ } -// void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) +// void OnChar(TCHAR chChar, UINT nRepCnt, UINT nFlags) #define MSG_WM_CHAR(func) \ if (uMsg == WM_CHAR) \ { \ @@ -744,7 +741,7 @@ public: \ return TRUE; \ } -// void OnDeadChar(UINT nChar, UINT nRepCnt, UINT nFlags) +// void OnDeadChar(TCHAR chChar, UINT nRepCnt, UINT nFlags) #define MSG_WM_DEADCHAR(func) \ if (uMsg == WM_DEADCHAR) \ { \ @@ -760,7 +757,7 @@ public: \ if (uMsg == WM_SYSKEYDOWN) \ { \ SetMsgHandled(TRUE); \ - func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ + func((UINT)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -771,13 +768,13 @@ public: \ if (uMsg == WM_SYSKEYUP) \ { \ SetMsgHandled(TRUE); \ - func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ + func((UINT)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ } -// void OnSysChar(UINT nChar, UINT nRepCnt, UINT nFlags) +// void OnSysChar(TCHAR chChar, UINT nRepCnt, UINT nFlags) #define MSG_WM_SYSCHAR(func) \ if (uMsg == WM_SYSCHAR) \ { \ @@ -788,7 +785,7 @@ public: \ return TRUE; \ } -// void OnSysDeadChar(UINT nChar, UINT nRepCnt, UINT nFlags) +// void OnSysDeadChar(TCHAR chChar, UINT nRepCnt, UINT nFlags) #define MSG_WM_SYSDEADCHAR(func) \ if (uMsg == WM_SYSDEADCHAR) \ { \ @@ -804,7 +801,7 @@ public: \ if (uMsg == WM_SYSCOMMAND) \ { \ SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -923,7 +920,7 @@ public: \ if (uMsg == WM_MOUSEMOVE) \ { \ SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -934,7 +931,7 @@ public: \ if (uMsg == WM_MOUSEWHEEL) \ { \ SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((UINT)LOWORD(wParam), (short)HIWORD(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = (LRESULT)func((UINT)LOWORD(wParam), (short)HIWORD(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ if(IsMsgHandled()) \ return TRUE; \ } @@ -944,7 +941,7 @@ public: \ if (uMsg == WM_LBUTTONDOWN) \ { \ SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -955,7 +952,7 @@ public: \ if (uMsg == WM_LBUTTONUP) \ { \ SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -966,7 +963,7 @@ public: \ if (uMsg == WM_LBUTTONDBLCLK) \ { \ SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -977,7 +974,7 @@ public: \ if (uMsg == WM_RBUTTONDOWN) \ { \ SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -988,7 +985,7 @@ public: \ if (uMsg == WM_RBUTTONUP) \ { \ SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -999,7 +996,7 @@ public: \ if (uMsg == WM_RBUTTONDBLCLK) \ { \ SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -1010,7 +1007,7 @@ public: \ if (uMsg == WM_MBUTTONDOWN) \ { \ SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -1021,7 +1018,7 @@ public: \ if (uMsg == WM_MBUTTONUP) \ { \ SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -1032,7 +1029,7 @@ public: \ if (uMsg == WM_MBUTTONDBLCLK) \ { \ SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -1132,7 +1129,7 @@ public: \ if (uMsg == WM_CONTEXTMENU) \ { \ SetMsgHandled(TRUE); \ - func((HWND)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func((HWND)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -1155,7 +1152,7 @@ public: \ if (uMsg == WM_ASKCBFORMATNAME) \ { \ SetMsgHandled(TRUE); \ - func((DWORD)wParam, (LPTSTR)lParam); \ + func((UINT)wParam, (LPTSTR)lParam); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -1325,12 +1322,12 @@ public: \ return TRUE; \ } -// BOOL OnDeviceChange(UINT nEventType, DWORD dwData) +// BOOL OnDeviceChange(UINT nEventType, DWORD_PTR dwData) #define MSG_WM_DEVICECHANGE(func) \ if (uMsg == WM_DEVICECHANGE) \ { \ SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((UINT)wParam, (DWORD)lParam); \ + lResult = (LRESULT)func((UINT)wParam, (DWORD_PTR)lParam); \ if(IsMsgHandled()) \ return TRUE; \ } @@ -1351,7 +1348,7 @@ public: \ if (uMsg == WM_DISPLAYCHANGE) \ { \ SetMsgHandled(TRUE); \ - func((UINT)wParam, _WTYPES_NS::CSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func((UINT)wParam, ::CSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -1505,12 +1502,12 @@ public: \ return TRUE; \ } -// BOOL OnPowerBroadcast(DWORD dwPowerEvent, DWORD dwData) +// BOOL OnPowerBroadcast(DWORD dwPowerEvent, DWORD_PTR dwData) #define MSG_WM_POWERBROADCAST(func) \ if (uMsg == WM_POWERBROADCAST) \ { \ SetMsgHandled(TRUE); \ - lResult = (LRESULT)func((DWORD)wParam, (DWORD)lParam); \ + lResult = (LRESULT)func((DWORD)wParam, (DWORD_PTR)lParam); \ if(IsMsgHandled()) \ return TRUE; \ } @@ -1612,16 +1609,14 @@ public: \ } /////////////////////////////////////////////////////////////////////////////// -// New NT4 & NT5 messages - -#if(_WIN32_WINNT >= 0x0400) +// Newer Windows messages // void OnMouseHover(WPARAM wParam, CPoint ptPos) #define MSG_WM_MOUSEHOVER(func) \ if (uMsg == WM_MOUSEHOVER) \ { \ SetMsgHandled(TRUE); \ - func(wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + func(wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(IsMsgHandled()) \ return TRUE; \ @@ -1638,10 +1633,6 @@ public: \ return TRUE; \ } -#endif /* _WIN32_WINNT >= 0x0400 */ - -#if(WINVER >= 0x0500) - // void OnMenuRButtonUp(WPARAM wParam, CMenuHandle menu) #define MSG_WM_MENURBUTTONUP(func) \ if (uMsg == WM_MENURBUTTONUP) \ @@ -1695,10 +1686,6 @@ public: \ return TRUE; \ } -#endif /* WINVER >= 0x0500 */ - -#if(_WIN32_WINNT >= 0x0500) - // BOOL OnAppCommand(CWindow wndFocus, short cmd, WORD uDevice, int dwKeys) #define MSG_WM_APPCOMMAND(func) \ if (uMsg == WM_APPCOMMAND) \ @@ -1714,8 +1701,8 @@ public: \ if (uMsg == WM_NCXBUTTONDOWN) \ { \ SetMsgHandled(TRUE); \ - func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ + func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = (LRESULT)TRUE; \ if(IsMsgHandled()) \ return TRUE; \ } @@ -1725,8 +1712,8 @@ public: \ if (uMsg == WM_NCXBUTTONUP) \ { \ SetMsgHandled(TRUE); \ - func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ + func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = (LRESULT)TRUE; \ if(IsMsgHandled()) \ return TRUE; \ } @@ -1736,8 +1723,8 @@ public: \ if (uMsg == WM_NCXBUTTONDBLCLK) \ { \ SetMsgHandled(TRUE); \ - func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ + func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = (LRESULT)TRUE; \ if(IsMsgHandled()) \ return TRUE; \ } @@ -1747,8 +1734,8 @@ public: \ if (uMsg == WM_XBUTTONDOWN) \ { \ SetMsgHandled(TRUE); \ - func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ + func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = (LRESULT)TRUE; \ if(IsMsgHandled()) \ return TRUE; \ } @@ -1758,8 +1745,8 @@ public: \ if (uMsg == WM_XBUTTONUP) \ { \ SetMsgHandled(TRUE); \ - func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ + func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = (LRESULT)TRUE; \ if(IsMsgHandled()) \ return TRUE; \ } @@ -1769,8 +1756,8 @@ public: \ if (uMsg == WM_XBUTTONDBLCLK) \ { \ SetMsgHandled(TRUE); \ - func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ - lResult = 0; \ + func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + lResult = (LRESULT)TRUE; \ if(IsMsgHandled()) \ return TRUE; \ } @@ -1807,10 +1794,6 @@ public: \ return TRUE; \ } -#endif // (_WIN32_WINNT >= 0x0500) - -#if(_WIN32_WINNT >= 0x0501) - // void OnInput(WPARAM RawInputCode, HRAWINPUT hRawInput) #define MSG_WM_INPUT(func) \ if (uMsg == WM_INPUT) \ @@ -1846,7 +1829,7 @@ public: \ return TRUE; \ } -// OnThemeChanged() +// void OnThemeChanged() #define MSG_WM_THEMECHANGED(func) \ if (uMsg == WM_THEMECHANGED) \ { \ @@ -1857,7 +1840,52 @@ public: \ return TRUE; \ } -#endif /* _WIN32_WINNT >= 0x0501 */ +#if (_WIN32_WINNT >= 0x0600) + +// BOOL OnMouseHWheel(UINT nFlags, short zDelta, CPoint pt) +#define MSG_WM_MOUSEHWHEEL(func) \ + if (uMsg == WM_MOUSEHWHEEL) \ + { \ + SetMsgHandled(TRUE); \ + lResult = (LRESULT)func((UINT)LOWORD(wParam), (short)HIWORD(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +#endif // (_WIN32_WINNT >= 0x0600) + +#if (WINVER >= 0x0601) + +// void OnGesture(ULONGLONG ullArguments, HGESTUREINFO hGestureInfo) +#define MSG_WM_GESTURE(func) \ + if (uMsg == WM_GESTURE) \ + { \ + SetMsgHandled(TRUE); \ + func((ULONGLONG)wParam, (HGESTUREINFO)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +// void OnGestureNotify(PGESTURENOTIFYSTRUCT pGestureNotifyStruct) +#define MSG_WM_GESTURENOTIFY(func) \ + if (uMsg == WM_GESTURENOTIFY) \ + { \ + func((PGESTURENOTIFYSTRUCT)lParam); \ + } + +// void OnDpiChanged(UINT nDpiX, UINT nDpiY, PRECT pRect) +#define MSG_WM_DPICHANGED(func) \ + if (uMsg == WM_DPICHANGED) \ + { \ + SetMsgHandled(TRUE); \ + func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (PRECT)lParam); \ + lResult = 0; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + +#endif // (WINVER >= 0x0601) /////////////////////////////////////////////////////////////////////////////// // ATL defined messages @@ -2160,7 +2188,7 @@ public: \ // LRESULT OnMessageRangeHandlerEX(UINT uMsg, WPARAM wParam, LPARAM lParam) #define MESSAGE_RANGE_HANDLER_EX(msgFirst, msgLast, func) \ - if(uMsg >= msgFirst && uMsg <= msgLast) \ + if((uMsg >= msgFirst) && (uMsg <= msgLast)) \ { \ SetMsgHandled(TRUE); \ lResult = func(uMsg, wParam, lParam); \ @@ -2173,7 +2201,7 @@ public: \ // void OnCommandHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) #define COMMAND_HANDLER_EX(id, code, func) \ - if (uMsg == WM_COMMAND && code == HIWORD(wParam) && id == LOWORD(wParam)) \ + if ((uMsg == WM_COMMAND) && (code == HIWORD(wParam)) && (id == LOWORD(wParam))) \ { \ SetMsgHandled(TRUE); \ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ @@ -2184,7 +2212,7 @@ public: \ // void OnCommandIDHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) #define COMMAND_ID_HANDLER_EX(id, func) \ - if (uMsg == WM_COMMAND && id == LOWORD(wParam)) \ + if ((uMsg == WM_COMMAND) && (id == LOWORD(wParam))) \ { \ SetMsgHandled(TRUE); \ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ @@ -2195,7 +2223,7 @@ public: \ // void OnCommandCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) #define COMMAND_CODE_HANDLER_EX(code, func) \ - if (uMsg == WM_COMMAND && code == HIWORD(wParam)) \ + if ((uMsg == WM_COMMAND) && (code == HIWORD(wParam))) \ { \ SetMsgHandled(TRUE); \ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ @@ -2206,7 +2234,7 @@ public: \ // LRESULT OnNotifyHandlerEX(LPNMHDR pnmh) #define NOTIFY_HANDLER_EX(id, cd, func) \ - if (uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code && id == ((LPNMHDR)lParam)->idFrom) \ + if ((uMsg == WM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code) && (id == ((LPNMHDR)lParam)->idFrom)) \ { \ SetMsgHandled(TRUE); \ lResult = func((LPNMHDR)lParam); \ @@ -2216,7 +2244,7 @@ public: \ // LRESULT OnNotifyIDHandlerEX(LPNMHDR pnmh) #define NOTIFY_ID_HANDLER_EX(id, func) \ - if (uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \ + if ((uMsg == WM_NOTIFY) && (id == ((LPNMHDR)lParam)->idFrom)) \ { \ SetMsgHandled(TRUE); \ lResult = func((LPNMHDR)lParam); \ @@ -2226,7 +2254,7 @@ public: \ // LRESULT OnNotifyCodeHandlerEX(LPNMHDR pnmh) #define NOTIFY_CODE_HANDLER_EX(cd, func) \ - if (uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \ + if ((uMsg == WM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code)) \ { \ SetMsgHandled(TRUE); \ lResult = func((LPNMHDR)lParam); \ @@ -2236,7 +2264,7 @@ public: \ // void OnCommandRangeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) #define COMMAND_RANGE_HANDLER_EX(idFirst, idLast, func) \ - if(uMsg == WM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ + if((uMsg == WM_COMMAND) && (LOWORD(wParam) >= idFirst) && (LOWORD(wParam) <= idLast)) \ { \ SetMsgHandled(TRUE); \ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ @@ -2247,7 +2275,7 @@ public: \ // void OnCommandRangeCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) #define COMMAND_RANGE_CODE_HANDLER_EX(idFirst, idLast, code, func) \ - if(uMsg == WM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ + if((uMsg == WM_COMMAND) && (code == HIWORD(wParam)) && (LOWORD(wParam) >= idFirst) && (LOWORD(wParam) <= idLast)) \ { \ SetMsgHandled(TRUE); \ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ @@ -2258,7 +2286,7 @@ public: \ // LRESULT OnNotifyRangeHandlerEX(LPNMHDR pnmh) #define NOTIFY_RANGE_HANDLER_EX(idFirst, idLast, func) \ - if(uMsg == WM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ + if((uMsg == WM_NOTIFY) && (((LPNMHDR)lParam)->idFrom >= idFirst) && (((LPNMHDR)lParam)->idFrom <= idLast)) \ { \ SetMsgHandled(TRUE); \ lResult = func((LPNMHDR)lParam); \ @@ -2268,7 +2296,7 @@ public: \ // LRESULT OnNotifyRangeCodeHandlerEX(LPNMHDR pnmh) #define NOTIFY_RANGE_CODE_HANDLER_EX(idFirst, idLast, cd, func) \ - if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ + if((uMsg == WM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code) && (((LPNMHDR)lParam)->idFrom >= idFirst) && (((LPNMHDR)lParam)->idFrom <= idLast)) \ { \ SetMsgHandled(TRUE); \ lResult = func((LPNMHDR)lParam); \ @@ -2278,7 +2306,7 @@ public: \ // LRESULT OnReflectedCommandHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) #define REFLECTED_COMMAND_HANDLER_EX(id, code, func) \ - if (uMsg == OCM_COMMAND && code == HIWORD(wParam) && id == LOWORD(wParam)) \ + if ((uMsg == OCM_COMMAND) && (code == HIWORD(wParam)) && (id == LOWORD(wParam))) \ { \ SetMsgHandled(TRUE); \ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ @@ -2289,7 +2317,7 @@ public: \ // LRESULT OnReflectedCommandIDHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) #define REFLECTED_COMMAND_ID_HANDLER_EX(id, func) \ - if (uMsg == OCM_COMMAND && id == LOWORD(wParam)) \ + if ((uMsg == OCM_COMMAND) && (id == LOWORD(wParam))) \ { \ SetMsgHandled(TRUE); \ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ @@ -2300,7 +2328,7 @@ public: \ // LRESULT OnReflectedCommandCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) #define REFLECTED_COMMAND_CODE_HANDLER_EX(code, func) \ - if (uMsg == OCM_COMMAND && code == HIWORD(wParam)) \ + if ((uMsg == OCM_COMMAND) && (code == HIWORD(wParam))) \ { \ SetMsgHandled(TRUE); \ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ @@ -2311,7 +2339,7 @@ public: \ // LRESULT OnReflectedNotifyHandlerEX(LPNMHDR pnmh) #define REFLECTED_NOTIFY_HANDLER_EX(id, cd, func) \ - if (uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code && id == ((LPNMHDR)lParam)->idFrom) \ + if ((uMsg == OCM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code) && (id == ((LPNMHDR)lParam)->idFrom)) \ { \ SetMsgHandled(TRUE); \ lResult = func((LPNMHDR)lParam); \ @@ -2321,7 +2349,7 @@ public: \ // LRESULT OnReflectedNotifyIDHandlerEX(LPNMHDR pnmh) #define REFLECTED_NOTIFY_ID_HANDLER_EX(id, func) \ - if (uMsg == OCM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \ + if ((uMsg == OCM_NOTIFY) && (id == ((LPNMHDR)lParam)->idFrom)) \ { \ SetMsgHandled(TRUE); \ lResult = func((LPNMHDR)lParam); \ @@ -2331,7 +2359,7 @@ public: \ // LRESULT OnReflectedNotifyCodeHandlerEX(LPNMHDR pnmh) #define REFLECTED_NOTIFY_CODE_HANDLER_EX(cd, func) \ - if (uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \ + if ((uMsg == OCM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code)) \ { \ SetMsgHandled(TRUE); \ lResult = func((LPNMHDR)lParam); \ @@ -2341,7 +2369,7 @@ public: \ // void OnReflectedCommandRangeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) #define REFLECTED_COMMAND_RANGE_HANDLER_EX(idFirst, idLast, func) \ - if(uMsg == OCM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ + if((uMsg == OCM_COMMAND) && (LOWORD(wParam) >= idFirst) && (LOWORD(wParam) <= idLast)) \ { \ SetMsgHandled(TRUE); \ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ @@ -2352,7 +2380,7 @@ public: \ // void OnReflectedCommandRangeCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) #define REFLECTED_COMMAND_RANGE_CODE_HANDLER_EX(idFirst, idLast, code, func) \ - if(uMsg == OCM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ + if((uMsg == OCM_COMMAND) && (code == HIWORD(wParam)) && (LOWORD(wParam) >= idFirst) && (LOWORD(wParam) <= idLast)) \ { \ SetMsgHandled(TRUE); \ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ @@ -2363,7 +2391,7 @@ public: \ // LRESULT OnReflectedNotifyRangeHandlerEX(LPNMHDR pnmh) #define REFLECTED_NOTIFY_RANGE_HANDLER_EX(idFirst, idLast, func) \ - if(uMsg == OCM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ + if((uMsg == OCM_NOTIFY) && (((LPNMHDR)lParam)->idFrom >= idFirst) && (((LPNMHDR)lParam)->idFrom <= idLast)) \ { \ SetMsgHandled(TRUE); \ lResult = func((LPNMHDR)lParam); \ @@ -2373,7 +2401,7 @@ public: \ // LRESULT OnReflectedNotifyRangeCodeHandlerEX(LPNMHDR pnmh) #define REFLECTED_NOTIFY_RANGE_CODE_HANDLER_EX(idFirst, idLast, cd, func) \ - if(uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ + if((uMsg == OCM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code) && (((LPNMHDR)lParam)->idFrom >= idFirst) && (((LPNMHDR)lParam)->idFrom <= idLast)) \ { \ SetMsgHandled(TRUE); \ lResult = func((LPNMHDR)lParam); \ @@ -2381,4 +2409,15 @@ public: \ return TRUE; \ } +// void OnAppCommandHandler(UINT uDevice, DWORD dwKeys, CWindow wndFocus) +#define APPCOMMAND_HANDLER_EX(cmd, func) \ + if((uMsg == WM_APPCOMMAND) && (cmd == GET_APPCOMMAND_LPARAM(lParam))) \ + { \ + SetMsgHandled(TRUE); \ + func(GET_DEVICE_LPARAM(lParam), GET_KEYSTATE_LPARAM(lParam), (HWND)wParam); \ + lResult = TRUE; \ + if(IsMsgHandled()) \ + return TRUE; \ + } + #endif // __ATLCRACK_H__ diff --git a/thirdparty/wtl/atlctrls.h b/thirdparty/wtl/atlctrls.h index f1f31c7..a6e83f3 100644 --- a/thirdparty/wtl/atlctrls.h +++ b/thirdparty/wtl/atlctrls.h @@ -1,13 +1,10 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. +// Windows Template Library - WTL version 10.0 +// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. +// Microsoft Public License (http://opensource.org/licenses/MS-PL) +// which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLCTRLS_H__ #define __ATLCTRLS_H__ @@ -22,12 +19,12 @@ #error atlctrls.h requires atlwin.h to be included first #endif -#ifndef _WIN32_WCE - #include - #include -#elif defined(WIN32_PLATFORM_WFSP) && !defined(_WINUSERM_H_) - #include -#endif // !_WIN32_WCE +#include +#include + +#if (_RICHEDIT_VER < 0x0300) + #error WTL10 requires RichEdit version 3 or higher +#endif // protect template members from windowsx.h macros #ifdef _INC_WINDOWSX @@ -47,7 +44,7 @@ // CEditCommands // CScrollBarT - CScrollBar // -// CImageList +// CImageListT - CImageList, CImageListManaged // CListViewCtrlT - CListViewCtrl // CTreeViewCtrlT - CTreeViewCtrl // CTreeItemT - CTreeItem @@ -78,9 +75,6 @@ // CLinkCtrlT - CLinkCtrl // // CCustomDraw -// -// CCECommandBarCtrlT - CCECommandBarCtrl -// CCECommandBandsCtrlT - CCECommandBandsCtrl namespace WTL @@ -115,7 +109,7 @@ class CStaticT : public TBase CStaticT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -132,66 +126,52 @@ class CStaticT : public TBase return _T("STATIC"); } -#ifndef _WIN32_WCE HICON GetIcon() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (HICON)::SendMessage(m_hWnd, STM_GETICON, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HICON)::SendMessage(this->m_hWnd, STM_GETICON, 0, 0L); } HICON SetIcon(HICON hIcon) { - ATLASSERT(::IsWindow(m_hWnd)); - return (HICON)::SendMessage(m_hWnd, STM_SETICON, (WPARAM)hIcon, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HICON)::SendMessage(this->m_hWnd, STM_SETICON, (WPARAM)hIcon, 0L); } HENHMETAFILE GetEnhMetaFile() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (HENHMETAFILE)::SendMessage(m_hWnd, STM_GETIMAGE, IMAGE_ENHMETAFILE, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HENHMETAFILE)::SendMessage(this->m_hWnd, STM_GETIMAGE, IMAGE_ENHMETAFILE, 0L); } HENHMETAFILE SetEnhMetaFile(HENHMETAFILE hMetaFile) { - ATLASSERT(::IsWindow(m_hWnd)); - return (HENHMETAFILE)::SendMessage(m_hWnd, STM_SETIMAGE, IMAGE_ENHMETAFILE, (LPARAM)hMetaFile); - } -#else // CE specific - HICON GetIcon() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HICON)::SendMessage(m_hWnd, STM_GETIMAGE, IMAGE_ICON, 0L); - } - - HICON SetIcon(HICON hIcon) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HICON)::SendMessage(m_hWnd, STM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HENHMETAFILE)::SendMessage(this->m_hWnd, STM_SETIMAGE, IMAGE_ENHMETAFILE, (LPARAM)hMetaFile); } -#endif // _WIN32_WCE CBitmapHandle GetBitmap() const { - ATLASSERT(::IsWindow(m_hWnd)); - return CBitmapHandle((HBITMAP)::SendMessage(m_hWnd, STM_GETIMAGE, IMAGE_BITMAP, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CBitmapHandle((HBITMAP)::SendMessage(this->m_hWnd, STM_GETIMAGE, IMAGE_BITMAP, 0L)); } CBitmapHandle SetBitmap(HBITMAP hBitmap) { - ATLASSERT(::IsWindow(m_hWnd)); - return CBitmapHandle((HBITMAP)::SendMessage(m_hWnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CBitmapHandle((HBITMAP)::SendMessage(this->m_hWnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap)); } HCURSOR GetCursor() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (HCURSOR)::SendMessage(m_hWnd, STM_GETIMAGE, IMAGE_CURSOR, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HCURSOR)::SendMessage(this->m_hWnd, STM_GETIMAGE, IMAGE_CURSOR, 0L); } HCURSOR SetCursor(HCURSOR hCursor) { - ATLASSERT(::IsWindow(m_hWnd)); - return (HCURSOR)::SendMessage(m_hWnd, STM_SETIMAGE, IMAGE_CURSOR, (LPARAM)hCursor); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HCURSOR)::SendMessage(this->m_hWnd, STM_SETIMAGE, IMAGE_CURSOR, (LPARAM)hCursor); } }; @@ -211,7 +191,7 @@ class CButtonT : public TBase CButtonT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -230,161 +210,157 @@ class CButtonT : public TBase UINT GetState() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, BM_GETSTATE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UINT)::SendMessage(this->m_hWnd, BM_GETSTATE, 0, 0L); } void SetState(BOOL bHighlight) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, BM_SETSTATE, bHighlight, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, BM_SETSTATE, bHighlight, 0L); } int GetCheck() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, BM_GETCHECK, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, BM_GETCHECK, 0, 0L); } void SetCheck(int nCheck) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, BM_SETCHECK, nCheck, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, BM_SETCHECK, nCheck, 0L); } UINT GetButtonStyle() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::GetWindowLong(m_hWnd, GWL_STYLE) & 0xFFFF; + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UINT)::GetWindowLong(this->m_hWnd, GWL_STYLE) & 0xFFFF; } void SetButtonStyle(UINT nStyle, BOOL bRedraw = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, BM_SETSTYLE, nStyle, (LPARAM)bRedraw); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, BM_SETSTYLE, nStyle, (LPARAM)bRedraw); } -#ifndef _WIN32_WCE HICON GetIcon() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (HICON)::SendMessage(m_hWnd, BM_GETIMAGE, IMAGE_ICON, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HICON)::SendMessage(this->m_hWnd, BM_GETIMAGE, IMAGE_ICON, 0L); } HICON SetIcon(HICON hIcon) { - ATLASSERT(::IsWindow(m_hWnd)); - return (HICON)::SendMessage(m_hWnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HICON)::SendMessage(this->m_hWnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); } CBitmapHandle GetBitmap() const { - ATLASSERT(::IsWindow(m_hWnd)); - return CBitmapHandle((HBITMAP)::SendMessage(m_hWnd, BM_GETIMAGE, IMAGE_BITMAP, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CBitmapHandle((HBITMAP)::SendMessage(this->m_hWnd, BM_GETIMAGE, IMAGE_BITMAP, 0L)); } CBitmapHandle SetBitmap(HBITMAP hBitmap) { - ATLASSERT(::IsWindow(m_hWnd)); - return CBitmapHandle((HBITMAP)::SendMessage(m_hWnd, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CBitmapHandle((HBITMAP)::SendMessage(this->m_hWnd, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap)); } -#endif // !_WIN32_WCE -#if (_WIN32_WINNT >= 0x0501) BOOL GetIdealSize(LPSIZE lpSize) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, BCM_GETIDEALSIZE, 0, (LPARAM)lpSize); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, BCM_GETIDEALSIZE, 0, (LPARAM)lpSize); } BOOL GetImageList(PBUTTON_IMAGELIST pButtonImagelist) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, BCM_GETIMAGELIST, 0, (LPARAM)pButtonImagelist); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, BCM_GETIMAGELIST, 0, (LPARAM)pButtonImagelist); } BOOL SetImageList(PBUTTON_IMAGELIST pButtonImagelist) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, BCM_SETIMAGELIST, 0, (LPARAM)pButtonImagelist); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, BCM_SETIMAGELIST, 0, (LPARAM)pButtonImagelist); } BOOL GetTextMargin(LPRECT lpRect) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, BCM_GETTEXTMARGIN, 0, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, BCM_GETTEXTMARGIN, 0, (LPARAM)lpRect); } BOOL SetTextMargin(LPRECT lpRect) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, BCM_SETTEXTMARGIN, 0, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, BCM_SETTEXTMARGIN, 0, (LPARAM)lpRect); } -#endif // (_WIN32_WINNT >= 0x0501) #if (WINVER >= 0x0600) void SetDontClick(BOOL bDontClick) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, BM_SETDONTCLICK, (WPARAM)bDontClick, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, BM_SETDONTCLICK, (WPARAM)bDontClick, 0L); } #endif // (WINVER >= 0x0600) #if (_WIN32_WINNT >= 0x0600) BOOL SetDropDownState(BOOL bDropDown) { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (BS_SPLITBUTTON | BS_DEFSPLITBUTTON)) != 0); - return (BOOL)::SendMessage(m_hWnd, BCM_SETDROPDOWNSTATE, (WPARAM)bDropDown, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & (BS_SPLITBUTTON | BS_DEFSPLITBUTTON)) != 0); + return (BOOL)::SendMessage(this->m_hWnd, BCM_SETDROPDOWNSTATE, (WPARAM)bDropDown, 0L); } BOOL GetSplitInfo(PBUTTON_SPLITINFO pSplitInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (BS_SPLITBUTTON | BS_DEFSPLITBUTTON)) != 0); - return (BOOL)::SendMessage(m_hWnd, BCM_GETSPLITINFO, 0, (LPARAM)pSplitInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & (BS_SPLITBUTTON | BS_DEFSPLITBUTTON)) != 0); + return (BOOL)::SendMessage(this->m_hWnd, BCM_GETSPLITINFO, 0, (LPARAM)pSplitInfo); } BOOL SetSplitInfo(PBUTTON_SPLITINFO pSplitInfo) { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (BS_SPLITBUTTON | BS_DEFSPLITBUTTON)) != 0); - return (BOOL)::SendMessage(m_hWnd, BCM_SETSPLITINFO, 0, (LPARAM)pSplitInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & (BS_SPLITBUTTON | BS_DEFSPLITBUTTON)) != 0); + return (BOOL)::SendMessage(this->m_hWnd, BCM_SETSPLITINFO, 0, (LPARAM)pSplitInfo); } int GetNoteLength() const { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (BS_COMMANDLINK | BS_DEFCOMMANDLINK)) != 0); - return (int)::SendMessage(m_hWnd, BCM_GETNOTELENGTH, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & (BS_COMMANDLINK | BS_DEFCOMMANDLINK)) != 0); + return (int)::SendMessage(this->m_hWnd, BCM_GETNOTELENGTH, 0, 0L); } BOOL GetNote(LPWSTR lpstrNoteText, int cchNoteText) const { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (BS_COMMANDLINK | BS_DEFCOMMANDLINK)) != 0); - return (BOOL)::SendMessage(m_hWnd, BCM_GETNOTE, cchNoteText, (LPARAM)lpstrNoteText); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & (BS_COMMANDLINK | BS_DEFCOMMANDLINK)) != 0); + return (BOOL)::SendMessage(this->m_hWnd, BCM_GETNOTE, cchNoteText, (LPARAM)lpstrNoteText); } BOOL SetNote(LPCWSTR lpstrNoteText) { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (BS_COMMANDLINK | BS_DEFCOMMANDLINK)) != 0); - return (BOOL)::SendMessage(m_hWnd, BCM_SETNOTE, 0, (LPARAM)lpstrNoteText); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & (BS_COMMANDLINK | BS_DEFCOMMANDLINK)) != 0); + return (BOOL)::SendMessage(this->m_hWnd, BCM_SETNOTE, 0, (LPARAM)lpstrNoteText); } LRESULT SetElevationRequiredState(BOOL bSet) { - ATLASSERT(::IsWindow(m_hWnd)); - return ::SendMessage(m_hWnd, BCM_SETSHIELD, 0, (LPARAM)bSet); + ATLASSERT(::IsWindow(this->m_hWnd)); + return ::SendMessage(this->m_hWnd, BCM_SETSHIELD, 0, (LPARAM)bSet); } #endif // (_WIN32_WINNT >= 0x0600) // Operations void Click() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, BM_CLICK, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, BM_CLICK, 0, 0L); } }; @@ -404,7 +380,7 @@ class CListBoxT : public TBase CListBoxT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -424,186 +400,177 @@ class CListBoxT : public TBase // for entire listbox int GetCount() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETCOUNT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LB_GETCOUNT, 0, 0L); } -#ifndef _WIN32_WCE int SetCount(int cItems) { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(((GetStyle() & LBS_NODATA) != 0) && ((GetStyle() & LBS_HASSTRINGS) == 0)); - return (int)::SendMessage(m_hWnd, LB_SETCOUNT, cItems, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT(((this->GetStyle() & LBS_NODATA) != 0) && ((this->GetStyle() & LBS_HASSTRINGS) == 0)); + return (int)::SendMessage(this->m_hWnd, LB_SETCOUNT, cItems, 0L); } -#endif // !_WIN32_WCE int GetHorizontalExtent() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETHORIZONTALEXTENT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LB_GETHORIZONTALEXTENT, 0, 0L); } void SetHorizontalExtent(int cxExtent) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LB_SETHORIZONTALEXTENT, cxExtent, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, LB_SETHORIZONTALEXTENT, cxExtent, 0L); } int GetTopIndex() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETTOPINDEX, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LB_GETTOPINDEX, 0, 0L); } int SetTopIndex(int nIndex) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_SETTOPINDEX, nIndex, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LB_SETTOPINDEX, nIndex, 0L); } LCID GetLocale() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (LCID)::SendMessage(m_hWnd, LB_GETLOCALE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (LCID)::SendMessage(this->m_hWnd, LB_GETLOCALE, 0, 0L); } LCID SetLocale(LCID nNewLocale) { - ATLASSERT(::IsWindow(m_hWnd)); - return (LCID)::SendMessage(m_hWnd, LB_SETLOCALE, (WPARAM)nNewLocale, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (LCID)::SendMessage(this->m_hWnd, LB_SETLOCALE, (WPARAM)nNewLocale, 0L); } -#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) DWORD GetListBoxInfo() const { - ATLASSERT(::IsWindow(m_hWnd)); -#if (_WIN32_WINNT >= 0x0501) - return (DWORD)::SendMessage(m_hWnd, LB_GETLISTBOXINFO, 0, 0L); -#else // !(_WIN32_WINNT >= 0x0501) - return ::GetListBoxInfo(m_hWnd); -#endif // !(_WIN32_WINNT >= 0x0501) + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, LB_GETLISTBOXINFO, 0, 0L); } -#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) // for single-selection listboxes int GetCurSel() const { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == 0); - return (int)::SendMessage(m_hWnd, LB_GETCURSEL, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == 0); + return (int)::SendMessage(this->m_hWnd, LB_GETCURSEL, 0, 0L); } int SetCurSel(int nSelect) { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == 0); - return (int)::SendMessage(m_hWnd, LB_SETCURSEL, nSelect, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == 0); + return (int)::SendMessage(this->m_hWnd, LB_SETCURSEL, nSelect, 0L); } // for multiple-selection listboxes int GetSel(int nIndex) const // also works for single-selection { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETSEL, nIndex, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LB_GETSEL, nIndex, 0L); } int SetSel(int nIndex, BOOL bSelect = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); - return (int)::SendMessage(m_hWnd, LB_SETSEL, bSelect, nIndex); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); + return (int)::SendMessage(this->m_hWnd, LB_SETSEL, bSelect, nIndex); } int GetSelCount() const { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); - return (int)::SendMessage(m_hWnd, LB_GETSELCOUNT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); + return (int)::SendMessage(this->m_hWnd, LB_GETSELCOUNT, 0, 0L); } int GetSelItems(int nMaxItems, LPINT rgIndex) const { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); - return (int)::SendMessage(m_hWnd, LB_GETSELITEMS, nMaxItems, (LPARAM)rgIndex); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); + return (int)::SendMessage(this->m_hWnd, LB_GETSELITEMS, nMaxItems, (LPARAM)rgIndex); } int GetAnchorIndex() const { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); - return (int)::SendMessage(m_hWnd, LB_GETANCHORINDEX, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); + return (int)::SendMessage(this->m_hWnd, LB_GETANCHORINDEX, 0, 0L); } void SetAnchorIndex(int nIndex) { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); - ::SendMessage(m_hWnd, LB_SETANCHORINDEX, nIndex, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); + ::SendMessage(this->m_hWnd, LB_SETANCHORINDEX, nIndex, 0L); } int GetCaretIndex() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETCARETINDEX, 0, 0); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LB_GETCARETINDEX, 0, 0); } int SetCaretIndex(int nIndex, BOOL bScroll = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_SETCARETINDEX, nIndex, MAKELONG(bScroll, 0)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LB_SETCARETINDEX, nIndex, MAKELONG(bScroll, 0)); } // for listbox items DWORD_PTR GetItemData(int nIndex) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD_PTR)::SendMessage(m_hWnd, LB_GETITEMDATA, nIndex, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD_PTR)::SendMessage(this->m_hWnd, LB_GETITEMDATA, nIndex, 0L); } int SetItemData(int nIndex, DWORD_PTR dwItemData) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_SETITEMDATA, nIndex, (LPARAM)dwItemData); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LB_SETITEMDATA, nIndex, (LPARAM)dwItemData); } void* GetItemDataPtr(int nIndex) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (void*)::SendMessage(m_hWnd, LB_GETITEMDATA, nIndex, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (void*)::SendMessage(this->m_hWnd, LB_GETITEMDATA, nIndex, 0L); } int SetItemDataPtr(int nIndex, void* pData) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); return SetItemData(nIndex, (DWORD_PTR)pData); } int GetItemRect(int nIndex, LPRECT lpRect) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETITEMRECT, nIndex, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LB_GETITEMRECT, nIndex, (LPARAM)lpRect); } int GetText(int nIndex, LPTSTR lpszBuffer) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETTEXT, nIndex, (LPARAM)lpszBuffer); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LB_GETTEXT, nIndex, (LPARAM)lpszBuffer); } -#ifndef _ATL_NO_COM #ifdef _OLEAUTO_H_ BOOL GetTextBSTR(int nIndex, BSTR& bstrText) const { USES_CONVERSION; - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(bstrText == NULL); int nLen = GetTextLen(nIndex); if(nLen == LB_ERR) return FALSE; - CTempBuffer buff; + ATL::CTempBuffer buff; LPTSTR lpstrText = buff.Allocate(nLen + 1); if(lpstrText == NULL) return FALSE; @@ -615,12 +582,11 @@ class CListBoxT : public TBase return (bstrText != NULL) ? TRUE : FALSE; } #endif // _OLEAUTO_H_ -#endif // !_ATL_NO_COM -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - int GetText(int nIndex, _CSTRING_NS::CString& strText) const +#ifdef __ATLSTR_H__ + int GetText(int nIndex, ATL::CString& strText) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); int cchLen = GetTextLen(nIndex); if(cchLen == LB_ERR) return LB_ERR; @@ -633,71 +599,71 @@ class CListBoxT : public TBase } return nRet; } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) +#endif // __ATLSTR_H__ int GetTextLen(int nIndex) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETTEXTLEN, nIndex, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LB_GETTEXTLEN, nIndex, 0L); } int GetItemHeight(int nIndex) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_GETITEMHEIGHT, nIndex, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LB_GETITEMHEIGHT, nIndex, 0L); } int SetItemHeight(int nIndex, UINT cyItemHeight) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_SETITEMHEIGHT, nIndex, MAKELONG(cyItemHeight, 0)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LB_SETITEMHEIGHT, nIndex, MAKELONG(cyItemHeight, 0)); } // Settable only attributes void SetColumnWidth(int cxWidth) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LB_SETCOLUMNWIDTH, cxWidth, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, LB_SETCOLUMNWIDTH, cxWidth, 0L); } BOOL SetTabStops(int nTabStops, LPINT rgTabStops) { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & LBS_USETABSTOPS) != 0); - return (BOOL)::SendMessage(m_hWnd, LB_SETTABSTOPS, nTabStops, (LPARAM)rgTabStops); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & LBS_USETABSTOPS) != 0); + return (BOOL)::SendMessage(this->m_hWnd, LB_SETTABSTOPS, nTabStops, (LPARAM)rgTabStops); } BOOL SetTabStops() { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & LBS_USETABSTOPS) != 0); - return (BOOL)::SendMessage(m_hWnd, LB_SETTABSTOPS, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & LBS_USETABSTOPS) != 0); + return (BOOL)::SendMessage(this->m_hWnd, LB_SETTABSTOPS, 0, 0L); } BOOL SetTabStops(const int& cxEachStop) // takes an 'int' { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & LBS_USETABSTOPS) != 0); - return (BOOL)::SendMessage(m_hWnd, LB_SETTABSTOPS, 1, (LPARAM)(LPINT)&cxEachStop); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & LBS_USETABSTOPS) != 0); + return (BOOL)::SendMessage(this->m_hWnd, LB_SETTABSTOPS, 1, (LPARAM)(LPINT)&cxEachStop); } // Operations int InitStorage(int nItems, UINT nBytes) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_INITSTORAGE, (WPARAM)nItems, nBytes); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LB_INITSTORAGE, (WPARAM)nItems, nBytes); } void ResetContent() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LB_RESETCONTENT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, LB_RESETCONTENT, 0, 0L); } UINT ItemFromPoint(POINT pt, BOOL& bOutside) const { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dw = (DWORD)::SendMessage(m_hWnd, LB_ITEMFROMPOINT, 0, MAKELPARAM(pt.x, pt.y)); + ATLASSERT(::IsWindow(this->m_hWnd)); + DWORD dw = (DWORD)::SendMessage(this->m_hWnd, LB_ITEMFROMPOINT, 0, MAKELPARAM(pt.x, pt.y)); bOutside = (BOOL)HIWORD(dw); return (UINT)LOWORD(dw); } @@ -705,74 +671,60 @@ class CListBoxT : public TBase // manipulating listbox items int AddString(LPCTSTR lpszItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_ADDSTRING, 0, (LPARAM)lpszItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LB_ADDSTRING, 0, (LPARAM)lpszItem); } int DeleteString(UINT nIndex) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_DELETESTRING, nIndex, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LB_DELETESTRING, nIndex, 0L); } int InsertString(int nIndex, LPCTSTR lpszItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_INSERTSTRING, nIndex, (LPARAM)lpszItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LB_INSERTSTRING, nIndex, (LPARAM)lpszItem); } -#ifndef _WIN32_WCE int Dir(UINT attr, LPCTSTR lpszWildCard) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_DIR, attr, (LPARAM)lpszWildCard); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LB_DIR, attr, (LPARAM)lpszWildCard); } int AddFile(LPCTSTR lpstrFileName) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_ADDFILE, 0, (LPARAM)lpstrFileName); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LB_ADDFILE, 0, (LPARAM)lpstrFileName); } -#endif // !_WIN32_WCE // selection helpers int FindString(int nStartAfter, LPCTSTR lpszItem) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_FINDSTRING, nStartAfter, (LPARAM)lpszItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LB_FINDSTRING, nStartAfter, (LPARAM)lpszItem); } int FindStringExact(int nIndexStart, LPCTSTR lpszFind) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_FINDSTRINGEXACT, nIndexStart, (LPARAM)lpszFind); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LB_FINDSTRINGEXACT, nIndexStart, (LPARAM)lpszFind); } int SelectString(int nStartAfter, LPCTSTR lpszItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LB_SELECTSTRING, nStartAfter, (LPARAM)lpszItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LB_SELECTSTRING, nStartAfter, (LPARAM)lpszItem); } int SelItemRange(BOOL bSelect, int nFirstItem, int nLastItem) { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); ATLASSERT(nFirstItem <= nLastItem); - return bSelect ? (int)::SendMessage(m_hWnd, LB_SELITEMRANGEEX, nFirstItem, nLastItem) : (int)::SendMessage(m_hWnd, LB_SELITEMRANGEEX, nLastItem, nFirstItem); + return bSelect ? (int)::SendMessage(this->m_hWnd, LB_SELITEMRANGEEX, nFirstItem, nLastItem) : (int)::SendMessage(this->m_hWnd, LB_SELITEMRANGEEX, nLastItem, nFirstItem); } - -#ifdef WIN32_PLATFORM_WFSP // SmartPhone only messages - DWORD GetInputMode(BOOL bCurrentMode = TRUE) - { - return SendMessage(LB_GETINPUTMODE, 0, (LPARAM)bCurrentMode); - } - - BOOL SetInputMode(DWORD dwMode) - { - return SendMessage(LB_SETINPUTMODE, 0, (LPARAM)dwMode); - } -#endif // WIN32_PLATFORM_WFSP }; typedef CListBoxT CListBox; @@ -781,8 +733,6 @@ typedef CListBoxT CListBox; /////////////////////////////////////////////////////////////////////////////// // CComboBox - client side for a Windows COMBOBOX control -#ifndef WIN32_PLATFORM_WFSP // No COMBOBOX on SmartPhones - template class CComboBoxT : public TBase { @@ -793,7 +743,7 @@ class CComboBoxT : public TBase CComboBoxT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -813,138 +763,131 @@ class CComboBoxT : public TBase // for entire combo box int GetCount() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_GETCOUNT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, CB_GETCOUNT, 0, 0L); } int GetCurSel() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_GETCURSEL, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, CB_GETCURSEL, 0, 0L); } int SetCurSel(int nSelect) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_SETCURSEL, nSelect, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, CB_SETCURSEL, nSelect, 0L); } LCID GetLocale() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (LCID)::SendMessage(m_hWnd, CB_GETLOCALE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (LCID)::SendMessage(this->m_hWnd, CB_GETLOCALE, 0, 0L); } LCID SetLocale(LCID nNewLocale) { - ATLASSERT(::IsWindow(m_hWnd)); - return (LCID)::SendMessage(m_hWnd, CB_SETLOCALE, (WPARAM)nNewLocale, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (LCID)::SendMessage(this->m_hWnd, CB_SETLOCALE, (WPARAM)nNewLocale, 0L); } int GetTopIndex() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_GETTOPINDEX, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, CB_GETTOPINDEX, 0, 0L); } int SetTopIndex(int nIndex) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_SETTOPINDEX, nIndex, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, CB_SETTOPINDEX, nIndex, 0L); } UINT GetHorizontalExtent() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, CB_GETHORIZONTALEXTENT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UINT)::SendMessage(this->m_hWnd, CB_GETHORIZONTALEXTENT, 0, 0L); } void SetHorizontalExtent(UINT nExtent) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, CB_SETHORIZONTALEXTENT, nExtent, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, CB_SETHORIZONTALEXTENT, nExtent, 0L); } int GetDroppedWidth() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_GETDROPPEDWIDTH, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, CB_GETDROPPEDWIDTH, 0, 0L); } int SetDroppedWidth(UINT nWidth) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_SETDROPPEDWIDTH, nWidth, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, CB_SETDROPPEDWIDTH, nWidth, 0L); } -#if ((WINVER >= 0x0500) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 420)) BOOL GetComboBoxInfo(PCOMBOBOXINFO pComboBoxInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); -#if ((_WIN32_WINNT >= 0x0501) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 420)) - return (BOOL)::SendMessage(m_hWnd, CB_GETCOMBOBOXINFO, 0, (LPARAM)pComboBoxInfo); -#else // !((_WIN32_WINNT >= 0x0501) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 420)) - return ::GetComboBoxInfo(m_hWnd, pComboBoxInfo); -#endif // !((_WIN32_WINNT >= 0x0501) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 420)) + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, CB_GETCOMBOBOXINFO, 0, (LPARAM)pComboBoxInfo); } -#endif // ((WINVER >= 0x0500) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 420)) // for edit control DWORD GetEditSel() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, CB_GETEDITSEL, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, CB_GETEDITSEL, 0, 0L); } BOOL SetEditSel(int nStartChar, int nEndChar) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CB_SETEDITSEL, 0, MAKELONG(nStartChar, nEndChar)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, CB_SETEDITSEL, 0, MAKELONG(nStartChar, nEndChar)); } // for combobox item DWORD_PTR GetItemData(int nIndex) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD_PTR)::SendMessage(m_hWnd, CB_GETITEMDATA, nIndex, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD_PTR)::SendMessage(this->m_hWnd, CB_GETITEMDATA, nIndex, 0L); } int SetItemData(int nIndex, DWORD_PTR dwItemData) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_SETITEMDATA, nIndex, (LPARAM)dwItemData); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, CB_SETITEMDATA, nIndex, (LPARAM)dwItemData); } void* GetItemDataPtr(int nIndex) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); return (void*)GetItemData(nIndex); } int SetItemDataPtr(int nIndex, void* pData) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); return SetItemData(nIndex, (DWORD_PTR)pData); } int GetLBText(int nIndex, LPTSTR lpszText) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_GETLBTEXT, nIndex, (LPARAM)lpszText); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, CB_GETLBTEXT, nIndex, (LPARAM)lpszText); } -#ifndef _ATL_NO_COM BOOL GetLBTextBSTR(int nIndex, BSTR& bstrText) const { USES_CONVERSION; - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(bstrText == NULL); int nLen = GetLBTextLen(nIndex); if(nLen == CB_ERR) return FALSE; - CTempBuffer buff; + ATL::CTempBuffer buff; LPTSTR lpstrText = buff.Allocate(nLen + 1); if(lpstrText == NULL) return FALSE; @@ -955,12 +898,11 @@ class CComboBoxT : public TBase bstrText = ::SysAllocString(T2OLE(lpstrText)); return (bstrText != NULL) ? TRUE : FALSE; } -#endif // !_ATL_NO_COM -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - int GetLBText(int nIndex, _CSTRING_NS::CString& strText) const +#ifdef __ATLSTR_H__ + int GetLBText(int nIndex, ATL::CString& strText) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); int cchLen = GetLBTextLen(nIndex); if(cchLen == CB_ERR) return CB_ERR; @@ -973,186 +915,175 @@ class CComboBoxT : public TBase } return nRet; } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) +#endif // __ATLSTR_H__ int GetLBTextLen(int nIndex) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_GETLBTEXTLEN, nIndex, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, CB_GETLBTEXTLEN, nIndex, 0L); } int GetItemHeight(int nIndex) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_GETITEMHEIGHT, nIndex, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, CB_GETITEMHEIGHT, nIndex, 0L); } int SetItemHeight(int nIndex, UINT cyItemHeight) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_SETITEMHEIGHT, nIndex, MAKELONG(cyItemHeight, 0)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, CB_SETITEMHEIGHT, nIndex, MAKELONG(cyItemHeight, 0)); } BOOL GetExtendedUI() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CB_GETEXTENDEDUI, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, CB_GETEXTENDEDUI, 0, 0L); } int SetExtendedUI(BOOL bExtended = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_SETEXTENDEDUI, bExtended, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, CB_SETEXTENDEDUI, bExtended, 0L); } void GetDroppedControlRect(LPRECT lprect) const { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)lprect); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)lprect); } BOOL GetDroppedState() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CB_GETDROPPEDSTATE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, CB_GETDROPPEDSTATE, 0, 0L); } -#if (_WIN32_WINNT >= 0x0501) int GetMinVisible() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_GETMINVISIBLE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, CB_GETMINVISIBLE, 0, 0L); } BOOL SetMinVisible(int nMinVisible) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CB_SETMINVISIBLE, nMinVisible, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, CB_SETMINVISIBLE, nMinVisible, 0L); } // Vista only BOOL GetCueBannerText(LPWSTR lpwText, int cchText) const { -#ifndef CB_GETCUEBANNER - const UINT CB_GETCUEBANNER = (CBM_FIRST + 4); -#endif - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CB_GETCUEBANNER, (WPARAM)lpwText, cchText); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, CB_GETCUEBANNER, (WPARAM)lpwText, cchText); } // Vista only BOOL SetCueBannerText(LPCWSTR lpcwText) { -#ifndef CB_SETCUEBANNER - const UINT CB_SETCUEBANNER = (CBM_FIRST + 3); -#endif - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CB_SETCUEBANNER, 0, (LPARAM)lpcwText); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, CB_SETCUEBANNER, 0, (LPARAM)lpcwText); } -#endif // (_WIN32_WINNT >= 0x0501) // Operations int InitStorage(int nItems, UINT nBytes) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_INITSTORAGE, (WPARAM)nItems, nBytes); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, CB_INITSTORAGE, (WPARAM)nItems, nBytes); } void ResetContent() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, CB_RESETCONTENT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, CB_RESETCONTENT, 0, 0L); } // for edit control BOOL LimitText(int nMaxChars) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CB_LIMITTEXT, nMaxChars, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, CB_LIMITTEXT, nMaxChars, 0L); } // for drop-down combo boxes void ShowDropDown(BOOL bShowIt = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, CB_SHOWDROPDOWN, bShowIt, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, CB_SHOWDROPDOWN, bShowIt, 0L); } // manipulating listbox items int AddString(LPCTSTR lpszString) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_ADDSTRING, 0, (LPARAM)lpszString); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, CB_ADDSTRING, 0, (LPARAM)lpszString); } int DeleteString(UINT nIndex) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_DELETESTRING, nIndex, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, CB_DELETESTRING, nIndex, 0L); } int InsertString(int nIndex, LPCTSTR lpszString) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_INSERTSTRING, nIndex, (LPARAM)lpszString); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, CB_INSERTSTRING, nIndex, (LPARAM)lpszString); } -#ifndef _WIN32_WCE int Dir(UINT attr, LPCTSTR lpszWildCard) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_DIR, attr, (LPARAM)lpszWildCard); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, CB_DIR, attr, (LPARAM)lpszWildCard); } -#endif // !_WIN32_WCE // selection helpers int FindString(int nStartAfter, LPCTSTR lpszString) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_FINDSTRING, nStartAfter, (LPARAM)lpszString); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, CB_FINDSTRING, nStartAfter, (LPARAM)lpszString); } int FindStringExact(int nIndexStart, LPCTSTR lpszFind) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_FINDSTRINGEXACT, nIndexStart, (LPARAM)lpszFind); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, CB_FINDSTRINGEXACT, nIndexStart, (LPARAM)lpszFind); } int SelectString(int nStartAfter, LPCTSTR lpszString) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CB_SELECTSTRING, nStartAfter, (LPARAM)lpszString); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, CB_SELECTSTRING, nStartAfter, (LPARAM)lpszString); } // Clipboard operations void Clear() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_CLEAR, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, WM_CLEAR, 0, 0L); } void Copy() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_COPY, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, WM_COPY, 0, 0L); } void Cut() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_CUT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, WM_CUT, 0, 0L); } void Paste() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_PASTE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, WM_PASTE, 0, 0L); } }; typedef CComboBoxT CComboBox; -#endif // !WIN32_PLATFORM_WFSP /////////////////////////////////////////////////////////////////////////////// // CEdit - client side for a Windows EDIT control @@ -1167,7 +1098,7 @@ class CEditT : public TBase CEditT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -1186,96 +1117,102 @@ class CEditT : public TBase BOOL CanUndo() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_CANUNDO, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_CANUNDO, 0, 0L); } int GetLineCount() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETLINECOUNT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, EM_GETLINECOUNT, 0, 0L); } BOOL GetModify() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_GETMODIFY, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_GETMODIFY, 0, 0L); } void SetModify(BOOL bModified = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETMODIFY, bModified, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_SETMODIFY, bModified, 0L); } void GetRect(LPRECT lpRect) const { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_GETRECT, 0, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_GETRECT, 0, (LPARAM)lpRect); } DWORD GetSel() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, EM_GETSEL, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, EM_GETSEL, 0, 0L); } void GetSel(int& nStartChar, int& nEndChar) const { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_GETSEL, (WPARAM)&nStartChar, (LPARAM)&nEndChar); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_GETSEL, (WPARAM)&nStartChar, (LPARAM)&nEndChar); } -#ifndef _WIN32_WCE HLOCAL GetHandle() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (HLOCAL)::SendMessage(m_hWnd, EM_GETHANDLE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HLOCAL)::SendMessage(this->m_hWnd, EM_GETHANDLE, 0, 0L); } void SetHandle(HLOCAL hBuffer) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETHANDLE, (WPARAM)hBuffer, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_SETHANDLE, (WPARAM)hBuffer, 0L); } -#endif // !_WIN32_WCE DWORD GetMargins() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, EM_GETMARGINS, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, EM_GETMARGINS, 0, 0L); } - void SetMargins(UINT nLeft, UINT nRight) + void GetMargins(UINT& nLeft, UINT& nRight) const { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETMARGINS, EC_LEFTMARGIN|EC_RIGHTMARGIN, MAKELONG(nLeft, nRight)); + ATLASSERT(::IsWindow(this->m_hWnd)); + DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, EM_GETMARGINS, 0, 0L); + nLeft = LOWORD(dwRet); + nRight = HIWORD(dwRet); + } + + void SetMargins(UINT nLeft, UINT nRight, WORD wFlags = EC_LEFTMARGIN | EC_RIGHTMARGIN) + { + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_SETMARGINS, wFlags, MAKELONG(nLeft, nRight)); } UINT GetLimitText() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_GETLIMITTEXT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UINT)::SendMessage(this->m_hWnd, EM_GETLIMITTEXT, 0, 0L); } void SetLimitText(UINT nMax) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETLIMITTEXT, nMax, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_SETLIMITTEXT, nMax, 0L); } POINT PosFromChar(UINT nChar) const { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, EM_POSFROMCHAR, nChar, 0); + ATLASSERT(::IsWindow(this->m_hWnd)); + DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, EM_POSFROMCHAR, nChar, 0); POINT point = { GET_X_LPARAM(dwRet), GET_Y_LPARAM(dwRet) }; return point; } int CharFromPos(POINT pt, int* pLine = NULL) const { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, EM_CHARFROMPOS, 0, MAKELPARAM(pt.x, pt.y)); + ATLASSERT(::IsWindow(this->m_hWnd)); + DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, EM_CHARFROMPOS, 0, MAKELPARAM(pt.x, pt.y)); if(pLine != NULL) *pLine = (int)(short)HIWORD(dwRet); return (int)(short)LOWORD(dwRet); @@ -1284,168 +1221,160 @@ class CEditT : public TBase // NOTE: first word in lpszBuffer must contain the size of the buffer! int GetLine(int nIndex, LPTSTR lpszBuffer) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); } int GetLine(int nIndex, LPTSTR lpszBuffer, int nMaxLength) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); *(LPWORD)lpszBuffer = (WORD)nMaxLength; - return (int)::SendMessage(m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); + return (int)::SendMessage(this->m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); } TCHAR GetPasswordChar() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (TCHAR)::SendMessage(m_hWnd, EM_GETPASSWORDCHAR, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (TCHAR)::SendMessage(this->m_hWnd, EM_GETPASSWORDCHAR, 0, 0L); } void SetPasswordChar(TCHAR ch) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETPASSWORDCHAR, ch, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_SETPASSWORDCHAR, ch, 0L); } -#ifndef _WIN32_WCE EDITWORDBREAKPROC GetWordBreakProc() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (EDITWORDBREAKPROC)::SendMessage(m_hWnd, EM_GETWORDBREAKPROC, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (EDITWORDBREAKPROC)::SendMessage(this->m_hWnd, EM_GETWORDBREAKPROC, 0, 0L); } void SetWordBreakProc(EDITWORDBREAKPROC ewbprc) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETWORDBREAKPROC, 0, (LPARAM)ewbprc); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_SETWORDBREAKPROC, 0, (LPARAM)ewbprc); } -#endif // !_WIN32_WCE int GetFirstVisibleLine() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETFIRSTVISIBLELINE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, EM_GETFIRSTVISIBLELINE, 0, 0L); } -#ifndef _WIN32_WCE int GetThumb() const { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & ES_MULTILINE) != 0); - return (int)::SendMessage(m_hWnd, EM_GETTHUMB, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & ES_MULTILINE) != 0); + return (int)::SendMessage(this->m_hWnd, EM_GETTHUMB, 0, 0L); } -#endif // !_WIN32_WCE BOOL SetReadOnly(BOOL bReadOnly = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETREADONLY, bReadOnly, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETREADONLY, bReadOnly, 0L); } -#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) UINT GetImeStatus(UINT uStatus) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_GETIMESTATUS, uStatus, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UINT)::SendMessage(this->m_hWnd, EM_GETIMESTATUS, uStatus, 0L); } UINT SetImeStatus(UINT uStatus, UINT uData) { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_SETIMESTATUS, uStatus, uData); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UINT)::SendMessage(this->m_hWnd, EM_SETIMESTATUS, uStatus, uData); } -#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) -#if (_WIN32_WINNT >= 0x0501) BOOL GetCueBannerText(LPCWSTR lpstrText, int cchText) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_GETCUEBANNER, (WPARAM)lpstrText, cchText); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_GETCUEBANNER, (WPARAM)lpstrText, cchText); } // bKeepWithFocus - Vista only BOOL SetCueBannerText(LPCWSTR lpstrText, BOOL bKeepWithFocus = FALSE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETCUEBANNER, (WPARAM)bKeepWithFocus, (LPARAM)(lpstrText)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETCUEBANNER, (WPARAM)bKeepWithFocus, (LPARAM)(lpstrText)); } -#endif // (_WIN32_WINNT >= 0x0501) // Operations void EmptyUndoBuffer() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_EMPTYUNDOBUFFER, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_EMPTYUNDOBUFFER, 0, 0L); } BOOL FmtLines(BOOL bAddEOL) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_FMTLINES, bAddEOL, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_FMTLINES, bAddEOL, 0L); } void LimitText(int nChars = 0) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_LIMITTEXT, nChars, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_LIMITTEXT, nChars, 0L); } int LineFromChar(int nIndex = -1) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_LINEFROMCHAR, nIndex, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, EM_LINEFROMCHAR, nIndex, 0L); } int LineIndex(int nLine = -1) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_LINEINDEX, nLine, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, EM_LINEINDEX, nLine, 0L); } int LineLength(int nLine = -1) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_LINELENGTH, nLine, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, EM_LINELENGTH, nLine, 0L); } void LineScroll(int nLines, int nChars = 0) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_LINESCROLL, nChars, nLines); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_LINESCROLL, nChars, nLines); } void ReplaceSel(LPCTSTR lpszNewText, BOOL bCanUndo = FALSE) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_REPLACESEL, (WPARAM) bCanUndo, (LPARAM)lpszNewText); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_REPLACESEL, (WPARAM) bCanUndo, (LPARAM)lpszNewText); } void SetRect(LPCRECT lpRect) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETRECT, 0, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_SETRECT, 0, (LPARAM)lpRect); } void SetRectNP(LPCRECT lpRect) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETRECTNP, 0, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_SETRECTNP, 0, (LPARAM)lpRect); } void SetSel(DWORD dwSelection, BOOL bNoScroll = FALSE) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETSEL, LOWORD(dwSelection), HIWORD(dwSelection)); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_SETSEL, LOWORD(dwSelection), HIWORD(dwSelection)); if(!bNoScroll) - ::SendMessage(m_hWnd, EM_SCROLLCARET, 0, 0L); + ::SendMessage(this->m_hWnd, EM_SCROLLCARET, 0, 0L); } void SetSel(int nStartChar, int nEndChar, BOOL bNoScroll = FALSE) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETSEL, nStartChar, nEndChar); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_SETSEL, nStartChar, nEndChar); if(!bNoScroll) - ::SendMessage(m_hWnd, EM_SCROLLCARET, 0, 0L); + ::SendMessage(this->m_hWnd, EM_SCROLLCARET, 0, 0L); } void SetSelAll(BOOL bNoScroll = FALSE) @@ -1460,33 +1389,33 @@ class CEditT : public TBase BOOL SetTabStops(int nTabStops, LPINT rgTabStops) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, nTabStops, (LPARAM)rgTabStops); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETTABSTOPS, nTabStops, (LPARAM)rgTabStops); } BOOL SetTabStops() { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETTABSTOPS, 0, 0L); } BOOL SetTabStops(const int& cxEachStop) // takes an 'int' { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, 1, (LPARAM)(LPINT)&cxEachStop); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETTABSTOPS, 1, (LPARAM)(LPINT)&cxEachStop); } void ScrollCaret() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SCROLLCARET, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_SCROLLCARET, 0, 0L); } int Scroll(int nScrollAction) { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & ES_MULTILINE) != 0); - LRESULT lRet = ::SendMessage(m_hWnd, EM_SCROLL, nScrollAction, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & ES_MULTILINE) != 0); + LRESULT lRet = ::SendMessage(this->m_hWnd, EM_SCROLL, nScrollAction, 0L); if(!(BOOL)HIWORD(lRet)) return -1; // failed return (int)(short)LOWORD(lRet); @@ -1501,107 +1430,73 @@ class CEditT : public TBase void AppendText(LPCTSTR lpstrText, BOOL bNoScroll = FALSE, BOOL bCanUndo = FALSE) { - InsertText(GetWindowTextLength(), lpstrText, bNoScroll, bCanUndo); + InsertText(this->GetWindowTextLength(), lpstrText, bNoScroll, bCanUndo); } -#if (_WIN32_WINNT >= 0x0501) BOOL ShowBalloonTip(PEDITBALLOONTIP pEditBaloonTip) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SHOWBALLOONTIP, 0, (LPARAM)pEditBaloonTip); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_SHOWBALLOONTIP, 0, (LPARAM)pEditBaloonTip); } BOOL HideBalloonTip() { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_HIDEBALLOONTIP, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_HIDEBALLOONTIP, 0, 0L); } -#endif // (_WIN32_WINNT >= 0x0501) #if (_WIN32_WINNT >= 0x0600) DWORD GetHilite() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, EM_GETHILITE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, EM_GETHILITE, 0, 0L); } void GetHilite(int& nStartChar, int& nEndChar) const { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, EM_GETHILITE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, EM_GETHILITE, 0, 0L); nStartChar = (int)(short)LOWORD(dwRet); nEndChar = (int)(short)HIWORD(dwRet); } void SetHilite(int nStartChar, int nEndChar) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETHILITE, nStartChar, nEndChar); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_SETHILITE, nStartChar, nEndChar); } #endif // (_WIN32_WINNT >= 0x0600) // Clipboard operations BOOL Undo() { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_UNDO, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_UNDO, 0, 0L); } void Clear() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_CLEAR, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, WM_CLEAR, 0, 0L); } void Copy() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_COPY, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, WM_COPY, 0, 0L); } void Cut() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_CUT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, WM_CUT, 0, 0L); } void Paste() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_PASTE, 0, 0L); - } - -#ifdef WIN32_PLATFORM_WFSP // SmartPhone only messages - DWORD GetExtendedStyle() - { - return SendMessage(EM_GETEXTENDEDSTYLE); - } - - DWORD SetExtendedStyle(DWORD dwMask, DWORD dwExStyle) - { - return SendMessage(EM_SETEXTENDEDSTYLE, (WPARAM)dwMask, (LPARAM)dwExStyle); - } - - DWORD GetInputMode(BOOL bCurrentMode = TRUE) - { - return SendMessage(EM_GETINPUTMODE, 0, (LPARAM)bCurrentMode); - } - - BOOL SetInputMode(DWORD dwMode) - { - return SendMessage(EM_SETINPUTMODE, 0, (LPARAM)dwMode); - } - - BOOL SetSymbols(LPCTSTR szSymbols) - { - return SendMessage(EM_SETSYMBOLS, 0, (LPARAM)szSymbols); - } - - BOOL ResetSymbols() - { - return SendMessage(EM_SETSYMBOLS); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, WM_PASTE, 0, 0L); } -#endif // WIN32_PLATFORM_WFSP }; typedef CEditT CEdit; @@ -1717,7 +1612,7 @@ class CEditCommands BOOL HasSelection() const { const T* pT = static_cast(this); - int nMin, nMax; + int nMin = 0, nMax = 0; ::SendMessage(pT->m_hWnd, EM_GETSEL, (WPARAM)&nMin, (LPARAM)&nMax); return (nMin != nMax); } @@ -1743,7 +1638,7 @@ class CScrollBarT : public TBase CScrollBarT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -1760,83 +1655,70 @@ class CScrollBarT : public TBase return _T("SCROLLBAR"); } -#ifndef _WIN32_WCE int GetScrollPos() const { - ATLASSERT(::IsWindow(m_hWnd)); - return ::GetScrollPos(m_hWnd, SB_CTL); + ATLASSERT(::IsWindow(this->m_hWnd)); + return ::GetScrollPos(this->m_hWnd, SB_CTL); } -#endif // !_WIN32_WCE int SetScrollPos(int nPos, BOOL bRedraw = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return ::SetScrollPos(m_hWnd, SB_CTL, nPos, bRedraw); + ATLASSERT(::IsWindow(this->m_hWnd)); + return ::SetScrollPos(this->m_hWnd, SB_CTL, nPos, bRedraw); } -#ifndef _WIN32_WCE void GetScrollRange(LPINT lpMinPos, LPINT lpMaxPos) const { - ATLASSERT(::IsWindow(m_hWnd)); - ::GetScrollRange(m_hWnd, SB_CTL, lpMinPos, lpMaxPos); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::GetScrollRange(this->m_hWnd, SB_CTL, lpMinPos, lpMaxPos); } -#endif // !_WIN32_WCE void SetScrollRange(int nMinPos, int nMaxPos, BOOL bRedraw = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SetScrollRange(m_hWnd, SB_CTL, nMinPos, nMaxPos, bRedraw); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SetScrollRange(this->m_hWnd, SB_CTL, nMinPos, nMaxPos, bRedraw); } BOOL GetScrollInfo(LPSCROLLINFO lpScrollInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); - return ::GetScrollInfo(m_hWnd, SB_CTL, lpScrollInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + return ::GetScrollInfo(this->m_hWnd, SB_CTL, lpScrollInfo); } int SetScrollInfo(LPSCROLLINFO lpScrollInfo, BOOL bRedraw = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return ::SetScrollInfo(m_hWnd, SB_CTL, lpScrollInfo, bRedraw); + ATLASSERT(::IsWindow(this->m_hWnd)); + return ::SetScrollInfo(this->m_hWnd, SB_CTL, lpScrollInfo, bRedraw); } -#ifndef _WIN32_WCE int GetScrollLimit() const { - int nMin = 0, nMax = 0; - ::GetScrollRange(m_hWnd, SB_CTL, &nMin, &nMax); - SCROLLINFO info = { sizeof(SCROLLINFO), SIF_PAGE }; - if(::GetScrollInfo(m_hWnd, SB_CTL, &info)) - nMax -= ((info.nPage - 1) > 0) ? (info.nPage - 1) : 0; + SCROLLINFO info = { sizeof(SCROLLINFO), SIF_RANGE | SIF_PAGE }; + ::GetScrollInfo(this->m_hWnd, SB_CTL, &info); + if(info.nPage > 1) + info.nMax -= info.nPage - 1; - return nMax; + return info.nMax; } -#if (WINVER >= 0x0500) BOOL GetScrollBarInfo(PSCROLLBARINFO pScrollBarInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); -#if (_WIN32_WINNT >= 0x0501) - return (BOOL)::SendMessage(m_hWnd, SBM_GETSCROLLBARINFO, 0, (LPARAM)pScrollBarInfo); -#else // !(_WIN32_WINNT >= 0x0501) - return ::GetScrollBarInfo(m_hWnd, OBJID_CLIENT, pScrollBarInfo); -#endif // !(_WIN32_WINNT >= 0x0501) + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, SBM_GETSCROLLBARINFO, 0, (LPARAM)pScrollBarInfo); } -#endif // (WINVER >= 0x0500) // Operations void ShowScrollBar(BOOL bShow = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - ::ShowScrollBar(m_hWnd, SB_CTL, bShow); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::ShowScrollBar(this->m_hWnd, SB_CTL, bShow); } BOOL EnableScrollBar(UINT nArrowFlags = ESB_ENABLE_BOTH) { - ATLASSERT(::IsWindow(m_hWnd)); - return ::EnableScrollBar(m_hWnd, SB_CTL, nArrowFlags); + ATLASSERT(::IsWindow(this->m_hWnd)); + return ::EnableScrollBar(this->m_hWnd, SB_CTL, nArrowFlags); } -#endif // !_WIN32_WCE }; typedef CScrollBarT CScrollBar; @@ -1847,28 +1729,39 @@ typedef CScrollBarT CScrollBar; /////////////////////////////////////////////////////////////////////////////// // CImageList -class CImageList +// forward declarations +template class CImageListT; +typedef CImageListT CImageList; +typedef CImageListT CImageListManaged; + + +template +class CImageListT { public: +// Data members HIMAGELIST m_hImageList; -// Constructor - CImageList(HIMAGELIST hImageList = NULL) : m_hImageList(hImageList) +// Constructor/destructor/operators + CImageListT(HIMAGELIST hImageList = NULL) : m_hImageList(hImageList) { } -// Operators, etc. - CImageList& operator =(HIMAGELIST hImageList) + ~CImageListT() { - m_hImageList = hImageList; - return *this; + if(t_bManaged && (m_hImageList != NULL)) + Destroy(); } - operator HIMAGELIST() const { return m_hImageList; } + CImageListT& operator =(HIMAGELIST hImageList) + { + Attach(hImageList); + return *this; + } void Attach(HIMAGELIST hImageList) { - ATLASSERT(m_hImageList == NULL); - ATLASSERT(hImageList != NULL); + if(t_bManaged && (m_hImageList != NULL) && (m_hImageList != hImageList)) + ImageList_Destroy(m_hImageList); m_hImageList = hImageList; } @@ -1879,6 +1772,8 @@ class CImageList return hImageList; } + operator HIMAGELIST() const { return m_hImageList; } + bool IsNull() const { return (m_hImageList == NULL); } // Attributes @@ -1977,7 +1872,6 @@ class CImageList return (m_hImageList != NULL) ? TRUE : FALSE; } -#ifndef _WIN32_WCE #ifdef __IStream_INTERFACE_DEFINED__ BOOL CreateFromStream(LPSTREAM lpStream) { @@ -1986,7 +1880,6 @@ class CImageList return (m_hImageList != NULL) ? TRUE : FALSE; } #endif // __IStream_INTERFACE_DEFINED__ -#endif // !_WIN32_WCE BOOL Destroy() { @@ -2086,7 +1979,6 @@ class CImageList } #ifdef __IStream_INTERFACE_DEFINED__ -#ifndef _WIN32_WCE static HIMAGELIST Read(LPSTREAM lpStream) { return ImageList_Read(lpStream); @@ -2097,9 +1989,7 @@ class CImageList ATLASSERT(m_hImageList != NULL); return ImageList_Write(m_hImageList, lpStream); } -#endif // !_WIN32_WCE -#if (_WIN32_WINNT >= 0x0501) static HRESULT ReadEx(DWORD dwFlags, LPSTREAM lpStream, REFIID riid, PVOID* ppv) { return ImageList_ReadEx(dwFlags, lpStream, riid, ppv); @@ -2110,7 +2000,6 @@ class CImageList ATLASSERT(m_hImageList != NULL); return ImageList_WriteEx(m_hImageList, dwFlags, lpStream); } -#endif // (_WIN32_WINNT >= 0x0501) #endif // __IStream_INTERFACE_DEFINED__ // Drag operations @@ -2178,7 +2067,6 @@ class CImageList return ImageList_DragLeave(hWnd); } -#if (_WIN32_IE >= 0x0400) CImageList Duplicate() const { ATLASSERT(m_hImageList != NULL); @@ -2190,19 +2078,16 @@ class CImageList ATLASSERT(hImageList != NULL); return CImageList(ImageList_Duplicate(hImageList)); } -#endif // (_WIN32_IE >= 0x0400) }; /////////////////////////////////////////////////////////////////////////////// // CToolTipCtrl -#ifndef _WIN32_WCE - class CToolInfo : public TOOLINFO { public: - CToolInfo(UINT nFlags, HWND hWnd, UINT nIDTool = 0, LPRECT lpRect = NULL, LPTSTR lpstrText = LPSTR_TEXTCALLBACK, LPARAM lUserParam = NULL) + CToolInfo(UINT nFlags, HWND hWnd, UINT_PTR nIDTool = 0, LPRECT lpRect = NULL, LPTSTR lpstrText = LPSTR_TEXTCALLBACK, LPARAM lUserParam = NULL) { Init(nFlags, hWnd, nIDTool, lpRect, lpstrText, lUserParam); } @@ -2211,11 +2096,11 @@ class CToolInfo : public TOOLINFO operator LPARAM() { return (LPARAM)this; } - void Init(UINT nFlags, HWND hWnd, UINT nIDTool = 0, LPRECT lpRect = NULL, LPTSTR lpstrText = LPSTR_TEXTCALLBACK, LPARAM lUserParam = NULL) + void Init(UINT nFlags, HWND hWnd, UINT_PTR nIDTool = 0, LPRECT lpRect = NULL, LPTSTR lpstrText = LPSTR_TEXTCALLBACK, LPARAM lUserParam = NULL) { ATLASSERT(::IsWindow(hWnd)); memset(this, 0, sizeof(TOOLINFO)); - cbSize = sizeof(TOOLINFO); + cbSize = RunTimeHelper::SizeOf_TOOLINFO(); uFlags = nFlags; if(nIDTool == 0) { @@ -2246,7 +2131,7 @@ class CToolTipCtrlT : public TBase CToolTipCtrlT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -2265,32 +2150,32 @@ class CToolTipCtrlT : public TBase void GetText(LPTOOLINFO lpToolInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_GETTEXT, 0, (LPARAM)&lpToolInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TTM_GETTEXT, 0, (LPARAM)&lpToolInfo); } - void GetText(LPTSTR lpstrText, HWND hWnd, UINT nIDTool = 0) const + void GetText(LPTSTR lpstrText, HWND hWnd, UINT_PTR nIDTool = 0) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(hWnd != NULL); CToolInfo ti(0, hWnd, nIDTool, NULL, lpstrText); - ::SendMessage(m_hWnd, TTM_GETTEXT, 0, ti); + ::SendMessage(this->m_hWnd, TTM_GETTEXT, 0, ti); } BOOL GetToolInfo(LPTOOLINFO lpToolInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TTM_GETTOOLINFO, 0, (LPARAM)lpToolInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TTM_GETTOOLINFO, 0, (LPARAM)lpToolInfo); } - BOOL GetToolInfo(HWND hWnd, UINT nIDTool, UINT* puFlags, LPRECT lpRect, LPTSTR lpstrText) const + BOOL GetToolInfo(HWND hWnd, UINT_PTR nIDTool, UINT* puFlags, LPRECT lpRect, LPTSTR lpstrText) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(hWnd != NULL); ATLASSERT(puFlags != NULL); ATLASSERT(lpRect != NULL); CToolInfo ti(0, hWnd, nIDTool, NULL, lpstrText); - BOOL bRet = (BOOL)::SendMessage(m_hWnd, TTM_GETTOOLINFO, 0, ti); + BOOL bRet = (BOOL)::SendMessage(this->m_hWnd, TTM_GETTOOLINFO, 0, ti); if(bRet != FALSE) { *puFlags = ti.uFlags; @@ -2301,185 +2186,188 @@ class CToolTipCtrlT : public TBase void SetToolInfo(LPTOOLINFO lpToolInfo) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_SETTOOLINFO, 0, (LPARAM)lpToolInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TTM_SETTOOLINFO, 0, (LPARAM)lpToolInfo); } void SetToolRect(LPTOOLINFO lpToolInfo) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_NEWTOOLRECT, 0, (LPARAM)lpToolInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TTM_NEWTOOLRECT, 0, (LPARAM)lpToolInfo); } - void SetToolRect(HWND hWnd, UINT nIDTool, LPCRECT lpRect) + void SetToolRect(HWND hWnd, UINT_PTR nIDTool, LPCRECT lpRect) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(hWnd != NULL); ATLASSERT(nIDTool != 0); CToolInfo ti(0, hWnd, nIDTool, (LPRECT)lpRect, NULL); - ::SendMessage(m_hWnd, TTM_NEWTOOLRECT, 0, ti); + ::SendMessage(this->m_hWnd, TTM_NEWTOOLRECT, 0, ti); } int GetToolCount() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TTM_GETTOOLCOUNT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TTM_GETTOOLCOUNT, 0, 0L); } int GetDelayTime(DWORD dwType) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TTM_GETDELAYTIME, dwType, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TTM_GETDELAYTIME, dwType, 0L); } void SetDelayTime(DWORD dwType, int nTime) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_SETDELAYTIME, dwType, MAKELPARAM(nTime, 0)); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TTM_SETDELAYTIME, dwType, MAKELPARAM(nTime, 0)); } void GetMargin(LPRECT lpRect) const { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_GETMARGIN, 0, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TTM_GETMARGIN, 0, (LPARAM)lpRect); } void SetMargin(LPRECT lpRect) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_SETMARGIN, 0, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TTM_SETMARGIN, 0, (LPARAM)lpRect); } int GetMaxTipWidth() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TTM_GETMAXTIPWIDTH, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TTM_GETMAXTIPWIDTH, 0, 0L); } int SetMaxTipWidth(int nWidth) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TTM_SETMAXTIPWIDTH, 0, nWidth); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TTM_SETMAXTIPWIDTH, 0, nWidth); } COLORREF GetTipBkColor() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TTM_GETTIPBKCOLOR, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, TTM_GETTIPBKCOLOR, 0, 0L); } void SetTipBkColor(COLORREF clr) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_SETTIPBKCOLOR, (WPARAM)clr, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TTM_SETTIPBKCOLOR, (WPARAM)clr, 0L); } COLORREF GetTipTextColor() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TTM_GETTIPTEXTCOLOR, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, TTM_GETTIPTEXTCOLOR, 0, 0L); } void SetTipTextColor(COLORREF clr) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_SETTIPTEXTCOLOR, (WPARAM)clr, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TTM_SETTIPTEXTCOLOR, (WPARAM)clr, 0L); } BOOL GetCurrentTool(LPTOOLINFO lpToolInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TTM_GETCURRENTTOOL, 0, (LPARAM)lpToolInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TTM_GETCURRENTTOOL, 0, (LPARAM)lpToolInfo); } -#if (_WIN32_IE >= 0x0500) SIZE GetBubbleSize(LPTOOLINFO lpToolInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, TTM_GETBUBBLESIZE, 0, (LPARAM)lpToolInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, TTM_GETBUBBLESIZE, 0, (LPARAM)lpToolInfo); SIZE size = { GET_X_LPARAM(dwRet), GET_Y_LPARAM(dwRet) }; return size; } - BOOL SetTitle(UINT uIcon, LPCTSTR lpstrTitle) + BOOL SetTitle(UINT_PTR uIcon, LPCTSTR lpstrTitle) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TTM_SETTITLE, uIcon, (LPARAM)lpstrTitle); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TTM_SETTITLE, uIcon, (LPARAM)lpstrTitle); + } + + + BOOL SetTitle(HICON hIcon, LPCTSTR lpstrTitle) + { + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TTM_SETTITLE, (WPARAM)hIcon, (LPARAM)lpstrTitle); } -#endif // (_WIN32_IE >= 0x0500) -#if (_WIN32_WINNT >= 0x0501) void GetTitle(PTTGETTITLE pTTGetTitle) const { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_GETTITLE, 0, (LPARAM)pTTGetTitle); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TTM_GETTITLE, 0, (LPARAM)pTTGetTitle); } void SetWindowTheme(LPCWSTR lpstrTheme) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TTM_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme); } -#endif // (_WIN32_WINNT >= 0x0501) // Operations void Activate(BOOL bActivate) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_ACTIVATE, bActivate, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TTM_ACTIVATE, bActivate, 0L); } BOOL AddTool(LPTOOLINFO lpToolInfo) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TTM_ADDTOOL, 0, (LPARAM)lpToolInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TTM_ADDTOOL, 0, (LPARAM)lpToolInfo); } - BOOL AddTool(HWND hWnd, ATL::_U_STRINGorID text = LPSTR_TEXTCALLBACK, LPCRECT lpRectTool = NULL, UINT nIDTool = 0) + BOOL AddTool(HWND hWnd, ATL::_U_STRINGorID text = LPSTR_TEXTCALLBACK, LPCRECT lpRectTool = NULL, UINT_PTR nIDTool = 0) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(hWnd != NULL); // the toolrect and toolid must both be zero or both valid - ATLASSERT((lpRectTool != NULL && nIDTool != 0) || (lpRectTool == NULL && nIDTool == 0)); + ATLASSERT(((lpRectTool != NULL) && (nIDTool != 0)) || ((lpRectTool == NULL) && (nIDTool == 0))); CToolInfo ti(0, hWnd, nIDTool, (LPRECT)lpRectTool, (LPTSTR)text.m_lpstr); - return (BOOL)::SendMessage(m_hWnd, TTM_ADDTOOL, 0, ti); + return (BOOL)::SendMessage(this->m_hWnd, TTM_ADDTOOL, 0, ti); } void DelTool(LPTOOLINFO lpToolInfo) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_DELTOOL, 0, (LPARAM)lpToolInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TTM_DELTOOL, 0, (LPARAM)lpToolInfo); } - void DelTool(HWND hWnd, UINT nIDTool = 0) + void DelTool(HWND hWnd, UINT_PTR nIDTool = 0) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(hWnd != NULL); CToolInfo ti(0, hWnd, nIDTool, NULL, NULL); - ::SendMessage(m_hWnd, TTM_DELTOOL, 0, ti); + ::SendMessage(this->m_hWnd, TTM_DELTOOL, 0, ti); } BOOL HitTest(LPTTHITTESTINFO lpHitTestInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TTM_HITTEST, 0, (LPARAM)lpHitTestInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TTM_HITTEST, 0, (LPARAM)lpHitTestInfo); } BOOL HitTest(HWND hWnd, POINT pt, LPTOOLINFO lpToolInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(hWnd != NULL); ATLASSERT(lpToolInfo != NULL); TTHITTESTINFO hti = { 0 }; - hti.ti.cbSize = sizeof(TOOLINFO); + hti.ti.cbSize = RunTimeHelper::SizeOf_TOOLINFO(); hti.hwnd = hWnd; hti.pt.x = pt.x; hti.pt.y = pt.y; - if((BOOL)::SendMessage(m_hWnd, TTM_HITTEST, 0, (LPARAM)&hti) != FALSE) + if((BOOL)::SendMessage(this->m_hWnd, TTM_HITTEST, 0, (LPARAM)&hti) != FALSE) { *lpToolInfo = hti.ti; return TRUE; @@ -2489,78 +2377,79 @@ class CToolTipCtrlT : public TBase void RelayEvent(LPMSG lpMsg) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_RELAYEVENT, 0, (LPARAM)lpMsg); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TTM_RELAYEVENT, 0, (LPARAM)lpMsg); } void UpdateTipText(LPTOOLINFO lpToolInfo) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_UPDATETIPTEXT, 0, (LPARAM)lpToolInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TTM_UPDATETIPTEXT, 0, (LPARAM)lpToolInfo); } - void UpdateTipText(ATL::_U_STRINGorID text, HWND hWnd, UINT nIDTool = 0) + void UpdateTipText(ATL::_U_STRINGorID text, HWND hWnd, UINT_PTR nIDTool = 0) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(hWnd != NULL); CToolInfo ti(0, hWnd, nIDTool, NULL, (LPTSTR)text.m_lpstr); - ::SendMessage(m_hWnd, TTM_UPDATETIPTEXT, 0, ti); + ::SendMessage(this->m_hWnd, TTM_UPDATETIPTEXT, 0, ti); } - BOOL EnumTools(UINT nTool, LPTOOLINFO lpToolInfo) const + BOOL EnumTools(UINT_PTR nTool, LPTOOLINFO lpToolInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TTM_ENUMTOOLS, nTool, (LPARAM)lpToolInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TTM_ENUMTOOLS, nTool, (LPARAM)lpToolInfo); } void Pop() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_POP, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TTM_POP, 0, 0L); } void TrackActivate(LPTOOLINFO lpToolInfo, BOOL bActivate) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_TRACKACTIVATE, bActivate, (LPARAM)lpToolInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TTM_TRACKACTIVATE, bActivate, (LPARAM)lpToolInfo); + } + + void TrackActivate(HWND hWnd, UINT_PTR nIDTool, BOOL bActivate) + { + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT(hWnd != NULL); + + CToolInfo ti(0, hWnd, nIDTool); + ::SendMessage(this->m_hWnd, TTM_TRACKACTIVATE, bActivate, ti); } void TrackPosition(int xPos, int yPos) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_TRACKPOSITION, 0, MAKELPARAM(xPos, yPos)); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TTM_TRACKPOSITION, 0, MAKELPARAM(xPos, yPos)); } -#if (_WIN32_IE >= 0x0400) void Update() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_UPDATE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TTM_UPDATE, 0, 0L); } -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0500) BOOL AdjustRect(LPRECT lpRect, BOOL bLarger /*= TRUE*/) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TTM_ADJUSTRECT, bLarger, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TTM_ADJUSTRECT, bLarger, (LPARAM)lpRect); } -#endif // (_WIN32_IE >= 0x0500) -#if (_WIN32_WINNT >= 0x0501) void Popup() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TTM_POPUP, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TTM_POPUP, 0, 0L); } -#endif // (_WIN32_WINNT >= 0x0501) }; typedef CToolTipCtrlT CToolTipCtrl; -#endif // !_WIN32_WCE - /////////////////////////////////////////////////////////////////////////////// // CHeaderCtrl @@ -2575,7 +2464,7 @@ class CHeaderCtrlT : public TBase CHeaderCtrlT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -2594,123 +2483,119 @@ class CHeaderCtrlT : public TBase int GetItemCount() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_GETITEMCOUNT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, HDM_GETITEMCOUNT, 0, 0L); } BOOL GetItem(int nIndex, LPHDITEM pHeaderItem) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_GETITEM, nIndex, (LPARAM)pHeaderItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, HDM_GETITEM, nIndex, (LPARAM)pHeaderItem); } BOOL SetItem(int nIndex, LPHDITEM pHeaderItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_SETITEM, nIndex, (LPARAM)pHeaderItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, HDM_SETITEM, nIndex, (LPARAM)pHeaderItem); } CImageList GetImageList() const { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, HDM_GETIMAGELIST, 0, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, HDM_GETIMAGELIST, 0, 0L)); } CImageList SetImageList(HIMAGELIST hImageList) { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, HDM_SETIMAGELIST, 0, (LPARAM)hImageList)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, HDM_SETIMAGELIST, 0, (LPARAM)hImageList)); } BOOL GetOrderArray(int nSize, int* lpnArray) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_GETORDERARRAY, nSize, (LPARAM)lpnArray); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, HDM_GETORDERARRAY, nSize, (LPARAM)lpnArray); } BOOL SetOrderArray(int nSize, int* lpnArray) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_SETORDERARRAY, nSize, (LPARAM)lpnArray); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, HDM_SETORDERARRAY, nSize, (LPARAM)lpnArray); } BOOL GetItemRect(int nIndex, LPRECT lpItemRect) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_GETITEMRECT, nIndex, (LPARAM)lpItemRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, HDM_GETITEMRECT, nIndex, (LPARAM)lpItemRect); } int SetHotDivider(BOOL bPos, DWORD dwInputValue) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_SETHOTDIVIDER, bPos, dwInputValue); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, HDM_SETHOTDIVIDER, bPos, dwInputValue); } -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) BOOL GetUnicodeFormat() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_GETUNICODEFORMAT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, HDM_GETUNICODEFORMAT, 0, 0L); } BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_SETUNICODEFORMAT, bUnicode, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, HDM_SETUNICODEFORMAT, bUnicode, 0L); } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) int GetBitmapMargin() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_GETBITMAPMARGIN, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, HDM_GETBITMAPMARGIN, 0, 0L); } int SetBitmapMargin(int nWidth) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_SETBITMAPMARGIN, nWidth, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, HDM_SETBITMAPMARGIN, nWidth, 0L); } int SetFilterChangeTimeout(DWORD dwTimeOut) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_SETFILTERCHANGETIMEOUT, 0, dwTimeOut); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, HDM_SETFILTERCHANGETIMEOUT, 0, dwTimeOut); } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) #if (_WIN32_WINNT >= 0x0600) BOOL GetItemDropDownRect(int nIndex, LPRECT lpRect) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_GETITEMDROPDOWNRECT, nIndex, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, HDM_GETITEMDROPDOWNRECT, nIndex, (LPARAM)lpRect); } BOOL GetOverflowRect(LPRECT lpRect) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_GETOVERFLOWRECT, 0, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, HDM_GETOVERFLOWRECT, 0, (LPARAM)lpRect); } int GetFocusedItem() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_GETFOCUSEDITEM, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, HDM_GETFOCUSEDITEM, 0, 0L); } BOOL SetFocusedItem(int nIndex) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_SETFOCUSEDITEM, 0, nIndex); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, HDM_SETFOCUSEDITEM, 0, nIndex); } #endif // (_WIN32_WINNT >= 0x0600) // Operations int InsertItem(int nIndex, LPHDITEM phdi) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_INSERTITEM, nIndex, (LPARAM)phdi); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, HDM_INSERTITEM, nIndex, (LPARAM)phdi); } int AddItem(LPHDITEM phdi) @@ -2720,53 +2605,51 @@ class CHeaderCtrlT : public TBase BOOL DeleteItem(int nIndex) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_DELETEITEM, nIndex, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, HDM_DELETEITEM, nIndex, 0L); } BOOL Layout(HD_LAYOUT* pHeaderLayout) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, HDM_LAYOUT, 0, (LPARAM)pHeaderLayout); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, HDM_LAYOUT, 0, (LPARAM)pHeaderLayout); } int HitTest(LPHDHITTESTINFO lpHitTestInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_HITTEST, 0, (LPARAM)lpHitTestInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, HDM_HITTEST, 0, (LPARAM)lpHitTestInfo); } int OrderToIndex(int nOrder) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_ORDERTOINDEX, nOrder, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, HDM_ORDERTOINDEX, nOrder, 0L); } CImageList CreateDragImage(int nIndex) { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, HDM_CREATEDRAGIMAGE, nIndex, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, HDM_CREATEDRAGIMAGE, nIndex, 0L)); } -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) int EditFilter(int nColumn, BOOL bDiscardChanges) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_EDITFILTER, nColumn, MAKELPARAM(bDiscardChanges, 0)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, HDM_EDITFILTER, nColumn, MAKELPARAM(bDiscardChanges, 0)); } int ClearFilter(int nColumn) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_CLEARFILTER, nColumn, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, HDM_CLEARFILTER, nColumn, 0L); } int ClearAllFilters() { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, HDM_CLEARFILTER, (WPARAM)-1, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, HDM_CLEARFILTER, (WPARAM)-1, 0L); } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) }; typedef CHeaderCtrlT CHeaderCtrl; @@ -2785,7 +2668,7 @@ class CListViewCtrlT : public TBase CListViewCtrlT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -2804,56 +2687,56 @@ class CListViewCtrlT : public TBase COLORREF GetBkColor() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, LVM_GETBKCOLOR, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, LVM_GETBKCOLOR, 0, 0L); } BOOL SetBkColor(COLORREF cr) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETBKCOLOR, 0, cr); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SETBKCOLOR, 0, cr); } CImageList GetImageList(int nImageListType) const { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, LVM_GETIMAGELIST, nImageListType, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, LVM_GETIMAGELIST, nImageListType, 0L)); } CImageList SetImageList(HIMAGELIST hImageList, int nImageList) { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, LVM_SETIMAGELIST, nImageList, (LPARAM)hImageList)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, LVM_SETIMAGELIST, nImageList, (LPARAM)hImageList)); } int GetItemCount() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETITEMCOUNT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_GETITEMCOUNT, 0, 0L); } BOOL SetItemCount(int nItems) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMCOUNT, nItems, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SETITEMCOUNT, nItems, 0L); } BOOL GetItem(LPLVITEM pItem) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETITEM, 0, (LPARAM)pItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_GETITEM, 0, (LPARAM)pItem); } BOOL SetItem(const LVITEM* pItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEM, 0, (LPARAM)pItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SETITEM, 0, (LPARAM)pItem); } BOOL SetItem(int nItem, int nSubItem, UINT nMask, LPCTSTR lpszItem, int nImage, UINT nState, UINT nStateMask, LPARAM lParam) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); LVITEM lvi = { 0 }; lvi.mask = nMask; lvi.iItem = nItem; @@ -2863,35 +2746,34 @@ class CListViewCtrlT : public TBase lvi.pszText = (LPTSTR) lpszItem; lvi.iImage = nImage; lvi.lParam = lParam; - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEM, 0, (LPARAM)&lvi); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SETITEM, 0, (LPARAM)&lvi); } UINT GetItemState(int nItem, UINT nMask) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, LVM_GETITEMSTATE, nItem, nMask); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UINT)::SendMessage(this->m_hWnd, LVM_GETITEMSTATE, nItem, nMask); } BOOL SetItemState(int nItem, UINT nState, UINT nStateMask) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); LVITEM lvi = { 0 }; lvi.state = nState; lvi.stateMask = nStateMask; - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMSTATE, nItem, (LPARAM)&lvi); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SETITEMSTATE, nItem, (LPARAM)&lvi); } BOOL SetItemState(int nItem, LPLVITEM pItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMSTATE, nItem, (LPARAM)pItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SETITEMSTATE, nItem, (LPARAM)pItem); } -#ifndef _ATL_NO_COM BOOL GetItemText(int nItem, int nSubItem, BSTR& bstrText) const { USES_CONVERSION; - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(bstrText == NULL); LVITEM lvi = { 0 }; lvi.iSubItem = nSubItem; @@ -2906,7 +2788,7 @@ class CListViewCtrlT : public TBase lpstrText[0] = NULL; lvi.cchTextMax = nLen; lvi.pszText = lpstrText; - nRes = (int)::SendMessage(m_hWnd, LVM_GETITEMTEXT, (WPARAM)nItem, (LPARAM)&lvi); + nRes = (int)::SendMessage(this->m_hWnd, LVM_GETITEMTEXT, (WPARAM)nItem, (LPARAM)&lvi); if(nRes < nLen - 1) break; delete [] lpstrText; @@ -2922,12 +2804,11 @@ class CListViewCtrlT : public TBase return (bstrText != NULL) ? TRUE : FALSE; } -#endif // !_ATL_NO_COM -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - int GetItemText(int nItem, int nSubItem, _CSTRING_NS::CString& strText) const +#ifdef __ATLSTR_H__ + int GetItemText(int nItem, int nSubItem, ATL::CString& strText) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); LVITEM lvi = { 0 }; lvi.iSubItem = nSubItem; @@ -2942,297 +2823,287 @@ class CListViewCtrlT : public TBase nRes = 0; break; } - nRes = (int)::SendMessage(m_hWnd, LVM_GETITEMTEXT, (WPARAM)nItem, (LPARAM)&lvi); + nRes = (int)::SendMessage(this->m_hWnd, LVM_GETITEMTEXT, (WPARAM)nItem, (LPARAM)&lvi); if(nRes < nLen - 1) break; } strText.ReleaseBuffer(); return nRes; } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) +#endif // __ATLSTR_H__ int GetItemText(int nItem, int nSubItem, LPTSTR lpszText, int nLen) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); LVITEM lvi = { 0 }; lvi.iSubItem = nSubItem; lvi.cchTextMax = nLen; lvi.pszText = lpszText; - return (int)::SendMessage(m_hWnd, LVM_GETITEMTEXT, (WPARAM)nItem, (LPARAM)&lvi); + return (int)::SendMessage(this->m_hWnd, LVM_GETITEMTEXT, (WPARAM)nItem, (LPARAM)&lvi); } BOOL SetItemText(int nItem, int nSubItem, LPCTSTR lpszText) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); return SetItem(nItem, nSubItem, LVIF_TEXT, lpszText, 0, 0, 0, 0); } DWORD_PTR GetItemData(int nItem) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); LVITEM lvi = { 0 }; lvi.iItem = nItem; lvi.mask = LVIF_PARAM; - BOOL bRet = (BOOL)::SendMessage(m_hWnd, LVM_GETITEM, 0, (LPARAM)&lvi); + BOOL bRet = (BOOL)::SendMessage(this->m_hWnd, LVM_GETITEM, 0, (LPARAM)&lvi); return (DWORD_PTR)(bRet ? lvi.lParam : NULL); } BOOL SetItemData(int nItem, DWORD_PTR dwData) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); return SetItem(nItem, 0, LVIF_PARAM, NULL, 0, 0, 0, (LPARAM)dwData); } UINT GetCallbackMask() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, LVM_GETCALLBACKMASK, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UINT)::SendMessage(this->m_hWnd, LVM_GETCALLBACKMASK, 0, 0L); } BOOL SetCallbackMask(UINT nMask) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETCALLBACKMASK, nMask, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SETCALLBACKMASK, nMask, 0L); } BOOL GetItemPosition(int nItem, LPPOINT lpPoint) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETITEMPOSITION, nItem, (LPARAM)lpPoint); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_GETITEMPOSITION, nItem, (LPARAM)lpPoint); } BOOL SetItemPosition(int nItem, POINT pt) { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(((GetStyle() & LVS_TYPEMASK) == LVS_ICON) || ((GetStyle() & LVS_TYPEMASK) == LVS_SMALLICON)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMPOSITION32, nItem, (LPARAM)&pt); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT(((this->GetStyle() & LVS_TYPEMASK) == LVS_ICON) || ((this->GetStyle() & LVS_TYPEMASK) == LVS_SMALLICON)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SETITEMPOSITION32, nItem, (LPARAM)&pt); } BOOL SetItemPosition(int nItem, int x, int y) { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(((GetStyle() & LVS_TYPEMASK) == LVS_ICON) || ((GetStyle() & LVS_TYPEMASK) == LVS_SMALLICON)); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT(((this->GetStyle() & LVS_TYPEMASK) == LVS_ICON) || ((this->GetStyle() & LVS_TYPEMASK) == LVS_SMALLICON)); POINT pt = { x, y }; - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMPOSITION32, nItem, (LPARAM)&pt); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SETITEMPOSITION32, nItem, (LPARAM)&pt); } int GetStringWidth(LPCTSTR lpsz) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETSTRINGWIDTH, 0, (LPARAM)lpsz); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_GETSTRINGWIDTH, 0, (LPARAM)lpsz); } CEdit GetEditControl() const { - ATLASSERT(::IsWindow(m_hWnd)); - return CEdit((HWND)::SendMessage(m_hWnd, LVM_GETEDITCONTROL, 0, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CEdit((HWND)::SendMessage(this->m_hWnd, LVM_GETEDITCONTROL, 0, 0L)); } BOOL GetColumn(int nCol, LVCOLUMN* pColumn) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETCOLUMN, nCol, (LPARAM)pColumn); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_GETCOLUMN, nCol, (LPARAM)pColumn); } BOOL SetColumn(int nCol, const LVCOLUMN* pColumn) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETCOLUMN, nCol, (LPARAM)pColumn); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SETCOLUMN, nCol, (LPARAM)pColumn); } int GetColumnWidth(int nCol) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETCOLUMNWIDTH, nCol, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_GETCOLUMNWIDTH, nCol, 0L); } BOOL SetColumnWidth(int nCol, int cx) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETCOLUMNWIDTH, nCol, MAKELPARAM(cx, 0)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SETCOLUMNWIDTH, nCol, MAKELPARAM(cx, 0)); } BOOL GetViewRect(LPRECT lpRect) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETVIEWRECT, 0, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_GETVIEWRECT, 0, (LPARAM)lpRect); } COLORREF GetTextColor() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, LVM_GETTEXTCOLOR, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, LVM_GETTEXTCOLOR, 0, 0L); } BOOL SetTextColor(COLORREF cr) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETTEXTCOLOR, 0, cr); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SETTEXTCOLOR, 0, cr); } COLORREF GetTextBkColor() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, LVM_GETTEXTBKCOLOR, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, LVM_GETTEXTBKCOLOR, 0, 0L); } BOOL SetTextBkColor(COLORREF cr) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETTEXTBKCOLOR, 0, cr); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SETTEXTBKCOLOR, 0, cr); } int GetTopIndex() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETTOPINDEX, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_GETTOPINDEX, 0, 0L); } int GetCountPerPage() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETCOUNTPERPAGE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_GETCOUNTPERPAGE, 0, 0L); } BOOL GetOrigin(LPPOINT lpPoint) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETORIGIN, 0, (LPARAM)lpPoint); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_GETORIGIN, 0, (LPARAM)lpPoint); } UINT GetSelectedCount() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, LVM_GETSELECTEDCOUNT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UINT)::SendMessage(this->m_hWnd, LVM_GETSELECTEDCOUNT, 0, 0L); } BOOL GetItemRect(int nItem, LPRECT lpRect, UINT nCode) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); lpRect->left = nCode; - return (BOOL)::SendMessage(m_hWnd, LVM_GETITEMRECT, (WPARAM)nItem, (LPARAM)lpRect); + return (BOOL)::SendMessage(this->m_hWnd, LVM_GETITEMRECT, (WPARAM)nItem, (LPARAM)lpRect); } -#ifndef _WIN32_WCE HCURSOR GetHotCursor() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (HCURSOR)::SendMessage(m_hWnd, LVM_GETHOTCURSOR, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HCURSOR)::SendMessage(this->m_hWnd, LVM_GETHOTCURSOR, 0, 0L); } HCURSOR SetHotCursor(HCURSOR hHotCursor) { - ATLASSERT(::IsWindow(m_hWnd)); - return (HCURSOR)::SendMessage(m_hWnd, LVM_SETHOTCURSOR, 0, (LPARAM)hHotCursor); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HCURSOR)::SendMessage(this->m_hWnd, LVM_SETHOTCURSOR, 0, (LPARAM)hHotCursor); } int GetHotItem() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETHOTITEM, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_GETHOTITEM, 0, 0L); } int SetHotItem(int nIndex) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_SETHOTITEM, nIndex, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_SETHOTITEM, nIndex, 0L); } -#endif // !_WIN32_WCE BOOL GetColumnOrderArray(int nCount, int* lpnArray) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETCOLUMNORDERARRAY, nCount, (LPARAM)lpnArray); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_GETCOLUMNORDERARRAY, nCount, (LPARAM)lpnArray); } BOOL SetColumnOrderArray(int nCount, int* lpnArray) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETCOLUMNORDERARRAY, nCount, (LPARAM)lpnArray); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SETCOLUMNORDERARRAY, nCount, (LPARAM)lpnArray); } CHeaderCtrl GetHeader() const { - ATLASSERT(::IsWindow(m_hWnd)); - return CHeaderCtrl((HWND)::SendMessage(m_hWnd, LVM_GETHEADER, 0, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CHeaderCtrl((HWND)::SendMessage(this->m_hWnd, LVM_GETHEADER, 0, 0L)); } BOOL GetSubItemRect(int nItem, int nSubItem, int nFlag, LPRECT lpRect) const { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & LVS_TYPEMASK) == LVS_REPORT); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & LVS_TYPEMASK) == LVS_REPORT); ATLASSERT(lpRect != NULL); lpRect->top = nSubItem; lpRect->left = nFlag; - return (BOOL)::SendMessage(m_hWnd, LVM_GETSUBITEMRECT, nItem, (LPARAM)lpRect); + return (BOOL)::SendMessage(this->m_hWnd, LVM_GETSUBITEMRECT, nItem, (LPARAM)lpRect); } DWORD SetIconSpacing(int cx, int cy) { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & LVS_TYPEMASK) == LVS_ICON); - return (DWORD)::SendMessage(m_hWnd, LVM_SETICONSPACING, 0, MAKELPARAM(cx, cy)); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & LVS_TYPEMASK) == LVS_ICON); + return (DWORD)::SendMessage(this->m_hWnd, LVM_SETICONSPACING, 0, MAKELPARAM(cx, cy)); } int GetISearchString(LPTSTR lpstr) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETISEARCHSTRING, 0, (LPARAM)lpstr); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_GETISEARCHSTRING, 0, (LPARAM)lpstr); } void GetItemSpacing(SIZE& sizeSpacing, BOOL bSmallIconView = FALSE) const { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, LVM_GETITEMSPACING, bSmallIconView, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, LVM_GETITEMSPACING, bSmallIconView, 0L); sizeSpacing.cx = GET_X_LPARAM(dwRet); sizeSpacing.cy = GET_Y_LPARAM(dwRet); } -#if (_WIN32_WCE >= 410) - void SetItemSpacing(INT cySpacing) - { - ATLASSERT(::IsWindow(m_hWnd)); - ListView_SetItemSpacing(m_hWnd, cySpacing); - } -#endif // (_WIN32_WCE >= 410) - // single-selection only int GetSelectedIndex() const { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & LVS_SINGLESEL) != 0); - return (int)::SendMessage(m_hWnd, LVM_GETNEXTITEM, (WPARAM)-1, MAKELPARAM(LVNI_ALL | LVNI_SELECTED, 0)); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & LVS_SINGLESEL) != 0); + return (int)::SendMessage(this->m_hWnd, LVM_GETNEXTITEM, (WPARAM)-1, MAKELPARAM(LVNI_ALL | LVNI_SELECTED, 0)); } BOOL GetSelectedItem(LPLVITEM pItem) const { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & LVS_SINGLESEL) != 0); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & LVS_SINGLESEL) != 0); ATLASSERT(pItem != NULL); - pItem->iItem = (int)::SendMessage(m_hWnd, LVM_GETNEXTITEM, (WPARAM)-1, MAKELPARAM(LVNI_ALL | LVNI_SELECTED, 0)); + pItem->iItem = (int)::SendMessage(this->m_hWnd, LVM_GETNEXTITEM, (WPARAM)-1, MAKELPARAM(LVNI_ALL | LVNI_SELECTED, 0)); if(pItem->iItem == -1) return FALSE; - return (BOOL)::SendMessage(m_hWnd, LVM_GETITEM, 0, (LPARAM)pItem); + return (BOOL)::SendMessage(this->m_hWnd, LVM_GETITEM, 0, (LPARAM)pItem); } // extended list view styles DWORD GetExtendedListViewStyle() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0L); } // dwExMask = 0 means all styles DWORD SetExtendedListViewStyle(DWORD dwExStyle, DWORD dwExMask = 0) { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, dwExMask, dwExStyle); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, dwExMask, dwExStyle); } // checkboxes only BOOL GetCheckState(int nIndex) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((GetExtendedListViewStyle() & LVS_EX_CHECKBOXES) != 0); UINT uRet = GetItemState(nIndex, LVIS_STATEIMAGEMASK); return (uRet >> 12) - 1; @@ -3247,304 +3118,294 @@ class CListViewCtrlT : public TBase // view type DWORD GetViewType() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (GetStyle() & LVS_TYPEMASK); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (this->GetStyle() & LVS_TYPEMASK); } DWORD SetViewType(DWORD dwType) { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(dwType == LVS_ICON || dwType == LVS_SMALLICON || dwType == LVS_LIST || dwType == LVS_REPORT); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((dwType == LVS_ICON) || (dwType == LVS_SMALLICON) || (dwType == LVS_LIST) || (dwType == LVS_REPORT)); DWORD dwOldType = GetViewType(); if(dwType != dwOldType) ModifyStyle(LVS_TYPEMASK, (dwType & LVS_TYPEMASK)); return dwOldType; } -#if (_WIN32_IE >= 0x0400) -#ifndef _WIN32_WCE BOOL GetBkImage(LPLVBKIMAGE plvbki) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETBKIMAGE, 0, (LPARAM)plvbki); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_GETBKIMAGE, 0, (LPARAM)plvbki); } BOOL SetBkImage(LPLVBKIMAGE plvbki) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETBKIMAGE, 0, (LPARAM)plvbki); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SETBKIMAGE, 0, (LPARAM)plvbki); } -#endif // !_WIN32_WCE int GetSelectionMark() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETSELECTIONMARK, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_GETSELECTIONMARK, 0, 0L); } int SetSelectionMark(int nIndex) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_SETSELECTIONMARK, 0, nIndex); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_SETSELECTIONMARK, 0, nIndex); } -#ifndef _WIN32_WCE BOOL GetWorkAreas(int nWorkAreas, LPRECT lpRect) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETWORKAREAS, nWorkAreas, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_GETWORKAREAS, nWorkAreas, (LPARAM)lpRect); } BOOL SetWorkAreas(int nWorkAreas, LPRECT lpRect) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETWORKAREAS, nWorkAreas, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SETWORKAREAS, nWorkAreas, (LPARAM)lpRect); } DWORD GetHoverTime() const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((GetExtendedListViewStyle() & (LVS_EX_TRACKSELECT | LVS_EX_ONECLICKACTIVATE | LVS_EX_TWOCLICKACTIVATE)) != 0); - return (DWORD)::SendMessage(m_hWnd, LVM_GETHOVERTIME, 0, 0L); + return (DWORD)::SendMessage(this->m_hWnd, LVM_GETHOVERTIME, 0, 0L); } DWORD SetHoverTime(DWORD dwHoverTime) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((GetExtendedListViewStyle() & (LVS_EX_TRACKSELECT | LVS_EX_ONECLICKACTIVATE | LVS_EX_TWOCLICKACTIVATE)) != 0); - return (DWORD)::SendMessage(m_hWnd, LVM_SETHOVERTIME, 0, dwHoverTime); + return (DWORD)::SendMessage(this->m_hWnd, LVM_SETHOVERTIME, 0, dwHoverTime); } BOOL GetNumberOfWorkAreas(int* pnWorkAreas) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETNUMBEROFWORKAREAS, 0, (LPARAM)pnWorkAreas); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_GETNUMBEROFWORKAREAS, 0, (LPARAM)pnWorkAreas); } -#endif // !_WIN32_WCE BOOL SetItemCountEx(int nItems, DWORD dwFlags) { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(((GetStyle() & LVS_OWNERDATA) != 0) && (((GetStyle() & LVS_TYPEMASK) == LVS_REPORT) || ((GetStyle() & LVS_TYPEMASK) == LVS_LIST))); - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMCOUNT, nItems, dwFlags); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT(((this->GetStyle() & LVS_OWNERDATA) != 0) && (((this->GetStyle() & LVS_TYPEMASK) == LVS_REPORT) || ((this->GetStyle() & LVS_TYPEMASK) == LVS_LIST))); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SETITEMCOUNT, nItems, dwFlags); } -#ifndef _WIN32_WCE CToolTipCtrl GetToolTips() const { - ATLASSERT(::IsWindow(m_hWnd)); - return CToolTipCtrl((HWND)::SendMessage(m_hWnd, LVM_GETTOOLTIPS, 0, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CToolTipCtrl((HWND)::SendMessage(this->m_hWnd, LVM_GETTOOLTIPS, 0, 0L)); } CToolTipCtrl SetToolTips(HWND hWndTT) { - ATLASSERT(::IsWindow(m_hWnd)); - return CToolTipCtrl((HWND)::SendMessage(m_hWnd, LVM_SETTOOLTIPS, (WPARAM)hWndTT, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CToolTipCtrl((HWND)::SendMessage(this->m_hWnd, LVM_SETTOOLTIPS, (WPARAM)hWndTT, 0L)); } BOOL GetUnicodeFormat() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETUNICODEFORMAT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_GETUNICODEFORMAT, 0, 0L); } BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETUNICODEFORMAT, bUnicode, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SETUNICODEFORMAT, bUnicode, 0L); } -#endif // !_WIN32_WCE -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_WINNT >= 0x0501) int GetSelectedColumn() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETSELECTEDCOLUMN, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_GETSELECTEDCOLUMN, 0, 0L); } void SetSelectedColumn(int nColumn) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_SETSELECTEDCOLUMN, nColumn, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, LVM_SETSELECTEDCOLUMN, nColumn, 0L); } DWORD GetView() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, LVM_GETVIEW, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, LVM_GETVIEW, 0, 0L); } int SetView(DWORD dwView) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_SETVIEW, dwView, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_SETVIEW, dwView, 0L); } BOOL IsGroupViewEnabled() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_ISGROUPVIEWENABLED, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_ISGROUPVIEWENABLED, 0, 0L); } int GetGroupInfo(int nGroupID, PLVGROUP pGroup) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETGROUPINFO, nGroupID, (LPARAM)pGroup); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_GETGROUPINFO, nGroupID, (LPARAM)pGroup); } int SetGroupInfo(int nGroupID, PLVGROUP pGroup) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_SETGROUPINFO, nGroupID, (LPARAM)pGroup); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_SETGROUPINFO, nGroupID, (LPARAM)pGroup); } void GetGroupMetrics(PLVGROUPMETRICS pGroupMetrics) const { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_GETGROUPMETRICS, 0, (LPARAM)pGroupMetrics); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, LVM_GETGROUPMETRICS, 0, (LPARAM)pGroupMetrics); } void SetGroupMetrics(PLVGROUPMETRICS pGroupMetrics) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_SETGROUPMETRICS, 0, (LPARAM)pGroupMetrics); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, LVM_SETGROUPMETRICS, 0, (LPARAM)pGroupMetrics); } void GetTileViewInfo(PLVTILEVIEWINFO pTileViewInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_GETTILEVIEWINFO, 0, (LPARAM)pTileViewInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, LVM_GETTILEVIEWINFO, 0, (LPARAM)pTileViewInfo); } BOOL SetTileViewInfo(PLVTILEVIEWINFO pTileViewInfo) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETTILEVIEWINFO, 0, (LPARAM)pTileViewInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SETTILEVIEWINFO, 0, (LPARAM)pTileViewInfo); } void GetTileInfo(PLVTILEINFO pTileInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_GETTILEINFO, 0, (LPARAM)pTileInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, LVM_GETTILEINFO, 0, (LPARAM)pTileInfo); } BOOL SetTileInfo(PLVTILEINFO pTileInfo) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETTILEINFO, 0, (LPARAM)pTileInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SETTILEINFO, 0, (LPARAM)pTileInfo); } BOOL GetInsertMark(LPLVINSERTMARK pInsertMark) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETINSERTMARK, 0, (LPARAM)pInsertMark); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_GETINSERTMARK, 0, (LPARAM)pInsertMark); } BOOL SetInsertMark(LPLVINSERTMARK pInsertMark) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETINSERTMARK, 0, (LPARAM)pInsertMark); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SETINSERTMARK, 0, (LPARAM)pInsertMark); } int GetInsertMarkRect(LPRECT lpRect) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETINSERTMARKRECT, 0, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_GETINSERTMARKRECT, 0, (LPARAM)lpRect); } COLORREF GetInsertMarkColor() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, LVM_GETINSERTMARKCOLOR, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, LVM_GETINSERTMARKCOLOR, 0, 0L); } COLORREF SetInsertMarkColor(COLORREF clr) { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, LVM_SETINSERTMARKCOLOR, 0, clr); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, LVM_SETINSERTMARKCOLOR, 0, clr); } COLORREF GetOutlineColor() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, LVM_GETOUTLINECOLOR, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, LVM_GETOUTLINECOLOR, 0, 0L); } COLORREF SetOutlineColor(COLORREF clr) { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, LVM_SETOUTLINECOLOR, 0, clr); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, LVM_SETOUTLINECOLOR, 0, clr); } -#endif // (_WIN32_WINNT >= 0x0501) #if (_WIN32_WINNT >= 0x0600) int GetGroupCount() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETGROUPCOUNT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_GETGROUPCOUNT, 0, 0L); } BOOL GetGroupInfoByIndex(int nIndex, PLVGROUP pGroup) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETGROUPINFOBYINDEX, nIndex, (LPARAM)pGroup); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_GETGROUPINFOBYINDEX, nIndex, (LPARAM)pGroup); } BOOL GetGroupRect(int nGroupID, int nType, LPRECT lpRect) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(lpRect != NULL); if(lpRect != NULL) lpRect->top = nType; - return (BOOL)::SendMessage(m_hWnd, LVM_GETGROUPRECT, nGroupID, (LPARAM)lpRect); + return (BOOL)::SendMessage(this->m_hWnd, LVM_GETGROUPRECT, nGroupID, (LPARAM)lpRect); } UINT GetGroupState(int nGroupID, UINT uMask) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, LVM_GETGROUPSTATE, nGroupID, (LPARAM)uMask); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UINT)::SendMessage(this->m_hWnd, LVM_GETGROUPSTATE, nGroupID, (LPARAM)uMask); } int GetFocusedGroup() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETFOCUSEDGROUP, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_GETFOCUSEDGROUP, 0, 0L); } BOOL GetEmptyText(LPWSTR lpstrText, int cchText) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETEMPTYTEXT, cchText, (LPARAM)lpstrText); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_GETEMPTYTEXT, cchText, (LPARAM)lpstrText); } BOOL GetFooterRect(LPRECT lpRect) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETFOOTERRECT, 0, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_GETFOOTERRECT, 0, (LPARAM)lpRect); } BOOL GetFooterInfo(LPLVFOOTERINFO lpFooterInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETFOOTERINFO, 0, (LPARAM)lpFooterInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_GETFOOTERINFO, 0, (LPARAM)lpFooterInfo); } BOOL GetFooterItemRect(int nItem, LPRECT lpRect) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETFOOTERITEMRECT, nItem, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_GETFOOTERITEMRECT, nItem, (LPARAM)lpRect); } BOOL GetFooterItem(int nItem, LPLVFOOTERITEM lpFooterItem) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETFOOTERITEM, nItem, (LPARAM)lpFooterItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_GETFOOTERITEM, nItem, (LPARAM)lpFooterItem); } BOOL GetItemIndexRect(PLVITEMINDEX pItemIndex, int nSubItem, int nType, LPRECT lpRect) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(pItemIndex != NULL); ATLASSERT(lpRect != NULL); if(lpRect != NULL) @@ -3552,30 +3413,30 @@ class CListViewCtrlT : public TBase lpRect->top = nSubItem; lpRect->left = nType; } - return (BOOL)::SendMessage(m_hWnd, LVM_GETITEMINDEXRECT, (WPARAM)pItemIndex, (LPARAM)lpRect); + return (BOOL)::SendMessage(this->m_hWnd, LVM_GETITEMINDEXRECT, (WPARAM)pItemIndex, (LPARAM)lpRect); } BOOL SetItemIndexState(PLVITEMINDEX pItemIndex, UINT uState, UINT dwMask) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); LVITEM lvi = { 0 }; lvi.state = uState; lvi.stateMask = dwMask; - return (BOOL)::SendMessage(m_hWnd, LVM_SETITEMINDEXSTATE, (WPARAM)pItemIndex, (LPARAM)&lvi); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SETITEMINDEXSTATE, (WPARAM)pItemIndex, (LPARAM)&lvi); } BOOL GetNextItemIndex(PLVITEMINDEX pItemIndex, WORD wFlags) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_GETNEXTITEMINDEX, (WPARAM)pItemIndex, MAKELPARAM(wFlags, 0)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_GETNEXTITEMINDEX, (WPARAM)pItemIndex, MAKELPARAM(wFlags, 0)); } #endif // (_WIN32_WINNT >= 0x0600) // Operations int InsertColumn(int nCol, const LVCOLUMN* pColumn) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_INSERTCOLUMN, nCol, (LPARAM)pColumn); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_INSERTCOLUMN, nCol, (LPARAM)pColumn); } int InsertColumn(int nCol, LPCTSTR lpszColumnHeading, int nFormat = LVCFMT_LEFT, @@ -3610,13 +3471,13 @@ class CListViewCtrlT : public TBase BOOL DeleteColumn(int nCol) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_DELETECOLUMN, nCol, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_DELETECOLUMN, nCol, 0L); } int InsertItem(UINT nMask, int nItem, LPCTSTR lpszItem, UINT nState, UINT nStateMask, int nImage, LPARAM lParam) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); LVITEM item = { 0 }; item.mask = nMask; item.iItem = nItem; @@ -3631,58 +3492,67 @@ class CListViewCtrlT : public TBase int InsertItem(const LVITEM* pItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_INSERTITEM, 0, (LPARAM)pItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_INSERTITEM, 0, (LPARAM)pItem); } int InsertItem(int nItem, LPCTSTR lpszItem) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); return InsertItem(LVIF_TEXT, nItem, lpszItem, 0, 0, 0, 0); } int InsertItem(int nItem, LPCTSTR lpszItem, int nImage) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); return InsertItem(LVIF_TEXT|LVIF_IMAGE, nItem, lpszItem, 0, 0, nImage, 0); } int GetNextItem(int nItem, int nFlags) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_GETNEXTITEM, nItem, MAKELPARAM(nFlags, 0)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_GETNEXTITEM, nItem, MAKELPARAM(nFlags, 0)); } BOOL DeleteItem(int nItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_DELETEITEM, nItem, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_DELETEITEM, nItem, 0L); } BOOL DeleteAllItems() { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_DELETEALLITEMS, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_DELETEALLITEMS, 0, 0L); + } + + int FindItem(LVFINDINFO* pFindInfo, int nStart = -1) const + { + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_FINDITEM, nStart, (LPARAM)pFindInfo); } - int FindItem(LVFINDINFO* pFindInfo, int nStart) const + int FindItem(LPCTSTR lpstrFind, bool bPartial = true, bool bWrap = false, int nStart = -1) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_FINDITEM, nStart, (LPARAM)pFindInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + LVFINDINFO lvfi = { 0 }; + lvfi.flags = LVFI_STRING | (bWrap ? LVFI_WRAP : 0) | (bPartial ? LVFI_PARTIAL : 0); + lvfi.psz = lpstrFind; + return (int)::SendMessage(this->m_hWnd, LVM_FINDITEM, nStart, (LPARAM)&lvfi); } int HitTest(LVHITTESTINFO* pHitTestInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_HITTEST, 0, (LPARAM)pHitTestInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_HITTEST, 0, (LPARAM)pHitTestInfo); } int HitTest(POINT pt, UINT* pFlags) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); LVHITTESTINFO hti = { 0 }; hti.pt = pt; - int nRes = (int)::SendMessage(m_hWnd, LVM_HITTEST, 0, (LPARAM)&hti); + int nRes = (int)::SendMessage(this->m_hWnd, LVM_HITTEST, 0, (LPARAM)&hti); if (pFlags != NULL) *pFlags = hti.flags; return nRes; @@ -3690,68 +3560,68 @@ class CListViewCtrlT : public TBase BOOL EnsureVisible(int nItem, BOOL bPartialOK) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_ENSUREVISIBLE, nItem, MAKELPARAM(bPartialOK, 0)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_ENSUREVISIBLE, nItem, MAKELPARAM(bPartialOK, 0)); } BOOL Scroll(SIZE size) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SCROLL, size.cx, size.cy); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SCROLL, size.cx, size.cy); } BOOL RedrawItems(int nFirst, int nLast) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_REDRAWITEMS, nFirst, nLast); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_REDRAWITEMS, nFirst, nLast); } BOOL Arrange(UINT nCode) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_ARRANGE, nCode, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_ARRANGE, nCode, 0L); } CEdit EditLabel(int nItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return CEdit((HWND)::SendMessage(m_hWnd, LVM_EDITLABEL, nItem, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CEdit((HWND)::SendMessage(this->m_hWnd, LVM_EDITLABEL, nItem, 0L)); } BOOL Update(int nItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_UPDATE, nItem, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_UPDATE, nItem, 0L); } BOOL SortItems(PFNLVCOMPARE pfnCompare, LPARAM lParamSort) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SORTITEMS, (WPARAM)lParamSort, (LPARAM)pfnCompare); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SORTITEMS, (WPARAM)lParamSort, (LPARAM)pfnCompare); } CImageList RemoveImageList(int nImageList) { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, LVM_SETIMAGELIST, (WPARAM)nImageList, NULL)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, LVM_SETIMAGELIST, (WPARAM)nImageList, NULL)); } CImageList CreateDragImage(int nItem, LPPOINT lpPoint) { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, LVM_CREATEDRAGIMAGE, nItem, (LPARAM)lpPoint)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, LVM_CREATEDRAGIMAGE, nItem, (LPARAM)lpPoint)); } DWORD ApproximateViewRect(int cx = -1, int cy = -1, int nCount = -1) { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, LVM_APPROXIMATEVIEWRECT, nCount, MAKELPARAM(cx, cy)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, LVM_APPROXIMATEVIEWRECT, nCount, MAKELPARAM(cx, cy)); } int SubItemHitTest(LPLVHITTESTINFO lpInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_SUBITEMHITTEST, 0, (LPARAM)lpInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_SUBITEMHITTEST, 0, (LPARAM)lpInfo); } int AddColumn(LPCTSTR strItem, int nItem, int nSubItem = -1, @@ -3759,7 +3629,7 @@ class CListViewCtrlT : public TBase int nFmt = LVCFMT_LEFT) { const int cxOffset = 15; - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); LVCOLUMN lvc = { 0 }; lvc.mask = nMask; lvc.fmt = nFmt; @@ -3770,15 +3640,15 @@ class CListViewCtrlT : public TBase return InsertColumn(nItem, &lvc); } - int AddItem(int nItem, int nSubItem, LPCTSTR strItem, int nImageIndex = -1) + int AddItem(int nItem, int nSubItem, LPCTSTR strItem, int nImageIndex = -3) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); LVITEM lvItem = { 0 }; lvItem.mask = LVIF_TEXT; lvItem.iItem = nItem; lvItem.iSubItem = nSubItem; lvItem.pszText = (LPTSTR)strItem; - if(nImageIndex != -1) + if(nImageIndex != -3) { lvItem.mask |= LVIF_IMAGE; lvItem.iImage = nImageIndex; @@ -3788,19 +3658,16 @@ class CListViewCtrlT : public TBase return SetItem(&lvItem) ? nItem : -1; } -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) BOOL SortItemsEx(PFNLVCOMPARE pfnCompare, LPARAM lParamSort) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SORTITEMSEX, (WPARAM)lParamSort, (LPARAM)pfnCompare); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SORTITEMSEX, (WPARAM)lParamSort, (LPARAM)pfnCompare); } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) -#if (_WIN32_WINNT >= 0x0501) int InsertGroup(int nItem, PLVGROUP pGroup) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_INSERTGROUP, nItem, (LPARAM)pGroup); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_INSERTGROUP, nItem, (LPARAM)pGroup); } int AddGroup(PLVGROUP pGroup) @@ -3810,96 +3677,95 @@ class CListViewCtrlT : public TBase int RemoveGroup(int nGroupID) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_REMOVEGROUP, nGroupID, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_REMOVEGROUP, nGroupID, 0L); } void MoveGroup(int nGroupID, int nItem) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_MOVEGROUP, nGroupID, nItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, LVM_MOVEGROUP, nGroupID, nItem); } void MoveItemToGroup(int nItem, int nGroupID) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_MOVEITEMTOGROUP, nItem, nGroupID); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, LVM_MOVEITEMTOGROUP, nItem, nGroupID); } int EnableGroupView(BOOL bEnable) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_ENABLEGROUPVIEW, bEnable, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_ENABLEGROUPVIEW, bEnable, 0L); } int SortGroups(PFNLVGROUPCOMPARE pCompareFunc, LPVOID lpVoid = NULL) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_SORTGROUPS, (WPARAM)pCompareFunc, (LPARAM)lpVoid); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_SORTGROUPS, (WPARAM)pCompareFunc, (LPARAM)lpVoid); } void InsertGroupSorted(PLVINSERTGROUPSORTED pInsertGroupSorted) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_INSERTGROUPSORTED, (WPARAM)pInsertGroupSorted, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, LVM_INSERTGROUPSORTED, (WPARAM)pInsertGroupSorted, 0L); } void RemoveAllGroups() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_REMOVEALLGROUPS, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, LVM_REMOVEALLGROUPS, 0, 0L); } BOOL HasGroup(int nGroupID) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_HASGROUP, nGroupID, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_HASGROUP, nGroupID, 0L); } BOOL InsertMarkHitTest(LPPOINT lpPoint, LPLVINSERTMARK pInsertMark) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_INSERTMARKHITTEST, (WPARAM)lpPoint, (LPARAM)pInsertMark); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_INSERTMARKHITTEST, (WPARAM)lpPoint, (LPARAM)pInsertMark); } BOOL SetInfoTip(PLVSETINFOTIP pSetInfoTip) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LVM_SETINFOTIP, 0, (LPARAM)pSetInfoTip); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LVM_SETINFOTIP, 0, (LPARAM)pSetInfoTip); } void CancelEditLabel() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, LVM_CANCELEDITLABEL, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, LVM_CANCELEDITLABEL, 0, 0L); } UINT MapIndexToID(int nIndex) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, LVM_MAPINDEXTOID, nIndex, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UINT)::SendMessage(this->m_hWnd, LVM_MAPINDEXTOID, nIndex, 0L); } int MapIDToIndex(UINT uID) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_MAPIDTOINDEX, uID, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_MAPIDTOINDEX, uID, 0L); } -#endif // (_WIN32_WINNT >= 0x0501) #if (_WIN32_WINNT >= 0x0600) int HitTestEx(LPLVHITTESTINFO lpHitTestInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_HITTEST, (WPARAM)-1, (LPARAM)lpHitTestInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_HITTEST, (WPARAM)-1, (LPARAM)lpHitTestInfo); } int HitTestEx(POINT pt, UINT* pFlags) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); LVHITTESTINFO hti = { 0 }; hti.pt = pt; - int nRes = (int)::SendMessage(m_hWnd, LVM_HITTEST, (WPARAM)-1, (LPARAM)&hti); + int nRes = (int)::SendMessage(this->m_hWnd, LVM_HITTEST, (WPARAM)-1, (LPARAM)&hti); if (pFlags != NULL) *pFlags = hti.flags; return nRes; @@ -3907,18 +3773,18 @@ class CListViewCtrlT : public TBase int SubItemHitTestEx(LPLVHITTESTINFO lpHitTestInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LVM_SUBITEMHITTEST, (WPARAM)-1, (LPARAM)lpHitTestInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LVM_SUBITEMHITTEST, (WPARAM)-1, (LPARAM)lpHitTestInfo); } #endif // (_WIN32_WINNT >= 0x0600) // Note: selects only one item BOOL SelectItem(int nIndex) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); // multi-selection only: de-select all items - if((GetStyle() & LVS_SINGLESEL) == 0) + if((this->GetStyle() & LVS_SINGLESEL) == 0) SetItemState(-1, 0, LVIS_SELECTED); BOOL bRet = SetItemState(nIndex, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); @@ -3945,7 +3811,7 @@ class CTreeViewCtrlT : public TBase CTreeViewCtrlT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -3964,50 +3830,50 @@ class CTreeViewCtrlT : public TBase UINT GetCount() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, TVM_GETCOUNT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UINT)::SendMessage(this->m_hWnd, TVM_GETCOUNT, 0, 0L); } UINT GetIndent() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, TVM_GETINDENT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UINT)::SendMessage(this->m_hWnd, TVM_GETINDENT, 0, 0L); } void SetIndent(UINT nIndent) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TVM_SETINDENT, nIndent, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TVM_SETINDENT, nIndent, 0L); } CImageList GetImageList(int nImageListType = TVSIL_NORMAL) const { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TVM_GETIMAGELIST, (WPARAM)nImageListType, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TVM_GETIMAGELIST, (WPARAM)nImageListType, 0L)); } CImageList SetImageList(HIMAGELIST hImageList, int nImageListType = TVSIL_NORMAL) { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TVM_SETIMAGELIST, (WPARAM)nImageListType, (LPARAM)hImageList)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TVM_SETIMAGELIST, (WPARAM)nImageListType, (LPARAM)hImageList)); } BOOL GetItem(LPTVITEM pItem) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)pItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TVM_GETITEM, 0, (LPARAM)pItem); } BOOL SetItem(LPTVITEM pItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SETITEM, 0, (LPARAM)pItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TVM_SETITEM, 0, (LPARAM)pItem); } BOOL SetItem(HTREEITEM hItem, UINT nMask, LPCTSTR lpszItem, int nImage, int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); TVITEM item = { 0 }; item.hItem = hItem; item.mask = nMask; @@ -4017,12 +3883,12 @@ class CTreeViewCtrlT : public TBase item.state = nState; item.stateMask = nStateMask; item.lParam = lParam; - return (BOOL)::SendMessage(m_hWnd, TVM_SETITEM, 0, (LPARAM)&item); + return (BOOL)::SendMessage(this->m_hWnd, TVM_SETITEM, 0, (LPARAM)&item); } BOOL GetItemText(HTREEITEM hItem, LPTSTR lpstrText, int nLen) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(lpstrText != NULL); TVITEM item = { 0 }; @@ -4031,14 +3897,13 @@ class CTreeViewCtrlT : public TBase item.pszText = lpstrText; item.cchTextMax = nLen; - return (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); + return (BOOL)::SendMessage(this->m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); } -#ifndef _ATL_NO_COM BOOL GetItemText(HTREEITEM hItem, BSTR& bstrText) const { USES_CONVERSION; - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(bstrText == NULL); TVITEM item = { 0 }; item.hItem = hItem; @@ -4054,8 +3919,8 @@ class CTreeViewCtrlT : public TBase lpstrText[0] = NULL; item.pszText = lpstrText; item.cchTextMax = nLen; - bRet = (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); - if(!bRet || (lstrlen(item.pszText) < nLen - 1)) + bRet = (BOOL)::SendMessage(this->m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); + if(!bRet || (lstrlen(item.pszText) < (nLen - 1))) break; delete [] lpstrText; lpstrText = NULL; @@ -4070,12 +3935,11 @@ class CTreeViewCtrlT : public TBase return (bstrText != NULL) ? TRUE : FALSE; } -#endif // !_ATL_NO_COM -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - BOOL GetItemText(HTREEITEM hItem, _CSTRING_NS::CString& strText) const +#ifdef __ATLSTR_H__ + BOOL GetItemText(HTREEITEM hItem, ATL::CString& strText) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); TVITEM item = { 0 }; item.hItem = hItem; item.mask = TVIF_TEXT; @@ -4091,28 +3955,28 @@ class CTreeViewCtrlT : public TBase break; } item.cchTextMax = nLen; - bRet = (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); - if(!bRet || (lstrlen(item.pszText) < nLen - 1)) + bRet = (BOOL)::SendMessage(this->m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); + if(!bRet || (lstrlen(item.pszText) < (nLen - 1))) break; } strText.ReleaseBuffer(); return bRet; } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) +#endif // __ATLSTR_H__ BOOL SetItemText(HTREEITEM hItem, LPCTSTR lpszItem) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); return SetItem(hItem, TVIF_TEXT, lpszItem, 0, 0, 0, 0, NULL); } BOOL GetItemImage(HTREEITEM hItem, int& nImage, int& nSelectedImage) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); TVITEM item = { 0 }; item.hItem = hItem; item.mask = TVIF_IMAGE|TVIF_SELECTEDIMAGE; - BOOL bRes = (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); + BOOL bRes = (BOOL)::SendMessage(this->m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); if (bRes) { nImage = item.iImage; @@ -4123,102 +3987,90 @@ class CTreeViewCtrlT : public TBase BOOL SetItemImage(HTREEITEM hItem, int nImage, int nSelectedImage) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); return SetItem(hItem, TVIF_IMAGE|TVIF_SELECTEDIMAGE, NULL, nImage, nSelectedImage, 0, 0, NULL); } UINT GetItemState(HTREEITEM hItem, UINT nStateMask) const { - ATLASSERT(::IsWindow(m_hWnd)); -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - return (((UINT)::SendMessage(m_hWnd, TVM_GETITEMSTATE, (WPARAM)hItem, (LPARAM)nStateMask)) & nStateMask); -#else // !((_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE)) - TVITEM item = { 0 }; - item.hItem = hItem; - item.mask = TVIF_STATE; - item.state = 0; - item.stateMask = nStateMask; - ::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); - return (item.state & nStateMask); -#endif // !((_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE)) + ATLASSERT(::IsWindow(this->m_hWnd)); + return (((UINT)::SendMessage(this->m_hWnd, TVM_GETITEMSTATE, (WPARAM)hItem, (LPARAM)nStateMask)) & nStateMask); } BOOL SetItemState(HTREEITEM hItem, UINT nState, UINT nStateMask) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); return SetItem(hItem, TVIF_STATE, NULL, 0, 0, nState, nStateMask, NULL); } DWORD_PTR GetItemData(HTREEITEM hItem) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); TVITEM item = { 0 }; item.hItem = hItem; item.mask = TVIF_PARAM; - BOOL bRet = (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); + BOOL bRet = (BOOL)::SendMessage(this->m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); return (DWORD_PTR)(bRet ? item.lParam : NULL); } BOOL SetItemData(HTREEITEM hItem, DWORD_PTR dwData) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); return SetItem(hItem, TVIF_PARAM, NULL, 0, 0, 0, 0, (LPARAM)dwData); } CEdit GetEditControl() const { - ATLASSERT(::IsWindow(m_hWnd)); - return CEdit((HWND)::SendMessage(m_hWnd, TVM_GETEDITCONTROL, 0, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CEdit((HWND)::SendMessage(this->m_hWnd, TVM_GETEDITCONTROL, 0, 0L)); } UINT GetVisibleCount() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, TVM_GETVISIBLECOUNT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UINT)::SendMessage(this->m_hWnd, TVM_GETVISIBLECOUNT, 0, 0L); } BOOL GetItemRect(HTREEITEM hItem, LPRECT lpRect, BOOL bTextOnly) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); *(HTREEITEM*)lpRect = hItem; - return (BOOL)::SendMessage(m_hWnd, TVM_GETITEMRECT, (WPARAM)bTextOnly, (LPARAM)lpRect); + return (BOOL)::SendMessage(this->m_hWnd, TVM_GETITEMRECT, (WPARAM)bTextOnly, (LPARAM)lpRect); } BOOL ItemHasChildren(HTREEITEM hItem) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); TVITEM item = { 0 }; item.hItem = hItem; item.mask = TVIF_CHILDREN; - ::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); + ::SendMessage(this->m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); return item.cChildren; } -#ifndef _WIN32_WCE CToolTipCtrl GetToolTips() const { - ATLASSERT(::IsWindow(m_hWnd)); - return CToolTipCtrl((HWND)::SendMessage(m_hWnd, TVM_GETTOOLTIPS, 0, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CToolTipCtrl((HWND)::SendMessage(this->m_hWnd, TVM_GETTOOLTIPS, 0, 0L)); } CToolTipCtrl SetToolTips(HWND hWndTT) { - ATLASSERT(::IsWindow(m_hWnd)); - return CToolTipCtrl((HWND)::SendMessage(m_hWnd, TVM_SETTOOLTIPS, (WPARAM)hWndTT, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CToolTipCtrl((HWND)::SendMessage(this->m_hWnd, TVM_SETTOOLTIPS, (WPARAM)hWndTT, 0L)); } -#endif // !_WIN32_WCE int GetISearchString(LPTSTR lpstr) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TVM_GETISEARCHSTRING, 0, (LPARAM)lpstr); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TVM_GETISEARCHSTRING, 0, (LPARAM)lpstr); } // checkboxes only BOOL GetCheckState(HTREEITEM hItem) const { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & TVS_CHECKBOXES) != 0); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & TVS_CHECKBOXES) != 0); UINT uRet = GetItemState(hItem, TVIS_STATEIMAGEMASK); return (uRet >> 12) - 1; } @@ -4229,164 +4081,152 @@ class CTreeViewCtrlT : public TBase return SetItemState(hItem, INDEXTOSTATEIMAGEMASK(nCheck), TVIS_STATEIMAGEMASK); } -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) COLORREF GetBkColor() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TVM_GETBKCOLOR, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, TVM_GETBKCOLOR, 0, 0L); } COLORREF SetBkColor(COLORREF clr) { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TVM_SETBKCOLOR, 0, (LPARAM)clr); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, TVM_SETBKCOLOR, 0, (LPARAM)clr); } COLORREF GetInsertMarkColor() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TVM_GETINSERTMARKCOLOR, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, TVM_GETINSERTMARKCOLOR, 0, 0L); } COLORREF SetInsertMarkColor(COLORREF clr) { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TVM_SETINSERTMARKCOLOR, 0, (LPARAM)clr); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, TVM_SETINSERTMARKCOLOR, 0, (LPARAM)clr); } int GetItemHeight() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TVM_GETITEMHEIGHT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TVM_GETITEMHEIGHT, 0, 0L); } int SetItemHeight(int cyHeight) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TVM_SETITEMHEIGHT, cyHeight, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TVM_SETITEMHEIGHT, cyHeight, 0L); } int GetScrollTime() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TVM_GETSCROLLTIME, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TVM_GETSCROLLTIME, 0, 0L); } int SetScrollTime(int nScrollTime) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TVM_SETSCROLLTIME, nScrollTime, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TVM_SETSCROLLTIME, nScrollTime, 0L); } COLORREF GetTextColor() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TVM_GETTEXTCOLOR, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, TVM_GETTEXTCOLOR, 0, 0L); } COLORREF SetTextColor(COLORREF clr) { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TVM_SETTEXTCOLOR, 0, (LPARAM)clr); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, TVM_SETTEXTCOLOR, 0, (LPARAM)clr); } BOOL GetUnicodeFormat() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_GETUNICODEFORMAT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TVM_GETUNICODEFORMAT, 0, 0L); } BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SETUNICODEFORMAT, bUnicode, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TVM_SETUNICODEFORMAT, bUnicode, 0L); } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) COLORREF GetLineColor() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TVM_GETLINECOLOR, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, TVM_GETLINECOLOR, 0, 0L); } COLORREF SetLineColor(COLORREF clrNew /*= CLR_DEFAULT*/) { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TVM_SETLINECOLOR, 0, (LPARAM)clrNew); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, TVM_SETLINECOLOR, 0, (LPARAM)clrNew); } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) BOOL GetItem(LPTVITEMEX pItem) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)pItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TVM_GETITEM, 0, (LPARAM)pItem); } BOOL SetItem(LPTVITEMEX pItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SETITEM, 0, (LPARAM)pItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TVM_SETITEM, 0, (LPARAM)pItem); } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) DWORD GetExtendedStyle() const { -#ifndef TVM_GETEXTENDEDSTYLE - const UINT TVM_GETEXTENDEDSTYLE = (TV_FIRST + 45); -#endif - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TVM_GETEXTENDEDSTYLE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, TVM_GETEXTENDEDSTYLE, 0, 0L); } DWORD SetExtendedStyle(DWORD dwStyle, DWORD dwMask) { -#ifndef TVM_SETEXTENDEDSTYLE - const UINT TVM_SETEXTENDEDSTYLE = (TV_FIRST + 44); -#endif - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TVM_SETEXTENDEDSTYLE, dwMask, dwStyle); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, TVM_SETEXTENDEDSTYLE, dwMask, dwStyle); } #if (_WIN32_WINNT >= 0x0600) BOOL SetAutoScrollInfo(UINT uPixPerSec, UINT uUpdateTime) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SETAUTOSCROLLINFO, (WPARAM)uPixPerSec, (LPARAM)uUpdateTime); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TVM_SETAUTOSCROLLINFO, (WPARAM)uPixPerSec, (LPARAM)uUpdateTime); } DWORD GetSelectedCount() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TVM_GETSELECTEDCOUNT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, TVM_GETSELECTEDCOUNT, 0, 0L); } BOOL GetItemPartRect(HTREEITEM hItem, TVITEMPART partID, LPRECT lpRect) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); TVGETITEMPARTRECTINFO gipri = { hItem, lpRect, partID }; - return (BOOL)::SendMessage(m_hWnd, TVM_GETITEMPARTRECT, 0, (LPARAM)&gipri); + return (BOOL)::SendMessage(this->m_hWnd, TVM_GETITEMPARTRECT, 0, (LPARAM)&gipri); } #endif // (_WIN32_WINNT >= 0x0600) // Operations HTREEITEM InsertItem(LPTVINSERTSTRUCT lpInsertStruct) { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_INSERTITEM, 0, (LPARAM)lpInsertStruct); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_INSERTITEM, 0, (LPARAM)lpInsertStruct); } HTREEITEM InsertItem(LPCTSTR lpszItem, int nImage, int nSelectedImage, HTREEITEM hParent, HTREEITEM hInsertAfter) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); return InsertItem(TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE, lpszItem, nImage, nSelectedImage, 0, 0, 0, hParent, hInsertAfter); } HTREEITEM InsertItem(LPCTSTR lpszItem, HTREEITEM hParent, HTREEITEM hInsertAfter) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); return InsertItem(TVIF_TEXT, lpszItem, 0, 0, 0, 0, 0, hParent, hInsertAfter); } @@ -4394,7 +4234,7 @@ class CTreeViewCtrlT : public TBase int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam, HTREEITEM hParent, HTREEITEM hInsertAfter) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); TVINSERTSTRUCT tvis = { 0 }; tvis.hParent = hParent; tvis.hInsertAfter = hInsertAfter; @@ -4405,157 +4245,153 @@ class CTreeViewCtrlT : public TBase tvis.item.state = nState; tvis.item.stateMask = nStateMask; tvis.item.lParam = lParam; - return (HTREEITEM)::SendMessage(m_hWnd, TVM_INSERTITEM, 0, (LPARAM)&tvis); + return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_INSERTITEM, 0, (LPARAM)&tvis); } BOOL DeleteItem(HTREEITEM hItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_DELETEITEM, 0, (LPARAM)hItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TVM_DELETEITEM, 0, (LPARAM)hItem); } BOOL DeleteAllItems() { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT); } BOOL Expand(HTREEITEM hItem, UINT nCode = TVE_EXPAND) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_EXPAND, nCode, (LPARAM)hItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TVM_EXPAND, nCode, (LPARAM)hItem); } HTREEITEM GetNextItem(HTREEITEM hItem, UINT nCode) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, nCode, (LPARAM)hItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, nCode, (LPARAM)hItem); } HTREEITEM GetChildItem(HTREEITEM hItem) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem); } HTREEITEM GetNextSiblingItem(HTREEITEM hItem) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem); } HTREEITEM GetPrevSiblingItem(HTREEITEM hItem) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUS, (LPARAM)hItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUS, (LPARAM)hItem); } HTREEITEM GetParentItem(HTREEITEM hItem) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PARENT, (LPARAM)hItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_PARENT, (LPARAM)hItem); } HTREEITEM GetFirstVisibleItem() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_FIRSTVISIBLE, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_FIRSTVISIBLE, 0L); } HTREEITEM GetNextVisibleItem(HTREEITEM hItem) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTVISIBLE, (LPARAM)hItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTVISIBLE, (LPARAM)hItem); } HTREEITEM GetPrevVisibleItem(HTREEITEM hItem) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUSVISIBLE, (LPARAM)hItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUSVISIBLE, (LPARAM)hItem); } HTREEITEM GetSelectedItem() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_CARET, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_CARET, 0L); } HTREEITEM GetDropHilightItem() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_DROPHILITE, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_DROPHILITE, 0L); } HTREEITEM GetRootItem() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_ROOT, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_ROOT, 0L); } -#if !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) HTREEITEM GetLastVisibleItem() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_LASTVISIBLE, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_LASTVISIBLE, 0L); } -#endif // !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0600) HTREEITEM GetNextSelectedItem() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTSELECTED, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTSELECTED, 0L); } -#endif // (_WIN32_IE >= 0x0600) BOOL Select(HTREEITEM hItem, UINT nCode) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SELECTITEM, nCode, (LPARAM)hItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TVM_SELECTITEM, nCode, (LPARAM)hItem); } BOOL SelectItem(HTREEITEM hItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hItem); } BOOL SelectDropTarget(HTREEITEM hItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SELECTITEM, TVGN_DROPHILITE, (LPARAM)hItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TVM_SELECTITEM, TVGN_DROPHILITE, (LPARAM)hItem); } BOOL SelectSetFirstVisible(HTREEITEM hItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SELECTITEM, TVGN_FIRSTVISIBLE, (LPARAM)hItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TVM_SELECTITEM, TVGN_FIRSTVISIBLE, (LPARAM)hItem); } CEdit EditLabel(HTREEITEM hItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return CEdit((HWND)::SendMessage(m_hWnd, TVM_EDITLABEL, 0, (LPARAM)hItem)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CEdit((HWND)::SendMessage(this->m_hWnd, TVM_EDITLABEL, 0, (LPARAM)hItem)); } BOOL EndEditLabelNow(BOOL bCancel) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_ENDEDITLABELNOW, bCancel, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TVM_ENDEDITLABELNOW, bCancel, 0L); } HTREEITEM HitTest(TVHITTESTINFO* pHitTestInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_HITTEST, 0, (LPARAM)pHitTestInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_HITTEST, 0, (LPARAM)pHitTestInfo); } HTREEITEM HitTest(POINT pt, UINT* pFlags) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); TVHITTESTINFO hti = { 0 }; hti.pt = pt; - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_HITTEST, 0, (LPARAM)&hti); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_HITTEST, 0, (LPARAM)&hti); if (pFlags != NULL) *pFlags = hti.flags; return hTreeItem; @@ -4563,67 +4399,63 @@ class CTreeViewCtrlT : public TBase BOOL SortChildren(HTREEITEM hItem, BOOL bRecurse = FALSE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SORTCHILDREN, (WPARAM)bRecurse, (LPARAM)hItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TVM_SORTCHILDREN, (WPARAM)bRecurse, (LPARAM)hItem); } BOOL EnsureVisible(HTREEITEM hItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_ENSUREVISIBLE, 0, (LPARAM)hItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TVM_ENSUREVISIBLE, 0, (LPARAM)hItem); } BOOL SortChildrenCB(LPTVSORTCB pSort, BOOL bRecurse = FALSE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SORTCHILDRENCB, (WPARAM)bRecurse, (LPARAM)pSort); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TVM_SORTCHILDRENCB, (WPARAM)bRecurse, (LPARAM)pSort); } CImageList RemoveImageList(int nImageList) { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TVM_SETIMAGELIST, (WPARAM)nImageList, NULL)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TVM_SETIMAGELIST, (WPARAM)nImageList, NULL)); } CImageList CreateDragImage(HTREEITEM hItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TVM_CREATEDRAGIMAGE, 0, (LPARAM)hItem)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TVM_CREATEDRAGIMAGE, 0, (LPARAM)hItem)); } -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) BOOL SetInsertMark(HTREEITEM hTreeItem, BOOL bAfter) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SETINSERTMARK, bAfter, (LPARAM)hTreeItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TVM_SETINSERTMARK, bAfter, (LPARAM)hTreeItem); } BOOL RemoveInsertMark() { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TVM_SETINSERTMARK, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TVM_SETINSERTMARK, 0, 0L); } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) -#if (_WIN32_WINNT >= 0x0501) HTREEITEM MapAccIDToHTREEITEM(UINT uID) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (HTREEITEM)::SendMessage(m_hWnd, TVM_MAPACCIDTOHTREEITEM, uID, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_MAPACCIDTOHTREEITEM, uID, 0L); } UINT MapHTREEITEMToAccID(HTREEITEM hTreeItem) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, TVM_MAPHTREEITEMTOACCID, (WPARAM)hTreeItem, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UINT)::SendMessage(this->m_hWnd, TVM_MAPHTREEITEMTOACCID, (WPARAM)hTreeItem, 0L); } -#endif // (_WIN32_WINNT >= 0x0501) #if (_WIN32_WINNT >= 0x0600) void ShowInfoTip(HTREEITEM hItem) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TVM_SHOWINFOTIP, 0, (LPARAM)hItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TVM_SHOWINFOTIP, 0, (LPARAM)hItem); } #endif // (_WIN32_WINNT >= 0x0600) }; @@ -4672,12 +4504,10 @@ class CTreeItemT BOOL GetRect(LPRECT lpRect, BOOL bTextOnly) const; BOOL GetText(LPTSTR lpstrText, int nLen) const; -#ifndef _ATL_NO_COM BOOL GetText(BSTR& bstrText) const; -#endif // !_ATL_NO_COM -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - BOOL GetText(_CSTRING_NS::CString& strText) const; -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) +#ifdef __ATLSTR_H__ + BOOL GetText(ATL::CString& strText) const; +#endif // __ATLSTR_H__ BOOL SetText(LPCTSTR lpszItem); BOOL GetImage(int& nImage, int& nSelectedImage) const; BOOL SetImage(int nImage, int nSelectedImage); @@ -4714,12 +4544,8 @@ class CTreeItemT CTreeItemT GetSelected() const; CTreeItemT GetDropHilight() const; CTreeItemT GetRoot() const; -#if !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) CTreeItemT GetLastVisible() const; -#endif // !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0600) CTreeItemT GetNextSelected() const; -#endif // (_WIN32_IE >= 0x0600) BOOL HasChildren() const; BOOL Delete(); BOOL Expand(UINT nCode = TVE_EXPAND); @@ -4733,12 +4559,8 @@ class CTreeItemT BOOL EnsureVisible(); CTreeItemT _Insert(LPCTSTR lpstrItem, int nImageIndex, HTREEITEM hItemAfter); int GetImageIndex() const; -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) BOOL SetInsertMark(BOOL bAfter); -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) -#if (_WIN32_WINNT >= 0x0501) UINT MapHTREEITEMToAccID() const; -#endif // (_WIN32_WINNT >= 0x0501) #if (_WIN32_WINNT >= 0x0600) void ShowInfoTip(); BOOL GetPartRect(TVITEMPART partID, LPRECT lpRect) const; @@ -4758,130 +4580,126 @@ class CTreeViewCtrlExT : public CTreeViewCtrlT< TBase > CTreeViewCtrlExT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } // Operations (overides that return CTreeItem) CTreeItemT InsertItem(LPTVINSERTSTRUCT lpInsertStruct) { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_INSERTITEM, 0, (LPARAM)lpInsertStruct); + ATLASSERT(::IsWindow(this->m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_INSERTITEM, 0, (LPARAM)lpInsertStruct); return CTreeItemT(hTreeItem, this); } CTreeItemT InsertItem(LPCTSTR lpszItem, int nImage, int nSelectedImage, HTREEITEM hParent, HTREEITEM hInsertAfter) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); return InsertItem(TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE, lpszItem, nImage, nSelectedImage, 0, 0, 0, hParent, hInsertAfter); } CTreeItemT InsertItem(LPCTSTR lpszItem, HTREEITEM hParent, HTREEITEM hInsertAfter) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); return InsertItem(TVIF_TEXT, lpszItem, 0, 0, 0, 0, 0, hParent, hInsertAfter); } CTreeItemT GetNextItem(HTREEITEM hItem, UINT nCode) const { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, nCode, (LPARAM)hItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, nCode, (LPARAM)hItem); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } CTreeItemT GetChildItem(HTREEITEM hItem) const { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } CTreeItemT GetNextSiblingItem(HTREEITEM hItem) const { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } CTreeItemT GetPrevSiblingItem(HTREEITEM hItem) const { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUS, (LPARAM)hItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUS, (LPARAM)hItem); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } CTreeItemT GetParentItem(HTREEITEM hItem) const { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PARENT, (LPARAM)hItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_PARENT, (LPARAM)hItem); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } CTreeItemT GetFirstVisibleItem() const { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_FIRSTVISIBLE, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_FIRSTVISIBLE, 0L); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } CTreeItemT GetNextVisibleItem(HTREEITEM hItem) const { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTVISIBLE, (LPARAM)hItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTVISIBLE, (LPARAM)hItem); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } CTreeItemT GetPrevVisibleItem(HTREEITEM hItem) const { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUSVISIBLE, (LPARAM)hItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUSVISIBLE, (LPARAM)hItem); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } CTreeItemT GetSelectedItem() const { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_CARET, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_CARET, 0L); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } CTreeItemT GetDropHilightItem() const { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_DROPHILITE, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_DROPHILITE, 0L); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } CTreeItemT GetRootItem() const { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_ROOT, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_ROOT, 0L); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } -#if !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) CTreeItemT GetLastVisibleItem() const { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_LASTVISIBLE, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_LASTVISIBLE, 0L); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } -#endif // !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0600) CTreeItemT GetNextSelectedItem() const { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTSELECTED, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTSELECTED, 0L); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } -#endif // (_WIN32_IE >= 0x0600) CTreeItemT HitTest(TVHITTESTINFO* pHitTestInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_HITTEST, 0, (LPARAM)pHitTestInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_HITTEST, 0, (LPARAM)pHitTestInfo); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } @@ -4889,7 +4707,7 @@ class CTreeViewCtrlExT : public CTreeViewCtrlT< TBase > int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam, HTREEITEM hParent, HTREEITEM hInsertAfter) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); TVINSERTSTRUCT tvis = { 0 }; tvis.hParent = hParent; tvis.hInsertAfter = hInsertAfter; @@ -4900,29 +4718,27 @@ class CTreeViewCtrlExT : public CTreeViewCtrlT< TBase > tvis.item.state = nState; tvis.item.stateMask = nStateMask; tvis.item.lParam = lParam; - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_INSERTITEM, 0, (LPARAM)&tvis); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_INSERTITEM, 0, (LPARAM)&tvis); return CTreeItemT(hTreeItem, this); } CTreeItemT HitTest(POINT pt, UINT* pFlags) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); TVHITTESTINFO hti = { 0 }; hti.pt = pt; - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_HITTEST, 0, (LPARAM)&hti); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_HITTEST, 0, (LPARAM)&hti); if (pFlags != NULL) *pFlags = hti.flags; return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } -#if (_WIN32_WINNT >= 0x0501) CTreeItemT MapAccIDToHTREEITEM(UINT uID) const { - ATLASSERT(::IsWindow(m_hWnd)); - HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(m_hWnd, TVM_MAPACCIDTOHTREEITEM, uID, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_MAPACCIDTOHTREEITEM, uID, 0L); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } -#endif // (_WIN32_WINNT >= 0x0501) }; typedef CTreeViewCtrlExT CTreeViewCtrlEx; @@ -5013,23 +4829,19 @@ inline CTreeItemT CTreeItemT::GetRoot() const return m_pTreeView->GetRootItem(); } -#if !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) template inline CTreeItemT CTreeItemT::GetLastVisible() const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->GetLastVisibleItem(); } -#endif // !defined(_WIN32_WCE) && (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0600) template inline CTreeItemT CTreeItemT::GetNextSelected() const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->GetNextSelectedItem(); } -#endif // (_WIN32_IE >= 0x0600) template inline BOOL CTreeItemT::GetText(LPTSTR lpstrText, int nLen) const @@ -5038,7 +4850,6 @@ inline BOOL CTreeItemT::GetText(LPTSTR lpstrText, int nLen) const return m_pTreeView->GetItemText(m_hTreeItem, lpstrText, nLen); } -#ifndef _ATL_NO_COM #ifdef _OLEAUTO_H_ template inline BOOL CTreeItemT::GetText(BSTR& bstrText) const @@ -5047,16 +4858,15 @@ inline BOOL CTreeItemT::GetText(BSTR& bstrText) const return m_pTreeView->GetItemText(m_hTreeItem, bstrText); } #endif // _OLEAUTO_H_ -#endif // !_ATL_NO_COM -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) +#ifdef __ATLSTR_H__ template -inline BOOL CTreeItemT::GetText(_CSTRING_NS::CString& strText) const +inline BOOL CTreeItemT::GetText(ATL::CString& strText) const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->GetItemText(m_hTreeItem, strText); } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) +#endif // __ATLSTR_H__ template inline BOOL CTreeItemT::GetImage(int& nImage, int& nSelectedImage) const @@ -5221,23 +5031,19 @@ inline int CTreeItemT::GetImageIndex() const return item.iImage; } -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) template inline BOOL CTreeItemT::SetInsertMark(BOOL bAfter) { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->SetInsertMark(m_hTreeItem, bAfter); } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) -#if (_WIN32_WINNT >= 0x0501) template inline UINT CTreeItemT::MapHTREEITEMToAccID() const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->MapHTREEITEMToAccID(m_hTreeItem); } -#endif // (_WIN32_WINNT >= 0x0501) #if (_WIN32_WINNT >= 0x0600) template @@ -5269,7 +5075,7 @@ class CToolBarCtrlT : public TBase CToolBarCtrlT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -5288,281 +5094,274 @@ class CToolBarCtrlT : public TBase BOOL IsButtonEnabled(int nID) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_ISBUTTONENABLED, nID, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_ISBUTTONENABLED, nID, 0L); } BOOL IsButtonChecked(int nID) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_ISBUTTONCHECKED, nID, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_ISBUTTONCHECKED, nID, 0L); } BOOL IsButtonPressed(int nID) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_ISBUTTONPRESSED, nID, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_ISBUTTONPRESSED, nID, 0L); } BOOL IsButtonHidden(int nID) const { - ATLASSERT(::IsWindow(m_hWnd)); - return(BOOL) ::SendMessage(m_hWnd, TB_ISBUTTONHIDDEN, nID, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return(BOOL) ::SendMessage(this->m_hWnd, TB_ISBUTTONHIDDEN, nID, 0L); } BOOL IsButtonIndeterminate(int nID) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_ISBUTTONINDETERMINATE, nID, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_ISBUTTONINDETERMINATE, nID, 0L); } int GetState(int nID) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_GETSTATE, nID, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TB_GETSTATE, nID, 0L); } BOOL SetState(int nID, UINT nState) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETSTATE, nID, MAKELPARAM(nState, 0)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_SETSTATE, nID, MAKELPARAM(nState, 0)); } BOOL GetButton(int nIndex, LPTBBUTTON lpButton) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_GETBUTTON, nIndex, (LPARAM)lpButton); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_GETBUTTON, nIndex, (LPARAM)lpButton); } int GetButtonCount() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_BUTTONCOUNT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TB_BUTTONCOUNT, 0, 0L); } BOOL GetItemRect(int nIndex, LPRECT lpRect) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_GETITEMRECT, nIndex, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_GETITEMRECT, nIndex, (LPARAM)lpRect); } void SetButtonStructSize(int nSize = sizeof(TBBUTTON)) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_BUTTONSTRUCTSIZE, nSize, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TB_BUTTONSTRUCTSIZE, nSize, 0L); } BOOL SetButtonSize(SIZE size) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETBUTTONSIZE, 0, MAKELPARAM(size.cx, size.cy)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_SETBUTTONSIZE, 0, MAKELPARAM(size.cx, size.cy)); } BOOL SetButtonSize(int cx, int cy) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETBUTTONSIZE, 0, MAKELPARAM(cx, cy)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_SETBUTTONSIZE, 0, MAKELPARAM(cx, cy)); } BOOL SetBitmapSize(SIZE size) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETBITMAPSIZE, 0, MAKELPARAM(size.cx, size.cy)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_SETBITMAPSIZE, 0, MAKELPARAM(size.cx, size.cy)); } BOOL SetBitmapSize(int cx, int cy) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETBITMAPSIZE, 0, MAKELPARAM(cx, cy)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_SETBITMAPSIZE, 0, MAKELPARAM(cx, cy)); } -#ifndef _WIN32_WCE CToolTipCtrl GetToolTips() const { - ATLASSERT(::IsWindow(m_hWnd)); - return CToolTipCtrl((HWND)::SendMessage(m_hWnd, TB_GETTOOLTIPS, 0, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CToolTipCtrl((HWND)::SendMessage(this->m_hWnd, TB_GETTOOLTIPS, 0, 0L)); } void SetToolTips(HWND hWndToolTip) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_SETTOOLTIPS, (WPARAM)hWndToolTip, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TB_SETTOOLTIPS, (WPARAM)hWndToolTip, 0L); } -#endif // !_WIN32_WCE void SetNotifyWnd(HWND hWnd) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_SETPARENT, (WPARAM)hWnd, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TB_SETPARENT, (WPARAM)hWnd, 0L); } int GetRows() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_GETROWS, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TB_GETROWS, 0, 0L); } void SetRows(int nRows, BOOL bLarger, LPRECT lpRect) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_SETROWS, MAKELPARAM(nRows, bLarger), (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TB_SETROWS, MAKELPARAM(nRows, bLarger), (LPARAM)lpRect); } BOOL SetCmdID(int nIndex, UINT nID) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETCMDID, nIndex, nID); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_SETCMDID, nIndex, nID); } DWORD GetBitmapFlags() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TB_GETBITMAPFLAGS, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, TB_GETBITMAPFLAGS, 0, 0L); } int GetBitmap(int nID) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_GETBITMAP, nID, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TB_GETBITMAP, nID, 0L); } int GetButtonText(int nID, LPTSTR lpstrText) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_GETBUTTONTEXT, nID, (LPARAM)lpstrText); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TB_GETBUTTONTEXT, nID, (LPARAM)lpstrText); } // nIndex - IE5 or higher only CImageList GetImageList(int nIndex = 0) const { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_GETIMAGELIST, nIndex, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TB_GETIMAGELIST, nIndex, 0L)); } // nIndex - IE5 or higher only CImageList SetImageList(HIMAGELIST hImageList, int nIndex = 0) { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_SETIMAGELIST, nIndex, (LPARAM)hImageList)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TB_SETIMAGELIST, nIndex, (LPARAM)hImageList)); } // nIndex - IE5 or higher only CImageList GetDisabledImageList(int nIndex = 0) const { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_GETDISABLEDIMAGELIST, nIndex, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TB_GETDISABLEDIMAGELIST, nIndex, 0L)); } // nIndex - IE5 or higher only CImageList SetDisabledImageList(HIMAGELIST hImageList, int nIndex = 0) { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_SETDISABLEDIMAGELIST, nIndex, (LPARAM)hImageList)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TB_SETDISABLEDIMAGELIST, nIndex, (LPARAM)hImageList)); } -#ifndef _WIN32_WCE // nIndex - IE5 or higher only CImageList GetHotImageList(int nIndex = 0) const { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_GETHOTIMAGELIST, nIndex, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TB_GETHOTIMAGELIST, nIndex, 0L)); } // nIndex - IE5 or higher only CImageList SetHotImageList(HIMAGELIST hImageList, int nIndex = 0) { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_SETHOTIMAGELIST, nIndex, (LPARAM)hImageList)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TB_SETHOTIMAGELIST, nIndex, (LPARAM)hImageList)); } -#endif // !_WIN32_WCE DWORD GetStyle() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TB_GETSTYLE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, TB_GETSTYLE, 0, 0L); } void SetStyle(DWORD dwStyle) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_SETSTYLE, 0, dwStyle); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TB_SETSTYLE, 0, dwStyle); } DWORD GetButtonSize() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TB_GETBUTTONSIZE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, TB_GETBUTTONSIZE, 0, 0L); } void GetButtonSize(SIZE& size) const { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, TB_GETBUTTONSIZE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, TB_GETBUTTONSIZE, 0, 0L); size.cx = LOWORD(dwRet); size.cy = HIWORD(dwRet); } BOOL GetRect(int nID, LPRECT lpRect) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_GETRECT, nID, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_GETRECT, nID, (LPARAM)lpRect); } int GetTextRows() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_GETTEXTROWS, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TB_GETTEXTROWS, 0, 0L); } BOOL SetButtonWidth(int cxMin, int cxMax) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETBUTTONWIDTH, 0, MAKELPARAM(cxMin, cxMax)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_SETBUTTONWIDTH, 0, MAKELPARAM(cxMin, cxMax)); } BOOL SetIndent(int nIndent) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETINDENT, nIndent, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_SETINDENT, nIndent, 0L); } BOOL SetMaxTextRows(int nMaxTextRows) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETMAXTEXTROWS, nMaxTextRows, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_SETMAXTEXTROWS, nMaxTextRows, 0L); } -#if (_WIN32_IE >= 0x0400) -#ifndef _WIN32_WCE BOOL GetAnchorHighlight() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_GETANCHORHIGHLIGHT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_GETANCHORHIGHLIGHT, 0, 0L); } BOOL SetAnchorHighlight(BOOL bEnable = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETANCHORHIGHLIGHT, bEnable, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_SETANCHORHIGHLIGHT, bEnable, 0L); } -#endif // !_WIN32_WCE int GetButtonInfo(int nID, LPTBBUTTONINFO lptbbi) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_GETBUTTONINFO, nID, (LPARAM)lptbbi); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TB_GETBUTTONINFO, nID, (LPARAM)lptbbi); } BOOL SetButtonInfo(int nID, LPTBBUTTONINFO lptbbi) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETBUTTONINFO, nID, (LPARAM)lptbbi); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_SETBUTTONINFO, nID, (LPARAM)lptbbi); } BOOL SetButtonInfo(int nID, DWORD dwMask, BYTE Style, BYTE State, LPCTSTR lpszItem, int iImage, WORD cx, int iCommand, DWORD_PTR lParam) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); TBBUTTONINFO tbbi = { 0 }; tbbi.cbSize = sizeof(TBBUTTONINFO); tbbi.dwMask = dwMask; @@ -5573,103 +5372,100 @@ class CToolBarCtrlT : public TBase tbbi.cx = cx; tbbi.pszText = (LPTSTR) lpszItem; tbbi.lParam = lParam; - return (BOOL)::SendMessage(m_hWnd, TB_SETBUTTONINFO, nID, (LPARAM)&tbbi); + return (BOOL)::SendMessage(this->m_hWnd, TB_SETBUTTONINFO, nID, (LPARAM)&tbbi); } -#ifndef _WIN32_WCE int GetHotItem() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_GETHOTITEM, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TB_GETHOTITEM, 0, 0L); } int SetHotItem(int nItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_SETHOTITEM, nItem, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TB_SETHOTITEM, nItem, 0L); } -#endif // !_WIN32_WCE BOOL IsButtonHighlighted(int nButtonID) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_ISBUTTONHIGHLIGHTED, nButtonID, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_ISBUTTONHIGHLIGHTED, nButtonID, 0L); } DWORD SetDrawTextFlags(DWORD dwMask, DWORD dwFlags) { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TB_SETDRAWTEXTFLAGS, dwMask, dwFlags); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, TB_SETDRAWTEXTFLAGS, dwMask, dwFlags); } -#ifndef _WIN32_WCE BOOL GetColorScheme(LPCOLORSCHEME lpcs) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_GETCOLORSCHEME, 0, (LPARAM)lpcs); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_GETCOLORSCHEME, 0, (LPARAM)lpcs); } void SetColorScheme(LPCOLORSCHEME lpcs) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_SETCOLORSCHEME, 0, (LPARAM)lpcs); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TB_SETCOLORSCHEME, 0, (LPARAM)lpcs); } DWORD GetExtendedStyle() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TB_GETEXTENDEDSTYLE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, TB_GETEXTENDEDSTYLE, 0, 0L); } DWORD SetExtendedStyle(DWORD dwStyle) { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TB_SETEXTENDEDSTYLE, 0, dwStyle); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, TB_SETEXTENDEDSTYLE, 0, dwStyle); } void GetInsertMark(LPTBINSERTMARK lptbim) const { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_GETINSERTMARK, 0, (LPARAM)lptbim); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TB_GETINSERTMARK, 0, (LPARAM)lptbim); } void SetInsertMark(LPTBINSERTMARK lptbim) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_SETINSERTMARK, 0, (LPARAM)lptbim); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TB_SETINSERTMARK, 0, (LPARAM)lptbim); } COLORREF GetInsertMarkColor() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TB_GETINSERTMARKCOLOR, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, TB_GETINSERTMARKCOLOR, 0, 0L); } COLORREF SetInsertMarkColor(COLORREF clr) { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, TB_SETINSERTMARKCOLOR, 0, (LPARAM)clr); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, TB_SETINSERTMARKCOLOR, 0, (LPARAM)clr); } BOOL GetMaxSize(LPSIZE lpSize) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_GETMAXSIZE, 0, (LPARAM)lpSize); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_GETMAXSIZE, 0, (LPARAM)lpSize); } void GetPadding(LPSIZE lpSizePadding) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(lpSizePadding != NULL); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, TB_GETPADDING, 0, 0L); + DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, TB_GETPADDING, 0, 0L); lpSizePadding->cx = GET_X_LPARAM(dwRet); lpSizePadding->cy = GET_Y_LPARAM(dwRet); } void SetPadding(int cx, int cy, LPSIZE lpSizePadding = NULL) { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, TB_SETPADDING, 0, MAKELPARAM(cx, cy)); + ATLASSERT(::IsWindow(this->m_hWnd)); + DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, TB_SETPADDING, 0, MAKELPARAM(cx, cy)); if(lpSizePadding != NULL) { lpSizePadding->cx = GET_X_LPARAM(dwRet); @@ -5679,38 +5475,35 @@ class CToolBarCtrlT : public TBase BOOL GetUnicodeFormat() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_GETUNICODEFORMAT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_GETUNICODEFORMAT, 0, 0L); } BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_SETUNICODEFORMAT, bUnicode, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_SETUNICODEFORMAT, bUnicode, 0L); } -#endif // !_WIN32_WCE -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) int GetString(int nString, LPTSTR lpstrString, int cchMaxLen) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_GETSTRING, MAKEWPARAM(cchMaxLen, nString), (LPARAM)lpstrString); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TB_GETSTRING, MAKEWPARAM(cchMaxLen, nString), (LPARAM)lpstrString); } int GetStringBSTR(int nString, BSTR& bstrString) const { USES_CONVERSION; - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(bstrString == NULL); - int nLength = (int)(short)LOWORD(::SendMessage(m_hWnd, TB_GETSTRING, MAKEWPARAM(0, nString), NULL)); + int nLength = (int)(short)LOWORD(::SendMessage(this->m_hWnd, TB_GETSTRING, MAKEWPARAM(0, nString), NULL)); if(nLength != -1) { - CTempBuffer buff; + ATL::CTempBuffer buff; LPTSTR lpstrText = buff.Allocate(nLength + 1); if(lpstrText != NULL) { - nLength = (int)::SendMessage(m_hWnd, TB_GETSTRING, MAKEWPARAM(nLength + 1, nString), (LPARAM)lpstrText); + nLength = (int)::SendMessage(this->m_hWnd, TB_GETSTRING, MAKEWPARAM(nLength + 1, nString), (LPARAM)lpstrText); if(nLength != -1) bstrString = ::SysAllocString(T2OLE(lpstrText)); } @@ -5723,125 +5516,133 @@ class CToolBarCtrlT : public TBase return nLength; } -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - int GetString(int nString, _CSTRING_NS::CString& str) const +#ifdef __ATLSTR_H__ + int GetString(int nString, ATL::CString& str) const { - ATLASSERT(::IsWindow(m_hWnd)); - int nLength = (int)(short)LOWORD(::SendMessage(m_hWnd, TB_GETSTRING, MAKEWPARAM(0, nString), NULL)); + ATLASSERT(::IsWindow(this->m_hWnd)); + int nLength = (int)(short)LOWORD(::SendMessage(this->m_hWnd, TB_GETSTRING, MAKEWPARAM(0, nString), NULL)); if(nLength != -1) { LPTSTR lpstr = str.GetBufferSetLength(nLength + 1); if(lpstr != NULL) - nLength = (int)::SendMessage(m_hWnd, TB_GETSTRING, MAKEWPARAM(nLength + 1, nString), (LPARAM)lpstr); + nLength = (int)::SendMessage(this->m_hWnd, TB_GETSTRING, MAKEWPARAM(nLength + 1, nString), (LPARAM)lpstr); else nLength = -1; str.ReleaseBuffer(); } return nLength; } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) +#endif // __ATLSTR_H__ -#if (_WIN32_WINNT >= 0x0501) void GetMetrics(LPTBMETRICS lptbm) const { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_GETMETRICS, 0, (LPARAM)lptbm); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TB_GETMETRICS, 0, (LPARAM)lptbm); } void SetMetrics(LPTBMETRICS lptbm) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_SETMETRICS, 0, (LPARAM)lptbm); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TB_SETMETRICS, 0, (LPARAM)lptbm); } void SetWindowTheme(LPCWSTR lpstrTheme) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TB_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme); } -#endif // (_WIN32_WINNT >= 0x0501) #if (_WIN32_WINNT >= 0x0600) CImageList GetPressedImageList(int nIndex = 0) const { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_GETPRESSEDIMAGELIST, nIndex, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TB_GETPRESSEDIMAGELIST, nIndex, 0L)); } CImageList SetPressedImageList(HIMAGELIST hImageList, int nIndex = 0) { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TB_SETPRESSEDIMAGELIST, nIndex, (LPARAM)hImageList)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TB_SETPRESSEDIMAGELIST, nIndex, (LPARAM)hImageList)); + } + + void GetItemDropDownRect(int nIndex, LPRECT lpRect) const + { +#ifndef TB_GETITEMDROPDOWNRECT + const int TB_GETITEMDROPDOWNRECT = WM_USER + 103; +#endif + ATLASSERT(::IsWindow(this->m_hWnd)); + BOOL bRet = (BOOL)::SendMessage(this->m_hWnd, TB_GETITEMDROPDOWNRECT, nIndex, (LPARAM)lpRect); + bRet; // avoid level 4 warning + ATLASSERT(bRet != FALSE); } #endif // (_WIN32_WINNT >= 0x0600) // Operations BOOL EnableButton(int nID, BOOL bEnable = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_ENABLEBUTTON, nID, MAKELPARAM(bEnable, 0)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_ENABLEBUTTON, nID, MAKELPARAM(bEnable, 0)); } BOOL CheckButton(int nID, BOOL bCheck = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_CHECKBUTTON, nID, MAKELPARAM(bCheck, 0)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_CHECKBUTTON, nID, MAKELPARAM(bCheck, 0)); } BOOL PressButton(int nID, BOOL bPress = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_PRESSBUTTON, nID, MAKELPARAM(bPress, 0)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_PRESSBUTTON, nID, MAKELPARAM(bPress, 0)); } BOOL HideButton(int nID, BOOL bHide = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_HIDEBUTTON, nID, MAKELPARAM(bHide, 0)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_HIDEBUTTON, nID, MAKELPARAM(bHide, 0)); } BOOL Indeterminate(int nID, BOOL bIndeterminate = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_INDETERMINATE, nID, MAKELPARAM(bIndeterminate, 0)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_INDETERMINATE, nID, MAKELPARAM(bIndeterminate, 0)); } int AddBitmap(int nNumButtons, UINT nBitmapID) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); TBADDBITMAP tbab = { 0 }; tbab.hInst = ModuleHelper::GetResourceInstance(); ATLASSERT(tbab.hInst != NULL); tbab.nID = nBitmapID; - return (int)::SendMessage(m_hWnd, TB_ADDBITMAP, (WPARAM)nNumButtons, (LPARAM)&tbab); + return (int)::SendMessage(this->m_hWnd, TB_ADDBITMAP, (WPARAM)nNumButtons, (LPARAM)&tbab); } int AddBitmap(int nNumButtons, HBITMAP hBitmap) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); TBADDBITMAP tbab = { 0 }; tbab.hInst = NULL; tbab.nID = (UINT_PTR)hBitmap; - return (int)::SendMessage(m_hWnd, TB_ADDBITMAP, (WPARAM)nNumButtons, (LPARAM)&tbab); + return (int)::SendMessage(this->m_hWnd, TB_ADDBITMAP, (WPARAM)nNumButtons, (LPARAM)&tbab); } BOOL AddButtons(int nNumButtons, LPTBBUTTON lpButtons) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_ADDBUTTONS, nNumButtons, (LPARAM)lpButtons); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_ADDBUTTONS, nNumButtons, (LPARAM)lpButtons); } BOOL InsertButton(int nIndex, LPTBBUTTON lpButton) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_INSERTBUTTON, nIndex, (LPARAM)lpButton); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_INSERTBUTTON, nIndex, (LPARAM)lpButton); } BOOL InsertButton(int nIndex, int iCommand, BYTE Style, BYTE State, int iBitmap, INT_PTR iString, DWORD_PTR lParam) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); TBBUTTON tbb = { 0 }; tbb.fsStyle = Style; tbb.fsState = State; @@ -5849,7 +5650,7 @@ class CToolBarCtrlT : public TBase tbb.iBitmap = iBitmap; tbb.iString = iString; tbb.dwData = lParam; - return (BOOL)::SendMessage(m_hWnd, TB_INSERTBUTTON, nIndex, (LPARAM)&tbb); + return (BOOL)::SendMessage(this->m_hWnd, TB_INSERTBUTTON, nIndex, (LPARAM)&tbb); } BOOL InsertButton(int nIndex, int iCommand, BYTE Style, BYTE State, int iBitmap, @@ -5875,132 +5676,136 @@ class CToolBarCtrlT : public TBase BOOL DeleteButton(int nIndex) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_DELETEBUTTON, nIndex, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_DELETEBUTTON, nIndex, 0L); } - UINT CommandToIndex(UINT nID) const + BOOL InsertSeparator(int nIndex, int cxWidth = 8) { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, TB_COMMANDTOINDEX, nID, 0L); + return InsertButton(nIndex, 0, BTNS_SEP, 0, cxWidth, (INT_PTR)0, 0); + } + + BOOL AddSeparator(int cxWidth = 8) + { + return AddButton(0, BTNS_SEP, 0, cxWidth, (INT_PTR)0, 0); + } + + int CommandToIndex(UINT nID) const + { + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TB_COMMANDTOINDEX, nID, 0L); } -#ifndef _WIN32_WCE void SaveState(HKEY hKeyRoot, LPCTSTR lpszSubKey, LPCTSTR lpszValueName) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); TBSAVEPARAMS tbs = { 0 }; tbs.hkr = hKeyRoot; tbs.pszSubKey = lpszSubKey; tbs.pszValueName = lpszValueName; - ::SendMessage(m_hWnd, TB_SAVERESTORE, (WPARAM)TRUE, (LPARAM)&tbs); + ::SendMessage(this->m_hWnd, TB_SAVERESTORE, (WPARAM)TRUE, (LPARAM)&tbs); } void RestoreState(HKEY hKeyRoot, LPCTSTR lpszSubKey, LPCTSTR lpszValueName) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); TBSAVEPARAMS tbs = { 0 }; tbs.hkr = hKeyRoot; tbs.pszSubKey = lpszSubKey; tbs.pszValueName = lpszValueName; - ::SendMessage(m_hWnd, TB_SAVERESTORE, (WPARAM)FALSE, (LPARAM)&tbs); + ::SendMessage(this->m_hWnd, TB_SAVERESTORE, (WPARAM)FALSE, (LPARAM)&tbs); } void Customize() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_CUSTOMIZE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TB_CUSTOMIZE, 0, 0L); } -#endif // !_WIN32_WCE int AddString(UINT nStringID) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_ADDSTRING, (WPARAM)ModuleHelper::GetResourceInstance(), (LPARAM)nStringID); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TB_ADDSTRING, (WPARAM)ModuleHelper::GetResourceInstance(), (LPARAM)nStringID); } int AddStrings(LPCTSTR lpszStrings) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_ADDSTRING, 0, (LPARAM)lpszStrings); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TB_ADDSTRING, 0, (LPARAM)lpszStrings); } void AutoSize() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TB_AUTOSIZE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TB_AUTOSIZE, 0, 0L); } BOOL ChangeBitmap(int nID, int nBitmap) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_CHANGEBITMAP, nID, MAKELPARAM(nBitmap, 0)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_CHANGEBITMAP, nID, MAKELPARAM(nBitmap, 0)); } int LoadImages(int nBitmapID) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_LOADIMAGES, nBitmapID, (LPARAM)ModuleHelper::GetResourceInstance()); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TB_LOADIMAGES, nBitmapID, (LPARAM)ModuleHelper::GetResourceInstance()); } int LoadStdImages(int nBitmapID) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_LOADIMAGES, nBitmapID, (LPARAM)HINST_COMMCTRL); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TB_LOADIMAGES, nBitmapID, (LPARAM)HINST_COMMCTRL); } BOOL ReplaceBitmap(LPTBREPLACEBITMAP ptbrb) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_REPLACEBITMAP, 0, (LPARAM)ptbrb); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_REPLACEBITMAP, 0, (LPARAM)ptbrb); } -#if (_WIN32_IE >= 0x0400) int HitTest(LPPOINT lpPoint) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TB_HITTEST, 0, (LPARAM)lpPoint); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TB_HITTEST, 0, (LPARAM)lpPoint); } -#ifndef _WIN32_WCE BOOL InsertMarkHitTest(LPPOINT lpPoint, LPTBINSERTMARK lptbim) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_INSERTMARKHITTEST, (WPARAM)lpPoint, (LPARAM)lptbim); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_INSERTMARKHITTEST, (WPARAM)lpPoint, (LPARAM)lptbim); } BOOL InsertMarkHitTest(int x, int y, LPTBINSERTMARK lptbim) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); POINT pt = { x, y }; - return (BOOL)::SendMessage(m_hWnd, TB_INSERTMARKHITTEST, (WPARAM)&pt, (LPARAM)lptbim); + return (BOOL)::SendMessage(this->m_hWnd, TB_INSERTMARKHITTEST, (WPARAM)&pt, (LPARAM)lptbim); } BOOL MapAccelerator(TCHAR chAccel, int& nID) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_MAPACCELERATOR, (WPARAM)chAccel, (LPARAM)&nID); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_MAPACCELERATOR, (WPARAM)chAccel, (LPARAM)&nID); } BOOL MarkButton(int nID, BOOL bHighlight = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_MARKBUTTON, nID, MAKELPARAM(bHighlight, 0)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_MARKBUTTON, nID, MAKELPARAM(bHighlight, 0)); } BOOL MoveButton(int nOldPos, int nNewPos) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TB_MOVEBUTTON, nOldPos, nNewPos); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TB_MOVEBUTTON, nOldPos, nNewPos); } HRESULT GetObject(REFIID iid, LPVOID* ppvObject) { - ATLASSERT(::IsWindow(m_hWnd)); - return (HRESULT)::SendMessage(m_hWnd, TB_GETOBJECT, (WPARAM)&iid, (LPARAM)ppvObject); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HRESULT)::SendMessage(this->m_hWnd, TB_GETOBJECT, (WPARAM)&iid, (LPARAM)ppvObject); } -#endif // !_WIN32_WCE -#endif // (_WIN32_IE >= 0x0400) }; typedef CToolBarCtrlT CToolBarCtrl; @@ -6019,7 +5824,7 @@ class CStatusBarCtrlT : public TBase CStatusBarCtrlT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -6038,21 +5843,21 @@ class CStatusBarCtrlT : public TBase int GetParts(int nParts, int* pParts) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, SB_GETPARTS, nParts, (LPARAM)pParts); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, SB_GETPARTS, nParts, (LPARAM)pParts); } BOOL SetParts(int nParts, int* pWidths) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, SB_SETPARTS, nParts, (LPARAM)pWidths); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, SB_SETPARTS, nParts, (LPARAM)pWidths); } int GetTextLength(int nPane, int* pType = NULL) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(nPane < 256); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, SB_GETTEXTLENGTH, (WPARAM)nPane, 0L); + DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, SB_GETTEXTLENGTH, (WPARAM)nPane, 0L); if (pType != NULL) *pType = (int)(short)HIWORD(dwRet); return (int)(short)LOWORD(dwRet); @@ -6060,26 +5865,25 @@ class CStatusBarCtrlT : public TBase int GetText(int nPane, LPTSTR lpszText, int* pType = NULL) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(nPane < 256); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, SB_GETTEXT, (WPARAM)nPane, (LPARAM)lpszText); + DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, SB_GETTEXT, (WPARAM)nPane, (LPARAM)lpszText); if(pType != NULL) *pType = (int)(short)HIWORD(dwRet); return (int)(short)LOWORD(dwRet); } -#ifndef _ATL_NO_COM BOOL GetTextBSTR(int nPane, BSTR& bstrText, int* pType = NULL) const { USES_CONVERSION; - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(nPane < 256); ATLASSERT(bstrText == NULL); - int nLength = (int)(short)LOWORD(::SendMessage(m_hWnd, SB_GETTEXTLENGTH, (WPARAM)nPane, 0L)); + int nLength = (int)(short)LOWORD(::SendMessage(this->m_hWnd, SB_GETTEXTLENGTH, (WPARAM)nPane, 0L)); if(nLength == 0) return FALSE; - CTempBuffer buff; + ATL::CTempBuffer buff; LPTSTR lpstrText = buff.Allocate(nLength + 1); if(lpstrText == NULL) return FALSE; @@ -6090,14 +5894,13 @@ class CStatusBarCtrlT : public TBase bstrText = ::SysAllocString(T2OLE(lpstrText)); return (bstrText != NULL) ? TRUE : FALSE; } -#endif // !_ATL_NO_COM -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - int GetText(int nPane, _CSTRING_NS::CString& strText, int* pType = NULL) const +#ifdef __ATLSTR_H__ + int GetText(int nPane, ATL::CString& strText, int* pType = NULL) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(nPane < 256); - int nLength = (int)(short)LOWORD(::SendMessage(m_hWnd, SB_GETTEXTLENGTH, (WPARAM)nPane, 0L)); + int nLength = (int)(short)LOWORD(::SendMessage(this->m_hWnd, SB_GETTEXTLENGTH, (WPARAM)nPane, 0L)); if(nLength == 0) return 0; @@ -6106,33 +5909,33 @@ class CStatusBarCtrlT : public TBase return 0; return GetText(nPane, lpstr, pType); } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) +#endif // __ATLSTR_H__ BOOL SetText(int nPane, LPCTSTR lpszText, int nType = 0) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(nPane < 256); - return (BOOL)::SendMessage(m_hWnd, SB_SETTEXT, (nPane | nType), (LPARAM)lpszText); + return (BOOL)::SendMessage(this->m_hWnd, SB_SETTEXT, (nPane | nType), (LPARAM)lpszText); } BOOL GetRect(int nPane, LPRECT lpRect) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(nPane < 256); - return (BOOL)::SendMessage(m_hWnd, SB_GETRECT, nPane, (LPARAM)lpRect); + return (BOOL)::SendMessage(this->m_hWnd, SB_GETRECT, nPane, (LPARAM)lpRect); } BOOL GetBorders(int* pBorders) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, SB_GETBORDERS, 0, (LPARAM)pBorders); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, SB_GETBORDERS, 0, (LPARAM)pBorders); } BOOL GetBorders(int& nHorz, int& nVert, int& nSpacing) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); int borders[3] = { 0, 0, 0 }; - BOOL bResult = (BOOL)::SendMessage(m_hWnd, SB_GETBORDERS, 0, (LPARAM)&borders); + BOOL bResult = (BOOL)::SendMessage(this->m_hWnd, SB_GETBORDERS, 0, (LPARAM)&borders); if(bResult) { nHorz = borders[0]; @@ -6144,71 +5947,67 @@ class CStatusBarCtrlT : public TBase void SetMinHeight(int nMin) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, SB_SETMINHEIGHT, nMin, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, SB_SETMINHEIGHT, nMin, 0L); } BOOL SetSimple(BOOL bSimple = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, SB_SIMPLE, bSimple, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, SB_SIMPLE, bSimple, 0L); } BOOL IsSimple() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, SB_ISSIMPLE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, SB_ISSIMPLE, 0, 0L); } -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) BOOL GetUnicodeFormat() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, SB_GETUNICODEFORMAT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, SB_GETUNICODEFORMAT, 0, 0L); } BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, SB_SETUNICODEFORMAT, bUnicode, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, SB_SETUNICODEFORMAT, bUnicode, 0L); } void GetTipText(int nPane, LPTSTR lpstrText, int nSize) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(nPane < 256); - ::SendMessage(m_hWnd, SB_GETTIPTEXT, MAKEWPARAM(nPane, nSize), (LPARAM)lpstrText); + ::SendMessage(this->m_hWnd, SB_GETTIPTEXT, MAKEWPARAM(nPane, nSize), (LPARAM)lpstrText); } void SetTipText(int nPane, LPCTSTR lpstrText) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(nPane < 256); - ::SendMessage(m_hWnd, SB_SETTIPTEXT, nPane, (LPARAM)lpstrText); + ::SendMessage(this->m_hWnd, SB_SETTIPTEXT, nPane, (LPARAM)lpstrText); } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) -#if ((_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 0x0500)) COLORREF SetBkColor(COLORREF clrBk) { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, SB_SETBKCOLOR, 0, (LPARAM)clrBk); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, SB_SETBKCOLOR, 0, (LPARAM)clrBk); } HICON GetIcon(int nPane) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(nPane < 256); - return (HICON)::SendMessage(m_hWnd, SB_GETICON, nPane, 0L); + return (HICON)::SendMessage(this->m_hWnd, SB_GETICON, nPane, 0L); } BOOL SetIcon(int nPane, HICON hIcon) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(nPane < 256); - return (BOOL)::SendMessage(m_hWnd, SB_SETICON, nPane, (LPARAM)hIcon); + return (BOOL)::SendMessage(this->m_hWnd, SB_SETICON, nPane, (LPARAM)hIcon); } -#endif // ((_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 0x0500)) }; typedef CStatusBarCtrlT CStatusBarCtrl; @@ -6227,7 +6026,7 @@ class CTabCtrlT : public TBase CTabCtrlT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -6246,37 +6045,37 @@ class CTabCtrlT : public TBase CImageList GetImageList() const { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TCM_GETIMAGELIST, 0, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TCM_GETIMAGELIST, 0, 0L)); } CImageList SetImageList(HIMAGELIST hImageList) { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, TCM_SETIMAGELIST, 0, (LPARAM)hImageList)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TCM_SETIMAGELIST, 0, (LPARAM)hImageList)); } int GetItemCount() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TCM_GETITEMCOUNT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TCM_GETITEMCOUNT, 0, 0L); } BOOL GetItem(int nItem, LPTCITEM pTabCtrlItem) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TCM_GETITEM, nItem, (LPARAM)pTabCtrlItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TCM_GETITEM, nItem, (LPARAM)pTabCtrlItem); } BOOL SetItem(int nItem, LPTCITEM pTabCtrlItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TCM_SETITEM, nItem, (LPARAM)pTabCtrlItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TCM_SETITEM, nItem, (LPARAM)pTabCtrlItem); } int SetItem(int nItem, UINT mask, LPCTSTR lpszItem, DWORD dwState, DWORD dwStateMask, int iImage, LPARAM lParam) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); TCITEM tci = { 0 }; tci.mask = mask; tci.pszText = (LPTSTR) lpszItem; @@ -6284,145 +6083,145 @@ class CTabCtrlT : public TBase tci.dwStateMask = dwStateMask; tci.iImage = iImage; tci.lParam = lParam; - return (int)::SendMessage(m_hWnd, TCM_SETITEM, nItem, (LPARAM)&tci); + return (int)::SendMessage(this->m_hWnd, TCM_SETITEM, nItem, (LPARAM)&tci); } BOOL GetItemRect(int nItem, LPRECT lpRect) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TCM_GETITEMRECT, nItem, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TCM_GETITEMRECT, nItem, (LPARAM)lpRect); } int GetCurSel() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TCM_GETCURSEL, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TCM_GETCURSEL, 0, 0L); } int SetCurSel(int nItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TCM_SETCURSEL, nItem, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TCM_SETCURSEL, nItem, 0L); } SIZE SetItemSize(SIZE size) { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwSize = (DWORD)::SendMessage(m_hWnd, TCM_SETITEMSIZE, 0, MAKELPARAM(size.cx, size.cy)); + ATLASSERT(::IsWindow(this->m_hWnd)); + DWORD dwSize = (DWORD)::SendMessage(this->m_hWnd, TCM_SETITEMSIZE, 0, MAKELPARAM(size.cx, size.cy)); SIZE sizeRet = { GET_X_LPARAM(dwSize), GET_Y_LPARAM(dwSize) }; return sizeRet; } void SetItemSize(int cx, int cy) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TCM_SETITEMSIZE, 0, MAKELPARAM(cx, cy)); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TCM_SETITEMSIZE, 0, MAKELPARAM(cx, cy)); } void SetPadding(SIZE size) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TCM_SETPADDING, 0, MAKELPARAM(size.cx, size.cy)); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TCM_SETPADDING, 0, MAKELPARAM(size.cx, size.cy)); } int GetRowCount() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TCM_GETROWCOUNT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TCM_GETROWCOUNT, 0, 0L); } -#ifndef _WIN32_WCE - CToolTipCtrl GetTooltips() const + CToolTipCtrl GetToolTips() const { - ATLASSERT(::IsWindow(m_hWnd)); - return CToolTipCtrl((HWND)::SendMessage(m_hWnd, TCM_GETTOOLTIPS, 0, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CToolTipCtrl((HWND)::SendMessage(this->m_hWnd, TCM_GETTOOLTIPS, 0, 0L)); } - void SetTooltips(HWND hWndToolTip) + // this method is deprecated, please use GetToolTips + CToolTipCtrl GetTooltips() const { return GetToolTips(); } + + void SetToolTips(HWND hWndToolTip) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TCM_SETTOOLTIPS, (WPARAM)hWndToolTip, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TCM_SETTOOLTIPS, (WPARAM)hWndToolTip, 0L); } -#endif // !_WIN32_WCE + + // this method is deprecated, please use SetToolTips + void SetTooltips(HWND hWndToolTip) { SetToolTips(hWndToolTip); } int GetCurFocus() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TCM_GETCURFOCUS, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TCM_GETCURFOCUS, 0, 0L); } void SetCurFocus(int nItem) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TCM_SETCURFOCUS, nItem, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TCM_SETCURFOCUS, nItem, 0L); } BOOL SetItemExtra(int cbExtra) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(GetItemCount() == 0); // must be empty - return (BOOL)::SendMessage(m_hWnd, TCM_SETITEMEXTRA, cbExtra, 0L); + return (BOOL)::SendMessage(this->m_hWnd, TCM_SETITEMEXTRA, cbExtra, 0L); } int SetMinTabWidth(int nWidth = -1) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TCM_SETMINTABWIDTH, 0, nWidth); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TCM_SETMINTABWIDTH, 0, nWidth); } -#if (_WIN32_IE >= 0x0400) DWORD GetExtendedStyle() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TCM_GETEXTENDEDSTYLE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, TCM_GETEXTENDEDSTYLE, 0, 0L); } DWORD SetExtendedStyle(DWORD dwExMask, DWORD dwExStyle) { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, TCM_SETEXTENDEDSTYLE, dwExMask, dwExStyle); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, TCM_SETEXTENDEDSTYLE, dwExMask, dwExStyle); } -#ifndef _WIN32_WCE BOOL GetUnicodeFormat() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TCM_GETUNICODEFORMAT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TCM_GETUNICODEFORMAT, 0, 0L); } BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TCM_SETUNICODEFORMAT, bUnicode, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TCM_SETUNICODEFORMAT, bUnicode, 0L); } -#endif // !_WIN32_WCE -#endif // (_WIN32_IE >= 0x0400) // Operations int InsertItem(int nItem, LPTCITEM pTabCtrlItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TCM_INSERTITEM, nItem, (LPARAM)pTabCtrlItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TCM_INSERTITEM, nItem, (LPARAM)pTabCtrlItem); } int InsertItem(int nItem, UINT mask, LPCTSTR lpszItem, int iImage, LPARAM lParam) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); TCITEM tci = { 0 }; tci.mask = mask; tci.pszText = (LPTSTR) lpszItem; tci.iImage = iImage; tci.lParam = lParam; - return (int)::SendMessage(m_hWnd, TCM_INSERTITEM, nItem, (LPARAM)&tci); + return (int)::SendMessage(this->m_hWnd, TCM_INSERTITEM, nItem, (LPARAM)&tci); } int InsertItem(int nItem, LPCTSTR lpszItem) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); TCITEM tci = { 0 }; tci.mask = TCIF_TEXT; tci.pszText = (LPTSTR) lpszItem; - return (int)::SendMessage(m_hWnd, TCM_INSERTITEM, nItem, (LPARAM)&tci); + return (int)::SendMessage(this->m_hWnd, TCM_INSERTITEM, nItem, (LPARAM)&tci); } int AddItem(LPTCITEM pTabCtrlItem) @@ -6442,47 +6241,45 @@ class CTabCtrlT : public TBase BOOL DeleteItem(int nItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TCM_DELETEITEM, nItem, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TCM_DELETEITEM, nItem, 0L); } BOOL DeleteAllItems() { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TCM_DELETEALLITEMS, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TCM_DELETEALLITEMS, 0, 0L); } void AdjustRect(BOOL bLarger, LPRECT lpRect) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TCM_ADJUSTRECT, bLarger, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TCM_ADJUSTRECT, bLarger, (LPARAM)lpRect); } void RemoveImage(int nImage) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TCM_REMOVEIMAGE, nImage, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TCM_REMOVEIMAGE, nImage, 0L); } int HitTest(TC_HITTESTINFO* pHitTestInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TCM_HITTEST, 0, (LPARAM)pHitTestInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TCM_HITTEST, 0, (LPARAM)pHitTestInfo); } void DeselectAll(BOOL bExcludeFocus = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TCM_DESELECTALL, bExcludeFocus, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TCM_DESELECTALL, bExcludeFocus, 0L); } -#if (_WIN32_IE >= 0x0400) BOOL HighlightItem(int nIndex, BOOL bHighlight = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TCM_HIGHLIGHTITEM, nIndex, MAKELPARAM(bHighlight, 0)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TCM_HIGHLIGHTITEM, nIndex, MAKELPARAM(bHighlight, 0)); } -#endif // (_WIN32_IE >= 0x0400) }; typedef CTabCtrlT CTabCtrl; @@ -6501,7 +6298,7 @@ class CTrackBarCtrlT : public TBase CTrackBarCtrlT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -6520,50 +6317,50 @@ class CTrackBarCtrlT : public TBase int GetLineSize() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETLINESIZE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TBM_GETLINESIZE, 0, 0L); } int SetLineSize(int nSize) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_SETLINESIZE, 0, nSize); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TBM_SETLINESIZE, 0, nSize); } int GetPageSize() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETPAGESIZE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TBM_GETPAGESIZE, 0, 0L); } int SetPageSize(int nSize) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_SETPAGESIZE, 0, nSize); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TBM_SETPAGESIZE, 0, nSize); } int GetRangeMin() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETRANGEMIN, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TBM_GETRANGEMIN, 0, 0L); } void SetRangeMin(int nMin, BOOL bRedraw = FALSE) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETRANGEMIN, bRedraw, nMin); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TBM_SETRANGEMIN, bRedraw, nMin); } int GetRangeMax() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETRANGEMAX, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TBM_GETRANGEMAX, 0, 0L); } void SetRangeMax(int nMax, BOOL bRedraw = FALSE) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETRANGEMAX, bRedraw, nMax); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TBM_SETRANGEMAX, bRedraw, nMax); } void GetRange(int& nMin, int& nMax) const @@ -6574,32 +6371,32 @@ class CTrackBarCtrlT : public TBase void SetRange(int nMin, int nMax, BOOL bRedraw = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETRANGE, bRedraw, MAKELPARAM(nMin, nMax)); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TBM_SETRANGE, bRedraw, MAKELPARAM(nMin, nMax)); } int GetSelStart() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETSELSTART, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TBM_GETSELSTART, 0, 0L); } - void SetSelStart(int nMin) + void SetSelStart(int nMin, BOOL bRedraw = FALSE) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETSELSTART, 0, (LPARAM)nMin); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TBM_SETSELSTART, bRedraw, (LPARAM)nMin); } int GetSelEnd() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETSELEND, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TBM_GETSELEND, 0, 0L); } - void SetSelEnd(int nMax) + void SetSelEnd(int nMax, BOOL bRedraw = FALSE) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETSELEND, 0, (LPARAM)nMax); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TBM_SETSELEND, bRedraw, (LPARAM)nMax); } void GetSelection(int& nMin, int& nMax) const @@ -6608,154 +6405,150 @@ class CTrackBarCtrlT : public TBase nMax = GetSelEnd(); } - void SetSelection(int nMin, int nMax) + void SetSelection(int nMin, int nMax, BOOL bRedraw = TRUE) { - SetSelStart(nMin); - SetSelEnd(nMax); + SetSelStart(nMin, FALSE); + SetSelEnd(nMax, bRedraw); } void GetChannelRect(LPRECT lprc) const { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_GETCHANNELRECT, 0, (LPARAM)lprc); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TBM_GETCHANNELRECT, 0, (LPARAM)lprc); } void GetThumbRect(LPRECT lprc) const { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_GETTHUMBRECT, 0, (LPARAM)lprc); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TBM_GETTHUMBRECT, 0, (LPARAM)lprc); } int GetPos() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETPOS, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TBM_GETPOS, 0, 0L); } void SetPos(int nPos) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETPOS, TRUE, nPos); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TBM_SETPOS, TRUE, nPos); } UINT GetNumTics() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, TBM_GETNUMTICS, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UINT)::SendMessage(this->m_hWnd, TBM_GETNUMTICS, 0, 0L); } DWORD* GetTicArray() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD*)::SendMessage(m_hWnd, TBM_GETPTICS, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD*)::SendMessage(this->m_hWnd, TBM_GETPTICS, 0, 0L); } int GetTic(int nTic) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETTIC, nTic, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TBM_GETTIC, nTic, 0L); } BOOL SetTic(int nTic) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TBM_SETTIC, 0, nTic); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TBM_SETTIC, 0, nTic); } int GetTicPos(int nTic) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETTICPOS, nTic, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TBM_GETTICPOS, nTic, 0L); } void SetTicFreq(int nFreq) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETTICFREQ, nFreq, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TBM_SETTICFREQ, nFreq, 0L); } int GetThumbLength() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_GETTHUMBLENGTH, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TBM_GETTHUMBLENGTH, 0, 0L); } void SetThumbLength(int nLength) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETTHUMBLENGTH, nLength, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TBM_SETTHUMBLENGTH, nLength, 0L); } void SetSel(int nStart, int nEnd, BOOL bRedraw = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & TBS_ENABLESELRANGE) != 0); - ::SendMessage(m_hWnd, TBM_SETSEL, bRedraw, MAKELPARAM(nStart, nEnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & TBS_ENABLESELRANGE) != 0); + ::SendMessage(this->m_hWnd, TBM_SETSEL, bRedraw, MAKELPARAM(nStart, nEnd)); } ATL::CWindow GetBuddy(BOOL bLeft = TRUE) const { - ATLASSERT(::IsWindow(m_hWnd)); - return ATL::CWindow((HWND)::SendMessage(m_hWnd, TBM_GETBUDDY, bLeft, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return ATL::CWindow((HWND)::SendMessage(this->m_hWnd, TBM_GETBUDDY, bLeft, 0L)); } ATL::CWindow SetBuddy(HWND hWndBuddy, BOOL bLeft = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return ATL::CWindow((HWND)::SendMessage(m_hWnd, TBM_SETBUDDY, bLeft, (LPARAM)hWndBuddy)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return ATL::CWindow((HWND)::SendMessage(this->m_hWnd, TBM_SETBUDDY, bLeft, (LPARAM)hWndBuddy)); } -#ifndef _WIN32_WCE CToolTipCtrl GetToolTips() const { - ATLASSERT(::IsWindow(m_hWnd)); - return CToolTipCtrl((HWND)::SendMessage(m_hWnd, TBM_GETTOOLTIPS, 0, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CToolTipCtrl((HWND)::SendMessage(this->m_hWnd, TBM_GETTOOLTIPS, 0, 0L)); } void SetToolTips(HWND hWndTT) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETTOOLTIPS, (WPARAM)hWndTT, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TBM_SETTOOLTIPS, (WPARAM)hWndTT, 0L); } int SetTipSide(int nSide) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, TBM_SETTIPSIDE, nSide, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, TBM_SETTIPSIDE, nSide, 0L); } -#endif // !_WIN32_WCE -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) BOOL GetUnicodeFormat() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TBM_GETUNICODEFORMAT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TBM_GETUNICODEFORMAT, 0, 0L); } BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, TBM_SETUNICODEFORMAT, bUnicode, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, TBM_SETUNICODEFORMAT, bUnicode, 0L); } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) // Operations void ClearSel(BOOL bRedraw = FALSE) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_CLEARSEL, bRedraw, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TBM_CLEARSEL, bRedraw, 0L); } void VerifyPos() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_SETPOS, FALSE, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TBM_SETPOS, FALSE, 0L); } void ClearTics(BOOL bRedraw = FALSE) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, TBM_CLEARTICS, bRedraw, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, TBM_CLEARTICS, bRedraw, 0L); } }; @@ -6775,7 +6568,7 @@ class CUpDownCtrlT : public TBase CUpDownCtrlT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -6794,44 +6587,44 @@ class CUpDownCtrlT : public TBase UINT GetAccel(int nAccel, UDACCEL* pAccel) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)LOWORD(::SendMessage(m_hWnd, UDM_GETACCEL, nAccel, (LPARAM)pAccel)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UINT)LOWORD(::SendMessage(this->m_hWnd, UDM_GETACCEL, nAccel, (LPARAM)pAccel)); } BOOL SetAccel(int nAccel, UDACCEL* pAccel) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)LOWORD(::SendMessage(m_hWnd, UDM_SETACCEL, nAccel, (LPARAM)pAccel)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)LOWORD(::SendMessage(this->m_hWnd, UDM_SETACCEL, nAccel, (LPARAM)pAccel)); } UINT GetBase() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)LOWORD(::SendMessage(m_hWnd, UDM_GETBASE, 0, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UINT)LOWORD(::SendMessage(this->m_hWnd, UDM_GETBASE, 0, 0L)); } int SetBase(int nBase) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, UDM_SETBASE, nBase, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, UDM_SETBASE, nBase, 0L); } ATL::CWindow GetBuddy() const { - ATLASSERT(::IsWindow(m_hWnd)); - return ATL::CWindow((HWND)::SendMessage(m_hWnd, UDM_GETBUDDY, 0, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return ATL::CWindow((HWND)::SendMessage(this->m_hWnd, UDM_GETBUDDY, 0, 0L)); } ATL::CWindow SetBuddy(HWND hWndBuddy) { - ATLASSERT(::IsWindow(m_hWnd)); - return ATL::CWindow((HWND)::SendMessage(m_hWnd, UDM_SETBUDDY, (WPARAM)hWndBuddy, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return ATL::CWindow((HWND)::SendMessage(this->m_hWnd, UDM_SETBUDDY, (WPARAM)hWndBuddy, 0L)); } int GetPos(LPBOOL lpbError = NULL) const { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, UDM_GETPOS, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, UDM_GETPOS, 0, 0L); // Note: Seems that Windows always sets error to TRUE if // UDS_SETBUDDYINT style is not used if(lpbError != NULL) @@ -6841,73 +6634,67 @@ class CUpDownCtrlT : public TBase int SetPos(int nPos) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)(short)LOWORD(::SendMessage(m_hWnd, UDM_SETPOS, 0, MAKELPARAM(nPos, 0))); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)(short)LOWORD(::SendMessage(this->m_hWnd, UDM_SETPOS, 0, MAKELPARAM(nPos, 0))); } DWORD GetRange() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, UDM_GETRANGE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, UDM_GETRANGE, 0, 0L); } void GetRange(int& nLower, int& nUpper) const { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, UDM_GETRANGE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, UDM_GETRANGE, 0, 0L); nLower = (int)(short)HIWORD(dwRet); nUpper = (int)(short)LOWORD(dwRet); } void SetRange(int nLower, int nUpper) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, UDM_SETRANGE, 0, MAKELPARAM(nUpper, nLower)); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, UDM_SETRANGE, 0, MAKELPARAM(nUpper, nLower)); } -#if (_WIN32_IE >= 0x0400) void SetRange32(int nLower, int nUpper) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, UDM_SETRANGE32, nLower, nUpper); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, UDM_SETRANGE32, nLower, nUpper); } void GetRange32(int& nLower, int& nUpper) const { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, UDM_GETRANGE32, (WPARAM)&nLower, (LPARAM)&nUpper); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, UDM_GETRANGE32, (WPARAM)&nLower, (LPARAM)&nUpper); } -#ifndef _WIN32_WCE BOOL GetUnicodeFormat() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, UDM_GETUNICODEFORMAT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, UDM_GETUNICODEFORMAT, 0, 0L); } BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, UDM_SETUNICODEFORMAT, bUnicode, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, UDM_SETUNICODEFORMAT, bUnicode, 0L); } -#endif // !_WIN32_WCE -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) int GetPos32(LPBOOL lpbError = NULL) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); // Note: Seems that Windows always sets error to TRUE if // UDS_SETBUDDYINT style is not used - return (int)::SendMessage(m_hWnd, UDM_GETPOS32, 0, (LPARAM)lpbError); + return (int)::SendMessage(this->m_hWnd, UDM_GETPOS32, 0, (LPARAM)lpbError); } int SetPos32(int nPos) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, UDM_SETPOS32, 0, (LPARAM)nPos); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, UDM_SETPOS32, 0, (LPARAM)nPos); } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) }; typedef CUpDownCtrlT CUpDownCtrl; @@ -6926,7 +6713,7 @@ class CProgressBarCtrlT : public TBase CProgressBarCtrlT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -6945,121 +6732,119 @@ class CProgressBarCtrlT : public TBase DWORD SetRange(int nLower, int nUpper) { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, PBM_SETRANGE, 0, MAKELPARAM(nLower, nUpper)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, PBM_SETRANGE, 0, MAKELPARAM(nLower, nUpper)); } int SetPos(int nPos) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)(short)LOWORD(::SendMessage(m_hWnd, PBM_SETPOS, nPos, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)(short)LOWORD(::SendMessage(this->m_hWnd, PBM_SETPOS, nPos, 0L)); } int OffsetPos(int nPos) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)(short)LOWORD(::SendMessage(m_hWnd, PBM_DELTAPOS, nPos, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)(short)LOWORD(::SendMessage(this->m_hWnd, PBM_DELTAPOS, nPos, 0L)); } int SetStep(int nStep) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)(short)LOWORD(::SendMessage(m_hWnd, PBM_SETSTEP, nStep, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)(short)LOWORD(::SendMessage(this->m_hWnd, PBM_SETSTEP, nStep, 0L)); } UINT GetPos() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, PBM_GETPOS, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UINT)::SendMessage(this->m_hWnd, PBM_GETPOS, 0, 0L); } void GetRange(PPBRANGE pPBRange) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(pPBRange != NULL); - ::SendMessage(m_hWnd, PBM_GETRANGE, TRUE, (LPARAM)pPBRange); + ::SendMessage(this->m_hWnd, PBM_GETRANGE, TRUE, (LPARAM)pPBRange); } void GetRange(int& nLower, int& nUpper) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); PBRANGE range = { 0 }; - ::SendMessage(m_hWnd, PBM_GETRANGE, TRUE, (LPARAM)&range); + ::SendMessage(this->m_hWnd, PBM_GETRANGE, TRUE, (LPARAM)&range); nLower = range.iLow; nUpper = range.iHigh; } int GetRangeLimit(BOOL bLowLimit) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PBM_GETRANGE, bLowLimit, (LPARAM)NULL); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, PBM_GETRANGE, bLowLimit, (LPARAM)NULL); } DWORD SetRange32(int nMin, int nMax) { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, PBM_SETRANGE32, nMin, nMax); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, PBM_SETRANGE32, nMin, nMax); } -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) COLORREF SetBarColor(COLORREF clr) { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, PBM_SETBARCOLOR, 0, (LPARAM)clr); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, PBM_SETBARCOLOR, 0, (LPARAM)clr); } COLORREF SetBkColor(COLORREF clr) { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, PBM_SETBKCOLOR, 0, (LPARAM)clr); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, PBM_SETBKCOLOR, 0, (LPARAM)clr); } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) -#if (_WIN32_WINNT >= 0x0501) && defined(PBM_SETMARQUEE) +#ifdef PBM_SETMARQUEE BOOL SetMarquee(BOOL bMarquee, UINT uUpdateTime = 0U) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, PBM_SETMARQUEE, (WPARAM)bMarquee, (LPARAM)uUpdateTime); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, PBM_SETMARQUEE, (WPARAM)bMarquee, (LPARAM)uUpdateTime); } -#endif // (_WIN32_WINNT >= 0x0501) && defined(PBM_SETMARQUEE) +#endif #if (_WIN32_WINNT >= 0x0600) int GetStep() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PBM_GETSTEP, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, PBM_GETSTEP, 0, 0L); } COLORREF GetBkColor() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, PBM_GETBKCOLOR, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, PBM_GETBKCOLOR, 0, 0L); } COLORREF GetBarColor() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, PBM_GETBARCOLOR, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, PBM_GETBARCOLOR, 0, 0L); } int GetState() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PBM_GETSTATE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, PBM_GETSTATE, 0, 0L); } int SetState(int nState) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PBM_SETSTATE, nState, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, PBM_SETSTATE, nState, 0L); } #endif // (_WIN32_WINNT >= 0x0600) // Operations int StepIt() { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)(short)LOWORD(::SendMessage(m_hWnd, PBM_STEPIT, 0, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)(short)LOWORD(::SendMessage(this->m_hWnd, PBM_STEPIT, 0, 0L)); } }; @@ -7069,8 +6854,6 @@ typedef CProgressBarCtrlT CProgressBarCtrl; /////////////////////////////////////////////////////////////////////////////// // CHotKeyCtrl -#ifndef _WIN32_WCE - template class CHotKeyCtrlT : public TBase { @@ -7081,7 +6864,7 @@ class CHotKeyCtrlT : public TBase CHotKeyCtrlT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -7100,41 +6883,37 @@ class CHotKeyCtrlT : public TBase DWORD GetHotKey() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, HKM_GETHOTKEY, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, HKM_GETHOTKEY, 0, 0L); } void GetHotKey(WORD &wVirtualKeyCode, WORD &wModifiers) const { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dw = (DWORD)::SendMessage(m_hWnd, HKM_GETHOTKEY, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + DWORD dw = (DWORD)::SendMessage(this->m_hWnd, HKM_GETHOTKEY, 0, 0L); wVirtualKeyCode = LOBYTE(LOWORD(dw)); wModifiers = HIBYTE(LOWORD(dw)); } void SetHotKey(WORD wVirtualKeyCode, WORD wModifiers) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, HKM_SETHOTKEY, MAKEWORD(wVirtualKeyCode, wModifiers), 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, HKM_SETHOTKEY, MAKEWORD(wVirtualKeyCode, wModifiers), 0L); } void SetRules(WORD wInvalidComb, WORD wModifiers) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, HKM_SETRULES, wInvalidComb, MAKELPARAM(wModifiers, 0)); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, HKM_SETRULES, wInvalidComb, MAKELPARAM(wModifiers, 0)); } }; typedef CHotKeyCtrlT CHotKeyCtrl; -#endif // !_WIN32_WCE - /////////////////////////////////////////////////////////////////////////////// // CAnimateCtrl -#ifndef _WIN32_WCE - template class CAnimateCtrlT : public TBase { @@ -7145,7 +6924,7 @@ class CAnimateCtrlT : public TBase CAnimateCtrlT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -7165,61 +6944,52 @@ class CAnimateCtrlT : public TBase // Operations BOOL Open(ATL::_U_STRINGorID FileName) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, ACM_OPEN, 0, (LPARAM)FileName.m_lpstr); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, ACM_OPEN, 0, (LPARAM)FileName.m_lpstr); } BOOL Play(UINT nFrom, UINT nTo, UINT nRep) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, ACM_PLAY, nRep, MAKELPARAM(nFrom, nTo)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, ACM_PLAY, nRep, MAKELPARAM(nFrom, nTo)); } BOOL Stop() { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, ACM_STOP, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, ACM_STOP, 0, 0L); } BOOL Close() { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, ACM_OPEN, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, ACM_OPEN, 0, 0L); } BOOL Seek(UINT nTo) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, ACM_PLAY, 0, MAKELPARAM(nTo, nTo)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, ACM_PLAY, 0, MAKELPARAM(nTo, nTo)); } // Vista only BOOL IsPlaying() const { -#ifndef ACM_ISPLAYING - const UINT ACM_ISPLAYING = (WM_USER+104); -#endif - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, ACM_ISPLAYING, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, ACM_ISPLAYING, 0, 0L); } }; typedef CAnimateCtrlT CAnimateCtrl; -#endif // !_WIN32_WCE - /////////////////////////////////////////////////////////////////////////////// // CRichEditCtrl -#ifndef _WIN32_WCE - -#ifdef _UNICODE -#if (_RICHEDIT_VER == 0x0100) -#undef RICHEDIT_CLASS -#define RICHEDIT_CLASS L"RICHEDIT" -#endif // (_RICHEDIT_VER == 0x0100) -#endif // _UNICODE +#if !defined(_UNICODE) && (_RICHEDIT_VER >= 0x0500) + #undef MSFTEDIT_CLASS + #define MSFTEDIT_CLASS "RICHEDIT50W" +#endif template class CRichEditCtrlT : public TBase @@ -7231,7 +7001,7 @@ class CRichEditCtrlT : public TBase CRichEditCtrlT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -7245,106 +7015,110 @@ class CRichEditCtrlT : public TBase // Attributes static LPCTSTR GetWndClassName() { +#if (_RICHEDIT_VER >= 0x0500) + return MSFTEDIT_CLASS; +#else return RICHEDIT_CLASS; +#endif } static LPCTSTR GetLibraryName() { -#if (_RICHEDIT_VER >= 0x0200) - return _T("RICHED20.DLL"); +#if (_RICHEDIT_VER >= 0x0500) + return _T("MSFTEDIT.DLL"); #else - return _T("RICHED32.DLL"); + return _T("RICHED20.DLL"); #endif } int GetLineCount() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETLINECOUNT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, EM_GETLINECOUNT, 0, 0L); } BOOL GetModify() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_GETMODIFY, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_GETMODIFY, 0, 0L); } void SetModify(BOOL bModified = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETMODIFY, bModified, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_SETMODIFY, bModified, 0L); } void GetRect(LPRECT lpRect) const { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_GETRECT, 0, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_GETRECT, 0, (LPARAM)lpRect); } DWORD GetOptions() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, EM_GETOPTIONS, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, EM_GETOPTIONS, 0, 0L); } DWORD SetOptions(WORD wOperation, DWORD dwOptions) { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, EM_SETOPTIONS, wOperation, dwOptions); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, EM_SETOPTIONS, wOperation, dwOptions); } // NOTE: first word in lpszBuffer must contain the size of the buffer! int GetLine(int nIndex, LPTSTR lpszBuffer) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); } int GetLine(int nIndex, LPTSTR lpszBuffer, int nMaxLength) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); *(LPWORD)lpszBuffer = (WORD)nMaxLength; - return (int)::SendMessage(m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); + return (int)::SendMessage(this->m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); } BOOL CanUndo() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_CANUNDO, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_CANUNDO, 0, 0L); } BOOL CanPaste(UINT nFormat = 0) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_CANPASTE, nFormat, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_CANPASTE, nFormat, 0L); } void GetSel(LONG& nStartChar, LONG& nEndChar) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); CHARRANGE cr = { 0, 0 }; - ::SendMessage(m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr); + ::SendMessage(this->m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr); nStartChar = cr.cpMin; nEndChar = cr.cpMax; } void GetSel(CHARRANGE &cr) const { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr); } int SetSel(LONG nStartChar, LONG nEndChar) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); CHARRANGE cr = { nStartChar, nEndChar }; - return (int)::SendMessage(m_hWnd, EM_EXSETSEL, 0, (LPARAM)&cr); + return (int)::SendMessage(this->m_hWnd, EM_EXSETSEL, 0, (LPARAM)&cr); } int SetSel(CHARRANGE &cr) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_EXSETSEL, 0, (LPARAM)&cr); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, EM_EXSETSEL, 0, (LPARAM)&cr); } int SetSelAll() @@ -7359,340 +7133,279 @@ class CRichEditCtrlT : public TBase DWORD GetDefaultCharFormat(CHARFORMAT& cf) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); cf.cbSize = sizeof(CHARFORMAT); - return (DWORD)::SendMessage(m_hWnd, EM_GETCHARFORMAT, 0, (LPARAM)&cf); + return (DWORD)::SendMessage(this->m_hWnd, EM_GETCHARFORMAT, 0, (LPARAM)&cf); } DWORD GetSelectionCharFormat(CHARFORMAT& cf) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); cf.cbSize = sizeof(CHARFORMAT); - return (DWORD)::SendMessage(m_hWnd, EM_GETCHARFORMAT, 1, (LPARAM)&cf); + return (DWORD)::SendMessage(this->m_hWnd, EM_GETCHARFORMAT, 1, (LPARAM)&cf); } DWORD GetEventMask() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, EM_GETEVENTMASK, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, EM_GETEVENTMASK, 0, 0L); } LONG GetLimitText() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_GETLIMITTEXT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (LONG)::SendMessage(this->m_hWnd, EM_GETLIMITTEXT, 0, 0L); } DWORD GetParaFormat(PARAFORMAT& pf) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); pf.cbSize = sizeof(PARAFORMAT); - return (DWORD)::SendMessage(m_hWnd, EM_GETPARAFORMAT, 0, (LPARAM)&pf); + return (DWORD)::SendMessage(this->m_hWnd, EM_GETPARAFORMAT, 0, (LPARAM)&pf); } -#if (_RICHEDIT_VER >= 0x0200) LONG GetSelText(LPTSTR lpstrBuff) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrBuff); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (LONG)::SendMessage(this->m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrBuff); } -#else // !(_RICHEDIT_VER >= 0x0200) - // RichEdit 1.0 EM_GETSELTEXT is ANSI only - LONG GetSelText(LPSTR lpstrBuff) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrBuff); - } -#endif // !(_RICHEDIT_VER >= 0x0200) -#ifndef _ATL_NO_COM BOOL GetSelTextBSTR(BSTR& bstrText) const { USES_CONVERSION; - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(bstrText == NULL); CHARRANGE cr = { 0, 0 }; - ::SendMessage(m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr); + ::SendMessage(this->m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr); -#if (_RICHEDIT_VER >= 0x0200) - CTempBuffer buff; + ATL::CTempBuffer buff; LPTSTR lpstrText = buff.Allocate(cr.cpMax - cr.cpMin + 1); if(lpstrText == NULL) return FALSE; - if(::SendMessage(m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrText) == 0) + if(::SendMessage(this->m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrText) == 0) return FALSE; bstrText = ::SysAllocString(T2W(lpstrText)); -#else // !(_RICHEDIT_VER >= 0x0200) - CTempBuffer buff; - LPSTR lpstrText = buff.Allocate(cr.cpMax - cr.cpMin + 1); - if(lpstrText == NULL) - return FALSE; - if(::SendMessage(m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrText) == 0) - return FALSE; - - bstrText = ::SysAllocString(A2W(lpstrText)); -#endif // !(_RICHEDIT_VER >= 0x0200) return (bstrText != NULL) ? TRUE : FALSE; } -#endif // !_ATL_NO_COM -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - LONG GetSelText(_CSTRING_NS::CString& strText) const +#ifdef __ATLSTR_H__ + LONG GetSelText(ATL::CString& strText) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); CHARRANGE cr = { 0, 0 }; - ::SendMessage(m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr); + ::SendMessage(this->m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr); -#if (_RICHEDIT_VER >= 0x0200) LONG lLen = 0; LPTSTR lpstrText = strText.GetBufferSetLength(cr.cpMax - cr.cpMin); if(lpstrText != NULL) { - lLen = (LONG)::SendMessage(m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrText); + lLen = (LONG)::SendMessage(this->m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrText); strText.ReleaseBuffer(); } -#else // !(_RICHEDIT_VER >= 0x0200) - CTempBuffer buff; - LPSTR lpstrText = buff.Allocate(cr.cpMax - cr.cpMin + 1); - if(lpstrText == NULL) - return 0; - LONG lLen = (LONG)::SendMessage(m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrText); - if(lLen == 0) - return 0; - - USES_CONVERSION; - strText = A2T(lpstrText); -#endif // !(_RICHEDIT_VER >= 0x0200) return lLen; } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) +#endif // __ATLSTR_H__ WORD GetSelectionType() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (WORD)::SendMessage(m_hWnd, EM_SELECTIONTYPE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (WORD)::SendMessage(this->m_hWnd, EM_SELECTIONTYPE, 0, 0L); } COLORREF SetBackgroundColor(COLORREF cr) { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, EM_SETBKGNDCOLOR, 0, cr); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, EM_SETBKGNDCOLOR, 0, cr); } COLORREF SetBackgroundColor() // sets to system background { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, EM_SETBKGNDCOLOR, 1, 0); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, EM_SETBKGNDCOLOR, 1, 0); } BOOL SetCharFormat(CHARFORMAT& cf, WORD wFlags) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); cf.cbSize = sizeof(CHARFORMAT); - return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, (WPARAM)wFlags, (LPARAM)&cf); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETCHARFORMAT, (WPARAM)wFlags, (LPARAM)&cf); } BOOL SetDefaultCharFormat(CHARFORMAT& cf) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); cf.cbSize = sizeof(CHARFORMAT); - return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, 0, (LPARAM)&cf); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETCHARFORMAT, 0, (LPARAM)&cf); } BOOL SetSelectionCharFormat(CHARFORMAT& cf) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); cf.cbSize = sizeof(CHARFORMAT); - return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); } BOOL SetWordCharFormat(CHARFORMAT& cf) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); cf.cbSize = sizeof(CHARFORMAT); - return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, SCF_SELECTION | SCF_WORD, (LPARAM)&cf); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETCHARFORMAT, SCF_SELECTION | SCF_WORD, (LPARAM)&cf); } DWORD SetEventMask(DWORD dwEventMask) { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, EM_SETEVENTMASK, 0, dwEventMask); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, EM_SETEVENTMASK, 0, dwEventMask); } BOOL SetParaFormat(PARAFORMAT& pf) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); pf.cbSize = sizeof(PARAFORMAT); - return (BOOL)::SendMessage(m_hWnd, EM_SETPARAFORMAT, 0, (LPARAM)&pf); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETPARAFORMAT, 0, (LPARAM)&pf); } BOOL SetTargetDevice(HDC hDC, int cxLineWidth) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETTARGETDEVICE, (WPARAM)hDC, cxLineWidth); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETTARGETDEVICE, (WPARAM)hDC, cxLineWidth); } int GetTextLength() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, WM_GETTEXTLENGTH, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, WM_GETTEXTLENGTH, 0, 0L); } BOOL SetReadOnly(BOOL bReadOnly = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETREADONLY, bReadOnly, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETREADONLY, bReadOnly, 0L); } int GetFirstVisibleLine() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETFIRSTVISIBLELINE, 0, 0L); - } - - EDITWORDBREAKPROCEX GetWordBreakProcEx() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (EDITWORDBREAKPROCEX)::SendMessage(m_hWnd, EM_GETWORDBREAKPROCEX, 0, 0L); - } - - EDITWORDBREAKPROCEX SetWordBreakProcEx(EDITWORDBREAKPROCEX pfnEditWordBreakProcEx) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (EDITWORDBREAKPROCEX)::SendMessage(m_hWnd, EM_SETWORDBREAKPROCEX, 0, (LPARAM)pfnEditWordBreakProcEx); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, EM_GETFIRSTVISIBLELINE, 0, 0L); } int GetTextRange(TEXTRANGE* pTextRange) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETTEXTRANGE, 0, (LPARAM)pTextRange); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, EM_GETTEXTRANGE, 0, (LPARAM)pTextRange); } -#if (_RICHEDIT_VER >= 0x0200) int GetTextRange(LONG nStartChar, LONG nEndChar, LPTSTR lpstrText) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); TEXTRANGE tr = { 0 }; tr.chrg.cpMin = nStartChar; tr.chrg.cpMax = nEndChar; tr.lpstrText = lpstrText; - return (int)::SendMessage(m_hWnd, EM_GETTEXTRANGE, 0, (LPARAM)&tr); + return (int)::SendMessage(this->m_hWnd, EM_GETTEXTRANGE, 0, (LPARAM)&tr); } -#else // !(_RICHEDIT_VER >= 0x0200) - int GetTextRange(LONG nStartChar, LONG nEndChar, LPSTR lpstrText) const - { - ATLASSERT(::IsWindow(m_hWnd)); - TEXTRANGE tr = { 0 }; - tr.chrg.cpMin = nStartChar; - tr.chrg.cpMax = nEndChar; - tr.lpstrText = lpstrText; - return (int)::SendMessage(m_hWnd, EM_GETTEXTRANGE, 0, (LPARAM)&tr); - } -#endif // !(_RICHEDIT_VER >= 0x0200) - -#if (_RICHEDIT_VER >= 0x0200) DWORD GetDefaultCharFormat(CHARFORMAT2& cf) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); cf.cbSize = sizeof(CHARFORMAT2); - return (DWORD)::SendMessage(m_hWnd, EM_GETCHARFORMAT, 0, (LPARAM)&cf); + return (DWORD)::SendMessage(this->m_hWnd, EM_GETCHARFORMAT, 0, (LPARAM)&cf); } BOOL SetCharFormat(CHARFORMAT2& cf, WORD wFlags) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); cf.cbSize = sizeof(CHARFORMAT2); - return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, (WPARAM)wFlags, (LPARAM)&cf); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETCHARFORMAT, (WPARAM)wFlags, (LPARAM)&cf); } BOOL SetDefaultCharFormat(CHARFORMAT2& cf) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); cf.cbSize = sizeof(CHARFORMAT2); - return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, 0, (LPARAM)&cf); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETCHARFORMAT, 0, (LPARAM)&cf); } DWORD GetSelectionCharFormat(CHARFORMAT2& cf) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); cf.cbSize = sizeof(CHARFORMAT2); - return (DWORD)::SendMessage(m_hWnd, EM_GETCHARFORMAT, 1, (LPARAM)&cf); + return (DWORD)::SendMessage(this->m_hWnd, EM_GETCHARFORMAT, 1, (LPARAM)&cf); } BOOL SetSelectionCharFormat(CHARFORMAT2& cf) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); cf.cbSize = sizeof(CHARFORMAT2); - return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); } BOOL SetWordCharFormat(CHARFORMAT2& cf) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); cf.cbSize = sizeof(CHARFORMAT2); - return (BOOL)::SendMessage(m_hWnd, EM_SETCHARFORMAT, SCF_SELECTION | SCF_WORD, (LPARAM)&cf); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETCHARFORMAT, SCF_SELECTION | SCF_WORD, (LPARAM)&cf); } DWORD GetParaFormat(PARAFORMAT2& pf) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); pf.cbSize = sizeof(PARAFORMAT2); - return (DWORD)::SendMessage(m_hWnd, EM_GETPARAFORMAT, 0, (LPARAM)&pf); + return (DWORD)::SendMessage(this->m_hWnd, EM_GETPARAFORMAT, 0, (LPARAM)&pf); } BOOL SetParaFormat(PARAFORMAT2& pf) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); pf.cbSize = sizeof(PARAFORMAT2); - return (BOOL)::SendMessage(m_hWnd, EM_SETPARAFORMAT, 0, (LPARAM)&pf); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETPARAFORMAT, 0, (LPARAM)&pf); } TEXTMODE GetTextMode() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (TEXTMODE)::SendMessage(m_hWnd, EM_GETTEXTMODE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (TEXTMODE)::SendMessage(this->m_hWnd, EM_GETTEXTMODE, 0, 0L); } BOOL SetTextMode(TEXTMODE enumTextMode) { - ATLASSERT(::IsWindow(m_hWnd)); - return !(BOOL)::SendMessage(m_hWnd, EM_SETTEXTMODE, enumTextMode, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return !(BOOL)::SendMessage(this->m_hWnd, EM_SETTEXTMODE, enumTextMode, 0L); } UNDONAMEID GetUndoName() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (UNDONAMEID)::SendMessage(m_hWnd, EM_GETUNDONAME, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UNDONAMEID)::SendMessage(this->m_hWnd, EM_GETUNDONAME, 0, 0L); } UNDONAMEID GetRedoName() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (UNDONAMEID)::SendMessage(m_hWnd, EM_GETREDONAME, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UNDONAMEID)::SendMessage(this->m_hWnd, EM_GETREDONAME, 0, 0L); } BOOL CanRedo() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_CANREDO, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_CANREDO, 0, 0L); } BOOL GetAutoURLDetect() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_GETAUTOURLDETECT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_GETAUTOURLDETECT, 0, 0L); } BOOL SetAutoURLDetect(BOOL bAutoDetect = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return !(BOOL)::SendMessage(m_hWnd, EM_AUTOURLDETECT, bAutoDetect, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return !(BOOL)::SendMessage(this->m_hWnd, EM_AUTOURLDETECT, bAutoDetect, 0L); } // this method is deprecated, please use SetAutoURLDetect @@ -7700,266 +7413,281 @@ class CRichEditCtrlT : public TBase UINT SetUndoLimit(UINT uUndoLimit) { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_SETUNDOLIMIT, uUndoLimit, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UINT)::SendMessage(this->m_hWnd, EM_SETUNDOLIMIT, uUndoLimit, 0L); } void SetPalette(HPALETTE hPalette) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETPALETTE, (WPARAM)hPalette, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_SETPALETTE, (WPARAM)hPalette, 0L); } int GetTextEx(GETTEXTEX* pGetTextEx, LPTSTR lpstrText) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETTEXTEX, (WPARAM)pGetTextEx, (LPARAM)lpstrText); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, EM_GETTEXTEX, (WPARAM)pGetTextEx, (LPARAM)lpstrText); } int GetTextEx(LPTSTR lpstrText, int nTextLen, DWORD dwFlags = GT_DEFAULT, UINT uCodePage = CP_ACP, LPCSTR lpDefaultChar = NULL, LPBOOL lpUsedDefChar = NULL) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); GETTEXTEX gte = { 0 }; gte.cb = nTextLen * sizeof(TCHAR); gte.codepage = uCodePage; gte.flags = dwFlags; gte.lpDefaultChar = lpDefaultChar; gte.lpUsedDefChar = lpUsedDefChar; - return (int)::SendMessage(m_hWnd, EM_GETTEXTEX, (WPARAM)>e, (LPARAM)lpstrText); + return (int)::SendMessage(this->m_hWnd, EM_GETTEXTEX, (WPARAM)>e, (LPARAM)lpstrText); } int GetTextLengthEx(GETTEXTLENGTHEX* pGetTextLengthEx) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETTEXTLENGTHEX, (WPARAM)pGetTextLengthEx, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, EM_GETTEXTLENGTHEX, (WPARAM)pGetTextLengthEx, 0L); } int GetTextLengthEx(DWORD dwFlags = GTL_DEFAULT, UINT uCodePage = CP_ACP) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); GETTEXTLENGTHEX gtle = { 0 }; gtle.codepage = uCodePage; gtle.flags = dwFlags; - return (int)::SendMessage(m_hWnd, EM_GETTEXTLENGTHEX, (WPARAM)>le, 0L); + return (int)::SendMessage(this->m_hWnd, EM_GETTEXTLENGTHEX, (WPARAM)>le, 0L); + } + + EDITWORDBREAKPROC GetWordBreakProc() const + { + ATLASSERT(::IsWindow(this->m_hWnd)); + return (EDITWORDBREAKPROC)::SendMessage(this->m_hWnd, EM_GETWORDBREAKPROC, 0, 0L); + } + + void SetWordBreakProc(EDITWORDBREAKPROC ewbprc) + { + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_SETWORDBREAKPROC, 0, (LPARAM)ewbprc); } -#endif // (_RICHEDIT_VER >= 0x0200) -#if (_RICHEDIT_VER >= 0x0300) int SetTextEx(SETTEXTEX* pSetTextEx, LPCTSTR lpstrText) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_SETTEXTEX, (WPARAM)pSetTextEx, (LPARAM)lpstrText); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, EM_SETTEXTEX, (WPARAM)pSetTextEx, (LPARAM)lpstrText); } int SetTextEx(LPCTSTR lpstrText, DWORD dwFlags = ST_DEFAULT, UINT uCodePage = CP_ACP) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); SETTEXTEX ste = { 0 }; ste.flags = dwFlags; ste.codepage = uCodePage; - return (int)::SendMessage(m_hWnd, EM_SETTEXTEX, (WPARAM)&ste, (LPARAM)lpstrText); + return (int)::SendMessage(this->m_hWnd, EM_SETTEXTEX, (WPARAM)&ste, (LPARAM)lpstrText); } int GetEditStyle() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_GETEDITSTYLE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, EM_GETEDITSTYLE, 0, 0L); } int SetEditStyle(int nStyle, int nMask = -1) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); if(nMask == -1) nMask = nStyle; // set everything specified - return (int)::SendMessage(m_hWnd, EM_SETEDITSTYLE, nStyle, nMask); + return (int)::SendMessage(this->m_hWnd, EM_SETEDITSTYLE, nStyle, nMask); } BOOL SetFontSize(int nFontSizeDelta) { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nFontSizeDelta >= -1637 && nFontSizeDelta <= 1638); - return (BOOL)::SendMessage(m_hWnd, EM_SETFONTSIZE, nFontSizeDelta, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((nFontSizeDelta >= -1637) && (nFontSizeDelta <= 1638)); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETFONTSIZE, nFontSizeDelta, 0L); } void GetScrollPos(LPPOINT lpPoint) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(lpPoint != NULL); - ::SendMessage(m_hWnd, EM_GETSCROLLPOS, 0, (LPARAM)lpPoint); + ::SendMessage(this->m_hWnd, EM_GETSCROLLPOS, 0, (LPARAM)lpPoint); } void SetScrollPos(LPPOINT lpPoint) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(lpPoint != NULL); - ::SendMessage(m_hWnd, EM_SETSCROLLPOS, 0, (LPARAM)lpPoint); + ::SendMessage(this->m_hWnd, EM_SETSCROLLPOS, 0, (LPARAM)lpPoint); } BOOL GetZoom(int& nNum, int& nDen) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_GETZOOM, (WPARAM)&nNum, (LPARAM)&nDen); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_GETZOOM, (WPARAM)&nNum, (LPARAM)&nDen); } BOOL SetZoom(int nNum, int nDen) { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nNum >= 0 && nNum <= 64); - ATLASSERT(nDen >= 0 && nDen <= 64); - return (BOOL)::SendMessage(m_hWnd, EM_SETZOOM, nNum, nDen); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((nNum >= 0) && (nNum <= 64)); + ATLASSERT((nDen >= 0) && (nDen <= 64)); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETZOOM, nNum, nDen); } BOOL SetZoomOff() { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETZOOM, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETZOOM, 0, 0L); + } + + void SetMargins(UINT nLeft, UINT nRight, WORD wFlags = EC_LEFTMARGIN | EC_RIGHTMARGIN) + { + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_SETMARGINS, wFlags, MAKELONG(nLeft, nRight)); } -#endif // (_RICHEDIT_VER >= 0x0300) // Operations void LimitText(LONG nChars = 0) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_EXLIMITTEXT, 0, nChars); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_EXLIMITTEXT, 0, nChars); } int LineFromChar(LONG nIndex) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_EXLINEFROMCHAR, 0, nIndex); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, EM_EXLINEFROMCHAR, 0, nIndex); } POINT PosFromChar(LONG nChar) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); POINT point = { 0, 0 }; - ::SendMessage(m_hWnd, EM_POSFROMCHAR, (WPARAM)&point, nChar); + ::SendMessage(this->m_hWnd, EM_POSFROMCHAR, (WPARAM)&point, nChar); return point; } int CharFromPos(POINT pt) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); POINTL ptl = { pt.x, pt.y }; - return (int)::SendMessage(m_hWnd, EM_CHARFROMPOS, 0, (LPARAM)&ptl); + return (int)::SendMessage(this->m_hWnd, EM_CHARFROMPOS, 0, (LPARAM)&ptl); } void EmptyUndoBuffer() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_EMPTYUNDOBUFFER, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_EMPTYUNDOBUFFER, 0, 0L); } int LineIndex(int nLine = -1) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_LINEINDEX, nLine, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, EM_LINEINDEX, nLine, 0L); } int LineLength(int nLine = -1) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, EM_LINELENGTH, nLine, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, EM_LINELENGTH, nLine, 0L); } - BOOL LineScroll(int nLines, int nChars = 0) + BOOL LineScroll(int nLines) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_LINESCROLL, nChars, nLines); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_LINESCROLL, 0, nLines); } void ReplaceSel(LPCTSTR lpszNewText, BOOL bCanUndo = FALSE) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_REPLACESEL, (WPARAM) bCanUndo, (LPARAM)lpszNewText); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_REPLACESEL, (WPARAM) bCanUndo, (LPARAM)lpszNewText); } void SetRect(LPCRECT lpRect) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETRECT, 0, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_SETRECT, 0, (LPARAM)lpRect); } BOOL DisplayBand(LPRECT pDisplayRect) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_DISPLAYBAND, 0, (LPARAM)pDisplayRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_DISPLAYBAND, 0, (LPARAM)pDisplayRect); } LONG FindText(DWORD dwFlags, FINDTEXT& ft) const { - ATLASSERT(::IsWindow(m_hWnd)); -#if (_RICHEDIT_VER >= 0x0200) && defined(_UNICODE) - return (LONG)::SendMessage(m_hWnd, EM_FINDTEXTW, dwFlags, (LPARAM)&ft); + ATLASSERT(::IsWindow(this->m_hWnd)); +#ifdef _UNICODE + return (LONG)::SendMessage(this->m_hWnd, EM_FINDTEXTW, dwFlags, (LPARAM)&ft); #else - return (LONG)::SendMessage(m_hWnd, EM_FINDTEXT, dwFlags, (LPARAM)&ft); + return (LONG)::SendMessage(this->m_hWnd, EM_FINDTEXT, dwFlags, (LPARAM)&ft); #endif } LONG FindText(DWORD dwFlags, FINDTEXTEX& ft) const { - ATLASSERT(::IsWindow(m_hWnd)); -#if (_RICHEDIT_VER >= 0x0200) && defined(_UNICODE) - return (LONG)::SendMessage(m_hWnd, EM_FINDTEXTEXW, dwFlags, (LPARAM)&ft); + ATLASSERT(::IsWindow(this->m_hWnd)); +#ifdef _UNICODE + return (LONG)::SendMessage(this->m_hWnd, EM_FINDTEXTEXW, dwFlags, (LPARAM)&ft); #else - return (LONG)::SendMessage(m_hWnd, EM_FINDTEXTEX, dwFlags, (LPARAM)&ft); + return (LONG)::SendMessage(this->m_hWnd, EM_FINDTEXTEX, dwFlags, (LPARAM)&ft); #endif } LONG FormatRange(FORMATRANGE& fr, BOOL bDisplay = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_FORMATRANGE, bDisplay, (LPARAM)&fr); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (LONG)::SendMessage(this->m_hWnd, EM_FORMATRANGE, bDisplay, (LPARAM)&fr); } LONG FormatRange(FORMATRANGE* pFormatRange, BOOL bDisplay = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_FORMATRANGE, bDisplay, (LPARAM)pFormatRange); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (LONG)::SendMessage(this->m_hWnd, EM_FORMATRANGE, bDisplay, (LPARAM)pFormatRange); } void HideSelection(BOOL bHide = TRUE, BOOL bChangeStyle = FALSE) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_HIDESELECTION, bHide, bChangeStyle); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_HIDESELECTION, bHide, bChangeStyle); } void PasteSpecial(UINT uClipFormat, DWORD dwAspect = 0, HMETAFILE hMF = 0) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); REPASTESPECIAL reps = { dwAspect, (DWORD_PTR)hMF }; - ::SendMessage(m_hWnd, EM_PASTESPECIAL, uClipFormat, (LPARAM)&reps); + ::SendMessage(this->m_hWnd, EM_PASTESPECIAL, uClipFormat, (LPARAM)&reps); } void RequestResize() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_REQUESTRESIZE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_REQUESTRESIZE, 0, 0L); } LONG StreamIn(UINT uFormat, EDITSTREAM& es) { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_STREAMIN, uFormat, (LPARAM)&es); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (LONG)::SendMessage(this->m_hWnd, EM_STREAMIN, uFormat, (LPARAM)&es); } LONG StreamOut(UINT uFormat, EDITSTREAM& es) { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_STREAMOUT, uFormat, (LPARAM)&es); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (LONG)::SendMessage(this->m_hWnd, EM_STREAMOUT, uFormat, (LPARAM)&es); } DWORD FindWordBreak(int nCode, LONG nStartChar) { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, EM_FINDWORDBREAK, nCode, nStartChar); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, EM_FINDWORDBREAK, nCode, nStartChar); } // Additional operations void ScrollCaret() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SCROLLCARET, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_SCROLLCARET, 0, 0L); } int InsertText(long nInsertAfterChar, LPCTSTR lpstrText, BOOL bCanUndo = FALSE) @@ -7971,106 +7699,208 @@ class CRichEditCtrlT : public TBase int AppendText(LPCTSTR lpstrText, BOOL bCanUndo = FALSE) { - return InsertText(GetWindowTextLength(), lpstrText, bCanUndo); + return InsertText(this->GetWindowTextLength(), lpstrText, bCanUndo); } // Clipboard operations BOOL Undo() { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_UNDO, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_UNDO, 0, 0L); } void Clear() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_CLEAR, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, WM_CLEAR, 0, 0L); } void Copy() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_COPY, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, WM_COPY, 0, 0L); } void Cut() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_CUT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, WM_CUT, 0, 0L); } void Paste() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_PASTE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, WM_PASTE, 0, 0L); } // OLE support IRichEditOle* GetOleInterface() const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); IRichEditOle *pRichEditOle = NULL; - ::SendMessage(m_hWnd, EM_GETOLEINTERFACE, 0, (LPARAM)&pRichEditOle); + ::SendMessage(this->m_hWnd, EM_GETOLEINTERFACE, 0, (LPARAM)&pRichEditOle); return pRichEditOle; } BOOL SetOleCallback(IRichEditOleCallback* pCallback) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETOLECALLBACK, 0, (LPARAM)pCallback); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETOLECALLBACK, 0, (LPARAM)pCallback); } -#if (_RICHEDIT_VER >= 0x0200) BOOL Redo() { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_REDO, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_REDO, 0, 0L); } void StopGroupTyping() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_STOPGROUPTYPING, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_STOPGROUPTYPING, 0, 0L); } void ShowScrollBar(int nBarType, BOOL bVisible = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SHOWSCROLLBAR, nBarType, bVisible); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_SHOWSCROLLBAR, nBarType, bVisible); } -#endif // (_RICHEDIT_VER >= 0x0200) -#if (_RICHEDIT_VER >= 0x0300) BOOL SetTabStops(int nTabStops, LPINT rgTabStops) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, nTabStops, (LPARAM)rgTabStops); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETTABSTOPS, nTabStops, (LPARAM)rgTabStops); } BOOL SetTabStops() { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETTABSTOPS, 0, 0L); } BOOL SetTabStops(const int& cxEachStop) // takes an 'int' { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, 1, (LPARAM)(LPINT)&cxEachStop); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETTABSTOPS, 1, (LPARAM)(LPINT)&cxEachStop); + } + +#if (_RICHEDIT_VER >= 0x0800) + AutoCorrectProc GetAutoCorrectProc() const + { + ATLASSERT(::IsWindow(this->m_hWnd)); + return (AutoCorrectProc)::SendMessage(this->m_hWnd, EM_GETAUTOCORRECTPROC, 0, 0L); + } + + BOOL SetAutoCorrectProc(AutoCorrectProc pfn) + { + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETAUTOCORRECTPROC, (WPARAM)pfn, 0L); + } + + BOOL CallAutoCorrectProc(WCHAR ch) + { + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_CALLAUTOCORRECTPROC, (WPARAM)ch, 0L); + } + + DWORD GetEditStyleEx() const + { + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, EM_GETEDITSTYLEEX, 0, 0L); + } + + DWORD SetEditStyleEx(DWORD dwStyleEx, DWORD dwMask) + { + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, EM_SETEDITSTYLEEX, dwStyleEx, dwMask); + } + + DWORD GetStoryType(int nStoryIndex) const + { + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, EM_GETSTORYTYPE, nStoryIndex, 0L); + } + + DWORD SetStoryType(int nStoryIndex, DWORD dwStoryType) + { + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, EM_SETSTORYTYPE, nStoryIndex, dwStoryType); } -#endif // (_RICHEDIT_VER >= 0x0300) + + DWORD GetEllipsisMode() const + { + ATLASSERT(::IsWindow(this->m_hWnd)); + + DWORD dwMode = 0; + BOOL bRet = (BOOL)::SendMessage(this->m_hWnd, EM_GETELLIPSISMODE, 0, (LPARAM)&dwMode); + bRet; // avoid level 4 warning + ATLASSERT(bRet != FALSE); + + return dwMode; + } + + BOOL SetEllipsisMode(DWORD dwEllipsisMode) + { + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETELLIPSISMODE, 0, dwEllipsisMode); + } + + BOOL GetEllipsisState() const + { + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_GETELLIPSISSTATE, 0, 0L); + } + + BOOL GetTouchOptions(int nTouchOptions) const + { + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_GETTOUCHOPTIONS, nTouchOptions, 0L); + } + + void SetTouchOptions(int nTouchOptions, BOOL bEnable) + { + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, EM_SETTOUCHOPTIONS, nTouchOptions, bEnable); + } + + HRESULT InsertTable(TABLEROWPARMS* pRowParams, TABLECELLPARMS* pCellParams) + { + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HRESULT)::SendMessage(this->m_hWnd, EM_INSERTTABLE, (WPARAM)pRowParams, (LPARAM)pCellParams); + } + + HRESULT GetTableParams(TABLEROWPARMS* pRowParams, TABLECELLPARMS* pCellParams) const + { + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HRESULT)::SendMessage(this->m_hWnd, EM_GETTABLEPARMS, (WPARAM)pRowParams, (LPARAM)pCellParams); + } + + HRESULT SetTableParams(TABLEROWPARMS* pRowParams, TABLECELLPARMS* pCellParams) + { + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HRESULT)::SendMessage(this->m_hWnd, EM_SETTABLEPARMS, (WPARAM)pRowParams, (LPARAM)pCellParams); + } + + HRESULT InsertImage(RICHEDIT_IMAGE_PARAMETERS* pParams) + { + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HRESULT)::SendMessage(this->m_hWnd, EM_INSERTIMAGE, 0, (LPARAM)pParams); + } + + BOOL SetUiaName(LPCTSTR lpstrName) + { + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, EM_SETUIANAME, 0, (LPARAM)lpstrName); + } +#endif // (_RICHEDIT_VER >= 0x0800) }; typedef CRichEditCtrlT CRichEditCtrl; -#endif // !_WIN32_WCE - /////////////////////////////////////////////////////////////////////////////// // CRichEditCommands - message handlers for standard EDIT commands -#ifndef _WIN32_WCE - // Chain to CRichEditCommands message map. Your class must also derive from CRichEditCtrl. // Example: // class CMyRichEdit : public CWindowImpl, @@ -8097,19 +7927,15 @@ class CRichEditCommands : public CEditCommands< T > COMMAND_ID_HANDLER(ID_EDIT_PASTE, CEditCommands< T >::OnEditPaste) COMMAND_ID_HANDLER(ID_EDIT_SELECT_ALL, CEditCommands< T >::OnEditSelectAll) COMMAND_ID_HANDLER(ID_EDIT_UNDO, CEditCommands< T >::OnEditUndo) -#if (_RICHEDIT_VER >= 0x0200) COMMAND_ID_HANDLER(ID_EDIT_REDO, OnEditRedo) -#endif // (_RICHEDIT_VER >= 0x0200) END_MSG_MAP() -#if (_RICHEDIT_VER >= 0x0200) LRESULT OnEditRedo(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->Redo(); return 0; } -#endif // (_RICHEDIT_VER >= 0x0200) // State (update UI) helpers BOOL CanCut() const @@ -8129,14 +7955,10 @@ class CRichEditCommands : public CEditCommands< T > } }; -#endif // _WIN32_WCE - /////////////////////////////////////////////////////////////////////////////// // CDragListBox -#ifndef _WIN32_WCE - template class CDragListBoxT : public CListBoxT< TBase > { @@ -8147,7 +7969,7 @@ class CDragListBoxT : public CListBoxT< TBase > CDragListBoxT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -8164,21 +7986,21 @@ class CDragListBoxT : public CListBoxT< TBase > // Operations BOOL MakeDragList() { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT((GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == 0); - return ::MakeDragList(m_hWnd); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((this->GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == 0); + return ::MakeDragList(this->m_hWnd); } int LBItemFromPt(POINT pt, BOOL bAutoScroll = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return ::LBItemFromPt(m_hWnd, pt, bAutoScroll); + ATLASSERT(::IsWindow(this->m_hWnd)); + return ::LBItemFromPt(this->m_hWnd, pt, bAutoScroll); } void DrawInsert(int nItem) { - ATLASSERT(::IsWindow(m_hWnd)); - ::DrawInsert(GetParent(), m_hWnd, nItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::DrawInsert(GetParent(), this->m_hWnd, nItem); } static UINT GetDragListMessage() @@ -8265,8 +8087,6 @@ class CDragListNotifyImpl } }; -#endif // _WIN32_WCE - /////////////////////////////////////////////////////////////////////////////// // CReBarCtrl @@ -8281,7 +8101,7 @@ class CReBarCtrlT : public TBase CReBarCtrlT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -8300,202 +8120,192 @@ class CReBarCtrlT : public TBase UINT GetBandCount() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, RB_GETBANDCOUNT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UINT)::SendMessage(this->m_hWnd, RB_GETBANDCOUNT, 0, 0L); } BOOL GetBandInfo(int nBand, LPREBARBANDINFO lprbbi) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_GETBANDINFO, nBand, (LPARAM)lprbbi); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, RB_GETBANDINFO, nBand, (LPARAM)lprbbi); } BOOL SetBandInfo(int nBand, LPREBARBANDINFO lprbbi) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_SETBANDINFO, nBand, (LPARAM)lprbbi); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, RB_SETBANDINFO, nBand, (LPARAM)lprbbi); } BOOL GetBarInfo(LPREBARINFO lprbi) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_GETBARINFO, 0, (LPARAM)lprbi); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, RB_GETBARINFO, 0, (LPARAM)lprbi); } BOOL SetBarInfo(LPREBARINFO lprbi) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_SETBARINFO, 0, (LPARAM)lprbi); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, RB_SETBARINFO, 0, (LPARAM)lprbi); } CImageList GetImageList() const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); REBARINFO rbi = { 0 }; rbi.cbSize = sizeof(REBARINFO); rbi.fMask = RBIM_IMAGELIST; - BOOL bRet = (BOOL)::SendMessage(m_hWnd, RB_GETBARINFO, 0, (LPARAM)&rbi); + BOOL bRet = (BOOL)::SendMessage(this->m_hWnd, RB_GETBARINFO, 0, (LPARAM)&rbi); return CImageList((bRet != FALSE) ? rbi.himl : NULL); } BOOL SetImageList(HIMAGELIST hImageList) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); REBARINFO rbi = { 0 }; rbi.cbSize = sizeof(REBARINFO); rbi.fMask = RBIM_IMAGELIST; rbi.himl = hImageList; - return (BOOL)::SendMessage(m_hWnd, RB_SETBARINFO, 0, (LPARAM)&rbi); + return (BOOL)::SendMessage(this->m_hWnd, RB_SETBARINFO, 0, (LPARAM)&rbi); } UINT GetRowCount() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, RB_GETROWCOUNT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UINT)::SendMessage(this->m_hWnd, RB_GETROWCOUNT, 0, 0L); } UINT GetRowHeight(int nBand) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, RB_GETROWHEIGHT, nBand, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UINT)::SendMessage(this->m_hWnd, RB_GETROWHEIGHT, nBand, 0L); } -#if (_WIN32_IE >= 0x0400) COLORREF GetTextColor() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, RB_GETTEXTCOLOR, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, RB_GETTEXTCOLOR, 0, 0L); } COLORREF SetTextColor(COLORREF clr) { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, RB_SETTEXTCOLOR, 0, (LPARAM)clr); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, RB_SETTEXTCOLOR, 0, (LPARAM)clr); } COLORREF GetBkColor() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, RB_GETBKCOLOR, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, RB_GETBKCOLOR, 0, 0L); } COLORREF SetBkColor(COLORREF clr) { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, RB_SETBKCOLOR, 0, (LPARAM)clr); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, RB_SETBKCOLOR, 0, (LPARAM)clr); } UINT GetBarHeight() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, RB_GETBARHEIGHT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (UINT)::SendMessage(this->m_hWnd, RB_GETBARHEIGHT, 0, 0L); } BOOL GetRect(int nBand, LPRECT lpRect) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_GETRECT, nBand, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, RB_GETRECT, nBand, (LPARAM)lpRect); } -#ifndef _WIN32_WCE CToolTipCtrl GetToolTips() const { - ATLASSERT(::IsWindow(m_hWnd)); - return CToolTipCtrl((HWND)::SendMessage(m_hWnd, RB_GETTOOLTIPS, 0, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CToolTipCtrl((HWND)::SendMessage(this->m_hWnd, RB_GETTOOLTIPS, 0, 0L)); } void SetToolTips(HWND hwndToolTip) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_SETTOOLTIPS, (WPARAM)hwndToolTip, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, RB_SETTOOLTIPS, (WPARAM)hwndToolTip, 0L); } -#endif // !_WIN32_WCE void GetBandBorders(int nBand, LPRECT lpRect) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(lpRect != NULL); - ::SendMessage(m_hWnd, RB_GETBANDBORDERS, nBand, (LPARAM)lpRect); + ::SendMessage(this->m_hWnd, RB_GETBANDBORDERS, nBand, (LPARAM)lpRect); } -#ifndef _WIN32_WCE BOOL GetColorScheme(LPCOLORSCHEME lpColorScheme) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(lpColorScheme != NULL); - return (BOOL)::SendMessage(m_hWnd, RB_GETCOLORSCHEME, 0, (LPARAM)lpColorScheme); + return (BOOL)::SendMessage(this->m_hWnd, RB_GETCOLORSCHEME, 0, (LPARAM)lpColorScheme); } void SetColorScheme(LPCOLORSCHEME lpColorScheme) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(lpColorScheme != NULL); - ::SendMessage(m_hWnd, RB_SETCOLORSCHEME, 0, (LPARAM)lpColorScheme); + ::SendMessage(this->m_hWnd, RB_SETCOLORSCHEME, 0, (LPARAM)lpColorScheme); } HPALETTE GetPalette() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (HPALETTE)::SendMessage(m_hWnd, RB_GETPALETTE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HPALETTE)::SendMessage(this->m_hWnd, RB_GETPALETTE, 0, 0L); } HPALETTE SetPalette(HPALETTE hPalette) { - ATLASSERT(::IsWindow(m_hWnd)); - return (HPALETTE)::SendMessage(m_hWnd, RB_SETPALETTE, 0, (LPARAM)hPalette); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (HPALETTE)::SendMessage(this->m_hWnd, RB_SETPALETTE, 0, (LPARAM)hPalette); } BOOL GetUnicodeFormat() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_GETUNICODEFORMAT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, RB_GETUNICODEFORMAT, 0, 0L); } BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_SETUNICODEFORMAT, bUnicode, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, RB_SETUNICODEFORMAT, bUnicode, 0L); } -#endif // !_WIN32_WCE -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_WINNT >= 0x0501) // requires uxtheme.h to be included to use MARGINS struct #ifndef _UXTHEME_H_ typedef struct _MARGINS* PMARGINS; #endif // !_UXTHEME_H_ void GetBandMargins(PMARGINS pMargins) const { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_GETBANDMARGINS, 0, (LPARAM)pMargins); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, RB_GETBANDMARGINS, 0, (LPARAM)pMargins); } void SetWindowTheme(LPCWSTR lpstrTheme) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, RB_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme); } -#endif // (_WIN32_WINNT >= 0x0501) -#if (_WIN32_IE >= 0x0600) DWORD GetExtendedStyle() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, RB_GETEXTENDEDSTYLE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, RB_GETEXTENDEDSTYLE, 0, 0L); } DWORD SetExtendedStyle(DWORD dwStyle, DWORD dwMask) { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, RB_SETEXTENDEDSTYLE, dwMask, dwStyle); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, RB_SETEXTENDEDSTYLE, dwMask, dwStyle); } -#endif // (_WIN32_IE >= 0x0600) // Operations BOOL InsertBand(int nBand, LPREBARBANDINFO lprbbi) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_INSERTBAND, nBand, (LPARAM)lprbbi); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, RB_INSERTBAND, nBand, (LPARAM)lprbbi); } BOOL AddBand(LPREBARBANDINFO lprbbi) @@ -8505,111 +8315,102 @@ class CReBarCtrlT : public TBase BOOL DeleteBand(int nBand) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_DELETEBAND, nBand, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, RB_DELETEBAND, nBand, 0L); } ATL::CWindow SetNotifyWnd(HWND hWnd) { - ATLASSERT(::IsWindow(m_hWnd)); - return ATL::CWindow((HWND)::SendMessage(m_hWnd, RB_SETPARENT, (WPARAM)hWnd, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return ATL::CWindow((HWND)::SendMessage(this->m_hWnd, RB_SETPARENT, (WPARAM)hWnd, 0L)); } -#if (_WIN32_IE >= 0x0400) void BeginDrag(int nBand, DWORD dwPos) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_BEGINDRAG, nBand, dwPos); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, RB_BEGINDRAG, nBand, dwPos); } void BeginDrag(int nBand, int xPos, int yPos) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_BEGINDRAG, nBand, MAKELPARAM(xPos, yPos)); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, RB_BEGINDRAG, nBand, MAKELPARAM(xPos, yPos)); } void EndDrag() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_ENDDRAG, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, RB_ENDDRAG, 0, 0L); } void DragMove(DWORD dwPos) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_DRAGMOVE, 0, dwPos); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, RB_DRAGMOVE, 0, dwPos); } void DragMove(int xPos, int yPos) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_DRAGMOVE, 0, MAKELPARAM(xPos, yPos)); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, RB_DRAGMOVE, 0, MAKELPARAM(xPos, yPos)); } -#ifndef _WIN32_WCE void GetDropTarget(IDropTarget** ppDropTarget) const { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_GETDROPTARGET, 0, (LPARAM)ppDropTarget); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, RB_GETDROPTARGET, 0, (LPARAM)ppDropTarget); } -#endif // !_WIN32_WCE void MaximizeBand(int nBand, BOOL bIdeal = FALSE) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_MAXIMIZEBAND, nBand, bIdeal); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, RB_MAXIMIZEBAND, nBand, bIdeal); } void MinimizeBand(int nBand) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_MINIMIZEBAND, nBand, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, RB_MINIMIZEBAND, nBand, 0L); } BOOL SizeToRect(LPRECT lpRect) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_SIZETORECT, 0, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, RB_SIZETORECT, 0, (LPARAM)lpRect); } int IdToIndex(UINT uBandID) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, RB_IDTOINDEX, uBandID, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, RB_IDTOINDEX, uBandID, 0L); } int HitTest(LPRBHITTESTINFO lprbht) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, RB_HITTEST, 0, (LPARAM)lprbht); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, RB_HITTEST, 0, (LPARAM)lprbht); } BOOL ShowBand(int nBand, BOOL bShow) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_SHOWBAND, nBand, bShow); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, RB_SHOWBAND, nBand, bShow); } -#ifndef _WIN32_WCE BOOL MoveBand(int nBand, int nNewPos) { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nNewPos >= 0 && nNewPos <= ((int)GetBandCount() - 1)); - return (BOOL)::SendMessage(m_hWnd, RB_MOVEBAND, nBand, nNewPos); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((nNewPos >= 0) && (nNewPos <= ((int)GetBandCount() - 1))); + return (BOOL)::SendMessage(this->m_hWnd, RB_MOVEBAND, nBand, nNewPos); } -#endif // !_WIN32_WCE -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) void PushChevron(int nBand, LPARAM lAppValue) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, RB_PUSHCHEVRON, nBand, lAppValue); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, RB_PUSHCHEVRON, nBand, lAppValue); } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) // Extra operations -#if (_WIN32_IE >= 0x0400) void LockBands(bool bLock) { int nBandCount = GetBandCount(); @@ -8637,13 +8438,12 @@ class CReBarCtrlT : public TBase ATLASSERT(bRet); } } -#endif // (_WIN32_IE >= 0x0400) #if (_WIN32_WINNT >= 0x0600) BOOL SetBandWidth(int nBand, int cxWidth) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, RB_SETBANDWIDTH, nBand, cxWidth); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, RB_SETBANDWIDTH, nBand, cxWidth); } #endif // (_WIN32_WINNT >= 0x0600) }; @@ -8654,8 +8454,6 @@ typedef CReBarCtrlT CReBarCtrl; /////////////////////////////////////////////////////////////////////////////// // CComboBoxEx -#ifndef _WIN32_WCE - template class CComboBoxExT : public CComboBoxT< TBase > { @@ -8666,7 +8464,7 @@ class CComboBoxExT : public CComboBoxT< TBase > CComboBoxExT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -8685,61 +8483,57 @@ class CComboBoxExT : public CComboBoxT< TBase > CImageList GetImageList() const { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, CBEM_GETIMAGELIST, 0, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, CBEM_GETIMAGELIST, 0, 0L)); } CImageList SetImageList(HIMAGELIST hImageList) { - ATLASSERT(::IsWindow(m_hWnd)); - return CImageList((HIMAGELIST)::SendMessage(m_hWnd, CBEM_SETIMAGELIST, 0, (LPARAM)hImageList)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, CBEM_SETIMAGELIST, 0, (LPARAM)hImageList)); } -#if (_WIN32_IE >= 0x0400) DWORD GetExtendedStyle() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, CBEM_GETEXTENDEDSTYLE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, CBEM_GETEXTENDEDSTYLE, 0, 0L); } DWORD SetExtendedStyle(DWORD dwExMask, DWORD dwExStyle) { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, CBEM_SETEXTENDEDSTYLE, dwExMask, dwExStyle); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, CBEM_SETEXTENDEDSTYLE, dwExMask, dwExStyle); } BOOL GetUnicodeFormat() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CBEM_GETUNICODEFORMAT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, CBEM_GETUNICODEFORMAT, 0, 0L); } BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CBEM_SETUNICODEFORMAT, bUnicode, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, CBEM_SETUNICODEFORMAT, bUnicode, 0L); } -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_WINNT >= 0x0501) void SetWindowTheme(LPCWSTR lpstrTheme) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, CBEM_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, CBEM_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme); } -#endif // (_WIN32_WINNT >= 0x0501) // Operations int InsertItem(const COMBOBOXEXITEM* lpcCBItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CBEM_INSERTITEM, 0, (LPARAM)lpcCBItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, CBEM_INSERTITEM, 0, (LPARAM)lpcCBItem); } int InsertItem(UINT nMask, int nIndex, LPCTSTR lpszItem, int nImage, int nSelImage, int iIndent, int iOverlay, LPARAM lParam) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); COMBOBOXEXITEM cbex = { 0 }; cbex.mask = nMask; cbex.iItem = nIndex; @@ -8749,12 +8543,12 @@ class CComboBoxExT : public CComboBoxT< TBase > cbex.iIndent = iIndent; cbex.iOverlay = iOverlay; cbex.lParam = lParam; - return (int)::SendMessage(m_hWnd, CBEM_INSERTITEM, 0, (LPARAM)&cbex); + return (int)::SendMessage(this->m_hWnd, CBEM_INSERTITEM, 0, (LPARAM)&cbex); } int InsertItem(int nIndex, LPCTSTR lpszItem, int nImage, int nSelImage, int iIndent, LPARAM lParam = 0) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); COMBOBOXEXITEM cbex = { 0 }; cbex.mask = CBEIF_TEXT | CBEIF_IMAGE | CBEIF_SELECTEDIMAGE | CBEIF_INDENT | CBEIF_LPARAM; cbex.iItem = nIndex; @@ -8763,7 +8557,7 @@ class CComboBoxExT : public CComboBoxT< TBase > cbex.iSelectedImage = nSelImage; cbex.iIndent = iIndent; cbex.lParam = lParam; - return (int)::SendMessage(m_hWnd, CBEM_INSERTITEM, 0, (LPARAM)&cbex); + return (int)::SendMessage(this->m_hWnd, CBEM_INSERTITEM, 0, (LPARAM)&cbex); } int AddItem(UINT nMask, LPCTSTR lpszItem, int nImage, int nSelImage, int iIndent, int iOverlay, LPARAM lParam) @@ -8778,26 +8572,26 @@ class CComboBoxExT : public CComboBoxT< TBase > int DeleteItem(int nIndex) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, CBEM_DELETEITEM, nIndex, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, CBEM_DELETEITEM, nIndex, 0L); } BOOL GetItem(PCOMBOBOXEXITEM pCBItem) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CBEM_GETITEM, 0, (LPARAM)pCBItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, CBEM_GETITEM, 0, (LPARAM)pCBItem); } BOOL SetItem(const COMBOBOXEXITEM* lpcCBItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CBEM_SETITEM, 0, (LPARAM)lpcCBItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, CBEM_SETITEM, 0, (LPARAM)lpcCBItem); } int SetItem(int nIndex, UINT nMask, LPCTSTR lpszItem, int nImage, int nSelImage, int iIndent, int iOverlay, LPARAM lParam) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); COMBOBOXEXITEM cbex = { 0 }; cbex.mask = nMask; cbex.iItem = nIndex; @@ -8807,12 +8601,12 @@ class CComboBoxExT : public CComboBoxT< TBase > cbex.iIndent = iIndent; cbex.iOverlay = iOverlay; cbex.lParam = lParam; - return (int)::SendMessage(m_hWnd, CBEM_SETITEM, 0, (LPARAM)&cbex); + return (int)::SendMessage(this->m_hWnd, CBEM_SETITEM, 0, (LPARAM)&cbex); } BOOL GetItemText(int nIndex, LPTSTR lpszItem, int nLen) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(lpszItem != NULL); COMBOBOXEXITEM cbex = { 0 }; @@ -8821,14 +8615,13 @@ class CComboBoxExT : public CComboBoxT< TBase > cbex.pszText = lpszItem; cbex.cchTextMax = nLen; - return (BOOL)::SendMessage(m_hWnd, CBEM_GETITEM, 0, (LPARAM)&cbex); + return (BOOL)::SendMessage(this->m_hWnd, CBEM_GETITEM, 0, (LPARAM)&cbex); } -#ifndef _ATL_NO_COM BOOL GetItemText(int nIndex, BSTR& bstrText) const { USES_CONVERSION; - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(bstrText == NULL); COMBOBOXEXITEM cbex = { 0 }; @@ -8845,8 +8638,8 @@ class CComboBoxExT : public CComboBoxT< TBase > lpstrText[0] = NULL; cbex.pszText = lpstrText; cbex.cchTextMax = nLen; - bRet = (BOOL)::SendMessage(m_hWnd, CBEM_GETITEM, 0, (LPARAM)&cbex); - if(!bRet || (lstrlen(cbex.pszText) < nLen - 1)) + bRet = (BOOL)::SendMessage(this->m_hWnd, CBEM_GETITEM, 0, (LPARAM)&cbex); + if(!bRet || (lstrlen(cbex.pszText) < (nLen - 1))) break; delete [] lpstrText; lpstrText = NULL; @@ -8861,12 +8654,11 @@ class CComboBoxExT : public CComboBoxT< TBase > return (bstrText != NULL) ? TRUE : FALSE; } -#endif // !_ATL_NO_COM -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - BOOL GetItemText(int nIndex, _CSTRING_NS::CString& strText) const +#ifdef __ATLSTR_H__ + BOOL GetItemText(int nIndex, ATL::CString& strText) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); COMBOBOXEXITEM cbex = { 0 }; cbex.mask = CBEIF_TEXT; @@ -8883,37 +8675,37 @@ class CComboBoxExT : public CComboBoxT< TBase > break; } cbex.cchTextMax = nLen; - bRet = (BOOL)::SendMessage(m_hWnd, CBEM_GETITEM, 0, (LPARAM)&cbex); - if(!bRet || (lstrlen(cbex.pszText) < nLen - 1)) + bRet = (BOOL)::SendMessage(this->m_hWnd, CBEM_GETITEM, 0, (LPARAM)&cbex); + if(!bRet || (lstrlen(cbex.pszText) < (nLen - 1))) break; } strText.ReleaseBuffer(); return bRet; } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) +#endif // __ATLSTR_H__ BOOL SetItemText(int nIndex, LPCTSTR lpszItem) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); return SetItem(nIndex, CBEIF_TEXT, lpszItem, 0, 0, 0, 0, 0); } CComboBox GetComboCtrl() const { - ATLASSERT(::IsWindow(m_hWnd)); - return CComboBox((HWND)::SendMessage(m_hWnd, CBEM_GETCOMBOCONTROL, 0, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CComboBox((HWND)::SendMessage(this->m_hWnd, CBEM_GETCOMBOCONTROL, 0, 0L)); } CEdit GetEditCtrl() const { - ATLASSERT(::IsWindow(m_hWnd)); - return CEdit((HWND)::SendMessage(m_hWnd, CBEM_GETEDITCONTROL, 0, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CEdit((HWND)::SendMessage(this->m_hWnd, CBEM_GETEDITCONTROL, 0, 0L)); } BOOL HasEditChanged() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, CBEM_HASEDITCHANGED, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, CBEM_HASEDITCHANGED, 0, 0L); } // Non-functional @@ -8944,8 +8736,6 @@ class CComboBoxExT : public CComboBoxT< TBase > typedef CComboBoxExT CComboBoxEx; -#endif // !_WIN32_WCE - /////////////////////////////////////////////////////////////////////////////// // CMonthCalendarCtrl @@ -8960,7 +8750,7 @@ class CMonthCalendarCtrlT : public TBase CMonthCalendarCtrlT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -8979,32 +8769,32 @@ class CMonthCalendarCtrlT : public TBase COLORREF GetColor(int nColorType) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, MCM_GETCOLOR, nColorType, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, MCM_GETCOLOR, nColorType, 0L); } COLORREF SetColor(int nColorType, COLORREF clr) { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, MCM_SETCOLOR, nColorType, clr); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, MCM_SETCOLOR, nColorType, clr); } BOOL GetCurSel(LPSYSTEMTIME lpSysTime) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_GETCURSEL, 0, (LPARAM)lpSysTime); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, MCM_GETCURSEL, 0, (LPARAM)lpSysTime); } BOOL SetCurSel(LPSYSTEMTIME lpSysTime) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_SETCURSEL, 0, (LPARAM)lpSysTime); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, MCM_SETCURSEL, 0, (LPARAM)lpSysTime); } int GetFirstDayOfWeek(BOOL* pbLocaleVal = NULL) const { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, MCM_GETFIRSTDAYOFWEEK, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, MCM_GETFIRSTDAYOFWEEK, 0, 0L); if(pbLocaleVal != NULL) *pbLocaleVal = (BOOL)HIWORD(dwRet); return (int)(short)LOWORD(dwRet); @@ -9012,8 +8802,8 @@ class CMonthCalendarCtrlT : public TBase int SetFirstDayOfWeek(int nDay, BOOL* pbLocaleVal = NULL) { - ATLASSERT(::IsWindow(m_hWnd)); - DWORD dwRet = (DWORD)::SendMessage(m_hWnd, MCM_SETFIRSTDAYOFWEEK, 0, nDay); + ATLASSERT(::IsWindow(this->m_hWnd)); + DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, MCM_SETFIRSTDAYOFWEEK, 0, nDay); if(pbLocaleVal != NULL) *pbLocaleVal = (BOOL)HIWORD(dwRet); return (int)(short)LOWORD(dwRet); @@ -9021,164 +8811,162 @@ class CMonthCalendarCtrlT : public TBase int GetMaxSelCount() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, MCM_GETMAXSELCOUNT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, MCM_GETMAXSELCOUNT, 0, 0L); } BOOL SetMaxSelCount(int nMax) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_SETMAXSELCOUNT, nMax, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, MCM_SETMAXSELCOUNT, nMax, 0L); } int GetMonthDelta() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, MCM_GETMONTHDELTA, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, MCM_GETMONTHDELTA, 0, 0L); } int SetMonthDelta(int nDelta) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, MCM_SETMONTHDELTA, nDelta, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, MCM_SETMONTHDELTA, nDelta, 0L); } DWORD GetRange(LPSYSTEMTIME lprgSysTimeArray) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, MCM_GETRANGE, 0, (LPARAM)lprgSysTimeArray); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, MCM_GETRANGE, 0, (LPARAM)lprgSysTimeArray); } BOOL SetRange(DWORD dwFlags, LPSYSTEMTIME lprgSysTimeArray) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_SETRANGE, dwFlags, (LPARAM)lprgSysTimeArray); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, MCM_SETRANGE, dwFlags, (LPARAM)lprgSysTimeArray); } BOOL GetSelRange(LPSYSTEMTIME lprgSysTimeArray) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_GETSELRANGE, 0, (LPARAM)lprgSysTimeArray); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, MCM_GETSELRANGE, 0, (LPARAM)lprgSysTimeArray); } BOOL SetSelRange(LPSYSTEMTIME lprgSysTimeArray) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_SETSELRANGE, 0, (LPARAM)lprgSysTimeArray); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, MCM_SETSELRANGE, 0, (LPARAM)lprgSysTimeArray); } BOOL GetToday(LPSYSTEMTIME lpSysTime) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_GETTODAY, 0, (LPARAM)lpSysTime); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, MCM_GETTODAY, 0, (LPARAM)lpSysTime); } void SetToday(LPSYSTEMTIME lpSysTime) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, MCM_SETTODAY, 0, (LPARAM)lpSysTime); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, MCM_SETTODAY, 0, (LPARAM)lpSysTime); } BOOL GetMinReqRect(LPRECT lpRectInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_GETMINREQRECT, 0, (LPARAM)lpRectInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, MCM_GETMINREQRECT, 0, (LPARAM)lpRectInfo); } int GetMaxTodayWidth() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, MCM_GETMAXTODAYWIDTH, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, MCM_GETMAXTODAYWIDTH, 0, 0L); } -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) BOOL GetUnicodeFormat() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_GETUNICODEFORMAT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, MCM_GETUNICODEFORMAT, 0, 0L); } BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_SETUNICODEFORMAT, bUnicode, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, MCM_SETUNICODEFORMAT, bUnicode, 0L); } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) #if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) DWORD GetCurrentView() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, MCM_GETCURRENTVIEW, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, MCM_GETCURRENTVIEW, 0, 0L); } BOOL SetCurrentView(DWORD dwView) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_SETCURRENTVIEW, 0, dwView); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, MCM_SETCURRENTVIEW, 0, dwView); } DWORD GetCalendarCount() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, MCM_GETCALENDARCOUNT, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, MCM_GETCALENDARCOUNT, 0, 0L); } BOOL GetCalendarGridInfo(PMCGRIDINFO pGridInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_GETCALENDARGRIDINFO, 0, (LPARAM)pGridInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, MCM_GETCALENDARGRIDINFO, 0, (LPARAM)pGridInfo); } CALID GetCALID() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (CALID)::SendMessage(m_hWnd, MCM_GETCALID, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (CALID)::SendMessage(this->m_hWnd, MCM_GETCALID, 0, 0L); } void SetCALID(CALID calid) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, MCM_SETCALID, (LPARAM)calid, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, MCM_SETCALID, (LPARAM)calid, 0L); } int GetCalendarBorder() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, MCM_GETCALENDARBORDER, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, MCM_GETCALENDARBORDER, 0, 0L); } void SetCalendarBorder(int cxyBorder, BOOL bSet = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, MCM_SETCALENDARBORDER, (WPARAM)bSet, (LPARAM)cxyBorder); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, MCM_SETCALENDARBORDER, (WPARAM)bSet, (LPARAM)cxyBorder); } #endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) // Operations int GetMonthRange(DWORD dwFlags, LPSYSTEMTIME lprgSysTimeArray) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, MCM_GETMONTHRANGE, dwFlags, (LPARAM)lprgSysTimeArray); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, MCM_GETMONTHRANGE, dwFlags, (LPARAM)lprgSysTimeArray); } BOOL SetDayState(int nMonths, LPMONTHDAYSTATE lpDayStateArray) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, MCM_SETDAYSTATE, nMonths, (LPARAM)lpDayStateArray); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, MCM_SETDAYSTATE, nMonths, (LPARAM)lpDayStateArray); } DWORD HitTest(PMCHITTESTINFO pMCHitTest) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, MCM_HITTEST, 0, (LPARAM)pMCHitTest); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, MCM_HITTEST, 0, (LPARAM)pMCHitTest); } #if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) void SizeRectToMin(LPRECT lpRect) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, MCM_SIZERECTTOMIN, 0, (LPARAM)lpRect); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, MCM_SIZERECTTOMIN, 0, (LPARAM)lpRect); } #endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) }; @@ -9199,7 +8987,7 @@ class CDateTimePickerCtrlT : public TBase CDateTimePickerCtrlT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -9218,95 +9006,93 @@ class CDateTimePickerCtrlT : public TBase BOOL SetFormat(LPCTSTR lpszFormat) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, DTM_SETFORMAT, 0, (LPARAM)lpszFormat); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, DTM_SETFORMAT, 0, (LPARAM)lpszFormat); } COLORREF GetMonthCalColor(int nColorType) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, DTM_GETMCCOLOR, nColorType, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, DTM_GETMCCOLOR, nColorType, 0L); } COLORREF SetMonthCalColor(int nColorType, COLORREF clr) { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, DTM_SETMCCOLOR, nColorType, clr); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, DTM_SETMCCOLOR, nColorType, clr); } DWORD GetRange(LPSYSTEMTIME lpSysTimeArray) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, DTM_GETRANGE, 0, (LPARAM)lpSysTimeArray); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, DTM_GETRANGE, 0, (LPARAM)lpSysTimeArray); } BOOL SetRange(DWORD dwFlags, LPSYSTEMTIME lpSysTimeArray) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, DTM_SETRANGE, dwFlags, (LPARAM)lpSysTimeArray); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, DTM_SETRANGE, dwFlags, (LPARAM)lpSysTimeArray); } DWORD GetSystemTime(LPSYSTEMTIME lpSysTime) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)lpSysTime); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)lpSysTime); } BOOL SetSystemTime(DWORD dwFlags, LPSYSTEMTIME lpSysTime) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, DTM_SETSYSTEMTIME, dwFlags, (LPARAM)lpSysTime); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, DTM_SETSYSTEMTIME, dwFlags, (LPARAM)lpSysTime); } CMonthCalendarCtrl GetMonthCal() const { - ATLASSERT(::IsWindow(m_hWnd)); - return CMonthCalendarCtrl((HWND)::SendMessage(m_hWnd, DTM_GETMONTHCAL, 0, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CMonthCalendarCtrl((HWND)::SendMessage(this->m_hWnd, DTM_GETMONTHCAL, 0, 0L)); } -#if (_WIN32_IE >= 0x0400) CFontHandle GetMonthCalFont() const { - ATLASSERT(::IsWindow(m_hWnd)); - return CFontHandle((HFONT)::SendMessage(m_hWnd, DTM_GETMCFONT, 0, 0L)); + ATLASSERT(::IsWindow(this->m_hWnd)); + return CFontHandle((HFONT)::SendMessage(this->m_hWnd, DTM_GETMCFONT, 0, 0L)); } void SetMonthCalFont(HFONT hFont, BOOL bRedraw = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_SETMCFONT, (WPARAM)hFont, MAKELPARAM(bRedraw, 0)); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, DTM_SETMCFONT, (WPARAM)hFont, MAKELPARAM(bRedraw, 0)); } -#endif // (_WIN32_IE >= 0x0400) #if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) DWORD GetMonthCalStyle() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, DTM_GETMCSTYLE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, DTM_GETMCSTYLE, 0, 0L); } DWORD SetMonthCalStyle(DWORD dwStyle) { - ATLASSERT(::IsWindow(m_hWnd)); - return (DWORD)::SendMessage(m_hWnd, DTM_SETMCSTYLE, 0, (LPARAM)dwStyle); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (DWORD)::SendMessage(this->m_hWnd, DTM_SETMCSTYLE, 0, (LPARAM)dwStyle); } void GetDateTimePickerInfo(LPDATETIMEPICKERINFO lpPickerInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_GETDATETIMEPICKERINFO, 0, (LPARAM)lpPickerInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, DTM_GETDATETIMEPICKERINFO, 0, (LPARAM)lpPickerInfo); } BOOL GetIdealSize(LPSIZE lpSize) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, DTM_GETIDEALSIZE, 0, (LPARAM)lpSize); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, DTM_GETIDEALSIZE, 0, (LPARAM)lpSize); } void CloseMonthCal() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_CLOSEMONTHCAL, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, DTM_CLOSEMONTHCAL, 0, 0L); } #endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) }; @@ -9317,8 +9103,6 @@ typedef CDateTimePickerCtrlT CDateTimePickerCtrl; /////////////////////////////////////////////////////////////////////////////// // CFlatScrollBarImpl - support for flat scroll bars -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - template class CFlatScrollBarImpl { @@ -9421,21 +9205,17 @@ class CFlatScrollBarT : public TBase, public CFlatScrollBarImpl& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } }; typedef CFlatScrollBarT CFlatScrollBar; -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - /////////////////////////////////////////////////////////////////////////////// // CIPAddressCtrl -#if (_WIN32_IE >= 0x0400) - template class CIPAddressCtrlT : public TBase { @@ -9446,7 +9226,7 @@ class CIPAddressCtrlT : public TBase CIPAddressCtrlT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -9465,57 +9245,53 @@ class CIPAddressCtrlT : public TBase BOOL IsBlank() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, IPM_ISBLANK, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, IPM_ISBLANK, 0, 0L); } int GetAddress(LPDWORD lpdwAddress) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, IPM_GETADDRESS, 0, (LPARAM)lpdwAddress); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, IPM_GETADDRESS, 0, (LPARAM)lpdwAddress); } void SetAddress(DWORD dwAddress) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IPM_SETADDRESS, 0, dwAddress); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, IPM_SETADDRESS, 0, dwAddress); } void ClearAddress() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IPM_CLEARADDRESS, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, IPM_CLEARADDRESS, 0, 0L); } void SetRange(int nField, WORD wRange) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IPM_SETRANGE, nField, wRange); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, IPM_SETRANGE, nField, wRange); } void SetRange(int nField, BYTE nMin, BYTE nMax) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IPM_SETRANGE, nField, MAKEIPRANGE(nMin, nMax)); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, IPM_SETRANGE, nField, MAKEIPRANGE(nMin, nMax)); } void SetFocus(int nField) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IPM_SETFOCUS, nField, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, IPM_SETFOCUS, nField, 0L); } }; typedef CIPAddressCtrlT CIPAddressCtrl; -#endif // (_WIN32_IE >= 0x0400) - /////////////////////////////////////////////////////////////////////////////// // CPagerCtrl -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - template class CPagerCtrlT : public TBase { @@ -9526,7 +9302,7 @@ class CPagerCtrlT : public TBase CPagerCtrlT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -9545,96 +9321,92 @@ class CPagerCtrlT : public TBase int GetButtonSize() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PGM_GETBUTTONSIZE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, PGM_GETBUTTONSIZE, 0, 0L); } int SetButtonSize(int nButtonSize) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PGM_SETBUTTONSIZE, 0, nButtonSize); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, PGM_SETBUTTONSIZE, 0, nButtonSize); } DWORD GetButtonState(int nButton) const { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nButton == PGB_TOPORLEFT || nButton == PGB_BOTTOMORRIGHT); - return (DWORD)::SendMessage(m_hWnd, PGM_GETBUTTONSTATE, 0, nButton); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((nButton == PGB_TOPORLEFT) || (nButton == PGB_BOTTOMORRIGHT)); + return (DWORD)::SendMessage(this->m_hWnd, PGM_GETBUTTONSTATE, 0, nButton); } COLORREF GetBkColor() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, PGM_GETBKCOLOR, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, PGM_GETBKCOLOR, 0, 0L); } COLORREF SetBkColor(COLORREF clrBk) { - ATLASSERT(::IsWindow(m_hWnd)); - return (COLORREF)::SendMessage(m_hWnd, PGM_SETBKCOLOR, 0, (LPARAM)clrBk); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (COLORREF)::SendMessage(this->m_hWnd, PGM_SETBKCOLOR, 0, (LPARAM)clrBk); } int GetBorder() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PGM_GETBORDER, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, PGM_GETBORDER, 0, 0L); } int SetBorder(int nBorderSize) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PGM_SETBORDER, 0, nBorderSize); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, PGM_SETBORDER, 0, nBorderSize); } int GetPos() const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PGM_GETPOS, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, PGM_GETPOS, 0, 0L); } int SetPos(int nPos) { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, PGM_SETPOS, 0, nPos); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, PGM_SETPOS, 0, nPos); } // Operations void SetChild(HWND hWndChild) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PGM_SETCHILD, 0, (LPARAM)hWndChild); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, PGM_SETCHILD, 0, (LPARAM)hWndChild); } void ForwardMouse(BOOL bForward = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PGM_FORWARDMOUSE, bForward, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, PGM_FORWARDMOUSE, bForward, 0L); } void RecalcSize() { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, PGM_RECALCSIZE, 0, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + ::SendMessage(this->m_hWnd, PGM_RECALCSIZE, 0, 0L); } void GetDropTarget(IDropTarget** ppDropTarget) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(ppDropTarget != NULL); - ::SendMessage(m_hWnd, PGM_GETDROPTARGET, 0, (LPARAM)ppDropTarget); + ::SendMessage(this->m_hWnd, PGM_GETDROPTARGET, 0, (LPARAM)ppDropTarget); } }; typedef CPagerCtrlT CPagerCtrl; -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) - /////////////////////////////////////////////////////////////////////////////// // CLinkCtrl - Windows SYSLINK control -#if (_WIN32_WINNT >= 0x0501) && !defined(_WIN32_WCE) - template class CLinkCtrlT : public TBase { @@ -9645,7 +9417,7 @@ class CLinkCtrlT : public TBase CLinkCtrlT< TBase >& operator =(HWND hWnd) { - m_hWnd = hWnd; + this->m_hWnd = hWnd; return *this; } @@ -9668,44 +9440,39 @@ class CLinkCtrlT : public TBase int GetIdealHeight(int cxMaxWidth = 0) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LM_GETIDEALHEIGHT, cxMaxWidth, 0L); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LM_GETIDEALHEIGHT, cxMaxWidth, 0L); } BOOL GetItem(PLITEM pLItem) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LM_GETITEM, 0, (LPARAM)pLItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LM_GETITEM, 0, (LPARAM)pLItem); } BOOL SetItem(PLITEM pLItem) { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LM_SETITEM, 0, (LPARAM)pLItem); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LM_SETITEM, 0, (LPARAM)pLItem); } // Vista only int GetIdealSize(SIZE& size, int cxMaxWidth = 0) const { -#ifndef LM_GETIDEALSIZE - const UINT LM_GETIDEALSIZE = LM_GETIDEALHEIGHT; -#endif - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, LM_GETIDEALSIZE, cxMaxWidth, (LPARAM)&size); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (int)::SendMessage(this->m_hWnd, LM_GETIDEALSIZE, cxMaxWidth, (LPARAM)&size); } // Operations BOOL HitTest(PLHITTESTINFO pLHitTestInfo) const { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, LM_HITTEST, 0, (LPARAM)pLHitTestInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + return (BOOL)::SendMessage(this->m_hWnd, LM_HITTEST, 0, (LPARAM)pLHitTestInfo); } }; typedef CLinkCtrlT CLinkCtrl; -#endif // (_WIN32_WINNT >= 0x0501) && !defined(_WIN32_WCE) - /////////////////////////////////////////////////////////////////////////////// // CCustomDraw - MI class for custom-draw support @@ -9714,20 +9481,6 @@ template class CCustomDraw { public: -#if (_ATL_VER < 0x0700) - BOOL m_bHandledCD; - - BOOL IsMsgHandled() const - { - return m_bHandledCD; - } - - void SetMsgHandled(BOOL bHandled) - { - m_bHandledCD = bHandled; - } -#endif // !(_ATL_VER < 0x0700) - // Message map and handlers BEGIN_MSG_MAP(CCustomDraw< T >) NOTIFY_CODE_HANDLER(NM_CUSTOMDRAW, OnCustomDraw) @@ -9768,11 +9521,9 @@ class CCustomDraw case CDDS_ITEMPOSTERASE: dwRet = pT->OnItemPostErase(idCtrl, lpNMCustomDraw); break; -#if (_WIN32_IE >= 0x0400) case (CDDS_ITEMPREPAINT | CDDS_SUBITEM): dwRet = pT->OnSubItemPrePaint(idCtrl, lpNMCustomDraw); break; -#endif // (_WIN32_IE >= 0x0400) default: pT->SetMsgHandled(FALSE); break; @@ -9822,212 +9573,12 @@ class CCustomDraw return CDRF_DODEFAULT; } -#if (_WIN32_IE >= 0x0400) DWORD OnSubItemPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) { return CDRF_DODEFAULT; } -#endif // (_WIN32_IE >= 0x0400) -}; - - -// --- Windows CE common controls --- - -#ifdef _WIN32_WCE - -/////////////////////////////////////////////////////////////////////////////// -// CCECommandBarCtrl - -template -class CCECommandBarCtrlT : public TBase -{ -public: -// Constructors - CCECommandBarCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } - - CCECommandBarCtrlT< TBase >& operator=(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - -// Attributes - BOOL IsVisible() const - { - return IsWindowVisible(); - } - - int GetHeight() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_Height(m_hWnd); - } - - HMENU GetMenu(WORD wButton) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_GetMenu(m_hWnd, wButton); - } - -// Operations - HWND Create(HWND hWndParent, int nCmdBarID) - { - m_hWnd = ::CommandBar_Create(ModuleHelper::GetModuleInstance(), hWndParent, nCmdBarID); - ATLASSERT(::IsWindow(m_hWnd)); - return m_hWnd; - } - - void Destroy() - { - DestroyWindow(); - } - - BOOL Show(BOOL bShow = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_Show(m_hWnd, bShow); - } - - BOOL DrawMenuBar(WORD wButton) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_DrawMenuBar(m_hWnd, wButton); - } - - BOOL AddAdornments(DWORD dwFlags = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_AddAdornments(m_hWnd, dwFlags, 0); - } - - int AddBitmap(int nBitmapID, int nNumImages) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_AddBitmap(m_hWnd, ModuleHelper::GetResourceInstance(), nBitmapID, nNumImages, 16, 16); - } - - BOOL AddButtons(UINT uNumButtons, LPTBBUTTON lpButtons) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CommandBar_AddButtons(m_hWnd, uNumButtons, lpButtons); - } - - BOOL AddToolTips(UINT uNumToolTips, LPTSTR lpToolTips) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CommandBar_AddToolTips(m_hWnd, uNumToolTips, lpToolTips); - } - - BOOL InsertButton(int nButton, LPTBBUTTON lpButton) - { - ATLASSERT(::IsWindow(m_hWnd)); - return CommandBar_InsertButton(m_hWnd, nButton, lpButton); - } - - HWND InsertComboBox(int nWidth, UINT dwStyle, WORD wComboBoxID, WORD wButton) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_InsertComboBox(m_hWnd, ModuleHelper::GetModuleInstance(), nWidth, dwStyle, wComboBoxID, wButton); - } - - BOOL InsertMenubar(WORD wMenuID, WORD wButton) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_InsertMenubar(m_hWnd, ModuleHelper::GetResourceInstance(), wMenuID, wButton); - } - - BOOL InsertMenubarEx(ATL::_U_STRINGorID menu, WORD wButton) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBar_InsertMenubarEx(m_hWnd, ModuleHelper::GetResourceInstance(), (LPTSTR)menu.m_lpstr, wButton); - } - - BOOL IsCommandBarMessage(LPMSG lpMsg) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::IsCommandBarMessage(m_hWnd, lpMsg); - } }; -#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC MenuBar - typedef CCECommandBarCtrlT CMenuBarCtrl; -#else - typedef CCECommandBarCtrlT CCECommandBarCtrl; -#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) - -/////////////////////////////////////////////////////////////////////////////// -// CCECommandBandsCtrl - -template -class CCECommandBandsCtrlT : public TBase -{ -public: -// Constructors - CCECommandBandsCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } - - CCECommandBandsCtrlT< TBase >& operator=(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - -// Attributes - BOOL IsVisible() const - { - return IsWindowVisible(); - } - -#if (_WIN32_IE >= 0x0400) - UINT GetHeight() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return CommandBands_Height(m_hWnd); - } -#endif // (_WIN32_IE >= 0x0400) - - HWND GetCommandBar(UINT uBand) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBands_GetCommandBar(m_hWnd, uBand); - } - - BOOL GetRestoreInformation(UINT uBand, LPCOMMANDBANDSRESTOREINFO pcbr) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBands_GetRestoreInformation(m_hWnd, uBand, pcbr); - } - -// Operations - HWND Create(HWND hWndParent, UINT wID, DWORD dwStyles, HIMAGELIST hImageList = NULL) - { - m_hWnd = ::CommandBands_Create(ModuleHelper::GetModuleInstance(), hWndParent, wID, dwStyles, hImageList); - ATLASSERT(::IsWindow(m_hWnd)); - return m_hWnd; - } - - BOOL AddAdornments(DWORD dwFlags = 0, LPREBARBANDINFO prbbi = NULL) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBands_AddAdornments(m_hWnd, ModuleHelper::GetModuleInstance(), dwFlags, prbbi); - } - - BOOL AddBands(UINT uBandCount, LPREBARBANDINFO prbbi) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBands_AddBands(m_hWnd, ModuleHelper::GetModuleInstance(), uBandCount, prbbi); - } - - BOOL Show(BOOL bShow = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - return ::CommandBands_Show(m_hWnd, bShow); - } -}; - -typedef CCECommandBandsCtrlT CCECommandBandsCtrl; - -#endif // _WIN32_WCE - }; // namespace WTL #endif // __ATLCTRLS_H__ diff --git a/thirdparty/wtl/atlctrlw.h b/thirdparty/wtl/atlctrlw.h index 0add350..b9b282d 100644 --- a/thirdparty/wtl/atlctrlw.h +++ b/thirdparty/wtl/atlctrlw.h @@ -1,23 +1,16 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. +// Windows Template Library - WTL version 10.0 +// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. +// Microsoft Public License (http://opensource.org/licenses/MS-PL) +// which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLCTRLW_H__ #define __ATLCTRLW_H__ #pragma once -#ifdef _WIN32_WCE - #error atlctrlw.h is not supported on Windows CE -#endif - #ifndef __ATLAPP_H__ #error atlctrlw.h requires atlapp.h to be included first #endif @@ -26,20 +19,12 @@ #error atlctrlw.h requires atlctrls.h to be included first #endif -#if (_WIN32_IE < 0x0400) - #error atlctrlw.h requires _WIN32_IE >= 0x0400 -#endif - // Define _WTL_CMDBAR_VISTA_MENUS as 0 to exclude Vista menus support -#if !defined(_WTL_CMDBAR_VISTA_MENUS) && (WINVER >= 0x0500) && (_WIN32_WINNT >= 0x0501) && (_WIN32_IE >= 0x0501) +#ifndef _WTL_CMDBAR_VISTA_MENUS #define _WTL_CMDBAR_VISTA_MENUS 1 #endif -#if _WTL_CMDBAR_VISTA_MENUS - #if !((_WIN32_WINNT >= 0x0501) && (_WIN32_IE >= 0x0501)) - #error _WTL_CMDBAR_VISTA_MENUS requires (_WIN32_WINNT >= 0x0501) && (_WIN32_IE >= 0x0501) - #endif -#endif +// Note: Define _WTL_CMDBAR_VISTA_STD_MENUBAR to use Vista standard menubar look with Vista menus /////////////////////////////////////////////////////////////////////////////// @@ -100,29 +85,29 @@ class CSimpleStack : public ATL::CSimpleArray< T > #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - STACK-PUSH (%8.8X) size = %i\n"), t, GetSize()); #endif - return Add(t); + return this->Add(t); } T Pop() { - int nLast = GetSize() - 1; + int nLast = this->GetSize() - 1; if(nLast < 0) return NULL; // must be able to convert to NULL - T t = m_aT[nLast]; + T t = this->m_aT[nLast]; #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - STACK-POP (%8.8X) size = %i\n"), t, GetSize()); #endif - if(!RemoveAt(nLast)) + if(!this->RemoveAt(nLast)) return NULL; return t; } T GetCurrent() { - int nLast = GetSize() - 1; + int nLast = this->GetSize() - 1; if(nLast < 0) return NULL; // must be able to convert to NULL - return m_aT[nLast]; + return this->m_aT[nLast]; } }; @@ -146,7 +131,6 @@ class CCommandBarCtrlBase : public CToolBarCtrl static CMsgHookMap* s_pmapMsgHook; static HHOOK s_hCreateHook; - static bool s_bW2K; // For animation flag static CCommandBarCtrlBase* s_pCurrentBar; static bool s_bStaticInit; @@ -174,8 +158,6 @@ class CCommandBarCtrlBase : public CToolBarCtrl { // Just in case... AtlInitCommonControls(ICC_COOL_CLASSES | ICC_BAR_CLASSES); - // Animation on Win2000 only - s_bW2K = !AtlIsOldWindows(); // done s_bStaticInit = true; } @@ -190,7 +172,6 @@ class CCommandBarCtrlBase : public CToolBarCtrl __declspec(selectany) CCommandBarCtrlBase::CMsgHookMap* CCommandBarCtrlBase::s_pmapMsgHook = NULL; __declspec(selectany) HHOOK CCommandBarCtrlBase::s_hCreateHook = NULL; __declspec(selectany) CCommandBarCtrlBase* CCommandBarCtrlBase::s_pCurrentBar = NULL; -__declspec(selectany) bool CCommandBarCtrlBase::s_bW2K = false; __declspec(selectany) bool CCommandBarCtrlBase::s_bStaticInit = false; @@ -331,7 +312,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi if(m_wndParent.IsWindow()) /*scary!*/ m_wndParent.UnsubclassWindow(); - if(m_hMenu != NULL && (m_dwExtendedStyle & CBR_EX_SHAREMENU) == 0) + if((m_hMenu != NULL) && ((m_dwExtendedStyle & CBR_EX_SHAREMENU) == 0)) ::DestroyMenu(m_hMenu); if(m_hImageList != NULL) @@ -356,7 +337,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi CMenuHandle GetMenu() const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); return m_hMenu; } @@ -409,7 +390,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi } } - if(cx == 0 || cy == 0) + if((cx == 0) || (cy == 0)) return false; m_szBitmap.cx = cx; @@ -457,12 +438,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi { // These styles are required for command bars dwStyle |= TBSTYLE_LIST | TBSTYLE_FLAT; -#if (_MSC_VER >= 1300) return ATL::CWindowImpl< T, TBase, TWinTraits >::Create(hWndParent, rcPos, szWindowName, dwStyle, dwExStyle, nID, lpCreateParam); -#else // !(_MSC_VER >= 1300) - typedef ATL::CWindowImpl< T, TBase, TWinTraits > _baseClass; - return _baseClass::Create(hWndParent, rcPos, szWindowName, dwStyle, dwExStyle, nID, lpCreateParam); -#endif // !(_MSC_VER >= 1300) } BOOL AttachToWindow(HWND hWnd) @@ -497,9 +473,9 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi BOOL AttachMenu(HMENU hMenu) { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(hMenu == NULL || ::IsMenu(hMenu)); - if(hMenu != NULL && !::IsMenu(hMenu)) + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((hMenu == NULL) || ::IsMenu(hMenu)); + if((hMenu != NULL) && !::IsMenu(hMenu)) return FALSE; #if _WTL_CMDBAR_VISTA_MENUS @@ -512,7 +488,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi #endif // _WTL_CMDBAR_VISTA_MENUS // destroy old menu, if needed, and set new one - if(m_hMenu != NULL && (m_dwExtendedStyle & CBR_EX_SHAREMENU) == 0) + if((m_hMenu != NULL) && ((m_dwExtendedStyle & CBR_EX_SHAREMENU) == 0)) ::DestroyMenu(m_hMenu); m_hMenu = hMenu; @@ -521,12 +497,12 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi return TRUE; // Build buttons according to menu - SetRedraw(FALSE); + this->SetRedraw(FALSE); // Clear all buttons - int nCount = GetButtonCount(); + int nCount = this->GetButtonCount(); for(int i = 0; i < nCount; i++) - ATLVERIFY(DeleteButton(0) != FALSE); + ATLVERIFY(this->DeleteButton(0) != FALSE); // Add buttons for each menu item if(m_hMenu != NULL) @@ -560,11 +536,11 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi btn.iBitmap = 0; btn.idCommand = i; btn.fsState = (BYTE)(((mii.fState & MFS_DISABLED) == 0) ? TBSTATE_ENABLED : 0); - btn.fsStyle = TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE | TBSTYLE_DROPDOWN; + btn.fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_DROPDOWN; btn.dwData = 0; btn.iString = 0; - bRet = InsertButton(-1, &btn); + bRet = this->InsertButton(-1, &btn); ATLASSERT(bRet); TBBUTTONINFO bi = { 0 }; @@ -572,14 +548,14 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi bi.dwMask = TBIF_TEXT; bi.pszText = szString; - bRet = SetButtonInfo(i, &bi); + bRet = this->SetButtonInfo(i, &bi); ATLASSERT(bRet); } } - SetRedraw(TRUE); - Invalidate(); - UpdateWindow(); + this->SetRedraw(TRUE); + this->Invalidate(); + this->UpdateWindow(); return TRUE; } @@ -596,7 +572,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi BOOL _LoadImagesHelper(ATL::_U_STRINGorID image, bool bMapped, UINT nFlags = 0, LPCOLORMAP lpColorMap = NULL, int nMapSize = 0) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); HINSTANCE hInstance = ModuleHelper::GetResourceInstance(); HRSRC hRsrc = ::FindResource(hInstance, image.m_lpstr, (LPTSTR)RT_TOOLBAR); @@ -702,7 +678,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi CBitmapHandle bmp = hBitmap; SIZE size = { 0, 0 }; bmp.GetSize(size); - if(size.cx != m_szBitmap.cx || size.cy != m_szBitmap.cy) + if((size.cx != m_szBitmap.cx) || (size.cy != m_szBitmap.cy)) { ATLASSERT(FALSE); // must match size! return FALSE; @@ -816,7 +792,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi { bRet = (::ImageList_ReplaceIcon(m_hImageList, i, hIcon) != -1); #if _WTL_CMDBAR_VISTA_MENUS - if(RunTimeHelper::IsVista() && bRet != FALSE) + if(RunTimeHelper::IsVista() && (bRet != FALSE)) { T* pT = static_cast(this); pT->_ReplaceVistaBitmapFromImageList(i); @@ -879,7 +855,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi BOOL TrackPopupMenu(HMENU hMenu, UINT uFlags, int x, int y, LPTPMPARAMS lpParams = NULL) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(::IsMenu(hMenu)); if(!::IsMenu(hMenu)) return FALSE; @@ -909,6 +885,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi MESSAGE_HANDLER(GetGetBarMessage(), OnInternalGetBar) MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) MESSAGE_HANDLER(WM_MENUCHAR, OnMenuChar) + MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus) MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown) MESSAGE_HANDLER(WM_KEYUP, OnKeyUp) @@ -957,9 +934,9 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi LRESULT OnForwardMsg(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) { LPMSG pMsg = (LPMSG)lParam; - if(pMsg->message >= WM_MOUSEFIRST && pMsg->message <= WM_MOUSELAST) + if((pMsg->message >= WM_MOUSEFIRST) && (pMsg->message <= WM_MOUSELAST)) m_bKeyboardInput = false; - else if(pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST) + else if((pMsg->message >= WM_KEYFIRST) && (pMsg->message <= WM_KEYLAST)) m_bKeyboardInput = true; LRESULT lRet = 0; ProcessWindowMessage(pMsg->hwnd, pMsg->message, pMsg->wParam, pMsg->lParam, lRet, 3); @@ -969,17 +946,17 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { // Let the toolbar initialize itself - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); + LRESULT lRet = this->DefWindowProc(uMsg, wParam, lParam); // get and use system settings T* pT = static_cast(this); pT->GetSystemSettings(); // Parent init - ATL::CWindow wndParent = GetParent(); + ATL::CWindow wndParent = this->GetParent(); ATL::CWindow wndTopLevelParent = wndParent.GetTopLevelParent(); m_wndParent.SubclassWindow(wndTopLevelParent); // Toolbar Init - SetButtonStructSize(); - SetImageList(NULL); + this->SetButtonStructSize(); + this->SetImageList(NULL); // Create message hook if needed CWindowCreateCriticalSectionLock lock; @@ -990,27 +967,27 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi return -1; } - if(s_pmapMsgHook == NULL) + if(this->s_pmapMsgHook == NULL) { - ATLTRY(s_pmapMsgHook = new CMsgHookMap); - ATLASSERT(s_pmapMsgHook != NULL); + ATLTRY(this->s_pmapMsgHook = new CCommandBarCtrlBase::CMsgHookMap); + ATLASSERT(this->s_pmapMsgHook != NULL); } - if(s_pmapMsgHook != NULL) + if(this->s_pmapMsgHook != NULL) { DWORD dwThreadID = ::GetCurrentThreadId(); - _MsgHookData* pData = s_pmapMsgHook->Lookup(dwThreadID); + CCommandBarCtrlBase::_MsgHookData* pData = this->s_pmapMsgHook->Lookup(dwThreadID); if(pData == NULL) { - ATLTRY(pData = new _MsgHookData); + ATLTRY(pData = new CCommandBarCtrlBase::_MsgHookData); ATLASSERT(pData != NULL); HHOOK hMsgHook = ::SetWindowsHookEx(WH_GETMESSAGE, MessageHookProc, ModuleHelper::GetModuleInstance(), dwThreadID); ATLASSERT(hMsgHook != NULL); - if(pData != NULL && hMsgHook != NULL) + if((pData != NULL) && (hMsgHook != NULL)) { pData->hMsgHook = hMsgHook; pData->dwUsage = 1; - BOOL bRet = s_pmapMsgHook->Add(dwThreadID, pData); + BOOL bRet = this->s_pmapMsgHook->Add(dwThreadID, pData); bRet; ATLASSERT(bRet); } @@ -1023,16 +1000,14 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi lock.Unlock(); // Get layout -#if (WINVER >= 0x0500) - m_bLayoutRTL = ((GetExStyle() & WS_EX_LAYOUTRTL) != 0); -#endif // (WINVER >= 0x0500) + m_bLayoutRTL = ((this->GetExStyle() & WS_EX_LAYOUTRTL) != 0); return lRet; } LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); + LRESULT lRet = this->DefWindowProc(uMsg, wParam, lParam); #if _WTL_CMDBAR_VISTA_MENUS if(m_bVistaMenus && (m_hMenu != NULL)) @@ -1059,10 +1034,10 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi return lRet; } - if(s_pmapMsgHook != NULL) + if(this->s_pmapMsgHook != NULL) { DWORD dwThreadID = ::GetCurrentThreadId(); - _MsgHookData* pData = s_pmapMsgHook->Lookup(dwThreadID); + CCommandBarCtrlBase::_MsgHookData* pData = this->s_pmapMsgHook->Lookup(dwThreadID); if(pData != NULL) { (pData->dwUsage)--; @@ -1070,16 +1045,16 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi { BOOL bRet = ::UnhookWindowsHookEx(pData->hMsgHook); ATLASSERT(bRet); - bRet = s_pmapMsgHook->Remove(dwThreadID); + bRet = this->s_pmapMsgHook->Remove(dwThreadID); ATLASSERT(bRet); if(bRet) delete pData; } - if(s_pmapMsgHook->GetSize() == 0) + if(this->s_pmapMsgHook->GetSize() == 0) { - delete s_pmapMsgHook; - s_pmapMsgHook = NULL; + delete this->s_pmapMsgHook; + this->s_pmapMsgHook = NULL; } } } @@ -1094,6 +1069,12 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnKeyDown\n")); #endif + if(m_bAttachedMenu) // nothing to do in this mode + { + bHandled = FALSE; + return 1; + } + bHandled = FALSE; // Simulate Alt+Space for the parent if(wParam == VK_SPACE) @@ -1101,25 +1082,23 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi m_wndParent.PostMessage(WM_SYSKEYDOWN, wParam, lParam | (1 << 29)); bHandled = TRUE; } -#if (_WIN32_IE >= 0x0500) - else if(wParam == VK_LEFT || wParam == VK_RIGHT) + else if((wParam == VK_LEFT) || (wParam == VK_RIGHT)) { WPARAM wpNext = m_bLayoutRTL ? VK_LEFT : VK_RIGHT; if(!m_bMenuActive) { T* pT = static_cast(this); - int nBtn = GetHotItem(); + int nBtn = this->GetHotItem(); int nNextBtn = (wParam == wpNext) ? pT->GetNextMenuItem(nBtn) : pT->GetPreviousMenuItem(nBtn); if(nNextBtn == -2) { - SetHotItem(-1); + this->SetHotItem(-1); if(pT->DisplayChevronMenu()) bHandled = TRUE; } } } -#endif // (_WIN32_IE >= 0x0500) return 0; } @@ -1128,8 +1107,15 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnKeyUp\n")); #endif + if(m_bAttachedMenu) // nothing to do in this mode + { + bHandled = FALSE; + return 1; + } + if(wParam != VK_SPACE) bHandled = FALSE; + return 0; } @@ -1138,46 +1124,46 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnChar\n")); #endif + if(m_bAttachedMenu) // nothing to do in this mode + { + bHandled = FALSE; + return 1; + } + if(wParam != VK_SPACE) bHandled = FALSE; else return 0; // Security - if(!m_wndParent.IsWindowEnabled() || ::GetFocus() != m_hWnd) + if(!m_wndParent.IsWindowEnabled() || (::GetFocus() != this->m_hWnd)) return 0; // Handle mnemonic press when we have focus int nBtn = 0; - if(wParam != VK_RETURN && !MapAccelerator((TCHAR)LOWORD(wParam), nBtn)) + if((wParam != VK_RETURN) && !this->MapAccelerator((TCHAR)LOWORD(wParam), nBtn)) { -#if (_WIN32_IE >= 0x0500) if((TCHAR)LOWORD(wParam) != _chChevronShortcut) -#endif // (_WIN32_IE >= 0x0500) ::MessageBeep(0); } else { -#if (_WIN32_IE >= 0x0500) RECT rcClient = { 0 }; - GetClientRect(&rcClient); + this->GetClientRect(&rcClient); RECT rcBtn = { 0 }; - GetItemRect(nBtn, &rcBtn); + this->GetItemRect(nBtn, &rcBtn); TBBUTTON tbb = { 0 }; - GetButton(nBtn, &tbb); - if((tbb.fsState & TBSTATE_ENABLED) != 0 && (tbb.fsState & TBSTATE_HIDDEN) == 0 && rcBtn.right <= rcClient.right) + this->GetButton(nBtn, &tbb); + if(((tbb.fsState & TBSTATE_ENABLED) != 0) && ((tbb.fsState & TBSTATE_HIDDEN) == 0) && (rcBtn.right <= rcClient.right)) { -#endif // (_WIN32_IE >= 0x0500) - PostMessage(WM_KEYDOWN, VK_DOWN, 0L); + this->PostMessage(WM_KEYDOWN, VK_DOWN, 0L); if(wParam != VK_RETURN) - SetHotItem(nBtn); -#if (_WIN32_IE >= 0x0500) + this->SetHotItem(nBtn); } else { ::MessageBeep(0); bHandled = TRUE; } -#endif // (_WIN32_IE >= 0x0500) } return 0; } @@ -1219,7 +1205,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi CDCHandle dc = (HDC)wParam; RECT rect = { 0 }; - GetClientRect(&rect); + this->GetClientRect(&rect); dc.FillRect(&rect, COLOR_MENU); return 1; // don't do the default erase @@ -1227,8 +1213,8 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi LRESULT OnInitMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { - int nIndex = GetHotItem(); - SendMessage(WM_MENUSELECT, MAKEWPARAM(nIndex, MF_POPUP|MF_HILITE), (LPARAM)m_hMenu); + int nIndex = this->GetHotItem(); + this->SendMessage(WM_MENUSELECT, MAKEWPARAM(nIndex, MF_POPUP|MF_HILITE), (LPARAM)m_hMenu); bHandled = FALSE; return 1; } @@ -1253,9 +1239,9 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi // forward to the parent or subclassed window, so it can handle update UI LRESULT lRet = 0; if(m_bAttachedMenu) - lRet = DefWindowProc(uMsg, wParam, (lParam || m_bContextMenu) ? lParam : GetHotItem()); + lRet = this->DefWindowProc(uMsg, wParam, (lParam || m_bContextMenu) ? lParam : this->GetHotItem()); else - lRet = m_wndParent.DefWindowProc(uMsg, wParam, (lParam || m_bContextMenu) ? lParam : GetHotItem()); + lRet = m_wndParent.DefWindowProc(uMsg, wParam, (lParam || m_bContextMenu) ? lParam : this->GetHotItem()); #if _WTL_CMDBAR_VISTA_MENUS // If Vista menus are active, just set bitmaps and return @@ -1323,7 +1309,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi ATLTRY(pMI->lpstrText = new TCHAR[cchLen]); ATLASSERT(pMI->lpstrText != NULL); if(pMI->lpstrText != NULL) - SecureHelper::strcpy_x(pMI->lpstrText, cchLen, szString); + ATL::Checked::tcscpy_s(pMI->lpstrText, cchLen, szString); mii.dwItemData = (ULONG_PTR)pMI; bRet = menuPopup.SetMenuItemInfo(i, TRUE, &mii); ATLASSERT(bRet); @@ -1332,7 +1318,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi } // Add it to the list - m_stackMenuHandle.Push(menuPopup.m_hMenu); + this->m_stackMenuHandle.Push(menuPopup.m_hMenu); } return lRet; @@ -1350,17 +1336,17 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi } // Check if a menu is closing, do a cleanup - if(HIWORD(wParam) == 0xFFFF && lParam == NULL) // Menu closing + if((HIWORD(wParam) == 0xFFFF) && (lParam == NULL)) // Menu closing { #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnMenuSelect - CLOSING!!!!\n")); #endif - ATLASSERT(m_stackMenuWnd.GetSize() == 0); + ATLASSERT(this->m_stackMenuWnd.GetSize() == 0); // Restore the menu items to the previous state for all menus that were converted if(m_bImagesVisible) { HMENU hMenu = NULL; - while((hMenu = m_stackMenuHandle.Pop()) != NULL) + while((hMenu = this->m_stackMenuHandle.Pop()) != NULL) { CMenuHandle menuPopup = hMenu; ATLASSERT(menuPopup.m_hMenu != NULL); @@ -1374,7 +1360,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi ATLASSERT(bRet); _MenuItemData* pMI = (_MenuItemData*)mii.dwItemData; - if(pMI != NULL && pMI->IsCmdBarMenuItem()) + if((pMI != NULL) && pMI->IsCmdBarMenuItem()) { mii.fMask = MIIM_DATA | MIIM_TYPE | MIIM_STATE; mii.fType = pMI->fType; @@ -1411,7 +1397,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi // Let's make sure we're not embedded in another process if((LPVOID)wParam != NULL) *((DWORD*)wParam) = GetCurrentProcessId(); - if(IsWindowVisible()) + if(this->IsWindowVisible()) return (LRESULT)static_cast(this); else return NULL; @@ -1419,14 +1405,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { -#ifndef SPI_GETKEYBOARDCUES - const UINT SPI_SETKEYBOARDCUES = 0x100B; -#endif // !SPI_GETKEYBOARDCUES -#ifndef SPI_GETFLATMENU - const UINT SPI_SETFLATMENU = 0x1023; -#endif // !SPI_GETFLATMENU - - if(wParam == SPI_SETNONCLIENTMETRICS || wParam == SPI_SETKEYBOARDCUES || wParam == SPI_SETFLATMENU) + if((wParam == SPI_SETNONCLIENTMETRICS) || (wParam == SPI_SETKEYBOARDCUES) || (wParam == SPI_SETFLATMENU)) { T* pT = static_cast(this); pT->GetSystemSettings(); @@ -1456,12 +1435,12 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi T* pT = static_cast(this); LRESULT lRet; - if(m_bMenuActive && LOWORD(wParam) != 0x0D) + if(m_bMenuActive && (LOWORD(wParam) != 0x0D)) lRet = 0; else lRet = MAKELRESULT(1, 1); - if(m_bMenuActive && HIWORD(wParam) == MF_POPUP) + if(m_bMenuActive && (HIWORD(wParam) == MF_POPUP)) { // Convert character to lower/uppercase and possibly Unicode, using current keyboard layout TCHAR ch = (TCHAR)LOWORD(wParam); @@ -1482,15 +1461,15 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi if(!bRet || (mii.fType & MFT_SEPARATOR)) continue; _MenuItemData* pmd = (_MenuItemData*)mii.dwItemData; - if(pmd != NULL && pmd->IsCmdBarMenuItem()) + if((pmd != NULL) && pmd->IsCmdBarMenuItem()) { LPTSTR p = pmd->lpstrText; if(p != NULL) { - while(*p && *p != _T('&')) + while(*p && (*p != _T('&'))) p = ::CharNext(p); - if(p != NULL && *p) + if((p != NULL) && *p) { DWORD dwP = MAKELONG(*(++p), 0); DWORD dwC = MAKELONG(ch, 0); @@ -1515,7 +1494,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi { if(nRetCode == MNC_EXECUTE) { - PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); + this->PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); pT->GiveFocusBack(); } bHandled = TRUE; @@ -1525,59 +1504,62 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi else if(!m_bMenuActive) { int nBtn = 0; - if(!MapAccelerator((TCHAR)LOWORD(wParam), nBtn)) + if(!this->MapAccelerator((TCHAR)LOWORD(wParam), nBtn)) { bHandled = FALSE; - PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); + this->PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); pT->GiveFocusBack(); -#if (_WIN32_IE >= 0x0500) // check if we should display chevron menu if((TCHAR)LOWORD(wParam) == pT->_chChevronShortcut) { if(pT->DisplayChevronMenu()) bHandled = TRUE; } -#endif // (_WIN32_IE >= 0x0500) } else if(m_wndParent.IsWindowEnabled()) { -#if (_WIN32_IE >= 0x0500) RECT rcClient = { 0 }; - GetClientRect(&rcClient); + this->GetClientRect(&rcClient); RECT rcBtn = { 0 }; - GetItemRect(nBtn, &rcBtn); + this->GetItemRect(nBtn, &rcBtn); TBBUTTON tbb = { 0 }; - GetButton(nBtn, &tbb); - if((tbb.fsState & TBSTATE_ENABLED) != 0 && (tbb.fsState & TBSTATE_HIDDEN) == 0 && rcBtn.right <= rcClient.right) + this->GetButton(nBtn, &tbb); + if(((tbb.fsState & TBSTATE_ENABLED) != 0) && ((tbb.fsState & TBSTATE_HIDDEN) == 0) && (rcBtn.right <= rcClient.right)) { -#endif // (_WIN32_IE >= 0x0500) if(m_bUseKeyboardCues && !m_bShowKeyboardCues) { m_bAllowKeyboardCues = true; ShowKeyboardCues(true); } pT->TakeFocus(); - PostMessage(WM_KEYDOWN, VK_DOWN, 0L); - SetHotItem(nBtn); -#if (_WIN32_IE >= 0x0500) + this->PostMessage(WM_KEYDOWN, VK_DOWN, 0L); + this->SetHotItem(nBtn); } else { ::MessageBeep(0); } -#endif // (_WIN32_IE >= 0x0500) } } return lRet; } + LRESULT OnKillFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) + { + if(m_bUseKeyboardCues && m_bShowKeyboardCues) + ShowKeyboardCues(false); + + bHandled = FALSE; + return 1; + } + LRESULT OnDrawItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { LPDRAWITEMSTRUCT lpDrawItemStruct = (LPDRAWITEMSTRUCT)lParam; _MenuItemData* pmd = (_MenuItemData*)lpDrawItemStruct->itemData; - if(lpDrawItemStruct->CtlType == ODT_MENU && pmd != NULL && pmd->IsCmdBarMenuItem()) + if((lpDrawItemStruct->CtlType == ODT_MENU) && (pmd != NULL) && pmd->IsCmdBarMenuItem()) { T* pT = static_cast(this); pT->DrawItem(lpDrawItemStruct); @@ -1593,7 +1575,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi { LPMEASUREITEMSTRUCT lpMeasureItemStruct = (LPMEASUREITEMSTRUCT)lParam; _MenuItemData* pmd = (_MenuItemData*)lpMeasureItemStruct->itemData; - if(lpMeasureItemStruct->CtlType == ODT_MENU && pmd != NULL && pmd->IsCmdBarMenuItem()) + if((lpMeasureItemStruct->CtlType == ODT_MENU) && (pmd != NULL) && pmd->IsCmdBarMenuItem()) { T* pT = static_cast(this); pT->MeasureItem(lpMeasureItemStruct); @@ -1625,7 +1607,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi LRESULT OnAPIGetCmdBar(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { - return (LRESULT)m_hWnd; + return (LRESULT)this->m_hWnd; } // Parent window message handlers @@ -1634,7 +1616,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi LPNMTBHOTITEM lpNMHT = (LPNMTBHOTITEM)pnmh; // Check if this comes from us - if(pnmh->hwndFrom != m_hWnd) + if(pnmh->hwndFrom != this->m_hWnd) { bHandled = FALSE; return 0; @@ -1649,45 +1631,36 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi } if((!m_wndParent.IsWindowEnabled() || bBlockTracking) && (lpNMHT->dwFlags & HICF_MOUSE)) - { return 1; - } - else - { -#ifndef HICF_LMOUSE - const DWORD HICF_LMOUSE = 0x00000080; // left mouse button selected -#endif - bHandled = FALSE; - // Send WM_MENUSELECT to the app if it needs to display a status text - if(!(lpNMHT->dwFlags & HICF_MOUSE) - && !(lpNMHT->dwFlags & HICF_ACCELERATOR) - && !(lpNMHT->dwFlags & HICF_LMOUSE)) - { - if(lpNMHT->dwFlags & HICF_ENTERING) - m_wndParent.SendMessage(WM_MENUSELECT, 0, (LPARAM)m_hMenu); - if(lpNMHT->dwFlags & HICF_LEAVING) - m_wndParent.SendMessage(WM_MENUSELECT, MAKEWPARAM(0, 0xFFFF), NULL); - } + bHandled = FALSE; - return 0; + // Send WM_MENUSELECT to the app if it needs to display a status text + if(!(lpNMHT->dwFlags & HICF_MOUSE) && !(lpNMHT->dwFlags & HICF_ACCELERATOR) && !(lpNMHT->dwFlags & HICF_LMOUSE)) + { + if(lpNMHT->dwFlags & HICF_ENTERING) + m_wndParent.SendMessage(WM_MENUSELECT, 0, (LPARAM)m_hMenu); + if(lpNMHT->dwFlags & HICF_LEAVING) + m_wndParent.SendMessage(WM_MENUSELECT, MAKEWPARAM(0, 0xFFFF), NULL); } + + return 0; } LRESULT OnParentDropDown(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) { // Check if this comes from us - if(pnmh->hwndFrom != m_hWnd) + if(pnmh->hwndFrom != this->m_hWnd) { bHandled = FALSE; return 1; } T* pT = static_cast(this); - if(::GetFocus() != m_hWnd) + if(::GetFocus() != this->m_hWnd) pT->TakeFocus(); LPNMTOOLBAR pNMToolBar = (LPNMTOOLBAR)pnmh; - int nIndex = CommandToIndex(pNMToolBar->iItem); + int nIndex = this->CommandToIndex(pNMToolBar->iItem); m_bContextMenu = false; m_bEscapePressed = false; pT->DoPopupMenu(nIndex, true); @@ -1708,18 +1681,18 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi LRESULT OnParentSysCommand(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { bHandled = FALSE; - if((m_uSysKey == VK_MENU - || (m_uSysKey == VK_F10 && !(::GetKeyState(VK_SHIFT) & 0x80)) - || m_uSysKey == VK_SPACE) - && wParam == SC_KEYMENU) + if(((m_uSysKey == VK_MENU) + || ((m_uSysKey == VK_F10) && !(::GetKeyState(VK_SHIFT) & 0x80)) + || (m_uSysKey == VK_SPACE)) + && (wParam == SC_KEYMENU)) { T* pT = static_cast(this); - if(::GetFocus() == m_hWnd) + if(::GetFocus() == this->m_hWnd) { pT->GiveFocusBack(); // exit menu "loop" - PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); + this->PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); } - else if(m_uSysKey != VK_SPACE && !m_bSkipMsg) + else if((m_uSysKey != VK_SPACE) && !m_bSkipMsg) { if(m_bUseKeyboardCues && !m_bShowKeyboardCues && m_bAllowKeyboardCues) ShowKeyboardCues(true); @@ -1782,8 +1755,8 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi } else { - Invalidate(); - UpdateWindow(); + this->Invalidate(); + this->UpdateWindow(); } bHandled = FALSE; return 1; @@ -1793,7 +1766,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi { LRESULT lRet = CDRF_DODEFAULT; bHandled = FALSE; - if(pnmh->hwndFrom == m_hWnd) + if(pnmh->hwndFrom == this->m_hWnd) { LPNMTBCUSTOMDRAW lpTBCustomDraw = (LPNMTBCUSTOMDRAW)pnmh; if(lpTBCustomDraw->nmcd.dwDrawStage == CDDS_PREPAINT) @@ -1803,54 +1776,86 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi } else if(lpTBCustomDraw->nmcd.dwDrawStage == CDDS_ITEMPREPAINT) { - if(m_bFlatMenus) +#if _WTL_CMDBAR_VISTA_MENUS && defined(_WTL_CMDBAR_VISTA_STD_MENUBAR) + if(m_bVistaMenus) + { + ::SetRectEmpty(&lpTBCustomDraw->rcText); + lRet = CDRF_NOTIFYPOSTPAINT; + bHandled = TRUE; + } + else +#endif // _WTL_CMDBAR_VISTA_MENUS && defined(_WTL_CMDBAR_VISTA_STD_MENUBAR) { -#ifndef COLOR_MENUHILIGHT - const int COLOR_MENUHILIGHT = 29; -#endif // !COLOR_MENUHILIGHT - bool bDisabled = ((lpTBCustomDraw->nmcd.uItemState & CDIS_DISABLED) == CDIS_DISABLED); - if(!bDisabled && ((lpTBCustomDraw->nmcd.uItemState & CDIS_HOT) == CDIS_HOT || - (lpTBCustomDraw->nmcd.uItemState & CDIS_SELECTED) == CDIS_SELECTED)) + if(m_bFlatMenus) { - ::FillRect(lpTBCustomDraw->nmcd.hdc, &lpTBCustomDraw->nmcd.rc, ::GetSysColorBrush(COLOR_MENUHILIGHT)); - ::FrameRect(lpTBCustomDraw->nmcd.hdc, &lpTBCustomDraw->nmcd.rc, ::GetSysColorBrush(COLOR_HIGHLIGHT)); - lpTBCustomDraw->clrText = ::GetSysColor(m_bParentActive ? COLOR_HIGHLIGHTTEXT : COLOR_GRAYTEXT); + bool bDisabled = ((lpTBCustomDraw->nmcd.uItemState & CDIS_DISABLED) == CDIS_DISABLED); + if(!bDisabled && (((lpTBCustomDraw->nmcd.uItemState & CDIS_HOT) == CDIS_HOT) || + (lpTBCustomDraw->nmcd.uItemState & CDIS_SELECTED) == CDIS_SELECTED)) + { + ::FillRect(lpTBCustomDraw->nmcd.hdc, &lpTBCustomDraw->nmcd.rc, ::GetSysColorBrush(COLOR_MENUHILIGHT)); + ::FrameRect(lpTBCustomDraw->nmcd.hdc, &lpTBCustomDraw->nmcd.rc, ::GetSysColorBrush(COLOR_HIGHLIGHT)); + lpTBCustomDraw->clrText = ::GetSysColor(m_bParentActive ? COLOR_HIGHLIGHTTEXT : COLOR_GRAYTEXT); + } + else if(bDisabled || !m_bParentActive) + { + lpTBCustomDraw->clrText = ::GetSysColor(COLOR_GRAYTEXT); + } + + _ParentCustomDrawHelper(lpTBCustomDraw); + + lRet = CDRF_SKIPDEFAULT; + bHandled = TRUE; } - else if(bDisabled || !m_bParentActive) + else if(!m_bParentActive) { lpTBCustomDraw->clrText = ::GetSysColor(COLOR_GRAYTEXT); + bHandled = TRUE; } - CDCHandle dc = lpTBCustomDraw->nmcd.hdc; - dc.SetTextColor(lpTBCustomDraw->clrText); - dc.SetBkMode(lpTBCustomDraw->nStringBkMode); - HFONT hFont = GetFont(); - HFONT hFontOld = NULL; - if(hFont != NULL) - hFontOld = dc.SelectFont(hFont); - const int cchText = 200; - TCHAR szText[cchText] = { 0 }; - TBBUTTONINFO tbbi = { 0 }; - tbbi.cbSize = sizeof(TBBUTTONINFO); - tbbi.dwMask = TBIF_TEXT; - tbbi.pszText = szText; - tbbi.cchText = cchText; - GetButtonInfo((int)lpTBCustomDraw->nmcd.dwItemSpec, &tbbi); - dc.DrawText(szText, -1, &lpTBCustomDraw->nmcd.rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER | (m_bShowKeyboardCues ? 0 : DT_HIDEPREFIX)); - if(hFont != NULL) - dc.SelectFont(hFontOld); - lRet = CDRF_SKIPDEFAULT; - bHandled = TRUE; } - else if(!m_bParentActive) - { + } +#if _WTL_CMDBAR_VISTA_MENUS && defined(_WTL_CMDBAR_VISTA_STD_MENUBAR) + else if (lpTBCustomDraw->nmcd.dwDrawStage == CDDS_ITEMPOSTPAINT) + { + bool bDisabled = ((lpTBCustomDraw->nmcd.uItemState & CDIS_DISABLED) == CDIS_DISABLED); + if(bDisabled || !m_bParentActive) lpTBCustomDraw->clrText = ::GetSysColor(COLOR_GRAYTEXT); - bHandled = TRUE; - } + + _ParentCustomDrawHelper(lpTBCustomDraw); + + lRet = CDRF_SKIPDEFAULT; + bHandled = TRUE; } +#endif // _WTL_CMDBAR_VISTA_MENUS && defined(_WTL_CMDBAR_VISTA_STD_MENUBAR) } return lRet; } + void _ParentCustomDrawHelper(LPNMTBCUSTOMDRAW lpTBCustomDraw) + { + CDCHandle dc = lpTBCustomDraw->nmcd.hdc; + dc.SetTextColor(lpTBCustomDraw->clrText); + dc.SetBkMode(lpTBCustomDraw->nStringBkMode); + + HFONT hFont = this->GetFont(); + HFONT hFontOld = NULL; + if(hFont != NULL) + hFontOld = dc.SelectFont(hFont); + + const int cchText = 200; + TCHAR szText[cchText] = { 0 }; + TBBUTTONINFO tbbi = { 0 }; + tbbi.cbSize = sizeof(TBBUTTONINFO); + tbbi.dwMask = TBIF_TEXT; + tbbi.pszText = szText; + tbbi.cchText = cchText; + this->GetButtonInfo((int)lpTBCustomDraw->nmcd.dwItemSpec, &tbbi); + + dc.DrawText(szText, -1, &lpTBCustomDraw->nmcd.rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER | (m_bShowKeyboardCues ? 0 : DT_HIDEPREFIX)); + + if(hFont != NULL) + dc.SelectFont(hFontOld); + } + // Message hook handlers LRESULT OnHookMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { @@ -1861,19 +1866,19 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi bHandled = FALSE; if(m_bMenuActive) { - if(::WindowFromPoint(point) == m_hWnd) + if(::WindowFromPoint(point) == this->m_hWnd) { - ScreenToClient(&point); - int nHit = HitTest(&point); + this->ScreenToClient(&point); + int nHit = this->HitTest(&point); - if((point.x != s_point.x || point.y != s_point.y) && nHit >= 0 && nHit < ::GetMenuItemCount(m_hMenu) && nHit != m_nPopBtn && m_nPopBtn != -1) + if(((point.x != s_point.x) || (point.y != s_point.y)) && (nHit >= 0) && (nHit < ::GetMenuItemCount(m_hMenu)) && (nHit != m_nPopBtn) && (m_nPopBtn != -1)) { TBBUTTON tbb = { 0 }; - GetButton(nHit, &tbb); + this->GetButton(nHit, &tbb); if((tbb.fsState & TBSTATE_ENABLED) != 0) { m_nNextPopBtn = nHit | 0xFFFF0000; - HWND hWndMenu = m_stackMenuWnd.GetCurrent(); + HWND hWndMenu = this->m_stackMenuWnd.GetCurrent(); ATLASSERT(hWndMenu != NULL); // this one is needed to close a menu if mouse button was down @@ -1888,7 +1893,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi } else { - ScreenToClient(&point); + this->ScreenToClient(&point); } s_point = point; @@ -1902,20 +1907,20 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_SYSKEYDOWN (0x%2.2X)\n"), wParam); #endif - if(wParam == VK_MENU && m_bParentActive && m_bUseKeyboardCues && !m_bShowKeyboardCues && m_bAllowKeyboardCues) + if((wParam == VK_MENU) && m_bParentActive && m_bUseKeyboardCues && !m_bShowKeyboardCues && m_bAllowKeyboardCues) ShowKeyboardCues(true); - if(wParam != VK_SPACE && !m_bMenuActive && ::GetFocus() == m_hWnd) + if((wParam != VK_SPACE) && !m_bMenuActive && (::GetFocus() == this->m_hWnd)) { m_bAllowKeyboardCues = false; - PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); + this->PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); T* pT = static_cast(this); pT->GiveFocusBack(); m_bSkipMsg = true; } else { - if(wParam == VK_SPACE && m_bUseKeyboardCues && m_bShowKeyboardCues) + if((wParam == VK_SPACE) && m_bUseKeyboardCues && m_bShowKeyboardCues) { m_bAllowKeyboardCues = true; ShowKeyboardCues(false); @@ -1944,7 +1949,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_SYSCHAR (0x%2.2X)\n"), wParam); #endif - if(!m_bMenuActive && m_hWndHook != m_hWnd && wParam != VK_SPACE) + if(!m_bMenuActive && (this->m_hWndHook != this->m_hWnd) && (wParam != VK_SPACE)) bHandled = TRUE; return 0; } @@ -1957,51 +1962,40 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi bHandled = FALSE; T* pT = static_cast(this); - if(wParam == VK_ESCAPE && m_stackMenuWnd.GetSize() <= 1) + if((wParam == VK_ESCAPE) && (this->m_stackMenuWnd.GetSize() <= 1)) { if(m_bMenuActive && !m_bContextMenu) { - int nHot = GetHotItem(); + int nHot = this->GetHotItem(); if(nHot == -1) nHot = m_nPopBtn; if(nHot == -1) nHot = 0; - SetHotItem(nHot); + this->SetHotItem(nHot); bHandled = TRUE; pT->TakeFocus(); m_bEscapePressed = true; // To keep focus m_bSkipPostDown = false; } - else if(::GetFocus() == m_hWnd && m_wndParent.IsWindow()) + else if((::GetFocus() == this->m_hWnd) && m_wndParent.IsWindow()) { - SetHotItem(-1); + this->SetHotItem(-1); pT->GiveFocusBack(); bHandled = TRUE; } } - else if(wParam == VK_RETURN || wParam == VK_UP || wParam == VK_DOWN) + else if((wParam == VK_RETURN) || (wParam == VK_UP) || (wParam == VK_DOWN)) { - if(!m_bMenuActive && ::GetFocus() == m_hWnd && m_wndParent.IsWindow()) + if(!m_bMenuActive && (::GetFocus() == this->m_hWnd) && m_wndParent.IsWindow()) { - int nHot = GetHotItem(); + int nHot = this->GetHotItem(); if(nHot != -1) { if(wParam != VK_RETURN) { if(!m_bSkipPostDown) { -// IE4 only: WM_KEYDOWN doesn't generate TBN_DROPDOWN, we need to simulate a mouse click -#if (_WIN32_IE < 0x0500) - DWORD dwMajor = 0, dwMinor = 0; - ATL::AtlGetCommCtrlVersion(&dwMajor, &dwMinor); - if(dwMajor <= 4 || (dwMajor == 5 && dwMinor < 80)) - { - RECT rect; - GetItemRect(nHot, &rect); - PostMessage(WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(rect.left, rect.top)); - } -#endif // (_WIN32_IE < 0x0500) - PostMessage(WM_KEYDOWN, VK_DOWN, 0L); + this->PostMessage(WM_KEYDOWN, VK_DOWN, 0L); m_bSkipPostDown = true; } else @@ -2016,22 +2010,22 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Can't find hot button\n")); } } - if(wParam == VK_RETURN && m_bMenuActive) + if((wParam == VK_RETURN) && m_bMenuActive) { - PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); + this->PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); m_nNextPopBtn = -1; pT->GiveFocusBack(); } } - else if(wParam == VK_LEFT || wParam == VK_RIGHT) + else if((wParam == VK_LEFT) || (wParam == VK_RIGHT)) { WPARAM wpNext = m_bLayoutRTL ? VK_LEFT : VK_RIGHT; WPARAM wpPrev = m_bLayoutRTL ? VK_RIGHT : VK_LEFT; - if(m_bMenuActive && !m_bContextMenu && !(wParam == wpNext && m_bPopupItem)) + if(m_bMenuActive && !m_bContextMenu && !((wParam == wpNext) && m_bPopupItem)) { bool bAction = false; - if(wParam == wpPrev && s_pCurrentBar->m_stackMenuWnd.GetSize() == 1) + if((wParam == wpPrev) && (this->s_pCurrentBar->m_stackMenuWnd.GetSize() == 1)) { m_nNextPopBtn = pT->GetPreviousMenuItem(m_nPopBtn); if(m_nNextPopBtn != -1) @@ -2043,7 +2037,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi if(m_nNextPopBtn != -1) bAction = true; } - HWND hWndMenu = m_stackMenuWnd.GetCurrent(); + HWND hWndMenu = this->m_stackMenuWnd.GetCurrent(); ATLASSERT(hWndMenu != NULL); // Close the popup menu @@ -2052,22 +2046,20 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi ::PostMessage(hWndMenu, WM_KEYDOWN, VK_ESCAPE, 0L); if(wParam == wpNext) { - int cItem = m_stackMenuWnd.GetSize() - 1; + int cItem = this->m_stackMenuWnd.GetSize() - 1; while(cItem >= 0) { - hWndMenu = m_stackMenuWnd[cItem]; + hWndMenu = this->m_stackMenuWnd[cItem]; if(hWndMenu != NULL) ::PostMessage(hWndMenu, WM_KEYDOWN, VK_ESCAPE, 0L); cItem--; } } -#if (_WIN32_IE >= 0x0500) if(m_nNextPopBtn == -2) { m_nNextPopBtn = -1; pT->DisplayChevronMenu(); } -#endif // (_WIN32_IE >= 0x0500) bHandled = TRUE; } } @@ -2184,7 +2176,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi CMenuItemInfo info; info.fMask = MIIM_CHECKMARKS | MIIM_TYPE; ::GetMenuItemInfo((HMENU)lpDrawItemStruct->hwndItem, lpDrawItemStruct->itemID, MF_BYCOMMAND, &info); - if(bChecked || info.hbmpUnchecked != NULL) + if(bChecked || (info.hbmpUnchecked != NULL)) { BOOL bRadio = ((info.fType & MFT_RADIOCHECK) != 0); bHasImage = pT->DrawCheckmark(dc, rcButn, bSelected, bDisabled, bRadio, bChecked ? info.hbmpChecked : info.hbmpUnchecked); @@ -2194,7 +2186,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi // draw item text int cxButn = m_szButton.cx; COLORREF colorBG = ::GetSysColor(bSelected ? COLOR_HIGHLIGHT : COLOR_MENU); - if(bSelected || lpDrawItemStruct->itemAction == ODA_SELECT) + if(bSelected || (lpDrawItemStruct->itemAction == ODA_SELECT)) { RECT rcBG = rcItem; if(bHasImage) @@ -2210,7 +2202,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi COLORREF colorText = ::GetSysColor(bDisabled ? (bSelected ? COLOR_GRAYTEXT : COLOR_3DSHADOW) : (bSelected ? COLOR_HIGHLIGHTTEXT : COLOR_MENUTEXT)); // font already selected by Windows - if(bDisabled && (!bSelected || colorText == colorBG)) + if(bDisabled && (!bSelected || (colorText == colorBG))) { // disabled - draw shadow text shifted down and right 1 pixel (unles selected) RECT rcDisabled = rcText; @@ -2228,16 +2220,12 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi const RECT& rcItem = lpDrawItemStruct->rcItem; T* pT = static_cast(this); -#ifndef COLOR_MENUHILIGHT - const int COLOR_MENUHILIGHT = 29; -#endif // !COLOR_MENUHILIGHT - BOOL bDisabled = lpDrawItemStruct->itemState & ODS_GRAYED; BOOL bSelected = lpDrawItemStruct->itemState & ODS_SELECTED; BOOL bChecked = lpDrawItemStruct->itemState & ODS_CHECKED; // paint background - if(bSelected || lpDrawItemStruct->itemAction == ODA_SELECT) + if(bSelected || (lpDrawItemStruct->itemAction == ODA_SELECT)) { if(bSelected) { @@ -2301,7 +2289,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi CMenuItemInfo info; info.fMask = MIIM_CHECKMARKS | MIIM_TYPE; ::GetMenuItemInfo((HMENU)lpDrawItemStruct->hwndItem, lpDrawItemStruct->itemID, MF_BYCOMMAND, &info); - if(bChecked || info.hbmpUnchecked != NULL) + if(bChecked || (info.hbmpUnchecked != NULL)) { BOOL bRadio = ((info.fType & MFT_RADIOCHECK) != 0); pT->DrawCheckmark(dc, rcButn, bSelected, bDisabled, bRadio, bChecked ? info.hbmpChecked : info.hbmpUnchecked); @@ -2324,7 +2312,8 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi void DrawMenuText(CDCHandle& dc, RECT& rc, LPCTSTR lpstrText, COLORREF color) { int nTab = -1; - for(int i = 0; i < lstrlen(lpstrText); i++) + const int nLen = lstrlen(lpstrText); + for(int i = 0; i < nLen; i++) { if(lpstrText[i] == _T('\t')) { @@ -2343,7 +2332,6 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi HBRUSH hBrush3DEffect = ::GetSysColorBrush(COLOR_3DHILIGHT), HBRUSH hBrushDisabledImage = ::GetSysColorBrush(COLOR_3DSHADOW)) { -#if (_WIN32_WINNT >= 0x0501) && (_WIN32_IE >= 0x0501) if(m_bAlphaImages) { IMAGELISTDRAWPARAMS ildp = { 0 }; @@ -2363,7 +2351,6 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi ::ImageList_DrawIndirect(&ildp); } else -#endif // (_WIN32_WINNT >= 0x0501) && (_WIN32_IE >= 0x0501) { // create memory DC CDC dcMem; @@ -2476,7 +2463,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi const DWORD ROP_DSna = 0x00220326L; // draw mask - RECT rcSource = { 0, 0, min(size.cx, rc.right - rc.left), min(size.cy, rc.bottom - rc.top) }; + RECT rcSource = { 0, 0, __min(size.cx, rc.right - rc.left), __min(size.cy, rc.bottom - rc.top) }; dcMask.DrawFrameControl(&rcSource, DFC_MENU, bRadio ? DFCS_MENUBULLET : DFCS_MENUCHECK); // draw shadow if disabled @@ -2578,7 +2565,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi hOldFont = dc.SelectFont(m_fontMenu); } - RECT rcText = { 0, 0, 0, 0 }; + RECT rcText = { 0 }; dc.DrawText(pmd->lpstrText, -1, &rcText, DT_SINGLELINE | DT_LEFT | DT_VCENTER | DT_CALCRECT); int cx = rcText.right - rcText.left; dc.SelectFont(hOldFont); @@ -2592,7 +2579,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi cy += cyMargin; // height of item is the bigger of these two - lpMeasureItemStruct->itemHeight = max(cy, (int)m_szButton.cy); + lpMeasureItemStruct->itemHeight = __max(cy, (int)m_szButton.cy); // width is width of text plus a bunch of stuff cx += 2 * s_kcxTextMargin; // L/R margin for readability @@ -2621,7 +2608,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi ::GetClassName(hWndMenu, szClassName, cchClassName); if(!lstrcmp(_T("#32768"), szClassName)) - s_pCurrentBar->m_stackMenuWnd.Push(hWndMenu); + CCommandBarCtrlBase::s_pCurrentBar->m_stackMenuWnd.Push(hWndMenu); } else if(nCode == HCBT_DESTROYWND) { @@ -2633,30 +2620,30 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi ::GetClassName(hWndMenu, szClassName, cchClassName); if(!lstrcmp(_T("#32768"), szClassName)) { - ATLASSERT(hWndMenu == s_pCurrentBar->m_stackMenuWnd.GetCurrent()); - s_pCurrentBar->m_stackMenuWnd.Pop(); + ATLASSERT(hWndMenu == CCommandBarCtrlBase::s_pCurrentBar->m_stackMenuWnd.GetCurrent()); + CCommandBarCtrlBase::s_pCurrentBar->m_stackMenuWnd.Pop(); } } - return ::CallNextHookEx(s_hCreateHook, nCode, wParam, lParam); + return ::CallNextHookEx(CCommandBarCtrlBase::s_hCreateHook, nCode, wParam, lParam); } static LRESULT CALLBACK MessageHookProc(int nCode, WPARAM wParam, LPARAM lParam) { LPMSG pMsg = (LPMSG)lParam; - if(nCode == HC_ACTION && wParam == PM_REMOVE && pMsg->message != GetGetBarMessage() && pMsg->message != WM_FORWARDMSG) + if((nCode == HC_ACTION) && (wParam == PM_REMOVE) && (pMsg->message != GetGetBarMessage()) && (pMsg->message != WM_FORWARDMSG)) { CCommandBarCtrlBase* pCmdBar = NULL; HWND hWnd = pMsg->hwnd; DWORD dwPID = 0; - while(pCmdBar == NULL && hWnd != NULL) + while((pCmdBar == NULL) && (hWnd != NULL)) { pCmdBar = (CCommandBarCtrlBase*)::SendMessage(hWnd, GetGetBarMessage(), (WPARAM)&dwPID, 0L); hWnd = ::GetParent(hWnd); } - if(pCmdBar != NULL && dwPID == GetCurrentProcessId()) + if((pCmdBar != NULL) && (dwPID == GetCurrentProcessId())) { pCmdBar->m_hWndHook = pMsg->hwnd; ATLASSERT(pCmdBar->IsCommandBarBase()); @@ -2669,11 +2656,11 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi } LRESULT lRet = 0; - ATLASSERT(s_pmapMsgHook != NULL); - if(s_pmapMsgHook != NULL) + ATLASSERT(CCommandBarCtrlBase::s_pmapMsgHook != NULL); + if(CCommandBarCtrlBase::s_pmapMsgHook != NULL) { DWORD dwThreadID = ::GetCurrentThreadId(); - _MsgHookData* pData = s_pmapMsgHook->Lookup(dwThreadID); + CCommandBarCtrlBase::_MsgHookData* pData = CCommandBarCtrlBase::s_pmapMsgHook->Lookup(dwThreadID); if(pData != NULL) { lRet = ::CallNextHookEx(pData->hMsgHook, nCode, wParam, lParam); @@ -2688,22 +2675,14 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - DoPopupMenu, bAnimate = %s\n"), bAnimate ? "true" : "false"); #endif - - // Menu animation flags -#ifndef TPM_VERPOSANIMATION - const UINT TPM_VERPOSANIMATION = 0x1000L; -#endif -#ifndef TPM_NOANIMATION - const UINT TPM_NOANIMATION = 0x4000L; -#endif T* pT = static_cast(this); // get popup menu and it's position RECT rect = { 0 }; - GetItemRect(nIndex, &rect); + this->GetItemRect(nIndex, &rect); POINT pt = { rect.left, rect.bottom }; - MapWindowPoints(NULL, &pt, 1); - MapWindowPoints(NULL, &rect); + this->MapWindowPoints(NULL, &pt, 1); + this->MapWindowPoints(NULL, &rect); TPMPARAMS TPMParams = { 0 }; TPMParams.cbSize = sizeof(TPMPARAMS); TPMParams.rcExclude = rect; @@ -2712,33 +2691,33 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi // get button ID TBBUTTON tbb = { 0 }; - GetButton(nIndex, &tbb); + this->GetButton(nIndex, &tbb); int nCmdID = tbb.idCommand; m_nPopBtn = nIndex; // remember current button's index // press button and display popup menu - PressButton(nCmdID, TRUE); - SetHotItem(nCmdID); + this->PressButton(nCmdID, TRUE); + this->SetHotItem(nCmdID); pT->DoTrackPopupMenu(hMenuPopup, TPM_LEFTBUTTON | TPM_VERTICAL | TPM_LEFTALIGN | TPM_TOPALIGN | - (s_bW2K ? (bAnimate ? TPM_VERPOSANIMATION : TPM_NOANIMATION) : 0), pt.x, pt.y, &TPMParams); - PressButton(nCmdID, FALSE); - if(::GetFocus() != m_hWnd) - SetHotItem(-1); + (bAnimate ? TPM_VERPOSANIMATION : TPM_NOANIMATION), pt.x, pt.y, &TPMParams); + this->PressButton(nCmdID, FALSE); + if(::GetFocus() != this->m_hWnd) + this->SetHotItem(-1); m_nPopBtn = -1; // restore // eat next message if click is on the same button MSG msg = { 0 }; - if(::PeekMessage(&msg, m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_NOREMOVE) && ::PtInRect(&rect, msg.pt)) - ::PeekMessage(&msg, m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_REMOVE); + if(::PeekMessage(&msg, this->m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_NOREMOVE) && ::PtInRect(&rect, msg.pt)) + ::PeekMessage(&msg, this->m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_REMOVE); // check if another popup menu should be displayed if(m_nNextPopBtn != -1) { - PostMessage(GetAutoPopupMessage(), m_nNextPopBtn & 0xFFFF); + this->PostMessage(GetAutoPopupMessage(), m_nNextPopBtn & 0xFFFF); if(!(m_nNextPopBtn & 0xFFFF0000) && !m_bPopupItem) - PostMessage(WM_KEYDOWN, VK_DOWN, 0); + this->PostMessage(WM_KEYDOWN, VK_DOWN, 0); m_nNextPopBtn = -1; } else @@ -2753,8 +2732,8 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi } else { - SetHotItem(nCmdID); - SetAnchorHighlight(TRUE); + this->SetHotItem(nCmdID); + this->SetAnchorHighlight(TRUE); } } } @@ -2771,23 +2750,23 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi return FALSE; } - ATLASSERT(s_hCreateHook == NULL); + ATLASSERT(this->s_hCreateHook == NULL); - s_pCurrentBar = static_cast(this); + this->s_pCurrentBar = static_cast(this); - s_hCreateHook = ::SetWindowsHookEx(WH_CBT, CreateHookProc, ModuleHelper::GetModuleInstance(), GetCurrentThreadId()); - ATLASSERT(s_hCreateHook != NULL); + this->s_hCreateHook = ::SetWindowsHookEx(WH_CBT, CreateHookProc, ModuleHelper::GetModuleInstance(), GetCurrentThreadId()); + ATLASSERT(this->s_hCreateHook != NULL); m_bPopupItem = false; m_bMenuActive = true; - BOOL bTrackRet = menuPopup.TrackPopupMenuEx(uFlags, x, y, m_hWnd, lpParams); + BOOL bTrackRet = menuPopup.TrackPopupMenuEx(uFlags, x, y, this->m_hWnd, lpParams); m_bMenuActive = false; - ::UnhookWindowsHookEx(s_hCreateHook); + ::UnhookWindowsHookEx(this->s_hCreateHook); - s_hCreateHook = NULL; - s_pCurrentBar = NULL; + this->s_hCreateHook = NULL; + this->s_pCurrentBar = NULL; lock.Unlock(); @@ -2796,17 +2775,17 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi ATLTRACE2(atlTraceUI, 0, _T("CmdBar - TrackPopupMenu - cleanup\n")); #endif - ATLASSERT(m_stackMenuWnd.GetSize() == 0); + ATLASSERT(this->m_stackMenuWnd.GetSize() == 0); - UpdateWindow(); - ATL::CWindow wndTL = GetTopLevelParent(); + this->UpdateWindow(); + ATL::CWindow wndTL = this->GetTopLevelParent(); wndTL.UpdateWindow(); // restore the menu items to the previous state for all menus that were converted if(m_bImagesVisible) { HMENU hMenuSav = NULL; - while((hMenuSav = m_stackMenuHandle.Pop()) != NULL) + while((hMenuSav = this->m_stackMenuHandle.Pop()) != NULL) { menuPopup = hMenuSav; BOOL bRet = FALSE; @@ -2819,7 +2798,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi ATLASSERT(bRet); _MenuItemData* pMI = (_MenuItemData*)mii.dwItemData; - if(pMI != NULL && pMI->IsCmdBarMenuItem()) + if((pMI != NULL) && pMI->IsCmdBarMenuItem()) { mii.fMask = MIIM_DATA | MIIM_TYPE | MIIM_STATE; mii.fType = pMI->fType; @@ -2846,27 +2825,23 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi { if(nBtn == -1) return -1; -#if (_WIN32_IE >= 0x0500) - RECT rcClient; - GetClientRect(&rcClient); -#endif // (_WIN32_IE >= 0x0500) + RECT rcClient = { 0 }; + this->GetClientRect(&rcClient); int nNextBtn; for(nNextBtn = nBtn - 1; nNextBtn != nBtn; nNextBtn--) { if(nNextBtn < 0) nNextBtn = ::GetMenuItemCount(m_hMenu) - 1; TBBUTTON tbb = { 0 }; - GetButton(nNextBtn, &tbb); -#if (_WIN32_IE >= 0x0500) - RECT rcBtn; - GetItemRect(nNextBtn, &rcBtn); + this->GetButton(nNextBtn, &tbb); + RECT rcBtn = { 0 }; + this->GetItemRect(nNextBtn, &rcBtn); if(rcBtn.right > rcClient.right) { nNextBtn = -2; // chevron break; } -#endif // (_WIN32_IE >= 0x0500) - if((tbb.fsState & TBSTATE_ENABLED) != 0 && (tbb.fsState & TBSTATE_HIDDEN) == 0) + if(((tbb.fsState & TBSTATE_ENABLED) != 0) && ((tbb.fsState & TBSTATE_HIDDEN) == 0)) break; } return (nNextBtn != nBtn) ? nNextBtn : -1; @@ -2876,10 +2851,8 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi { if(nBtn == -1) return -1; -#if (_WIN32_IE >= 0x0500) RECT rcClient = { 0 }; - GetClientRect(&rcClient); -#endif // (_WIN32_IE >= 0x0500) + this->GetClientRect(&rcClient); int nNextBtn = 0; int nCount = ::GetMenuItemCount(m_hMenu); for(nNextBtn = nBtn + 1; nNextBtn != nBtn; nNextBtn++) @@ -2887,39 +2860,36 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi if(nNextBtn >= nCount) nNextBtn = 0; TBBUTTON tbb = { 0 }; - GetButton(nNextBtn, &tbb); -#if (_WIN32_IE >= 0x0500) + this->GetButton(nNextBtn, &tbb); RECT rcBtn = { 0 }; - GetItemRect(nNextBtn, &rcBtn); + this->GetItemRect(nNextBtn, &rcBtn); if(rcBtn.right > rcClient.right) { nNextBtn = -2; // chevron break; } -#endif // (_WIN32_IE >= 0x0500) - if((tbb.fsState & TBSTATE_ENABLED) != 0 && (tbb.fsState & TBSTATE_HIDDEN) == 0) + if(((tbb.fsState & TBSTATE_ENABLED) != 0) && ((tbb.fsState & TBSTATE_HIDDEN) == 0)) break; } return (nNextBtn != nBtn) ? nNextBtn : -1; } -#if (_WIN32_IE >= 0x0500) bool DisplayChevronMenu() { // assume we are in a rebar - HWND hWndReBar = GetParent(); + HWND hWndReBar = this->GetParent(); int nCount = (int)::SendMessage(hWndReBar, RB_GETBANDCOUNT, 0, 0L); bool bRet = false; for(int i = 0; i < nCount; i++) { REBARBANDINFO rbbi = { RunTimeHelper::SizeOf_REBARBANDINFO(), RBBIM_CHILD | RBBIM_STYLE }; BOOL bRetBandInfo = (BOOL)::SendMessage(hWndReBar, RB_GETBANDINFO, i, (LPARAM)&rbbi); - if(bRetBandInfo && rbbi.hwndChild == m_hWnd) + if(bRetBandInfo && (rbbi.hwndChild == this->m_hWnd)) { if((rbbi.fStyle & RBBS_USECHEVRON) != 0) { ::PostMessage(hWndReBar, RB_PUSHCHEVRON, i, 0L); - PostMessage(WM_KEYDOWN, VK_DOWN, 0L); + this->PostMessage(WM_KEYDOWN, VK_DOWN, 0L); bRet = true; } break; @@ -2927,7 +2897,6 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi } return bRet; } -#endif // (_WIN32_IE >= 0x0500) void GetSystemSettings() { @@ -2940,20 +2909,20 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi LOGFONT logfont = { 0 }; if(m_fontMenu.m_hFont != NULL) m_fontMenu.GetLogFont(logfont); - if(logfont.lfHeight != info.lfMenuFont.lfHeight || - logfont.lfWidth != info.lfMenuFont.lfWidth || - logfont.lfEscapement != info.lfMenuFont.lfEscapement || - logfont.lfOrientation != info.lfMenuFont.lfOrientation || - logfont.lfWeight != info.lfMenuFont.lfWeight || - logfont.lfItalic != info.lfMenuFont.lfItalic || - logfont.lfUnderline != info.lfMenuFont.lfUnderline || - logfont.lfStrikeOut != info.lfMenuFont.lfStrikeOut || - logfont.lfCharSet != info.lfMenuFont.lfCharSet || - logfont.lfOutPrecision != info.lfMenuFont.lfOutPrecision || - logfont.lfClipPrecision != info.lfMenuFont.lfClipPrecision || - logfont.lfQuality != info.lfMenuFont.lfQuality || - logfont.lfPitchAndFamily != info.lfMenuFont.lfPitchAndFamily || - lstrcmp(logfont.lfFaceName, info.lfMenuFont.lfFaceName) != 0) + if((logfont.lfHeight != info.lfMenuFont.lfHeight) || + (logfont.lfWidth != info.lfMenuFont.lfWidth) || + (logfont.lfEscapement != info.lfMenuFont.lfEscapement) || + (logfont.lfOrientation != info.lfMenuFont.lfOrientation) || + (logfont.lfWeight != info.lfMenuFont.lfWeight) || + (logfont.lfItalic != info.lfMenuFont.lfItalic) || + (logfont.lfUnderline != info.lfMenuFont.lfUnderline) || + (logfont.lfStrikeOut != info.lfMenuFont.lfStrikeOut) || + (logfont.lfCharSet != info.lfMenuFont.lfCharSet) || + (logfont.lfOutPrecision != info.lfMenuFont.lfOutPrecision) || + (logfont.lfClipPrecision != info.lfMenuFont.lfClipPrecision) || + (logfont.lfQuality != info.lfMenuFont.lfQuality) || + (logfont.lfPitchAndFamily != info.lfMenuFont.lfPitchAndFamily) || + (lstrcmp(logfont.lfFaceName, info.lfMenuFont.lfFaceName) != 0)) { HFONT hFontMenu = ::CreateFontIndirect(&info.lfMenuFont); ATLASSERT(hFontMenu != NULL); @@ -2962,17 +2931,17 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi if(m_fontMenu.m_hFont != NULL) m_fontMenu.DeleteObject(); m_fontMenu.Attach(hFontMenu); - SetFont(m_fontMenu); - AddStrings(_T("NS\0")); // for proper item height - AutoSize(); + this->SetFont(m_fontMenu); + this->AddStrings(_T("NS\0")); // for proper item height + this->AutoSize(); } } } // check if we need extra spacing for menu item text - CWindowDC dc(m_hWnd); + CWindowDC dc(this->m_hWnd); HFONT hFontOld = dc.SelectFont(m_fontMenu); - RECT rcText = { 0, 0, 0, 0 }; + RECT rcText = { 0 }; dc.DrawText(_T("\t"), -1, &rcText, DT_SINGLELINE | DT_LEFT | DT_VCENTER | DT_CALCRECT); if((rcText.right - rcText.left) < 4) { @@ -2987,15 +2956,18 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi dc.SelectFont(hFontOld); // get Windows version +#ifndef _versionhelpers_H_INCLUDED_ OSVERSIONINFO ovi = { sizeof(OSVERSIONINFO) }; ::GetVersionEx(&ovi); +#endif // !_versionhelpers_H_INCLUDED_ // query keyboard cues mode (Windows 2000 or later) - if(ovi.dwMajorVersion >= 5) +#ifdef _versionhelpers_H_INCLUDED_ + if(::IsWindowsVersionOrGreater(5, 0, 0)) +#else // !_versionhelpers_H_INCLUDED_ + if (ovi.dwMajorVersion >= 5) +#endif // _versionhelpers_H_INCLUDED_ { -#ifndef SPI_GETKEYBOARDCUES - const UINT SPI_GETKEYBOARDCUES = 0x100A; -#endif // !SPI_GETKEYBOARDCUES BOOL bRetVal = TRUE; bRet = ::SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &bRetVal, 0); m_bUseKeyboardCues = (bRet && !bRetVal); @@ -3004,11 +2976,12 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi } // query flat menu mode (Windows XP or later) - if((ovi.dwMajorVersion == 5 && ovi.dwMinorVersion >= 1) || (ovi.dwMajorVersion > 5)) +#ifdef _versionhelpers_H_INCLUDED_ + if(::IsWindowsXPOrGreater()) +#else // !_versionhelpers_H_INCLUDED_ + if (((ovi.dwMajorVersion == 5) && (ovi.dwMinorVersion >= 1)) || (ovi.dwMajorVersion > 5)) +#endif // _versionhelpers_H_INCLUDED_ { -#ifndef SPI_GETFLATMENU - const UINT SPI_GETFLATMENU = 0x1022; -#endif // !SPI_GETFLATMENU BOOL bRetVal = FALSE; bRet = ::SystemParametersInfo(SPI_GETFLATMENU, 0, &bRetVal, 0); m_bFlatMenus = (bRet && bRetVal); @@ -3016,27 +2989,7 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi #if _WTL_CMDBAR_VISTA_MENUS // check if we should use Vista menus - bool bVistaMenus = (RunTimeHelper::IsVista() && RunTimeHelper::IsCommCtrl6() && ((m_dwExtendedStyle & CBR_EX_NOVISTAMENUS) == 0)); - - if(bVistaMenus) - { - HMODULE hThemeDLL = ::LoadLibrary(_T("uxtheme.dll")); - if(hThemeDLL != NULL) - { - typedef BOOL (STDAPICALLTYPE *PFN_IsThemeActive)(); - PFN_IsThemeActive pfnIsThemeActive = (PFN_IsThemeActive)::GetProcAddress(hThemeDLL, "IsThemeActive"); - ATLASSERT(pfnIsThemeActive != NULL); - bVistaMenus = bVistaMenus && (pfnIsThemeActive != NULL) && (pfnIsThemeActive() != FALSE); - - typedef BOOL (STDAPICALLTYPE *PFN_IsAppThemed)(); - PFN_IsAppThemed pfnIsAppThemed = (PFN_IsAppThemed)::GetProcAddress(hThemeDLL, "IsAppThemed"); - ATLASSERT(pfnIsAppThemed != NULL); - bVistaMenus = bVistaMenus && (pfnIsAppThemed != NULL) && (pfnIsAppThemed() != FALSE); - - ::FreeLibrary(hThemeDLL); - } - } - + bool bVistaMenus = (((m_dwExtendedStyle & CBR_EX_NOVISTAMENUS) == 0) && RunTimeHelper::IsVista() && RunTimeHelper::IsThemeAvailable()); if(!bVistaMenus && m_bVistaMenus && (m_hMenu != NULL) && (m_arrCommand.GetSize() > 0)) { T* pT = static_cast(this); @@ -3055,9 +3008,9 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi // Implementation - alternate focus mode support void TakeFocus() { - if((m_dwExtendedStyle & CBR_EX_ALTFOCUSMODE) && m_hWndFocus == NULL) + if((m_dwExtendedStyle & CBR_EX_ALTFOCUSMODE) && (m_hWndFocus == NULL)) m_hWndFocus = ::GetFocus(); - SetFocus(); + this->SetFocus(); } void GiveFocusBack() @@ -3070,18 +3023,18 @@ class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWi m_wndParent.SetFocus(); } m_hWndFocus = NULL; - SetAnchorHighlight(FALSE); + this->SetAnchorHighlight(FALSE); if(m_bUseKeyboardCues && m_bShowKeyboardCues) - ShowKeyboardCues(false); + this->ShowKeyboardCues(false); m_bSkipPostDown = false; } void ShowKeyboardCues(bool bShow) { m_bShowKeyboardCues = bShow; - SetDrawTextFlags(DT_HIDEPREFIX, m_bShowKeyboardCues ? 0 : DT_HIDEPREFIX); - Invalidate(); - UpdateWindow(); + this->SetDrawTextFlags(DT_HIDEPREFIX, m_bShowKeyboardCues ? 0 : DT_HIDEPREFIX); + this->Invalidate(); + this->UpdateWindow(); } // Implementation - internal message helpers @@ -3284,34 +3237,18 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas int m_cxLeft; // left nonclient area width int m_cxRight; // right nonclient area width -// Theme declarations and data members -#ifndef _WTL_NO_AUTO_THEME -#ifndef _UXTHEME_H_ - typedef HANDLE HTHEME; -#endif // !_UXTHEME_H_ - typedef HTHEME (STDAPICALLTYPE *PFN_OpenThemeData)(HWND hwnd, LPCWSTR pszClassList); - typedef HRESULT (STDAPICALLTYPE *PFN_CloseThemeData)(HTHEME hTheme); - typedef HRESULT (STDAPICALLTYPE *PFN_DrawThemeBackground)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect); - typedef HRESULT (STDAPICALLTYPE *PFN_DrawThemeParentBackground)(HWND hwnd, HDC hdc, OPTIONAL RECT* prc); - - HMODULE m_hThemeDLL; HTHEME m_hTheme; - PFN_DrawThemeBackground m_pfnDrawThemeBackground; - PFN_DrawThemeParentBackground m_pfnDrawThemeParentBackground; -#endif // !_WTL_NO_AUTO_THEME // Constructor/destructor CMDICommandBarCtrlImpl() : m_wndMDIClient(this, 2), m_bChildMaximized(false), m_hWndChildMaximized(NULL), m_hIconChildMaximized(NULL), m_nBtnPressed(-1), m_nBtnWasPressed(-1), -#ifndef _WTL_NO_AUTO_THEME - m_hThemeDLL(NULL), m_hTheme(NULL), m_pfnDrawThemeBackground(NULL), m_pfnDrawThemeParentBackground(NULL), -#endif // !_WTL_NO_AUTO_THEME m_cxyOffset(2), m_cxIconWidth(16), m_cyIconHeight(16), m_cxBtnWidth(16), m_cyBtnHeight(14), - m_cxLeft(20), m_cxRight(55) + m_cxLeft(20), m_cxRight(55), + m_hTheme(NULL) { } ~CMDICommandBarCtrlImpl() @@ -3350,9 +3287,7 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas BEGIN_MSG_MAP(CMDICommandBarCtrlImpl) MESSAGE_HANDLER(WM_CREATE, OnCreate) MESSAGE_HANDLER(WM_DESTROY, OnDestroy) -#ifndef _WTL_NO_AUTO_THEME MESSAGE_HANDLER(_GetThemeChangedMsg(), OnThemeChanged) -#endif // !_WTL_NO_AUTO_THEME MESSAGE_HANDLER(WM_SIZE, OnSize) MESSAGE_HANDLER(WM_NCCALCSIZE, OnNcCalcSize) MESSAGE_HANDLER(WM_NCPAINT, OnNcPaint) @@ -3381,27 +3316,8 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas if(lRet == (LRESULT)-1) return lRet; -#ifndef _WTL_NO_AUTO_THEME - // this will fail if theming is not supported - m_hThemeDLL = ::LoadLibrary(_T("uxtheme.dll")); - if(m_hThemeDLL != NULL) - { - m_pfnDrawThemeBackground = (PFN_DrawThemeBackground)::GetProcAddress(m_hThemeDLL, "DrawThemeBackground"); - ATLASSERT(m_pfnDrawThemeBackground != NULL); - if(m_pfnDrawThemeBackground != NULL) - { - T* pT = static_cast(this); - pT->_OpenThemeData(); - } - else - { - ::FreeLibrary(m_hThemeDLL); - m_hThemeDLL = NULL; - } - m_pfnDrawThemeParentBackground = (PFN_DrawThemeParentBackground)::GetProcAddress(m_hThemeDLL, "DrawThemeParentBackground"); - ATLASSERT(m_pfnDrawThemeParentBackground != NULL); - } -#endif // !_WTL_NO_AUTO_THEME + T* pT = static_cast(this); + pT->_OpenThemeData(); return lRet; } @@ -3410,35 +3326,24 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas { LRESULT lRet = _baseClass::OnDestroy(uMsg, wParam, lParam, bHandled); -#ifndef _WTL_NO_AUTO_THEME - if(m_hThemeDLL != NULL) - { - T* pT = static_cast(this); - pT->_CloseThemeData(); - ::FreeLibrary(m_hThemeDLL); - m_hThemeDLL = NULL; - } -#endif // !_WTL_NO_AUTO_THEME + T* pT = static_cast(this); + pT->_CloseThemeData(); return lRet; } -#ifndef _WTL_NO_AUTO_THEME LRESULT OnThemeChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { - if(m_hThemeDLL != NULL) - { - T* pT = static_cast(this); - pT->_CloseThemeData(); - pT->_OpenThemeData(); - } + T* pT = static_cast(this); + pT->_CloseThemeData(); + pT->_OpenThemeData(); + return 0; } -#endif // !_WTL_NO_AUTO_THEME LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); + LRESULT lRet = this->DefWindowProc(uMsg, wParam, lParam); T* pT = static_cast(this); pT->_AdjustBtnSize(GET_Y_LPARAM(lParam)); return lRet; @@ -3446,12 +3351,12 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas LRESULT OnNcCalcSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); + LRESULT lRet = this->DefWindowProc(uMsg, wParam, lParam); if(m_bChildMaximized && (BOOL)wParam) { LPNCCALCSIZE_PARAMS lpParams = (LPNCCALCSIZE_PARAMS)lParam; - if(m_bLayoutRTL) + if(this->m_bLayoutRTL) { lpParams->rgrc[0].left += m_cxRight; lpParams->rgrc[0].right -= m_cxLeft; @@ -3468,34 +3373,29 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas LRESULT OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); + LRESULT lRet = this->DefWindowProc(uMsg, wParam, lParam); if(!m_bChildMaximized) return lRet; - ATLASSERT(m_hWndChildMaximized != NULL && m_hIconChildMaximized != NULL); + ATLASSERT((m_hWndChildMaximized != NULL) && (m_hIconChildMaximized != NULL)); // get DC and window rectangle - CWindowDC dc(m_hWnd); - RECT rect; - GetWindowRect(&rect); + CWindowDC dc(this->m_hWnd); + RECT rect = { 0 }; + this->GetWindowRect(&rect); int cxWidth = rect.right - rect.left; int cyHeight = rect.bottom - rect.top; // paint left side nonclient background and draw icon ::SetRect(&rect, 0, 0, m_cxLeft, cyHeight); -#ifndef _WTL_NO_AUTO_THEME if(m_hTheme != NULL) { - if(m_pfnDrawThemeParentBackground != NULL) - m_pfnDrawThemeParentBackground(m_hWnd, dc, &rect); - else - dc.FillRect(&rect, COLOR_WINDOW); + ::DrawThemeParentBackground(this->m_hWnd, dc, &rect); } else -#endif // !_WTL_NO_AUTO_THEME { - if((m_dwExtendedStyle & CBR_EX_TRANSPARENT) != 0) + if((this->m_dwExtendedStyle & CBR_EX_TRANSPARENT) != 0) dc.FillRect(&rect, COLOR_3DFACE); else dc.FillRect(&rect, COLOR_MENU); @@ -3508,32 +3408,23 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas // paint right side nonclient background ::SetRect(&rect, cxWidth - m_cxRight, 0, cxWidth, cyHeight); -#ifndef _WTL_NO_AUTO_THEME if(m_hTheme != NULL) { - if(m_pfnDrawThemeParentBackground != NULL) - { - // this is to account for the left non-client area - POINT ptOrg = { 0, 0 }; - dc.GetViewportOrg(&ptOrg); - dc.SetViewportOrg(ptOrg.x + m_cxLeft, ptOrg.y); - ::OffsetRect(&rect, -m_cxLeft, 0); + // this is to account for the left non-client area + POINT ptOrg = { 0, 0 }; + dc.GetViewportOrg(&ptOrg); + dc.SetViewportOrg(ptOrg.x + m_cxLeft, ptOrg.y); + ::OffsetRect(&rect, -m_cxLeft, 0); - m_pfnDrawThemeParentBackground(m_hWnd, dc, &rect); + ::DrawThemeParentBackground(this->m_hWnd, dc, &rect); - // restore - dc.SetViewportOrg(ptOrg); - ::OffsetRect(&rect, m_cxLeft, 0); - } - else - { - dc.FillRect(&rect, COLOR_3DFACE); - } + // restore + dc.SetViewportOrg(ptOrg); + ::OffsetRect(&rect, m_cxLeft, 0); } else -#endif // !_WTL_NO_AUTO_THEME { - if((m_dwExtendedStyle & CBR_EX_TRANSPARENT) != 0) + if((this->m_dwExtendedStyle & CBR_EX_TRANSPARENT) != 0) dc.FillRect(&rect, COLOR_3DFACE); else dc.FillRect(&rect, COLOR_MENU); @@ -3549,13 +3440,13 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas LRESULT OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); + LRESULT lRet = this->DefWindowProc(uMsg, wParam, lParam); if(m_bChildMaximized) { RECT rect = { 0 }; - GetWindowRect(&rect); + this->GetWindowRect(&rect); POINT pt = { GET_X_LPARAM(lParam) - rect.left, GET_Y_LPARAM(lParam) - rect.top }; - if(m_bLayoutRTL) + if(this->m_bLayoutRTL) { if((pt.x < m_cxRight) || (pt.x > ((rect.right - rect.left) - m_cxLeft))) lRet = HTBORDER; @@ -3581,33 +3472,30 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; RECT rect = { 0 }; - GetWindowRect(&rect); + this->GetWindowRect(&rect); pt.x -= rect.left; pt.y -= rect.top; RECT rcIcon = { 0 }; T* pT = static_cast(this); - pT->_CalcIconRect(rect.right - rect.left, rect.bottom - rect.top, rcIcon, m_bLayoutRTL); + pT->_CalcIconRect(rect.right - rect.left, rect.bottom - rect.top, rcIcon, this->m_bLayoutRTL); RECT arrRect[3] = { 0 }; - pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect, m_bLayoutRTL); + pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect, this->m_bLayoutRTL); if(::PtInRect(&rcIcon, pt)) { #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonDown: icon\n")); -#endif -#ifndef TPM_VERPOSANIMATION - const UINT TPM_VERPOSANIMATION = 0x1000L; // Menu animation flag #endif CMenuHandle menu = ::GetSystemMenu(m_hWndChildMaximized, FALSE); UINT uRet = (UINT)menu.TrackPopupMenu(TPM_LEFTBUTTON | TPM_VERTICAL | TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RETURNCMD | - (s_bW2K ? TPM_VERPOSANIMATION : 0), m_bLayoutRTL ? rect.right : rect.left, rect.bottom, m_hWndChildMaximized); + TPM_VERPOSANIMATION, this->m_bLayoutRTL ? rect.right : rect.left, rect.bottom, m_hWndChildMaximized); // eat next message if click is on the same button ::OffsetRect(&rcIcon, rect.left, rect.top); MSG msg = { 0 }; - if(::PeekMessage(&msg, m_hWnd, WM_NCLBUTTONDOWN, WM_NCLBUTTONDOWN, PM_NOREMOVE) && ::PtInRect(&rcIcon, msg.pt)) - ::PeekMessage(&msg, m_hWnd, WM_NCLBUTTONDOWN, WM_NCLBUTTONDOWN, PM_REMOVE); + if(::PeekMessage(&msg, this->m_hWnd, WM_NCLBUTTONDOWN, WM_NCLBUTTONDOWN, PM_NOREMOVE) && ::PtInRect(&rcIcon, msg.pt)) + ::PeekMessage(&msg, this->m_hWnd, WM_NCLBUTTONDOWN, WM_NCLBUTTONDOWN, PM_REMOVE); if(uRet != 0) ::SendMessage(m_hWndChildMaximized, WM_SYSCOMMAND, uRet, 0L); @@ -3641,8 +3529,8 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas // draw the button state if it was pressed if(m_nBtnPressed != -1) { - SetCapture(); - CWindowDC dc(m_hWnd); + this->SetCapture(); + CWindowDC dc(this->m_hWnd); pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect); pT->_DrawMDIButton(dc, arrRect, m_nBtnPressed); } @@ -3652,26 +3540,26 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { - if(!m_bChildMaximized || ::GetCapture() != m_hWnd || m_nBtnWasPressed == -1) + if(!m_bChildMaximized || (::GetCapture() != this->m_hWnd) || (m_nBtnWasPressed == -1)) { bHandled = FALSE; return 1; } POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - ClientToScreen(&pt); + this->ClientToScreen(&pt); RECT rect = { 0 }; - GetWindowRect(&rect); + this->GetWindowRect(&rect); pt.x -= rect.left; pt.y -= rect.top; RECT arrRect[3] = { 0 }; T* pT = static_cast(this); - pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect, m_bLayoutRTL); + pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect, this->m_bLayoutRTL); int nOldBtnPressed = m_nBtnPressed; m_nBtnPressed = ::PtInRect(&arrRect[m_nBtnWasPressed], pt) ? m_nBtnWasPressed : -1; if(nOldBtnPressed != m_nBtnPressed) { - CWindowDC dc(m_hWnd); + CWindowDC dc(this->m_hWnd); pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect); pT->_DrawMDIButton(dc, arrRect, (m_nBtnPressed != -1) ? m_nBtnPressed : nOldBtnPressed); } @@ -3681,7 +3569,7 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { - if(!m_bChildMaximized || ::GetCapture() != m_hWnd || m_nBtnWasPressed == -1) + if(!m_bChildMaximized || (::GetCapture() != this->m_hWnd) || (m_nBtnWasPressed == -1)) { bHandled = FALSE; return 1; @@ -3690,9 +3578,9 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas ATLASSERT(_DebugCheckChild()); POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - ClientToScreen(&pt); + this->ClientToScreen(&pt); RECT rect = { 0 }; - GetWindowRect(&rect); + this->GetWindowRect(&rect); pt.x -= rect.left; pt.y -= rect.top; @@ -3701,7 +3589,7 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas RECT arrRect[3] = { 0 }; T* pT = static_cast(this); - pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect, m_bLayoutRTL); + pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect, this->m_bLayoutRTL); if(::PtInRect(&arrRect[nBtn], pt)) { switch(nBtn) @@ -3734,7 +3622,7 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas LRESULT OnNcLButtonDblClk(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { - if(!m_bChildMaximized || m_nBtnWasPressed != -1) + if(!m_bChildMaximized || (m_nBtnWasPressed != -1)) { bHandled = FALSE; return 1; @@ -3744,15 +3632,15 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; RECT rect = { 0 }; - GetWindowRect(&rect); + this->GetWindowRect(&rect); pt.x -= rect.left; pt.y -= rect.top; RECT rcIcon = { 0 }; T* pT = static_cast(this); - pT->_CalcIconRect(rect.right - rect.left, rect.bottom - rect.top, rcIcon, m_bLayoutRTL); + pT->_CalcIconRect(rect.right - rect.left, rect.bottom - rect.top, rcIcon, this->m_bLayoutRTL); RECT arrRect[3] = { 0 }; - pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect, m_bLayoutRTL); + pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect, this->m_bLayoutRTL); if(::PtInRect(&rcIcon, pt)) { @@ -3775,11 +3663,11 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas ATLASSERT(m_nBtnPressed == m_nBtnWasPressed); // must be m_nBtnPressed = -1; RECT rect = { 0 }; - GetWindowRect(&rect); + this->GetWindowRect(&rect); RECT arrRect[3] = { 0 }; T* pT = static_cast(this); pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect); - CWindowDC dc(m_hWnd); + CWindowDC dc(this->m_hWnd); pT->_DrawMDIButton(dc, arrRect, m_nBtnWasPressed); } m_nBtnWasPressed = -1; @@ -3794,8 +3682,8 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas // Parent window message handlers LRESULT OnParentActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { - m_bParentActive = (LOWORD(wParam) != WA_INACTIVE); - RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); + this->m_bParentActive = (LOWORD(wParam) != WA_INACTIVE); + this->RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); bHandled = FALSE; return 1; } @@ -3804,15 +3692,13 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas LRESULT OnMDISetMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { m_wndMDIClient.DefWindowProc(uMsg, NULL, lParam); - HMENU hOldMenu = GetMenu(); - BOOL bRet = AttachMenu((HMENU)wParam); + HMENU hOldMenu = this->GetMenu(); + BOOL bRet = this->AttachMenu((HMENU)wParam); bRet; // avoid level 4 warning ATLASSERT(bRet); -#if (_WIN32_IE >= 0x0400) T* pT = static_cast(this); pT->UpdateRebarBandIdealSize(); -#endif // (_WIN32_IE >= 0x0400) return (LRESULT)hOldMenu; } @@ -3833,23 +3719,23 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas { // assuming we are in a rebar, change ideal size to our size // we hope that if we are not in a rebar, nCount will be 0 - int nCount = (int)::SendMessage(GetParent(), RB_GETBANDCOUNT, 0, 0L); + int nCount = (int)this->GetParent().SendMessage(RB_GETBANDCOUNT, 0, 0L); for(int i = 0; i < nCount; i++) { REBARBANDINFO rbi = { RunTimeHelper::SizeOf_REBARBANDINFO(), RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE }; - ::SendMessage(GetParent(), RB_GETBANDINFO, i, (LPARAM)&rbi); - if(rbi.hwndChild == m_hWnd) + this->GetParent().SendMessage(RB_GETBANDINFO, i, (LPARAM)&rbi); + if(rbi.hwndChild == this->m_hWnd) { rbi.fMask = RBBIM_IDEALSIZE; rbi.cxIdeal = m_bChildMaximized ? m_cxLeft + m_cxRight : 0; - int nBtnCount = GetButtonCount(); + int nBtnCount = this->GetButtonCount(); if(nBtnCount > 0) { RECT rect = { 0 }; - GetItemRect(nBtnCount - 1, &rect); + this->GetItemRect(nBtnCount - 1, &rect); rbi.cxIdeal += rect.right; } - ::SendMessage(GetParent(), RB_SETBANDINFO, i, (LPARAM)&rbi); + this->GetParent().SendMessage(RB_SETBANDINFO, i, (LPARAM)&rbi); break; } } @@ -3858,13 +3744,13 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas // all hook messages - check for the maximized MDI child window change void _ProcessAllHookMessages(UINT uMsg, WPARAM /*wParam*/, LPARAM /*lParam*/) { - if(uMsg == WM_MDIGETACTIVE || uMsg == WM_MDISETMENU) + if((uMsg == WM_MDIGETACTIVE) || (uMsg == WM_MDISETMENU)) return; BOOL bMaximized = FALSE; HWND hWndChild = (HWND)::SendMessage(m_wndMDIClient, WM_MDIGETACTIVE, 0, (LPARAM)&bMaximized); bool bMaxOld = m_bChildMaximized; - m_bChildMaximized = (hWndChild != NULL && bMaximized); + m_bChildMaximized = ((hWndChild != NULL) && bMaximized); HICON hIconOld = m_hIconChildMaximized; if(m_bChildMaximized) @@ -3876,16 +3762,8 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas if(m_hIconChildMaximized == NULL) { m_hIconChildMaximized = wnd.GetIcon(TRUE); - if(m_hIconChildMaximized == NULL) - { - // no icon set with WM_SETICON, get the class one -// need conditional code because types don't match in winuser.h -#ifdef _WIN64 + if(m_hIconChildMaximized == NULL) // no icon set with WM_SETICON, get the class one m_hIconChildMaximized = (HICON)::GetClassLongPtr(wnd, GCLP_HICONSM); -#else - m_hIconChildMaximized = (HICON)LongToHandle(::GetClassLongPtr(wnd, GCLP_HICONSM)); -#endif - } } } } @@ -3902,60 +3780,37 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas #endif // assuming we are in a rebar, change our size to accomodate new state // we hope that if we are not in a rebar, nCount will be 0 - int nCount = (int)::SendMessage(GetParent(), RB_GETBANDCOUNT, 0, 0L); + int nCount = (int)this->GetParent().SendMessage(RB_GETBANDCOUNT, 0, 0L); int cxDiff = (m_bChildMaximized ? 1 : -1) * (m_cxLeft + m_cxRight); for(int i = 0; i < nCount; i++) { -#if (_WIN32_IE >= 0x0500) REBARBANDINFO rbi = { RunTimeHelper::SizeOf_REBARBANDINFO(), RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE | RBBIM_STYLE }; - ::SendMessage(GetParent(), RB_GETBANDINFO, i, (LPARAM)&rbi); - if(rbi.hwndChild == m_hWnd) + this->GetParent().SendMessage(RB_GETBANDINFO, i, (LPARAM)&rbi); + if(rbi.hwndChild == this->m_hWnd) { if((rbi.fStyle & RBBS_USECHEVRON) != 0) { rbi.fMask = RBBIM_CHILDSIZE | RBBIM_IDEALSIZE; rbi.cxMinChild += cxDiff; rbi.cxIdeal += cxDiff; - ::SendMessage(GetParent(), RB_SETBANDINFO, i, (LPARAM)&rbi); + this->GetParent().SendMessage(RB_SETBANDINFO, i, (LPARAM)&rbi); } break; } -#elif (_WIN32_IE >= 0x0400) - REBARBANDINFO rbi = { RunTimeHelper::SizeOf_REBARBANDINFO(), RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE }; - ::SendMessage(GetParent(), RB_GETBANDINFO, i, (LPARAM)&rbi); - if(rbi.hwndChild == m_hWnd) - { - rbi.fMask = RBBIM_CHILDSIZE | RBBIM_IDEALSIZE; - rbi.cxMinChild += cxDiff; - rbi.cxIdeal += cxDiff; - ::SendMessage(GetParent(), RB_SETBANDINFO, i, (LPARAM)&rbi); - break; - } -#else // (_WIN32_IE < 0x0400) - REBARBANDINFO rbi = { RunTimeHelper::SizeOf_REBARBANDINFO(), RBBIM_CHILD | RBBIM_CHILDSIZE }; - ::SendMessage(GetParent(), RB_GETBANDINFO, i, (LPARAM)&rbi); - if(rbi.hwndChild == m_hWnd) - { - rbi.fMask = RBBIM_CHILDSIZE; - rbi.cxMinChild += cxDiff; - ::SendMessage(GetParent(), RB_SETBANDINFO, i, (LPARAM)&rbi); - break; - } -#endif // (_WIN32_IE < 0x0400) } } - if(bMaxOld != m_bChildMaximized || hIconOld != m_hIconChildMaximized) + if((bMaxOld != m_bChildMaximized) || (hIconOld != m_hIconChildMaximized)) { // force size change and redraw everything RECT rect = { 0 }; - GetWindowRect(&rect); - ::MapWindowPoints(NULL, GetParent(), (LPPOINT)&rect, 2); - SetRedraw(FALSE); - SetWindowPos(NULL, 0, 0, 1, 1, SWP_NOZORDER | SWP_NOMOVE); - SetWindowPos(NULL, &rect, SWP_NOZORDER | SWP_NOMOVE); - SetRedraw(TRUE); - RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW); + this->GetWindowRect(&rect); + ::MapWindowPoints(NULL, this->GetParent(), (LPPOINT)&rect, 2); + this->SetRedraw(FALSE); + this->SetWindowPos(NULL, 0, 0, 1, 1, SWP_NOZORDER | SWP_NOMOVE); + this->SetWindowPos(NULL, &rect, SWP_NOZORDER | SWP_NOMOVE); + this->SetRedraw(TRUE); + this->RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW); } } @@ -3976,7 +3831,6 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas m_cyIconHeight = ::GetSystemMetrics(SM_CYSMICON); m_cxLeft = m_cxIconWidth; -#ifndef _WTL_NO_AUTO_THEME if(m_hTheme != NULL) { m_cxBtnWidth = info.iCaptionWidth - 2 * m_cxyOffset; @@ -3984,7 +3838,6 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas m_cxRight = 3 * m_cxBtnWidth; } else -#endif // !_WTL_NO_AUTO_THEME { m_cxBtnWidth = info.iCaptionWidth - m_cxyOffset; m_cyBtnHeight = info.iCaptionHeight - 2 * m_cxyOffset; @@ -3993,16 +3846,15 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas } RECT rect = { 0 }; - GetClientRect(&rect); + this->GetClientRect(&rect); T* pT = static_cast(this); pT->_AdjustBtnSize(rect.bottom); } void _AdjustBtnSize(int cyHeight) { - if(cyHeight > 1 && m_cyBtnHeight > cyHeight) + if((cyHeight > 1) && (m_cyBtnHeight > cyHeight)) { -#ifndef _WTL_NO_AUTO_THEME if(m_hTheme != NULL) { m_cyBtnHeight = cyHeight; @@ -4010,7 +3862,6 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas m_cxRight = 3 * m_cxBtnWidth; } else -#endif // !_WTL_NO_AUTO_THEME { m_cyBtnHeight = cyHeight; m_cxBtnWidth = cyHeight + m_cxyOffset; @@ -4049,11 +3900,9 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas } arrRect[0] = rcBtn; -#ifndef _WTL_NO_AUTO_THEME if(m_hTheme != NULL) ::OffsetRect(&rcBtn, nDirection * m_cxBtnWidth, 0); else -#endif // !_WTL_NO_AUTO_THEME ::OffsetRect(&rcBtn, nDirection * (m_cxBtnWidth + m_cxyOffset), 0); arrRect[1] = rcBtn; ::OffsetRect(&rcBtn, nDirection * m_cxBtnWidth, 0); @@ -4062,10 +3911,9 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas void _DrawMDIButton(CWindowDC& dc, LPRECT pRects, int nBtn) { -#ifndef _WTL_NO_AUTO_THEME if(m_hTheme != NULL) { -#ifndef TMSCHEMA_H +#ifndef __VSSYM32_H__ const int WP_MDICLOSEBUTTON = 20; const int CBS_NORMAL = 1; const int CBS_PUSHED = 3; @@ -4078,27 +3926,25 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas const int MINBS_NORMAL = 1; const int MINBS_PUSHED = 3; const int MINBS_DISABLED = 4; -#endif // TMSCHEMA_H - if(nBtn == -1 || nBtn == 0) - m_pfnDrawThemeBackground(m_hTheme, dc, WP_MDICLOSEBUTTON, m_bParentActive ? ((m_nBtnPressed == 0) ? CBS_PUSHED : CBS_NORMAL) : CBS_DISABLED, &pRects[0], NULL); - if(nBtn == -1 || nBtn == 1) - m_pfnDrawThemeBackground(m_hTheme, dc, WP_MDIRESTOREBUTTON, m_bParentActive ? ((m_nBtnPressed == 1) ? RBS_PUSHED : RBS_NORMAL) : RBS_DISABLED, &pRects[1], NULL); - if(nBtn == -1 || nBtn == 2) - m_pfnDrawThemeBackground(m_hTheme, dc, WP_MDIMINBUTTON, m_bParentActive ? ((m_nBtnPressed == 2) ? MINBS_PUSHED : MINBS_NORMAL) : MINBS_DISABLED, &pRects[2], NULL); +#endif // __VSSYM32_H__ + if((nBtn == -1) || (nBtn == 0)) + ::DrawThemeBackground(m_hTheme, dc, WP_MDICLOSEBUTTON, this->m_bParentActive ? ((m_nBtnPressed == 0) ? CBS_PUSHED : CBS_NORMAL) : CBS_DISABLED, &pRects[0], NULL); + if((nBtn == -1) || (nBtn == 1)) + ::DrawThemeBackground(m_hTheme, dc, WP_MDIRESTOREBUTTON, this->m_bParentActive ? ((m_nBtnPressed == 1) ? RBS_PUSHED : RBS_NORMAL) : RBS_DISABLED, &pRects[1], NULL); + if((nBtn == -1) || (nBtn == 2)) + ::DrawThemeBackground(m_hTheme, dc, WP_MDIMINBUTTON, this->m_bParentActive ? ((m_nBtnPressed == 2) ? MINBS_PUSHED : MINBS_NORMAL) : MINBS_DISABLED, &pRects[2], NULL); } else -#endif // !_WTL_NO_AUTO_THEME { - if(nBtn == -1 || nBtn == 0) + if((nBtn == -1) || (nBtn == 0)) dc.DrawFrameControl(&pRects[0], DFC_CAPTION, DFCS_CAPTIONCLOSE | ((m_nBtnPressed == 0) ? DFCS_PUSHED : 0)); - if(nBtn == -1 || nBtn == 1) + if((nBtn == -1) || (nBtn == 1)) dc.DrawFrameControl(&pRects[1], DFC_CAPTION, DFCS_CAPTIONRESTORE | ((m_nBtnPressed == 1) ? DFCS_PUSHED : 0)); - if(nBtn == -1 || nBtn == 2) + if((nBtn == -1) || (nBtn == 2)) dc.DrawFrameControl(&pRects[2], DFC_CAPTION, DFCS_CAPTIONMIN | ((m_nBtnPressed == 2) ? DFCS_PUSHED : 0)); } } -#ifndef _WTL_NO_AUTO_THEME static UINT _GetThemeChangedMsg() { #ifndef WM_THEMECHANGED @@ -4109,37 +3955,25 @@ class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBas void _OpenThemeData() { - ATLASSERT(m_hThemeDLL != NULL); - - PFN_OpenThemeData pfnOpenThemeData = (PFN_OpenThemeData)::GetProcAddress(m_hThemeDLL, "OpenThemeData"); - ATLASSERT(pfnOpenThemeData != NULL); - if(pfnOpenThemeData != NULL) - m_hTheme = pfnOpenThemeData(m_hWnd, L"Window"); + if(RunTimeHelper::IsThemeAvailable()) + m_hTheme = ::OpenThemeData(this->m_hWnd, L"Window"); } void _CloseThemeData() { - ATLASSERT(m_hThemeDLL != NULL); - - if(m_hTheme == NULL) - return; // nothing to do - - PFN_CloseThemeData pfnCloseThemeData = (PFN_CloseThemeData)::GetProcAddress(m_hThemeDLL, "CloseThemeData"); - ATLASSERT(pfnCloseThemeData != NULL); - if(pfnCloseThemeData != NULL) + if(m_hTheme != NULL) { - pfnCloseThemeData(m_hTheme); + ::CloseThemeData(m_hTheme); m_hTheme = NULL; } } -#endif // !_WTL_NO_AUTO_THEME bool _DebugCheckChild() { #ifdef _DEBUG BOOL bMaximized = FALSE; HWND hWndChild = (HWND)::SendMessage(m_wndMDIClient, WM_MDIGETACTIVE, 0, (LPARAM)&bMaximized); - return (bMaximized && hWndChild == m_hWndChildMaximized); + return (bMaximized && (hWndChild == m_hWndChildMaximized)); #else // !_DEBUG return true; #endif // !_DEBUG diff --git a/thirdparty/wtl/atlctrlx.h b/thirdparty/wtl/atlctrlx.h index dde1215..6aa9db5 100644 --- a/thirdparty/wtl/atlctrlx.h +++ b/thirdparty/wtl/atlctrlx.h @@ -1,13 +1,10 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. +// Windows Template Library - WTL version 10.0 +// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. +// Microsoft Public License (http://opensource.org/licenses/MS-PL) +// which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLCTRLX_H__ #define __ATLCTRLX_H__ @@ -22,10 +19,6 @@ #error atlctrlx.h requires atlctrls.h to be included first #endif -#ifndef WM_UPDATEUISTATE - #define WM_UPDATEUISTATE 0x0128 -#endif // !WM_UPDATEUISTATE - /////////////////////////////////////////////////////////////////////////////// // Classes in this file: @@ -54,18 +47,21 @@ namespace WTL /////////////////////////////////////////////////////////////////////////////// // CBitmapButton - bitmap button implementation -#ifndef _WIN32_WCE - // bitmap button extended styles -#define BMPBTN_HOVER 0x00000001 -#define BMPBTN_AUTO3D_SINGLE 0x00000002 -#define BMPBTN_AUTO3D_DOUBLE 0x00000004 -#define BMPBTN_AUTOSIZE 0x00000008 -#define BMPBTN_SHAREIMAGELISTS 0x00000010 -#define BMPBTN_AUTOFIRE 0x00000020 +#define BMPBTN_HOVER 0x00000001 +#define BMPBTN_AUTO3D_SINGLE 0x00000002 +#define BMPBTN_AUTO3D_DOUBLE 0x00000004 +#define BMPBTN_AUTOSIZE 0x00000008 +#define BMPBTN_SHAREIMAGELISTS 0x00000010 +#define BMPBTN_AUTOFIRE 0x00000020 +#define BMPBTN_CHECK 0x00000040 +#define BMPBTN_AUTOCHECK 0x00000080 + +// Note: BMPBTN_CHECK/BMPBTN_AUTOCHECK disables BN_DOUBLECLICKED, +// BMPBTN_AUTOFIRE doesn't work with BMPBTN_CHECK/BMPBTN_AUTOCHECK template -class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinTraits> +class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinTraits > { public: DECLARE_WND_SUPERCLASS(NULL, TBase::GetWndClassName()) @@ -99,18 +95,24 @@ class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinT unsigned m_fMouseOver:1; unsigned m_fFocus:1; unsigned m_fPressed:1; + unsigned m_fChecked:1; // Constructor/Destructor CBitmapButtonImpl(DWORD dwExtendedStyle = BMPBTN_AUTOSIZE, HIMAGELIST hImageList = NULL) : - m_ImageList(hImageList), m_dwExtendedStyle(dwExtendedStyle), - m_lpstrToolTipText(NULL), - m_fMouseOver(0), m_fFocus(0), m_fPressed(0) + m_dwExtendedStyle(dwExtendedStyle), m_ImageList(hImageList), + m_lpstrToolTipText(NULL), + m_fMouseOver(0), m_fFocus(0), m_fPressed(0), m_fChecked(0) { m_nImage[_nImageNormal] = -1; m_nImage[_nImagePushed] = -1; m_nImage[_nImageFocusOrHover] = -1; m_nImage[_nImageDisabled] = -1; + +#ifdef _DEBUG + if(((m_dwExtendedStyle & BMPBTN_AUTOFIRE) != 0) && IsCheckMode()) + ATLTRACE2(atlTraceUI, 0, _T("CBitmapButtonImpl - Check mode and BMPBTN_AUTOFIRE cannot be used together, BMPBTN_AUTOFIRE will be ignored.\n")); +#endif // _DEBUG } ~CBitmapButtonImpl() @@ -123,14 +125,13 @@ class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinT // overridden to provide proper initialization BOOL SubclassWindow(HWND hWnd) { -#if (_MSC_VER >= 1300) - BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits>::SubclassWindow(hWnd); -#else // !(_MSC_VER >= 1300) - typedef ATL::CWindowImpl< T, TBase, TWinTraits> _baseClass; - BOOL bRet = _baseClass::SubclassWindow(hWnd); -#endif // !(_MSC_VER >= 1300) - if(bRet) - Init(); + BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits >::SubclassWindow(hWnd); + if(bRet != FALSE) + { + T* pT = static_cast(this); + pT->Init(); + } + return bRet; } @@ -147,6 +148,12 @@ class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinT m_dwExtendedStyle = dwExtendedStyle; else m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); + +#ifdef _DEBUG + if(((m_dwExtendedStyle & BMPBTN_AUTOFIRE) != 0) && IsCheckMode()) + ATLTRACE2(atlTraceUI, 0, _T("CBitmapButtonImpl - Check mode and BMPBTN_AUTOFIRE cannot be used together, BMPBTN_AUTOFIRE will be ignored.\n")); +#endif // _DEBUG + return dwPrevStyle; } @@ -159,8 +166,9 @@ class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinT { HIMAGELIST hImageListPrev = m_ImageList; m_ImageList = hImageList; - if((m_dwExtendedStyle & BMPBTN_AUTOSIZE) != 0 && ::IsWindow(m_hWnd)) + if(((m_dwExtendedStyle & BMPBTN_AUTOSIZE) != 0) && ::IsWindow(this->m_hWnd)) SizeToImage(); + return hImageListPrev; } @@ -175,9 +183,9 @@ class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinT if(m_lpstrToolTipText == NULL) return false; - errno_t nRet = SecureHelper::strncpy_x(lpstrText, nLength, m_lpstrToolTipText, _TRUNCATE); + errno_t nRet = ATL::Checked::tcsncpy_s(lpstrText, nLength, m_lpstrToolTipText, _TRUNCATE); - return (nRet == 0 || nRet == STRUNCATE); + return ((nRet == 0) || (nRet == STRUNCATE)); } bool SetToolTipText(LPCTSTR lpstrText) @@ -200,16 +208,32 @@ class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinT if(m_lpstrToolTipText == NULL) return false; - SecureHelper::strcpy_x(m_lpstrToolTipText, cchLen, lpstrText); + ATL::Checked::tcscpy_s(m_lpstrToolTipText, cchLen, lpstrText); if(m_tip.IsWindow()) { m_tip.Activate(TRUE); - m_tip.AddTool(m_hWnd, m_lpstrToolTipText); + m_tip.AddTool(this->m_hWnd, m_lpstrToolTipText); } return true; } + bool GetCheck() const + { + return (m_fChecked == 1); + } + + void SetCheck(bool bCheck, bool bUpdate = true) + { + m_fChecked = bCheck ? 1 : 0; + + if(bUpdate) + { + this->Invalidate(); + this->UpdateWindow(); + } + } + // Operations void SetImages(int nNormal, int nPushed = -1, int nFocusOrHover = -1, int nDisabled = -1) { @@ -225,12 +249,12 @@ class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinT BOOL SizeToImage() { - ATLASSERT(::IsWindow(m_hWnd) && m_ImageList.m_hImageList != NULL); + ATLASSERT(::IsWindow(this->m_hWnd) && (m_ImageList.m_hImageList != NULL)); int cx = 0; int cy = 0; if(!m_ImageList.GetIconSize(cx, cy)) return FALSE; - return ResizeClient(cx, cy); + return this->ResizeClient(cx, cy); } // Overrideables @@ -240,35 +264,37 @@ class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinT ATLASSERT(m_nImage[0] != -1); // main bitmap must be set // set bitmap according to the current button state - int nImage = -1; bool bHover = IsHoverMode(); - if(!IsWindowEnabled()) + bool bPressed = (m_fPressed == 1) || (IsCheckMode() && (m_fChecked == 1)); + int nImage = -1; + if(!this->IsWindowEnabled()) nImage = m_nImage[_nImageDisabled]; - else if(m_fPressed == 1) + else if(bPressed) nImage = m_nImage[_nImagePushed]; - else if((!bHover && m_fFocus == 1) || (bHover && m_fMouseOver == 1)) + else if((!bHover && (m_fFocus == 1)) || (bHover && (m_fMouseOver == 1))) nImage = m_nImage[_nImageFocusOrHover]; - if(nImage == -1) // not there, use default one + + // if none is set, use default one + if(nImage == -1) nImage = m_nImage[_nImageNormal]; // draw the button image - int xyPos = 0; - if((m_fPressed == 1) && ((m_dwExtendedStyle & (BMPBTN_AUTO3D_SINGLE | BMPBTN_AUTO3D_DOUBLE)) != 0) && (m_nImage[_nImagePushed] == -1)) - xyPos = 1; + bool bAuto3D = (m_dwExtendedStyle & (BMPBTN_AUTO3D_SINGLE | BMPBTN_AUTO3D_DOUBLE)) != 0; + int xyPos = (bPressed && bAuto3D && (m_nImage[_nImagePushed] == -1)) ? 1 : 0; m_ImageList.Draw(dc, nImage, xyPos, xyPos, ILD_NORMAL); // draw 3D border if required - if((m_dwExtendedStyle & (BMPBTN_AUTO3D_SINGLE | BMPBTN_AUTO3D_DOUBLE)) != 0) + if(bAuto3D) { - RECT rect; - GetClientRect(&rect); + RECT rect = { 0 }; + this->GetClientRect(&rect); - if(m_fPressed == 1) + if(bPressed) dc.DrawEdge(&rect, ((m_dwExtendedStyle & BMPBTN_AUTO3D_SINGLE) != 0) ? BDR_SUNKENOUTER : EDGE_SUNKEN, BF_RECT); - else if(!bHover || m_fMouseOver == 1) + else if(!bHover || (m_fMouseOver == 1)) dc.DrawEdge(&rect, ((m_dwExtendedStyle & BMPBTN_AUTO3D_SINGLE) != 0) ? BDR_RAISEDINNER : EDGE_RAISED, BF_RECT); - if(!bHover && m_fFocus == 1) + if(!bHover && (m_fFocus == 1)) { ::InflateRect(&rect, -2 * ::GetSystemMetrics(SM_CXEDGE), -2 * ::GetSystemMetrics(SM_CYEDGE)); dc.DrawFocusRect(&rect); @@ -301,7 +327,9 @@ class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinT LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { - Init(); + T* pT = static_cast(this); + pT->Init(); + bHandled = FALSE; return 1; } @@ -319,7 +347,7 @@ class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinT LRESULT OnMouseMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { - MSG msg = { m_hWnd, uMsg, wParam, lParam }; + MSG msg = { this->m_hWnd, uMsg, wParam, lParam }; if(m_tip.IsWindow()) m_tip.RelayEvent(&msg); bHandled = FALSE; @@ -340,7 +368,7 @@ class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinT } else { - CPaintDC dc(m_hWnd); + CPaintDC dc(this->m_hWnd); pT->DoPaint(dc.m_hDC); } return 0; @@ -349,8 +377,8 @@ class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinT LRESULT OnFocus(UINT uMsg, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { m_fFocus = (uMsg == WM_SETFOCUS) ? 1 : 0; - Invalidate(); - UpdateWindow(); + this->Invalidate(); + this->UpdateWindow(); bHandled = FALSE; return 1; } @@ -359,22 +387,22 @@ class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinT { LRESULT lRet = 0; if(IsHoverMode()) - SetCapture(); + this->SetCapture(); else - lRet = DefWindowProc(uMsg, wParam, lParam); - if(::GetCapture() == m_hWnd) + lRet = this->DefWindowProc(uMsg, wParam, lParam); + if(::GetCapture() == this->m_hWnd) { m_fPressed = 1; - Invalidate(); - UpdateWindow(); + this->Invalidate(); + this->UpdateWindow(); } - if((m_dwExtendedStyle & BMPBTN_AUTOFIRE) != 0) + if(((m_dwExtendedStyle & BMPBTN_AUTOFIRE) != 0) && !IsCheckMode()) { int nElapse = 250; int nDelay = 0; if(::SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, &nDelay, 0)) nElapse += nDelay * 250; // all milli-seconds - SetTimer(ID_TIMER_FIRST, nElapse); + this->SetTimer(ID_TIMER_FIRST, nElapse); } return lRet; } @@ -382,29 +410,31 @@ class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinT LRESULT OnLButtonDblClk(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { LRESULT lRet = 0; - if(!IsHoverMode()) - lRet = DefWindowProc(uMsg, wParam, lParam); - if(::GetCapture() != m_hWnd) - SetCapture(); + if(!IsHoverMode() && !IsCheckMode()) + lRet = this->DefWindowProc(uMsg, wParam, lParam); + if(::GetCapture() != this->m_hWnd) + this->SetCapture(); if(m_fPressed == 0) { m_fPressed = 1; - Invalidate(); - UpdateWindow(); + this->Invalidate(); + this->UpdateWindow(); } return lRet; } LRESULT OnLButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { + if(((m_dwExtendedStyle & BMPBTN_AUTOCHECK) != 0) && (m_fPressed == 1)) + SetCheck(!GetCheck(), false); + LRESULT lRet = 0; - bool bHover = IsHoverMode(); - if(!bHover) - lRet = DefWindowProc(uMsg, wParam, lParam); - if(::GetCapture() == m_hWnd) + if(!IsHoverMode() && !IsCheckMode()) + lRet = this->DefWindowProc(uMsg, wParam, lParam); + if(::GetCapture() == this->m_hWnd) { - if(bHover && m_fPressed == 1) - ::SendMessage(GetParent(), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), BN_CLICKED), (LPARAM)m_hWnd); + if((IsHoverMode() || IsCheckMode()) && (m_fPressed == 1)) + this->GetParent().SendMessage(WM_COMMAND, MAKEWPARAM(this->GetDlgCtrlID(), BN_CLICKED), (LPARAM)this->m_hWnd); ::ReleaseCapture(); } return lRet; @@ -415,8 +445,8 @@ class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinT if(m_fPressed == 1) { m_fPressed = 0; - Invalidate(); - UpdateWindow(); + this->Invalidate(); + this->UpdateWindow(); } bHandled = FALSE; return 1; @@ -424,33 +454,33 @@ class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinT LRESULT OnEnable(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { - Invalidate(); - UpdateWindow(); + this->Invalidate(); + this->UpdateWindow(); bHandled = FALSE; return 1; } LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { - if(::GetCapture() == m_hWnd) + if(::GetCapture() == this->m_hWnd) { POINT ptCursor = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - ClientToScreen(&ptCursor); + this->ClientToScreen(&ptCursor); RECT rect = { 0 }; - GetWindowRect(&rect); + this->GetWindowRect(&rect); unsigned int uPressed = ::PtInRect(&rect, ptCursor) ? 1 : 0; if(m_fPressed != uPressed) { m_fPressed = uPressed; - Invalidate(); - UpdateWindow(); + this->Invalidate(); + this->UpdateWindow(); } } else if(IsHoverMode() && m_fMouseOver == 0) { m_fMouseOver = 1; - Invalidate(); - UpdateWindow(); + this->Invalidate(); + this->UpdateWindow(); StartTrackMouseLeave(); } bHandled = FALSE; @@ -462,21 +492,21 @@ class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinT if(m_fMouseOver == 1) { m_fMouseOver = 0; - Invalidate(); - UpdateWindow(); + this->Invalidate(); + this->UpdateWindow(); } return 0; } LRESULT OnKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { - if(wParam == VK_SPACE && IsHoverMode()) + if((wParam == VK_SPACE) && IsHoverMode()) return 0; // ignore if in hover mode - if(wParam == VK_SPACE && m_fPressed == 0) + if((wParam == VK_SPACE) && (m_fPressed == 0)) { m_fPressed = 1; - Invalidate(); - UpdateWindow(); + this->Invalidate(); + this->UpdateWindow(); } bHandled = FALSE; return 1; @@ -484,13 +514,15 @@ class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinT LRESULT OnKeyUp(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { - if(wParam == VK_SPACE && IsHoverMode()) + if((wParam == VK_SPACE) && IsHoverMode()) return 0; // ignore if in hover mode - if(wParam == VK_SPACE && m_fPressed == 1) + if((wParam == VK_SPACE) && (m_fPressed == 1)) { m_fPressed = 0; - Invalidate(); - UpdateWindow(); + if((m_dwExtendedStyle & BMPBTN_AUTOCHECK) != 0) + SetCheck(!GetCheck(), false); + this->Invalidate(); + this->UpdateWindow(); } bHandled = FALSE; return 1; @@ -502,22 +534,22 @@ class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinT switch(wParam) // timer ID { case ID_TIMER_FIRST: - KillTimer(ID_TIMER_FIRST); + this->KillTimer(ID_TIMER_FIRST); if(m_fPressed == 1) { - ::SendMessage(GetParent(), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), BN_CLICKED), (LPARAM)m_hWnd); + this->GetParent().SendMessage(WM_COMMAND, MAKEWPARAM(this->GetDlgCtrlID(), BN_CLICKED), (LPARAM)this->m_hWnd); int nElapse = 250; int nRepeat = 40; if(::SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &nRepeat, 0)) nElapse = 10000 / (10 * nRepeat + 25); // milli-seconds, approximated - SetTimer(ID_TIMER_REPEAT, nElapse); + this->SetTimer(ID_TIMER_REPEAT, nElapse); } break; case ID_TIMER_REPEAT: if(m_fPressed == 1) - ::SendMessage(GetParent(), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), BN_CLICKED), (LPARAM)m_hWnd); - else if(::GetCapture() != m_hWnd) - KillTimer(ID_TIMER_REPEAT); + this->GetParent().SendMessage(WM_COMMAND, MAKEWPARAM(this->GetDlgCtrlID(), BN_CLICKED), (LPARAM)this->m_hWnd); + else if(::GetCapture() != this->m_hWnd) + this->KillTimer(ID_TIMER_REPEAT); break; default: // not our timer break; @@ -536,18 +568,18 @@ class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinT void Init() { // We need this style to prevent Windows from painting the button - ModifyStyle(0, BS_OWNERDRAW); + this->ModifyStyle(0, BS_OWNERDRAW); // create a tool tip - m_tip.Create(m_hWnd); + m_tip.Create(this->m_hWnd); ATLASSERT(m_tip.IsWindow()); - if(m_tip.IsWindow() && m_lpstrToolTipText != NULL) + if(m_tip.IsWindow() && (m_lpstrToolTipText != NULL)) { m_tip.Activate(TRUE); - m_tip.AddTool(m_hWnd, m_lpstrToolTipText); + m_tip.AddTool(this->m_hWnd, m_lpstrToolTipText); } - if(m_ImageList.m_hImageList != NULL && (m_dwExtendedStyle & BMPBTN_AUTOSIZE) != 0) + if((m_ImageList.m_hImageList != NULL) && ((m_dwExtendedStyle & BMPBTN_AUTOSIZE) != 0)) SizeToImage(); } @@ -556,14 +588,19 @@ class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinT TRACKMOUSEEVENT tme = { 0 }; tme.cbSize = sizeof(tme); tme.dwFlags = TME_LEAVE; - tme.hwndTrack = m_hWnd; - return _TrackMouseEvent(&tme); + tme.hwndTrack = this->m_hWnd; + return ::TrackMouseEvent(&tme); } bool IsHoverMode() const { return ((m_dwExtendedStyle & BMPBTN_HOVER) != 0); } + + bool IsCheckMode() const + { + return ((m_dwExtendedStyle & (BMPBTN_CHECK | BMPBTN_AUTOCHECK)) != 0); + } }; class CBitmapButton : public CBitmapButtonImpl @@ -576,8 +613,6 @@ class CBitmapButton : public CBitmapButtonImpl { } }; -#endif // !_WIN32_WCE - /////////////////////////////////////////////////////////////////////////////// // CCheckListCtrlView - list view control with check boxes @@ -605,7 +640,7 @@ class CCheckListViewCtrlImplTraits typedef CCheckListViewCtrlImplTraits CCheckListViewCtrlTraits; template -class ATL_NO_VTABLE CCheckListViewCtrlImpl : public ATL::CWindowImpl +class ATL_NO_VTABLE CCheckListViewCtrlImpl : public ATL::CWindowImpl { public: DECLARE_WND_SUPERCLASS(NULL, TBase::GetWndClassName()) @@ -619,19 +654,13 @@ class ATL_NO_VTABLE CCheckListViewCtrlImpl : public ATL::CWindowImpl= 1300) - BOOL bRet = ATL::CWindowImplBaseT< TBase, TWinTraits>::SubclassWindow(hWnd); -#else // !(_MSC_VER >= 1300) - typedef ATL::CWindowImplBaseT< TBase, TWinTraits> _baseClass; - BOOL bRet = _baseClass::SubclassWindow(hWnd); -#endif // !(_MSC_VER >= 1300) - if(bRet) + BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits >::SubclassWindow(hWnd); + if(bRet != FALSE) { T* pT = static_cast(this); - pT; - ATLASSERT((pT->GetExtendedLVStyle() & LVS_EX_CHECKBOXES) != 0); - SetExtendedListViewStyle(pT->GetExtendedLVStyle()); + pT->Init(); } + return bRet; } @@ -643,23 +672,32 @@ class ATL_NO_VTABLE CCheckListViewCtrlImpl : public ATL::CWindowImplGetItem(&lvi); // if item is not selected, don't do anything if(!(lvi.state & LVIS_SELECTED)) return; // new check state will be reverse of the current state, - BOOL bCheck = !GetCheckState(nCurrItem); + BOOL bCheck = !this->GetCheckState(nCurrItem); int nItem = -1; int nOldItem = -1; - while((nItem = GetNextItem(nOldItem, LVNI_SELECTED)) != -1) + while((nItem = this->GetNextItem(nOldItem, LVNI_SELECTED)) != -1) { if(nItem != nCurrItem) - SetCheckState(nItem, bCheck); + this->SetCheckState(nItem, bCheck); nOldItem = nItem; } } // Implementation + void Init() + { + T* pT = static_cast(this); + pT; // avoid level 4 warning + ATLASSERT((pT->GetExtendedLVStyle() & LVS_EX_CHECKBOXES) != 0); + this->SetExtendedListViewStyle(pT->GetExtendedLVStyle()); + } + +// Message map and handlers BEGIN_MSG_MAP(CCheckListViewCtrlImpl) MESSAGE_HANDLER(WM_CREATE, OnCreate) MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) @@ -670,11 +708,13 @@ class ATL_NO_VTABLE CCheckListViewCtrlImpl : public ATL::CWindowImpl(this); - pT; - ATLASSERT((pT->GetExtendedLVStyle() & LVS_EX_CHECKBOXES) != 0); - SetExtendedListViewStyle(pT->GetExtendedLVStyle()); + LRESULT lRet = this->DefWindowProc(uMsg, wParam, lParam); + if(lRet == 0) + { + T* pT = static_cast(this); + pT->Init(); + } + return lRet; } @@ -683,7 +723,7 @@ class ATL_NO_VTABLE CCheckListViewCtrlImpl : public ATL::CWindowImpl= 0) + if((this->HitTest(&lvh) != -1) && (lvh.flags == LVHT_ONITEMSTATEICON) && (::GetKeyState(VK_CONTROL) >= 0)) { T* pT = static_cast(this); pT->CheckSelectedItems(lvh.iItem); @@ -696,8 +736,8 @@ class ATL_NO_VTABLE CCheckListViewCtrlImpl : public ATL::CWindowImpl= 0) + int nCurrItem = this->GetNextItem(-1, LVNI_FOCUSED); + if((nCurrItem != -1) && (::GetKeyState(VK_CONTROL) >= 0)) { T* pT = static_cast(this); pT->CheckSelectedItems(nCurrItem); @@ -718,40 +758,6 @@ class CCheckListViewCtrl : public CCheckListViewCtrlImpl /////////////////////////////////////////////////////////////////////////////// // CHyperLink - hyper link control implementation -#if (WINVER < 0x0500) && !defined(_WIN32_WCE) -__declspec(selectany) struct -{ - enum { cxWidth = 32, cyHeight = 32 }; - int xHotSpot; - int yHotSpot; - unsigned char arrANDPlane[cxWidth * cyHeight / 8]; - unsigned char arrXORPlane[cxWidth * cyHeight / 8]; -} _AtlHyperLink_CursorData = -{ - 5, 0, - { - 0xF9, 0xFF, 0xFF, 0xFF, 0xF0, 0xFF, 0xFF, 0xFF, 0xF0, 0xFF, 0xFF, 0xFF, 0xF0, 0xFF, 0xFF, 0xFF, - 0xF0, 0xFF, 0xFF, 0xFF, 0xF0, 0x3F, 0xFF, 0xFF, 0xF0, 0x07, 0xFF, 0xFF, 0xF0, 0x01, 0xFF, 0xFF, - 0xF0, 0x00, 0xFF, 0xFF, 0x10, 0x00, 0x7F, 0xFF, 0x00, 0x00, 0x7F, 0xFF, 0x00, 0x00, 0x7F, 0xFF, - 0x80, 0x00, 0x7F, 0xFF, 0xC0, 0x00, 0x7F, 0xFF, 0xC0, 0x00, 0x7F, 0xFF, 0xE0, 0x00, 0x7F, 0xFF, - 0xE0, 0x00, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xF8, 0x01, 0xFF, 0xFF, - 0xF8, 0x01, 0xFF, 0xFF, 0xF8, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF - }, - { - 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0xC0, 0x00, 0x00, 0x06, 0xD8, 0x00, 0x00, - 0x06, 0xDA, 0x00, 0x00, 0x06, 0xDB, 0x00, 0x00, 0x67, 0xFB, 0x00, 0x00, 0x77, 0xFF, 0x00, 0x00, - 0x37, 0xFF, 0x00, 0x00, 0x17, 0xFF, 0x00, 0x00, 0x1F, 0xFF, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, - 0x0F, 0xFE, 0x00, 0x00, 0x07, 0xFE, 0x00, 0x00, 0x07, 0xFE, 0x00, 0x00, 0x03, 0xFC, 0x00, 0x00, - 0x03, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - } -}; -#endif // (WINVER < 0x0500) && !defined(_WIN32_WCE) - #define HLINK_UNDERLINED 0x00000000 #define HLINK_NOTUNDERLINED 0x00000001 #define HLINK_UNDERLINEHOVER 0x00000002 @@ -779,9 +785,7 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai HFONT m_hFontNormal; RECT m_rcLink; -#ifndef _WIN32_WCE CToolTipCtrl m_tip; -#endif // !_WIN32_WCE COLORREF m_clrLink; COLORREF m_clrVisited; @@ -811,11 +815,6 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai { delete [] m_lpstrLabel; delete [] m_lpstrHyperLink; -#if (WINVER < 0x0500) && !defined(_WIN32_WCE) - // It was created, not loaded, so we have to destroy it - if(m_hCursor != NULL) - ::DestroyCursor(m_hCursor); -#endif // (WINVER < 0x0500) && !defined(_WIN32_WCE) } // Attributes @@ -842,7 +841,7 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai if(nLength <= lstrlen(m_lpstrLabel)) return false; - SecureHelper::strcpy_x(lpstrBuffer, nLength, m_lpstrLabel); + ATL::Checked::tcscpy_s(lpstrBuffer, nLength, m_lpstrLabel); return true; } @@ -856,12 +855,12 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai if(m_lpstrLabel == NULL) return false; - SecureHelper::strcpy_x(m_lpstrLabel, cchLen, lpstrLabel); + ATL::Checked::tcscpy_s(m_lpstrLabel, cchLen, lpstrLabel); T* pT = static_cast(this); pT->CalcLabelRect(); - if(m_hWnd != NULL) - SetWindowText(lpstrLabel); // Set this for accessibility + if(this->m_hWnd != NULL) + this->SetWindowText(lpstrLabel); // Set this for accessibility return true; } @@ -874,7 +873,7 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai if(nLength <= lstrlen(m_lpstrHyperLink)) return false; - SecureHelper::strcpy_x(lpstrBuffer, nLength, m_lpstrHyperLink); + ATL::Checked::tcscpy_s(lpstrBuffer, nLength, m_lpstrHyperLink); return true; } @@ -888,19 +887,19 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai if(m_lpstrHyperLink == NULL) return false; - SecureHelper::strcpy_x(m_lpstrHyperLink, cchLen, lpstrLink); + ATL::Checked::tcscpy_s(m_lpstrHyperLink, cchLen, lpstrLink); if(m_lpstrLabel == NULL) { T* pT = static_cast(this); pT->CalcLabelRect(); } -#ifndef _WIN32_WCE + if(m_tip.IsWindow()) { m_tip.Activate(TRUE); - m_tip.AddTool(m_hWnd, m_lpstrHyperLink, &m_rcLink, 1); + m_tip.AddTool(this->m_hWnd, m_lpstrHyperLink, &m_rcLink, 1); } -#endif // !_WIN32_WCE + return true; } @@ -925,15 +924,15 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai int GetIdealHeight() const { - ATLASSERT(::IsWindow(m_hWnd)); - if(m_lpstrLabel == NULL && m_lpstrHyperLink == NULL) + ATLASSERT(::IsWindow(this->m_hWnd)); + if((m_lpstrLabel == NULL) && (m_lpstrHyperLink == NULL)) return -1; if(!m_bPaintLabel) return -1; UINT uFormat = IsSingleLine() ? DT_SINGLELINE : DT_WORDBREAK; - CClientDC dc(m_hWnd); + CClientDC dc(this->m_hWnd); RECT rect = { 0 }; GetClientRect(&rect); HFONT hFontOld = dc.SelectFont(m_hFontNormal); @@ -943,7 +942,7 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai RECT rcLink = rect; dc.DrawText(_T("NS"), -1, &rcLink, DT_LEFT | uFormat | DT_CALCRECT); dc.SelectFont(hFontOld); - return max(rcText.bottom - rcText.top, rcLink.bottom - rcLink.top); + return __max(rcText.bottom - rcText.top, rcLink.bottom - rcLink.top); } bool GetIdealSize(SIZE& size) const @@ -960,13 +959,13 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai bool GetIdealSize(int& cx, int& cy) const { - ATLASSERT(::IsWindow(m_hWnd)); - if(m_lpstrLabel == NULL && m_lpstrHyperLink == NULL) + ATLASSERT(::IsWindow(this->m_hWnd)); + if((m_lpstrLabel == NULL) && (m_lpstrHyperLink == NULL)) return false; if(!m_bPaintLabel) return false; - CClientDC dc(m_hWnd); + CClientDC dc(this->m_hWnd); RECT rcClient = { 0 }; GetClientRect(&rcClient); RECT rcAll = rcClient; @@ -1001,7 +1000,7 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai dc.SelectFont(hFontOld); - int cyMax = max(rcLeft.bottom, max(rcLink.bottom, rcRight.bottom)); + int cyMax = __max(rcLeft.bottom, __max(rcLink.bottom, rcRight.bottom)); ::SetRect(&rcAll, rcLeft.left, rcLeft.top, rcRight.right, cyMax); } else @@ -1054,54 +1053,44 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai // Operations BOOL SubclassWindow(HWND hWnd) { - ATLASSERT(m_hWnd == NULL); + ATLASSERT(this->m_hWnd == NULL); ATLASSERT(::IsWindow(hWnd)); if(m_hFontNormal == NULL) m_hFontNormal = (HFONT)::SendMessage(hWnd, WM_GETFONT, 0, 0L); -#if (_MSC_VER >= 1300) - BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits>::SubclassWindow(hWnd); -#else // !(_MSC_VER >= 1300) - typedef ATL::CWindowImpl< T, TBase, TWinTraits> _baseClass; - BOOL bRet = _baseClass::SubclassWindow(hWnd); -#endif // !(_MSC_VER >= 1300) - if(bRet) + + BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits >::SubclassWindow(hWnd); + if(bRet != FALSE) { T* pT = static_cast(this); pT->Init(); } + return bRet; } bool Navigate() { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); bool bRet = true; if(IsNotifyButton()) { - NMHDR nmhdr = { m_hWnd, GetDlgCtrlID(), NM_CLICK }; - ::SendMessage(GetParent(), WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&nmhdr); + NMHDR nmhdr = { this->m_hWnd, (UINT_PTR)this->GetDlgCtrlID(), NM_CLICK }; + this->GetParent().SendMessage(WM_NOTIFY, this->GetDlgCtrlID(), (LPARAM)&nmhdr); } else if(IsCommandButton()) { - ::SendMessage(GetParent(), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), BN_CLICKED), (LPARAM)m_hWnd); + this->GetParent().SendMessage(WM_COMMAND, MAKEWPARAM(this->GetDlgCtrlID(), BN_CLICKED), (LPARAM)this->m_hWnd); } else { ATLASSERT(m_lpstrHyperLink != NULL); -#ifndef _WIN32_WCE DWORD_PTR dwRet = (DWORD_PTR)::ShellExecute(0, _T("open"), m_lpstrHyperLink, 0, 0, SW_SHOWNORMAL); bRet = (dwRet > 32); -#else // CE specific - SHELLEXECUTEINFO shExeInfo = { sizeof(SHELLEXECUTEINFO), 0, 0, L"open", m_lpstrHyperLink, 0, 0, SW_SHOWNORMAL, 0, 0, 0, 0, 0, 0, 0 }; - ::ShellExecuteEx(&shExeInfo); - DWORD_PTR dwRet = (DWORD_PTR)shExeInfo.hInstApp; - bRet = (dwRet == 0) || (dwRet > 32); -#endif // _WIN32_WCE ATLASSERT(bRet); if(bRet) { m_bVisited = true; - Invalidate(); + this->Invalidate(); } } return bRet; @@ -1132,21 +1121,15 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai // Message map and handlers BEGIN_MSG_MAP(CHyperLinkImpl) MESSAGE_HANDLER(WM_CREATE, OnCreate) -#ifndef _WIN32_WCE MESSAGE_HANDLER(WM_DESTROY, OnDestroy) MESSAGE_RANGE_HANDLER(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseMessage) -#endif // !_WIN32_WCE MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) MESSAGE_HANDLER(WM_PAINT, OnPaint) -#ifndef _WIN32_WCE MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) -#endif // !_WIN32_WCE MESSAGE_HANDLER(WM_SETFOCUS, OnFocus) MESSAGE_HANDLER(WM_KILLFOCUS, OnFocus) MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) -#ifndef _WIN32_WCE MESSAGE_HANDLER(WM_MOUSELEAVE, OnMouseLeave) -#endif // !_WIN32_WCE MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) MESSAGE_HANDLER(WM_CHAR, OnChar) @@ -1166,7 +1149,6 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai return 0; } -#ifndef _WIN32_WCE LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { if(m_tip.IsWindow()) @@ -1195,13 +1177,12 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai LRESULT OnMouseMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { - MSG msg = { m_hWnd, uMsg, wParam, lParam }; + MSG msg = { this->m_hWnd, uMsg, wParam, lParam }; if(m_tip.IsWindow() && IsUsingToolTip()) m_tip.RelayEvent(&msg); bHandled = FALSE; return 1; } -#endif // !_WIN32_WCE LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { @@ -1224,7 +1205,7 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai } else { - CPaintDC dc(m_hWnd); + CPaintDC dc(this->m_hWnd); pT->DoEraseBackground(dc.m_hDC); pT->DoPaint(dc.m_hDC); } @@ -1235,7 +1216,7 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai LRESULT OnFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { if(m_bPaintLabel) - Invalidate(); + this->Invalidate(); else bHandled = FALSE; return 0; @@ -1244,7 +1225,7 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - if((m_lpstrHyperLink != NULL || IsCommandButton()) && ::PtInRect(&m_rcLink, pt)) + if(((m_lpstrHyperLink != NULL) || IsCommandButton()) && ::PtInRect(&m_rcLink, pt)) { ::SetCursor(m_hCursor); if(IsUnderlineHover()) @@ -1252,11 +1233,9 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai if(!m_bHover) { m_bHover = true; - InvalidateRect(&m_rcLink); - UpdateWindow(); -#ifndef _WIN32_WCE + this->InvalidateRect(&m_rcLink); + this->UpdateWindow(); StartTrackMouseLeave(); -#endif // !_WIN32_WCE } } } @@ -1267,8 +1246,8 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai if(m_bHover) { m_bHover = false; - InvalidateRect(&m_rcLink); - UpdateWindow(); + this->InvalidateRect(&m_rcLink); + this->UpdateWindow(); } } bHandled = FALSE; @@ -1276,33 +1255,31 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai return 0; } -#ifndef _WIN32_WCE LRESULT OnMouseLeave(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { if(IsUnderlineHover() && m_bHover) { m_bHover = false; - InvalidateRect(&m_rcLink); - UpdateWindow(); + this->InvalidateRect(&m_rcLink); + this->UpdateWindow(); } return 0; } -#endif // !_WIN32_WCE LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) { POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; if(::PtInRect(&m_rcLink, pt)) { - SetFocus(); - SetCapture(); + this->SetFocus(); + this->SetCapture(); } return 0; } LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) { - if(GetCapture() == m_hWnd) + if(GetCapture() == this->m_hWnd) { ReleaseCapture(); POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; @@ -1317,7 +1294,7 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai LRESULT OnChar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { - if(wParam == VK_RETURN || wParam == VK_SPACE) + if((wParam == VK_RETURN) || (wParam == VK_SPACE)) { T* pT = static_cast(this); pT->Navigate(); @@ -1334,8 +1311,8 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai { POINT pt = { 0, 0 }; GetCursorPos(&pt); - ScreenToClient(&pt); - if((m_lpstrHyperLink != NULL || IsCommandButton()) && ::PtInRect(&m_rcLink, pt)) + this->ScreenToClient(&pt); + if(((m_lpstrHyperLink != NULL) || IsCommandButton()) && ::PtInRect(&m_rcLink, pt)) { return TRUE; } @@ -1345,8 +1322,8 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai LRESULT OnEnable(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { - Invalidate(); - UpdateWindow(); + this->Invalidate(); + this->UpdateWindow(); return 0; } @@ -1375,8 +1352,8 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai if((BOOL)lParam) { - Invalidate(); - UpdateWindow(); + this->Invalidate(); + this->UpdateWindow(); } return 0; @@ -1400,35 +1377,27 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai // Implementation void Init() { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); // Check if we should paint a label const int cchBuff = 8; TCHAR szBuffer[cchBuff] = { 0 }; - if(::GetClassName(m_hWnd, szBuffer, cchBuff)) + if(::GetClassName(this->m_hWnd, szBuffer, cchBuff)) { if(lstrcmpi(szBuffer, _T("static")) == 0) { - ModifyStyle(0, SS_NOTIFY); // we need this - DWORD dwStyle = GetStyle() & 0x000000FF; -#ifndef _WIN32_WCE - if(dwStyle == SS_ICON || dwStyle == SS_BLACKRECT || dwStyle == SS_GRAYRECT || - dwStyle == SS_WHITERECT || dwStyle == SS_BLACKFRAME || dwStyle == SS_GRAYFRAME || - dwStyle == SS_WHITEFRAME || dwStyle == SS_OWNERDRAW || - dwStyle == SS_BITMAP || dwStyle == SS_ENHMETAFILE) -#else // CE specific - if(dwStyle == SS_ICON || dwStyle == SS_BITMAP) -#endif // _WIN32_WCE + this->ModifyStyle(0, SS_NOTIFY); // we need this + DWORD dwStyle = this->GetStyle() & 0x000000FF; + if((dwStyle == SS_ICON) || (dwStyle == SS_BLACKRECT) || (dwStyle == SS_GRAYRECT) || + (dwStyle == SS_WHITERECT) || (dwStyle == SS_BLACKFRAME) || (dwStyle == SS_GRAYFRAME) || + (dwStyle == SS_WHITEFRAME) || (dwStyle == SS_OWNERDRAW) || + (dwStyle == SS_BITMAP) || (dwStyle == SS_ENHMETAFILE)) m_bPaintLabel = false; } } // create or load a cursor -#if (WINVER >= 0x0500) || defined(_WIN32_WCE) m_hCursor = ::LoadCursor(NULL, IDC_HAND); -#else - m_hCursor = ::CreateCursor(ModuleHelper::GetModuleInstance(), _AtlHyperLink_CursorData.xHotSpot, _AtlHyperLink_CursorData.yHotSpot, _AtlHyperLink_CursorData.cxWidth, _AtlHyperLink_CursorData.cyHeight, _AtlHyperLink_CursorData.arrANDPlane, _AtlHyperLink_CursorData.arrXORPlane); -#endif ATLASSERT(m_hCursor != NULL); // set fonts @@ -1444,21 +1413,19 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai CreateLinkFontFromNormal(); } -#ifndef _WIN32_WCE // create a tool tip - m_tip.Create(m_hWnd); + m_tip.Create(this->m_hWnd); ATLASSERT(m_tip.IsWindow()); -#endif // !_WIN32_WCE // set label (defaults to window text) if(m_lpstrLabel == NULL) { - int nLen = GetWindowTextLength(); + int nLen = this->GetWindowTextLength(); if(nLen > 0) { ATLTRY(m_lpstrLabel = new TCHAR[nLen + 1]); if(m_lpstrLabel != NULL) - ATLVERIFY(GetWindowText(m_lpstrLabel, nLen + 1) > 0); + ATLVERIFY(this->GetWindowText(m_lpstrLabel, nLen + 1) > 0); } } @@ -1466,23 +1433,21 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai pT->CalcLabelRect(); // set hyperlink (defaults to label), or just activate tool tip if already set - if(m_lpstrHyperLink == NULL && !IsCommandButton()) + if((m_lpstrHyperLink == NULL) && !IsCommandButton()) { if(m_lpstrLabel != NULL) SetHyperLink(m_lpstrLabel); } -#ifndef _WIN32_WCE else { m_tip.Activate(TRUE); - m_tip.AddTool(m_hWnd, m_lpstrHyperLink, &m_rcLink, 1); + m_tip.AddTool(this->m_hWnd, m_lpstrHyperLink, &m_rcLink, 1); } -#endif // !_WIN32_WCE // set link colors if(m_bPaintLabel) { - CRegKeyEx rk; + ATL::CRegKey rk; LONG lRet = rk.Open(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Internet Explorer\\Settings")); if(lRet == ERROR_SUCCESS) { @@ -1522,7 +1487,7 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai if(*p == _T(',')) { *p = _T('\0'); - c[i] = MinCrtHelper::_atoi(lpstr); + c[i] = _ttoi(lpstr); lpstr = &p[1]; break; } @@ -1532,21 +1497,21 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai } if(*lpstr == _T('\0')) return CLR_INVALID; - c[2] = MinCrtHelper::_atoi(lpstr); + c[2] = _ttoi(lpstr); return RGB(c[0], c[1], c[2]); } bool CalcLabelRect() { - if(!::IsWindow(m_hWnd)) + if(!::IsWindow(this->m_hWnd)) return false; - if(m_lpstrLabel == NULL && m_lpstrHyperLink == NULL) + if((m_lpstrLabel == NULL) && (m_lpstrHyperLink == NULL)) return false; - CClientDC dc(m_hWnd); + CClientDC dc(this->m_hWnd); RECT rcClient = { 0 }; - GetClientRect(&rcClient); + this->GetClientRect(&rcClient); m_rcLink = rcClient; if(!m_bPaintLabel) return true; @@ -1591,7 +1556,7 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai if(m_hFontLink != NULL) hOldFont = dc.SelectFont(m_hFontLink); LPTSTR lpstrText = (m_lpstrLabel != NULL) ? m_lpstrLabel : m_lpstrHyperLink; - DWORD dwStyle = GetStyle(); + DWORD dwStyle = this->GetStyle(); UINT uFormat = DT_LEFT; if (dwStyle & SS_CENTER) uFormat = DT_CENTER; @@ -1665,11 +1630,11 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai void DoEraseBackground(CDCHandle dc) { - HBRUSH hBrush = (HBRUSH)::SendMessage(GetParent(), WM_CTLCOLORSTATIC, (WPARAM)dc.m_hDC, (LPARAM)m_hWnd); + HBRUSH hBrush = (HBRUSH)this->GetParent().SendMessage(WM_CTLCOLORSTATIC, (WPARAM)dc.m_hDC, (LPARAM)this->m_hWnd); if(hBrush != NULL) { RECT rect = { 0 }; - GetClientRect(&rect); + this->GetClientRect(&rect); dc.FillRect(&rect, hBrush); } } @@ -1691,7 +1656,7 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai // get label part rects RECT rcClient = { 0 }; - GetClientRect(&rcClient); + this->GetClientRect(&rcClient); dc.SetBkMode(TRANSPARENT); HFONT hFontOld = dc.SelectFont(m_hFontNormal); @@ -1701,8 +1666,8 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai if(lpstrLeft != NULL) dc.DrawText(lpstrLeft, cchLeft, &rcClient, DT_LEFT | uFormat); - COLORREF clrOld = dc.SetTextColor(IsWindowEnabled() ? (m_bVisited ? m_clrVisited : m_clrLink) : (::GetSysColor(COLOR_GRAYTEXT))); - if(m_hFontLink != NULL && (!IsUnderlineHover() || (IsUnderlineHover() && m_bHover))) + COLORREF clrOld = dc.SetTextColor(this->IsWindowEnabled() ? (m_bVisited ? m_clrVisited : m_clrLink) : (::GetSysColor(COLOR_GRAYTEXT))); + if((m_hFontLink != NULL) && (!IsUnderlineHover() || (IsUnderlineHover() && m_bHover))) dc.SelectFont(m_hFontLink); else dc.SelectFont(m_hFontNormal); @@ -1717,7 +1682,7 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai dc.DrawText(lpstrRight, cchRight, &rcRight, DT_LEFT | uFormat); } - if(GetFocus() == m_hWnd) + if(GetFocus() == this->m_hWnd) dc.DrawFocusRect(&m_rcLink); dc.SelectFont(hFontOld); @@ -1725,17 +1690,17 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai else { dc.SetBkMode(TRANSPARENT); - COLORREF clrOld = dc.SetTextColor(IsWindowEnabled() ? (m_bVisited ? m_clrVisited : m_clrLink) : (::GetSysColor(COLOR_GRAYTEXT))); + COLORREF clrOld = dc.SetTextColor(this->IsWindowEnabled() ? (m_bVisited ? m_clrVisited : m_clrLink) : (::GetSysColor(COLOR_GRAYTEXT))); HFONT hFontOld = NULL; - if(m_hFontLink != NULL && (!IsUnderlineHover() || (IsUnderlineHover() && m_bHover))) + if((m_hFontLink != NULL) && (!IsUnderlineHover() || (IsUnderlineHover() && m_bHover))) hFontOld = dc.SelectFont(m_hFontLink); else hFontOld = dc.SelectFont(m_hFontNormal); LPTSTR lpstrText = (m_lpstrLabel != NULL) ? m_lpstrLabel : m_lpstrHyperLink; - DWORD dwStyle = GetStyle(); + DWORD dwStyle = this->GetStyle(); UINT uFormat = DT_LEFT; if (dwStyle & SS_CENTER) uFormat = DT_CENTER; @@ -1745,7 +1710,7 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai dc.DrawText(lpstrText, -1, &m_rcLink, uFormat); - if(GetFocus() == m_hWnd) + if(GetFocus() == this->m_hWnd) dc.DrawFocusRect(&m_rcLink); dc.SetTextColor(clrOld); @@ -1753,16 +1718,14 @@ class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTrai } } -#ifndef _WIN32_WCE BOOL StartTrackMouseLeave() { TRACKMOUSEEVENT tme = { 0 }; tme.cbSize = sizeof(tme); tme.dwFlags = TME_LEAVE; - tme.hwndTrack = m_hWnd; - return _TrackMouseEvent(&tme); + tme.hwndTrack = this->m_hWnd; + return ::TrackMouseEvent(&tme); } -#endif // !_WIN32_WCE // Implementation helpers bool IsUnderlined() const @@ -1892,9 +1855,7 @@ class CCustomWaitCursor : public CWaitCursor ~CCustomWaitCursor() { Restore(); -#if !defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))) ::DestroyCursor(m_hWaitCursor); -#endif // !defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))) } }; @@ -1926,12 +1887,7 @@ class ATL_NO_VTABLE CMultiPaneStatusBarCtrlImpl : public ATL::CWindowImpl< T, TB // Methods HWND Create(HWND hWndParent, LPCTSTR lpstrText, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBARS_SIZEGRIP, UINT nID = ATL_IDW_STATUS_BAR) { -#if (_MSC_VER >= 1300) return ATL::CWindowImpl< T, TBase >::Create(hWndParent, rcDefault, lpstrText, dwStyle, 0, nID); -#else // !(_MSC_VER >= 1300) - typedef ATL::CWindowImpl< T, TBase > _baseClass; - return _baseClass::Create(hWndParent, rcDefault, lpstrText, dwStyle, 0, nID); -#endif // !(_MSC_VER >= 1300) } HWND Create(HWND hWndParent, UINT nTextID = ATL_IDS_IDLEMESSAGE, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBARS_SIZEGRIP, UINT nID = ATL_IDW_STATUS_BAR) @@ -1944,7 +1900,7 @@ class ATL_NO_VTABLE CMultiPaneStatusBarCtrlImpl : public ATL::CWindowImpl< T, TB BOOL SetPanes(int* pPanes, int nPanes, bool bSetText = true) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(nPanes > 0); m_nPanes = nPanes; @@ -1956,21 +1912,21 @@ class ATL_NO_VTABLE CMultiPaneStatusBarCtrlImpl : public ATL::CWindowImpl< T, TB if(m_pPane == NULL) return FALSE; - CTempBuffer buff; + ATL::CTempBuffer buff; int* pPanesPos = buff.Allocate(nPanes); ATLASSERT(pPanesPos != NULL); if(pPanesPos == NULL) return FALSE; - SecureHelper::memcpy_x(m_pPane, nPanes * sizeof(int), pPanes, nPanes * sizeof(int)); + ATL::Checked::memcpy_s(m_pPane, nPanes * sizeof(int), pPanes, nPanes * sizeof(int)); // get status bar DC and set font - CClientDC dc(m_hWnd); + CClientDC dc(this->m_hWnd); HFONT hOldFont = dc.SelectFont(GetFont()); // get status bar borders int arrBorders[3] = { 0 }; - GetBorders(arrBorders); + this->GetBorders(arrBorders); const int cchBuff = 128; TCHAR szBuff[cchBuff] = { 0 }; @@ -1996,7 +1952,7 @@ class ATL_NO_VTABLE CMultiPaneStatusBarCtrlImpl : public ATL::CWindowImpl< T, TB cxLeft = pPanesPos[i]; } - BOOL bRet = SetParts(nPanes, pPanesPos); + BOOL bRet = this->SetParts(nPanes, pPanesPos); if(bRet && bSetText) { @@ -2016,12 +1972,12 @@ class ATL_NO_VTABLE CMultiPaneStatusBarCtrlImpl : public ATL::CWindowImpl< T, TB bool GetPaneTextLength(int nPaneID, int* pcchLength = NULL, int* pnType = NULL) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); int nIndex = GetPaneIndexFromID(nPaneID); if(nIndex == -1) return false; - int nLength = GetTextLength(nIndex, pnType); + int nLength = this->GetTextLength(nIndex, pnType); if(pcchLength != NULL) *pcchLength = nLength; @@ -2030,12 +1986,12 @@ class ATL_NO_VTABLE CMultiPaneStatusBarCtrlImpl : public ATL::CWindowImpl< T, TB BOOL GetPaneText(int nPaneID, LPTSTR lpstrText, int* pcchLength = NULL, int* pnType = NULL) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); int nIndex = GetPaneIndexFromID(nPaneID); if(nIndex == -1) return FALSE; - int nLength = GetText(nIndex, lpstrText, pnType); + int nLength = this->GetText(nIndex, lpstrText, pnType); if(pcchLength != NULL) *pcchLength = nLength; @@ -2044,38 +2000,38 @@ class ATL_NO_VTABLE CMultiPaneStatusBarCtrlImpl : public ATL::CWindowImpl< T, TB BOOL SetPaneText(int nPaneID, LPCTSTR lpstrText, int nType = 0) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); int nIndex = GetPaneIndexFromID(nPaneID); if(nIndex == -1) return FALSE; - return SetText(nIndex, lpstrText, nType); + return this->SetText(nIndex, lpstrText, nType); } BOOL GetPaneRect(int nPaneID, LPRECT lpRect) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); int nIndex = GetPaneIndexFromID(nPaneID); if(nIndex == -1) return FALSE; - return GetRect(nIndex, lpRect); + return this->GetRect(nIndex, lpRect); } BOOL SetPaneWidth(int nPaneID, int cxWidth) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(nPaneID != ID_DEFAULT_PANE); // Can't resize this one int nIndex = GetPaneIndexFromID(nPaneID); if(nIndex == -1) return FALSE; // get pane positions - CTempBuffer buff; + ATL::CTempBuffer buff; int* pPanesPos = buff.Allocate(m_nPanes); if(pPanesPos == NULL) return FALSE; - GetParts(m_nPanes, pPanesPos); + this->GetParts(m_nPanes, pPanesPos); // calculate offset int cxPaneWidth = pPanesPos[nIndex] - ((nIndex == 0) ? 0 : pPanesPos[nIndex - 1]); int cxOff = cxWidth - cxPaneWidth; @@ -2102,55 +2058,51 @@ class ATL_NO_VTABLE CMultiPaneStatusBarCtrlImpl : public ATL::CWindowImpl< T, TB pPanesPos[i] -= cxOff; } // set pane postions - return SetParts(m_nPanes, pPanesPos); + return this->SetParts(m_nPanes, pPanesPos); } -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) BOOL GetPaneTipText(int nPaneID, LPTSTR lpstrText, int nSize) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); int nIndex = GetPaneIndexFromID(nPaneID); if(nIndex == -1) return FALSE; - GetTipText(nIndex, lpstrText, nSize); + this->GetTipText(nIndex, lpstrText, nSize); return TRUE; } BOOL SetPaneTipText(int nPaneID, LPCTSTR lpstrText) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); int nIndex = GetPaneIndexFromID(nPaneID); if(nIndex == -1) return FALSE; - SetTipText(nIndex, lpstrText); + this->SetTipText(nIndex, lpstrText); return TRUE; } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) -#if ((_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 0x0500)) BOOL GetPaneIcon(int nPaneID, HICON& hIcon) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); int nIndex = GetPaneIndexFromID(nPaneID); if(nIndex == -1) return FALSE; - hIcon = GetIcon(nIndex); + hIcon = this->GetIcon(nIndex); return TRUE; } BOOL SetPaneIcon(int nPaneID, HICON hIcon) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); int nIndex = GetPaneIndexFromID(nPaneID); if(nIndex == -1) return FALSE; - return SetIcon(nIndex, hIcon); + return this->SetIcon(nIndex, hIcon); } -#endif // ((_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)) || (defined(_WIN32_WCE) && (_WIN32_WCE >= 0x0500)) // Message map and handlers BEGIN_MSG_MAP(CMultiPaneStatusBarCtrlImpl< T >) @@ -2159,8 +2111,8 @@ class ATL_NO_VTABLE CMultiPaneStatusBarCtrlImpl : public ATL::CWindowImpl< T, TB LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); - if(wParam != SIZE_MINIMIZED && m_nPanes > 0) + LRESULT lRet = this->DefWindowProc(uMsg, wParam, lParam); + if((wParam != SIZE_MINIMIZED) && (m_nPanes > 0)) { T* pT = static_cast(this); pT->UpdatePanesLayout(); @@ -2172,24 +2124,22 @@ class ATL_NO_VTABLE CMultiPaneStatusBarCtrlImpl : public ATL::CWindowImpl< T, TB BOOL UpdatePanesLayout() { // get pane positions - CTempBuffer buff; + ATL::CTempBuffer buff; int* pPanesPos = buff.Allocate(m_nPanes); ATLASSERT(pPanesPos != NULL); if(pPanesPos == NULL) return FALSE; - int nRet = GetParts(m_nPanes, pPanesPos); + int nRet = this->GetParts(m_nPanes, pPanesPos); ATLASSERT(nRet == m_nPanes); if(nRet != m_nPanes) return FALSE; // calculate offset RECT rcClient = { 0 }; - GetClientRect(&rcClient); + this->GetClientRect(&rcClient); int cxOff = rcClient.right - pPanesPos[m_nPanes - 1]; -#ifndef _WIN32_WCE // Move panes left if size grip box is present - if((GetStyle() & SBARS_SIZEGRIP) != 0) + if((this->GetStyle() & SBARS_SIZEGRIP) != 0) cxOff -= ::GetSystemMetrics(SM_CXVSCROLL) + ::GetSystemMetrics(SM_CXEDGE); -#endif // !_WIN32_WCE // find variable width pane int i; for(i = 0; i < m_nPanes; i++) @@ -2204,7 +2154,7 @@ class ATL_NO_VTABLE CMultiPaneStatusBarCtrlImpl : public ATL::CWindowImpl< T, TB pPanesPos[i] += cxOff; } // set pane postions - return SetParts(m_nPanes, pPanesPos); + return this->SetParts(m_nPanes, pPanesPos); } int GetPaneIndexFromID(int nPaneID) const @@ -2230,10 +2180,14 @@ class CMultiPaneStatusBarCtrl : public CMultiPaneStatusBarCtrlImpl class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CCustomDraw< T > @@ -2293,7 +2247,7 @@ class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWin m_dwExtendedStyle = dwExtendedStyle; else m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); - if(m_hWnd != NULL) + if(this->m_hWnd != NULL) { T* pT = static_cast(this); bool bUpdate = false; @@ -2321,6 +2275,12 @@ class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWin bUpdate = true; } +#ifndef _ATL_NO_MSIMG + if((dwPrevStyle & PANECNT_GRADIENT) != (m_dwExtendedStyle & PANECNT_GRADIENT)) // change background + { + bUpdate = true; + } +#endif if(bUpdate) pT->UpdateLayout(); } @@ -2336,7 +2296,7 @@ class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWin { HWND hWndOldClient = m_wndClient; m_wndClient = hWndClient; - if(m_hWnd != NULL) + if(this->m_hWnd != NULL) { T* pT = static_cast(this); pT->UpdateLayout(); @@ -2348,18 +2308,18 @@ class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWin { ATLASSERT(lpstrTitle != NULL); - errno_t nRet = SecureHelper::strncpy_x(lpstrTitle, cchLength, m_szTitle, _TRUNCATE); + errno_t nRet = ATL::Checked::tcsncpy_s(lpstrTitle, cchLength, m_szTitle, _TRUNCATE); - return (nRet == 0 || nRet == STRUNCATE); + return ((nRet == 0) || (nRet == STRUNCATE)); } BOOL SetTitle(LPCTSTR lpstrTitle) { ATLASSERT(lpstrTitle != NULL); - errno_t nRet = SecureHelper::strncpy_x(m_szTitle, m_cchTitle, lpstrTitle, _TRUNCATE); - bool bRet = (nRet == 0 || nRet == STRUNCATE); - if(bRet && m_hWnd != NULL) + errno_t nRet = ATL::Checked::tcsncpy_s(m_szTitle, m_cchTitle, lpstrTitle, _TRUNCATE); + bool bRet = ((nRet == 0) || (nRet == STRUNCATE)); + if(bRet && (this->m_hWnd != NULL)) { T* pT = static_cast(this); pT->UpdateLayout(); @@ -2378,13 +2338,8 @@ class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWin DWORD dwExStyle = 0, UINT nID = 0, LPVOID lpCreateParam = NULL) { if(lpstrTitle != NULL) - SecureHelper::strncpy_x(m_szTitle, m_cchTitle, lpstrTitle, _TRUNCATE); -#if (_MSC_VER >= 1300) + ATL::Checked::tcsncpy_s(m_szTitle, m_cchTitle, lpstrTitle, _TRUNCATE); return ATL::CWindowImpl< T, TBase, TWinTraits >::Create(hWndParent, rcDefault, NULL, dwStyle, dwExStyle, nID, lpCreateParam); -#else // !(_MSC_VER >= 1300) - typedef ATL::CWindowImpl< T, TBase, TWinTraits > _baseClass; - return _baseClass::Create(hWndParent, rcDefault, NULL, dwStyle, dwExStyle, nID, lpCreateParam); -#endif // !(_MSC_VER >= 1300) } HWND Create(HWND hWndParent, UINT uTitleID, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, @@ -2392,17 +2347,28 @@ class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWin { if(uTitleID != 0U) ::LoadString(ModuleHelper::GetResourceInstance(), uTitleID, m_szTitle, m_cchTitle); -#if (_MSC_VER >= 1300) return ATL::CWindowImpl< T, TBase, TWinTraits >::Create(hWndParent, rcDefault, NULL, dwStyle, dwExStyle, nID, lpCreateParam); -#else // !(_MSC_VER >= 1300) - typedef ATL::CWindowImpl< T, TBase, TWinTraits > _baseClass; - return _baseClass::Create(hWndParent, rcDefault, NULL, dwStyle, dwExStyle, nID, lpCreateParam); -#endif // !(_MSC_VER >= 1300) + } + + BOOL SubclassWindow(HWND hWnd) + { + BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits >::SubclassWindow(hWnd); + if(bRet != FALSE) + { + T* pT = static_cast(this); + pT->Init(); + + RECT rect = { 0 }; + GetClientRect(&rect); + pT->UpdateLayout(rect.right, rect.bottom); + } + + return bRet; } BOOL EnableCloseButton(BOOL bEnable) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); T* pT = static_cast(this); pT; // avoid level 4 warning return (m_tb.m_hWnd != NULL) ? m_tb.EnableButton(pT->m_nCloseBtnID, bEnable) : FALSE; @@ -2411,7 +2377,7 @@ class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWin void UpdateLayout() { RECT rcClient = { 0 }; - GetClientRect(&rcClient); + this->GetClientRect(&rcClient); T* pT = static_cast(this); pT->UpdateLayout(rcClient.right, rcClient.bottom); } @@ -2426,9 +2392,7 @@ class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWin MESSAGE_HANDLER(WM_SETFONT, OnSetFont) MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) MESSAGE_HANDLER(WM_PAINT, OnPaint) -#ifndef _WIN32_WCE MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) -#endif // !_WIN32_WCE MESSAGE_HANDLER(WM_NOTIFY, OnNotify) MESSAGE_HANDLER(WM_COMMAND, OnCommand) FORWARD_NOTIFICATIONS() @@ -2436,32 +2400,8 @@ class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWin LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { - if(m_hFont == NULL) - { - // The same as AtlCreateControlFont() for horizontal pane -#ifndef _WIN32_WCE - LOGFONT lf = { 0 }; - ATLVERIFY(::SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, 0) != FALSE); - if(IsVertical()) - lf.lfEscapement = 900; // 90 degrees - m_hFont = ::CreateFontIndirect(&lf); -#else // CE specific - m_hFont = (HFONT)::GetStockObject(SYSTEM_FONT); - if(IsVertical()) - { - CLogFont lf(m_hFont); - lf.lfEscapement = 900; // 90 degrees - m_hFont = ::CreateFontIndirect(&lf); - } -#endif // _WIN32_WCE - m_bInternalFont = true; - } - T* pT = static_cast(this); - pT->CalcSize(); - - if((m_dwExtendedStyle & PANECNT_NOCLOSEBUTTON) == 0) - pT->CreateCloseButton(); + pT->Init(); return 0; } @@ -2516,9 +2456,12 @@ class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWin return 0; } - LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { - return 1; // no background needed + T* pT = static_cast(this); + pT->DrawPaneTitleBackground((HDC)wParam); + + return 1; } LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) @@ -2533,7 +2476,7 @@ class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWin } else { - CPaintDC dc(m_hWnd); + CPaintDC dc(this->m_hWnd); pT->DrawPaneTitle(dc.m_hDC); if(m_wndClient.m_hWnd == NULL) // no client window @@ -2557,16 +2500,14 @@ class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWin LRESULT lRet = 0; // pass toolbar custom draw notifications to the base class - if(lpnmh->code == NM_CUSTOMDRAW && lpnmh->hwndFrom == m_tb.m_hWnd) + if((lpnmh->code == NM_CUSTOMDRAW) && (lpnmh->hwndFrom == m_tb.m_hWnd)) lRet = CCustomDraw< T >::OnCustomDraw(0, lpnmh, bHandled); -#ifndef _WIN32_WCE // tooltip notifications come with the tooltip window handle and button ID, // pass them to the parent if we don't handle them - else if(lpnmh->code == TTN_GETDISPINFO && lpnmh->idFrom == pT->m_nCloseBtnID) + else if((lpnmh->code == TTN_GETDISPINFO) && (lpnmh->idFrom == pT->m_nCloseBtnID)) bHandled = pT->GetToolTipText(lpnmh); -#endif // !_WIN32_WCE // only let notifications not from the toolbar go to the parent - else if(lpnmh->hwndFrom != m_tb.m_hWnd && lpnmh->idFrom != pT->m_nCloseBtnID) + else if((lpnmh->hwndFrom != m_tb.m_hWnd) && (lpnmh->idFrom != pT->m_nCloseBtnID)) bHandled = FALSE; return lRet; @@ -2575,8 +2516,8 @@ class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWin LRESULT OnCommand(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { // if command comes from the close button, substitute HWND of the pane container instead - if(m_tb.m_hWnd != NULL && (HWND)lParam == m_tb.m_hWnd) - return ::SendMessage(GetParent(), WM_COMMAND, wParam, (LPARAM)m_hWnd); + if((m_tb.m_hWnd != NULL) && ((HWND)lParam == m_tb.m_hWnd)) + return this->GetParent().SendMessage(WM_COMMAND, wParam, (LPARAM)this->m_hWnd); bHandled = FALSE; return 1; @@ -2588,30 +2529,15 @@ class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWin return CDRF_NOTIFYITEMDRAW; // we need per-item notifications } - DWORD OnItemPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW lpNMCustomDraw) + DWORD OnItemPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) { - CDCHandle dc = lpNMCustomDraw->hdc; -#if (_WIN32_IE >= 0x0400) - RECT& rc = lpNMCustomDraw->rc; -#else // !(_WIN32_IE >= 0x0400) - RECT rc; - m_tb.GetItemRect(0, &rc); -#endif // !(_WIN32_IE >= 0x0400) - - dc.FillRect(&rc, COLOR_3DFACE); - return CDRF_NOTIFYPOSTPAINT; } DWORD OnItemPostPaint(int /*idCtrl*/, LPNMCUSTOMDRAW lpNMCustomDraw) { CDCHandle dc = lpNMCustomDraw->hdc; -#if (_WIN32_IE >= 0x0400) RECT& rc = lpNMCustomDraw->rc; -#else // !(_WIN32_IE >= 0x0400) - RECT rc = { 0 }; - m_tb.GetItemRect(0, &rc); -#endif // !(_WIN32_IE >= 0x0400) RECT rcImage = { m_xBtnImageLeft, m_yBtnImageTop, m_xBtnImageRight + 1, m_yBtnImageBottom + 1 }; ::OffsetRect(&rcImage, rc.left, rc.top); @@ -2641,9 +2567,29 @@ class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWin } // Implementation - overrideable methods + void Init() + { + if(m_hFont == NULL) + { + // The same as AtlCreateControlFont() for horizontal pane + LOGFONT lf = { 0 }; + ATLVERIFY(::SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, 0) != FALSE); + if(IsVertical()) + lf.lfEscapement = 900; // 90 degrees + m_hFont = ::CreateFontIndirect(&lf); + m_bInternalFont = true; + } + + T* pT = static_cast(this); + pT->CalcSize(); + + if((m_dwExtendedStyle & PANECNT_NOCLOSEBUTTON) == 0) + pT->CreateCloseButton(); + } + void UpdateLayout(int cxWidth, int cyHeight) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); RECT rect = { 0 }; if(IsVertical()) @@ -2669,14 +2615,14 @@ class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWin rect.bottom = cyHeight; } - InvalidateRect(&rect); + this->InvalidateRect(&rect); } void CreateCloseButton() { ATLASSERT(m_tb.m_hWnd == NULL); // create toolbar for the "x" button - m_tb.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | CCS_NODIVIDER | CCS_NORESIZE | CCS_NOPARENTALIGN | CCS_NOMOVEY | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT, 0); + m_tb.Create(this->m_hWnd, this->rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | CCS_NODIVIDER | CCS_NORESIZE | CCS_NOPARENTALIGN | CCS_NOMOVEY | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT, 0); ATLASSERT(m_tb.IsWindow()); if(m_tb.m_hWnd != NULL) @@ -2689,16 +2635,16 @@ class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWin TBBUTTON tbbtn = { 0 }; tbbtn.idCommand = pT->m_nCloseBtnID; tbbtn.fsState = TBSTATE_ENABLED; - tbbtn.fsStyle = TBSTYLE_BUTTON; + tbbtn.fsStyle = BTNS_BUTTON; m_tb.AddButtons(1, &tbbtn); m_tb.SetBitmapSize(m_cxImageTB, m_cyImageTB); m_tb.SetButtonSize(m_cxImageTB + m_cxyBtnAddTB, m_cyImageTB + m_cxyBtnAddTB); if(IsVertical()) - m_tb.SetWindowPos(NULL, m_cxyBorder + m_cxyBtnOffset, m_cxyBorder + m_cxyBtnOffset, m_cxImageTB + m_cxyBtnAddTB, m_cyImageTB + m_cxyBtnAddTB, SWP_NOZORDER | SWP_NOACTIVATE); + m_tb.SetWindowPos(NULL, m_cxyBorder + m_cxyBtnOffset, m_cxyBorder + m_cxyBtnOffset, m_cxImageTB + m_cxyBtnAddTB, m_cyImageTB + m_cxyBtnAddTB + 1, SWP_NOZORDER | SWP_NOACTIVATE); else - m_tb.SetWindowPos(NULL, 0, 0, m_cxImageTB + m_cxyBtnAddTB, m_cyImageTB + m_cxyBtnAddTB, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); + m_tb.SetWindowPos(NULL, 0, 0, m_cxImageTB + m_cxyBtnAddTB, m_cyImageTB + m_cxyBtnAddTB + 1, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); } } @@ -2718,13 +2664,13 @@ class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWin font.GetLogFont(lf); if(IsVertical()) { - m_cxyHeader = m_cxImageTB + m_cxyBtnAddTB + m_cxyBorder; + m_cxyHeader = m_cxImageTB + m_cxyBtnAddTB + m_cxyBorder + 1; } else { int cyFont = abs(lf.lfHeight) + m_cxyBorder + 2 * m_cxyTextOffset; - int cyBtn = m_cyImageTB + m_cxyBtnAddTB + m_cxyBorder + 2 * m_cxyBtnOffset; - m_cxyHeader = max(cyFont, cyBtn); + int cyBtn = m_cyImageTB + m_cxyBtnAddTB + m_cxyBorder + 2 * m_cxyBtnOffset + 1; + m_cxyHeader = __max(cyFont, cyBtn); } } @@ -2733,17 +2679,15 @@ class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWin return m_hFont; } -#ifndef _WIN32_WCE BOOL GetToolTipText(LPNMHDR /*lpnmh*/) { return FALSE; } -#endif // !_WIN32_WCE void DrawPaneTitle(CDCHandle dc) { RECT rect = { 0 }; - GetClientRect(&rect); + this->GetClientRect(&rect); UINT uBorder = BF_LEFT | BF_TOP | BF_ADJUST; if(IsVertical()) @@ -2763,16 +2707,18 @@ class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWin uBorder |= BF_FLAT; dc.DrawEdge(&rect, EDGE_ETCHED, uBorder); } - dc.FillRect(&rect, COLOR_3DFACE); + + if((m_dwExtendedStyle & PANECNT_DIVIDER) != 0) + { + uBorder = BF_FLAT | BF_ADJUST | (IsVertical() ? BF_RIGHT : BF_BOTTOM); + dc.DrawEdge(&rect, BDR_SUNKENOUTER, uBorder); + } // draw title text dc.SetTextColor(::GetSysColor(COLOR_WINDOWTEXT)); dc.SetBkMode(TRANSPARENT); T* pT = static_cast(this); HFONT hFontOld = dc.SelectFont(pT->GetTitleFont()); -#ifdef _WIN32_WCE - const UINT DT_END_ELLIPSIS = 0; -#endif // _WIN32_WCE if(IsVertical()) { @@ -2803,16 +2749,33 @@ class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWin dc.SelectFont(hFontOld); } + void DrawPaneTitleBackground(CDCHandle dc) + { + RECT rect = { 0 }; + this->GetClientRect(&rect); + if(IsVertical()) + rect.right = m_cxyHeader; + else + rect.bottom = m_cxyHeader; + +#ifndef _ATL_NO_MSIMG + if((m_dwExtendedStyle & PANECNT_GRADIENT) != 0) + dc.GradientFillRect(rect, ::GetSysColor(COLOR_WINDOW), ::GetSysColor(COLOR_3DFACE), IsVertical()); + else +#endif + dc.FillRect(&rect, COLOR_3DFACE); + } + // called only if pane is empty void DrawPane(CDCHandle dc) { RECT rect = { 0 }; - GetClientRect(&rect); + this->GetClientRect(&rect); if(IsVertical()) rect.left += m_cxyHeader; else rect.top += m_cxyHeader; - if((GetExStyle() & WS_EX_CLIENTEDGE) == 0) + if((this->GetExStyle() & WS_EX_CLIENTEDGE) == 0) dc.DrawEdge(&rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST); dc.FillRect(&rect, COLOR_APPWORKSPACE); } @@ -2820,7 +2783,6 @@ class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWin // drawing helper - draws "x" button image void DrawButtonImage(CDCHandle dc, RECT& rcImage, HPEN hPen) { -#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) HPEN hPenOld = dc.SelectPen(hPen); dc.MoveTo(rcImage.left, rcImage.top); @@ -2834,11 +2796,6 @@ class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWin dc.LineTo(rcImage.right + 1, rcImage.top - 1); dc.SelectPen(hPenOld); -#else // (_WIN32_WCE < 400) - rcImage; - hPen; - // no support for the "x" button image -#endif // (_WIN32_WCE < 400) } bool IsVertical() const @@ -2945,12 +2902,10 @@ class CSortListViewImpl m_dwSortLVExtendedStyle(SORTLV_USESHELLBITMAPS), m_bUseWaitCursor(true) { -#ifndef _WIN32_WCE DWORD dwMajor = 0; DWORD dwMinor = 0; HRESULT hRet = ATL::AtlGetCommCtrlVersion(&dwMajor, &dwMinor); - m_bCommCtrl6 = SUCCEEDED(hRet) && dwMajor >= 6; -#endif // !_WIN32_WCE + m_bCommCtrl6 = SUCCEEDED(hRet) && (dwMajor >= 6); } // Attributes @@ -2960,26 +2915,20 @@ class CSortListViewImpl ATLASSERT(::IsWindow(pT->m_hWnd)); CHeaderCtrl header = pT->GetHeader(); ATLASSERT(header.m_hWnd != NULL); - ATLASSERT(iCol >= -1 && iCol < m_arrColSortType.GetSize()); + ATLASSERT((iCol >= -1) && (iCol < m_arrColSortType.GetSize())); int iOldSortCol = m_iSortColumn; m_iSortColumn = iCol; if(m_bCommCtrl6) { -#ifndef HDF_SORTUP - const int HDF_SORTUP = 0x0400; -#endif // HDF_SORTUP -#ifndef HDF_SORTDOWN - const int HDF_SORTDOWN = 0x0200; -#endif // HDF_SORTDOWN const int nMask = HDF_SORTUP | HDF_SORTDOWN; HDITEM hditem = { HDI_FORMAT }; - if(iOldSortCol != iCol && iOldSortCol >= 0 && header.GetItem(iOldSortCol, &hditem)) + if((iOldSortCol != iCol) && (iOldSortCol >= 0) && header.GetItem(iOldSortCol, &hditem)) { hditem.fmt &= ~nMask; header.SetItem(iOldSortCol, &hditem); } - if(iCol >= 0 && header.GetItem(iCol, &hditem)) + if((iCol >= 0) && header.GetItem(iCol, &hditem)) { hditem.fmt &= ~nMask; hditem.fmt |= m_bSortDescending ? HDF_SORTDOWN : HDF_SORTUP; @@ -2993,7 +2942,7 @@ class CSortListViewImpl // restore previous sort column's bitmap, if any, and format HDITEM hditem = { HDI_BITMAP | HDI_FORMAT }; - if(iOldSortCol != iCol && iOldSortCol >= 0) + if((iOldSortCol != iCol) && (iOldSortCol >= 0)) { hditem.hbm = m_hbmOldSortCol; hditem.fmt = m_fmtOldSortCol; @@ -3001,7 +2950,7 @@ class CSortListViewImpl } // save new sort column's bitmap and format, and add our sort bitmap - if(iCol >= 0 && header.GetItem(iCol, &hditem)) + if((iCol >= 0) && header.GetItem(iCol, &hditem)) { if(iOldSortCol != iCol) { @@ -3023,14 +2972,14 @@ class CSortListViewImpl void SetColumnSortType(int iCol, WORD wType) { - ATLASSERT(iCol >= 0 && iCol < m_arrColSortType.GetSize()); - ATLASSERT(wType >= LVCOLSORT_NONE && wType <= LVCOLSORT_LAST); + ATLASSERT((iCol >= 0) && (iCol < m_arrColSortType.GetSize())); + ATLASSERT((wType >= LVCOLSORT_NONE) && (wType <= LVCOLSORT_LAST)); m_arrColSortType[iCol] = wType; } WORD GetColumnSortType(int iCol) const { - ATLASSERT((iCol >= 0) && iCol < m_arrColSortType.GetSize()); + ATLASSERT((iCol >= 0) && (iCol < m_arrColSortType.GetSize())); return m_arrColSortType[iCol]; } @@ -3067,7 +3016,7 @@ class CSortListViewImpl { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); - ATLASSERT(iCol >= 0 && iCol < m_arrColSortType.GetSize()); + ATLASSERT((iCol >= 0) && (iCol < m_arrColSortType.GetSize())); WORD wType = m_arrColSortType[iCol]; if(wType == LVCOLSORT_NONE) @@ -3226,11 +3175,7 @@ class CSortListViewImpl if(!m_bmSort[i].IsNull()) m_bmSort[i].DeleteObject(); m_bmSort[i] = (HBITMAP)::LoadImage(hShell, MAKEINTRESOURCE(m_nShellSortUpID + i), -#ifndef _WIN32_WCE IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS); -#else // CE specific - IMAGE_BITMAP, 0, 0, 0); -#endif // _WIN32_WCE if(m_bmSort[i].IsNull()) { bSuccess = false; @@ -3255,7 +3200,7 @@ class CSortListViewImpl dcMem.CreateCompatibleDC(dc.m_hDC); m_bmSort[i].CreateCompatibleBitmap(dc.m_hDC, m_cxSortImage, m_cySortImage); HBITMAP hbmOld = dcMem.SelectBitmap(m_bmSort[i]); - RECT rc = {0,0,m_cxSortImage, m_cySortImage}; + RECT rc = { 0, 0, m_cxSortImage, m_cySortImage }; pT->DrawSortBitmap(dcMem.m_hDC, i, &rc); dcMem.SelectBitmap(hbmOld); dcMem.DeleteDC(); @@ -3266,7 +3211,7 @@ class CSortListViewImpl { T* pT = static_cast(this); int nID = pT->GetDlgCtrlID(); - NMSORTLISTVIEW nm = { { pT->m_hWnd, nID, SLVN_SORTCHANGED }, iNewSortCol, iOldSortCol }; + NMSORTLISTVIEW nm = { { pT->m_hWnd, (UINT_PTR)nID, SLVN_SORTCHANGED }, iNewSortCol, iOldSortCol }; ::SendMessage(pT->GetParent(), WM_NOTIFY, (WPARAM)nID, (LPARAM)&nm); } @@ -3313,7 +3258,7 @@ class CSortListViewImpl double DateStrToDouble(LPCTSTR lpstr, DWORD dwFlags) { ATLASSERT(lpstr != NULL); - if(lpstr == NULL || lpstr[0] == _T('\0')) + if((lpstr == NULL) || (lpstr[0] == _T('\0'))) return 0; USES_CONVERSION; @@ -3330,7 +3275,7 @@ class CSortListViewImpl long StrToLong(LPCTSTR lpstr) { ATLASSERT(lpstr != NULL); - if(lpstr == NULL || lpstr[0] == _T('\0')) + if((lpstr == NULL) || (lpstr[0] == _T('\0'))) return 0; USES_CONVERSION; @@ -3347,7 +3292,7 @@ class CSortListViewImpl double StrToDouble(LPCTSTR lpstr) { ATLASSERT(lpstr != NULL); - if(lpstr == NULL || lpstr[0] == _T('\0')) + if((lpstr == NULL) || (lpstr[0] == _T('\0'))) return 0; USES_CONVERSION; @@ -3365,7 +3310,7 @@ class CSortListViewImpl { ATLASSERT(lpstr != NULL); ATLASSERT(pDecimal != NULL); - if(lpstr == NULL || pDecimal == NULL) + if((lpstr == NULL) || (pDecimal == NULL)) return false; USES_CONVERSION; @@ -3384,7 +3329,7 @@ class CSortListViewImpl // Overrideable PFNLVCOMPARE functions static int CALLBACK LVCompareText(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { - ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); + ATLASSERT((lParam1 != NULL) && (lParam2 != NULL) && (lParamSort != NULL)); LVCompareParam* pParam1 = (LVCompareParam*)lParam1; LVCompareParam* pParam2 = (LVCompareParam*)lParam2; @@ -3396,7 +3341,7 @@ class CSortListViewImpl static int CALLBACK LVCompareTextNoCase(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { - ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); + ATLASSERT((lParam1 != NULL) && (lParam2 != NULL) && (lParamSort != NULL)); LVCompareParam* pParam1 = (LVCompareParam*)lParam1; LVCompareParam* pParam2 = (LVCompareParam*)lParam2; @@ -3408,7 +3353,7 @@ class CSortListViewImpl static int CALLBACK LVCompareLong(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { - ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); + ATLASSERT((lParam1 != NULL) && (lParam2 != NULL) && (lParamSort != NULL)); LVCompareParam* pParam1 = (LVCompareParam*)lParam1; LVCompareParam* pParam2 = (LVCompareParam*)lParam2; @@ -3424,7 +3369,7 @@ class CSortListViewImpl static int CALLBACK LVCompareDouble(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { - ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); + ATLASSERT((lParam1 != NULL) && (lParam2 != NULL) && (lParamSort != NULL)); LVCompareParam* pParam1 = (LVCompareParam*)lParam1; LVCompareParam* pParam2 = (LVCompareParam*)lParam2; @@ -3440,7 +3385,7 @@ class CSortListViewImpl static int CALLBACK LVCompareCustom(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { - ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); + ATLASSERT((lParam1 != NULL) && (lParam2 != NULL) && (lParamSort != NULL)); LVCompareParam* pParam1 = (LVCompareParam*)lParam1; LVCompareParam* pParam2 = (LVCompareParam*)lParam2; @@ -3450,10 +3395,9 @@ class CSortListViewImpl return pInfo->bDescending ? -nRet : nRet; } -#ifndef _WIN32_WCE static int CALLBACK LVCompareDecimal(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { - ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); + ATLASSERT((lParam1 != NULL) && (lParam2 != NULL) && (lParamSort != NULL)); LVCompareParam* pParam1 = (LVCompareParam*)lParam1; LVCompareParam* pParam2 = (LVCompareParam*)lParam2; @@ -3463,147 +3407,6 @@ class CSortListViewImpl nRet--; return pInfo->bDescending ? -nRet : nRet; } -#else - // Compare mantissas, ignore sign and scale - static int CompareMantissas(const DECIMAL& decLeft, const DECIMAL& decRight) - { - if (decLeft.Hi32 < decRight.Hi32) - { - return -1; - } - if (decLeft.Hi32 > decRight.Hi32) - { - return 1; - } - // Here, decLeft.Hi32 == decRight.Hi32 - if (decLeft.Lo64 < decRight.Lo64) - { - return -1; - } - if (decLeft.Lo64 > decRight.Lo64) - { - return 1; - } - return 0; - } - - // return values: VARCMP_LT, VARCMP_EQ, VARCMP_GT, VARCMP_NULL - static HRESULT VarDecCmp(const DECIMAL* pdecLeft, const DECIMAL* pdecRight) - { - static const ULONG powersOfTen[] = - { - 10ul, - 100ul, - 1000ul, - 10000ul, - 100000ul, - 1000000ul, - 10000000ul, - 100000000ul, - 1000000000ul - }; - static const int largestPower = sizeof(powersOfTen) / sizeof(powersOfTen[0]); - if (!pdecLeft || !pdecRight) - { - return VARCMP_NULL; - } - - // Degenerate case - at least one comparand is of the form - // [+-]0*10^N (denormalized zero) - bool bLeftZero = (!pdecLeft->Lo64 && !pdecLeft->Hi32); - bool bRightZero = (!pdecRight->Lo64 && !pdecRight->Hi32); - if (bLeftZero && bRightZero) - { - return VARCMP_EQ; - } - bool bLeftNeg = ((pdecLeft->sign & DECIMAL_NEG) != 0); - bool bRightNeg = ((pdecRight->sign & DECIMAL_NEG) != 0); - if (bLeftZero) - { - return (bRightNeg ? VARCMP_GT : VARCMP_LT); - } - // This also covers the case where the comparands have different signs - if (bRightZero || bLeftNeg != bRightNeg) - { - return (bLeftNeg ? VARCMP_LT : VARCMP_GT); - } - - // Here both comparands have the same sign and need to be compared - // on mantissa and scale. The result is obvious when - // 1. Scales are equal (then compare mantissas) - // 2. A number with smaller scale is also the one with larger mantissa - // (then this number is obviously larger) - // In the remaining case, we would multiply the number with smaller - // scale by 10 and simultaneously increment its scale (which amounts to - // adding trailing zeros after decimal point), until the numbers fall under - // one of the two cases above - DECIMAL temp; - bool bInvert = bLeftNeg; // the final result needs to be inverted - if (pdecLeft->scale < pdecRight->scale) - { - temp = *pdecLeft; - } - else - { - temp = *pdecRight; - pdecRight = pdecLeft; - bInvert = !bInvert; - } - - // Now temp is the number with smaller (or equal) scale, and - // we can modify it freely without touching original parameters - int comp; - while ((comp = CompareMantissas(temp, *pdecRight)) < 0 && - temp.scale < pdecRight->scale) - { - // Multiply by an appropriate power of 10 - int scaleDiff = pdecRight->scale - temp.scale; - if (scaleDiff > largestPower) - { - // Keep the multiplier representable in 32bit - scaleDiff = largestPower; - } - DWORDLONG power = powersOfTen[scaleDiff - 1]; - // Multiply temp's mantissa by power - DWORDLONG product = temp.Lo32 * power; - ULONG carry = static_cast(product >> 32); - temp.Lo32 = static_cast(product); - product = temp.Mid32 * power + carry; - carry = static_cast(product >> 32); - temp.Mid32 = static_cast(product); - product = temp.Hi32 * power + carry; - if (static_cast(product >> 32)) - { - // Multiplication overflowed - pdecLeft is clearly larger - break; - } - temp.Hi32 = static_cast(product); - temp.scale = (BYTE)(temp.scale + scaleDiff); - } - if (temp.scale < pdecRight->scale) - { - comp = 1; - } - if (bInvert) - { - comp = -comp; - } - return (comp > 0 ? VARCMP_GT : comp < 0 ? VARCMP_LT : VARCMP_EQ); - } - - static int CALLBACK LVCompareDecimal(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) - { - ATLASSERT(lParam1 != NULL && lParam2 != NULL && lParamSort != NULL); - - LVCompareParam* pParam1 = (LVCompareParam*)lParam1; - LVCompareParam* pParam2 = (LVCompareParam*)lParam2; - LVSortInfo* pInfo = (LVSortInfo*)lParamSort; - - int nRet = (int)VarDecCmp(&pParam1->decValue, &pParam2->decValue); - nRet--; - return pInfo->bDescending ? -nRet : nRet; - } -#endif // !_WIN32_WCE BEGIN_MSG_MAP(CSortListViewImpl) MESSAGE_HANDLER(LVM_INSERTCOLUMN, OnInsertColumn) @@ -3668,13 +3471,8 @@ class CSortListViewImpl LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { -#ifndef _WIN32_WCE if(wParam == SPI_SETNONCLIENTMETRICS) GetSystemSettings(); -#else // CE specific - wParam; // avoid level 4 warning - GetSystemSettings(); -#endif // _WIN32_WCE bHandled = FALSE; return 0; } @@ -3740,7 +3538,7 @@ typedef TBVCONTEXTMENUINFO* LPTBVCONTEXTMENUINFO; template -class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl +class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl< T, TBase, TWinTraits > { public: DECLARE_WND_CLASS_EX(NULL, 0, COLOR_APPWORKSPACE) @@ -3835,7 +3633,7 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl // Message filter function - to be called from PreTranslateMessage of the main window BOOL PreTranslateMessage(MSG* pMsg) { - if(IsWindow() == FALSE) + if(this->IsWindow() == FALSE) return FALSE; BOOL bRet = FALSE; @@ -3868,7 +3666,7 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl // If we are doing drag-drop, check for Escape key that cancels it if(bRet == FALSE) { - if(m_bTabCapture && pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE) + if(m_bTabCapture && (pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_ESCAPE)) { ::ReleaseCapture(); bRet = TRUE; @@ -3888,7 +3686,7 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl // Attributes int GetPageCount() const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); return m_tab.GetItemCount(); } @@ -3899,23 +3697,23 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl void SetActivePage(int nPage) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(IsValidPageIndex(nPage)); T* pT = static_cast(this); - SetRedraw(FALSE); + this->SetRedraw(FALSE); if(m_nActivePage != -1) - ::ShowWindow(GetPageHWND(m_nActivePage), FALSE); + ::ShowWindow(GetPageHWND(m_nActivePage), SW_HIDE); m_nActivePage = nPage; m_tab.SetCurSel(m_nActivePage); - ::ShowWindow(GetPageHWND(m_nActivePage), TRUE); + ::ShowWindow(GetPageHWND(m_nActivePage), SW_SHOW); pT->UpdateLayout(); - SetRedraw(TRUE); - RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); + this->SetRedraw(TRUE); + this->RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); if(::GetFocus() != m_tab.m_hWnd) ::SetFocus(GetPageHWND(m_nActivePage)); @@ -3926,19 +3724,19 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl HIMAGELIST GetImageList() const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); return m_tab.GetImageList(); } HIMAGELIST SetImageList(HIMAGELIST hImageList) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); return m_tab.SetImageList(hImageList); } void SetWindowMenu(HMENU hMenu) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); m_menu = hMenu; @@ -3948,7 +3746,7 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl void SetTitleBarWindow(HWND hWnd) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); delete [] m_lpstrTitleBarBase; m_lpstrTitleBarBase = NULL; @@ -3970,7 +3768,7 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl // Page attributes HWND GetPageHWND(int nPage) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(IsValidPageIndex(nPage)); TCITEMEXTRA tcix = { 0 }; @@ -3982,7 +3780,7 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl LPCTSTR GetPageTitle(int nPage) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(IsValidPageIndex(nPage)); TCITEMEXTRA tcix = { 0 }; @@ -3995,7 +3793,7 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl bool SetPageTitle(int nPage, LPCTSTR lpstrTitle) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(IsValidPageIndex(nPage)); T* pT = static_cast(this); @@ -4006,13 +3804,13 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl if(lpstrBuff == NULL) return false; - SecureHelper::strcpy_x(lpstrBuff, cchBuff, lpstrTitle); + ATL::Checked::tcscpy_s(lpstrBuff, cchBuff, lpstrTitle); TCITEMEXTRA tcix = { 0 }; tcix.tciheader.mask = TCIF_PARAM; if(m_tab.GetItem(nPage, tcix) == FALSE) return false; - CTempBuffer buff; + ATL::CTempBuffer buff; LPTSTR lpstrTabText = buff.Allocate(m_cchTabTextLength + 1); if(lpstrTabText == NULL) return false; @@ -4035,7 +3833,7 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl LPVOID GetPageData(int nPage) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(IsValidPageIndex(nPage)); TCITEMEXTRA tcix = { 0 }; @@ -4047,7 +3845,7 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl LPVOID SetPageData(int nPage, LPVOID pData) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(IsValidPageIndex(nPage)); TCITEMEXTRA tcix = { 0 }; @@ -4063,7 +3861,7 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl int GetPageImage(int nPage) const { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(IsValidPageIndex(nPage)); TCITEMEXTRA tcix = { 0 }; @@ -4075,7 +3873,7 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl int SetPageImage(int nPage, int nImage) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(IsValidPageIndex(nPage)); TCITEMEXTRA tcix = { 0 }; @@ -4097,8 +3895,8 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl bool InsertPage(int nPage, HWND hWndView, LPCTSTR lpstrTitle, int nImage = -1, LPVOID pData = NULL) { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(nPage == GetPageCount() || IsValidPageIndex(nPage)); + ATLASSERT(::IsWindow(this->m_hWnd)); + ATLASSERT((nPage == GetPageCount()) || IsValidPageIndex(nPage)); T* pT = static_cast(this); @@ -4108,16 +3906,16 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl if(lpstrBuff == NULL) return false; - SecureHelper::strcpy_x(lpstrBuff, cchBuff, lpstrTitle); + ATL::Checked::tcscpy_s(lpstrBuff, cchBuff, lpstrTitle); - CTempBuffer buff; + ATL::CTempBuffer buff; LPTSTR lpstrTabText = buff.Allocate(m_cchTabTextLength + 1); if(lpstrTabText == NULL) return false; pT->ShortenTitle(lpstrTitle, lpstrTabText, m_cchTabTextLength + 1); - SetRedraw(FALSE); + this->SetRedraw(FALSE); TCITEMEXTRA tcix = { 0 }; tcix.tciheader.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM; @@ -4130,10 +3928,14 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl if(nItem == -1) { delete [] lpstrBuff; - SetRedraw(TRUE); + this->SetRedraw(TRUE); return false; } + // adjust active page index, if inserted before it + if(nPage <= m_nActivePage) + m_nActivePage++; + SetActivePage(nItem); pT->OnPageActivated(m_nActivePage); @@ -4142,20 +3944,20 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl pT->UpdateLayout(); - SetRedraw(TRUE); - RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); + this->SetRedraw(TRUE); + this->RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); return true; } void RemovePage(int nPage) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(IsValidPageIndex(nPage)); T* pT = static_cast(this); - SetRedraw(FALSE); + this->SetRedraw(FALSE); if(GetPageCount() == 1) pT->ShowTabControl(false); @@ -4163,7 +3965,7 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl if(m_bDestroyPageOnRemove) ::DestroyWindow(GetPageHWND(nPage)); else - ::ShowWindow(GetPageHWND(nPage), FALSE); + ::ShowWindow(GetPageHWND(nPage), SW_HIDE); LPTSTR lpstrTitle = (LPTSTR)GetPageTitle(nPage); delete [] lpstrTitle; @@ -4183,9 +3985,9 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl } else { - SetRedraw(TRUE); - Invalidate(); - UpdateWindow(); + this->SetRedraw(TRUE); + this->Invalidate(); + this->UpdateWindow(); pT->UpdateTitleBar(); pT->UpdateMenu(); } @@ -4202,14 +4004,14 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl void RemoveAllPages() { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); if(GetPageCount() == 0) return; T* pT = static_cast(this); - SetRedraw(FALSE); + this->SetRedraw(FALSE); pT->ShowTabControl(false); @@ -4218,7 +4020,7 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl if(m_bDestroyPageOnRemove) ::DestroyWindow(GetPageHWND(i)); else - ::ShowWindow(GetPageHWND(i), FALSE); + ::ShowWindow(GetPageHWND(i), SW_HIDE); LPTSTR lpstrTitle = (LPTSTR)GetPageTitle(i); delete [] lpstrTitle; } @@ -4227,9 +4029,9 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl m_nActivePage = -1; pT->OnPageActivated(m_nActivePage); - SetRedraw(TRUE); - Invalidate(); - UpdateWindow(); + this->SetRedraw(TRUE); + this->Invalidate(); + this->UpdateWindow(); pT->UpdateTitleBar(); pT->UpdateMenu(); @@ -4253,7 +4055,7 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl void BuildWindowMenu(HMENU hMenu, int nMenuItemsCount = 10, bool bEmptyMenuItem = true, bool bWindowsMenuItem = true, bool bActivePageMenuItem = true, bool bActiveAsDefaultMenuItem = false) { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); CMenuHandle menu = hMenu; T* pT = static_cast(this); @@ -4261,25 +4063,12 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl int nFirstPos = 0; // Find first menu item in our range -#ifndef _WIN32_WCE for(nFirstPos = 0; nFirstPos < menu.GetMenuItemCount(); nFirstPos++) { UINT nID = menu.GetMenuItemID(nFirstPos); - if((nID >= ID_WINDOW_TABFIRST && nID <= ID_WINDOW_TABLAST) || nID == ID_WINDOW_SHOWTABLIST) + if(((nID >= ID_WINDOW_TABFIRST) && (nID <= ID_WINDOW_TABLAST)) || (nID == ID_WINDOW_SHOWTABLIST)) break; } -#else // CE specific - for(nFirstPos = 0; ; nFirstPos++) - { - CMenuItemInfo mii; - mii.fMask = MIIM_ID; - BOOL bRet = menu.GetMenuItemInfo(nFirstPos, TRUE, &mii); - if(bRet == FALSE) - break; - if((mii.wID >= ID_WINDOW_TABFIRST && mii.wID <= ID_WINDOW_TABLAST) || mii.wID == ID_WINDOW_SHOWTABLIST) - break; - } -#endif // _WIN32_WCE // Remove all menu items for tab pages BOOL bRet = TRUE; @@ -4305,7 +4094,7 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl { // Append menu items for all pages const int cchPrefix = 3; // 2 digits + space - nMenuItemsCount = min(min(nPageCount, nMenuItemsCount), (int)m_nMenuItemsMax); + nMenuItemsCount = __min(__min(nPageCount, nMenuItemsCount), (int)m_nMenuItemsMax); ATLASSERT(nMenuItemsCount < 100); // 2 digits only if(nMenuItemsCount >= 100) nMenuItemsCount = 99; @@ -4314,13 +4103,13 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl { LPCTSTR lpstrTitle = GetPageTitle(i); int nLen = lstrlen(lpstrTitle); - CTempBuffer buff; + ATL::CTempBuffer buff; LPTSTR lpstrText = buff.Allocate(cchPrefix + nLen + 1); ATLASSERT(lpstrText != NULL); if(lpstrText != NULL) { LPCTSTR lpstrFormat = (i < 9) ? _T("&%i %s") : _T("%i %s"); - SecureHelper::wsprintf_x(lpstrText, cchPrefix + nLen + 1, lpstrFormat, i + 1, lpstrTitle); + _stprintf_s(lpstrText, cchPrefix + nLen + 1, lpstrFormat, i + 1, lpstrTitle); menu.AppendMenu(MF_STRING, ID_WINDOW_TABFIRST + i, lpstrText); } } @@ -4328,16 +4117,12 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl // Mark active page if(bActivePageMenuItem && (m_nActivePage != -1)) { -#ifndef _WIN32_WCE if(bActiveAsDefaultMenuItem) { menu.SetMenuDefaultItem((UINT)-1, TRUE); menu.SetMenuDefaultItem(nFirstPos + m_nActivePage, TRUE); } else -#else // CE specific - bActiveAsDefaultMenuItem; // avoid level 4 warning -#endif // _WIN32_WCE { menu.CheckMenuRadioItem(nFirstPos, nFirstPos + nMenuItemsCount, nFirstPos + m_nActivePage, MF_BYPOSITION); } @@ -4367,6 +4152,19 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl menu.AppendMenu(MF_BYPOSITION | MF_STRING, ID_WINDOW_SHOWTABLIST, pT->GetWindowsMenuItemText()); } + BOOL SubclassWindow(HWND hWnd) + { + BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits >::SubclassWindow(hWnd); + if(bRet != FALSE) + { + T* pT = static_cast(this); + pT->CreateTabControl(); + pT->UpdateLayout(); + } + + return bRet; + } + // Message map and handlers BEGIN_MSG_MAP(CTabViewImpl) MESSAGE_HANDLER(WM_CREATE, OnCreate) @@ -4377,9 +4175,7 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl MESSAGE_HANDLER(WM_SETFONT, OnSetFont) NOTIFY_HANDLER(m_nTabID, TCN_SELCHANGE, OnTabChanged) NOTIFY_ID_HANDLER(m_nTabID, OnTabNotification) -#ifndef _WIN32_WCE NOTIFY_CODE_HANDLER(TTN_GETDISPINFO, OnTabGetDispInfo) -#endif // !_WIN32_WCE FORWARD_NOTIFICATIONS() ALT_MSG_MAP(1) // tab control MESSAGE_HANDLER(WM_LBUTTONDOWN, OnTabLButtonDown) @@ -4476,7 +4272,6 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl return 0; } -#ifndef _WIN32_WCE LRESULT OnTabGetDispInfo(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) { LPNMTTDISPINFO pTTDI = (LPNMTTDISPINFO)pnmh; @@ -4492,7 +4287,6 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl return 0; } -#endif // !_WIN32_WCE // Tab control message handlers LRESULT OnTabLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) @@ -4543,9 +4337,7 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl T* pT = static_cast(this); pT->DrawMoveMark(-1); -#ifndef _WIN32_WCE m_ilDrag.DragLeave(GetDesktopWindow()); -#endif // !_WIN32_WCE m_ilDrag.EndDrag(); m_ilDrag.Destroy(); @@ -4567,13 +4359,8 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl if(!m_bTabDrag) { -#ifndef _WIN32_WCE - if(abs(m_ptStartDrag.x - GET_X_LPARAM(lParam)) >= ::GetSystemMetrics(SM_CXDRAG) || - abs(m_ptStartDrag.y - GET_Y_LPARAM(lParam)) >= ::GetSystemMetrics(SM_CYDRAG)) -#else // CE specific - if(abs(m_ptStartDrag.x - GET_X_LPARAM(lParam)) >= 4 || - abs(m_ptStartDrag.y - GET_Y_LPARAM(lParam)) >= 4) -#endif // _WIN32_WCE + if((abs(m_ptStartDrag.x - GET_X_LPARAM(lParam)) >= ::GetSystemMetrics(SM_CXDRAG)) || + (abs(m_ptStartDrag.y - GET_Y_LPARAM(lParam)) >= ::GetSystemMetrics(SM_CYDRAG))) { T* pT = static_cast(this); pT->GenerateDragImage(m_nActivePage); @@ -4581,11 +4368,9 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl int cxCursor = ::GetSystemMetrics(SM_CXCURSOR); int cyCursor = ::GetSystemMetrics(SM_CYCURSOR); m_ilDrag.BeginDrag(0, -(cxCursor / 2), -(cyCursor / 2)); -#ifndef _WIN32_WCE POINT ptEnter = m_ptStartDrag; m_tab.ClientToScreen(&ptEnter); m_ilDrag.DragEnter(GetDesktopWindow(), ptEnter); -#endif // !_WIN32_WCE m_bTabDrag = true; } @@ -4632,7 +4417,7 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl LRESULT OnTabSysKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { bool bShift = (::GetKeyState(VK_SHIFT) < 0); - if(wParam == VK_F10 && bShift) + if((wParam == VK_F10) && bShift) { if(m_nActivePage != -1) { @@ -4654,7 +4439,7 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl // Implementation helpers bool IsValidPageIndex(int nPage) const { - return (nPage >= 0 && nPage < GetPageCount()); + return ((nPage >= 0) && (nPage < GetPageCount())); } bool MovePage(int nMovePage, int nInsertBeforePage) @@ -4668,7 +4453,7 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl if(nMovePage == nInsertBeforePage) return true; // nothing to do - CTempBuffer buff; + ATL::CTempBuffer buff; LPTSTR lpstrTabText = buff.Allocate(m_cchTabTextLength + 1); if(lpstrTabText == NULL) return false; @@ -4705,11 +4490,7 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl // Implementation overrideables bool CreateTabControl() { -#ifndef _WIN32_WCE - m_tab.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TCS_TOOLTIPS, 0, m_nTabID); -#else // CE specific - m_tab.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0, m_nTabID); -#endif // _WIN32_WCE + m_tab.Create(this->m_hWnd, this->rcDefault, NULL, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TCS_TOOLTIPS, 0, m_nTabID); ATLASSERT(m_tab.m_hWnd != NULL); if(m_tab.m_hWnd == NULL) return false; @@ -4728,9 +4509,10 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl int CalcTabHeight() { int nCount = m_tab.GetItemCount(); + TCHAR szText[] = _T("NS"); TCITEMEXTRA tcix = { 0 }; tcix.tciheader.mask = TCIF_TEXT; - tcix.tciheader.pszText = _T("NS"); + tcix.tciheader.pszText = szText; int nIndex = m_tab.InsertItem(nCount, tcix); RECT rect = { 0, 0, 1000, 1000 }; @@ -4749,18 +4531,24 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl void ShowTabControl(bool bShow) { m_tab.ShowWindow(bShow ? SW_SHOWNOACTIVATE : SW_HIDE); + T* pT = static_cast(this); + pT->UpdateLayout(); } void UpdateLayout() { - RECT rect; - GetClientRect(&rect); + RECT rect = { 0 }; + this->GetClientRect(&rect); + int cyOffset = 0; if(m_tab.IsWindow() && ((m_tab.GetStyle() & WS_VISIBLE) != 0)) + { m_tab.SetWindowPos(NULL, 0, 0, rect.right - rect.left, m_cyTabHeight, SWP_NOZORDER); + cyOffset = m_cyTabHeight; + } if(m_nActivePage != -1) - ::SetWindowPos(GetPageHWND(m_nActivePage), NULL, 0, m_cyTabHeight, rect.right - rect.left, rect.bottom - rect.top - m_cyTabHeight, SWP_NOZORDER); + ::SetWindowPos(GetPageHWND(m_nActivePage), NULL, 0, cyOffset, rect.right - rect.left, rect.bottom - rect.top - cyOffset, SWP_NOZORDER); } void UpdateMenu() @@ -4771,7 +4559,7 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl void UpdateTitleBar() { - if(!m_wndTitleBar.IsWindow() || m_lpstrTitleBarBase == NULL) + if(!m_wndTitleBar.IsWindow() || (m_lpstrTitleBarBase == NULL)) return; // nothing to do if(m_nActivePage != -1) @@ -4780,14 +4568,14 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl LPCTSTR lpstrTitle = pT->GetPageTitle(m_nActivePage); LPCTSTR lpstrDivider = pT->GetTitleDividerText(); int cchBuffer = m_cchTitleBarLength + lstrlen(lpstrDivider) + lstrlen(m_lpstrTitleBarBase) + 1; - CTempBuffer buff; + ATL::CTempBuffer buff; LPTSTR lpstrPageTitle = buff.Allocate(cchBuffer); ATLASSERT(lpstrPageTitle != NULL); if(lpstrPageTitle != NULL) { pT->ShortenTitle(lpstrTitle, lpstrPageTitle, m_cchTitleBarLength + 1); - SecureHelper::strcat_x(lpstrPageTitle, cchBuffer, lpstrDivider); - SecureHelper::strcat_x(lpstrPageTitle, cchBuffer, m_lpstrTitleBarBase); + ATL::Checked::tcscat_s(lpstrPageTitle, cchBuffer, lpstrDivider); + ATL::Checked::tcscat_s(lpstrPageTitle, cchBuffer, m_lpstrTitleBarBase); } else { @@ -4872,19 +4660,14 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl { ATLASSERT(IsValidPageIndex(nItem)); -#ifndef _WIN32_WCE RECT rcItem = { 0 }; m_tab.GetItemRect(nItem, &rcItem); ::InflateRect(&rcItem, 2, 2); // make bigger to cover selected item -#else // CE specific - nItem; // avoid level 4 warning - RECT rcItem = { 0, 0, 40, 20 }; -#endif // _WIN32_WCE ATLASSERT(m_ilDrag.m_hImageList == NULL); m_ilDrag.Create(rcItem.right - rcItem.left, rcItem.bottom - rcItem.top, ILC_COLORDDB | ILC_MASK, 1, 1); - CClientDC dc(m_hWnd); + CClientDC dc(this->m_hWnd); CDC dcMem; dcMem.CreateCompatibleDC(dc); ATLASSERT(dcMem.m_hDC != NULL); @@ -4895,11 +4678,7 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl ATLASSERT(bmp.m_hBitmap != NULL); HBITMAP hBmpOld = dcMem.SelectBitmap(bmp); -#ifndef _WIN32_WCE m_tab.SendMessage(WM_PRINTCLIENT, (WPARAM)dcMem.m_hDC); -#else // CE specific - dcMem.Rectangle(&rcItem); -#endif // _WIN32_WCE dcMem.SelectBitmap(hBmpOld); ATLVERIFY(m_ilDrag.Add(bmp.m_hBitmap, RGB(255, 0, 255)) != -1); @@ -4911,22 +4690,20 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl { LPCTSTR lpstrEllipsis = _T("..."); int cchEllipsis = lstrlen(lpstrEllipsis); - SecureHelper::strncpy_x(lpstrShortTitle, cchShortTitle, lpstrTitle, cchShortTitle - cchEllipsis - 1); - SecureHelper::strcat_x(lpstrShortTitle, cchShortTitle, lpstrEllipsis); + ATL::Checked::tcsncpy_s(lpstrShortTitle, cchShortTitle, lpstrTitle, cchShortTitle - cchEllipsis - 1); + ATL::Checked::tcscat_s(lpstrShortTitle, cchShortTitle, lpstrEllipsis); } else { - SecureHelper::strcpy_x(lpstrShortTitle, cchShortTitle, lpstrTitle); + ATL::Checked::tcscpy_s(lpstrShortTitle, cchShortTitle, lpstrTitle); } } -#ifndef _WIN32_WCE void UpdateTooltipText(LPNMTTDISPINFO pTTDI) { ATLASSERT(pTTDI != NULL); pTTDI->lpszText = (LPTSTR)GetPageTitle((int)pTTDI->hdr.idFrom); } -#endif // !_WIN32_WCE // Text for menu items and title bar - override to provide different strings static LPCTSTR GetEmptyListText() @@ -4948,10 +4725,10 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl void OnPageActivated(int nPage) { NMHDR nmhdr = { 0 }; - nmhdr.hwndFrom = m_hWnd; + nmhdr.hwndFrom = this->m_hWnd; nmhdr.idFrom = nPage; nmhdr.code = TBVN_PAGEACTIVATED; - ::SendMessage(GetParent(), WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&nmhdr); + this->GetParent().SendMessage(WM_NOTIFY, this->GetDlgCtrlID(), (LPARAM)&nmhdr); } void OnContextMenu(int nPage, POINT pt) @@ -4959,11 +4736,11 @@ class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl m_tab.ClientToScreen(&pt); TBVCONTEXTMENUINFO cmi = { 0 }; - cmi.hdr.hwndFrom = m_hWnd; + cmi.hdr.hwndFrom = this->m_hWnd; cmi.hdr.idFrom = nPage; cmi.hdr.code = TBVN_CONTEXTMENU; cmi.pt = pt; - ::SendMessage(GetParent(), WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&cmi); + this->GetParent().SendMessage(WM_NOTIFY, this->GetDlgCtrlID(), (LPARAM)&cmi); } }; diff --git a/thirdparty/wtl/atlddx.h b/thirdparty/wtl/atlddx.h index 2d54ca5..ea36ae5 100644 --- a/thirdparty/wtl/atlddx.h +++ b/thirdparty/wtl/atlddx.h @@ -1,13 +1,10 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. +// Windows Template Library - WTL version 10.0 +// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. +// Microsoft Public License (http://opensource.org/licenses/MS-PL) +// which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLDDX_H__ #define __ATLDDX_H__ @@ -18,13 +15,7 @@ #error atlddx.h requires atlapp.h to be included first #endif -#if defined(_ATL_USE_DDX_FLOAT) && defined(_ATL_MIN_CRT) - #error Cannot use floating point DDX with _ATL_MIN_CRT defined -#endif // defined(_ATL_USE_DDX_FLOAT) && defined(_ATL_MIN_CRT) - -#ifdef _ATL_USE_DDX_FLOAT - #include -#endif // _ATL_USE_DDX_FLOAT +#include /////////////////////////////////////////////////////////////////////////////// @@ -44,94 +35,92 @@ namespace WTL #define BEGIN_DDX_MAP(thisClass) \ BOOL DoDataExchange(BOOL bSaveAndValidate = FALSE, UINT nCtlID = (UINT)-1) \ { \ - bSaveAndValidate; \ - nCtlID; + (bSaveAndValidate); \ + (nCtlID); #define DDX_TEXT(nID, var) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ + if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ { \ if(!DDX_Text(nID, var, sizeof(var), bSaveAndValidate)) \ return FALSE; \ } #define DDX_TEXT_LEN(nID, var, len) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ + if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ { \ if(!DDX_Text(nID, var, sizeof(var), bSaveAndValidate, TRUE, len)) \ return FALSE; \ } #define DDX_INT(nID, var) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ + if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ { \ if(!DDX_Int(nID, var, TRUE, bSaveAndValidate)) \ return FALSE; \ } #define DDX_INT_RANGE(nID, var, min, max) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ + if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ { \ if(!DDX_Int(nID, var, TRUE, bSaveAndValidate, TRUE, min, max)) \ return FALSE; \ } #define DDX_UINT(nID, var) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ + if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ { \ if(!DDX_Int(nID, var, FALSE, bSaveAndValidate)) \ return FALSE; \ } #define DDX_UINT_RANGE(nID, var, min, max) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ + if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ { \ if(!DDX_Int(nID, var, FALSE, bSaveAndValidate, TRUE, min, max)) \ return FALSE; \ } -#ifdef _ATL_USE_DDX_FLOAT #define DDX_FLOAT(nID, var) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ + if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ { \ if(!DDX_Float(nID, var, bSaveAndValidate)) \ return FALSE; \ } #define DDX_FLOAT_RANGE(nID, var, min, max) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ + if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ { \ if(!DDX_Float(nID, var, bSaveAndValidate, TRUE, min, max)) \ return FALSE; \ } #define DDX_FLOAT_P(nID, var, precision) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ + if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ { \ if(!DDX_Float(nID, var, bSaveAndValidate, FALSE, 0, 0, precision)) \ return FALSE; \ } #define DDX_FLOAT_P_RANGE(nID, var, min, max, precision) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ + if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ { \ if(!DDX_Float(nID, var, bSaveAndValidate, TRUE, min, max, precision)) \ return FALSE; \ } -#endif // _ATL_USE_DDX_FLOAT #define DDX_CONTROL(nID, obj) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ + if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ DDX_Control(nID, obj, bSaveAndValidate); #define DDX_CONTROL_HANDLE(nID, obj) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ + if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ DDX_Control_Handle(nID, obj, bSaveAndValidate); #define DDX_CHECK(nID, var) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ + if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ DDX_Check(nID, var, bSaveAndValidate); #define DDX_RADIO(nID, var) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ + if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ DDX_Radio(nID, var, bSaveAndValidate); #define END_DDX_MAP() \ @@ -140,10 +129,9 @@ namespace WTL // DDX support for Tab, Combo, ListBox and ListView selection index // Note: Specialized versions require atlctrls.h to be included first -#if (_MSC_VER >= 1300) #define DDX_INDEX(CtrlClass, nID, var) \ - if(nCtlID == (UINT)-1 || nCtlID == nID) \ + if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ DDX_Index(nID, var, bSaveAndValidate); #ifdef __ATLCTRLS_H__ @@ -153,8 +141,6 @@ namespace WTL #define DDX_LISTVIEW_INDEX(nID, var) DDX_INDEX(WTL::CListViewCtrl, nID, var) #endif // __ATLCTRLS_H__ -#endif // (_MSC_VER >= 1300) - /////////////////////////////////////////////////////////////////////////////// // CWinDataExchange - provides support for DDX @@ -228,7 +214,7 @@ class CWinDataExchange } else { - ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength); + ATLASSERT(!bValidate || (lstrlen(lpstrText) <= nLength)); bSuccess = pT->SetDlgItemText(nID, lpstrText); } @@ -264,7 +250,7 @@ class CWinDataExchange { USES_CONVERSION; LPTSTR lpstrText = OLE2T(bstrText); - ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength); + ATLASSERT(!bValidate || (lstrlen(lpstrText) <= nLength)); bSuccess = pT->SetDlgItemText(nID, lpstrText); } @@ -300,7 +286,7 @@ class CWinDataExchange { USES_CONVERSION; LPTSTR lpstrText = OLE2T(bstrText); - ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength); + ATLASSERT(!bValidate || (lstrlen(lpstrText) <= nLength)); bSuccess = pT->SetDlgItemText(nID, lpstrText); } @@ -323,8 +309,8 @@ class CWinDataExchange return bSuccess; } -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - BOOL DDX_Text(UINT nID, _CSTRING_NS::CString& strText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0) +#ifdef __ATLSTR_H__ + BOOL DDX_Text(UINT nID, ATL::CString& strText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0) { T* pT = static_cast(this); BOOL bSuccess = TRUE; @@ -366,7 +352,7 @@ class CWinDataExchange } return bSuccess; } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) +#endif // __ATLSTR_H__ // Numeric exchange template @@ -381,7 +367,7 @@ class CWinDataExchange } else { - ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax); + ATLASSERT(!bValidate || ((nVal >= nMin) && (nVal <= nMax))); bSuccess = pT->SetDlgItemInt(nID, nVal, bSigned); } @@ -392,7 +378,7 @@ class CWinDataExchange else if(bSave && bValidate) // validation { ATLASSERT(nMin != nMax); - if(nVal < nMin || nVal > nMax) + if((nVal < nMin) || (nVal > nMax)) { _XData data = { ddxDataInt }; data.intData.nVal = (long)nVal; @@ -406,18 +392,17 @@ class CWinDataExchange } // Float exchange -#ifdef _ATL_USE_DDX_FLOAT static BOOL _AtlSimpleFloatParse(LPCTSTR lpszText, double& d) { ATLASSERT(lpszText != NULL); - while (*lpszText == _T(' ') || *lpszText == _T('\t')) + while ((*lpszText == _T(' ')) || (*lpszText == _T('\t'))) lpszText++; TCHAR chFirst = lpszText[0]; d = _tcstod(lpszText, (LPTSTR*)&lpszText); - if (d == 0.0 && chFirst != _T('0')) + if ((d == 0.0) && (chFirst != _T('0'))) return FALSE; // could not convert - while (*lpszText == _T(' ') || *lpszText == _T('\t')) + while ((*lpszText == _T(' ')) || (*lpszText == _T('\t'))) lpszText++; if (*lpszText != _T('\0')) @@ -444,8 +429,8 @@ class CWinDataExchange } else { - ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax); - SecureHelper::sprintf_x(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal); + ATLASSERT(!bValidate || ((nVal >= nMin) && (nVal <= nMax))); + _stprintf_s(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal); bSuccess = pT->SetDlgItemText(nID, szBuff); } @@ -456,7 +441,7 @@ class CWinDataExchange else if(bSave && bValidate) // validation { ATLASSERT(nMin != nMax); - if(nVal < nMin || nVal > nMax) + if((nVal < nMin) || (nVal > nMax)) { _XData data = { ddxDataFloat }; data.floatData.nVal = (double)nVal; @@ -487,8 +472,8 @@ class CWinDataExchange } else { - ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax); - SecureHelper::sprintf_x(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal); + ATLASSERT(!bValidate || ((nVal >= nMin) && (nVal <= nMax))); + _stprintf_s(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal); bSuccess = pT->SetDlgItemText(nID, szBuff); } @@ -499,7 +484,7 @@ class CWinDataExchange else if(bSave && bValidate) // validation { ATLASSERT(nMin != nMax); - if(nVal < nMin || nVal > nMax) + if((nVal < nMin) || (nVal > nMax)) { _XData data = { ddxDataFloat }; data.floatData.nVal = nVal; @@ -511,13 +496,12 @@ class CWinDataExchange } return bSuccess; } -#endif // _ATL_USE_DDX_FLOAT // Full control subclassing (for CWindowImpl derived controls) template void DDX_Control(UINT nID, TControl& ctrl, BOOL bSave) { - if(!bSave && ctrl.m_hWnd == NULL) + if(!bSave && (ctrl.m_hWnd == NULL)) { T* pT = static_cast(this); ctrl.SubclassWindow(pT->GetDlgItem(nID)); @@ -528,7 +512,7 @@ class CWinDataExchange template void DDX_Control_Handle(UINT nID, TControl& ctrl, BOOL bSave) { - if(!bSave && ctrl.m_hWnd == NULL) + if(!bSave && (ctrl.m_hWnd == NULL)) { T* pT = static_cast(this); ctrl = pT->GetDlgItem(nID); @@ -543,11 +527,11 @@ class CWinDataExchange if(bSave) { nValue = (int)::SendMessage(hWndCtrl, BM_GETCHECK, 0, 0L); - ATLASSERT(nValue >= 0 && nValue <= 2); + ATLASSERT((nValue >= 0) && (nValue <= 2)); } else { - if(nValue < 0 || nValue > 2) + if((nValue < 0) || (nValue > 2)) { ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - dialog data checkbox value (%d) out of range.\n"), nValue); nValue = 0; // default to off @@ -611,11 +595,10 @@ class CWinDataExchange } hWndCtrl = ::GetWindow(hWndCtrl, GW_HWNDNEXT); } - while (hWndCtrl != NULL && !(GetWindowLong(hWndCtrl, GWL_STYLE) & WS_GROUP)); + while ((hWndCtrl != NULL) && !(GetWindowLong(hWndCtrl, GWL_STYLE) & WS_GROUP)); } // DDX support for Tab, Combo, ListBox and ListView selection index -#if (_MSC_VER >= 1300) template INT _getSel(TCtrl& tCtrl) { @@ -660,7 +643,6 @@ class CWinDataExchange else _setSel(ctrl, nVal); } -#endif // (_MSC_VER >= 1300) // Overrideables void OnDataExchangeError(UINT nCtrlID, BOOL /*bSave*/) diff --git a/thirdparty/wtl/atldlgs.h b/thirdparty/wtl/atldlgs.h index d73cad7..a3a98d4 100644 --- a/thirdparty/wtl/atldlgs.h +++ b/thirdparty/wtl/atldlgs.h @@ -1,13 +1,10 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. +// Windows Template Library - WTL version 10.0 +// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. +// Microsoft Public License (http://opensource.org/licenses/MS-PL) +// which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLDLGS_H__ #define __ATLDLGS_H__ @@ -25,9 +22,9 @@ #include #include -#if (_WIN32_WINNT >= 0x0600) && !defined(_WIN32_WCE) +#if (_WIN32_WINNT >= 0x0600) #include -#endif // (_WIN32_WINNT >= 0x0600) && !defined(_WIN32_WCE) +#endif // (_WIN32_WINNT >= 0x0600) /////////////////////////////////////////////////////////////////////////////// @@ -35,7 +32,7 @@ // // CFileDialogImpl // CFileDialog -// CFileDialogEx +// CSimpleFileDialog // CMultiFileDialogImpl // CMultiFileDialog // CShellFileDialogImpl @@ -104,33 +101,11 @@ namespace WTL /////////////////////////////////////////////////////////////////////////////// // CFileDialogImpl - used for File Open or File Save As -// compatibility with the old (vc6.0) headers -#if (_WIN32_WINNT >= 0x0500) && !defined(OPENFILENAME_SIZE_VERSION_400) - #ifndef CDSIZEOF_STRUCT - #define CDSIZEOF_STRUCT(structname, member) (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0)))) + sizeof(((structname*)0)->member)) - #endif - #define OPENFILENAME_SIZE_VERSION_400A CDSIZEOF_STRUCT(OPENFILENAMEA,lpTemplateName) - #define OPENFILENAME_SIZE_VERSION_400W CDSIZEOF_STRUCT(OPENFILENAMEW,lpTemplateName) - #ifdef UNICODE - #define OPENFILENAME_SIZE_VERSION_400 OPENFILENAME_SIZE_VERSION_400W - #else - #define OPENFILENAME_SIZE_VERSION_400 OPENFILENAME_SIZE_VERSION_400A - #endif // !UNICODE -#endif // (_WIN32_WINNT >= 0x0500) && !defined(OPENFILENAME_SIZE_VERSION_400) - -#if !defined(_WIN32_WCE) && !defined(CDN_INCLUDEITEM) - #define CDN_INCLUDEITEM (CDN_FIRST - 0x0007) -#endif - template class ATL_NO_VTABLE CFileDialogImpl : public ATL::CDialogImplBase { public: -#if defined(__AYGSHELL_H__) && (_WIN32_WCE >= 0x0501) - OPENFILENAMEEX m_ofn; -#else OPENFILENAME m_ofn; -#endif BOOL m_bOpenFileDialog; // TRUE for file open, FALSE for file save TCHAR m_szFileTitle[_MAX_FNAME]; // contains file title after return TCHAR m_szFileName[_MAX_PATH]; // contains full path name after return @@ -140,46 +115,27 @@ class ATL_NO_VTABLE CFileDialogImpl : public ATL::CDialogImplBase LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL, - HWND hWndParent = NULL) + HWND hWndParent = NULL) : m_bOpenFileDialog(bOpenFileDialog) { memset(&m_ofn, 0, sizeof(m_ofn)); // initialize structure to 0/NULL - m_szFileName[0] = _T('\0'); - m_szFileTitle[0] = _T('\0'); - - m_bOpenFileDialog = bOpenFileDialog; - -#if defined(__AYGSHELL_H__) && (_WIN32_WCE >= 0x0501) - m_ofn.lStructSize = bOpenFileDialog ? sizeof(m_ofn) : sizeof(OPENFILENAME); -#else m_ofn.lStructSize = sizeof(m_ofn); -#endif - -#if (_WIN32_WINNT >= 0x0500) - // adjust struct size if running on older version of Windows - if(AtlIsOldWindows()) - { - ATLASSERT(sizeof(m_ofn) > OPENFILENAME_SIZE_VERSION_400); // must be - m_ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; - } -#endif // (_WIN32_WINNT >= 0x0500) m_ofn.lpstrFile = m_szFileName; m_ofn.nMaxFile = _MAX_PATH; m_ofn.lpstrDefExt = lpszDefExt; m_ofn.lpstrFileTitle = (LPTSTR)m_szFileTitle; m_ofn.nMaxFileTitle = _MAX_FNAME; -#ifndef _WIN32_WCE m_ofn.Flags = dwFlags | OFN_EXPLORER | OFN_ENABLEHOOK | OFN_ENABLESIZING; -#else // CE specific - m_ofn.Flags = dwFlags | OFN_EXPLORER | OFN_ENABLEHOOK; -#endif // !_WIN32_WCE m_ofn.lpstrFilter = lpszFilter; m_ofn.hInstance = ModuleHelper::GetResourceInstance(); m_ofn.lpfnHook = (LPOFNHOOKPROC)T::StartDialogProc; m_ofn.hwndOwner = hWndParent; + m_szFileName[0] = _T('\0'); + m_szFileTitle[0] = _T('\0'); + // setup initial file name if(lpszFileName != NULL) - SecureHelper::strncpy_x(m_szFileName, _countof(m_szFileName), lpszFileName, _TRUNCATE); + ATL::Checked::tcsncpy_s(m_szFileName, _countof(m_szFileName), lpszFileName, _TRUNCATE); } INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) @@ -193,23 +149,22 @@ class ATL_NO_VTABLE CFileDialogImpl : public ATL::CDialogImplBase m_ofn.hwndOwner = hWndParent; ATLASSERT(m_hWnd == NULL); + + // Allocate the thunk structure here, where we can fail gracefully. + BOOL bRetTh = m_thunk.Init(NULL, NULL); + if(bRetTh == FALSE) + { + ::SetLastError(ERROR_OUTOFMEMORY); + return -1; + } + ModuleHelper::AddCreateWndData(&m_thunk.cd, (ATL::CDialogImplBase*)this); - BOOL bRet; - if(m_bOpenFileDialog) -#if defined(__AYGSHELL_H__) && (_WIN32_WCE >= 0x0501) - bRet = ::GetOpenFileNameEx(&m_ofn); - else - bRet = ::GetSaveFileName((LPOPENFILENAME)&m_ofn); -#else - bRet = ::GetOpenFileName(&m_ofn); - else - bRet = ::GetSaveFileName(&m_ofn); -#endif + BOOL bRet = (m_bOpenFileDialog != FALSE) ? ::GetOpenFileName(&m_ofn) : ::GetSaveFileName(&m_ofn); m_hWnd = NULL; - return bRet ? IDOK : IDCANCEL; + return (bRet != FALSE) ? IDOK : IDCANCEL; } // Attributes @@ -298,9 +253,7 @@ class ATL_NO_VTABLE CFileDialogImpl : public ATL::CDialogImplBase NOTIFY_CODE_HANDLER(CDN_SELCHANGE, _OnSelChange) NOTIFY_CODE_HANDLER(CDN_SHAREVIOLATION, _OnShareViolation) NOTIFY_CODE_HANDLER(CDN_TYPECHANGE, _OnTypeChange) -#ifndef _WIN32_WCE NOTIFY_CODE_HANDLER(CDN_INCLUDEITEM, _OnIncludeItem) -#endif // !_WIN32_WCE END_MSG_MAP() LRESULT _OnFileOK(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) @@ -357,14 +310,12 @@ class ATL_NO_VTABLE CFileDialogImpl : public ATL::CDialogImplBase return 0; } -#ifndef _WIN32_WCE LRESULT _OnIncludeItem(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) { ATLASSERT(::IsWindow(m_hWnd)); T* pT = static_cast(this); return pT->OnIncludeItem((LPOFNOTIFYEX)pnmh); } -#endif // !_WIN32_WCE // Overrideables BOOL OnFileOK(LPOFNOTIFY /*lpon*/) @@ -397,12 +348,10 @@ class ATL_NO_VTABLE CFileDialogImpl : public ATL::CDialogImplBase { } -#ifndef _WIN32_WCE BOOL OnIncludeItem(LPOFNOTIFYEX /*lponex*/) { return TRUE; // include item } -#endif // !_WIN32_WCE }; class CFileDialog : public CFileDialogImpl @@ -421,35 +370,62 @@ class CFileDialog : public CFileDialogImpl DECLARE_EMPTY_MSG_MAP() }; -#if defined(__AYGSHELL_H__) && (_WIN32_WCE >= 0x0501) -class CFileDialogEx : public CFileDialogImpl + +/////////////////////////////////////////////////////////////////////////////// +// CSimpleFileDialog - simple class for non-customized Open/SaveAs dialogs + +class CSimpleFileDialog { public: - CFileDialogEx( // Supports only FileOpen - LPCTSTR lpszDefExt = NULL, - LPCTSTR lpszFileName = NULL, - DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, - OFN_EXFLAG ExFlags = OFN_EXFLAG_THUMBNAILVIEW, - OFN_SORTORDER dwSortOrder = OFN_SORTORDER_AUTO, - LPCTSTR lpszFilter = NULL, - HWND hWndParent = NULL) - : CFileDialogImpl(TRUE, lpszDefExt, lpszFileName, dwFlags, lpszFilter, hWndParent) + OPENFILENAME m_ofn; + BOOL m_bOpenFileDialog; // TRUE for file open, FALSE for file save + TCHAR m_szFileTitle[_MAX_FNAME]; // contains file title after return + TCHAR m_szFileName[_MAX_PATH]; // contains full path name after return + + CSimpleFileDialog(BOOL bOpenFileDialog, // TRUE for FileOpen, FALSE for FileSaveAs + LPCTSTR lpszDefExt = NULL, + LPCTSTR lpszFileName = NULL, + DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + LPCTSTR lpszFilter = NULL, + HWND hWndParent = NULL) : m_bOpenFileDialog(bOpenFileDialog) { - m_ofn.ExFlags = ExFlags; - m_ofn.dwSortOrder = dwSortOrder; + memset(&m_ofn, 0, sizeof(m_ofn)); // initialize structure to 0/NULL + m_ofn.lStructSize = sizeof(m_ofn); + m_ofn.lpstrFile = m_szFileName; + m_ofn.nMaxFile = _MAX_PATH; + m_ofn.lpstrDefExt = lpszDefExt; + m_ofn.lpstrFileTitle = (LPTSTR)m_szFileTitle; + m_ofn.nMaxFileTitle = _MAX_FNAME; + m_ofn.Flags = dwFlags | OFN_EXPLORER | OFN_ENABLESIZING; + m_ofn.lpstrFilter = lpszFilter; + m_ofn.hInstance = ModuleHelper::GetResourceInstance(); + m_ofn.hwndOwner = hWndParent; + + m_szFileName[0] = _T('\0'); + m_szFileTitle[0] = _T('\0'); + + // setup initial file name + if(lpszFileName != NULL) + ATL::Checked::tcsncpy_s(m_szFileName, _countof(m_szFileName), lpszFileName, _TRUNCATE); } - // override base class map and references to handlers - DECLARE_EMPTY_MSG_MAP() + INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) + { + ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); + + if(m_ofn.hwndOwner == NULL) // set only if not specified before + m_ofn.hwndOwner = hWndParent; + + BOOL bRet = (m_bOpenFileDialog != FALSE) ? ::GetOpenFileName(&m_ofn) : ::GetSaveFileName(&m_ofn); + + return (bRet != FALSE) ? IDOK : IDCANCEL; + } }; -#endif // defined(__AYGSHELL_H__) && (_WIN32_WCE >= 0x0501) /////////////////////////////////////////////////////////////////////////////// // Multi File Dialog - Multi-select File Open dialog -#ifndef _WIN32_WCE - // The class dynamically resizes the buffer as the file selection changes // (as described in Knowledge Base article 131462). It also expands selected // shortcut files to take into account the full path of the target file. @@ -478,12 +454,19 @@ class ATL_NO_VTABLE CMultiFileDialogImpl : public CFileDialogImpl< T > : CFileDialogImpl(TRUE, lpszDefExt, lpszFileName, dwFlags, lpszFilter, hWndParent), m_pNextFile(NULL) { - m_ofn.Flags |= OFN_ALLOWMULTISELECT; // Force multiple selection mode + this->m_ofn.Flags |= OFN_ALLOWMULTISELECT; // Force multiple selection mode #ifndef _UNICODE +#ifdef _versionhelpers_H_INCLUDED_ + OSVERSIONINFOEX ovi = { sizeof(OSVERSIONINFOEX) }; + ovi.dwPlatformId = VER_PLATFORM_WIN32_NT; + DWORDLONG const dwlConditionMask = ::VerSetConditionMask(0, VER_PLATFORMID, VER_EQUAL); + m_bIsNT = (::VerifyVersionInfo(&ovi, VER_PLATFORMID, dwlConditionMask) != FALSE); +#else // !_versionhelpers_H_INCLUDED_ OSVERSIONINFO ovi = { sizeof(OSVERSIONINFO) }; ::GetVersionEx(&ovi); m_bIsNT = (ovi.dwPlatformId == VER_PLATFORM_WIN32_NT); +#endif // _versionhelpers_H_INCLUDED_ if (m_bIsNT) { // On NT platforms, GetOpenFileNameA thunks to GetOpenFileNameW and there @@ -495,8 +478,8 @@ class ATL_NO_VTABLE CMultiFileDialogImpl : public CFileDialogImpl< T > ~CMultiFileDialogImpl() { - if (m_ofn.lpstrFile != m_szFileName) // Free the buffer if we allocated it - delete[] m_ofn.lpstrFile; + if (this->m_ofn.lpstrFile != this->m_szFileName) // Free the buffer if we allocated it + delete[] this->m_ofn.lpstrFile; } // Operations @@ -506,15 +489,15 @@ class ATL_NO_VTABLE CMultiFileDialogImpl : public CFileDialogImpl< T > // If the function fails, the return value is zero. int GetDirectory(LPTSTR pBuffer, int nBufLen) const { - if (m_ofn.lpstrFile == NULL) + if (this->m_ofn.lpstrFile == NULL) return 0; - LPCTSTR pStr = m_ofn.lpstrFile; + LPCTSTR pStr = this->m_ofn.lpstrFile; int nLength = lstrlen(pStr); if (pStr[nLength + 1] == 0) { // The OFN buffer contains a single item so extract its path. - LPCTSTR pSep = MinCrtHelper::_strrchr(pStr, _T('\\')); + LPCTSTR pSep = _tcsrchr(pStr, _T('\\')); if (pSep != NULL) nLength = (int)(DWORD_PTR)(pSep - pStr); } @@ -526,15 +509,15 @@ class ATL_NO_VTABLE CMultiFileDialogImpl : public CFileDialogImpl< T > } else if (nBufLen > nLength) { - SecureHelper::strncpy_x(pBuffer, nBufLen, pStr, nLength); + ATL::Checked::tcsncpy_s(pBuffer, nBufLen, pStr, nLength); nRet = nLength; } return nRet; } -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - bool GetDirectory(_CSTRING_NS::CString& strDir) const +#ifdef __ATLSTR_H__ + bool GetDirectory(ATL::CString& strDir) const { bool bRet = false; @@ -547,17 +530,17 @@ class ATL_NO_VTABLE CMultiFileDialogImpl : public CFileDialogImpl< T > return bRet; } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) +#endif // __ATLSTR_H__ // Get the first filename as a pointer into the buffer. LPCTSTR GetFirstFileName() const { - if (m_ofn.lpstrFile == NULL) + if (this->m_ofn.lpstrFile == NULL) return NULL; m_pNextFile = NULL; // Reset internal buffer pointer - LPCTSTR pStr = m_ofn.lpstrFile; + LPCTSTR pStr = this->m_ofn.lpstrFile; int nLength = lstrlen(pStr); if (pStr[nLength + 1] != 0) { @@ -572,7 +555,7 @@ class ATL_NO_VTABLE CMultiFileDialogImpl : public CFileDialogImpl< T > else { // A single item was selected. Skip forward past the path. - LPCTSTR pSep = MinCrtHelper::_strrchr(pStr, _T('\\')); + LPCTSTR pSep = _tcsrchr(pStr, _T('\\')); if (pSep != NULL) pStr = pSep + 1; } @@ -617,16 +600,16 @@ class ATL_NO_VTABLE CMultiFileDialogImpl : public CFileDialogImpl< T > else if (nBufLen > nLengthTotal) // If the buffer is big enough, go ahead and construct the path { GetDirectory(pBuffer, nBufLen); - SecureHelper::strcat_x(pBuffer, nBufLen, _T("\\")); - SecureHelper::strcat_x(pBuffer, nBufLen, pStr); + ATL::Checked::tcscat_s(pBuffer, nBufLen, _T("\\")); + ATL::Checked::tcscat_s(pBuffer, nBufLen, pStr); nRet = nLengthTotal; } return nRet; } -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - bool GetFirstPathName(_CSTRING_NS::CString& strPath) const +#ifdef __ATLSTR_H__ + bool GetFirstPathName(ATL::CString& strPath) const { bool bRet = false; @@ -639,7 +622,7 @@ class ATL_NO_VTABLE CMultiFileDialogImpl : public CFileDialogImpl< T > return bRet; } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) +#endif // __ATLSTR_H__ // Get the next filename as a full path. // The function returns the number of characters copied, not including the terminating zero. @@ -654,7 +637,7 @@ class ATL_NO_VTABLE CMultiFileDialogImpl : public CFileDialogImpl< T > int nRet = 0; LPCTSTR pStr = m_pNextFile; // Does the filename contain a backslash? - if (MinCrtHelper::_strrchr(pStr, _T('\\')) != NULL) + if (_tcsrchr(pStr, _T('\\')) != NULL) { // Yes, so we'll assume it's a full path. int nLength = lstrlen(pStr); @@ -665,7 +648,7 @@ class ATL_NO_VTABLE CMultiFileDialogImpl : public CFileDialogImpl< T > } else if (nBufLen > nLength) // The buffer is big enough, so go ahead and copy the filename { - SecureHelper::strcpy_x(pBuffer, nBufLen, GetNextFileName()); + ATL::Checked::tcscpy_s(pBuffer, nBufLen, GetNextFileName()); nRet = nBufLen; } } @@ -685,8 +668,8 @@ class ATL_NO_VTABLE CMultiFileDialogImpl : public CFileDialogImpl< T > else if (nBufLen > nLengthTotal) // If the buffer is big enough, go ahead and construct the path { GetDirectory(pBuffer, nBufLen); - SecureHelper::strcat_x(pBuffer, nBufLen, _T("\\")); - SecureHelper::strcat_x(pBuffer, nBufLen, GetNextFileName()); + ATL::Checked::tcscat_s(pBuffer, nBufLen, _T("\\")); + ATL::Checked::tcscat_s(pBuffer, nBufLen, GetNextFileName()); nRet = nLengthTotal; } } @@ -695,8 +678,8 @@ class ATL_NO_VTABLE CMultiFileDialogImpl : public CFileDialogImpl< T > return nRet; } -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - bool GetNextPathName(_CSTRING_NS::CString& strPath) const +#ifdef __ATLSTR_H__ + bool GetNextPathName(ATL::CString& strPath) const { bool bRet = false; @@ -709,19 +692,19 @@ class ATL_NO_VTABLE CMultiFileDialogImpl : public CFileDialogImpl< T > return bRet; } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) +#endif // __ATLSTR_H__ // Implementation bool ResizeFilenameBuffer(DWORD dwLength) { - if (dwLength > m_ofn.nMaxFile) + if (dwLength > this->m_ofn.nMaxFile) { // Free the old buffer. - if (m_ofn.lpstrFile != m_szFileName) + if (this->m_ofn.lpstrFile != this->m_szFileName) { - delete[] m_ofn.lpstrFile; - m_ofn.lpstrFile = NULL; - m_ofn.nMaxFile = 0; + delete[] this->m_ofn.lpstrFile; + this->m_ofn.lpstrFile = NULL; + this->m_ofn.nMaxFile = 0; } // Allocate the new buffer. @@ -729,13 +712,13 @@ class ATL_NO_VTABLE CMultiFileDialogImpl : public CFileDialogImpl< T > ATLTRY(lpstrBuff = new TCHAR[dwLength]); if (lpstrBuff != NULL) { - m_ofn.lpstrFile = lpstrBuff; - m_ofn.lpstrFile[0] = 0; - m_ofn.nMaxFile = dwLength; + this->m_ofn.lpstrFile = lpstrBuff; + this->m_ofn.lpstrFile[0] = 0; + this->m_ofn.nMaxFile = dwLength; } } - return (m_ofn.lpstrFile != NULL); + return (this->m_ofn.lpstrFile != NULL); } void OnSelChange(LPOFNOTIFY /*lpon*/) @@ -747,12 +730,12 @@ class ATL_NO_VTABLE CMultiFileDialogImpl : public CFileDialogImpl< T > #endif // Get the buffer length required to hold the spec. - int nLength = GetSpec(NULL, 0); + int nLength = this->GetSpec(NULL, 0); if (nLength <= 1) return; // no files are selected, presumably // Add room for the directory, and an extra terminating zero. - nLength += GetFolderPath(NULL, 0) + 1; + nLength += this->GetFolderPath(NULL, 0) + 1; if (!ResizeFilenameBuffer(nLength)) { @@ -761,18 +744,22 @@ class ATL_NO_VTABLE CMultiFileDialogImpl : public CFileDialogImpl< T > } // If we are not following links then our work is done. - if ((m_ofn.Flags & OFN_NODEREFERENCELINKS) != 0) + if ((this->m_ofn.Flags & OFN_NODEREFERENCELINKS) != 0) return; // Get the file spec, which is the text in the edit control. - if (GetSpec(m_ofn.lpstrFile, m_ofn.nMaxFile) <= 0) + if (this->GetSpec(this->m_ofn.lpstrFile, this->m_ofn.nMaxFile) <= 0) return; // Get the ID-list of the current folder. - int nBytes = GetFolderIDList(NULL, 0); - CTempBuffer idlist; + int nBytes = this->GetFolderIDList(NULL, 0); +#ifdef STRICT_TYPED_ITEMIDS + ATL::CTempBuffer idlist; +#else + ATL::CTempBuffer idlist; +#endif idlist.AllocateBytes(nBytes); - if ((nBytes <= 0) || (GetFolderIDList(idlist, nBytes) <= 0)) + if ((nBytes <= 0) || (this->GetFolderIDList(idlist, nBytes) <= 0)) return; // First bind to the desktop folder, then to the current folder. @@ -786,8 +773,8 @@ class ATL_NO_VTABLE CMultiFileDialogImpl : public CFileDialogImpl< T > // we need to add enough extra buffer space to hold its target path. DWORD nExtraChars = 0; bool bInsideQuotes = false; - LPCTSTR pAnchor = m_ofn.lpstrFile; - LPCTSTR pChar = m_ofn.lpstrFile; + LPCTSTR pAnchor = this->m_ofn.lpstrFile; + LPCTSTR pChar = this->m_ofn.lpstrFile; for ( ; *pChar; ++pChar) { // Look for quotation marks. @@ -812,8 +799,12 @@ class ATL_NO_VTABLE CMultiFileDialogImpl : public CFileDialogImpl< T > USES_CONVERSION; int nFileNameLength = (int)(DWORD_PTR)(pChar - pAnchor); TCHAR szFileName[MAX_PATH] = { 0 }; - SecureHelper::strncpy_x(szFileName, MAX_PATH, pAnchor, nFileNameLength); + ATL::Checked::tcsncpy_s(szFileName, MAX_PATH, pAnchor, nFileNameLength); +#ifdef STRICT_TYPED_ITEMIDS + PIDLIST_RELATIVE pidl = NULL; +#else LPITEMIDLIST pidl = NULL; +#endif DWORD dwAttrib = SFGAO_LINK; if (SUCCEEDED(pFolder->ParseDisplayName(NULL, NULL, T2W(szFileName), NULL, &pidl, &dwAttrib))) { @@ -846,7 +837,7 @@ class ATL_NO_VTABLE CMultiFileDialogImpl : public CFileDialogImpl< T > // If we need more space for shortcut targets, then reallocate. if (nExtraChars > 0) - ATLVERIFY(ResizeFilenameBuffer(m_ofn.nMaxFile + nExtraChars)); + ATLVERIFY(ResizeFilenameBuffer(this->m_ofn.nMaxFile + nExtraChars)); } }; @@ -867,8 +858,6 @@ class CMultiFileDialog : public CMultiFileDialogImpl END_MSG_MAP() }; -#endif // !_WIN32_WCE - /////////////////////////////////////////////////////////////////////////////// // Shell File Dialog - new Shell File Open and Save dialogs in Vista @@ -878,7 +867,7 @@ class CMultiFileDialog : public CMultiFileDialogImpl // CShellFileOpenDialog dlg; // dlg.GetPtr()->SetTitle(L"MyFileOpenDialog"); -#if (_WIN32_WINNT >= 0x0600) && !defined(_WIN32_WCE) +#if (_WIN32_WINNT >= 0x0600) /////////////////////////////////////////////////////////////////////////////// // CShellFileDialogImpl - base class for CShellFileOpenDialogImpl and CShellFileSaveDialogImpl @@ -950,8 +939,8 @@ class ATL_NO_VTABLE CShellFileDialogImpl : public IFileDialogEvents return hRet; } -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - HRESULT GetFilePath(_CSTRING_NS::CString& strFilePath) +#ifdef __ATLSTR_H__ + HRESULT GetFilePath(ATL::CString& strFilePath) { T* pT = static_cast(this); ATLASSERT(pT->m_spFileDlg != NULL); @@ -965,7 +954,7 @@ class ATL_NO_VTABLE CShellFileDialogImpl : public IFileDialogEvents return hRet; } - HRESULT GetFileTitle(_CSTRING_NS::CString& strFileTitle) + HRESULT GetFileTitle(ATL::CString& strFileTitle) { T* pT = static_cast(this); ATLASSERT(pT->m_spFileDlg != NULL); @@ -978,7 +967,7 @@ class ATL_NO_VTABLE CShellFileDialogImpl : public IFileDialogEvents return hRet; } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) +#endif // __ATLSTR_H__ // Helpers for IShellItem static HRESULT GetFileNameFromShellItem(IShellItem* pShellItem, SIGDN type, LPWSTR lpstr, int cchLength) @@ -992,7 +981,7 @@ class ATL_NO_VTABLE CShellFileDialogImpl : public IFileDialogEvents { if(lstrlenW(lpstrName) < cchLength) { - SecureHelper::strcpyW_x(lpstr, cchLength, lpstrName); + ATL::Checked::wcscpy_s(lpstr, cchLength, lpstrName); } else { @@ -1006,8 +995,8 @@ class ATL_NO_VTABLE CShellFileDialogImpl : public IFileDialogEvents return hRet; } -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - static HRESULT GetFileNameFromShellItem(IShellItem* pShellItem, SIGDN type, _CSTRING_NS::CString& str) +#ifdef __ATLSTR_H__ + static HRESULT GetFileNameFromShellItem(IShellItem* pShellItem, SIGDN type, ATL::CString& str) { ATLASSERT(pShellItem != NULL); @@ -1022,7 +1011,7 @@ class ATL_NO_VTABLE CShellFileDialogImpl : public IFileDialogEvents return hRet; } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) +#endif // __ATLSTR_H__ // Implementation void _Advise(DWORD& dwCookie) @@ -1063,7 +1052,7 @@ class ATL_NO_VTABLE CShellFileDialogImpl : public IFileDialogEvents ATLASSERT(SUCCEEDED(hRet)); } - if(arrFilterSpec != NULL && uFilterSpecCount != 0U) + if((arrFilterSpec != NULL) && (uFilterSpecCount != 0U)) { hRet = pT->m_spFileDlg->SetFileTypes(uFilterSpecCount, arrFilterSpec); ATLASSERT(SUCCEEDED(hRet)); @@ -1098,7 +1087,7 @@ class ATL_NO_VTABLE CShellFileDialogImpl : public IFileDialogEvents } // Implementation - IFileDialogEvents interface - virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnFileOk(IFileDialog* pfd) + virtual HRESULT STDMETHODCALLTYPE OnFileOk(IFileDialog* pfd) { T* pT = static_cast(this); ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); @@ -1106,7 +1095,7 @@ class ATL_NO_VTABLE CShellFileDialogImpl : public IFileDialogEvents return pT->OnFileOk(); } - virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnFolderChanging(IFileDialog* pfd, IShellItem* psiFolder) + virtual HRESULT STDMETHODCALLTYPE OnFolderChanging(IFileDialog* pfd, IShellItem* psiFolder) { T* pT = static_cast(this); ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); @@ -1114,7 +1103,7 @@ class ATL_NO_VTABLE CShellFileDialogImpl : public IFileDialogEvents return pT->OnFolderChanging(psiFolder); } - virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnFolderChange(IFileDialog* pfd) + virtual HRESULT STDMETHODCALLTYPE OnFolderChange(IFileDialog* pfd) { T* pT = static_cast(this); ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); @@ -1122,7 +1111,7 @@ class ATL_NO_VTABLE CShellFileDialogImpl : public IFileDialogEvents return pT->OnFolderChange(); } - virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnSelectionChange(IFileDialog* pfd) + virtual HRESULT STDMETHODCALLTYPE OnSelectionChange(IFileDialog* pfd) { T* pT = static_cast(this); ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); @@ -1130,7 +1119,7 @@ class ATL_NO_VTABLE CShellFileDialogImpl : public IFileDialogEvents return pT->OnSelectionChange(); } - virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnShareViolation(IFileDialog* pfd, IShellItem* psi, FDE_SHAREVIOLATION_RESPONSE* pResponse) + virtual HRESULT STDMETHODCALLTYPE OnShareViolation(IFileDialog* pfd, IShellItem* psi, FDE_SHAREVIOLATION_RESPONSE* pResponse) { T* pT = static_cast(this); ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); @@ -1138,7 +1127,7 @@ class ATL_NO_VTABLE CShellFileDialogImpl : public IFileDialogEvents return pT->OnShareViolation(psi, pResponse); } - virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnTypeChange(IFileDialog* pfd) + virtual HRESULT STDMETHODCALLTYPE OnTypeChange(IFileDialog* pfd) { T* pT = static_cast(this); ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); @@ -1146,7 +1135,7 @@ class ATL_NO_VTABLE CShellFileDialogImpl : public IFileDialogEvents return pT->OnTypeChange(); } - virtual HRESULT STDMETHODCALLTYPE IFileDialogEvents::OnOverwrite(IFileDialog* pfd, IShellItem* psi, FDE_OVERWRITE_RESPONSE* pResponse) + virtual HRESULT STDMETHODCALLTYPE OnOverwrite(IFileDialog* pfd, IShellItem* psi, FDE_OVERWRITE_RESPONSE* pResponse) { T* pT = static_cast(this); ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); @@ -1210,7 +1199,7 @@ class ATL_NO_VTABLE CShellFileOpenDialogImpl : public CShellFileDialogImpl< T > HRESULT hRet = m_spFileDlg.CoCreateInstance(CLSID_FileOpenDialog); if(SUCCEEDED(hRet)) - _Init(lpszFileName, dwOptions, lpszDefExt, arrFilterSpec, uFilterSpecCount); + this->_Init(lpszFileName, dwOptions, lpszDefExt, arrFilterSpec, uFilterSpecCount); } IFileOpenDialog* GetPtr() @@ -1260,7 +1249,7 @@ class ATL_NO_VTABLE CShellFileSaveDialogImpl : public CShellFileDialogImpl< T > HRESULT hRet = m_spFileDlg.CoCreateInstance(CLSID_FileSaveDialog); if(SUCCEEDED(hRet)) - _Init(lpszFileName, dwOptions, lpszDefExt, arrFilterSpec, uFilterSpecCount); + this->_Init(lpszFileName, dwOptions, lpszDefExt, arrFilterSpec, uFilterSpecCount); } IFileSaveDialog* GetPtr() @@ -1291,14 +1280,12 @@ class CShellFileSaveDialog : public CShellFileSaveDialogImpl= 0x0600) && !defined(_WIN32_WCE) +#endif // (_WIN32_WINNT >= 0x0600) /////////////////////////////////////////////////////////////////////////////// // CFolderDialogImpl - used for browsing for a folder -#ifndef _WIN32_WCE - template class ATL_NO_VTABLE CFolderDialogImpl { @@ -1309,7 +1296,11 @@ class ATL_NO_VTABLE CFolderDialogImpl bool m_bExpandInitialSelection; TCHAR m_szFolderDisplayName[MAX_PATH]; TCHAR m_szFolderPath[MAX_PATH]; +#ifdef STRICT_TYPED_ITEMIDS + PIDLIST_ABSOLUTE m_pidlSelected; +#else LPITEMIDLIST m_pidlSelected; +#endif HWND m_hWnd; // used only in the callback function // Constructor @@ -1379,6 +1370,15 @@ class ATL_NO_VTABLE CFolderDialogImpl m_bExpandInitialSelection = bExpand; } +#ifdef STRICT_TYPED_ITEMIDS + void SetRootFolder(PCIDLIST_ABSOLUTE pidl) +#else + void SetRootFolder(LPCITEMIDLIST pidl) +#endif + { + m_bi.pidlRoot = pidl; + } + // Methods to call after DoModal LPITEMIDLIST GetSelectedItem(bool bDetach = false) { @@ -1407,20 +1407,6 @@ class ATL_NO_VTABLE CFolderDialogImpl // Callback function and overrideables static int CALLBACK BrowseCallbackProc(HWND hWnd, UINT uMsg, LPARAM lParam, LPARAM lpData) { -#ifndef BFFM_VALIDATEFAILED - #ifdef UNICODE - const int BFFM_VALIDATEFAILED = 4; - #else - const int BFFM_VALIDATEFAILED = 3; - #endif -#endif // !BFFM_VALIDATEFAILED -#ifndef BFFM_IUNKNOWN - const int BFFM_IUNKNOWN = 5; -#endif // !BFFM_IUNKNOWN -#ifndef BIF_NEWDIALOGSTYLE - const UINT BIF_NEWDIALOGSTYLE = 0x0040; -#endif // !BIF_NEWDIALOGSTYLE - int nRet = 0; T* pT = (T*)lpData; bool bClear = false; @@ -1517,9 +1503,6 @@ class ATL_NO_VTABLE CFolderDialogImpl void SetOKText(LPCTSTR lpstrOKText) { -#ifndef BFFM_SETOKTEXT - const UINT BFFM_SETOKTEXT = WM_USER + 105; -#endif ATLASSERT(m_hWnd != NULL); USES_CONVERSION; LPCWSTR lpstr = T2CW(lpstrOKText); @@ -1528,18 +1511,12 @@ class ATL_NO_VTABLE CFolderDialogImpl void SetExpanded(LPCITEMIDLIST pItemIDList) { -#ifndef BFFM_SETEXPANDED - const UINT BFFM_SETEXPANDED = WM_USER + 106; -#endif ATLASSERT(m_hWnd != NULL); ::SendMessage(m_hWnd, BFFM_SETEXPANDED, FALSE, (LPARAM)pItemIDList); } void SetExpanded(LPCTSTR lpstrFolderPath) { -#ifndef BFFM_SETEXPANDED - const UINT BFFM_SETEXPANDED = WM_USER + 106; -#endif ATLASSERT(m_hWnd != NULL); USES_CONVERSION; LPCWSTR lpstr = T2CW(lpstrFolderPath); @@ -1555,8 +1532,6 @@ class CFolderDialog : public CFolderDialogImpl { } }; -#endif // !_WIN32_WCE - /////////////////////////////////////////////////////////////////////////////// // CCommonDialogImplBase - base class for common dialog classes @@ -1611,8 +1586,6 @@ class ATL_NO_VTABLE CCommonDialogImplBase : public ATL::CWindowImplBase /////////////////////////////////////////////////////////////////////////////// // CFontDialogImpl - font selection dialog -#ifndef _WIN32_WCE - template class ATL_NO_VTABLE CFontDialogImpl : public CCommonDialogImplBase { @@ -1668,6 +1641,15 @@ class ATL_NO_VTABLE CFontDialogImpl : public CCommonDialogImplBase m_cf.hwndOwner = hWndParent; ATLASSERT(m_hWnd == NULL); + + // Allocate the thunk structure here, where we can fail gracefully. + BOOL bRetTh = m_thunk.Init(NULL, NULL); + if(bRetTh == FALSE) + { + ::SetLastError(ERROR_OUTOFMEMORY); + return -1; + } + ModuleHelper::AddCreateWndData(&m_thunk.cd, (CCommonDialogImplBase*)this); BOOL bRet = ::ChooseFont(&m_cf); @@ -1675,7 +1657,7 @@ class ATL_NO_VTABLE CFontDialogImpl : public CCommonDialogImplBase m_hWnd = NULL; if(bRet) // copy logical font from user's initialization buffer (if needed) - SecureHelper::memcpy_x(&m_lf, sizeof(m_lf), m_cf.lpLogFont, sizeof(m_lf)); + ATL::Checked::memcpy_s(&m_lf, sizeof(m_lf), m_cf.lpLogFont, sizeof(m_lf)); return bRet ? IDOK : IDCANCEL; } @@ -1692,13 +1674,10 @@ class ATL_NO_VTABLE CFontDialogImpl : public CCommonDialogImplBase } // works only when the dialog is dislayed or before -#ifndef _WIN32_WCE void SetLogFont(LPLOGFONT lplf) { ATLASSERT(lplf != NULL); -#ifndef WM_CHOOSEFONT_SETLOGFONT - const UINT WM_CHOOSEFONT_SETLOGFONT = (WM_USER + 101); -#endif + if(m_hWnd != NULL) { ::SendMessage(m_hWnd, WM_CHOOSEFONT_SETLOGFONT, 0, (LPARAM)lplf); @@ -1712,9 +1691,6 @@ class ATL_NO_VTABLE CFontDialogImpl : public CCommonDialogImplBase void SetFlags(DWORD dwFlags) { -#ifndef WM_CHOOSEFONT_SETFLAGS - const UINT WM_CHOOSEFONT_SETFLAGS = (WM_USER + 102); -#endif if(m_hWnd != NULL) { CHOOSEFONT cf = { sizeof(CHOOSEFONT) }; @@ -1726,7 +1702,6 @@ class ATL_NO_VTABLE CFontDialogImpl : public CCommonDialogImplBase m_cf.Flags = dwFlags; } } -#endif // !_WIN32_WCE // Helpers for parsing information after successful return LPCTSTR GetFaceName() const // return the face name of the font @@ -1788,13 +1763,11 @@ class CFontDialog : public CFontDialogImpl DECLARE_EMPTY_MSG_MAP() }; -#endif // _WIN32_WCE - /////////////////////////////////////////////////////////////////////////////// // CRichEditFontDialogImpl - font selection for the Rich Edit ctrl -#if defined(_RICHEDIT_) && !defined(_WIN32_WCE) +#ifdef _RICHEDIT_ template class ATL_NO_VTABLE CRichEditFontDialogImpl : public CFontDialogImpl< T > @@ -1806,12 +1779,12 @@ class ATL_NO_VTABLE CRichEditFontDialogImpl : public CFontDialogImpl< T > HWND hWndParent = NULL) : CFontDialogImpl< T >(NULL, dwFlags, hDCPrinter, hWndParent) { - m_cf.Flags |= CF_INITTOLOGFONTSTRUCT; - m_cf.Flags |= FillInLogFont(charformat); - m_cf.lpLogFont = &m_lf; + this->m_cf.Flags |= CF_INITTOLOGFONTSTRUCT; + this->m_cf.Flags |= FillInLogFont(charformat); + this->m_cf.lpLogFont = &this->m_lf; if((charformat.dwMask & CFM_COLOR) != 0) - m_cf.rgbColors = charformat.crTextColor; + this->m_cf.rgbColors = charformat.crTextColor; } void GetCharFormat(CHARFORMAT& cf) const @@ -1836,11 +1809,7 @@ class ATL_NO_VTABLE CRichEditFontDialogImpl : public CFontDialogImpl< T > { cf.dwMask |= CFM_FACE; cf.bPitchAndFamily = m_cf.lpLogFont->lfPitchAndFamily; -#if (_RICHEDIT_VER >= 0x0200) - SecureHelper::strcpy_x(cf.szFaceName, _countof(cf.szFaceName), GetFaceName()); -#else // !(_RICHEDIT_VER >= 0x0200) - SecureHelper::strcpyA_x(cf.szFaceName, _countof(cf.szFaceName), T2A((LPTSTR)(LPCTSTR)GetFaceName())); -#endif // !(_RICHEDIT_VER >= 0x0200) + ATL::Checked::tcscpy_s(cf.szFaceName, _countof(cf.szFaceName), GetFaceName()); } if((m_cf.Flags & CF_EFFECTS) != 0) @@ -1866,59 +1835,55 @@ class ATL_NO_VTABLE CRichEditFontDialogImpl : public CFontDialogImpl< T > { HDC hDC = ::CreateDC(_T("DISPLAY"), NULL, NULL, NULL); LONG yPerInch = ::GetDeviceCaps(hDC, LOGPIXELSY); - m_lf.lfHeight = -(int)((cf.yHeight * yPerInch) / 1440); + this->m_lf.lfHeight = -(int)((cf.yHeight * yPerInch) / 1440); } else - m_lf.lfHeight = 0; + this->m_lf.lfHeight = 0; - m_lf.lfWidth = 0; - m_lf.lfEscapement = 0; - m_lf.lfOrientation = 0; + this->m_lf.lfWidth = 0; + this->m_lf.lfEscapement = 0; + this->m_lf.lfOrientation = 0; if((cf.dwMask & (CFM_ITALIC | CFM_BOLD)) == (CFM_ITALIC | CFM_BOLD)) { - m_lf.lfWeight = ((cf.dwEffects & CFE_BOLD) != 0) ? FW_BOLD : FW_NORMAL; - m_lf.lfItalic = (BYTE)(((cf.dwEffects & CFE_ITALIC) != 0) ? TRUE : FALSE); + this->m_lf.lfWeight = ((cf.dwEffects & CFE_BOLD) != 0) ? FW_BOLD : FW_NORMAL; + this->m_lf.lfItalic = (BYTE)(((cf.dwEffects & CFE_ITALIC) != 0) ? TRUE : FALSE); } else { dwFlags |= CF_NOSTYLESEL; - m_lf.lfWeight = FW_DONTCARE; - m_lf.lfItalic = FALSE; + this->m_lf.lfWeight = FW_DONTCARE; + this->m_lf.lfItalic = FALSE; } if((cf.dwMask & (CFM_UNDERLINE | CFM_STRIKEOUT | CFM_COLOR)) == (CFM_UNDERLINE|CFM_STRIKEOUT|CFM_COLOR)) { dwFlags |= CF_EFFECTS; - m_lf.lfUnderline = (BYTE)(((cf.dwEffects & CFE_UNDERLINE) != 0) ? TRUE : FALSE); - m_lf.lfStrikeOut = (BYTE)(((cf.dwEffects & CFE_STRIKEOUT) != 0) ? TRUE : FALSE); + this->m_lf.lfUnderline = (BYTE)(((cf.dwEffects & CFE_UNDERLINE) != 0) ? TRUE : FALSE); + this->m_lf.lfStrikeOut = (BYTE)(((cf.dwEffects & CFE_STRIKEOUT) != 0) ? TRUE : FALSE); } else { - m_lf.lfUnderline = (BYTE)FALSE; - m_lf.lfStrikeOut = (BYTE)FALSE; + this->m_lf.lfUnderline = (BYTE)FALSE; + this->m_lf.lfStrikeOut = (BYTE)FALSE; } if((cf.dwMask & CFM_CHARSET) != 0) - m_lf.lfCharSet = cf.bCharSet; + this->m_lf.lfCharSet = cf.bCharSet; else dwFlags |= CF_NOSCRIPTSEL; - m_lf.lfOutPrecision = OUT_DEFAULT_PRECIS; - m_lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; - m_lf.lfQuality = DEFAULT_QUALITY; + this->m_lf.lfOutPrecision = OUT_DEFAULT_PRECIS; + this->m_lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; + this->m_lf.lfQuality = DEFAULT_QUALITY; if((cf.dwMask & CFM_FACE) != 0) { - m_lf.lfPitchAndFamily = cf.bPitchAndFamily; -#if (_RICHEDIT_VER >= 0x0200) - SecureHelper::strcpy_x(m_lf.lfFaceName, _countof(m_lf.lfFaceName), cf.szFaceName); -#else // !(_RICHEDIT_VER >= 0x0200) - SecureHelper::strcpy_x(m_lf.lfFaceName, _countof(m_lf.lfFaceName), A2T((LPSTR)cf.szFaceName)); -#endif // !(_RICHEDIT_VER >= 0x0200) + this->m_lf.lfPitchAndFamily = cf.bPitchAndFamily; + ATL::Checked::tcscpy_s(this->m_lf.lfFaceName, _countof(this->m_lf.lfFaceName), cf.szFaceName); } else { - m_lf.lfPitchAndFamily = DEFAULT_PITCH|FF_DONTCARE; - m_lf.lfFaceName[0] = (TCHAR)0; + this->m_lf.lfPitchAndFamily = DEFAULT_PITCH|FF_DONTCARE; + this->m_lf.lfFaceName[0] = (TCHAR)0; } return dwFlags; } @@ -1937,26 +1902,12 @@ class CRichEditFontDialog : public CRichEditFontDialogImpl DECLARE_EMPTY_MSG_MAP() }; -#endif // defined(_RICHEDIT_) && !defined(_WIN32_WCE) +#endif // _RICHEDIT_ /////////////////////////////////////////////////////////////////////////////// // CColorDialogImpl - color selection -#if !defined(_WIN32_WCE) || ((_WIN32_WCE > 420) && !(defined(WIN32_PLATFORM_WFSP) && (_WIN32_WCE > 0x0500))) - -#ifdef _WIN32_WCE - #pragma comment(lib, "commdlg.lib") - - #ifndef SETRGBSTRING - #define SETRGBSTRING _T("commdlg_SetRGBColor") - #endif - - #ifndef COLOROKSTRING - #define COLOROKSTRING _T("commdlg_ColorOK") - #endif -#endif - template class ATL_NO_VTABLE CColorDialogImpl : public CCommonDialogImplBase { @@ -1991,6 +1942,15 @@ class ATL_NO_VTABLE CColorDialogImpl : public CCommonDialogImplBase m_cc.hwndOwner = hWndParent; ATLASSERT(m_hWnd == NULL); + + // Allocate the thunk structure here, where we can fail gracefully. + BOOL bRetTh = m_thunk.Init(NULL, NULL); + if(bRetTh == FALSE) + { + ::SetLastError(ERROR_OUTOFMEMORY); + return -1; + } + ModuleHelper::AddCreateWndData(&m_thunk.cd, (CCommonDialogImplBase*)this); BOOL bRet = ::ChooseColor(&m_cc); @@ -2016,7 +1976,7 @@ class ATL_NO_VTABLE CColorDialogImpl : public CCommonDialogImplBase // Special override for the color dialog static UINT_PTR APIENTRY HookProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - if(uMsg != WM_INITDIALOG && uMsg != _GetColorOKMessage()) + if((uMsg != WM_INITDIALOG) && (uMsg != _GetColorOKMessage())) return 0; LPCHOOSECOLOR lpCC = (LPCHOOSECOLOR)lParam; @@ -2042,11 +2002,17 @@ class ATL_NO_VTABLE CColorDialogImpl : public CCommonDialogImplBase ATLASSERT(pT != NULL); ATLASSERT(::IsWindow(pT->m_hWnd)); } + else + { + ATLASSERT(FALSE); + return 0; + } // pass to the message map - LRESULT lRes; + LRESULT lRes = 0; if(pT->ProcessWindowMessage(pT->m_hWnd, uMsg, wParam, lParam, lRes, 0) == FALSE) return 0; + return lRes; } @@ -2141,16 +2107,12 @@ class CColorDialog : public CColorDialogImpl DECLARE_EMPTY_MSG_MAP() }; -#endif // !defined(_WIN32_WCE) || ((_WIN32_WCE > 420) && !(defined(WIN32_PLATFORM_WFSP) && (_WIN32_WCE > 0x0500))) - /////////////////////////////////////////////////////////////////////////////// // CPrintDialogImpl - used for Print... and PrintSetup... -#ifndef _WIN32_WCE - // global helper -static HDC _AtlCreateDC(HGLOBAL hDevNames, HGLOBAL hDevMode) +static inline HDC _AtlCreateDC(HGLOBAL hDevNames, HGLOBAL hDevMode) { if(hDevNames == NULL) return NULL; @@ -2172,6 +2134,9 @@ static HDC _AtlCreateDC(HGLOBAL hDevNames, HGLOBAL hDevMode) return hDC; } +#pragma warning(push) +#pragma warning(disable: 4512) // assignment operator could not be generated + template class ATL_NO_VTABLE CPrintDialogImpl : public CCommonDialogImplBase { @@ -2214,6 +2179,15 @@ class ATL_NO_VTABLE CPrintDialogImpl : public CCommonDialogImplBase m_pd.hwndOwner = hWndParent; ATLASSERT(m_hWnd == NULL); + + // Allocate the thunk structure here, where we can fail gracefully. + BOOL bRetTh = m_thunk.Init(NULL, NULL); + if(bRetTh == FALSE) + { + ::SetLastError(ERROR_OUTOFMEMORY); + return -1; + } + ModuleHelper::AddCreateWndData(&m_thunk.cd, (CCommonDialogImplBase*)this); BOOL bRet = ::PrintDlg(&m_pd); @@ -2377,14 +2351,12 @@ class CPrintDialog : public CPrintDialogImpl { } }; -#endif // _WIN32_WCE +#pragma warning(pop) /////////////////////////////////////////////////////////////////////////////// // CPrintDialogExImpl - new print dialog for Windows 2000 -#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) - }; // namespace WTL #include @@ -2449,11 +2421,17 @@ class ATL_NO_VTABLE CPrintDialogExImpl : // GetDefaults will not display a dialog but will get device defaults HRESULT GetDefaults() { - m_pdex.Flags |= PD_RETURNDEFAULT; ATLASSERT(m_pdex.hDevMode == NULL); // must be NULL ATLASSERT(m_pdex.hDevNames == NULL); // must be NULL - return ::PrintDlgEx(&m_pdex); + if(m_pdex.hwndOwner == NULL) // set only if not specified before + m_pdex.hwndOwner = ::GetActiveWindow(); + + m_pdex.Flags |= PD_RETURNDEFAULT; + HRESULT hRet = ::PrintDlgEx(&m_pdex); + m_pdex.Flags &= ~PD_RETURNDEFAULT; + + return hRet; } // Helpers for parsing information after successful return num. copies requested @@ -2608,10 +2586,10 @@ class ATL_NO_VTABLE CPrintDialogExImpl : // call message map HRESULT hRet = ProcessWindowMessage(hWnd, uMsg, wParam, lParam, *plResult, 0) ? S_OK : S_FALSE; - if(hRet == S_OK && uMsg == WM_NOTIFY) // return in DWLP_MSGRESULT + if((hRet == S_OK) && (uMsg == WM_NOTIFY)) // return in DWLP_MSGRESULT ::SetWindowLongPtr(GetParent(), DWLP_MSGRESULT, (LONG_PTR)*plResult); - if(uMsg == WM_INITDIALOG && hRet == S_OK && (BOOL)*plResult != FALSE) + if((uMsg == WM_INITDIALOG) && (hRet == S_OK) && ((BOOL)*plResult != FALSE)) hRet = S_FALSE; return hRet; @@ -2630,14 +2608,10 @@ class CPrintDialogEx : public CPrintDialogExImpl DECLARE_EMPTY_MSG_MAP() }; -#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) - /////////////////////////////////////////////////////////////////////////////// // CPageSetupDialogImpl - Page Setup dialog -#ifndef _WIN32_WCE - template class ATL_NO_VTABLE CPageSetupDialogImpl : public CCommonDialogImplBase { @@ -2655,11 +2629,7 @@ class ATL_NO_VTABLE CPageSetupDialogImpl : public CCommonDialogImplBase m_psd.Flags = (dwFlags | PSD_ENABLEPAGESETUPHOOK | PSD_ENABLEPAGEPAINTHOOK); m_psd.lpfnPageSetupHook = (LPPAGESETUPHOOK)T::HookProc; m_thunkPaint.Init((WNDPROC)T::PaintHookProc, this); -#if (_ATL_VER >= 0x0700) m_psd.lpfnPagePaintHook = (LPPAGEPAINTHOOK)m_thunkPaint.GetWNDPROC(); -#else - m_psd.lpfnPagePaintHook = (LPPAGEPAINTHOOK)&(m_thunkPaint.thunk); -#endif } DECLARE_EMPTY_MSG_MAP() @@ -2707,9 +2677,7 @@ class ATL_NO_VTABLE CPageSetupDialogImpl : public CCommonDialogImplBase SIZE GetPaperSize() const { - SIZE size; - size.cx = m_psd.ptPaperSize.x; - size.cy = m_psd.ptPaperSize.y; + SIZE size = { m_psd.ptPaperSize.x, m_psd.ptPaperSize.y }; return size; } @@ -2733,6 +2701,15 @@ class ATL_NO_VTABLE CPageSetupDialogImpl : public CCommonDialogImplBase m_psd.hwndOwner = hWndParent; ATLASSERT(m_hWnd == NULL); + + // Allocate the thunk structure here, where we can fail gracefully. + BOOL bRetTh = m_thunk.Init(NULL, NULL); + if(bRetTh == FALSE) + { + ::SetLastError(ERROR_OUTOFMEMORY); + return -1; + } + ModuleHelper::AddCreateWndData(&m_thunk.cd, (CCommonDialogImplBase*)this); BOOL bRet = ::PageSetupDlg(&m_psd); @@ -2794,14 +2771,10 @@ class CPageSetupDialog : public CPageSetupDialogImpl } }; -#endif // _WIN32_WCE - /////////////////////////////////////////////////////////////////////////////// // CFindReplaceDialogImpl - Find/FindReplace modeless dialogs -#ifndef _WIN32_WCE - template class ATL_NO_VTABLE CFindReplaceDialogImpl : public CCommonDialogImplBase { @@ -2853,12 +2826,21 @@ class ATL_NO_VTABLE CFindReplaceDialogImpl : public CCommonDialogImplBase ATLASSERT(m_fr.hwndOwner != NULL); // must have an owner for modeless dialog if(lpszFindWhat != NULL) - SecureHelper::strncpy_x(m_szFindWhat, _countof(m_szFindWhat), lpszFindWhat, _TRUNCATE); + ATL::Checked::tcsncpy_s(m_szFindWhat, _countof(m_szFindWhat), lpszFindWhat, _TRUNCATE); if(lpszReplaceWith != NULL) - SecureHelper::strncpy_x(m_szReplaceWith, _countof(m_szReplaceWith), lpszReplaceWith, _TRUNCATE); + ATL::Checked::tcsncpy_s(m_szReplaceWith, _countof(m_szReplaceWith), lpszReplaceWith, _TRUNCATE); ATLASSERT(m_hWnd == NULL); + + // Allocate the thunk structure here, where we can fail gracefully. + BOOL bRet = m_thunk.Init(NULL, NULL); + if(bRet == FALSE) + { + ::SetLastError(ERROR_OUTOFMEMORY); + return NULL; + } + ModuleHelper::AddCreateWndData(&m_thunk.cd, (CCommonDialogImplBase*)this); HWND hWnd = NULL; @@ -2939,8 +2921,6 @@ class CFindReplaceDialog : public CFindReplaceDialogImpl DECLARE_EMPTY_MSG_MAP() }; -#endif // !_WIN32_WCE - ///////////////////////////////////////////////////////////////////////// // CDialogBaseUnits - Dialog Units helper @@ -3048,7 +3028,7 @@ class CDialogBaseUnits return out; } - RECT MapDialogPixels(RECT input) const + RECT MapDialogPixels(const RECT& input) const { RECT out = { MapDialogPixelsX(input.left), MapDialogPixelsY(input.top), MapDialogPixelsX(input.right), MapDialogPixelsY(input.bottom) }; return out; @@ -3061,7 +3041,7 @@ class CDialogBaseUnits INT MapDialogUnitsY(INT y) const { - return ::MulDiv(y, m_sizeUnits.cx, 8); // DLU to Pixels Y + return ::MulDiv(y, m_sizeUnits.cy, 8); // DLU to Pixels Y } POINT MapDialogUnits(POINT pt) const @@ -3076,7 +3056,7 @@ class CDialogBaseUnits return out; } - RECT MapDialogUnits(RECT input) const + RECT MapDialogUnits(const RECT& input) const { RECT out = { MapDialogUnitsX(input.left), MapDialogUnitsY(input.top), MapDialogUnitsX(input.right), MapDialogUnitsY(input.bottom) }; return out; @@ -3087,30 +3067,13 @@ class CDialogBaseUnits /////////////////////////////////////////////////////////////////////////////// // CMemDlgTemplate - in-memory dialog template - DLGTEMPLATE or DLGTEMPLATEEX -#if (_ATL_VER >= 0x800) - typedef ATL::_DialogSplitHelper::DLGTEMPLATEEX DLGTEMPLATEEX; - typedef ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX DLGITEMTEMPLATEEX; -#else // (_ATL_VER >= 0x800) - typedef ATL::_DialogSizeHelper::_ATL_DLGTEMPLATEEX DLGTEMPLATEEX; - #pragma pack(push, 4) - struct DLGITEMTEMPLATEEX - { - DWORD helpID; - DWORD exStyle; - DWORD style; - short x; - short y; - short cx; - short cy; - DWORD id; - }; - #pragma pack(pop) -#endif // (_ATL_VER >= 0x800) - - -class CMemDlgTemplate +template +class CMemDlgTemplateT { public: + typedef ATL::_DialogSplitHelper::DLGTEMPLATEEX DLGTEMPLATEEX; + typedef ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX DLGITEMTEMPLATEEX; + enum StdCtrlType { CTRL_BUTTON = 0x0080, @@ -3121,10 +3084,15 @@ class CMemDlgTemplate CTRL_COMBOBOX = 0x0085 }; - CMemDlgTemplate() : m_hData(NULL), m_pData(NULL), m_pPtr(NULL), m_cAllocated(0) + HANDLE m_hData; + LPBYTE m_pData; + LPBYTE m_pPtr; + SIZE_T m_cAllocated; + + CMemDlgTemplateT() : m_hData(NULL), m_pData(NULL), m_pPtr(NULL), m_cAllocated(0) { } - ~CMemDlgTemplate() + ~CMemDlgTemplateT() { Reset(); } @@ -3151,10 +3119,9 @@ class CMemDlgTemplate void Reset() { - if (IsValid()) { -#ifndef UNDER_CE + if (IsValid()) + { ::GlobalUnlock(m_pData); -#endif ATLVERIFY(::GlobalFree(m_hData) == NULL); } @@ -3164,17 +3131,17 @@ class CMemDlgTemplate m_cAllocated = 0; } - void Create(bool bDlgEx, LPCTSTR lpszCaption, RECT rc, DWORD dwStyle = 0, DWORD dwExStyle = 0, - LPCTSTR lpstrFontName = NULL, WORD wFontSize = 0, WORD wWeight = 0, BYTE bItalic = 0, BYTE bCharset = 0, DWORD dwHelpID = 0, - ATL::_U_STRINGorID ClassName = 0U, ATL::_U_STRINGorID Menu = 0U) + void Create(bool bDlgEx, LPCTSTR lpszCaption, const RECT& rc, DWORD dwStyle = 0, DWORD dwExStyle = 0, + LPCTSTR lpstrFontName = NULL, WORD wFontSize = 0, WORD wWeight = 0, BYTE bItalic = 0, BYTE bCharset = 0, DWORD dwHelpID = 0, + ATL::_U_STRINGorID ClassName = 0U, ATL::_U_STRINGorID Menu = 0U) { Create(bDlgEx, lpszCaption, (short) rc.left, (short) rc.top, (short) (rc.right - rc.left), (short) (rc.bottom - rc.top), dwStyle, dwExStyle, lpstrFontName, wFontSize, wWeight, bItalic, bCharset, dwHelpID, ClassName.m_lpstr, Menu.m_lpstr); } void Create(bool bDlgEx, LPCTSTR lpszCaption, short nX, short nY, short nWidth, short nHeight, DWORD dwStyle = 0, DWORD dwExStyle = 0, - LPCTSTR lpstrFontName = NULL, WORD wFontSize = 0, WORD wWeight = 0, BYTE bItalic = 0, BYTE bCharset = 0, DWORD dwHelpID = 0, - ATL::_U_STRINGorID ClassName = 0U, ATL::_U_STRINGorID Menu = 0U) + LPCTSTR lpstrFontName = NULL, WORD wFontSize = 0, WORD wWeight = 0, BYTE bItalic = 0, BYTE bCharset = 0, DWORD dwHelpID = 0, + ATL::_U_STRINGorID ClassName = 0U, ATL::_U_STRINGorID Menu = 0U) { // Should have DS_SETFONT style to set the dialog font name and size if (lpstrFontName != NULL) @@ -3197,7 +3164,6 @@ class CMemDlgTemplate AddData(&dlg, sizeof(dlg)); } -#ifndef _WIN32_WCE if (Menu.m_lpstr == NULL) { WORD menuData = 0; @@ -3205,20 +3171,13 @@ class CMemDlgTemplate } else if (IS_INTRESOURCE(Menu.m_lpstr)) { - WORD menuData[] = {0xFFFF, (WORD)Menu.m_lpstr}; + WORD menuData[] = { 0xFFFF, LOWORD(Menu.m_lpstr) }; AddData(menuData, sizeof(menuData)); } else { AddString(Menu.m_lpstr); } -#else // _WIN32_WCE - // Windows CE doesn't support the addition of menus to a dialog box - ATLASSERT(Menu.m_lpstr == NULL); - Menu.m_lpstr; // avoid level 4 warning - WORD menuData = 0; - AddData(&menuData, sizeof(WORD)); -#endif // _WIN32_WCE if (ClassName.m_lpstr == NULL) { @@ -3227,7 +3186,7 @@ class CMemDlgTemplate } else if (IS_INTRESOURCE(ClassName.m_lpstr)) { - WORD classData[] = {0xFFFF, (WORD)ClassName.m_lpstr}; + WORD classData[] = { 0xFFFF, LOWORD(ClassName.m_lpstr) }; AddData(classData, sizeof(classData)); } else @@ -3253,7 +3212,7 @@ class CMemDlgTemplate } } - void AddControl(ATL::_U_STRINGorID ClassName, WORD wId, RECT rc, DWORD dwStyle, DWORD dwExStyle, + void AddControl(ATL::_U_STRINGorID ClassName, WORD wId, const RECT& rc, DWORD dwStyle, DWORD dwExStyle, ATL::_U_STRINGorID Text, const WORD* pCreationData = NULL, WORD nCreationData = 0, DWORD dwHelpID = 0) { AddControl(ClassName.m_lpstr, wId, (short) rc.left, (short) rc.top, (short) (rc.right - rc.left), (short) (rc.bottom - rc.top), dwStyle, dwExStyle, @@ -3266,14 +3225,15 @@ class CMemDlgTemplate ATLASSERT(IsValid()); // DWORD align data - m_pPtr = (LPBYTE)(DWORD_PTR)((DWORD)(DWORD_PTR)(m_pPtr + 3) & (~3)); + const DWORD_PTR dwDwordAlignBits = sizeof(DWORD) - 1; + m_pPtr = (LPBYTE)(((DWORD_PTR)m_pPtr + dwDwordAlignBits) & (~dwDwordAlignBits)); if (IsTemplateEx()) { DLGTEMPLATEEX* dlg = (DLGTEMPLATEEX*)m_pData; dlg->cDlgItems++; - DLGITEMTEMPLATEEX item = {dwHelpID, ATL::CControlWinTraits::GetWndExStyle(0) | dwExStyle, ATL::CControlWinTraits::GetWndStyle(0) | dwStyle, nX, nY, nWidth, nHeight, wId}; + DLGITEMTEMPLATEEX item = {dwHelpID, TWinTraits::GetWndExStyle(0) | dwExStyle, TWinTraits::GetWndStyle(0) | dwStyle, nX, nY, nWidth, nHeight, wId}; AddData(&item, sizeof(item)); } else @@ -3281,14 +3241,14 @@ class CMemDlgTemplate LPDLGTEMPLATE dlg = (LPDLGTEMPLATE)m_pData; dlg->cdit++; - DLGITEMTEMPLATE item = {ATL::CControlWinTraits::GetWndStyle(0) | dwStyle, ATL::CControlWinTraits::GetWndExStyle(0) | dwExStyle, nX, nY, nWidth, nHeight, wId}; + DLGITEMTEMPLATE item = {TWinTraits::GetWndStyle(0) | dwStyle, TWinTraits::GetWndExStyle(0) | dwExStyle, nX, nY, nWidth, nHeight, wId}; AddData(&item, sizeof(item)); } ATLASSERT(ClassName.m_lpstr != NULL); if (IS_INTRESOURCE(ClassName.m_lpstr)) { - WORD wData[] = {0xFFFF, (WORD)ClassName.m_lpstr}; + WORD wData[] = { 0xFFFF, LOWORD(ClassName.m_lpstr) }; AddData(wData, sizeof(wData)); } else @@ -3303,7 +3263,7 @@ class CMemDlgTemplate } else if (IS_INTRESOURCE(Text.m_lpstr)) { - WORD wData[] = {0xFFFF, (WORD)Text.m_lpstr}; + WORD wData[] = { 0xFFFF, LOWORD(Text.m_lpstr) }; AddData(wData, sizeof(wData)); } else @@ -3337,32 +3297,22 @@ class CMemDlgTemplate m_cAllocated = ((nData / ALLOCATION_INCREMENT) + 1) * ALLOCATION_INCREMENT; m_hData = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, m_cAllocated); ATLASSERT(m_hData != NULL); -#ifndef UNDER_CE m_pPtr = m_pData = static_cast(::GlobalLock(m_hData)); -#else - m_pPtr = m_pData = static_cast(m_hData); -#endif ATLASSERT(m_pData != NULL); } else if (((m_pPtr - m_pData) + nData) > m_cAllocated) { SIZE_T ptrPos = (m_pPtr - m_pData); m_cAllocated += ((nData / ALLOCATION_INCREMENT) + 1) * ALLOCATION_INCREMENT; -#ifndef UNDER_CE ::GlobalUnlock(m_pData); -#endif m_hData = ::GlobalReAlloc(m_hData, m_cAllocated, GMEM_MOVEABLE | GMEM_ZEROINIT); ATLASSERT(m_hData != NULL); -#ifndef UNDER_CE m_pData = static_cast(::GlobalLock(m_hData)); -#else - m_pData = static_cast(m_hData); -#endif ATLASSERT(m_pData != NULL); m_pPtr = m_pData + ptrPos; } - SecureHelper::memcpy_x(m_pPtr, m_cAllocated - (m_pPtr - m_pData), pData, nData); + ATL::Checked::memcpy_s(m_pPtr, m_cAllocated - (m_pPtr - m_pData), pData, nData); m_pPtr += nData; } @@ -3382,13 +3332,10 @@ class CMemDlgTemplate AddData(lpstr, nSize * sizeof(WCHAR)); } } - - HANDLE m_hData; - LPBYTE m_pData; - LPBYTE m_pPtr; - SIZE_T m_cAllocated; }; +typedef CMemDlgTemplateT CMemDlgTemplate; + /////////////////////////////////////////////////////////////////////////////// // Dialog and control macros for indirect dialogs @@ -3463,43 +3410,41 @@ class CMemDlgTemplate #define CONTROL_LTEXT(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_STATIC, (WORD)id, x, y, width, height, style | SS_LEFT | WS_GROUP, exStyle, text, NULL, 0); + m_Template.AddStdControl(m_Template.CTRL_STATIC, (WORD)id, x, y, width, height, style | SS_LEFT | WS_GROUP, exStyle, text, NULL, 0); #define CONTROL_CTEXT(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_STATIC, (WORD)id, x, y, width, height, style | SS_CENTER | WS_GROUP, exStyle, text, NULL, 0); + m_Template.AddStdControl(m_Template.CTRL_STATIC, (WORD)id, x, y, width, height, style | SS_CENTER | WS_GROUP, exStyle, text, NULL, 0); #define CONTROL_RTEXT(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_STATIC, (WORD)id, x, y, width, height, style | SS_RIGHT | WS_GROUP, exStyle, text, NULL, 0); + m_Template.AddStdControl(m_Template.CTRL_STATIC, (WORD)id, x, y, width, height, style | SS_RIGHT | WS_GROUP, exStyle, text, NULL, 0); #define CONTROL_PUSHBUTTON(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_PUSHBUTTON | WS_TABSTOP, exStyle, text, NULL, 0); + m_Template.AddStdControl(m_Template.CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_PUSHBUTTON | WS_TABSTOP, exStyle, text, NULL, 0); #define CONTROL_DEFPUSHBUTTON(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_DEFPUSHBUTTON | WS_TABSTOP, exStyle, text, NULL, 0); -#ifndef _WIN32_WCE + m_Template.AddStdControl(m_Template.CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_DEFPUSHBUTTON | WS_TABSTOP, exStyle, text, NULL, 0); #define CONTROL_PUSHBOX(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_PUSHBOX | WS_TABSTOP, exStyle, text, NULL, 0); -#endif // !_WIN32_WCE + m_Template.AddStdControl(m_Template.CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_PUSHBOX | WS_TABSTOP, exStyle, text, NULL, 0); #define CONTROL_STATE3(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_3STATE | WS_TABSTOP, exStyle, text, NULL, 0); + m_Template.AddStdControl(m_Template.CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_3STATE | WS_TABSTOP, exStyle, text, NULL, 0); #define CONTROL_AUTO3STATE(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_AUTO3STATE | WS_TABSTOP, exStyle, text, NULL, 0); + m_Template.AddStdControl(m_Template.CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_AUTO3STATE | WS_TABSTOP, exStyle, text, NULL, 0); #define CONTROL_CHECKBOX(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_CHECKBOX | WS_TABSTOP, exStyle, text, NULL, 0); + m_Template.AddStdControl(m_Template.CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_CHECKBOX | WS_TABSTOP, exStyle, text, NULL, 0); #define CONTROL_AUTOCHECKBOX(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_AUTOCHECKBOX | WS_TABSTOP, exStyle, text, NULL, 0); + m_Template.AddStdControl(m_Template.CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_AUTOCHECKBOX | WS_TABSTOP, exStyle, text, NULL, 0); #define CONTROL_RADIOBUTTON(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_RADIOBUTTON | WS_TABSTOP, exStyle, text, NULL, 0); + m_Template.AddStdControl(m_Template.CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_RADIOBUTTON | WS_TABSTOP, exStyle, text, NULL, 0); #define CONTROL_AUTORADIOBUTTON(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_AUTORADIOBUTTON | WS_TABSTOP, exStyle, text, NULL, 0); + m_Template.AddStdControl(m_Template.CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_AUTORADIOBUTTON | WS_TABSTOP, exStyle, text, NULL, 0); #define CONTROL_COMBOBOX(id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_COMBOBOX, (WORD)id, x, y, width, height, style | CBS_DROPDOWN | WS_TABSTOP, exStyle, (LPCTSTR)NULL, NULL, 0); + m_Template.AddStdControl(m_Template.CTRL_COMBOBOX, (WORD)id, x, y, width, height, style | CBS_DROPDOWN | WS_TABSTOP, exStyle, (LPCTSTR)NULL, NULL, 0); #define CONTROL_EDITTEXT(id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_EDIT, (WORD)id, x, y, width, height, style | ES_LEFT | WS_BORDER | WS_TABSTOP, exStyle, (LPCTSTR)NULL, NULL, 0); + m_Template.AddStdControl(m_Template.CTRL_EDIT, (WORD)id, x, y, width, height, style | ES_LEFT | WS_BORDER | WS_TABSTOP, exStyle, (LPCTSTR)NULL, NULL, 0); #define CONTROL_GROUPBOX(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_GROUPBOX, exStyle, text, NULL, 0); + m_Template.AddStdControl(m_Template.CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_GROUPBOX, exStyle, text, NULL, 0); #define CONTROL_LISTBOX(id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_LISTBOX, (WORD)id, x, y, width, height, style | LBS_NOTIFY | WS_BORDER, exStyle, (LPCTSTR)NULL, NULL, 0); + m_Template.AddStdControl(m_Template.CTRL_LISTBOX, (WORD)id, x, y, width, height, style | LBS_NOTIFY | WS_BORDER, exStyle, (LPCTSTR)NULL, NULL, 0); #define CONTROL_SCROLLBAR(id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_SCROLLBAR, (WORD)id, x, y, width, height, style | SBS_HORZ, exStyle, (LPCTSTR)NULL, NULL, 0); + m_Template.AddStdControl(m_Template.CTRL_SCROLLBAR, (WORD)id, x, y, width, height, style | SBS_HORZ, exStyle, (LPCTSTR)NULL, NULL, 0); #define CONTROL_ICON(text, id, x, y, width, height, style, exStyle) \ - m_Template.AddStdControl(WTL::CMemDlgTemplate::CTRL_STATIC, (WORD)id, x, y, width, height, style | SS_ICON, exStyle, text, NULL, 0); + m_Template.AddStdControl(m_Template.CTRL_STATIC, (WORD)id, x, y, width, height, style | SS_ICON, exStyle, text, NULL, 0); #define CONTROL_CONTROL(text, id, className, style, x, y, width, height, exStyle) \ m_Template.AddControl(className, (WORD)id, x, y, width, height, style, exStyle, text, NULL, 0); @@ -3507,8 +3452,8 @@ class CMemDlgTemplate /////////////////////////////////////////////////////////////////////////////// // CIndirectDialogImpl - dialogs with template in memory -template > -class ATL_NO_VTABLE CIndirectDialogImpl : public TBase +template +class ATL_NO_VTABLE CIndirectDialogImpl : public ATL::CDialogImpl< T, TBase > { public: enum { IDD = 0 }; // no dialog template resource @@ -3527,23 +3472,21 @@ class ATL_NO_VTABLE CIndirectDialogImpl : public TBase T* pT = static_cast(this); ATLASSERT(pT->m_hWnd == NULL); - if (!m_Template.IsValid()) + if(!m_Template.IsValid()) CreateTemplate(); -#if (_ATL_VER >= 0x0800) // Allocate the thunk structure here, where we can fail gracefully. - BOOL result = m_thunk.Init(NULL, NULL); - if (result == FALSE) + BOOL bRet = this->m_thunk.Init(NULL, NULL); + if(bRet == FALSE) { - SetLastError(ERROR_OUTOFMEMORY); + ::SetLastError(ERROR_OUTOFMEMORY); return -1; } -#endif // (_ATL_VER >= 0x0800) - ModuleHelper::AddCreateWndData(&m_thunk.cd, pT); + ModuleHelper::AddCreateWndData(&this->m_thunk.cd, (ATL::CDialogImplBaseT< TBase >*)pT); #ifdef _DEBUG - m_bModal = true; + this->m_bModal = true; #endif // _DEBUG return ::DialogBoxIndirectParam(ModuleHelper::GetResourceInstance(), m_Template.GetTemplatePtr(), hWndParent, (DLGPROC)T::StartDialogProc, dwInitParam); @@ -3554,27 +3497,25 @@ class ATL_NO_VTABLE CIndirectDialogImpl : public TBase T* pT = static_cast(this); ATLASSERT(pT->m_hWnd == NULL); - if (!m_Template.IsValid()) + if(!m_Template.IsValid()) CreateTemplate(); -#if (_ATL_VER >= 0x0800) // Allocate the thunk structure here, where we can fail gracefully. - BOOL result = m_thunk.Init(NULL, NULL); - if (result == FALSE) + BOOL bRet = this->m_thunk.Init(NULL, NULL); + if(bRet == FALSE) { - SetLastError(ERROR_OUTOFMEMORY); + ::SetLastError(ERROR_OUTOFMEMORY); return NULL; } -#endif // (_ATL_VER >= 0x0800) - ModuleHelper::AddCreateWndData(&m_thunk.cd, pT); + ModuleHelper::AddCreateWndData(&this->m_thunk.cd, (ATL::CDialogImplBaseT< TBase >*)pT); #ifdef _DEBUG - m_bModal = false; + this->m_bModal = false; #endif // _DEBUG HWND hWnd = ::CreateDialogIndirectParam(ModuleHelper::GetResourceInstance(), (LPCDLGTEMPLATE)m_Template.GetTemplatePtr(), hWndParent, (DLGPROC)T::StartDialogProc, dwInitParam); - ATLASSERT(m_hWnd == hWnd); + ATLASSERT(this->m_hWnd == hWnd); return hWnd; } @@ -3596,6 +3537,7 @@ class ATL_NO_VTABLE CIndirectDialogImpl : public TBase } }; + /////////////////////////////////////////////////////////////////////////////// // CPropertySheetWindow - client side for a property sheet @@ -3698,7 +3640,6 @@ class CPropertySheetWindow : public ATL::CWindow return (BOOL)::SendMessage(m_hWnd, PSM_ADDPAGE, 0, (LPARAM)hPage); } -#ifndef _WIN32_WCE BOOL InsertPage(int nNewPageIndex, HPROPSHEETPAGE hPage) { ATLASSERT(::IsWindow(m_hWnd)); @@ -3732,7 +3673,6 @@ class CPropertySheetWindow : public ATL::CWindow return FALSE; return (BOOL)::SendMessage(m_hWnd, PSM_INSERTPAGE, (WPARAM)hPageInsertAfter, (LPARAM)hPage); } -#endif // !_WIN32_WCE void RemovePage(int nPageIndex) { @@ -3797,7 +3737,6 @@ class CPropertySheetWindow : public ATL::CWindow return (BOOL)::SendMessage(m_hWnd, PSM_ISDIALOGMESSAGE, 0, (LPARAM)lpMsg); } -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) int HwndToIndex(HWND hWnd) const { ATLASSERT(::IsWindow(m_hWnd)); @@ -3857,7 +3796,6 @@ class CPropertySheetWindow : public ATL::CWindow ATLASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, PSM_SETHEADERSUBTITLE, nIndex, (LPARAM)lpstrHeaderSubTitle); } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) // Implementation - override to prevent usage HWND Create(LPCTSTR, HWND, ATL::_U_RECT = NULL, LPCTSTR = NULL, DWORD = 0, DWORD = 0, ATL::_U_MENUorID = 0U, LPVOID = NULL) @@ -3877,15 +3815,6 @@ class ATL_NO_VTABLE CPropertySheetImpl : public ATL::CWindowImplBaseT< TBase > PROPSHEETHEADER m_psh; ATL::CSimpleArray m_arrPages; -#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC specific - #ifndef PROPSHEET_LINK_SIZE - #define PROPSHEET_LINK_SIZE 128 - #endif // PROPSHEET_LINK_SIZE - TCHAR m_szLink[PROPSHEET_LINK_SIZE]; - static LPCTSTR m_pszTitle; - static LPCTSTR m_pszLink; -#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) - // Construction/Destruction CPropertySheetImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uStartPage = 0, HWND hWndParent = NULL) { @@ -3899,11 +3828,6 @@ class ATL_NO_VTABLE CPropertySheetImpl : public ATL::CWindowImplBaseT< TBase > m_psh.nStartPage = uStartPage; m_psh.hwndParent = hWndParent; // if NULL, will be set in DoModal/Create m_psh.pfnCallback = T::PropSheetCallback; - -#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC specific - m_psh.dwFlags |= PSH_MAXIMIZE; - m_szLink[0] = 0; -#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) } ~CPropertySheetImpl() @@ -3930,41 +3854,8 @@ class ATL_NO_VTABLE CPropertySheetImpl : public ATL::CWindowImplBaseT< TBase > // remove page handles array pT->_CleanUpPages(); -#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC specific - m_pszTitle = pT->m_psh.pszCaption; - if(*pT->m_szLink != 0) - m_pszLink = pT->m_szLink; -#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC specific - pT->OnSheetInitialized(); } -#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC specific uMsg - else - { - switch(uMsg) - { - case PSCB_GETVERSION : - nRet = COMCTL32_VERSION; - break; - case PSCB_GETTITLE : - if(m_pszTitle != NULL) - { - lstrcpy((LPTSTR)lParam, m_pszTitle); - m_pszTitle = NULL; - } - break; - case PSCB_GETLINKTEXT: - if(m_pszLink != NULL) - { - lstrcpy((LPTSTR)lParam, m_pszLink); - m_pszLink = NULL; - } - break; - default: - break; - } - } -#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) return nRet; } @@ -3976,7 +3867,7 @@ class ATL_NO_VTABLE CPropertySheetImpl : public ATL::CWindowImplBaseT< TBase > // Create method HWND Create(HWND hWndParent = NULL) { - ATLASSERT(m_hWnd == NULL); + ATLASSERT(this->m_hWnd == NULL); m_psh.dwFlags |= PSH_MODELESS; if(m_psh.hwndParent == NULL) @@ -3985,19 +3876,28 @@ class ATL_NO_VTABLE CPropertySheetImpl : public ATL::CWindowImplBaseT< TBase > m_psh.nPages = m_arrPages.GetSize(); T* pT = static_cast(this); + + // Allocate the thunk structure here, where we can fail gracefully. + BOOL bRet = pT->m_thunk.Init(NULL, NULL); + if(bRet == FALSE) + { + ::SetLastError(ERROR_OUTOFMEMORY); + return NULL; + } + ModuleHelper::AddCreateWndData(&pT->m_thunk.cd, pT); HWND hWnd = (HWND)::PropertySheet(&m_psh); _CleanUpPages(); // ensure clean-up, required if call failed - ATLASSERT(m_hWnd == hWnd); + ATLASSERT(this->m_hWnd == hWnd); return hWnd; } INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) { - ATLASSERT(m_hWnd == NULL); + ATLASSERT(this->m_hWnd == NULL); m_psh.dwFlags &= ~PSH_MODELESS; if(m_psh.hwndParent == NULL) @@ -4006,6 +3906,15 @@ class ATL_NO_VTABLE CPropertySheetImpl : public ATL::CWindowImplBaseT< TBase > m_psh.nPages = m_arrPages.GetSize(); T* pT = static_cast(this); + + // Allocate the thunk structure here, where we can fail gracefully. + BOOL bRet = pT->m_thunk.Init(NULL, NULL); + if(bRet == FALSE) + { + ::SetLastError(ERROR_OUTOFMEMORY); + return -1; + } + ModuleHelper::AddCreateWndData(&pT->m_thunk.cd, pT); INT_PTR nRet = ::PropertySheet(&m_psh); @@ -4027,35 +3936,35 @@ class ATL_NO_VTABLE CPropertySheetImpl : public ATL::CWindowImplBaseT< TBase > // Note: Calling these after the sheet is created gives unpredictable results int GetPageCount() const { - if(m_hWnd == NULL) // not created yet + if(this->m_hWnd == NULL) // not created yet return m_arrPages.GetSize(); return TBase::GetPageCount(); } int GetActiveIndex() const { - if(m_hWnd == NULL) // not created yet + if(this->m_hWnd == NULL) // not created yet return m_psh.nStartPage; return TBase::GetActiveIndex(); } HPROPSHEETPAGE GetPage(int nPageIndex) const { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created + ATLASSERT(this->m_hWnd == NULL); // can't do this after it's created return (HPROPSHEETPAGE)m_arrPages[nPageIndex]; } int GetPageIndex(HPROPSHEETPAGE hPage) const { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created + ATLASSERT(this->m_hWnd == NULL); // can't do this after it's created return m_arrPages.Find((HPROPSHEETPAGE&)hPage); } BOOL SetActivePage(int nPageIndex) { - if(m_hWnd == NULL) // not created yet + if(this->m_hWnd == NULL) // not created yet { - ATLASSERT(nPageIndex >= 0 && nPageIndex < m_arrPages.GetSize()); + ATLASSERT((nPageIndex >= 0) && (nPageIndex < m_arrPages.GetSize())); m_psh.nStartPage = nPageIndex; return TRUE; } @@ -4065,7 +3974,7 @@ class ATL_NO_VTABLE CPropertySheetImpl : public ATL::CWindowImplBaseT< TBase > BOOL SetActivePage(HPROPSHEETPAGE hPage) { ATLASSERT(hPage != NULL); - if (m_hWnd == NULL) // not created yet + if(this->m_hWnd == NULL) // not created yet { int nPageIndex = GetPageIndex(hPage); if(nPageIndex == -1) @@ -4082,7 +3991,7 @@ class ATL_NO_VTABLE CPropertySheetImpl : public ATL::CWindowImplBaseT< TBase > ATLASSERT((nStyle & ~PSH_PROPTITLE) == 0); // only PSH_PROPTITLE is valid ATLASSERT(lpszText != NULL); - if(m_hWnd == NULL) + if(this->m_hWnd == NULL) { // set internal state m_psh.pszCaption = lpszText; // must exist until sheet is created @@ -4096,15 +4005,6 @@ class ATL_NO_VTABLE CPropertySheetImpl : public ATL::CWindowImplBaseT< TBase > } } -#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC specific Link field - void SetLinkText(LPCTSTR lpszText) - { - ATLASSERT(lpszText != NULL); - ATLASSERT(lstrlen(lpszText) < PROPSHEET_LINK_SIZE); - lstrcpy(m_szLink, lpszText); - } -#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) - void SetWizardMode() { m_psh.dwFlags |= PSH_WIZARD; @@ -4120,7 +4020,7 @@ class ATL_NO_VTABLE CPropertySheetImpl : public ATL::CWindowImplBaseT< TBase > { ATLASSERT(hPage != NULL); BOOL bRet = FALSE; - if(m_hWnd != NULL) + if(this->m_hWnd != NULL) bRet = TBase::AddPage(hPage); else // sheet not created yet, use internal data bRet = m_arrPages.Add((HPROPSHEETPAGE&)hPage); @@ -4142,7 +4042,7 @@ class ATL_NO_VTABLE CPropertySheetImpl : public ATL::CWindowImplBaseT< TBase > BOOL RemovePage(HPROPSHEETPAGE hPage) { ATLASSERT(hPage != NULL); - if (m_hWnd == NULL) // not created yet + if(this->m_hWnd == NULL) // not created yet { int nPage = GetPageIndex(hPage); if(nPage == -1) @@ -4157,17 +4057,16 @@ class ATL_NO_VTABLE CPropertySheetImpl : public ATL::CWindowImplBaseT< TBase > BOOL RemovePage(int nPageIndex) { BOOL bRet = TRUE; - if(m_hWnd != NULL) + if(this->m_hWnd != NULL) TBase::RemovePage(nPageIndex); else // sheet not created yet, use internal data bRet = m_arrPages.RemoveAt(nPageIndex); return bRet; } -#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) void SetHeader(LPCTSTR szbmHeader) { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created + ATLASSERT(this->m_hWnd == NULL); // can't do this after it's created m_psh.dwFlags &= ~PSH_WIZARD; m_psh.dwFlags |= (PSH_HEADER | PSH_WIZARD97); @@ -4176,7 +4075,7 @@ class ATL_NO_VTABLE CPropertySheetImpl : public ATL::CWindowImplBaseT< TBase > void SetHeader(HBITMAP hbmHeader) { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created + ATLASSERT(this->m_hWnd == NULL); // can't do this after it's created m_psh.dwFlags &= ~PSH_WIZARD; m_psh.dwFlags |= (PSH_HEADER | PSH_USEHBMHEADER | PSH_WIZARD97); @@ -4185,13 +4084,13 @@ class ATL_NO_VTABLE CPropertySheetImpl : public ATL::CWindowImplBaseT< TBase > void SetWatermark(LPCTSTR szbmWatermark, HPALETTE hplWatermark = NULL) { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created + ATLASSERT(this->m_hWnd == NULL); // can't do this after it's created m_psh.dwFlags &= ~PSH_WIZARD; m_psh.dwFlags |= PSH_WATERMARK | PSH_WIZARD97; m_psh.pszbmWatermark = szbmWatermark; - if (hplWatermark != NULL) + if(hplWatermark != NULL) { m_psh.dwFlags |= PSH_USEHPLWATERMARK; m_psh.hplWatermark = hplWatermark; @@ -4200,13 +4099,13 @@ class ATL_NO_VTABLE CPropertySheetImpl : public ATL::CWindowImplBaseT< TBase > void SetWatermark(HBITMAP hbmWatermark, HPALETTE hplWatermark = NULL) { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created + ATLASSERT(this->m_hWnd == NULL); // can't do this after it's created m_psh.dwFlags &= ~PSH_WIZARD; m_psh.dwFlags |= (PSH_WATERMARK | PSH_USEHBMWATERMARK | PSH_WIZARD97); m_psh.hbmWatermark = hbmWatermark; - if (hplWatermark != NULL) + if(hplWatermark != NULL) { m_psh.dwFlags |= PSH_USEHPLWATERMARK; m_psh.hplWatermark = hplWatermark; @@ -4215,13 +4114,12 @@ class ATL_NO_VTABLE CPropertySheetImpl : public ATL::CWindowImplBaseT< TBase > void StretchWatermark(bool bStretchWatermark) { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created - if (bStretchWatermark) + ATLASSERT(this->m_hWnd == NULL); // can't do this after it's created + if(bStretchWatermark) m_psh.dwFlags |= PSH_STRETCHWATERMARK; else m_psh.dwFlags &= ~PSH_STRETCHWATERMARK; } -#endif // (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) // Message map and handlers BEGIN_MSG_MAP(CPropertySheetImpl) @@ -4231,30 +4129,23 @@ class ATL_NO_VTABLE CPropertySheetImpl : public ATL::CWindowImplBaseT< TBase > LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { - LRESULT lRet = DefWindowProc(uMsg, wParam, lParam); - if(HIWORD(wParam) == BN_CLICKED && (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) && - ((m_psh.dwFlags & PSH_MODELESS) != 0) && (GetActivePage() == NULL)) - DestroyWindow(); + LRESULT lRet = this->DefWindowProc(uMsg, wParam, lParam); + if((HIWORD(wParam) == BN_CLICKED) && ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL)) && + ((m_psh.dwFlags & PSH_MODELESS) != 0) && (this->GetActivePage() == NULL)) + this->DestroyWindow(); return lRet; } LRESULT OnSysCommand(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { if(((m_psh.dwFlags & PSH_MODELESS) == PSH_MODELESS) && ((wParam & 0xFFF0) == SC_CLOSE)) - SendMessage(WM_CLOSE); + this->SendMessage(WM_CLOSE); else bHandled = FALSE; return 0; } }; -#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) // PPC static pointers -template < class T, class TBase > -LPCWSTR CPropertySheetImpl::m_pszTitle = NULL; -template < class T, class TBase> -LPCWSTR CPropertySheetImpl::m_pszLink = NULL; -#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) - // for non-customized sheets class CPropertySheet : public CPropertySheetImpl { @@ -4349,6 +4240,19 @@ class CPropertyPageWindow : public ATL::CWindow /////////////////////////////////////////////////////////////////////////////// // CPropertyPageImpl - implements a property page +#if defined(_WTL_FORCE_OLD_PAGE_NOTIFY_HANDLERS) && defined(_WTL_NEW_PAGE_NOTIFY_HANDLERS) + #error _WTL_FORCE_OLD_PAGE_NOTIFY_HANDLERS and _WTL_NEW_PAGE_NOTIFY_HANDLERS cannot be both defined +#endif + +#if !defined(_WTL_FORCE_OLD_PAGE_NOTIFY_HANDLERS) && !defined(_WTL_NEW_PAGE_NOTIFY_HANDLERS) + #define _WTL_NEW_PAGE_NOTIFY_HANDLERS +#endif + +// NOTE: _WTL_NEW_PAGE_NOTIFY_HANDLERS is now defined by default. +// It enables use of new notification handlers that +// return direct values without any restrictions. +// Define _WTL_FORCE_OLD_PAGE_NOTIFY_HANDLERS to use old handlers. + template class ATL_NO_VTABLE CPropertyPageImpl : public ATL::CDialogImplBaseT< TBase > { @@ -4392,11 +4296,9 @@ class ATL_NO_VTABLE CPropertyPageImpl : public ATL::CDialogImplBaseT< TBase > uRet = pT->OnPageCreate() ? 1 : 0; } break; -#if (_WIN32_IE >= 0x0500) case PSPCB_ADDREF: pT->OnPageAddRef(); break; -#endif // (_WIN32_IE >= 0x0500) case PSPCB_RELEASE: pT->OnPageRelease(); break; @@ -4412,11 +4314,9 @@ class ATL_NO_VTABLE CPropertyPageImpl : public ATL::CDialogImplBaseT< TBase > return true; // true - allow page to be created, false - prevent creation } -#if (_WIN32_IE >= 0x0500) void OnPageAddRef() { } -#endif // (_WIN32_IE >= 0x0500) void OnPageRelease() { @@ -4435,21 +4335,19 @@ class ATL_NO_VTABLE CPropertyPageImpl : public ATL::CDialogImplBaseT< TBase > m_psp.dwFlags |= PSP_USETITLE; } -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) void SetHeaderTitle(LPCTSTR lpstrHeaderTitle) { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created + ATLASSERT(this->m_hWnd == NULL); // can't do this after it's created m_psp.dwFlags |= PSP_USEHEADERTITLE; m_psp.pszHeaderTitle = lpstrHeaderTitle; } void SetHeaderSubTitle(LPCTSTR lpstrHeaderSubTitle) { - ATLASSERT(m_hWnd == NULL); // can't do this after it's created + ATLASSERT(this->m_hWnd == NULL); // can't do this after it's created m_psp.dwFlags |= PSP_USEHEADERSUBTITLE; m_psp.pszHeaderSubTitle = lpstrHeaderSubTitle; } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) // Operations void EnableHelp() @@ -4462,25 +4360,17 @@ class ATL_NO_VTABLE CPropertyPageImpl : public ATL::CDialogImplBaseT< TBase > MESSAGE_HANDLER(WM_NOTIFY, OnNotify) END_MSG_MAP() - // NOTE: Define _WTL_NEW_PAGE_NOTIFY_HANDLERS to use new notification - // handlers that return direct values without any restrictions LRESULT OnNotify(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { -#ifndef _WIN32_WCE - // This notification is sometimes received on Windows CE after the window is already destroyed - ATLASSERT(::IsWindow(m_hWnd)); -#endif + ATLASSERT(::IsWindow(this->m_hWnd)); NMHDR* pNMHDR = (NMHDR*)lParam; // don't handle messages not from the page/sheet itself - if(pNMHDR->hwndFrom != m_hWnd && pNMHDR->hwndFrom != ::GetParent(m_hWnd)) + if((pNMHDR->hwndFrom != this->m_hWnd) && (pNMHDR->hwndFrom != ::GetParent(this->m_hWnd))) { bHandled = FALSE; return 1; } -#ifdef _WIN32_WCE - ATLASSERT(::IsWindow(m_hWnd)); -#endif T* pT = static_cast(this); LRESULT lResult = 0; @@ -4514,14 +4404,10 @@ class ATL_NO_VTABLE CPropertyPageImpl : public ATL::CDialogImplBaseT< TBase > case PSN_HELP: pT->OnHelp(); break; -#ifndef _WIN32_WCE -#if (_WIN32_IE >= 0x0400) case PSN_GETOBJECT: if(!pT->OnGetObject((LPNMOBJECTNOTIFY)lParam)) bHandled = FALSE; break; -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0500) case PSN_TRANSLATEACCELERATOR: { LPPSHNOTIFY lpPSHNotify = (LPPSHNOTIFY)lParam; @@ -4534,8 +4420,6 @@ class ATL_NO_VTABLE CPropertyPageImpl : public ATL::CDialogImplBaseT< TBase > lResult = (LRESULT)pT->OnQueryInitialFocus((HWND)lpPSHNotify->lParam); } break; -#endif // (_WIN32_IE >= 0x0500) -#endif // !_WIN32_WCE #else // !_WTL_NEW_PAGE_NOTIFY_HANDLERS case PSN_SETACTIVE: @@ -4565,14 +4449,10 @@ class ATL_NO_VTABLE CPropertyPageImpl : public ATL::CDialogImplBaseT< TBase > case PSN_HELP: pT->OnHelp(); break; -#ifndef _WIN32_WCE -#if (_WIN32_IE >= 0x0400) case PSN_GETOBJECT: if(!pT->OnGetObject((LPNMOBJECTNOTIFY)lParam)) bHandled = FALSE; break; -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0500) case PSN_TRANSLATEACCELERATOR: { LPPSHNOTIFY lpPSHNotify = (LPPSHNOTIFY)lParam; @@ -4585,8 +4465,6 @@ class ATL_NO_VTABLE CPropertyPageImpl : public ATL::CDialogImplBaseT< TBase > lResult = (LRESULT)pT->OnQueryInitialFocus((HWND)lpPSHNotify->lParam); } break; -#endif // (_WIN32_IE >= 0x0500) -#endif // !_WIN32_WCE #endif // !_WTL_NEW_PAGE_NOTIFY_HANDLERS default: @@ -4597,8 +4475,6 @@ class ATL_NO_VTABLE CPropertyPageImpl : public ATL::CDialogImplBaseT< TBase > } // Overridables - // NOTE: Define _WTL_NEW_PAGE_NOTIFY_HANDLERS to use new notification - // handlers that return direct values without any restrictions #ifdef _WTL_NEW_PAGE_NOTIFY_HANDLERS int OnSetActive() { @@ -4662,15 +4538,11 @@ class ATL_NO_VTABLE CPropertyPageImpl : public ATL::CDialogImplBaseT< TBase > { } -#ifndef _WIN32_WCE -#if (_WIN32_IE >= 0x0400) BOOL OnGetObject(LPNMOBJECTNOTIFY /*lpObjectNotify*/) { return FALSE; // not processed } -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0500) int OnTranslateAccelerator(LPMSG /*lpMsg*/) { // PSNRET_NOERROR - message not handled @@ -4684,8 +4556,6 @@ class ATL_NO_VTABLE CPropertyPageImpl : public ATL::CDialogImplBaseT< TBase > // HWND = set focus to HWND return NULL; } -#endif // (_WIN32_IE >= 0x0500) -#endif // !_WIN32_WCE #else // !_WTL_NEW_PAGE_NOTIFY_HANDLERS BOOL OnSetActive() @@ -4737,15 +4607,11 @@ class ATL_NO_VTABLE CPropertyPageImpl : public ATL::CDialogImplBaseT< TBase > { } -#ifndef _WIN32_WCE -#if (_WIN32_IE >= 0x0400) BOOL OnGetObject(LPNMOBJECTNOTIFY /*lpObjectNotify*/) { return FALSE; // not processed } -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0500) BOOL OnTranslateAccelerator(LPMSG /*lpMsg*/) { return FALSE; // not translated @@ -4755,8 +4621,6 @@ class ATL_NO_VTABLE CPropertyPageImpl : public ATL::CDialogImplBaseT< TBase > { return NULL; // default } -#endif // (_WIN32_IE >= 0x0500) -#endif // !_WIN32_WCE #endif // !_WTL_NEW_PAGE_NOTIFY_HANDLERS }; @@ -4824,8 +4688,8 @@ class ATL_NO_VTABLE CAxPropertyPageImpl : public CPropertyPageImpl< T, TBase > // set up property page to use in-memory dialog template if(lpDialogTemplate != NULL) { - m_psp.dwFlags |= PSP_DLGINDIRECT; - m_psp.pResource = lpDialogTemplate; + this->m_psp.dwFlags |= PSP_DLGINDIRECT; + this->m_psp.pResource = lpDialogTemplate; } else { @@ -4860,25 +4724,24 @@ class ATL_NO_VTABLE CAxPropertyPageImpl : public CPropertyPageImpl< T, TBase > // call this one to handle keyboard message for ActiveX controls BOOL PreTranslateMessage(LPMSG pMsg) { - if ((pMsg->message < WM_KEYFIRST || pMsg->message > WM_KEYLAST) && - (pMsg->message < WM_MOUSEFIRST || pMsg->message > WM_MOUSELAST)) + if (((pMsg->message < WM_KEYFIRST) || (pMsg->message > WM_KEYLAST)) && + ((pMsg->message < WM_MOUSEFIRST) || (pMsg->message > WM_MOUSELAST))) return FALSE; // find a direct child of the dialog from the window that has focus HWND hWndCtl = ::GetFocus(); - if (IsChild(hWndCtl) && ::GetParent(hWndCtl) != m_hWnd) + if (this->IsChild(hWndCtl) && (::GetParent(hWndCtl) != this->m_hWnd)) { do { hWndCtl = ::GetParent(hWndCtl); } - while (::GetParent(hWndCtl) != m_hWnd); + while (::GetParent(hWndCtl) != this->m_hWnd); } // give controls a chance to translate this message return (BOOL)::SendMessage(hWndCtl, WM_FORWARDMSG, 0, (LPARAM)pMsg); } // Overridables -#if (_WIN32_IE >= 0x0500) // new default implementation for ActiveX hosting pages #ifdef _WTL_NEW_PAGE_NOTIFY_HANDLERS int OnTranslateAccelerator(LPMSG lpMsg) @@ -4893,10 +4756,7 @@ class ATL_NO_VTABLE CAxPropertyPageImpl : public CPropertyPageImpl< T, TBase > return pT->PreTranslateMessage(lpMsg); } #endif // !_WTL_NEW_PAGE_NOTIFY_HANDLERS -#endif // (_WIN32_IE >= 0x0500) -// Support for new stuff in ATL7 -#if (_ATL_VER >= 0x0700) int GetIDD() { return( static_cast(this)->IDD ); @@ -4953,7 +4813,7 @@ class ATL_NO_VTABLE CAxPropertyPageImpl : public CPropertyPageImpl< T, TBase > // Get first control on the dialog DLGITEMTEMPLATE* pItem = ATL::_DialogSplitHelper::FindFirstDlgItem(pDlg); - HWND hWndPrev = GetWindow(GW_CHILD); + HWND hWndPrev = this->GetWindow(GW_CHILD); // Create all ActiveX cotnrols in the dialog template and place them in the correct tab order (z-order) for (WORD nItem = 0; nItem < nItems; nItem++) @@ -4971,7 +4831,7 @@ class ATL_NO_VTABLE CAxPropertyPageImpl : public CPropertyPageImpl< T, TBase > { BYTE* pBytes = (BYTE*) GlobalLock(h); BYTE* pSource = pData; - SecureHelper::memcpy_x(pBytes, dwLen, pSource, dwLen); + ATL::Checked::memcpy_s(pBytes, dwLen, pSource, dwLen); GlobalUnlock(h); CreateStreamOnHGlobal(h, TRUE, &spStream); } @@ -4993,29 +4853,17 @@ class ATL_NO_VTABLE CAxPropertyPageImpl : public CPropertyPageImpl< T, TBase > (LPWSTR)(((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem) + 1) : (LPWSTR)(pItem + 1); // Get control rect. - RECT rect; - rect.left = - bDialogEx ? - ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->x : - pItem->x; - rect.top = - bDialogEx ? - ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->y : - pItem->y; - rect.right = rect.left + - (bDialogEx ? - ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->cx : - pItem->cx); - rect.bottom = rect.top + - (bDialogEx ? - ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->cy : - pItem->cy); + RECT rect = { 0 }; + rect.left = bDialogEx ? ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->x : pItem->x; + rect.top = bDialogEx ? ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->y : pItem->y; + rect.right = rect.left + (bDialogEx ? ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->cx : pItem->cx); + rect.bottom = rect.top + (bDialogEx ? ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->cy : pItem->cy); // Convert from dialog units to screen units - MapDialogRect(&rect); + this->MapDialogRect(&rect); // Create AxWindow with a NULL caption. - wnd.Create(m_hWnd, + wnd.Create(this->m_hWnd, &rect, NULL, (bDialogEx ? @@ -5031,11 +4879,9 @@ class ATL_NO_VTABLE CAxPropertyPageImpl : public CPropertyPageImpl< T, TBase > if (wnd != NULL) { -#ifndef _WIN32_WCE // Set the Help ID if (bDialogEx && ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->helpID != 0) wnd.SetWindowContextHelpId(((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->helpID); -#endif // !_WIN32_WCE // Try to create the ActiveX control. hr = wnd.CreateControlLic(pszClassName, spStream, NULL, bstrLicKey); if (FAILED(hr)) @@ -5072,7 +4918,7 @@ class ATL_NO_VTABLE CAxPropertyPageImpl : public CPropertyPageImpl< T, TBase > // Event handling support HRESULT AdviseSinkMap(bool bAdvise) { - if(!bAdvise && m_hWnd == NULL) + if(!bAdvise && (this->m_hWnd == NULL)) { // window is gone, controls are already unadvised ATLTRACE2(atlTraceUI, 0, _T("CAxPropertyPageImpl::AdviseSinkMap called after the window was destroyed\n")); @@ -5098,7 +4944,7 @@ class ATL_NO_VTABLE CAxPropertyPageImpl : public CPropertyPageImpl< T, TBase > LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { // initialize controls in dialog with DLGINIT resource section - ExecuteDlgInit(static_cast(this)->IDD); + this->ExecuteDlgInit(static_cast(this)->IDD); AdviseSinkMap(true); bHandled = FALSE; return 1; @@ -5110,7 +4956,6 @@ class ATL_NO_VTABLE CAxPropertyPageImpl : public CPropertyPageImpl< T, TBase > bHandled = FALSE; return 1; } -#endif // (_ATL_VER >= 0x0700) }; // for non-customized pages @@ -5123,14 +4968,9 @@ class CAxPropertyPage : public CAxPropertyPageImpl(title) { } -#if (_WIN32_IE >= 0x0500) || (_ATL_VER >= 0x0700) - // not empty so we handle accelerators/create controls BEGIN_MSG_MAP(CAxPropertyPage) CHAIN_MSG_MAP(CAxPropertyPageImpl >) END_MSG_MAP() -#else // !((_WIN32_IE >= 0x0500) || (_ATL_VER >= 0x0700)) - DECLARE_EMPTY_MSG_MAP() -#endif // !((_WIN32_IE >= 0x0500) || (_ATL_VER >= 0x0700)) }; #endif // _ATL_NO_HOSTING @@ -5139,8 +4979,6 @@ class CAxPropertyPage : public CAxPropertyPageImpl= 0x0500) && !defined(_WIN32_WCE) - // Sample wizard dialog resources: // // IDD_WIZ97_INTERIOR_BLANK DIALOG 0, 0, 317, 143 @@ -5304,11 +5142,11 @@ class ATL_NO_VTABLE CWizard97SheetImpl : public CPropertySheetImpl< T, TBase > baseClass(title, uStartPage, hWndParent), m_bReceivedFirstSizeMessage(false) { - m_psh.dwFlags &= ~(PSH_NOCONTEXTHELP); - m_psh.dwFlags &= ~(PSH_WIZARD | PSH_WIZARD_LITE); + this->m_psh.dwFlags &= ~(PSH_NOCONTEXTHELP); + this->m_psh.dwFlags &= ~(PSH_WIZARD | PSH_WIZARD_LITE); - m_psh.dwFlags |= (PSH_HASHELP | PSH_WIZARDCONTEXTHELP); - m_psh.dwFlags |= PSH_WIZARD97; + this->m_psh.dwFlags |= (PSH_HASHELP | PSH_WIZARDCONTEXTHELP); + this->m_psh.dwFlags |= PSH_WIZARD97; baseClass::SetHeader(headerBitmap.m_lpstr); baseClass::SetWatermark(watermarkBitmap.m_lpstr); @@ -5343,7 +5181,7 @@ class ATL_NO_VTABLE CWizard97SheetImpl : public CPropertySheetImpl< T, TBase > // as Verdana Bold, 12pt. titleLogFont.lfCharSet = DEFAULT_CHARSET; titleLogFont.lfWeight = FW_BOLD; - SecureHelper::strcpy_x(titleLogFont.lfFaceName, _countof(titleLogFont.lfFaceName), _T("Verdana Bold")); + ATL::Checked::tcscpy_s(titleLogFont.lfFaceName, _countof(titleLogFont.lfFaceName), _T("Verdana Bold")); INT titleFontPointSize = 12; titleLogFont.lfHeight = -::MulDiv(titleFontPointSize, dcScreen.GetDeviceCaps(LOGPIXELSY), 72); m_fontExteriorPageTitle.CreateFontIndirect(&titleLogFont); @@ -5352,7 +5190,7 @@ class ATL_NO_VTABLE CWizard97SheetImpl : public CPropertySheetImpl< T, TBase > // static text of "h" in the Marlett font. bulletLogFont.lfCharSet = DEFAULT_CHARSET; bulletLogFont.lfWeight = FW_NORMAL; - SecureHelper::strcpy_x(bulletLogFont.lfFaceName, _countof(bulletLogFont.lfFaceName), _T("Marlett")); + ATL::Checked::tcscpy_s(bulletLogFont.lfFaceName, _countof(bulletLogFont.lfFaceName), _T("Marlett")); INT bulletFontSize = 8; bulletLogFont.lfHeight = -::MulDiv(bulletFontSize, dcScreen.GetDeviceCaps(LOGPIXELSY), 72); m_fontBullet.CreateFontIndirect(&bulletLogFont); @@ -5497,8 +5335,8 @@ class ATL_NO_VTABLE CWizard97ExteriorPageImpl : public CPropertyPageImpl< T, TBa // Constructors CWizard97ExteriorPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : baseClass(title) { - m_psp.dwFlags |= PSP_HASHELP; - m_psp.dwFlags |= PSP_HIDEHEADER; + this->m_psp.dwFlags |= PSP_HASHELP; + this->m_psp.dwFlags |= PSP_HIDEHEADER; } // Message Handling @@ -5523,9 +5361,9 @@ class ATL_NO_VTABLE CWizard97InteriorPageImpl : public CPropertyPageImpl< T, TBa // Constructors CWizard97InteriorPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : baseClass(title) { - m_psp.dwFlags |= PSP_HASHELP; - m_psp.dwFlags &= ~PSP_HIDEHEADER; - m_psp.dwFlags |= PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; + this->m_psp.dwFlags |= PSP_HASHELP; + this->m_psp.dwFlags &= ~PSP_HIDEHEADER; + this->m_psp.dwFlags |= PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; // Be sure to have the derived class define this in the constructor. // We'll default it to something obvious in case its forgotten. @@ -5539,13 +5377,11 @@ class ATL_NO_VTABLE CWizard97InteriorPageImpl : public CPropertyPageImpl< T, TBa END_MSG_MAP() }; -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) - /////////////////////////////////////////////////////////////////////////////// // Aero Wizard support -#if (_WIN32_WINNT >= 0x0600) && !defined(_WIN32_WCE) +#if (_WIN32_WINNT >= 0x0600) /////////////////////////////////////////////////////////////////////////////// // CAeroWizardFrameWindow - client side for an Aero Wizard frame window @@ -5601,26 +5437,26 @@ class ATL_NO_VTABLE CAeroWizardFrameImpl : public CPropertySheetImpl CAeroWizardFrameImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uStartPage = 0, HWND hWndParent = NULL) : CPropertySheetImpl(title, uStartPage, hWndParent) { - m_psh.dwFlags |= PSH_WIZARD | PSH_AEROWIZARD; + this->m_psh.dwFlags |= PSH_WIZARD | PSH_AEROWIZARD; } // Operations void EnableResizing() { ATLASSERT(m_hWnd == NULL); // can't do this after it's created - m_psh.dwFlags |= PSH_RESIZABLE; + this->m_psh.dwFlags |= PSH_RESIZABLE; } void UseHeaderBitmap() { ATLASSERT(m_hWnd == NULL); // can't do this after it's created - m_psh.dwFlags |= PSH_HEADERBITMAP; + this->m_psh.dwFlags |= PSH_HEADERBITMAP; } void SetNoMargin() { ATLASSERT(m_hWnd == NULL); // can't do this after it's created - m_psh.dwFlags |= PSH_NOMARGIN; + this->m_psh.dwFlags |= PSH_NOMARGIN; } // Override to prevent use @@ -5759,25 +5595,20 @@ class CAeroWizardAxPage : public CAeroWizardAxPageImpl(title) { } -#if (_WIN32_IE >= 0x0500) || (_ATL_VER >= 0x0700) - // not empty so we handle accelerators/create controls BEGIN_MSG_MAP(CAeroWizardAxPage) CHAIN_MSG_MAP(CAeroWizardAxPageImpl >) END_MSG_MAP() -#else // !((_WIN32_IE >= 0x0500) || (_ATL_VER >= 0x0700)) - DECLARE_EMPTY_MSG_MAP() -#endif // !((_WIN32_IE >= 0x0500) || (_ATL_VER >= 0x0700)) }; #endif // _ATL_NO_HOSTING -#endif // (_WIN32_WINNT >= 0x0600) && !defined(_WIN32_WCE) +#endif // (_WIN32_WINNT >= 0x0600) /////////////////////////////////////////////////////////////////////////////// // TaskDialog support -#if ((_WIN32_WINNT >= 0x0600) || defined(_WTL_TASKDIALOG)) && !defined(_WIN32_WCE) +#if (_WIN32_WINNT >= 0x0600) || defined(_WTL_TASKDIALOG) /////////////////////////////////////////////////////////////////////////////// // AtlTaskDialog - support for TaskDialog() function @@ -5848,9 +5679,9 @@ class CTaskDialogConfig : public TASKDIALOGCONFIG // Operations - setting values // common buttons - void SetCommonButtons(TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons) + void SetCommonButtons(TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtonsArg) { - this->dwCommonButtons = dwCommonButtons; + this->dwCommonButtons = dwCommonButtonsArg; } // window title text @@ -5906,31 +5737,31 @@ class CTaskDialogConfig : public TASKDIALOGCONFIG } // buttons - void SetButtons(const TASKDIALOG_BUTTON* pButtons, UINT cButtons, int nDefaultButton = 0) + void SetButtons(const TASKDIALOG_BUTTON* pButtonsArg, UINT cButtonsArg, int nDefaultButtonArg = 0) { - this->pButtons = pButtons; - this->cButtons = cButtons; - if(nDefaultButton != 0) - this->nDefaultButton = nDefaultButton; + this->pButtons = pButtonsArg; + this->cButtons = cButtonsArg; + if(nDefaultButtonArg != 0) + this->nDefaultButton = nDefaultButtonArg; } - void SetDefaultButton(int nDefaultButton) + void SetDefaultButton(int nDefaultButtonArg) { - this->nDefaultButton = nDefaultButton; + this->nDefaultButton = nDefaultButtonArg; } // radio buttons - void SetRadioButtons(const TASKDIALOG_BUTTON* pRadioButtons, UINT cRadioButtons, int nDefaultRadioButton = 0) + void SetRadioButtons(const TASKDIALOG_BUTTON* pRadioButtonsArg, UINT cRadioButtonsArg, int nDefaultRadioButtonArg = 0) { - this->pRadioButtons = pRadioButtons; - this->cRadioButtons = cRadioButtons; - if(nDefaultRadioButton != 0) - this->nDefaultRadioButton = nDefaultRadioButton; + this->pRadioButtons = pRadioButtonsArg; + this->cRadioButtons = cRadioButtonsArg; + if(nDefaultRadioButtonArg != 0) + this->nDefaultRadioButton = nDefaultRadioButtonArg; } - void SetDefaultRadioButton(int nDefaultRadioButton) + void SetDefaultRadioButton(int nDefaultRadioButtonArg) { - this->nDefaultRadioButton = nDefaultRadioButton; + this->nDefaultRadioButton = nDefaultRadioButtonArg; } // verification text @@ -6008,9 +5839,9 @@ class CTaskDialogConfig : public TASKDIALOGCONFIG } // width (in DLUs) - void SetWidth(UINT cxWidth) + void SetWidth(UINT cxWidthArg) { - this->cxWidth = cxWidth; + this->cxWidth = cxWidthArg; } // modify flags @@ -6146,7 +5977,7 @@ class ATL_NO_VTABLE CTaskDialogImpl static HRESULT CALLBACK TaskDialogCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LONG_PTR lpRefData) { T* pT = (T*)lpRefData; - ATLASSERT(pT->m_hWnd == NULL || pT->m_hWnd == hWnd); + ATLASSERT((pT->m_hWnd == NULL) || (pT->m_hWnd == hWnd)); BOOL bRet = FALSE; switch(uMsg) @@ -6191,7 +6022,7 @@ class ATL_NO_VTABLE CTaskDialogImpl break; } - return (HRESULT)bRet; + return (bRet != FALSE) ? S_OK : S_FALSE; } // Overrideables - notification handlers @@ -6379,7 +6210,7 @@ class CTaskDialog : public CTaskDialogImpl } }; -#endif // ((_WIN32_WINNT >= 0x0600) || defined(_WTL_TASKDIALOG)) && !defined(_WIN32_WCE) +#endif // (_WIN32_WINNT >= 0x0600) || defined(_WTL_TASKDIALOG) }; // namespace WTL diff --git a/thirdparty/wtl/atldwm.h b/thirdparty/wtl/atldwm.h index e6377f4..514bc02 100644 --- a/thirdparty/wtl/atldwm.h +++ b/thirdparty/wtl/atldwm.h @@ -1,23 +1,16 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. +// Windows Template Library - WTL version 10.0 +// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. +// Microsoft Public License (http://opensource.org/licenses/MS-PL) +// which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLDWM_H__ #define __ATLDWM_H__ #pragma once -#ifdef _WIN32_WCE - #error atldwm.h is not supported on Windows CE -#endif - #ifndef __ATLAPP_H__ #error atldwm.h requires atlapp.h to be included first #endif @@ -28,11 +21,11 @@ #if (_WIN32_WINNT < 0x0600) #error atldwm.h requires _WIN32_WINNT >= 0x0600 -#endif // (_WIN32_WINNT < 0x0600) +#endif #ifndef _DWMAPI_H_ -#include -#endif // _DWMAPI_H_ + #include +#endif #pragma comment(lib, "dwmapi.lib") // Note: To create an application that also runs on older versions of Windows, @@ -40,10 +33,7 @@ // Delay load is NOT AUTOMATIC for VC++ 7, you have to link to delayimp.lib, // and add dwmapi.dll in the Linker.Input.Delay Loaded DLLs section of the // project properties. -#if (_MSC_VER < 1300) && !defined(_WTL_NO_DWMAPI_DELAYLOAD) - #pragma comment(lib, "delayimp.lib") - #pragma comment(linker, "/delayload:dwmapi.dll") -#endif // (_MSC_VER < 1300) && !defined(_WTL_NO_DWMAPI_DELAYLOAD) + /////////////////////////////////////////////////////////////////////////////// // Classes in this file: @@ -106,32 +96,42 @@ class CDwm // Operations BOOL DwmIsCompositionEnabled() const { - if(!IsDwmSupported()) return FALSE; + if(!IsDwmSupported()) + return FALSE; + BOOL bRes = FALSE; - return SUCCEEDED(::DwmIsCompositionEnabled(&bRes)) && bRes; + return (SUCCEEDED(::DwmIsCompositionEnabled(&bRes)) && bRes) ? TRUE : FALSE; } BOOL DwmEnableComposition(UINT fEnable) { - if(!IsDwmSupported()) return FALSE; - return SUCCEEDED(::DwmEnableComposition(fEnable)); + if(!IsDwmSupported()) + return FALSE; + + return SUCCEEDED(::DwmEnableComposition(fEnable)) ? TRUE : FALSE; } BOOL DwmEnableMMCSS(BOOL fEnableMMCSS) { - if(!IsDwmSupported()) return FALSE; - return SUCCEEDED(::DwmEnableMMCSS(fEnableMMCSS)); + if(!IsDwmSupported()) + return FALSE; + + return SUCCEEDED(::DwmEnableMMCSS(fEnableMMCSS)) ? TRUE : FALSE; } HRESULT DwmGetColorizationColor(DWORD* pcrColorization, BOOL* pfOpaqueBlend) { - if(!IsDwmSupported()) return E_NOTIMPL; + if(!IsDwmSupported()) + return E_NOTIMPL; + return ::DwmGetColorizationColor(pcrColorization, pfOpaqueBlend); } HRESULT DwmFlush() { - if(!IsDwmSupported()) return E_NOTIMPL; + if(!IsDwmSupported()) + return E_NOTIMPL; + return ::DwmFlush(); } }; @@ -148,7 +148,9 @@ class CDwmImpl : public TBase public: HRESULT DwmEnableBlurBehindWindow(const DWM_BLURBEHIND* pBB) { - if(!IsDwmSupported()) return E_NOTIMPL; + if(!IsDwmSupported()) + return E_NOTIMPL; + T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::DwmEnableBlurBehindWindow(pT->m_hWnd, pBB); @@ -156,7 +158,9 @@ class CDwmImpl : public TBase HRESULT DwmExtendFrameIntoClientArea(const MARGINS* pMargins) { - if(!IsDwmSupported()) return E_NOTIMPL; + if(!IsDwmSupported()) + return E_NOTIMPL; + T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::DwmExtendFrameIntoClientArea(pT->m_hWnd, pMargins); @@ -170,7 +174,9 @@ class CDwmImpl : public TBase HRESULT DwmGetCompositionTimingInfo(DWM_TIMING_INFO* pTimingInfo) { - if(!IsDwmSupported()) return E_NOTIMPL; + if(!IsDwmSupported()) + return E_NOTIMPL; + T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::DwmGetCompositionTimingInfo(pT->m_hWnd, pTimingInfo); @@ -178,7 +184,9 @@ class CDwmImpl : public TBase HRESULT DwmGetWindowAttribute(DWORD dwAttribute, PVOID pvAttribute, DWORD cbAttribute) { - if(!IsDwmSupported()) return E_NOTIMPL; + if(!IsDwmSupported()) + return E_NOTIMPL; + T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::DwmGetWindowAttribute(pT->m_hWnd, dwAttribute, pvAttribute, cbAttribute); @@ -186,7 +194,9 @@ class CDwmImpl : public TBase HRESULT DwmModifyPreviousDxFrameDuration(INT cRefreshes, BOOL fRelative) { - if(!IsDwmSupported()) return E_NOTIMPL; + if(!IsDwmSupported()) + return E_NOTIMPL; + T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::DwmModifyPreviousDxFrameDuration(pT->m_hWnd, cRefreshes, fRelative); @@ -194,7 +204,9 @@ class CDwmImpl : public TBase HRESULT DwmSetDxFrameDuration(INT cRefreshes) { - if(!IsDwmSupported()) return E_NOTIMPL; + if(!IsDwmSupported()) + return E_NOTIMPL; + T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::DwmSetDxFrameDuration(pT->m_hWnd, cRefreshes); @@ -202,7 +214,9 @@ class CDwmImpl : public TBase HRESULT DwmSetPresentParameters(DWM_PRESENT_PARAMETERS* pPresentParams) { - if(!IsDwmSupported()) return E_NOTIMPL; + if(!IsDwmSupported()) + return E_NOTIMPL; + T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::DwmSetPresentParameters(pT->m_hWnd, pPresentParams); @@ -210,7 +224,9 @@ class CDwmImpl : public TBase HRESULT DwmSetWindowAttribute(DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute) { - if(!IsDwmSupported()) return E_NOTIMPL; + if(!IsDwmSupported()) + return E_NOTIMPL; + T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::DwmSetWindowAttribute(pT->m_hWnd, dwAttribute, pvAttribute, cbAttribute); @@ -218,7 +234,9 @@ class CDwmImpl : public TBase HRESULT DwmAttachMilContent() { - if(!IsDwmSupported()) return E_NOTIMPL; + if(!IsDwmSupported()) + return E_NOTIMPL; + T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::DwmAttachMilContent(pT->m_hWnd); @@ -226,7 +244,9 @@ class CDwmImpl : public TBase HRESULT DwmDetachMilContent() { - if(!IsDwmSupported()) return E_NOTIMPL; + if(!IsDwmSupported()) + return E_NOTIMPL; + T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::DwmDetachMilContent(pT->m_hWnd); @@ -262,12 +282,11 @@ class CDwmThumbnailT : public TBase // Constructor CDwmThumbnailT(HTHUMBNAIL hThumbnail = NULL) : m_hThumbnail(hThumbnail) - { - } + { } ~CDwmThumbnailT() { - if(t_bManaged && m_hThumbnail != NULL) + if(t_bManaged && (m_hThumbnail != NULL)) Unregister(); } @@ -280,7 +299,7 @@ class CDwmThumbnailT : public TBase void Attach(HTHUMBNAIL hThumbnailNew) { - if(t_bManaged && m_hThumbnail != NULL && m_hThumbnail != hThumbnailNew) + if(t_bManaged && (m_hThumbnail != NULL) && (m_hThumbnail != hThumbnailNew)) Unregister(); m_hThumbnail = hThumbnailNew; } @@ -297,16 +316,24 @@ class CDwmThumbnailT : public TBase ATLASSERT(::IsWindow(hwndDestination)); ATLASSERT(::IsWindow(hwndSource)); ATLASSERT(m_hThumbnail==NULL); - if(!IsDwmSupported()) return E_NOTIMPL; + + if(!IsDwmSupported()) + return E_NOTIMPL; + return ::DwmRegisterThumbnail(hwndDestination, hwndSource, &m_hThumbnail); } HRESULT Unregister() { - if(!IsDwmSupported()) return E_NOTIMPL; - if(m_hThumbnail == NULL) return S_FALSE; + if(!this->IsDwmSupported()) + return E_NOTIMPL; + if(m_hThumbnail == NULL) + return S_FALSE; + HRESULT Hr = ::DwmUnregisterThumbnail(m_hThumbnail); - if(SUCCEEDED(Hr)) m_hThumbnail = NULL; + if(SUCCEEDED(Hr)) + m_hThumbnail = NULL; + return Hr; } @@ -316,7 +343,9 @@ class CDwmThumbnailT : public TBase HRESULT UpdateProperties(const DWM_THUMBNAIL_PROPERTIES* ptnProperties) { - if(!IsDwmSupported()) return E_NOTIMPL; + if(!IsDwmSupported()) + return E_NOTIMPL; + ATLASSERT(m_hThumbnail != NULL); return ::DwmUpdateThumbnailProperties(m_hThumbnail, ptnProperties); } @@ -324,7 +353,9 @@ class CDwmThumbnailT : public TBase // Attributes HRESULT QuerySourceSize(PSIZE pSize) { - if(!IsDwmSupported()) return E_NOTIMPL; + if(!IsDwmSupported()) + return E_NOTIMPL; + ATLASSERT(m_hThumbnail != NULL); return ::DwmQueryThumbnailSourceSize(m_hThumbnail, pSize); } @@ -340,10 +371,9 @@ typedef CDwmThumbnailT CDwmThumbnailHandle; // CAeroControlImpl - Base class for controls on Glass template -class CAeroControlImpl : - public CThemeImpl, - public CBufferedPaintImpl, - public ATL::CWindowImpl +class CAeroControlImpl : public CThemeImpl, + public CBufferedPaintImpl, + public ATL::CWindowImpl { public: typedef CThemeImpl _themeClass; @@ -352,7 +382,7 @@ class CAeroControlImpl : CAeroControlImpl() { - m_PaintParams.dwFlags = BPPF_ERASE; + this->m_PaintParams.dwFlags = BPPF_ERASE; } static LPCWSTR GetThemeName() @@ -377,13 +407,16 @@ class CAeroControlImpl : { T* pT = static_cast(this); pT->Init(); + bHandled = FALSE; return 0; } LRESULT OnActivate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { - if(IsThemingSupported()) Invalidate(FALSE); + if(this->IsThemingSupported()) + this->Invalidate(FALSE); + bHandled = FALSE; return 0; } @@ -394,20 +427,23 @@ class CAeroControlImpl : ATLASSERT(m_hWnd == NULL); ATLASSERT(::IsWindow(hWnd)); BOOL bRet = _windowClass::SubclassWindow(hWnd); - if(bRet) { + if(bRet) + { T* pT = static_cast(this); pT->Init(); } + return bRet; } // Implementation LRESULT DefWindowProc() { - const _ATL_MSG* pMsg = m_pCurrentMsg; + const ATL::_ATL_MSG* pMsg = this->m_pCurrentMsg; LRESULT lRes = 0; if(pMsg != NULL) lRes = DefWindowProc(pMsg->message, pMsg->wParam, pMsg->lParam); + return lRes; } @@ -415,7 +451,9 @@ class CAeroControlImpl : { T* pT = static_cast(this); LRESULT lRes = 0; - if( ::DwmDefWindowProc(pT->m_hWnd, uMsg, wParam, lParam, &lRes) ) return lRes; + if(::DwmDefWindowProc(pT->m_hWnd, uMsg, wParam, lParam, &lRes) != FALSE) + return lRes; + return _windowClass::DefWindowProc(uMsg, wParam, lParam); } @@ -424,11 +462,11 @@ class CAeroControlImpl : T* pT = static_cast(this); HDC hDCPaint = NULL; RECT rcClient = { 0 }; - GetClientRect(&rcClient); - m_BufferedPaint.Begin(hDC, &rcClient, m_dwFormat, &m_PaintParams, &hDCPaint); + this->GetClientRect(&rcClient); + this->m_BufferedPaint.Begin(hDC, &rcClient, this->m_dwFormat, &this->m_PaintParams, &hDCPaint); ATLASSERT(hDCPaint != NULL); pT->DoAeroPaint(hDCPaint, rcClient, rcPaint); - m_BufferedPaint.End(); + this->m_BufferedPaint.End(); } void DoPaint(HDC /*hdc*/, RECT& /*rcClient*/) @@ -440,22 +478,21 @@ class CAeroControlImpl : void Init() { T* pT = static_cast(this); - SetThemeClassList(pT->GetThemeName()); - if(m_lpstrThemeClassList != NULL) - OpenThemeData(); + pT; // avoid level 4 warning + this->SetThemeClassList(pT->GetThemeName()); + if(this->m_lpstrThemeClassList != NULL) + this->OpenThemeData(); } void DoAeroPaint(HDC hDC, RECT& /*rcClient*/, RECT& rcPaint) { DefWindowProc(WM_PAINT, (WPARAM) hDC, 0L); - m_BufferedPaint.MakeOpaque(&rcPaint); + this->m_BufferedPaint.MakeOpaque(&rcPaint); } }; #endif // __ATLTHEME_H__ - }; // namespace WTL - #endif // __ATLDWM_H__ diff --git a/thirdparty/wtl/atlfind.h b/thirdparty/wtl/atlfind.h index e266ed3..e6ce3c5 100644 --- a/thirdparty/wtl/atlfind.h +++ b/thirdparty/wtl/atlfind.h @@ -1,23 +1,16 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. +// Windows Template Library - WTL version 10.0 +// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. +// Microsoft Public License (http://opensource.org/licenses/MS-PL) +// which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLFIND_H__ #define __ATLFIND_H__ #pragma once -#ifdef _WIN32_WCE - #error atlfind.h is not supported on Windows CE -#endif - #ifndef __ATLCTRLS_H__ #error atlfind.h requires atlctrls.h to be included first #endif @@ -26,8 +19,8 @@ #error atlfind.h requires atldlgs.h to be included first #endif -#if !((defined(__ATLMISC_H__) && defined(_WTL_USE_CSTRING)) || defined(__ATLSTR_H__)) - #error atlfind.h requires CString (either from ATL's atlstr.h or WTL's atlmisc.h with _WTL_USE_CSTRING) +#ifndef __ATLSTR_H__ + #error atlfind.h requires CString #endif @@ -55,7 +48,7 @@ class CEditFindReplaceImplBase // Data members TFindReplaceDialog* m_pFindReplaceDialog; - _CSTRING_NS::CString m_sFindNext, m_sReplaceWith; + ATL::CString m_sFindNext, m_sReplaceWith; BOOL m_bFindOnly, m_bFirstSearch, m_bMatchCase, m_bWholeWord, m_bFindDown; LONG m_nInitialSearchPos; HCURSOR m_hOldCursor; @@ -242,29 +235,28 @@ class CEditFindReplaceImplBase ::SendMessage(pT->m_hWnd, EM_GETSEL, (WPARAM)&nStartChar, (LPARAM)&nEndChar); POINT point = pT->PosFromChar(nStartChar); ::ClientToScreen(pT->GetParent(), &point); - CRect rect; + RECT rect = { 0 }; ::GetWindowRect(hWndDialog, &rect); - if(rect.PtInRect(point)) + if(::PtInRect(&rect, point) != FALSE) { - if(point.y > rect.Height()) + if(point.y > (rect.bottom - rect.top)) { - rect.OffsetRect(0, point.y - rect.bottom - 20); + ::OffsetRect(&rect, 0, point.y - rect.bottom - 20); } else { int nVertExt = GetSystemMetrics(SM_CYSCREEN); - if(point.y + rect.Height() < nVertExt) - rect.OffsetRect(0, 40 + point.y - rect.top); + if((point.y + (rect.bottom - rect.top)) < nVertExt) + ::OffsetRect(&rect, 0, 40 + point.y - rect.top); } - ::MoveWindow(hWndDialog, rect.left, rect.top, rect.Width(), rect.Height(), TRUE); + ::MoveWindow(hWndDialog, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE); } } - DWORD GetFindReplaceDialogFlags(void) const + DWORD GetFindReplaceDialogFlags() const { DWORD dwFlags = 0; - if(m_bFindDown) dwFlags |= FR_DOWN; if(m_bMatchCase) @@ -296,12 +288,12 @@ class CEditFindReplaceImplBase ATLASSERT(m_pFindReplaceDialog == NULL); - _CSTRING_NS::CString findNext; + ATL::CString findNext; pT->GetSelText(findNext); // if selection is empty or spans multiple lines use old find text if(findNext.IsEmpty() || (findNext.FindOneOf(_T("\n\r")) != -1)) findNext = m_sFindNext; - _CSTRING_NS::CString replaceWith = m_sReplaceWith; + ATL::CString replaceWith = m_sReplaceWith; DWORD dwFlags = pT->GetFindReplaceDialogFlags(); m_pFindReplaceDialog = pT->CreateFindReplaceDialog(bFindOnly, @@ -325,11 +317,11 @@ class CEditFindReplaceImplBase return FALSE; // length is the same, check contents - _CSTRING_NS::CString selectedText; + ATL::CString selectedText; pT->GetSelText(selectedText); - return (bMatchCase && selectedText.Compare(lpszCompare) == 0) || - (!bMatchCase && selectedText.CompareNoCase(lpszCompare) == 0); + return (bMatchCase && (selectedText.Compare(lpszCompare) == 0)) || + (!bMatchCase && (selectedText.CompareNoCase(lpszCompare) == 0)); } void TextNotFound(LPCTSTR lpszFind) @@ -339,9 +331,9 @@ class CEditFindReplaceImplBase pT->OnTextNotFound(lpszFind); } - _CSTRING_NS::CString GetTranslationText(enum TranslationTextItem eItem) const + ATL::CString GetTranslationText(enum TranslationTextItem eItem) const { - _CSTRING_NS::CString text; + ATL::CString text; switch(eItem) { case eText_OnReplaceAllMessage: @@ -445,12 +437,11 @@ class CEditFindReplaceImplBase ::SetCursor(m_hOldCursor); - _CSTRING_NS::CString message = pT->GetTranslationText(eText_OnReplaceAllMessage); + ATL::CString message = pT->GetTranslationText(eText_OnReplaceAllMessage); if(message.GetLength() > 0) { - _CSTRING_NS::CString formattedMessage; - formattedMessage.Format(message, - replaceCount, m_sFindNext, m_sReplaceWith); + ATL::CString formattedMessage; + formattedMessage.Format(message, replaceCount, (LPCTSTR)m_sFindNext, (LPCTSTR)m_sReplaceWith); if(m_pFindReplaceDialog != NULL) { m_pFindReplaceDialog->MessageBox(formattedMessage, @@ -469,10 +460,10 @@ class CEditFindReplaceImplBase void OnTextNotFound(LPCTSTR lpszFind) { T* pT = static_cast(this); - _CSTRING_NS::CString message = pT->GetTranslationText(eText_OnTextNotFoundMessage); + ATL::CString message = pT->GetTranslationText(eText_OnTextNotFoundMessage); if(message.GetLength() > 0) { - _CSTRING_NS::CString formattedMessage; + ATL::CString formattedMessage; formattedMessage.Format(message, lpszFind); if(m_pFindReplaceDialog != NULL) { @@ -523,29 +514,7 @@ class CEditFindReplaceImpl : public CEditFindReplaceImplBase thisClass; typedef CEditFindReplaceImplBase baseClass; -// Data members - LPTSTR m_pShadowBuffer; // Special shadow buffer only used in some cases. - UINT m_nShadowSize; - int m_bShadowBufferNeeded; // TRUE, FALSE, < 0 => Need to check - public: -// Constructors - CEditFindReplaceImpl() : - m_pShadowBuffer(NULL), - m_nShadowSize(0), - m_bShadowBufferNeeded(-1) - { - } - - virtual ~CEditFindReplaceImpl() - { - if(m_pShadowBuffer != NULL) - { - delete [] m_pShadowBuffer; - m_pShadowBuffer = NULL; - } - } - // Message Handlers BEGIN_MSG_MAP(thisClass) ALT_MSG_MAP(1) @@ -573,7 +542,7 @@ class CEditFindReplaceImpl : public CEditFindReplaceImplBaseLockBuffer(); @@ -590,7 +559,7 @@ class CEditFindReplaceImpl : public CEditFindReplaceImplBaseSameAsSelected(lpszFind, bMatchCase, bWholeWord)) + else if((nStartChar != nEndChar) && (pT->SameAsSelected(lpszFind, bMatchCase, bWholeWord))) { // easy to go backward/forward with SBCS #ifndef _UNICODE @@ -602,9 +571,9 @@ class CEditFindReplaceImpl : public CEditFindReplaceImplBase= nLen) + if((nStart + nLenFind - 1) >= nLen) { - if(iDir < 0 && nLen >= nLenFind) + if((iDir < 0) && (nLen >= nLenFind)) { if(isDBCS) { @@ -621,7 +590,7 @@ class CEditFindReplaceImpl : public CEditFindReplaceImplBase 0) { ATLASSERT(lpsz >= lpszText); - ATLASSERT(lpsz + nLenFind - 1 <= lpszText + nLen - 1); + ATLASSERT((lpsz + nLenFind - 1) <= (lpszText + nLen - 1)); LPSTR lpch = (LPSTR)(lpsz + nLenFind); char chSave = *lpch; @@ -726,35 +695,20 @@ class CEditFindReplaceImpl : public CEditFindReplaceImplBase(this); - ATLASSERT(pT->m_hWnd != NULL); - BOOL useShadowBuffer = pT->UseShadowBuffer(); - if(useShadowBuffer) - { - if(m_pShadowBuffer == NULL || pT->GetModify()) - { - ATLASSERT(m_pShadowBuffer != NULL || m_nShadowSize == 0); - UINT nSize = pT->GetWindowTextLength() + 1; - if(nSize > m_nShadowSize) - { - // need more room for shadow buffer - T* pThisNoConst = const_cast(pT); - delete[] m_pShadowBuffer; - pThisNoConst->m_pShadowBuffer = NULL; - pThisNoConst->m_nShadowSize = 0; - pThisNoConst->m_pShadowBuffer = new TCHAR[nSize]; - pThisNoConst->m_nShadowSize = nSize; - } - - // update the shadow buffer with GetWindowText - ATLASSERT(m_nShadowSize >= nSize); - ATLASSERT(m_pShadowBuffer != NULL); - pT->GetWindowText(m_pShadowBuffer, nSize); - } - - return m_pShadowBuffer; +#ifndef _UNICODE + // If common controls version 6 is in use (such as via theming), then EM_GETHANDLE + // will always return a UNICODE string. You're really not supposed to superclass + // or subclass common controls with an ANSI windows procedure. + DWORD dwMajor = 0, dwMinor = 0; + HRESULT hRet = ATL::AtlGetCommCtrlVersion(&dwMajor, &dwMinor); + if(SUCCEEDED(hRet) && (dwMajor >= 6)) + { + ATLTRACE2(atlTraceUI, 0, _T("AtlFind Warning: You have compiled for MBCS/ANSI but are using common controls version 6 or later which are always Unicode.\r\n")); + ATLASSERT(FALSE); } +#endif // !_UNICODE HLOCAL hLocal = pT->GetHandle(); ATLASSERT(hLocal != NULL); @@ -767,23 +721,18 @@ class CEditFindReplaceImpl : public CEditFindReplaceImplBase(this); - ATLASSERT(pT->m_hWnd != NULL); - BOOL useShadowBuffer = pT->UseShadowBuffer(); - if(!useShadowBuffer) - { - HLOCAL hLocal = pT->GetHandle(); - ATLASSERT(hLocal != NULL); - ::LocalUnlock(hLocal); - } + HLOCAL hLocal = pT->GetHandle(); + ATLASSERT(hLocal != NULL); + ::LocalUnlock(hLocal); } UINT GetBufferLength() const { const T* pT = static_cast(this); - ATLASSERT(pT->m_hWnd != NULL); + UINT nLen = 0; LPCTSTR lpszText = pT->LockBuffer(); if(lpszText != NULL) @@ -797,12 +746,12 @@ class CEditFindReplaceImpl : public CEditFindReplaceImplBase(this); @@ -811,88 +760,12 @@ class CEditFindReplaceImpl : public CEditFindReplaceImplBaseGetBufferLength()); LPCTSTR lpszText = pT->LockBuffer(); LONG nLen = pT->EndOfLine(lpszText, nEndChar, nStartChar) - nStartChar; - SecureHelper::memcpy_x(strText.GetBuffer(nLen), nLen * sizeof(TCHAR), lpszText + nStartChar, nLen * sizeof(TCHAR)); + ATL::Checked::memcpy_s(strText.GetBuffer(nLen), nLen * sizeof(TCHAR), lpszText + nStartChar, nLen * sizeof(TCHAR)); strText.ReleaseBuffer(nLen); pT->UnlockBuffer(); return nLen; } - - BOOL UseShadowBuffer(void) const - { - const T* pT = static_cast(this); - - if(pT->m_bShadowBufferNeeded < 0) - { - T* pThisNoConst = const_cast(pT); - - OSVERSIONINFO ovi = { sizeof(OSVERSIONINFO) }; - ::GetVersionEx(&ovi); - - bool bWin9x = (ovi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS); - if(bWin9x) - { - // Windows 95, 98, ME - // Under Win9x, it is necessary to maintain a shadow buffer. - // It is only updated when the control contents have been changed. - pThisNoConst->m_bShadowBufferNeeded = TRUE; - } - else - { - // Windows NT, 2000, XP, etc. - pThisNoConst->m_bShadowBufferNeeded = FALSE; - -#ifndef _UNICODE - // On Windows XP (or later), if common controls version 6 is in use - // (such as via theming), then EM_GETHANDLE will always return a UNICODE string. - // If theming is enabled and Common Controls version 6 is in use, - // you're really not suppose to superclass or subclass common controls - // with an ANSI windows procedure (so its best to only theme if you use UNICODE). - // Using a shadow buffer uses GetWindowText instead, so it solves - // this problem for us (although it makes it a little less efficient). - - if((ovi.dwMajorVersion == 5 && ovi.dwMinorVersion >= 1) || (ovi.dwMajorVersion > 5)) - { - // We use DLLVERSIONINFO_private so we don't have to depend on shlwapi.h - typedef struct _DLLVERSIONINFO_private - { - DWORD cbSize; - DWORD dwMajorVersion; - DWORD dwMinorVersion; - DWORD dwBuildNumber; - DWORD dwPlatformID; - } DLLVERSIONINFO_private; - - HMODULE hModule = ::LoadLibrary("comctl32.dll"); - if(hModule != NULL) - { - typedef HRESULT (CALLBACK *LPFN_DllGetVersion)(DLLVERSIONINFO_private *); - LPFN_DllGetVersion fnDllGetVersion = (LPFN_DllGetVersion)::GetProcAddress(hModule, "DllGetVersion"); - if(fnDllGetVersion != NULL) - { - DLLVERSIONINFO_private version = { sizeof(DLLVERSIONINFO_private) }; - if(SUCCEEDED(fnDllGetVersion(&version))) - { - if(version.dwMajorVersion >= 6) - { - pThisNoConst->m_bShadowBufferNeeded = TRUE; - - ATLTRACE2(atlTraceUI, 0, _T("Warning: You have compiled for MBCS/ANSI but are using common controls version 6 or later (likely through a manifest file).\r\n")); - ATLTRACE2(atlTraceUI, 0, _T("If you use common controls version 6 or later, you should only do so for UNICODE builds.\r\n")); - } - } - } - - ::FreeLibrary(hModule); - hModule = NULL; - } - } -#endif // !_UNICODE - } - } - - return (pT->m_bShadowBufferNeeded != FALSE); - } }; @@ -935,21 +808,16 @@ class CRichEditFindReplaceImpl : public CEditFindReplaceImplBaseGetSel(ft.chrg); - if(m_bFirstSearch) + if(this->m_bFirstSearch) { if(bFindDown) - m_nInitialSearchPos = ft.chrg.cpMin; + this->m_nInitialSearchPos = ft.chrg.cpMin; else - m_nInitialSearchPos = ft.chrg.cpMax; - m_bFirstSearch = FALSE; + this->m_nInitialSearchPos = ft.chrg.cpMax; + this->m_bFirstSearch = FALSE; } -#if (_RICHEDIT_VER >= 0x0200) ft.lpstrText = (LPTSTR)lpszFind; -#else // !(_RICHEDIT_VER >= 0x0200) - USES_CONVERSION; - ft.lpstrText = T2A((LPTSTR)lpszFind); -#endif // !(_RICHEDIT_VER >= 0x0200) if(ft.chrg.cpMin != ft.chrg.cpMax) // i.e. there is a selection { @@ -960,18 +828,18 @@ class CRichEditFindReplaceImpl : public CEditFindReplaceImplBaseGetTextLength() + m_nInitialSearchPos; + ft.chrg.cpMax = pT->GetTextLength() + this->m_nInitialSearchPos; if(bFindDown) { - if(m_nInitialSearchPos >= 0) + if(this->m_nInitialSearchPos >= 0) ft.chrg.cpMax = pT->GetTextLength(); dwFlags |= FR_DOWN; @@ -979,7 +847,7 @@ class CRichEditFindReplaceImpl : public CEditFindReplaceImplBase= 0) + if(this->m_nInitialSearchPos >= 0) ft.chrg.cpMax = 0; dwFlags &= ~FR_DOWN; @@ -987,26 +855,25 @@ class CRichEditFindReplaceImpl : public CEditFindReplaceImplBaseFindAndSelect(dwFlags, ft) != -1) { bRet = TRUE; // we found the text } - else if(m_nInitialSearchPos > 0) + else if(this->m_nInitialSearchPos > 0) { // if the original starting point was not the beginning // of the buffer and we haven't already been here if(bFindDown) { ft.chrg.cpMin = 0; - ft.chrg.cpMax = m_nInitialSearchPos; + ft.chrg.cpMax = this->m_nInitialSearchPos; } else { ft.chrg.cpMin = pT->GetTextLength(); - ft.chrg.cpMax = m_nInitialSearchPos; + ft.chrg.cpMax = this->m_nInitialSearchPos; } - m_nInitialSearchPos = m_nInitialSearchPos - pT->GetTextLength(); + this->m_nInitialSearchPos = this->m_nInitialSearchPos - pT->GetTextLength(); bRet = (pT->FindAndSelect(dwFlags, ft) != -1) ? TRUE : FALSE; } diff --git a/thirdparty/wtl/atlframe.h b/thirdparty/wtl/atlframe.h index 7b02526..3791e6b 100644 --- a/thirdparty/wtl/atlframe.h +++ b/thirdparty/wtl/atlframe.h @@ -1,13 +1,10 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. +// Windows Template Library - WTL version 10.0 +// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. +// Microsoft Public License (http://opensource.org/licenses/MS-PL) +// which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLFRAME_H__ #define __ATLFRAME_H__ @@ -52,13 +49,8 @@ namespace WTL class CFrameWndClassInfo { public: -#ifndef _WIN32_WCE enum { cchAutoName = 5 + sizeof(void*) * 2 }; // sizeof(void*) * 2 is the number of digits %p outputs WNDCLASSEX m_wc; -#else // CE specific - enum { cchAutoName = MAX_PATH }; // MAX_PATH because this can be set in the wizard generated CMainFrame::ActivatePreviousInstance to a user defined string. - WNDCLASS m_wc; -#endif // !_WIN32_WCE LPCTSTR m_lpszOrigName; WNDPROC pWndProc; LPCTSTR m_lpszCursorID; @@ -67,7 +59,6 @@ class CFrameWndClassInfo TCHAR m_szAutoName[cchAutoName]; UINT m_uCommonResourceID; -#ifndef _WIN32_WCE ATOM Register(WNDPROC* pProc) { if (m_atom == 0) @@ -115,11 +106,7 @@ class CFrameWndClassInfo m_wc.style &= ~CS_GLOBALCLASS; // we don't register global classes if (m_wc.lpszClassName == NULL) { -#if (_WIN32_WINNT >= 0x0500) || defined(_WIN64) - SecureHelper::wsprintf_x(m_szAutoName, cchAutoName, _T("ATL:%p"), &m_wc); -#else // !((_WIN32_WINNT >= 0x0500) || defined(_WIN64)) - SecureHelper::wsprintf_x(m_szAutoName, cchAutoName, _T("ATL:%8.8X"), (DWORD_PTR)&m_wc); -#endif // !((_WIN32_WINNT >= 0x0500) || defined(_WIN64)) + _stprintf_s(m_szAutoName, cchAutoName, _T("ATL:%p"), &m_wc); m_wc.lpszClassName = m_szAutoName; } @@ -129,8 +116,12 @@ class CFrameWndClassInfo { if(m_uCommonResourceID != 0) // use it if not zero { - m_wc.hIcon = (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(m_uCommonResourceID), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR); - m_wc.hIconSm = (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(m_uCommonResourceID), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); + m_wc.hIcon = (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), + MAKEINTRESOURCE(m_uCommonResourceID), IMAGE_ICON, + ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR); + m_wc.hIconSm = (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), + MAKEINTRESOURCE(m_uCommonResourceID), IMAGE_ICON, + ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR); } m_atom = ::RegisterClassEx(&m_wc); } @@ -148,93 +139,12 @@ class CFrameWndClassInfo return m_atom; } -#else // CE specific - ATOM Register(WNDPROC* pProc) - { - if (m_atom == 0) - { - CWindowCreateCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CFrameWndClassInfo::Register.\n")); - ATLASSERT(FALSE); - return 0; - } - - if(m_atom == 0) - { - HINSTANCE hInst = ModuleHelper::GetModuleInstance(); - - if (m_lpszOrigName != NULL) - { - ATLASSERT(pProc != NULL); - LPCTSTR lpsz = m_wc.lpszClassName; - WNDPROC proc = m_wc.lpfnWndProc; - - WNDCLASS wc = { 0 }; - // try process local class first - if(!::GetClassInfo(ModuleHelper::GetModuleInstance(), m_lpszOrigName, &wc)) - { - // try global class - if(!::GetClassInfo(NULL, m_lpszOrigName, &wc)) - { - lock.Unlock(); - return 0; - } - } - m_wc = wc; - pWndProc = m_wc.lpfnWndProc; - m_wc.lpszClassName = lpsz; - m_wc.lpfnWndProc = proc; - } - else - { -#if defined(GWES_CURSOR) || defined(GWES_MCURSOR) - m_wc.hCursor = ::LoadCursor(m_bSystemCursor ? NULL : hInst, m_lpszCursorID); -#else // !(defined(GWES_CURSOR) || defined(GWES_MCURSOR)) - m_wc.hCursor = NULL; -#endif // !(defined(GWES_CURSOR) || defined(GWES_MCURSOR)) - } - - m_wc.hInstance = hInst; - m_wc.style &= ~CS_GLOBALCLASS; // we don't register global classes - if (m_wc.lpszClassName == NULL) - { - wsprintf(m_szAutoName, _T("ATL:%8.8X"), (DWORD_PTR)&m_wc); - m_wc.lpszClassName = m_szAutoName; - } - - WNDCLASS wcTemp = m_wc; - m_atom = (ATOM)::GetClassInfo(m_wc.hInstance, m_wc.lpszClassName, &wcTemp); - if (m_atom == 0) - { - if(m_uCommonResourceID != 0) // use it if not zero - m_wc.hIcon = (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(m_uCommonResourceID), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR); - m_atom = ::RegisterClass(&m_wc); - } - } - - lock.Unlock(); - } - - if (m_lpszOrigName != NULL) - { - ATLASSERT(pProc != NULL); - ATLASSERT(pWndProc != NULL); - *pProc = pWndProc; - } - - return m_atom; - } -#endif // _WIN32_WCE }; /////////////////////////////////////////////////////////////////////////////// // Macros for declaring frame window WNDCLASS -#ifndef _WIN32_WCE - #define DECLARE_FRAME_WND_CLASS(WndClassName, uCommonResourceID) \ static WTL::CFrameWndClassInfo& GetWndClassInfo() \ { \ @@ -271,53 +181,13 @@ static WTL::CFrameWndClassInfo& GetWndClassInfo() \ return wc; \ } -#else // CE specific - -#define DECLARE_FRAME_WND_CLASS(WndClassName, uCommonResourceID) \ -static WTL::CFrameWndClassInfo& GetWndClassInfo() \ -{ \ - static WTL::CFrameWndClassInfo wc = \ - { \ - { 0, StartWindowProc, \ - 0, 0, NULL, NULL, NULL, (HBRUSH)(COLOR_WINDOW + 1), NULL, WndClassName }, \ - NULL, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ - }; \ - return wc; \ -} - -#define DECLARE_FRAME_WND_CLASS_EX(WndClassName, uCommonResourceID, style, bkgnd) \ -static WTL::CFrameWndClassInfo& GetWndClassInfo() \ -{ \ - static WTL::CFrameWndClassInfo wc = \ - { \ - { style, StartWindowProc, \ - 0, 0, NULL, NULL, NULL, (HBRUSH)(bkgnd + 1), NULL, WndClassName }, \ - NULL, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ - }; \ - return wc; \ -} - -#define DECLARE_FRAME_WND_SUPERCLASS(WndClassName, OrigWndClassName, uCommonResourceID) \ -static WTL::CFrameWndClassInfo& GetWndClassInfo() \ -{ \ - static WTL::CFrameWndClassInfo wc = \ - { \ - { NULL, StartWindowProc, \ - 0, 0, NULL, NULL, NULL, NULL, NULL, WndClassName }, \ - OrigWndClassName, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ - }; \ - return wc; \ -} - -#endif // !_WIN32_WCE - /////////////////////////////////////////////////////////////////////////////// // CFrameWindowImpl // Client window command chaining macro (only for frame windows) #define CHAIN_CLIENT_COMMANDS() \ - if(uMsg == WM_COMMAND && m_hWndClient != NULL) \ + if((uMsg == WM_COMMAND) && (m_hWndClient != NULL)) \ ::SendMessage(m_hWndClient, uMsg, wParam, lParam); // standard toolbar styles @@ -327,24 +197,14 @@ static WTL::CFrameWndClassInfo& GetWndClassInfo() \ #define ATL_SIMPLE_TOOLBAR_PANE_STYLE \ (WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | CCS_NODIVIDER | CCS_NORESIZE | CCS_NOPARENTALIGN | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT) // standard rebar styles -#if (_WIN32_IE >= 0x0400) #define ATL_SIMPLE_REBAR_STYLE \ (WS_CHILD | WS_VISIBLE | WS_BORDER | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | RBS_VARHEIGHT | RBS_BANDBORDERS | RBS_AUTOSIZE) -#else - #define ATL_SIMPLE_REBAR_STYLE \ - (WS_CHILD | WS_VISIBLE | WS_BORDER | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | RBS_VARHEIGHT | RBS_BANDBORDERS) -#endif // !(_WIN32_IE >= 0x0400) // rebar without borders -#if (_WIN32_IE >= 0x0400) #define ATL_SIMPLE_REBAR_NOBORDER_STYLE \ (WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | RBS_VARHEIGHT | RBS_BANDBORDERS | RBS_AUTOSIZE | CCS_NODIVIDER) -#else - #define ATL_SIMPLE_REBAR_NOBORDER_STYLE \ - (WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | RBS_VARHEIGHT | RBS_BANDBORDERS | CCS_NODIVIDER) -#endif // !(_WIN32_IE >= 0x0400) // command bar support -#if !defined(__ATLCTRLW_H__) && !defined(_WIN32_WCE) +#if !defined(__ATLCTRLW_H__) #define CBRM_GETCMDBAR (WM_USER + 301) // returns command bar HWND #define CBRM_GETMENU (WM_USER + 302) // returns loaded or attached menu @@ -362,33 +222,37 @@ struct _AtlFrameWnd_CmdBarPopupMenu #define CBRPOPUPMENU _AtlFrameWnd_CmdBarPopupMenu -#endif // !defined(__ATLCTRLW_H__) && !defined(_WIN32_WCE) +#endif // !defined(__ATLCTRLW_H__) template class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, TWinTraits > { public: - DECLARE_FRAME_WND_CLASS(NULL, 0) + // This is instead of DECLARE_FRAME_WND_CLASS(NULL, 0) + static CFrameWndClassInfo& GetWndClassInfo() + { + static CFrameWndClassInfo wc = + { + { sizeof(WNDCLASSEX), 0, ATL::CWindowImplBaseT::StartWindowProc, + 0, 0, NULL, NULL, NULL, (HBRUSH)(COLOR_WINDOW + 1), NULL, NULL, NULL }, + NULL, NULL, IDC_ARROW, TRUE, 0, _T(""), 0 + }; + return wc; + } -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) struct _ChevronMenuInfo { HMENU hMenu; LPNMREBARCHEVRON lpnm; bool bCmdBar; }; -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) // Data members HWND m_hWndToolBar; HWND m_hWndStatusBar; HWND m_hWndClient; -#ifdef _WIN32_WCE - HWND m_hWndCECommandBar; -#endif // _WIN32_WCE - HACCEL m_hAccel; // Constructor @@ -396,23 +260,28 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, m_hWndToolBar(NULL), m_hWndStatusBar(NULL), m_hWndClient(NULL), -#ifdef _WIN32_WCE - m_hWndCECommandBar(NULL), -#endif // _WIN32_WCE m_hAccel(NULL) { } // Methods HWND Create(HWND hWndParent, ATL::_U_RECT rect, LPCTSTR szWindowName, DWORD dwStyle, DWORD dwExStyle, ATL::_U_MENUorID MenuOrID, ATOM atom, LPVOID lpCreateParam) { - ATLASSERT(m_hWnd == NULL); + ATLASSERT(this->m_hWnd == NULL); + + // Allocate the thunk structure here, where we can fail gracefully. + BOOL bRet = this->m_thunk.Init(NULL, NULL); + if(bRet == FALSE) + { + ::SetLastError(ERROR_OUTOFMEMORY); + return NULL; + } if(atom == 0) return NULL; - ModuleHelper::AddCreateWndData(&m_thunk.cd, this); + ModuleHelper::AddCreateWndData(&this->m_thunk.cd, this); - if(MenuOrID.m_hMenu == NULL && (dwStyle & WS_CHILD)) + if((MenuOrID.m_hMenu == NULL) && (dwStyle & WS_CHILD)) MenuOrID.m_hMenu = (HMENU)(UINT_PTR)this; if(rect.m_lpRect == NULL) rect.m_lpRect = &TBase::rcDefault; @@ -422,7 +291,7 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, rect.m_lpRect->bottom - rect.m_lpRect->top, hWndParent, MenuOrID.m_hMenu, ModuleHelper::GetModuleInstance(), lpCreateParam); - ATLASSERT(hWnd == NULL || m_hWnd == hWnd); + ATLASSERT((hWnd == NULL) || (this->m_hWnd == hWnd)); return hWnd; } @@ -446,7 +315,7 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, WORD* pItems = pData->items(); int nItems = pData->wItemCount + (bInitialSeparator ? 1 : 0); - CTempBuffer buff; + ATL::CTempBuffer buff; TBBUTTON* pTBBtn = buff.Allocate(nItems); ATLASSERT(pTBBtn != NULL); if(pTBBtn == NULL) @@ -460,7 +329,7 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, pTBBtn[0].iBitmap = cxSeparator / 2; pTBBtn[0].idCommand = 0; pTBBtn[0].fsState = 0; - pTBBtn[0].fsStyle = TBSTYLE_SEP; + pTBBtn[0].fsStyle = BTNS_SEP; pTBBtn[0].dwData = 0; pTBBtn[0].iString = 0; } @@ -473,7 +342,7 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, pTBBtn[j].iBitmap = nBmp++; pTBBtn[j].idCommand = pItems[i]; pTBBtn[j].fsState = TBSTATE_ENABLED; - pTBBtn[j].fsStyle = TBSTYLE_BUTTON; + pTBBtn[j].fsStyle = BTNS_BUTTON; pTBBtn[j].dwData = 0; pTBBtn[j].iString = 0; } @@ -482,25 +351,18 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, pTBBtn[j].iBitmap = cxSeparator; pTBBtn[j].idCommand = 0; pTBBtn[j].fsState = 0; - pTBBtn[j].fsStyle = TBSTYLE_SEP; + pTBBtn[j].fsStyle = BTNS_SEP; pTBBtn[j].dwData = 0; pTBBtn[j].iString = 0; } } -#ifndef _WIN32_WCE HWND hWnd = ::CreateWindowEx(0, TOOLBARCLASSNAME, NULL, dwStyle, 0, 0, 100, 100, hWndParent, (HMENU)LongToHandle(nID), ModuleHelper::GetModuleInstance(), NULL); if(hWnd == NULL) { ATLASSERT(FALSE); return NULL; } -#else // CE specific - dwStyle; - nID; - // The toolbar must go onto the existing CommandBar or MenuBar - HWND hWnd = hWndParent; -#endif // _WIN32_WCE ::SendMessage(hWnd, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0L); @@ -512,7 +374,6 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, font.GetLogFont(lf); WORD cyFontHeight = (WORD)abs(lf.lfHeight); -#ifndef _WIN32_WCE WORD bitsPerPixel = AtlGetBitmapResourceBitsPerPixel(nResourceID); if(bitsPerPixel > 4) { @@ -527,7 +388,6 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, ::SendMessage(hWnd, TB_SETIMAGELIST, 0, (LPARAM)hImageList); } else -#endif // !_WIN32_WCE { TBADDBITMAP tbab = { 0 }; tbab.hInst = hInst; @@ -536,18 +396,17 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, } ::SendMessage(hWnd, TB_ADDBUTTONS, nItems, (LPARAM)pTBBtn); - ::SendMessage(hWnd, TB_SETBITMAPSIZE, 0, MAKELONG(pData->wWidth, max(pData->wHeight, cyFontHeight))); + ::SendMessage(hWnd, TB_SETBITMAPSIZE, 0, MAKELONG(pData->wWidth, __max(pData->wHeight, cyFontHeight))); const int cxyButtonMargin = 7; - ::SendMessage(hWnd, TB_SETBUTTONSIZE, 0, MAKELONG(pData->wWidth + cxyButtonMargin, max(pData->wHeight, cyFontHeight) + cxyButtonMargin)); + ::SendMessage(hWnd, TB_SETBUTTONSIZE, 0, MAKELONG(pData->wWidth + cxyButtonMargin, __max(pData->wHeight, cyFontHeight) + cxyButtonMargin)); return hWnd; } -#ifndef _WIN32_WCE static HWND CreateSimpleReBarCtrl(HWND hWndParent, DWORD dwStyle = ATL_SIMPLE_REBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) { // Ensure style combinations for proper rebar painting - if(dwStyle & CCS_NODIVIDER && dwStyle & WS_BORDER) + if(dwStyle & CCS_NODIVIDER && (dwStyle & WS_BORDER)) dwStyle &= ~WS_BORDER; else if(!(dwStyle & WS_BORDER) && !(dwStyle & CCS_NODIVIDER)) dwStyle |= CCS_NODIVIDER; @@ -575,7 +434,7 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, BOOL CreateSimpleReBar(DWORD dwStyle = ATL_SIMPLE_REBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) { ATLASSERT(!::IsWindow(m_hWndToolBar)); - m_hWndToolBar = CreateSimpleReBarCtrl(m_hWnd, dwStyle, nID); + m_hWndToolBar = CreateSimpleReBarCtrl(this->m_hWnd, dwStyle, nID); return (m_hWndToolBar != NULL); } @@ -597,18 +456,12 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, // Set band info structure REBARBANDINFO rbBand = { RunTimeHelper::SizeOf_REBARBANDINFO() }; -#if (_WIN32_IE >= 0x0400) rbBand.fMask = RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_STYLE | RBBIM_ID | RBBIM_SIZE | RBBIM_IDEALSIZE; -#else - rbBand.fMask = RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_STYLE | RBBIM_ID | RBBIM_SIZE; -#endif // !(_WIN32_IE >= 0x0400) if(lpstrTitle != NULL) rbBand.fMask |= RBBIM_TEXT; rbBand.fStyle = RBBS_CHILDEDGE; -#if (_WIN32_IE >= 0x0500) if(nBtnCount > 0) // add chevron style for toolbar with buttons rbBand.fStyle |= RBBS_USECHEVRON; -#endif // (_WIN32_IE >= 0x0500) if(bNewRow) rbBand.fStyle |= RBBS_BREAK; @@ -651,9 +504,7 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, rbBand.cyMinChild = rcTmp.bottom - rcTmp.top; } -#if (_WIN32_IE >= 0x0400) rbBand.cxIdeal = rbBand.cx; -#endif // (_WIN32_IE >= 0x0400) // Add the band LRESULT lRes = ::SendMessage(hWndReBar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand); @@ -663,10 +514,8 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, return FALSE; } -#if (_WIN32_IE >= 0x0501) DWORD dwExStyle = (DWORD)::SendMessage(hWndBand, TB_GETEXTENDEDSTYLE, 0, 0L); ::SendMessage(hWndBand, TB_SETEXTENDEDSTYLE, 0, dwExStyle | TBSTYLE_EX_HIDECLIPPEDBUTTONS); -#endif // (_WIN32_IE >= 0x0501) return TRUE; } @@ -678,7 +527,6 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, return AddSimpleReBarBandCtrl(m_hWndToolBar, hWndBand, 0, lpstrTitle, bNewRow, cxWidth, bFullWidthAlways); } -#if (_WIN32_IE >= 0x0400) void SizeSimpleReBarBands() { ATLASSERT(::IsWindow(m_hWndToolBar)); // must be an existing rebar @@ -691,32 +539,22 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, rbBand.fMask = RBBIM_SIZE; BOOL bRet = (BOOL)::SendMessage(m_hWndToolBar, RB_GETBANDINFO, i, (LPARAM)&rbBand); ATLASSERT(bRet); - RECT rect = { 0, 0, 0, 0 }; + RECT rect = { 0 }; ::SendMessage(m_hWndToolBar, RB_GETBANDBORDERS, i, (LPARAM)&rect); rbBand.cx += rect.left + rect.right; bRet = (BOOL)::SendMessage(m_hWndToolBar, RB_SETBANDINFO, i, (LPARAM)&rbBand); ATLASSERT(bRet); } } -#endif // (_WIN32_IE >= 0x0400) -#endif // _WIN32_WCE -#ifndef _WIN32_WCE BOOL CreateSimpleStatusBar(LPCTSTR lpstrText, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBARS_SIZEGRIP, UINT nID = ATL_IDW_STATUS_BAR) -#else // CE specific - BOOL CreateSimpleStatusBar(LPCTSTR lpstrText, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, UINT nID = ATL_IDW_STATUS_BAR) -#endif // _WIN32_WCE { ATLASSERT(!::IsWindow(m_hWndStatusBar)); - m_hWndStatusBar = ::CreateStatusWindow(dwStyle, lpstrText, m_hWnd, nID); + m_hWndStatusBar = ::CreateStatusWindow(dwStyle, lpstrText, this->m_hWnd, nID); return (m_hWndStatusBar != NULL); } -#ifndef _WIN32_WCE BOOL CreateSimpleStatusBar(UINT nTextID = ATL_IDS_IDLEMESSAGE, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBARS_SIZEGRIP, UINT nID = ATL_IDW_STATUS_BAR) -#else // CE specific - BOOL CreateSimpleStatusBar(UINT nTextID = ATL_IDS_IDLEMESSAGE, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, UINT nID = ATL_IDW_STATUS_BAR) -#endif // _WIN32_WCE { const int cchMax = 128; // max text length is 127 for status bars (+1 for null) TCHAR szText[cchMax] = { 0 }; @@ -724,72 +562,10 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, return CreateSimpleStatusBar(szText, dwStyle, nID); } -#ifdef _WIN32_WCE - BOOL CreateSimpleCECommandBar(LPTSTR pszMenu = NULL, WORD iButton = 0, DWORD dwFlags = 0, int nCmdBarID = 1) - { - ATLASSERT(m_hWndCECommandBar == NULL); - ATLASSERT(m_hWndToolBar == NULL); - - m_hWndCECommandBar = ::CommandBar_Create(ModuleHelper::GetModuleInstance(), m_hWnd, nCmdBarID); - if(m_hWndCECommandBar == NULL) - return FALSE; - - m_hWndToolBar = m_hWndCECommandBar; - - BOOL bRet = TRUE; - - if(pszMenu != NULL) - bRet &= ::CommandBar_InsertMenubarEx(m_hWndCECommandBar, IS_INTRESOURCE(pszMenu) ? ModuleHelper::GetResourceInstance() : NULL, pszMenu, iButton); - - bRet &= ::CommandBar_AddAdornments(m_hWndCECommandBar, dwFlags, 0); - - return bRet; - } - -#if defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) - BOOL CreateSimpleCEMenuBar(UINT nToolBarId = ATL_IDW_MENU_BAR, DWORD dwFlags = 0, int nBmpId = 0, int cBmpImages = 0) - { - ATLASSERT(m_hWndCECommandBar == NULL); - - SHMENUBARINFO mbi = { 0 }; - mbi.cbSize = sizeof(mbi); - mbi.hwndParent = m_hWnd; - mbi.dwFlags = dwFlags; - mbi.nToolBarId = nToolBarId; - mbi.hInstRes = ModuleHelper::GetResourceInstance(); - mbi.nBmpId = nBmpId; - mbi.cBmpImages = cBmpImages; - mbi.hwndMB = NULL; // This gets set by SHCreateMenuBar - - BOOL bRet = ::SHCreateMenuBar(&mbi); - if(bRet != FALSE) - { - m_hWndCECommandBar = mbi.hwndMB; - SizeToMenuBar(); - } - - return bRet; - } - - void SizeToMenuBar() // for menu bar only - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(::IsWindow(m_hWndCECommandBar)); - - RECT rect = { 0 }; - GetWindowRect(&rect); - RECT rectMB = { 0 }; - ::GetWindowRect(m_hWndCECommandBar, &rectMB); - int cy = ::IsWindowVisible(m_hWndCECommandBar) ? rectMB.top - rect.top : rectMB.bottom - rect.top; - SetWindowPos(NULL, 0, 0, rect.right - rect.left, cy, SWP_NOZORDER | SWP_NOMOVE); - } -#endif // defined(_AYGSHELL_H_) || defined(__AYGSHELL_H__) -#endif // _WIN32_WCE - void UpdateLayout(BOOL bResizeBars = TRUE) { RECT rect = { 0 }; - GetClientRect(&rect); + this->GetClientRect(&rect); // position bars and offset their dimensions UpdateBarsPosition(rect, bResizeBars); @@ -804,7 +580,7 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, void UpdateBarsPosition(RECT& rect, BOOL bResizeBars = TRUE) { // resize toolbar - if(m_hWndToolBar != NULL && ((DWORD)::GetWindowLong(m_hWndToolBar, GWL_STYLE) & WS_VISIBLE)) + if((m_hWndToolBar != NULL) && ((DWORD)::GetWindowLong(m_hWndToolBar, GWL_STYLE) & WS_VISIBLE)) { if(bResizeBars != FALSE) { @@ -817,7 +593,7 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, } // resize status bar - if(m_hWndStatusBar != NULL && ((DWORD)::GetWindowLong(m_hWndStatusBar, GWL_STYLE) & WS_VISIBLE)) + if((m_hWndStatusBar != NULL) && ((DWORD)::GetWindowLong(m_hWndStatusBar, GWL_STYLE) & WS_VISIBLE)) { if(bResizeBars != FALSE) ::SendMessage(m_hWndStatusBar, WM_SIZE, 0, 0); @@ -829,22 +605,18 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, BOOL PreTranslateMessage(MSG* pMsg) { - if(m_hAccel != NULL && ::TranslateAccelerator(m_hWnd, m_hAccel, pMsg)) + if((m_hAccel != NULL) && ::TranslateAccelerator(this->m_hWnd, m_hAccel, pMsg)) return TRUE; return FALSE; } BEGIN_MSG_MAP(CFrameWindowImplBase) MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) -#ifndef _WIN32_WCE MESSAGE_HANDLER(WM_MENUSELECT, OnMenuSelect) -#endif // !_WIN32_WCE MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) MESSAGE_HANDLER(WM_DESTROY, OnDestroy) -#ifndef _WIN32_WCE NOTIFY_CODE_HANDLER(TTN_GETDISPINFOA, OnToolTipTextA) NOTIFY_CODE_HANDLER(TTN_GETDISPINFOW, OnToolTipTextW) -#endif // !_WIN32_WCE END_MSG_MAP() LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) @@ -856,7 +628,6 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, return 0; } -#ifndef _WIN32_WCE LRESULT OnMenuSelect(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { bHandled = FALSE; @@ -865,7 +636,7 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, return 1; WORD wFlags = HIWORD(wParam); - if(wFlags == 0xFFFF && lParam == NULL) // menu closing + if((wFlags == 0xFFFF) && (lParam == NULL)) // menu closing { ::SendMessage(m_hWndStatusBar, SB_SIMPLE, FALSE, 0L); } @@ -877,11 +648,11 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, { WORD wID = LOWORD(wParam); // check for special cases - if(wID >= 0xF000 && wID < 0xF1F0) // system menu IDs + if((wID >= 0xF000) && (wID < 0xF1F0)) // system menu IDs wID = (WORD)(((wID - 0xF000) >> 4) + ATL_IDS_SCFIRST); - else if(wID >= ID_FILE_MRU_FIRST && wID <= ID_FILE_MRU_LAST) // MRU items + else if((wID >= ID_FILE_MRU_FIRST) && (wID <= ID_FILE_MRU_LAST)) // MRU items wID = ATL_IDS_MRU_FILE; - else if(wID >= ATL_IDM_FIRST_MDICHILD && wID <= ATL_IDM_LAST_MDICHILD) // MDI child windows + else if((wID >= ATL_IDM_FIRST_MDICHILD) && (wID <= ATL_IDM_LAST_MDICHILD)) // MDI child windows wID = ATL_IDS_MDICHILD; int nRet = ::LoadString(ModuleHelper::GetResourceInstance(), wID, szBuff, cchBuff); @@ -900,7 +671,6 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, return 1; } -#endif // !_WIN32_WCE LRESULT OnSetFocus(UINT, WPARAM, LPARAM, BOOL& bHandled) { @@ -913,19 +683,16 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, LRESULT OnDestroy(UINT, WPARAM, LPARAM, BOOL& bHandled) { - if((GetStyle() & (WS_CHILD | WS_POPUP)) == 0) + if((this->GetStyle() & (WS_CHILD | WS_POPUP)) == 0) ::PostQuitMessage(1); bHandled = FALSE; return 1; } -#ifndef _WIN32_WCE LRESULT OnToolTipTextA(int idCtrl, LPNMHDR pnmh, BOOL& /*bHandled*/) { LPNMTTDISPINFOA pDispInfo = (LPNMTTDISPINFOA)pnmh; - pDispInfo->szText[0] = 0; - if((idCtrl != 0) && !(pDispInfo->uFlags & TTF_IDISHWND)) { const int cchBuff = 256; @@ -935,14 +702,12 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, { if(szBuff[i] == '\n') { - SecureHelper::strncpyA_x(pDispInfo->szText, _countof(pDispInfo->szText), &szBuff[i + 1], _TRUNCATE); + ATL::Checked::strncpy_s(pDispInfo->szText, _countof(pDispInfo->szText), &szBuff[i + 1], _TRUNCATE); break; } } -#if (_WIN32_IE >= 0x0300) if(nRet > 0) // string was loaded, save it pDispInfo->uFlags |= TTF_DI_SETITEM; -#endif // (_WIN32_IE >= 0x0300) } return 0; @@ -951,8 +716,6 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, LRESULT OnToolTipTextW(int idCtrl, LPNMHDR pnmh, BOOL& /*bHandled*/) { LPNMTTDISPINFOW pDispInfo = (LPNMTTDISPINFOW)pnmh; - pDispInfo->szText[0] = 0; - if((idCtrl != 0) && !(pDispInfo->uFlags & TTF_IDISHWND)) { const int cchBuff = 256; @@ -962,22 +725,18 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, { if(szBuff[i] == L'\n') { - SecureHelper::strncpyW_x(pDispInfo->szText, _countof(pDispInfo->szText), &szBuff[i + 1], _TRUNCATE); + ATL::Checked::wcsncpy_s(pDispInfo->szText, _countof(pDispInfo->szText), &szBuff[i + 1], _TRUNCATE); break; } } -#if (_WIN32_IE >= 0x0300) if(nRet > 0) // string was loaded, save it pDispInfo->uFlags |= TTF_DI_SETITEM; -#endif // (_WIN32_IE >= 0x0300) } return 0; } -#endif // !_WIN32_WCE // Implementation - chevron menu support -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) bool PrepareChevronMenu(_ChevronMenuInfo& cmi) { // get rebar and toolbar @@ -1015,7 +774,7 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, bRet = (BOOL)wnd.SendMessage(TB_GETITEMRECT, i, (LPARAM)&rcButton); ATLASSERT(bRet); bool bEnabled = ((tbb.fsState & TBSTATE_ENABLED) != 0); - if(rcButton.right > rcClient.right) + if((rcButton.right > rcClient.right) || (rcButton.bottom > rcClient.bottom)) { if(tbb.fsStyle & BTNS_SEP) { @@ -1042,13 +801,13 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, // get button's text const int cchBuff = 200; TCHAR szBuff[cchBuff] = { 0 }; - LPTSTR lpstrText = szBuff; + LPCTSTR lpstrText = szBuff; TBBUTTONINFO tbbi = { 0 }; tbbi.cbSize = sizeof(TBBUTTONINFO); tbbi.dwMask = TBIF_TEXT; tbbi.pszText = szBuff; tbbi.cchText = cchBuff; - if(wnd.SendMessage(TB_GETBUTTONINFO, tbb.idCommand, (LPARAM)&tbbi) == -1 || lstrlen(szBuff) == 0) + if((wnd.SendMessage(TB_GETBUTTONINFO, tbb.idCommand, (LPARAM)&tbbi) == -1) || (szBuff[0] == 0)) { // no text for this button, try a resource string lpstrText = _T(""); @@ -1081,9 +840,6 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, void DisplayChevronMenu(_ChevronMenuInfo& cmi) { -#ifndef TPM_VERPOSANIMATION - const UINT TPM_VERPOSANIMATION = 0x1000L; // Menu animation flag -#endif // convert chevron rect to screen coordinates ATL::CWindow wndFrom = cmi.lpnm->hdr.hwndFrom; POINT pt = { cmi.lpnm->rc.left, cmi.lpnm->rc.bottom }; @@ -1091,12 +847,12 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, RECT rc = cmi.lpnm->rc; wndFrom.MapWindowPoints(NULL, &rc); // set up flags and rect - UINT uMenuFlags = TPM_LEFTBUTTON | TPM_VERTICAL | TPM_LEFTALIGN | TPM_TOPALIGN | (!AtlIsOldWindows() ? TPM_VERPOSANIMATION : 0); + UINT uMenuFlags = TPM_LEFTBUTTON | TPM_VERTICAL | TPM_LEFTALIGN | TPM_TOPALIGN | TPM_VERPOSANIMATION; TPMPARAMS TPMParams = { 0 }; TPMParams.cbSize = sizeof(TPMPARAMS); TPMParams.rcExclude = rc; // check if this window has a command bar - HWND hWndCmdBar = (HWND)::SendMessage(m_hWnd, CBRM_GETCMDBAR, 0, 0L); + HWND hWndCmdBar = (HWND)::SendMessage(this->m_hWnd, CBRM_GETCMDBAR, 0, 0L); if(::IsWindow(hWndCmdBar)) { CBRPOPUPMENU CBRPopupMenu = { sizeof(CBRPOPUPMENU), cmi.hMenu, uMenuFlags, pt.x, pt.y, &TPMParams }; @@ -1105,7 +861,7 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, else { CMenuHandle menu = cmi.hMenu; - menu.TrackPopupMenuEx(uMenuFlags, pt.x, pt.y, m_hWnd, &TPMParams); + menu.TrackPopupMenuEx(uMenuFlags, pt.x, pt.y, this->m_hWnd, &TPMParams); } } @@ -1126,10 +882,9 @@ class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, wndFrom.MapWindowPoints(NULL, &rc); // eat next message if click is on the same button MSG msg = { 0 }; - if(::PeekMessage(&msg, m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_NOREMOVE) && ::PtInRect(&rc, msg.pt)) - ::PeekMessage(&msg, m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_REMOVE); + if(::PeekMessage(&msg, this->m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_NOREMOVE) && ::PtInRect(&rc, msg.pt)) + ::PeekMessage(&msg, this->m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_REMOVE); } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) }; @@ -1141,7 +896,7 @@ class ATL_NO_VTABLE CFrameWindowImpl : public CFrameWindowImplBase< TBase, TWinT DWORD dwStyle = 0, DWORD dwExStyle = 0, HMENU hMenu = NULL, LPVOID lpCreateParam = NULL) { - ATOM atom = T::GetWndClassInfo().Register(&m_pfnSuperWindowProc); + ATOM atom = T::GetWndClassInfo().Register(&this->m_pfnSuperWindowProc); dwStyle = T::GetWndStyle(dwStyle); dwExStyle = T::GetWndExStyle(dwExStyle); @@ -1156,23 +911,14 @@ class ATL_NO_VTABLE CFrameWindowImpl : public CFrameWindowImplBase< TBase, TWinT { const int cchName = 256; TCHAR szWindowName[cchName] = { 0 }; -#ifndef _WIN32_WCE ::LoadString(ModuleHelper::GetResourceInstance(), T::GetWndClassInfo().m_uCommonResourceID, szWindowName, cchName); HMENU hMenu = ::LoadMenu(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(T::GetWndClassInfo().m_uCommonResourceID)); -#else // CE specific - ::LoadString(ModuleHelper::GetResourceInstance(), T::GetWndClassInfo().m_uCommonResourceID, szWindowName, cchName); - - // This always needs to be NULL for Windows CE. - // Frame Window menus have to go onto the CommandBar. - // Use CreateSimpleCECommandBar - HMENU hMenu = NULL; -#endif // _WIN32_WCE T* pT = static_cast(this); HWND hWnd = pT->Create(hWndParent, rect, szWindowName, dwStyle, dwExStyle, hMenu, lpCreateParam); if(hWnd != NULL) - m_hAccel = ::LoadAccelerators(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(T::GetWndClassInfo().m_uCommonResourceID)); + this->m_hAccel = ::LoadAccelerators(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(T::GetWndClassInfo().m_uCommonResourceID)); return hWnd; } @@ -1181,26 +927,10 @@ class ATL_NO_VTABLE CFrameWindowImpl : public CFrameWindowImplBase< TBase, TWinT { if(nResourceID == 0) nResourceID = T::GetWndClassInfo().m_uCommonResourceID; -#ifndef _WIN32_WCE ATLASSERT(!::IsWindow(m_hWndToolBar)); m_hWndToolBar = T::CreateSimpleToolBarCtrl(m_hWnd, nResourceID, TRUE, dwStyle, nID); return (m_hWndToolBar != NULL); -#else // CE specific - HWND hWnd= T::CreateSimpleToolBarCtrl(m_hWndCECommandBar, nResourceID, TRUE, dwStyle, nID); - return (hWnd != NULL); -#endif // _WIN32_WCE - } - -#ifdef _WIN32_WCE - // CE specific variant that returns the handle of the toolbar - HWND CreateSimpleCEToolBar(UINT nResourceID = 0, DWORD dwStyle = ATL_SIMPLE_TOOLBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) - { - if(nResourceID == 0) - nResourceID = T::GetWndClassInfo().m_uCommonResourceID; - - return T::CreateSimpleToolBarCtrl(m_hWndCECommandBar, nResourceID, TRUE, dwStyle, nID); } -#endif // _WIN32_WCE // message map and handlers typedef CFrameWindowImplBase< TBase, TWinTraits > _baseClass; @@ -1208,12 +938,8 @@ class ATL_NO_VTABLE CFrameWindowImpl : public CFrameWindowImplBase< TBase, TWinT BEGIN_MSG_MAP(CFrameWindowImpl) MESSAGE_HANDLER(WM_SIZE, OnSize) #ifndef _ATL_NO_REBAR_SUPPORT -#if (_WIN32_IE >= 0x0400) NOTIFY_CODE_HANDLER(RBN_AUTOSIZE, OnReBarAutoSize) -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) NOTIFY_CODE_HANDLER(RBN_CHEVRONPUSHED, OnChevronPushed) -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) #endif // !_ATL_NO_REBAR_SUPPORT CHAIN_MSG_MAP(_baseClass) END_MSG_MAP() @@ -1230,20 +956,17 @@ class ATL_NO_VTABLE CFrameWindowImpl : public CFrameWindowImplBase< TBase, TWinT } #ifndef _ATL_NO_REBAR_SUPPORT -#if (_WIN32_IE >= 0x0400) LRESULT OnReBarAutoSize(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->UpdateLayout(FALSE); return 0; } -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) LRESULT OnChevronPushed(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) { T* pT = static_cast(this); - _ChevronMenuInfo cmi = { NULL, (LPNMREBARCHEVRON)pnmh, false }; + typename CFrameWindowImplBase< TBase, TWinTraits >::_ChevronMenuInfo cmi = { NULL, (LPNMREBARCHEVRON)pnmh, false }; if(!pT->PrepareChevronMenu(cmi)) { bHandled = FALSE; @@ -1255,7 +978,6 @@ class ATL_NO_VTABLE CFrameWindowImpl : public CFrameWindowImplBase< TBase, TWinT pT->CleanupChevronMenu(cmi); return 0; } -#endif // (_WIN32_IE >= 0x0500) && !defined(_WIN32_WCE) #endif // !_ATL_NO_REBAR_SUPPORT }; @@ -1263,24 +985,18 @@ class ATL_NO_VTABLE CFrameWindowImpl : public CFrameWindowImplBase< TBase, TWinT /////////////////////////////////////////////////////////////////////////////// // AtlCreateSimpleToolBar - helper for creating simple toolbars -#ifndef _WIN32_WCE - inline HWND AtlCreateSimpleToolBar(HWND hWndParent, UINT nResourceID, BOOL bInitialSeparator = FALSE, DWORD dwStyle = ATL_SIMPLE_TOOLBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) { return CFrameWindowImplBase<>::CreateSimpleToolBarCtrl(hWndParent, nResourceID, bInitialSeparator, dwStyle, nID); } -#endif // !_WIN32_WCE - /////////////////////////////////////////////////////////////////////////////// // CMDIWindow -#ifndef _WIN32_WCE - #ifndef _WTL_MDIWINDOWMENU_TEXT -#define _WTL_MDIWINDOWMENU_TEXT _T("&Window") + #define _WTL_MDIWINDOWMENU_TEXT _T("&Window") #endif class CMDIWindow : public ATL::CWindow @@ -1317,7 +1033,7 @@ class CMDIWindow : public ATL::CWindow void MDINext(HWND hWndChild, BOOL bPrevious = FALSE) { ATLASSERT(::IsWindow(m_hWndMDIClient)); - ATLASSERT(hWndChild == NULL || ::IsWindow(hWndChild)); + ATLASSERT((hWndChild == NULL) || ::IsWindow(hWndChild)); ::SendMessage(m_hWndMDIClient, WM_MDINEXT, (WPARAM)hWndChild, (LPARAM)bPrevious); } @@ -1381,7 +1097,7 @@ class CMDIWindow : public ATL::CWindow int nLen = ::GetMenuString(hMenu, nCount - 2, NULL, 0, MF_BYPOSITION); if(nLen == 0) return NULL; - CTempBuffer buff; + ATL::CTempBuffer buff; LPTSTR lpszText = buff.Allocate(nLen + 1); if(lpszText == NULL) return NULL; @@ -1406,14 +1122,10 @@ class CMDIWindow : public ATL::CWindow } }; -#endif // !_WIN32_WCE - /////////////////////////////////////////////////////////////////////////////// // CMDIFrameWindowImpl -#ifndef _WIN32_WCE - // MDI child command chaining macro (only for MDI frame windows) #define CHAIN_MDI_CHILD_COMMANDS() \ if(uMsg == WM_COMMAND) \ @@ -1477,13 +1189,8 @@ class ATL_NO_VTABLE CMDIFrameWindowImpl : public CFrameWindowImplBase* pThis = (CMDIFrameWindowImpl< T, TBase, TWinTraits >*)hWnd; // set a ptr to this message and save the old value -#if (_ATL_VER >= 0x0700) ATL::_ATL_MSG msg(pThis->m_hWnd, uMsg, wParam, lParam); const ATL::_ATL_MSG* pOldMsg = pThis->m_pCurrentMsg; -#else // !(_ATL_VER >= 0x0700) - MSG msg = { pThis->m_hWnd, uMsg, wParam, lParam, 0, { 0, 0 } }; - const MSG* pOldMsg = pThis->m_pCurrentMsg; -#endif // !(_ATL_VER >= 0x0700) pThis->m_pCurrentMsg = &msg; // pass to the message map to process LRESULT lRes = 0; @@ -1495,44 +1202,36 @@ class ATL_NO_VTABLE CMDIFrameWindowImpl : public CFrameWindowImplBaseDefWindowProc(uMsg, wParam, lParam); + } else { // unsubclass, if needed LONG_PTR pfnWndProc = ::GetWindowLongPtr(pThis->m_hWnd, GWLP_WNDPROC); lRes = pThis->DefWindowProc(uMsg, wParam, lParam); - if(pThis->m_pfnSuperWindowProc != ::DefWindowProc && ::GetWindowLongPtr(pThis->m_hWnd, GWLP_WNDPROC) == pfnWndProc) + if((pThis->m_pfnSuperWindowProc != ::DefWindowProc) && (::GetWindowLongPtr(pThis->m_hWnd, GWLP_WNDPROC) == pfnWndProc)) ::SetWindowLongPtr(pThis->m_hWnd, GWLP_WNDPROC, (LONG_PTR)pThis->m_pfnSuperWindowProc); -#if (_ATL_VER >= 0x0700) // mark window as destryed - pThis->m_dwState |= WINSTATE_DESTROYED; -#else // !(_ATL_VER >= 0x0700) - // clear out window handle - HWND hWnd = pThis->m_hWnd; - pThis->m_hWnd = NULL; - // clean up after window is destroyed - pThis->OnFinalMessage(hWnd); -#endif // !(_ATL_VER >= 0x0700) + pThis->m_dwState |= ATL::CWindowImplRoot< TBase >::WINSTATE_DESTROYED; } } -#if (_ATL_VER >= 0x0700) - if(pThis->m_dwState & WINSTATE_DESTROYED && pThis->m_pCurrentMsg == NULL) + if((pThis->m_dwState & ATL::CWindowImplRoot< TBase >::WINSTATE_DESTROYED) && (pThis->m_pCurrentMsg == NULL)) { // clear out window handle - HWND hWnd = pThis->m_hWnd; + HWND hWndThis = pThis->m_hWnd; pThis->m_hWnd = NULL; - pThis->m_dwState &= ~WINSTATE_DESTROYED; + pThis->m_dwState &= ~ATL::CWindowImplRoot< TBase >::WINSTATE_DESTROYED; // clean up after window is destroyed - pThis->OnFinalMessage(hWnd); + pThis->OnFinalMessage(hWndThis); } -#endif // (_ATL_VER >= 0x0700) return lRes; } // Overriden to call DefWindowProc which uses DefFrameProc LRESULT DefWindowProc() { - const MSG* pMsg = m_pCurrentMsg; + const ATL::_ATL_MSG* pMsg = this->m_pCurrentMsg; LRESULT lRes = 0; if (pMsg != NULL) lRes = DefWindowProc(pMsg->message, pMsg->wParam, pMsg->lParam); @@ -1541,14 +1240,14 @@ class ATL_NO_VTABLE CMDIFrameWindowImpl : public CFrameWindowImplBasem_hWnd, this->m_hWndMDIClient, uMsg, wParam, lParam); } BOOL PreTranslateMessage(MSG* pMsg) { if(CFrameWindowImplBase::PreTranslateMessage(pMsg)) return TRUE; - return ::TranslateMDISysAccel(m_hWndMDIClient, pMsg); + return ::TranslateMDISysAccel(this->m_hWndMDIClient, pMsg); } HWND CreateMDIClient(HMENU hWindowMenu = NULL, UINT nID = ATL_IDW_CLIENT, UINT nFirstChildID = ATL_IDM_FIRST_MDICHILD) @@ -1599,12 +1298,8 @@ class ATL_NO_VTABLE CMDIFrameWindowImpl : public CFrameWindowImplBase= 0x0400) NOTIFY_CODE_HANDLER(RBN_AUTOSIZE, OnReBarAutoSize) -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0500) NOTIFY_CODE_HANDLER(RBN_CHEVRONPUSHED, OnChevronPushed) -#endif // (_WIN32_IE >= 0x0500) #endif // !_ATL_NO_REBAR_SUPPORT CHAIN_MSG_MAP(_baseClass) END_MSG_MAP() @@ -1628,25 +1323,22 @@ class ATL_NO_VTABLE CMDIFrameWindowImpl : public CFrameWindowImplBaseSetMDIFrameMenu(); return 0; } #ifndef _ATL_NO_REBAR_SUPPORT -#if (_WIN32_IE >= 0x0400) LRESULT OnReBarAutoSize(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->UpdateLayout(FALSE); return 0; } -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0500) LRESULT OnChevronPushed(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) { T* pT = static_cast(this); - _ChevronMenuInfo cmi = { NULL, (LPNMREBARCHEVRON)pnmh, false }; + typename CFrameWindowImplBase::_ChevronMenuInfo cmi = { NULL, (LPNMREBARCHEVRON)pnmh, false }; if(!pT->PrepareChevronMenu(cmi)) { bHandled = FALSE; @@ -1658,18 +1350,13 @@ class ATL_NO_VTABLE CMDIFrameWindowImpl : public CFrameWindowImplBaseCleanupChevronMenu(cmi); return 0; } -#endif // (_WIN32_IE >= 0x0500) #endif // !_ATL_NO_REBAR_SUPPORT }; -#endif // !_WIN32_WCE - /////////////////////////////////////////////////////////////////////////////// // CMDIChildWindowImpl -#ifndef _WIN32_WCE - template class ATL_NO_VTABLE CMDIChildWindowImpl : public CFrameWindowImplBase { @@ -1712,7 +1399,7 @@ class ATL_NO_VTABLE CMDIChildWindowImpl : public CFrameWindowImplBaseMDIGetActive(); + if((hWndChild != NULL) && (hWndChild != this->m_hWnd)) return FALSE; // need to adjust the client edge style as max/restore happens - DWORD dwStyle = ::GetWindowLong(m_hWndMDIClient, GWL_EXSTYLE); + DWORD dwStyle = ::GetWindowLong(this->m_hWndMDIClient, GWL_EXSTYLE); DWORD dwNewStyle = dwStyle; - if(hWndChild != NULL && ((GetExStyle() & WS_EX_CLIENTEDGE) == 0) && ((GetStyle() & WS_MAXIMIZE) != 0)) + if((hWndChild != NULL) && ((this->GetExStyle() & WS_EX_CLIENTEDGE) == 0) && ((this->GetStyle() & WS_MAXIMIZE) != 0)) dwNewStyle &= ~(WS_EX_CLIENTEDGE); else dwNewStyle |= WS_EX_CLIENTEDGE; @@ -1766,17 +1453,17 @@ class ATL_NO_VTABLE CMDIChildWindowImpl : public CFrameWindowImplBasem_hWndMDIClient, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN); // remove/add WS_EX_CLIENTEDGE to MDI client area - ::SetWindowLong(m_hWndMDIClient, GWL_EXSTYLE, dwNewStyle); - ::SetWindowPos(m_hWndMDIClient, NULL, 0, 0, 0, 0, + ::SetWindowLong(this->m_hWndMDIClient, GWL_EXSTYLE, dwNewStyle); + ::SetWindowPos(this->m_hWndMDIClient, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOCOPYBITS); // return new client area if (lpRect != NULL) - ::GetClientRect(m_hWndMDIClient, lpRect); + ::GetClientRect(this->m_hWndMDIClient, lpRect); return TRUE; } @@ -1793,19 +1480,15 @@ class ATL_NO_VTABLE CMDIChildWindowImpl : public CFrameWindowImplBase= 0x0400) NOTIFY_CODE_HANDLER(RBN_AUTOSIZE, OnReBarAutoSize) -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0500) NOTIFY_CODE_HANDLER(RBN_CHEVRONPUSHED, OnChevronPushed) -#endif // (_WIN32_IE >= 0x0500) #endif // !_ATL_NO_REBAR_SUPPORT CHAIN_MSG_MAP(_baseClass) END_MSG_MAP() LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { - DefWindowProc(uMsg, wParam, lParam); // needed for MDI children + this->DefWindowProc(uMsg, wParam, lParam); // needed for MDI children if(wParam != SIZE_MINIMIZED) { T* pT = static_cast(this); @@ -1821,10 +1504,10 @@ class ATL_NO_VTABLE CMDIChildWindowImpl : public CFrameWindowImplBaseflags & SWP_NOSIZE)) { - RECT rectClient; - if(UpdateClientEdge(&rectClient) && ((GetStyle() & WS_MAXIMIZE) != 0)) + RECT rectClient = { 0 }; + if(UpdateClientEdge(&rectClient) && ((this->GetStyle() & WS_MAXIMIZE) != 0)) { - ::AdjustWindowRectEx(&rectClient, GetStyle(), FALSE, GetExStyle()); + ::AdjustWindowRectEx(&rectClient, this->GetStyle(), FALSE, this->GetExStyle()); lpWndPos->x = rectClient.left; lpWndPos->y = rectClient.top; lpWndPos->cx = rectClient.right - rectClient.left; @@ -1838,13 +1521,13 @@ class ATL_NO_VTABLE CMDIChildWindowImpl : public CFrameWindowImplBaseDefWindowProc(uMsg, wParam, lParam); // Activate this MDI window if needed - if(lRes == MA_ACTIVATE || lRes == MA_ACTIVATEANDEAT) + if((lRes == MA_ACTIVATE) || (lRes == MA_ACTIVATEANDEAT)) { - if(MDIGetActive() != m_hWnd) - MDIActivate(m_hWnd); + if(this->MDIGetActive() != this->m_hWnd) + this->MDIActivate(this->m_hWnd); } return lRes; @@ -1852,15 +1535,15 @@ class ATL_NO_VTABLE CMDIChildWindowImpl : public CFrameWindowImplBaseGetMDIFrame(), uMsg, wParam, lParam); } LRESULT OnMDIActivate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { - if((HWND)lParam == m_hWnd && m_hMenu != NULL) - SetMDIFrameMenu(); + if(((HWND)lParam == this->m_hWnd) && (this->m_hMenu != NULL)) + this->SetMDIFrameMenu(); else if((HWND)lParam == NULL) - ::SendMessage(GetMDIFrame(), WM_MDISETMENU, 0, 0); + ::SendMessage(this->GetMDIFrame(), WM_MDISETMENU, 0, 0); bHandled = FALSE; return 1; @@ -1868,10 +1551,10 @@ class ATL_NO_VTABLE CMDIChildWindowImpl : public CFrameWindowImplBasem_hMenu != NULL) { - ::DestroyMenu(m_hMenu); - m_hMenu = NULL; + ::DestroyMenu(this->m_hMenu); + this->m_hMenu = NULL; } UpdateClientEdge(); bHandled = FALSE; @@ -1879,20 +1562,17 @@ class ATL_NO_VTABLE CMDIChildWindowImpl : public CFrameWindowImplBase= 0x0400) LRESULT OnReBarAutoSize(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->UpdateLayout(FALSE); return 0; } -#endif // (_WIN32_IE >= 0x0400) -#if (_WIN32_IE >= 0x0500) LRESULT OnChevronPushed(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) { T* pT = static_cast(this); - _ChevronMenuInfo cmi = { NULL, (LPNMREBARCHEVRON)pnmh, false }; + typename CFrameWindowImplBase::_ChevronMenuInfo cmi = { NULL, (LPNMREBARCHEVRON)pnmh, false }; if(!pT->PrepareChevronMenu(cmi)) { bHandled = FALSE; @@ -1904,12 +1584,9 @@ class ATL_NO_VTABLE CMDIChildWindowImpl : public CFrameWindowImplBaseCleanupChevronMenu(cmi); return 0; } -#endif // (_WIN32_IE >= 0x0500) #endif // !_ATL_NO_REBAR_SUPPORT }; -#endif // !_WIN32_WCE - /////////////////////////////////////////////////////////////////////////////// // COwnerDraw - MI class for owner-draw support @@ -1918,19 +1595,6 @@ template class COwnerDraw { public: -#if (_ATL_VER < 0x0700) - BOOL m_bHandledOD; - - BOOL IsMsgHandled() const - { - return m_bHandledOD; - } - void SetMsgHandled(BOOL bHandled) - { - m_bHandledOD = bHandled; - } -#endif // (_ATL_VER < 0x0700) - // Message map and handlers BEGIN_MSG_MAP(COwnerDraw< T >) MESSAGE_HANDLER(WM_DRAWITEM, OnDrawItem) @@ -2023,7 +1687,7 @@ class COwnerDraw #define BEGIN_UPDATE_UI_MAP(thisClass) \ static const CUpdateUIBase::_AtlUpdateUIMap* GetUpdateUIMap() \ { \ - static const _AtlUpdateUIMap theMap[] = \ + static const CUpdateUIBase::_AtlUpdateUIMap theMap[] = \ { #define UPDATE_ELEMENT(nID, wType) \ @@ -2069,7 +1733,7 @@ class CUpdateUIBase WORD m_wType; bool operator ==(const _AtlUpdateUIElement& e) const - { return (m_hWnd == e.m_hWnd && m_wType == e.m_wType); } + { return ((m_hWnd == e.m_hWnd) && (m_wType == e.m_wType)); } }; // map data @@ -2079,10 +1743,13 @@ class CUpdateUIBase WORD m_wType; bool operator ==(const _AtlUpdateUIMap& e) const - { return (m_nID == e.m_nID && m_wType == e.m_wType); } + { return ((m_nID == e.m_nID) && (m_wType == e.m_wType)); } }; // instance data +#pragma warning(push) +#pragma warning(disable: 4201) // nameless unions are part of C++ + struct _AtlUpdateUIData { WORD m_wState; @@ -2098,9 +1765,11 @@ class CUpdateUIBase }; bool operator ==(const _AtlUpdateUIData& e) const - { return (m_wState == e.m_wState && m_lpData == e.m_lpData); } + { return ((m_wState == e.m_wState) && (m_lpData == e.m_lpData)); } }; +#pragma warning(pop) + ATL::CSimpleArray<_AtlUpdateUIElement> m_UIElements; // elements data const _AtlUpdateUIMap* m_pUIMap; // static UI data _AtlUpdateUIData* m_pUIData; // instance UI data @@ -2115,7 +1784,7 @@ class CUpdateUIBase ~CUpdateUIBase() { - if(m_pUIMap != NULL && m_pUIData != NULL) + if((m_pUIMap != NULL) && (m_pUIData != NULL)) { const _AtlUpdateUIMap* pUIMap = m_pUIMap; _AtlUpdateUIData* pUIData = m_pUIData; @@ -2218,7 +1887,7 @@ class CUpdateUIBase LRESULT OnCommand(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { bHandled = FALSE; - if(m_bBlockAccelerators && HIWORD(wParam) == 1) // accelerators only + if(m_bBlockAccelerators && (HIWORD(wParam) == 1)) // accelerators only { int nID = LOWORD(wParam); if((UIGetState(nID) & UPDUI_DISABLED) == UPDUI_DISABLED) @@ -2389,7 +2058,7 @@ class CUpdateUIBase if(pUIData->m_wState & pMap->m_wType) m_wDirtyType |= pMap->m_wType; } - else if(pMap->m_nID >= nIDFirst && pMap->m_nID <= nIDLast) + else if((pMap->m_nID >= nIDFirst) && (pMap->m_nID <= nIDLast)) { if(pUIData->m_wState & UPDUI_RADIO) { @@ -2420,7 +2089,7 @@ class CUpdateUIBase { if(nID == (int)pMap->m_nID) { - if(pUIData->m_lpstrText == NULL || lstrcmp(pUIData->m_lpstrText, lpstrText)) + if((pUIData->m_lpstrText == NULL) || lstrcmp(pUIData->m_lpstrText, lpstrText)) { delete [] pUIData->m_lpstrText; pUIData->m_lpstrText = NULL; @@ -2431,7 +2100,7 @@ class CUpdateUIBase ATLTRACE2(atlTraceUI, 0, _T("UISetText - memory allocation failed\n")); break; } - SecureHelper::strcpy_x(pUIData->m_lpstrText, nStrLen + 1, lpstrText); + ATL::Checked::tcscpy_s(pUIData->m_lpstrText, nStrLen + 1, lpstrText); pUIData->m_wState |= (UPDUI_TEXT | pMap->m_wType); } @@ -2522,7 +2191,6 @@ class CUpdateUIBase } // methods for updating UI -#ifndef _WIN32_WCE BOOL UIUpdateMenuBar(BOOL bForceUpdate = FALSE, BOOL bMainMenu = FALSE) { if(!(m_wDirtyType & UPDUI_MENUBAR) && !bForceUpdate) @@ -2540,7 +2208,7 @@ class CUpdateUIBase if(m_UIElements[i].m_wType == UPDUI_MENUBAR) { HMENU hMenu = ::GetMenu(m_UIElements[i].m_hWnd); - if(hMenu != NULL && (pUIData->m_wState & UPDUI_MENUBAR) && (pMap->m_wType & UPDUI_MENUBAR)) + if((hMenu != NULL) && (pUIData->m_wState & UPDUI_MENUBAR) && (pMap->m_wType & UPDUI_MENUBAR)) UIUpdateMenuBarElement(pMap->m_nID, pUIData, hMenu); } if(bMainMenu) @@ -2560,7 +2228,6 @@ class CUpdateUIBase m_wDirtyType &= ~UPDUI_MENUBAR; return TRUE; } -#endif // !_WIN32_WCE BOOL UIUpdateToolBar(BOOL bForceUpdate = FALSE) { @@ -2664,19 +2331,16 @@ class CUpdateUIBase // internal element specific methods static void UIUpdateMenuBarElement(int nID, _AtlUpdateUIData* pUIData, HMENU hMenu) { -#ifndef _WIN32_WCE if((pUIData->m_wState & UPDUI_CLEARDEFAULT) != 0) { ::SetMenuDefaultItem(hMenu, (UINT)-1, 0); pUIData->m_wState &= ~UPDUI_CLEARDEFAULT; } -#endif // !_WIN32_WCE CMenuItemInfo mii; mii.fMask = MIIM_STATE; mii.wID = nID; -#ifndef _WIN32_WCE if((pUIData->m_wState & UPDUI_DISABLED) != 0) mii.fState |= MFS_DISABLED | MFS_GRAYED; else @@ -2689,23 +2353,6 @@ class CUpdateUIBase if((pUIData->m_wState & UPDUI_DEFAULT) != 0) mii.fState |= MFS_DEFAULT; -#else // CE specific - // ::SetMenuItemInfo() can't disable or check menu items - // on Windows CE, so we have to do that directly - UINT uEnable = MF_BYCOMMAND; - if((pUIData->m_wState & UPDUI_DISABLED) != 0) - uEnable |= MF_GRAYED; - else - uEnable |= MF_ENABLED; - ::EnableMenuItem(hMenu, nID, uEnable); - - UINT uCheck = MF_BYCOMMAND; - if((pUIData->m_wState & UPDUI_CHECKED) != 0) - uCheck |= MF_CHECKED; - else - uCheck |= MF_UNCHECKED; - ::CheckMenuItem(hMenu, nID, uCheck); -#endif // _WIN32_WCE if((pUIData->m_wState & UPDUI_TEXT) != 0) { @@ -2716,11 +2363,7 @@ class CUpdateUIBase { mii.fMask |= MIIM_TYPE; // MFT_BITMAP and MFT_SEPARATOR don't go together with MFT_STRING -#ifndef _WIN32_WCE mii.fType |= (miiNow.fType & ~(MFT_BITMAP | MFT_SEPARATOR)) | MFT_STRING; -#else // CE specific - mii.fType |= (miiNow.fType & ~(MFT_SEPARATOR)) | MFT_STRING; -#endif // _WIN32_WCE mii.dwTypeData = pUIData->m_lpstrText; } } @@ -2751,7 +2394,7 @@ class CUpdateUIBase ::EnableWindow(hChild, (pUIData->m_wState & UPDUI_DISABLED) ? FALSE : TRUE); // for check and radio, assume that window is a button int nCheck = BST_UNCHECKED; - if(pUIData->m_wState & UPDUI_CHECKED || pUIData->m_wState & UPDUI_RADIO) + if((pUIData->m_wState & UPDUI_CHECKED) || (pUIData->m_wState & UPDUI_RADIO)) nCheck = BST_CHECKED; else if(pUIData->m_wState & UPDUI_CHECKED2) nCheck = BST_INDETERMINATE; @@ -2783,8 +2426,8 @@ class CUpdateUI : public CUpdateUIBase const _AtlUpdateUIMap* pMap = pT->GetUpdateUIMap(); m_pUIMap = pMap; ATLASSERT(m_pUIMap != NULL); - int nCount; - for(nCount = 1; pMap->m_nID != (WORD)-1; nCount++) + int nCount = 1; + for( ; pMap->m_nID != (WORD)-1; nCount++) pMap++; // check for duplicates (debug only) @@ -2932,6 +2575,9 @@ class CDynamicUpdateUI : public CUpdateUIBase { if(m_arrUIMap[i].m_nID == nID) { + if((m_arrUIData[i].m_wState & UPDUI_TEXT) != 0) + delete [] m_arrUIData[i].m_lpstrText; + BOOL bRet = m_arrUIMap.RemoveAt(i); ATLASSERT(bRet); bRet = m_arrUIData.RemoveAt(i); @@ -2956,10 +2602,10 @@ class CAutoUpdateUI : public CDynamicUpdateUI public: LPCTSTR UIGetText(int nID) { - for(int i = 0; i < m_arrUIMap.GetSize(); i++) + for(int i = 0; i < this->m_arrUIMap.GetSize(); i++) { - if(m_arrUIMap[i].m_nID == nID) - return m_arrUIData[i].m_lpstrText; + if(this->m_arrUIMap[i].m_nID == nID) + return this->m_arrUIData[i].m_lpstrText; } return NULL; @@ -2970,36 +2616,36 @@ class CAutoUpdateUI : public CDynamicUpdateUI bool UIAddElement(UINT nID) { // check for existing UI map element - for(int i = 0; i < m_arrUIMap.GetSize(); i++) + for(int i = 0; i < this->m_arrUIMap.GetSize(); i++) { - if(m_arrUIMap[i].m_nID == nID) + if(this->m_arrUIMap[i].m_nID == nID) { // set requested type - m_arrUIMap[i].m_wType |= t_wType; + this->m_arrUIMap[i].m_wType |= t_wType; return true; } } // Add element to UI map with requested type - return UIAddUpdateElement((WORD)nID, t_wType); + return this->UIAddUpdateElement((WORD)nID, t_wType); } template bool UIRemoveElement(UINT nID) { - for(int i = 0; i < m_arrUIMap.GetSize(); i++) + for(int i = 0; i < this->m_arrUIMap.GetSize(); i++) { - if(m_arrUIMap[i].m_nID == nID) // matching UI map element + if(this->m_arrUIMap[i].m_nID == nID) // matching UI map element { - WORD wType = m_arrUIMap[i].m_wType & ~t_wType; - if (wType) // has other types + WORD wType = this->m_arrUIMap[i].m_wType & ~t_wType; + if (wType != 0) // has other types { - m_arrUIMap[i].m_wType = wType; // keep other types + this->m_arrUIMap[i].m_wType = wType; // keep other types return true; } else { - return UIRemoveUpdateElement((WORD)nID); + return this->UIRemoveUpdateElement((WORD)nID); } } } @@ -3010,9 +2656,6 @@ class CAutoUpdateUI : public CDynamicUpdateUI // Menu bool UIAddMenu(HMENU hMenu, bool bSetText = false) { -#if defined(_WIN32_WCE) && (_ATL_VER >= 0x0800) - using ATL::GetMenuString; -#endif ATLASSERT(::IsMenu(hMenu)); MENUITEMINFO mii = {sizeof(MENUITEMINFO), MIIM_TYPE | MIIM_ID | MIIM_SUBMENU}; @@ -3024,20 +2667,16 @@ class CAutoUpdateUI : public CDynamicUpdateUI // Add submenu to UI map UIAddMenu(mii.hSubMenu, bSetText); } - else if (mii.wID) + else if (mii.wID != 0) { // Add element to UI map UIAddElement(mii.wID); -#if !defined(_WIN32_WCE) || (_ATL_VER >= 0x0800) if (bSetText) { TCHAR sText[64] = { 0 }; if (GetMenuString(hMenu, uItem, sText, 64, MF_BYPOSITION)) UISetText(mii.wID, sText); } -#else - bSetText; -#endif // !defined(_WIN32_WCE) || (_ATL_VER >= 0x0800) } } @@ -3052,15 +2691,10 @@ class CAutoUpdateUI : public CDynamicUpdateUI } // ToolBar -#ifndef BTNS_SEP - #define BTNS_SEP TBSTYLE_SEP -#endif // BTNS_SEP compatibility - -#if !defined(_WIN32_WCE) || (defined(_AUTOUI_CE_TOOLBAR) && defined(TBIF_BYINDEX)) bool UIAddToolBar(HWND hWndToolBar) { ATLASSERT(::IsWindow(hWndToolBar)); - TBBUTTONINFO tbbi = {sizeof TBBUTTONINFO, TBIF_COMMAND | TBIF_STYLE | TBIF_BYINDEX}; + TBBUTTONINFO tbbi = { sizeof(TBBUTTONINFO), TBIF_COMMAND | TBIF_STYLE | TBIF_BYINDEX }; // Add toolbar buttons for (int uItem = 0; ::SendMessage(hWndToolBar, TB_GETBUTTONINFO, uItem, (LPARAM)&tbbi) != -1; uItem++) @@ -3075,7 +2709,6 @@ class CAutoUpdateUI : public CDynamicUpdateUI return (CUpdateUIBase::UIAddToolBar(hWndToolBar) != FALSE); } -#endif // !defined(_WIN32_WCE) || (defined(_AUTOUI_CE_TOOLBAR) && defined(TBIF_BYINDEX)) // Container bool UIAddChildWindowContainer(HWND hWnd) @@ -3085,7 +2718,8 @@ class CAutoUpdateUI : public CDynamicUpdateUI // Add children controls if any for (ATL::CWindow wCtl = ::GetWindow(hWnd, GW_CHILD); wCtl.IsWindow(); wCtl = wCtl.GetWindow(GW_HWNDNEXT)) { - if (int id = wCtl.GetDlgCtrlID()) + int id = wCtl.GetDlgCtrlID(); + if(id != 0) UIAddElement(id); } @@ -3214,14 +2848,14 @@ class CDialogResize void SetGroupCount(int nCount) { - ATLASSERT(nCount > 0 && nCount < 256); + ATLASSERT((nCount > 0) && (nCount < 256)); DWORD dwCount = (DWORD)MAKELONG(0, MAKEWORD(nCount, 0)); m_dwResizeFlags &= 0xFF00FFFF; m_dwResizeFlags |= dwCount; } bool operator ==(const _AtlDlgResizeData& r) const - { return (m_nCtlID == r.m_nCtlID && m_dwResizeFlags == r.m_dwResizeFlags); } + { return ((m_nCtlID == r.m_nCtlID) && (m_dwResizeFlags == r.m_dwResizeFlags)); } }; ATL::CSimpleArray<_AtlDlgResizeData> m_arrData; @@ -3271,7 +2905,7 @@ class CDialogResize // block: first check for the gripper control, destroy it if needed { ATL::CWindow wndGripper = pT->GetDlgItem(ATL_IDW_STATUS_BAR); - if(wndGripper.IsWindow() && m_arrData.GetSize() > 0 && (m_arrData[0].m_dwResizeFlags & _DLSZ_GRIPPER) != 0) + if(wndGripper.IsWindow() && (m_arrData.GetSize() > 0) && (m_arrData[0].m_dwResizeFlags & _DLSZ_GRIPPER) != 0) wndGripper.DestroyWindow(); } // clear out everything else @@ -3287,14 +2921,13 @@ class CDialogResize m_sizeDialog.cx = rectDlg.right; m_sizeDialog.cy = rectDlg.bottom; -#ifndef _WIN32_WCE // Create gripper if requested m_bGripper = false; if(bAddGripper) { // shouldn't exist already - ATLASSERT(!::IsWindow(pT->GetDlgItem(ATL_IDW_STATUS_BAR))); - if(!::IsWindow(pT->GetDlgItem(ATL_IDW_STATUS_BAR))) + ATLASSERT(!pT->GetDlgItem(ATL_IDW_STATUS_BAR).IsWindow()); + if(!pT->GetDlgItem(ATL_IDW_STATUS_BAR).IsWindow()) { ATL::CWindow wndGripper; wndGripper.Create(_T("SCROLLBAR"), pT->m_hWnd, rectDlg, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | SBS_SIZEBOX | SBS_SIZEGRIP | SBS_SIZEBOXBOTTOMRIGHTALIGN, 0, ATL_IDW_STATUS_BAR); @@ -3310,9 +2943,6 @@ class CDialogResize } } } -#else // CE specific - bAddGripper; // avoid level 4 warning -#endif // _WIN32_WCE // Get min track position if requested if(bUseMinTrackSize) @@ -3337,7 +2967,7 @@ class CDialogResize const _AtlDlgResizeMap* pMap = pT->GetDlgResizeMap(); ATLASSERT(pMap != NULL); int nGroupStart = -1; - for(int nCount = 1; !(pMap->m_nCtlID == -1 && pMap->m_dwResizeFlags == 0); nCount++, pMap++) + for(int nCount = 1; !((pMap->m_nCtlID == -1) && (pMap->m_dwResizeFlags == 0)); nCount++, pMap++) { if(pMap->m_nCtlID == -1) { @@ -3371,7 +3001,7 @@ class CDialogResize ctl.GetWindowRect(&rectCtl); ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rectCtl, 2); - DWORD dwGroupFlag = (nGroupStart != -1 && m_arrData.GetSize() == nGroupStart) ? _DLSZ_BEGIN_GROUP : 0; + DWORD dwGroupFlag = ((nGroupStart != -1) && (m_arrData.GetSize() == nGroupStart)) ? _DLSZ_BEGIN_GROUP : 0; _AtlDlgResizeData data = { pMap->m_nCtlID, pMap->m_dwResizeFlags | dwGroupFlag, { rectCtl.left, rectCtl.top, rectCtl.right, rectCtl.bottom } }; m_arrData.Add(data); } @@ -3385,7 +3015,7 @@ class CDialogResize ATLASSERT(::IsWindow(pT->m_hWnd)); // Restrict minimum size if requested - if(((pT->GetStyle() & WS_CHILD) != 0) && m_ptMinTrackSize.x != -1 && m_ptMinTrackSize.y != -1) + if(((pT->GetStyle() & WS_CHILD) != 0) && (m_ptMinTrackSize.x != -1) && (m_ptMinTrackSize.y != -1)) { if(cxWidth < m_ptMinTrackSize.x) cxWidth = m_ptMinTrackSize.x; @@ -3402,16 +3032,16 @@ class CDialogResize if((m_arrData[i].m_dwResizeFlags & _DLSZ_BEGIN_GROUP) != 0) // start of a group { int nGroupCount = m_arrData[i].GetGroupCount(); - ATLASSERT(nGroupCount > 0 && i + nGroupCount - 1 < m_arrData.GetSize()); + ATLASSERT((nGroupCount > 0) && ((i + nGroupCount - 1) < m_arrData.GetSize())); RECT rectGroup = m_arrData[i].m_rect; int j = 1; for(j = 1; j < nGroupCount; j++) { - rectGroup.left = min(rectGroup.left, m_arrData[i + j].m_rect.left); - rectGroup.top = min(rectGroup.top, m_arrData[i + j].m_rect.top); - rectGroup.right = max(rectGroup.right, m_arrData[i + j].m_rect.right); - rectGroup.bottom = max(rectGroup.bottom, m_arrData[i + j].m_rect.bottom); + rectGroup.left = __min(rectGroup.left, m_arrData[i + j].m_rect.left); + rectGroup.top = __min(rectGroup.top, m_arrData[i + j].m_rect.top); + rectGroup.right = __max(rectGroup.right, m_arrData[i + j].m_rect.right); + rectGroup.bottom = __max(rectGroup.bottom, m_arrData[i + j].m_rect.bottom); } for(j = 0; j < nGroupCount; j++) @@ -3426,7 +3056,7 @@ class CDialogResize } else // one control entry { - RECT rectGroup = { 0, 0, 0, 0 }; + RECT rectGroup = { 0 }; pT->DlgResize_PositionControl(cxWidth, cyHeight, rectGroup, m_arrData[i], false); } } @@ -3440,15 +3070,12 @@ class CDialogResize // Message map and handlers BEGIN_MSG_MAP(CDialogResize) MESSAGE_HANDLER(WM_SIZE, OnSize) -#ifndef _WIN32_WCE MESSAGE_HANDLER(WM_GETMINMAXINFO, OnGetMinMaxInfo) -#endif // _WIN32_WCE END_MSG_MAP() LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { T* pT = static_cast(this); -#ifndef _WIN32_WCE if(m_bGripper) { ATL::CWindow wndGripper = pT->GetDlgItem(ATL_IDW_STATUS_BAR); @@ -3457,7 +3084,6 @@ class CDialogResize else if(wParam == SIZE_RESTORED) wndGripper.ShowWindow(SW_SHOW); } -#endif // _WIN32_WCE if(wParam != SIZE_MINIMIZED) { ATLASSERT(::IsWindow(pT->m_hWnd)); @@ -3466,17 +3092,15 @@ class CDialogResize return 0; } -#ifndef _WIN32_WCE LRESULT OnGetMinMaxInfo(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) { - if(m_ptMinTrackSize.x != -1 && m_ptMinTrackSize.y != -1) + if((m_ptMinTrackSize.x != -1) && (m_ptMinTrackSize.y != -1)) { LPMINMAXINFO lpMMI = (LPMINMAXINFO)lParam; lpMMI->ptMinTrackSize = m_ptMinTrackSize; } return 0; } -#endif // _WIN32_WCE // Implementation bool DlgResize_PositionControl(int cxWidth, int cyHeight, RECT& rectGroup, _AtlDlgResizeData& data, bool bGroup, @@ -3618,9 +3242,7 @@ class CDoubleBufferImpl BEGIN_MSG_MAP(CDoubleBufferImpl) MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) MESSAGE_HANDLER(WM_PAINT, OnPaint) -#ifndef _WIN32_WCE MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) -#endif // !_WIN32_WCE END_MSG_MAP() LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) @@ -3666,12 +3288,12 @@ class ATL_NO_VTABLE CDoubleBufferWindowImpl : public ATL::CWindowImpl< T, TBase, // command bar support -#if !defined(__ATLCTRLW_H__) && !defined(_WIN32_WCE) +#if !defined(__ATLCTRLW_H__) #undef CBRM_GETMENU #undef CBRM_TRACKPOPUPMENU #undef CBRM_GETCMDBAR #undef CBRPOPUPMENU -#endif // !defined(__ATLCTRLW_H__) && !defined(_WIN32_WCE) +#endif // !defined(__ATLCTRLW_H__) }; // namespace WTL diff --git a/thirdparty/wtl/atlgdi.h b/thirdparty/wtl/atlgdi.h index be60296..5c2a06f 100644 --- a/thirdparty/wtl/atlgdi.h +++ b/thirdparty/wtl/atlgdi.h @@ -1,13 +1,10 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. +// Windows Template Library - WTL version 10.0 +// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. +// Microsoft Public License (http://opensource.org/licenses/MS-PL) +// which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLGDI_H__ #define __ATLGDI_H__ @@ -31,12 +28,12 @@ #endif // _INC_WINDOWSX // required libraries -#if !defined(_ATL_NO_MSIMG) && !defined(_WIN32_WCE) +#if !defined(_ATL_NO_MSIMG) #pragma comment(lib, "msimg32.lib") -#endif // !defined(_ATL_NO_MSIMG) && !defined(_WIN32_WCE) -#if !defined(_ATL_NO_OPENGL) && !defined(_WIN32_WCE) +#endif +#if !defined(_ATL_NO_OPENGL) #pragma comment(lib, "opengl32.lib") -#endif // !defined(_ATL_NO_OPENGL) && !defined(_WIN32_WCE) +#endif /////////////////////////////////////////////////////////////////////////////// @@ -57,19 +54,6 @@ // CEnhMetaFileInfo // CEnhMetaFileT // CEnhMetaFileDC -// -// Global functions: -// AtlGetBitmapResourceInfo() -// AtlGetBitmapResourceBitsPerPixel() -// AtlIsAlphaBitmapResource() -// AtlIsDib16() -// AtlGetDibColorTableSize() -// AtlGetDibNumColors(), -// AtlGetDibBitmap() -// AtlCopyBitmap() -// AtlCreatePackedDib16() -// AtlSetClipboardDib16() -// AtlGetClipboardDib() namespace WTL @@ -130,7 +114,7 @@ class CPenT ~CPenT() { - if(t_bManaged && m_hPen != NULL) + if(t_bManaged && (m_hPen != NULL)) DeleteObject(); } @@ -142,7 +126,7 @@ class CPenT void Attach(HPEN hPen) { - if(t_bManaged && m_hPen != NULL && m_hPen != hPen) + if(t_bManaged && (m_hPen != NULL) && (m_hPen != hPen)) ::DeleteObject(m_hPen); m_hPen = hPen; } @@ -166,14 +150,12 @@ class CPenT return m_hPen; } -#ifndef _WIN32_WCE HPEN CreatePen(int nPenStyle, int nWidth, const LOGBRUSH* pLogBrush, int nStyleCount = 0, const DWORD* lpStyle = NULL) { ATLASSERT(m_hPen == NULL); m_hPen = ::ExtCreatePen(nPenStyle, nWidth, pLogBrush, nStyleCount, lpStyle); return m_hPen; } -#endif // !_WIN32_WCE HPEN CreatePenIndirect(LPLOGPEN lpLogPen) { @@ -204,19 +186,18 @@ class CPenT return (::GetObject(m_hPen, sizeof(LOGPEN), &LogPen) == sizeof(LOGPEN)); } -#ifndef _WIN32_WCE - int GetExtLogPen(EXTLOGPEN* pLogPen) const + int GetExtLogPen(EXTLOGPEN* pLogPen, int nSize = sizeof(EXTLOGPEN)) const { ATLASSERT(m_hPen != NULL); - return ::GetObject(m_hPen, sizeof(EXTLOGPEN), pLogPen); + return ::GetObject(m_hPen, nSize, pLogPen); } - bool GetExtLogPen(EXTLOGPEN& ExtLogPen) const + bool GetExtLogPen(EXTLOGPEN& ExtLogPen, int nSize = sizeof(EXTLOGPEN)) const { ATLASSERT(m_hPen != NULL); - return (::GetObject(m_hPen, sizeof(EXTLOGPEN), &ExtLogPen) == sizeof(EXTLOGPEN)); + int nRet = ::GetObject(m_hPen, nSize, &ExtLogPen); + return ((nRet > 0) && (nRet <= nSize)); } -#endif // !_WIN32_WCE }; typedef CPenT CPenHandle; @@ -239,7 +220,7 @@ class CBrushT ~CBrushT() { - if(t_bManaged && m_hBrush != NULL) + if(t_bManaged && (m_hBrush != NULL)) DeleteObject(); } @@ -251,7 +232,7 @@ class CBrushT void Attach(HBRUSH hBrush) { - if(t_bManaged && m_hBrush != NULL && m_hBrush != hBrush) + if(t_bManaged && (m_hBrush != NULL) && (m_hBrush != hBrush)) ::DeleteObject(m_hBrush); m_hBrush = hBrush; } @@ -275,27 +256,19 @@ class CBrushT return m_hBrush; } -#ifndef _WIN32_WCE HBRUSH CreateHatchBrush(int nIndex, COLORREF crColor) { ATLASSERT(m_hBrush == NULL); m_hBrush = ::CreateHatchBrush(nIndex, crColor); return m_hBrush; } -#endif // !_WIN32_WCE -#if !defined(_WIN32_WCE) || (_ATL_VER >= 0x0800) HBRUSH CreateBrushIndirect(const LOGBRUSH* lpLogBrush) { ATLASSERT(m_hBrush == NULL); -#ifndef _WIN32_WCE m_hBrush = ::CreateBrushIndirect(lpLogBrush); -#else // CE specific - m_hBrush = ATL::CreateBrushIndirect(lpLogBrush); -#endif // _WIN32_WCE return m_hBrush; } -#endif // !defined(_WIN32_WCE) || (_ATL_VER >= 0x0800) HBRUSH CreatePatternBrush(HBITMAP hBitmap) { @@ -428,17 +401,12 @@ class CLogFont : public LOGFONT LONG GetDeciPointHeight(HDC hDC = NULL) const { HDC hDC1 = (hDC != NULL) ? hDC : ::GetDC(NULL); -#ifndef _WIN32_WCE POINT ptOrg = { 0, 0 }; ::DPtoLP(hDC1, &ptOrg, 1); POINT pt = { 0, 0 }; pt.y = abs(lfHeight) + ptOrg.y; ::LPtoDP(hDC1, &pt,1); LONG nDeciPoint = ::MulDiv(pt.y, 720, ::GetDeviceCaps(hDC1, LOGPIXELSY)); // 72 points/inch, 10 decipoints/point -#else // CE specific - // DP and LP are always the same on CE - LONG nDeciPoint = ::MulDiv(abs(lfHeight), 720, ::GetDeviceCaps(hDC1, LOGPIXELSY)); // 72 points/inch, 10 decipoints/point -#endif // _WIN32_WCE if(hDC == NULL) ::ReleaseDC(NULL, hDC1); @@ -448,22 +416,16 @@ class CLogFont : public LOGFONT void SetHeightFromDeciPoint(LONG nDeciPtHeight, HDC hDC = NULL) { HDC hDC1 = (hDC != NULL) ? hDC : ::GetDC(NULL); -#ifndef _WIN32_WCE POINT pt = { 0, 0 }; pt.y = ::MulDiv(::GetDeviceCaps(hDC1, LOGPIXELSY), nDeciPtHeight, 720); // 72 points/inch, 10 decipoints/point ::DPtoLP(hDC1, &pt, 1); POINT ptOrg = { 0, 0 }; ::DPtoLP(hDC1, &ptOrg, 1); lfHeight = -abs(pt.y - ptOrg.y); -#else // CE specific - // DP and LP are always the same on CE - lfHeight = -abs(::MulDiv(::GetDeviceCaps(hDC1, LOGPIXELSY), nDeciPtHeight, 720)); // 72 points/inch, 10 decipoints/point -#endif // _WIN32_WCE if(hDC == NULL) ::ReleaseDC(NULL, hDC1); } -#ifndef _WIN32_WCE void SetCaptionFont() { NONCLIENTMETRICS ncm = { RunTimeHelper::SizeOf_NONCLIENTMETRICS() }; @@ -491,7 +453,6 @@ class CLogFont : public LOGFONT ATLVERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0)); Copy(&ncm.lfMessageFont); } -#endif // !_WIN32_WCE void Copy(const LOGFONT* pLogFont) { @@ -520,20 +481,20 @@ class CLogFont : public LOGFONT bool operator ==(const LOGFONT& logfont) const { - return(logfont.lfHeight == lfHeight && - logfont.lfWidth == lfWidth && - logfont.lfEscapement == lfEscapement && - logfont.lfOrientation == lfOrientation && - logfont.lfWeight == lfWeight && - logfont.lfItalic == lfItalic && - logfont.lfUnderline == lfUnderline && - logfont.lfStrikeOut == lfStrikeOut && - logfont.lfCharSet == lfCharSet && - logfont.lfOutPrecision == lfOutPrecision && - logfont.lfClipPrecision == lfClipPrecision && - logfont.lfQuality == lfQuality && - logfont.lfPitchAndFamily == lfPitchAndFamily && - lstrcmp(logfont.lfFaceName, lfFaceName) == 0); + return((logfont.lfHeight == lfHeight) && + (logfont.lfWidth == lfWidth) && + (logfont.lfEscapement == lfEscapement) && + (logfont.lfOrientation == lfOrientation) && + (logfont.lfWeight == lfWeight) && + (logfont.lfItalic == lfItalic) && + (logfont.lfUnderline == lfUnderline) && + (logfont.lfStrikeOut == lfStrikeOut) && + (logfont.lfCharSet == lfCharSet) && + (logfont.lfOutPrecision == lfOutPrecision) && + (logfont.lfClipPrecision == lfClipPrecision) && + (logfont.lfQuality == lfQuality) && + (logfont.lfPitchAndFamily == lfPitchAndFamily) && + (lstrcmp(logfont.lfFaceName, lfFaceName) == 0)); } }; @@ -551,7 +512,7 @@ class CFontT ~CFontT() { - if(t_bManaged && m_hFont != NULL) + if(t_bManaged && (m_hFont != NULL)) DeleteObject(); } @@ -563,7 +524,7 @@ class CFontT void Attach(HFONT hFont) { - if(t_bManaged && m_hFont != NULL && m_hFont != hFont) + if(t_bManaged && (m_hFont != NULL) && (m_hFont != hFont)) ::DeleteObject(m_hFont); m_hFont = hFont; } @@ -587,16 +548,13 @@ class CFontT return m_hFont; } -#if !defined(_WIN32_WCE) && (_WIN32_WINNT >= 0x0500) HFONT CreateFontIndirectEx(CONST ENUMLOGFONTEXDV* penumlfex) { ATLASSERT(m_hFont == NULL); m_hFont = ::CreateFontIndirectEx(penumlfex); return m_hFont; } -#endif // !defined(_WIN32_WCE) && (_WIN32_WINNT >= 0x0500) -#if !defined(_WIN32_WCE) || (_ATL_VER >= 0x0800) HFONT CreateFont(int nHeight, int nWidth, int nEscapement, int nOrientation, int nWeight, BYTE bItalic, BYTE bUnderline, BYTE cStrikeOut, BYTE nCharSet, BYTE nOutPrecision, @@ -604,27 +562,19 @@ class CFontT LPCTSTR lpszFacename) { ATLASSERT(m_hFont == NULL); -#ifndef _WIN32_WCE m_hFont = ::CreateFont(nHeight, nWidth, nEscapement, nOrientation, nWeight, bItalic, bUnderline, cStrikeOut, nCharSet, nOutPrecision, nClipPrecision, nQuality, nPitchAndFamily, lpszFacename); -#else // CE specific - m_hFont = ATL::CreateFont(nHeight, nWidth, nEscapement, - nOrientation, nWeight, bItalic, bUnderline, cStrikeOut, - nCharSet, nOutPrecision, nClipPrecision, nQuality, - nPitchAndFamily, lpszFacename); -#endif // _WIN32_WCE return m_hFont; } -#endif // !defined(_WIN32_WCE) || (_ATL_VER >= 0x0800) HFONT CreatePointFont(int nPointSize, LPCTSTR lpszFaceName, HDC hDC = NULL, bool bBold = false, bool bItalic = false) { LOGFONT logFont = { 0 }; logFont.lfCharSet = DEFAULT_CHARSET; logFont.lfHeight = nPointSize; - SecureHelper::strncpy_x(logFont.lfFaceName, _countof(logFont.lfFaceName), lpszFaceName, _TRUNCATE); + ATL::Checked::tcsncpy_s(logFont.lfFaceName, _countof(logFont.lfFaceName), lpszFaceName, _TRUNCATE); if(bBold) logFont.lfWeight = FW_BOLD; @@ -640,17 +590,12 @@ class CFontT // convert nPointSize to logical units based on hDC LOGFONT logFont = *lpLogFont; -#ifndef _WIN32_WCE POINT pt = { 0, 0 }; pt.y = ::MulDiv(::GetDeviceCaps(hDC1, LOGPIXELSY), logFont.lfHeight, 720); // 72 points/inch, 10 decipoints/point ::DPtoLP(hDC1, &pt, 1); POINT ptOrg = { 0, 0 }; ::DPtoLP(hDC1, &ptOrg, 1); logFont.lfHeight = -abs(pt.y - ptOrg.y); -#else // CE specific - // DP and LP are always the same on CE - logFont.lfHeight = -abs(::MulDiv(::GetDeviceCaps(hDC1, LOGPIXELSY), logFont.lfHeight, 720)); // 72 points/inch, 10 decipoints/point -#endif // _WIN32_WCE if(hDC == NULL) ::ReleaseDC(NULL, hDC1); @@ -701,7 +646,7 @@ class CBitmapT ~CBitmapT() { - if(t_bManaged && m_hBitmap != NULL) + if(t_bManaged && (m_hBitmap != NULL)) DeleteObject(); } @@ -713,7 +658,7 @@ class CBitmapT void Attach(HBITMAP hBitmap) { - if(t_bManaged && m_hBitmap != NULL&& m_hBitmap != hBitmap) + if(t_bManaged && (m_hBitmap != NULL) && (m_hBitmap != hBitmap)) ::DeleteObject(m_hBitmap); m_hBitmap = hBitmap; } @@ -744,14 +689,12 @@ class CBitmapT return m_hBitmap; } -#ifndef _WIN32_WCE HBITMAP LoadMappedBitmap(UINT nIDBitmap, UINT nFlags = 0, LPCOLORMAP lpColorMap = NULL, int nMapSize = 0) { ATLASSERT(m_hBitmap == NULL); m_hBitmap = ::CreateMappedBitmap(ModuleHelper::GetResourceInstance(), nIDBitmap, (WORD)nFlags, lpColorMap, nMapSize); return m_hBitmap; } -#endif // !_WIN32_WCE HBITMAP CreateBitmap(int nWidth, int nHeight, UINT nPlanes, UINT nBitsPerPixel, const void* lpBits) { @@ -760,14 +703,12 @@ class CBitmapT return m_hBitmap; } -#ifndef _WIN32_WCE HBITMAP CreateBitmapIndirect(LPBITMAP lpBitmap) { ATLASSERT(m_hBitmap == NULL); m_hBitmap = ::CreateBitmapIndirect(lpBitmap); return m_hBitmap; } -#endif // !_WIN32_WCE HBITMAP CreateCompatibleBitmap(HDC hDC, int nWidth, int nHeight) { @@ -776,14 +717,12 @@ class CBitmapT return m_hBitmap; } -#ifndef _WIN32_WCE HBITMAP CreateDiscardableBitmap(HDC hDC, int nWidth, int nHeight) { ATLASSERT(m_hBitmap == NULL); m_hBitmap = ::CreateDiscardableBitmap(hDC, nWidth, nHeight); return m_hBitmap; } -#endif // !_WIN32_WCE BOOL DeleteObject() { @@ -818,23 +757,18 @@ class CBitmapT return true; } -#ifndef _WIN32_WCE DWORD GetBitmapBits(DWORD dwCount, LPVOID lpBits) const { ATLASSERT(m_hBitmap != NULL); return ::GetBitmapBits(m_hBitmap, dwCount, lpBits); } -#endif // !_WIN32_WCE -#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 410) DWORD SetBitmapBits(DWORD dwCount, const void* lpBits) { ATLASSERT(m_hBitmap != NULL); return ::SetBitmapBits(m_hBitmap, dwCount, lpBits); } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 410) -#ifndef _WIN32_WCE BOOL GetBitmapDimension(LPSIZE lpSize) const { ATLASSERT(m_hBitmap != NULL); @@ -854,7 +788,6 @@ class CBitmapT m_hBitmap = ::CreateDIBitmap(hDC, lpbmih, dwInit, lpbInit, lpbmi, uColorUse); return m_hBitmap; } -#endif // !_WIN32_WCE HBITMAP CreateDIBSection(HDC hDC, CONST BITMAPINFO* lpbmi, UINT uColorUse, VOID** ppvBits, HANDLE hSection, DWORD dwOffset) { @@ -863,7 +796,6 @@ class CBitmapT return m_hBitmap; } -#ifndef _WIN32_WCE int GetDIBits(HDC hDC, UINT uStartScan, UINT cScanLines, LPVOID lpvBits, LPBITMAPINFO lpbmi, UINT uColorUse) const { ATLASSERT(m_hBitmap != NULL); @@ -875,7 +807,6 @@ class CBitmapT ATLASSERT(m_hBitmap != NULL); return ::SetDIBits(hDC, m_hBitmap, uStartScan, cScanLines, lpvBits, lpbmi, uColorUse); } -#endif // !_WIN32_WCE }; typedef CBitmapT CBitmapHandle; @@ -898,7 +829,7 @@ class CPaletteT ~CPaletteT() { - if(t_bManaged && m_hPalette != NULL) + if(t_bManaged && (m_hPalette != NULL)) DeleteObject(); } @@ -910,7 +841,7 @@ class CPaletteT void Attach(HPALETTE hPalette) { - if(t_bManaged && m_hPalette != NULL && m_hPalette != hPalette) + if(t_bManaged && (m_hPalette != NULL) && (m_hPalette != hPalette)) ::DeleteObject(m_hPalette); m_hPalette = hPalette; } @@ -934,7 +865,6 @@ class CPaletteT return m_hPalette; } -#ifndef _WIN32_WCE HPALETTE CreateHalftonePalette(HDC hDC) { ATLASSERT(m_hPalette == NULL); @@ -942,7 +872,6 @@ class CPaletteT m_hPalette = ::CreateHalftonePalette(hDC); return m_hPalette; } -#endif // !_WIN32_WCE BOOL DeleteObject() { @@ -975,7 +904,6 @@ class CPaletteT } // Operations -#ifndef _WIN32_WCE void AnimatePalette(UINT nStartIndex, UINT nNumEntries, LPPALETTEENTRY lpPaletteColors) { ATLASSERT(m_hPalette != NULL); @@ -987,7 +915,6 @@ class CPaletteT ATLASSERT(m_hPalette != NULL); return ::ResizePalette(m_hPalette, nNumEntries); } -#endif // !_WIN32_WCE UINT GetNearestPaletteIndex(COLORREF crColor) const { @@ -1016,7 +943,7 @@ class CRgnT ~CRgnT() { - if(t_bManaged && m_hRgn != NULL) + if(t_bManaged && (m_hRgn != NULL)) DeleteObject(); } @@ -1028,7 +955,7 @@ class CRgnT void Attach(HRGN hRgn) { - if(t_bManaged && m_hRgn != NULL && m_hRgn != hRgn) + if(t_bManaged && (m_hRgn != NULL) && (m_hRgn != hRgn)) ::DeleteObject(m_hRgn); m_hRgn = hRgn; } @@ -1059,7 +986,6 @@ class CRgnT return m_hRgn; } -#ifndef _WIN32_WCE HRGN CreateEllipticRgn(int x1, int y1, int x2, int y2) { ATLASSERT(m_hRgn == NULL); @@ -1074,14 +1000,14 @@ class CRgnT return m_hRgn; } - HRGN CreatePolygonRgn(LPPOINT lpPoints, int nCount, int nMode) + HRGN CreatePolygonRgn(const POINT* lpPoints, int nCount, int nMode) { ATLASSERT(m_hRgn == NULL); m_hRgn = ::CreatePolygonRgn(lpPoints, nCount, nMode); return m_hRgn; } - HRGN CreatePolyPolygonRgn(LPPOINT lpPoints, LPINT lpPolyCounts, int nCount, int nPolyFillMode) + HRGN CreatePolyPolygonRgn(const POINT* lpPoints, const INT* lpPolyCounts, int nCount, int nPolyFillMode) { ATLASSERT(m_hRgn == NULL); m_hRgn = ::CreatePolyPolygonRgn(lpPoints, lpPolyCounts, nCount, nPolyFillMode); @@ -1109,7 +1035,6 @@ class CRgnT m_hRgn = ::ExtCreateRegion(lpXForm, nCount, pRgnData); return m_hRgn; } -#endif // !_WIN32_WCE BOOL DeleteObject() { @@ -1221,7 +1146,7 @@ class CDCT ~CDCT() { - if(t_bManaged && m_hDC != NULL) + if(t_bManaged && (m_hDC != NULL)) ::DeleteDC(Detach()); } @@ -1233,7 +1158,7 @@ class CDCT void Attach(HDC hDC) { - if(t_bManaged && m_hDC != NULL && m_hDC != hDC) + if(t_bManaged && (m_hDC != NULL) && (m_hDC != hDC)) ::DeleteDC(m_hDC); m_hDC = hDC; } @@ -1250,13 +1175,11 @@ class CDCT bool IsNull() const { return (m_hDC == NULL); } // Operations -#ifndef _WIN32_WCE HWND WindowFromDC() const { ATLASSERT(m_hDC != NULL); return ::WindowFromDC(m_hDC); } -#endif // !_WIN32_WCE CPenHandle GetCurrentPen() const { @@ -1331,7 +1254,6 @@ class CDCT return ::GetDeviceCaps(m_hDC, nIndex); } -#ifndef _WIN32_WCE UINT SetBoundsRect(LPCRECT lpRectBounds, UINT flags) { ATLASSERT(m_hDC != NULL); @@ -1356,7 +1278,6 @@ class CDCT ATLASSERT(m_hDC != NULL); return ::GetBrushOrgEx(m_hDC, lpPoint); } -#endif // !_WIN32_WCE BOOL SetBrushOrg(int x, int y, LPPOINT lpPoint = NULL) { @@ -1370,7 +1291,6 @@ class CDCT return ::SetBrushOrgEx(m_hDC, point.x, point.y, lpPointRet); } -#ifndef _WIN32_WCE int EnumObjects(int nObjectType, int (CALLBACK* lpfn)(LPVOID, LPARAM), LPARAM lpData) { ATLASSERT(m_hDC != NULL); @@ -1380,45 +1300,40 @@ class CDCT return ::EnumObjects(m_hDC, nObjectType, (GOBJENUMPROC)lpfn, (LPVOID)lpData); #endif } -#endif // !_WIN32_WCE // Type-safe selection helpers HPEN SelectPen(HPEN hPen) { ATLASSERT(m_hDC != NULL); -#ifndef _WIN32_WCE - ATLASSERT(hPen == NULL || ::GetObjectType(hPen) == OBJ_PEN || ::GetObjectType(hPen) == OBJ_EXTPEN); -#else // CE specific - ATLASSERT(hPen == NULL || ::GetObjectType(hPen) == OBJ_PEN); -#endif // _WIN32_WCE + ATLASSERT((hPen == NULL) || (::GetObjectType(hPen) == OBJ_PEN) || (::GetObjectType(hPen) == OBJ_EXTPEN)); return (HPEN)::SelectObject(m_hDC, hPen); } HBRUSH SelectBrush(HBRUSH hBrush) { ATLASSERT(m_hDC != NULL); - ATLASSERT(hBrush == NULL || ::GetObjectType(hBrush) == OBJ_BRUSH); + ATLASSERT((hBrush == NULL) || (::GetObjectType(hBrush) == OBJ_BRUSH)); return (HBRUSH)::SelectObject(m_hDC, hBrush); } HFONT SelectFont(HFONT hFont) { ATLASSERT(m_hDC != NULL); - ATLASSERT(hFont == NULL || ::GetObjectType(hFont) == OBJ_FONT); + ATLASSERT((hFont == NULL) || (::GetObjectType(hFont) == OBJ_FONT)); return (HFONT)::SelectObject(m_hDC, hFont); } HBITMAP SelectBitmap(HBITMAP hBitmap) { ATLASSERT(m_hDC != NULL); - ATLASSERT(hBitmap == NULL || ::GetObjectType(hBitmap) == OBJ_BITMAP); + ATLASSERT((hBitmap == NULL) || (::GetObjectType(hBitmap) == OBJ_BITMAP)); return (HBITMAP)::SelectObject(m_hDC, hBitmap); } int SelectRgn(HRGN hRgn) // special return for regions { ATLASSERT(m_hDC != NULL); - ATLASSERT(hRgn == NULL || ::GetObjectType(hRgn) == OBJ_REGION); + ATLASSERT((hRgn == NULL) || (::GetObjectType(hRgn) == OBJ_REGION)); return PtrToInt(::SelectObject(m_hDC, hRgn)); } @@ -1426,31 +1341,19 @@ class CDCT HPEN SelectStockPen(int nPen) { ATLASSERT(m_hDC != NULL); -#if (_WIN32_WINNT >= 0x0500) - ATLASSERT(nPen == WHITE_PEN || nPen == BLACK_PEN || nPen == NULL_PEN || nPen == DC_PEN); -#else - ATLASSERT(nPen == WHITE_PEN || nPen == BLACK_PEN || nPen == NULL_PEN); -#endif // !(_WIN32_WINNT >= 0x0500) + ATLASSERT((nPen == WHITE_PEN) || (nPen == BLACK_PEN) || (nPen == NULL_PEN) || (nPen == DC_PEN)); return SelectPen((HPEN)::GetStockObject(nPen)); } HBRUSH SelectStockBrush(int nBrush) { -#if (_WIN32_WINNT >= 0x0500) - ATLASSERT((nBrush >= WHITE_BRUSH && nBrush <= HOLLOW_BRUSH) || nBrush == DC_BRUSH); -#else - ATLASSERT(nBrush >= WHITE_BRUSH && nBrush <= HOLLOW_BRUSH); -#endif // !(_WIN32_WINNT >= 0x0500) + ATLASSERT(((nBrush >= WHITE_BRUSH) && (nBrush <= HOLLOW_BRUSH)) || (nBrush == DC_BRUSH)); return SelectBrush((HBRUSH)::GetStockObject(nBrush)); } HFONT SelectStockFont(int nFont) { -#ifndef _WIN32_WCE - ATLASSERT((nFont >= OEM_FIXED_FONT && nFont <= SYSTEM_FIXED_FONT) || nFont == DEFAULT_GUI_FONT); -#else // CE specific - ATLASSERT(nFont == SYSTEM_FONT); -#endif // _WIN32_WCE + ATLASSERT(((nFont >= OEM_FIXED_FONT) && (nFont <= SYSTEM_FIXED_FONT)) || (nFont == DEFAULT_GUI_FONT)); return SelectFont((HFONT)::GetStockObject(nFont)); } @@ -1480,13 +1383,11 @@ class CDCT return ::RealizePalette(m_hDC); } -#ifndef _WIN32_WCE void UpdateColors() { ATLASSERT(m_hDC != NULL); ::UpdateColors(m_hDC); } -#endif // !_WIN32_WCE // Drawing-Attribute Functions COLORREF GetBkColor() const @@ -1501,7 +1402,6 @@ class CDCT return ::GetBkMode(m_hDC); } -#ifndef _WIN32_WCE int GetPolyFillMode() const { ATLASSERT(m_hDC != NULL); @@ -1519,7 +1419,6 @@ class CDCT ATLASSERT(m_hDC != NULL); return ::GetStretchBltMode(m_hDC); } -#endif // !_WIN32_WCE COLORREF GetTextColor() const { @@ -1539,13 +1438,11 @@ class CDCT return ::SetBkMode(m_hDC, nBkMode); } -#ifndef _WIN32_WCE int SetPolyFillMode(int nPolyFillMode) { ATLASSERT(m_hDC != NULL); return ::SetPolyFillMode(m_hDC, nPolyFillMode); } -#endif // !_WIN32_WCE int SetROP2(int nDrawMode) { @@ -1553,13 +1450,11 @@ class CDCT return ::SetROP2(m_hDC, nDrawMode); } -#ifndef _WIN32_WCE int SetStretchBltMode(int nStretchMode) { ATLASSERT(m_hDC != NULL); return ::SetStretchBltMode(m_hDC, nStretchMode); } -#endif // !_WIN32_WCE COLORREF SetTextColor(COLORREF crColor) { @@ -1567,7 +1462,6 @@ class CDCT return ::SetTextColor(m_hDC, crColor); } -#ifndef _WIN32_WCE BOOL GetColorAdjustment(LPCOLORADJUSTMENT lpColorAdjust) const { ATLASSERT(m_hDC != NULL); @@ -1598,7 +1492,6 @@ class CDCT ATLASSERT(m_hDC != NULL); return ::SetMapMode(m_hDC, nMapMode); } -#endif // !_WIN32_WCE // Viewport Origin BOOL SetViewportOrg(int x, int y, LPPOINT lpPoint = NULL) @@ -1613,7 +1506,6 @@ class CDCT return SetViewportOrg(point.x, point.y, lpPointRet); } -#ifndef _WIN32_WCE BOOL OffsetViewportOrg(int nWidth, int nHeight, LPPOINT lpPoint = NULL) { ATLASSERT(m_hDC != NULL); @@ -1644,10 +1536,8 @@ class CDCT ATLASSERT(m_hDC != NULL); return ::ScaleViewportExtEx(m_hDC, xNum, xDenom, yNum, yDenom, lpSize); } -#endif // !_WIN32_WCE // Window Origin -#ifndef _WIN32_WCE BOOL GetWindowOrg(LPPOINT lpPoint) const { ATLASSERT(m_hDC != NULL); @@ -1751,62 +1641,61 @@ class CDCT // Special Coordinate Functions (useful for dealing with metafiles and OLE) #define HIMETRIC_INCH 2540 // HIMETRIC units per inch - void DPtoHIMETRIC(LPSIZE lpSize) const + void DPtoHIMETRIC(LPSIZE lpSize) { ATLASSERT(m_hDC != NULL); - int nMapMode; - if((nMapMode = GetMapMode()) < MM_ISOTROPIC && nMapMode != MM_TEXT) + int nMapMode = GetMapMode(); + if((nMapMode < MM_ISOTROPIC) && (nMapMode != MM_TEXT)) { // when using a constrained map mode, map against physical inch - ((CDCHandle*)this)->SetMapMode(MM_HIMETRIC); + SetMapMode(MM_HIMETRIC); DPtoLP(lpSize); - ((CDCHandle*)this)->SetMapMode(nMapMode); + SetMapMode(nMapMode); } else { // map against logical inch for non-constrained mapping modes int cxPerInch = GetDeviceCaps(LOGPIXELSX); int cyPerInch = GetDeviceCaps(LOGPIXELSY); - ATLASSERT(cxPerInch != 0 && cyPerInch != 0); + ATLASSERT((cxPerInch != 0) && (cyPerInch != 0)); lpSize->cx = ::MulDiv(lpSize->cx, HIMETRIC_INCH, cxPerInch); lpSize->cy = ::MulDiv(lpSize->cy, HIMETRIC_INCH, cyPerInch); } } - void HIMETRICtoDP(LPSIZE lpSize) const + void HIMETRICtoDP(LPSIZE lpSize) { ATLASSERT(m_hDC != NULL); - int nMapMode; - if((nMapMode = GetMapMode()) < MM_ISOTROPIC && nMapMode != MM_TEXT) + int nMapMode = GetMapMode(); + if((nMapMode < MM_ISOTROPIC) && (nMapMode != MM_TEXT)) { // when using a constrained map mode, map against physical inch - ((CDCHandle*)this)->SetMapMode(MM_HIMETRIC); + SetMapMode(MM_HIMETRIC); LPtoDP(lpSize); - ((CDCHandle*)this)->SetMapMode(nMapMode); + SetMapMode(nMapMode); } else { // map against logical inch for non-constrained mapping modes int cxPerInch = GetDeviceCaps(LOGPIXELSX); int cyPerInch = GetDeviceCaps(LOGPIXELSY); - ATLASSERT(cxPerInch != 0 && cyPerInch != 0); + ATLASSERT((cxPerInch != 0) && (cyPerInch != 0)); lpSize->cx = ::MulDiv(lpSize->cx, cxPerInch, HIMETRIC_INCH); lpSize->cy = ::MulDiv(lpSize->cy, cyPerInch, HIMETRIC_INCH); } } - void LPtoHIMETRIC(LPSIZE lpSize) const + void LPtoHIMETRIC(LPSIZE lpSize) { LPtoDP(lpSize); DPtoHIMETRIC(lpSize); } - void HIMETRICtoLP(LPSIZE lpSize) const + void HIMETRICtoLP(LPSIZE lpSize) { HIMETRICtoDP(lpSize); DPtoLP(lpSize); } -#endif // !_WIN32_WCE // Region Functions BOOL FillRgn(HRGN hRgn, HBRUSH hBrush) @@ -1815,7 +1704,6 @@ class CDCT return ::FillRgn(m_hDC, hRgn, hBrush); } -#ifndef _WIN32_WCE BOOL FrameRgn(HRGN hRgn, HBRUSH hBrush, int nWidth, int nHeight) { ATLASSERT(m_hDC != NULL); @@ -1833,7 +1721,6 @@ class CDCT ATLASSERT(m_hDC != NULL); return ::PaintRgn(m_hDC, hRgn); } -#endif // !_WIN32_WCE // Clipping Functions int GetClipBox(LPRECT lpRect) const @@ -1855,7 +1742,6 @@ class CDCT return nRet; } -#ifndef _WIN32_WCE BOOL PtVisible(int x, int y) const { ATLASSERT(m_hDC != NULL); @@ -1867,7 +1753,6 @@ class CDCT ATLASSERT(m_hDC != NULL); return ::PtVisible(m_hDC, point.x, point.y); } -#endif // !_WIN32_WCE BOOL RectVisible(LPCRECT lpRect) const { @@ -1893,13 +1778,11 @@ class CDCT return ::ExcludeClipRect(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); } -#ifndef _WIN32_WCE int ExcludeUpdateRgn(HWND hWnd) { ATLASSERT(m_hDC != NULL); return ::ExcludeUpdateRgn(m_hDC, hWnd); } -#endif // !_WIN32_WCE int IntersectClipRect(int x1, int y1, int x2, int y2) { @@ -1913,7 +1796,6 @@ class CDCT return ::IntersectClipRect(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); } -#ifndef _WIN32_WCE int OffsetClipRgn(int x, int y) { ATLASSERT(m_hDC != NULL); @@ -1931,10 +1813,8 @@ class CDCT ATLASSERT(m_hDC != NULL); return ::ExtSelectClipRgn(m_hDC, hRgn, nMode); } -#endif // !_WIN32_WCE // Line-Output Functions -#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) BOOL GetCurrentPosition(LPPOINT lpPoint) const { ATLASSERT(m_hDC != NULL); @@ -1964,9 +1844,7 @@ class CDCT ATLASSERT(m_hDC != NULL); return LineTo(point.x, point.y); } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) -#ifndef _WIN32_WCE BOOL Arc(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) { ATLASSERT(m_hDC != NULL); @@ -1980,15 +1858,13 @@ class CDCT lpRect->right, lpRect->bottom, ptStart.x, ptStart.y, ptEnd.x, ptEnd.y); } -#endif // !_WIN32_WCE - BOOL Polyline(LPPOINT lpPoints, int nCount) + BOOL Polyline(const POINT* lpPoints, int nCount) { ATLASSERT(m_hDC != NULL); return ::Polyline(m_hDC, lpPoints, nCount); } -#ifndef _WIN32_WCE BOOL AngleArc(int x, int y, int nRadius, float fStartAngle, float fSweepAngle) { ATLASSERT(m_hDC != NULL); @@ -2050,7 +1926,6 @@ class CDCT ATLASSERT(m_hDC != NULL); return ::PolyBezierTo(m_hDC, lpPoints, nCount); } -#endif // !_WIN32_WCE // Simple Drawing Functions BOOL FillRect(LPCRECT lpRect, HBRUSH hBrush) @@ -2062,47 +1937,31 @@ class CDCT BOOL FillRect(LPCRECT lpRect, int nColorIndex) { ATLASSERT(m_hDC != NULL); -#ifndef _WIN32_WCE return ::FillRect(m_hDC, lpRect, (HBRUSH)LongToPtr(nColorIndex + 1)); -#else // CE specific - return ::FillRect(m_hDC, lpRect, ::GetSysColorBrush(nColorIndex)); -#endif // _WIN32_WCE } -#ifndef _WIN32_WCE BOOL FrameRect(LPCRECT lpRect, HBRUSH hBrush) { ATLASSERT(m_hDC != NULL); return ::FrameRect(m_hDC, lpRect, hBrush); } -#endif // !_WIN32_WCE -#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 420) BOOL InvertRect(LPCRECT lpRect) { ATLASSERT(m_hDC != NULL); return ::InvertRect(m_hDC, lpRect); } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 420) BOOL DrawIcon(int x, int y, HICON hIcon) { ATLASSERT(m_hDC != NULL); -#ifndef _WIN32_WCE return ::DrawIcon(m_hDC, x, y, hIcon); -#else // CE specific - return ::DrawIconEx(m_hDC, x, y, hIcon, 0, 0, 0, NULL, DI_NORMAL); -#endif // _WIN32_WCE } BOOL DrawIcon(POINT point, HICON hIcon) { ATLASSERT(m_hDC != NULL); -#ifndef _WIN32_WCE return ::DrawIcon(m_hDC, point.x, point.y, hIcon); -#else // CE specific - return ::DrawIconEx(m_hDC, point.x, point.y, hIcon, 0, 0, 0, NULL, DI_NORMAL); -#endif // _WIN32_WCE } BOOL DrawIconEx(int x, int y, HICON hIcon, int cxWidth, int cyWidth, UINT uStepIfAniCur = 0, HBRUSH hbrFlickerFreeDraw = NULL, UINT uFlags = DI_NORMAL) @@ -2117,7 +1976,6 @@ class CDCT return ::DrawIconEx(m_hDC, point.x, point.y, hIcon, size.cx, size.cy, uStepIfAniCur, hbrFlickerFreeDraw, uFlags); } -#ifndef _WIN32_WCE BOOL DrawState(POINT pt, SIZE size, HBITMAP hBitmap, UINT nFlags, HBRUSH hBrush = NULL) { ATLASSERT(m_hDC != NULL); @@ -2141,10 +1999,8 @@ class CDCT ATLASSERT(m_hDC != NULL); return ::DrawState(m_hDC, hBrush, lpDrawProc, lData, 0, pt.x, pt.y, size.cx, size.cy, nFlags | DST_COMPLEX); } -#endif // !_WIN32_WCE // Ellipse and Polygon Functions -#ifndef _WIN32_WCE BOOL Chord(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) { ATLASSERT(m_hDC != NULL); @@ -2156,7 +2012,6 @@ class CDCT ATLASSERT(m_hDC != NULL); return ::Chord(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, ptStart.x, ptStart.y, ptEnd.x, ptEnd.y); } -#endif // !_WIN32_WCE void DrawFocusRect(LPCRECT lpRect) { @@ -2176,7 +2031,6 @@ class CDCT return ::Ellipse(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); } -#ifndef _WIN32_WCE BOOL Pie(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) { ATLASSERT(m_hDC != NULL); @@ -2188,21 +2042,18 @@ class CDCT ATLASSERT(m_hDC != NULL); return ::Pie(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, ptStart.x, ptStart.y, ptEnd.x, ptEnd.y); } -#endif // !_WIN32_WCE - BOOL Polygon(LPPOINT lpPoints, int nCount) + BOOL Polygon(const POINT* lpPoints, int nCount) { ATLASSERT(m_hDC != NULL); return ::Polygon(m_hDC, lpPoints, nCount); } -#ifndef _WIN32_WCE - BOOL PolyPolygon(LPPOINT lpPoints, LPINT lpPolyCounts, int nCount) + BOOL PolyPolygon(const POINT* lpPoints, const INT* lpPolyCounts, int nCount) { ATLASSERT(m_hDC != NULL); return ::PolyPolygon(m_hDC, lpPoints, lpPolyCounts, nCount); } -#endif // !_WIN32_WCE BOOL Rectangle(int x1, int y1, int x2, int y2) { @@ -2272,7 +2123,6 @@ class CDCT return ::SetPixel(m_hDC, point.x, point.y, crColor); } -#ifndef _WIN32_WCE BOOL FloodFill(int x, int y, COLORREF crColor) { ATLASSERT(m_hDC != NULL); @@ -2284,7 +2134,6 @@ class CDCT ATLASSERT(m_hDC != NULL); return ::ExtFloodFill(m_hDC, x, y, crColor, nFillType); } -#endif // !_WIN32_WCE BOOL MaskBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, HBITMAP hMaskBitmap, int xMask, int yMask, DWORD dwRop) { @@ -2292,7 +2141,6 @@ class CDCT return ::MaskBlt(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, hMaskBitmap, xMask, yMask, dwRop); } -#ifndef _WIN32_WCE BOOL PlgBlt(LPPOINT lpPoint, HDC hSrcDC, int xSrc, int ySrc, int nWidth, int nHeight, HBITMAP hMaskBitmap, int xMask, int yMask) { ATLASSERT(m_hDC != NULL); @@ -2310,24 +2158,14 @@ class CDCT ATLASSERT(m_hDC != NULL); return ::SetPixelV(m_hDC, point.x, point.y, crColor); } -#endif // !_WIN32_WCE -#if !defined(_ATL_NO_MSIMG) || defined(_WIN32_WCE) -#ifndef _WIN32_WCE +#if !defined(_ATL_NO_MSIMG) BOOL TransparentBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, UINT crTransparent) { ATLASSERT(m_hDC != NULL); return ::TransparentBlt(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, nSrcWidth, nSrcHeight, crTransparent); } -#else // CE specific - BOOL TransparentImage(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, UINT crTransparent) - { - ATLASSERT(m_hDC != NULL); - return ::TransparentImage(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, nSrcWidth, nSrcHeight, crTransparent); - } -#endif // _WIN32_WCE -#if (!defined(_WIN32_WCE) || (_WIN32_WCE >= 420)) BOOL GradientFill(const PTRIVERTEX pVertices, DWORD nVertices, void* pMeshElements, DWORD nMeshElements, DWORD dwMode) { ATLASSERT(m_hDC != NULL); @@ -2358,16 +2196,13 @@ class CDCT return ::GradientFill(m_hDC, arrTvx, 2, &gr, 1, bHorizontal ? GRADIENT_FILL_RECT_H : GRADIENT_FILL_RECT_V); } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 420) -#if !defined(_WIN32_WCE) || (_WIN32_WCE > 0x500) BOOL AlphaBlend(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, BLENDFUNCTION bf) { ATLASSERT(m_hDC != NULL); return ::AlphaBlend(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, nSrcWidth, nSrcHeight, bf); } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE > 0x500) -#endif // !defined(_ATL_NO_MSIMG) || defined(_WIN32_WCE) +#endif // !defined(_ATL_NO_MSIMG) // Extra bitmap functions // Helper function for painting a disabled toolbar or menu bitmap @@ -2378,17 +2213,17 @@ class CDCT HBRUSH hBrush3DEffect = ::GetSysColorBrush(COLOR_3DHILIGHT), HBRUSH hBrushDisabledImage = ::GetSysColorBrush(COLOR_3DSHADOW)) { - ATLASSERT(m_hDC != NULL || hBitmap != NULL); - ATLASSERT(nWidth > 0 && nHeight > 0); + ATLASSERT((m_hDC != NULL) || (hBitmap != NULL)); + ATLASSERT((nWidth > 0) && (nHeight > 0)); // Create a generic DC for all BitBlts - CDCHandle dc = (hSrcDC != NULL) ? hSrcDC : ::CreateCompatibleDC(m_hDC); + CDCT dc = (hSrcDC != NULL) ? hSrcDC : ::CreateCompatibleDC(m_hDC); ATLASSERT(dc.m_hDC != NULL); if(dc.m_hDC == NULL) return FALSE; // Create a DC for the monochrome DIB section - CDC dcBW = ::CreateCompatibleDC(m_hDC); + CDCT dcBW = ::CreateCompatibleDC(m_hDC); ATLASSERT(dcBW.m_hDC != NULL); if(dcBW.m_hDC == NULL) { @@ -2428,8 +2263,8 @@ class CDCT // Block: Dark gray removal: we want (128, 128, 128) pixels to become black and not white { - CDC dcTemp1 = ::CreateCompatibleDC(m_hDC); - CDC dcTemp2 = ::CreateCompatibleDC(m_hDC); + CDCT dcTemp1 = ::CreateCompatibleDC(m_hDC); + CDCT dcTemp2 = ::CreateCompatibleDC(m_hDC); CBitmap bmpTemp1; bmpTemp1.CreateCompatibleBitmap(dc, nWidth, nHeight); CBitmap bmpTemp2; @@ -2482,7 +2317,6 @@ class CDCT } // Text Functions -#ifndef _WIN32_WCE BOOL TextOut(int x, int y, LPCTSTR lpszString, int nCount = -1) { ATLASSERT(m_hDC != NULL); @@ -2490,7 +2324,6 @@ class CDCT nCount = lstrlen(lpszString); return ::TextOut(m_hDC, x, y, lpszString, nCount); } -#endif // !_WIN32_WCE BOOL ExtTextOut(int x, int y, UINT nOptions, LPCRECT lpRect, LPCTSTR lpszString, UINT nCount = -1, LPINT lpDxWidths = NULL) { @@ -2500,7 +2333,6 @@ class CDCT return ::ExtTextOut(m_hDC, x, y, nOptions, lpRect, lpszString, nCount, lpDxWidths); } -#ifndef _WIN32_WCE SIZE TabbedTextOut(int x, int y, LPCTSTR lpszString, int nCount = -1, int nTabPositions = 0, LPINT lpnTabStopPositions = NULL, int nTabOrigin = 0) { ATLASSERT(m_hDC != NULL); @@ -2510,14 +2342,11 @@ class CDCT SIZE size = { GET_X_LPARAM(lRes), GET_Y_LPARAM(lRes) }; return size; } -#endif // !_WIN32_WCE int DrawText(LPCTSTR lpstrText, int cchText, LPRECT lpRect, UINT uFormat) { ATLASSERT(m_hDC != NULL); -#ifndef _WIN32_WCE ATLASSERT((uFormat & DT_MODIFYSTRING) == 0); -#endif // !_WIN32_WCE return ::DrawText(m_hDC, lpstrText, cchText, lpRect, uFormat); } @@ -2527,36 +2356,19 @@ class CDCT return ::DrawText(m_hDC, lpstrText, cchText, lpRect, uFormat); } -#ifndef _WIN32_WCE int DrawTextEx(LPTSTR lpstrText, int cchText, LPRECT lpRect, UINT uFormat, LPDRAWTEXTPARAMS lpDTParams = NULL) { ATLASSERT(m_hDC != NULL); return ::DrawTextEx(m_hDC, lpstrText, cchText, lpRect, uFormat, lpDTParams); } -#endif // !_WIN32_WCE -#if (_WIN32_WINNT >= 0x0501) + // Note - ::DrawShadowText() is present only if comctl32.dll version 6 is loaded int DrawShadowText(LPCWSTR lpstrText, int cchText, LPRECT lpRect, DWORD dwFlags, COLORREF clrText, COLORREF clrShadow, int xOffset, int yOffset) { ATLASSERT(m_hDC != NULL); - // This function is present only if comctl32.dll version 6 is loaded; - // we use LoadLibrary/GetProcAddress to allow apps compiled with - // _WIN32_WINNT >= 0x0501 to run on older Windows/CommCtrl - int nRet = 0; - HMODULE hCommCtrlDLL = ::LoadLibrary(_T("comctl32.dll")); - ATLASSERT(hCommCtrlDLL != NULL); - if(hCommCtrlDLL != NULL) - { - typedef int (WINAPI *PFN_DrawShadowText)(HDC hDC, LPCWSTR lpstrText, UINT cchText, LPRECT lpRect, DWORD dwFlags, COLORREF clrText, COLORREF clrShadow, int xOffset, int yOffset); - PFN_DrawShadowText pfnDrawShadowText = (PFN_DrawShadowText)::GetProcAddress(hCommCtrlDLL, "DrawShadowText"); - ATLASSERT(pfnDrawShadowText != NULL); // this function requires CommCtrl6 - if(pfnDrawShadowText != NULL) - nRet = pfnDrawShadowText(m_hDC, lpstrText, cchText, lpRect, dwFlags, clrText, clrShadow, xOffset, yOffset); - ::FreeLibrary(hCommCtrlDLL); - } - return nRet; + ATLASSERT(lpRect != NULL); + return ::DrawShadowText(m_hDC, lpstrText, cchText, lpRect, dwFlags, clrText, clrShadow, xOffset, yOffset); } -#endif // (_WIN32_WINNT >= 0x0501) BOOL GetTextExtent(LPCTSTR lpszString, int nCount, LPSIZE lpSize) const { @@ -2572,7 +2384,6 @@ class CDCT return ::GetTextExtentExPoint(m_hDC, lpszString, cchString, nMaxExtent, lpnFit, alpDx, lpSize); } -#ifndef _WIN32_WCE DWORD GetTabbedTextExtent(LPCTSTR lpszString, int nCount = -1, int nTabPositions = 0, LPINT lpnTabStopPositions = NULL) const { ATLASSERT(m_hDC != NULL); @@ -2586,9 +2397,7 @@ class CDCT ATLASSERT(m_hDC != NULL); return ::GrayString(m_hDC, hBrush, (GRAYSTRINGPROC)lpfnOutput, lpData, nCount, x, y, nWidth, nHeight); } -#endif // !_WIN32_WCE -#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) UINT GetTextAlign() const { ATLASSERT(m_hDC != NULL); @@ -2600,7 +2409,6 @@ class CDCT ATLASSERT(m_hDC != NULL); return ::SetTextAlign(m_hDC, nFlags); } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) int GetTextFace(LPTSTR lpszFacename, int nCount) const { @@ -2614,7 +2422,6 @@ class CDCT return ::GetTextFace(m_hDC, 0, NULL); } -#ifndef _ATL_NO_COM #ifdef _OLEAUTO_H_ BOOL GetTextFace(BSTR& bstrFace) const { @@ -2626,7 +2433,7 @@ class CDCT if(nLen == 0) return FALSE; - CTempBuffer buff; + ATL::CTempBuffer buff; LPTSTR lpszText = buff.Allocate(nLen); if(lpszText == NULL) return FALSE; @@ -2638,10 +2445,9 @@ class CDCT return (bstrFace != NULL) ? TRUE : FALSE; } #endif -#endif // !_ATL_NO_COM -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - int GetTextFace(_CSTRING_NS::CString& strFace) const +#ifdef __ATLSTR_H__ + int GetTextFace(ATL::CString& strFace) const { ATLASSERT(m_hDC != NULL); @@ -2656,7 +2462,7 @@ class CDCT strFace.ReleaseBuffer(); return nRet; } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) +#endif // __ATLSTR_H__ BOOL GetTextMetrics(LPTEXTMETRIC lpMetrics) const { @@ -2664,7 +2470,6 @@ class CDCT return ::GetTextMetrics(m_hDC, lpMetrics); } -#ifndef _WIN32_WCE int SetTextJustification(int nBreakExtra, int nBreakCount) { ATLASSERT(m_hDC != NULL); @@ -2682,7 +2487,6 @@ class CDCT ATLASSERT(m_hDC != NULL); return ::SetTextCharacterExtra(m_hDC, nCharExtra); } -#endif // !_WIN32_WCE // Advanced Drawing BOOL DrawEdge(LPRECT lpRect, UINT nEdge, UINT nFlags) @@ -2705,7 +2509,6 @@ class CDCT } // Font Functions -#ifndef _WIN32_WCE BOOL GetCharWidth(UINT nFirstChar, UINT nLastChar, LPINT lpBuffer) const { ATLASSERT(m_hDC != NULL); @@ -2772,16 +2575,13 @@ class CDCT ATLASSERT(m_hDC != NULL); return ::GetCharWidthFloat(m_hDC, nFirstChar, nLastChar, lpFloatBuffer); } -#endif // !_WIN32_WCE // Printer/Device Escape Functions -#ifndef _WIN32_WCE int Escape(int nEscape, int nCount, LPCSTR lpszInData, LPVOID lpOutData) { ATLASSERT(m_hDC != NULL); return ::Escape(m_hDC, nEscape, nCount, lpszInData, lpOutData); } -#endif // !_WIN32_WCE int Escape(int nEscape, int nInputSize, LPCSTR lpszInputData, int nOutputSize, LPSTR lpszOutputData) @@ -2790,16 +2590,13 @@ class CDCT return ::ExtEscape(m_hDC, nEscape, nInputSize, lpszInputData, nOutputSize, lpszOutputData); } -#ifndef _WIN32_WCE int DrawEscape(int nEscape, int nInputSize, LPCSTR lpszInputData) { ATLASSERT(m_hDC != NULL); return ::DrawEscape(m_hDC, nEscape, nInputSize, lpszInputData); } -#endif // !_WIN32_WCE // Escape helpers -#if !defined(_WIN32_WCE) || ((_WIN32_WCE >= 200) && defined(StartDoc)) int StartDoc(LPCTSTR lpszDocName) // old Win3.0 version { DOCINFO di = { 0 }; @@ -2843,10 +2640,8 @@ class CDCT ATLASSERT(m_hDC != NULL); return ::EndDoc(m_hDC); } -#endif // !defined(_WIN32_WCE) || ((_WIN32_WCE >= 200) && defined(StartDoc)) // MetaFile Functions -#ifndef _WIN32_WCE BOOL PlayMetaFile(HMETAFILE hMF) { ATLASSERT(m_hDC != NULL); @@ -2875,7 +2670,7 @@ class CDCT // Special handling for metafile playback static int CALLBACK EnumMetaFileProc(HDC hDC, HANDLETABLE* pHandleTable, METARECORD* pMetaRec, int nHandles, LPARAM lParam) { - CDCHandle* pDC = (CDCHandle*)lParam; + CDCT* pDC = (CDCT*)lParam; switch (pMetaRec->rdFunction) { @@ -2959,10 +2754,8 @@ class CDCT return 1; } -#endif // !_WIN32_WCE // Path Functions -#ifndef _WIN32_WCE BOOL AbortPath() { ATLASSERT(m_hDC != NULL); @@ -3040,7 +2833,6 @@ class CDCT ATLASSERT(m_hDC != NULL); return ::SelectClipPath(m_hDC, nMode); } -#endif // !_WIN32_WCE // Misc Helper Functions static CBrushHandle PASCAL GetHalftoneBrush() @@ -3099,7 +2891,7 @@ class CDCT rgnUpdate.CombineRgn(rgnLast, rgnNew, RGN_XOR); } } - if(hBrush != hBrushLast && lpRectLast != NULL) + if((hBrush != hBrushLast) && (lpRectLast != NULL)) { // brushes are different -- erase old region first SelectClipRgn(rgnLast); @@ -3158,15 +2950,12 @@ class CDCT } // DIB support -#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 410) int SetDIBitsToDevice(int x, int y, DWORD dwWidth, DWORD dwHeight, int xSrc, int ySrc, UINT uStartScan, UINT cScanLines, CONST VOID* lpvBits, CONST BITMAPINFO* lpbmi, UINT uColorUse) { ATLASSERT(m_hDC != NULL); return ::SetDIBitsToDevice(m_hDC, x, y, dwWidth, dwHeight, xSrc, ySrc, uStartScan, cScanLines, lpvBits, lpbmi, uColorUse); } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 410) -#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) int StretchDIBits(int x, int y, int nWidth, int nHeight, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, CONST VOID* lpvBits, CONST BITMAPINFO* lpbmi, UINT uColorUse, DWORD dwRop) { ATLASSERT(m_hDC != NULL); @@ -3184,10 +2973,9 @@ class CDCT ATLASSERT(m_hDC != NULL); return ::SetDIBColorTable(m_hDC, uStartIndex, cEntries, pColors); } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) // OpenGL support -#if !defined(_ATL_NO_OPENGL) && !defined(_WIN32_WCE) +#if !defined(_ATL_NO_OPENGL) int ChoosePixelFormat(CONST PIXELFORMATDESCRIPTOR* ppfd) { ATLASSERT(m_hDC != NULL); @@ -3277,10 +3065,8 @@ class CDCT ATLASSERT(m_hDC != NULL); return ::wglSwapLayerBuffers(m_hDC, uPlanes); } -#endif // !defined(_ATL_NO_OPENGL) && !defined(_WIN32_WCE) +#endif // !defined(_ATL_NO_OPENGL) -// New for Windows 2000 only -#if (_WIN32_WINNT >= 0x0500) COLORREF GetDCPenColor() const { ATLASSERT(m_hDC != NULL); @@ -3305,13 +3091,11 @@ class CDCT return ::SetDCBrushColor(m_hDC, clr); } -#ifndef _WIN32_WCE DWORD GetFontUnicodeRanges(LPGLYPHSET lpgs) const { ATLASSERT(m_hDC != NULL); return ::GetFontUnicodeRanges(m_hDC, lpgs); } -#endif // !_WIN32_WCE DWORD GetGlyphIndices(LPCTSTR lpstr, int cch, LPWORD pgi, DWORD dwFlags) const { @@ -3342,16 +3126,12 @@ class CDCT ATLASSERT(m_hDC != NULL); return ::GetCharABCWidthsI(m_hDC, giFirst, cgi, pgi, lpabc); } -#endif // (_WIN32_WINNT >= 0x0500) -// New for Windows 2000 and Windows 98 -#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) BOOL ColorCorrectPalette(HPALETTE hPalette, DWORD dwFirstEntry, DWORD dwNumOfEntries) { ATLASSERT(m_hDC != NULL); return ::ColorCorrectPalette(m_hDC, hPalette, dwFirstEntry, dwNumOfEntries); } -#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) }; typedef CDCT CDCHandle; @@ -3394,7 +3174,7 @@ class CClientDC : public CDC // Constructor/destructor CClientDC(HWND hWnd) { - ATLASSERT(hWnd == NULL || ::IsWindow(hWnd)); + ATLASSERT((hWnd == NULL) || ::IsWindow(hWnd)); m_hWnd = hWnd; m_hDC = ::GetDC(hWnd); } @@ -3415,7 +3195,7 @@ class CWindowDC : public CDC // Constructor/destructor CWindowDC(HWND hWnd) { - ATLASSERT(hWnd == NULL || ::IsWindow(hWnd)); + ATLASSERT((hWnd == NULL) || ::IsWindow(hWnd)); m_hWnd = hWnd; m_hDC = ::GetWindowDC(hWnd); } @@ -3437,7 +3217,7 @@ class CMemoryDC : public CDC HBITMAP m_hBmpOld; // Constructor/destructor - CMemoryDC(HDC hDC, RECT& rcPaint) : m_hDCOriginal(hDC), m_hBmpOld(NULL) + CMemoryDC(HDC hDC, const RECT& rcPaint) : m_hDCOriginal(hDC), m_hBmpOld(NULL) { m_rcPaint = rcPaint; CreateCompatibleDC(m_hDCOriginal); @@ -3459,8 +3239,6 @@ class CMemoryDC : public CDC /////////////////////////////////////////////////////////////////////////////// // Enhanced metafile support -#ifndef _WIN32_WCE - class CEnhMetaFileInfo { public: @@ -3540,7 +3318,7 @@ class CEnhMetaFileT ~CEnhMetaFileT() { - if(t_bManaged && m_hEMF != NULL) + if(t_bManaged && (m_hEMF != NULL)) DeleteObject(); } @@ -3553,7 +3331,7 @@ class CEnhMetaFileT void Attach(HENHMETAFILE hEMF) { - if(t_bManaged && m_hEMF != NULL && m_hEMF != hEMF) + if(t_bManaged && (m_hEMF != NULL) && (m_hEMF != hEMF)) DeleteObject(); m_hEMF = hEMF; } @@ -3660,232 +3438,6 @@ class CEnhMetaFileDC : public CDC } }; -#endif // !_WIN32_WCE - - -/////////////////////////////////////////////////////////////////////////////// -// WinCE compatible clipboard CF_DIB format support functions - -#ifndef _WTL_NO_DIB16 - -#define DIBINFO16_BITFIELDS { 31744, 992, 31 } - -// DIBINFO16 - To avoid color table problems in WinCE we only create this type of Dib -struct DIBINFO16 // a BITMAPINFO with 2 additional color bitfields -{ - BITMAPINFOHEADER bmiHeader; - RGBQUAD bmiColors[3]; - - DIBINFO16(SIZE size) - { - BITMAPINFOHEADER bmih = { sizeof(BITMAPINFOHEADER), size.cx, size.cy, - 1, 16, BI_BITFIELDS, 2 * size.cx * size.cy , 0, 0, 3 }; - DWORD dw[3] = DIBINFO16_BITFIELDS ; - - bmiHeader = bmih; - SecureHelper::memcpy_x(bmiColors, sizeof(bmiColors), dw, 3 * sizeof(DWORD)); - } -}; - - -// AtlxxxDibxxx minimal packed DIB implementation and helpers to copy and paste CF_DIB - -inline bool AtlIsDib16(LPBITMAPINFOHEADER pbmih) -{ - return (pbmih->biBitCount == 16) && (pbmih->biCompression == BI_BITFIELDS); -} - -inline int AtlGetDibColorTableSize(LPBITMAPINFOHEADER pbmih) -{ - switch (pbmih->biBitCount) - { - case 2: - case 4: - case 8: - return pbmih->biClrUsed ? pbmih->biClrUsed : 1 << pbmih->biBitCount; - case 24: - break; - case 16: - case 32: - return pbmih->biCompression == BI_BITFIELDS ? 3 : 0; - default: - ATLASSERT(FALSE); // should never come here - } - - return 0; -} - -inline int AtlGetDibNumColors(LPBITMAPINFOHEADER pbmih) -{ - switch (pbmih->biBitCount) - { - case 2: - case 4: - case 8: - if (pbmih->biClrUsed) - return pbmih->biClrUsed; - else - break; - case 16: - if (pbmih->biCompression == BI_BITFIELDS ) - return 1 << 15; - else - break; - case 24: - break; - case 32: - if (pbmih->biCompression == BI_BITFIELDS ) - return 1 << 24; - else - break; - default: - ATLASSERT(FALSE); - } - - return 1 << pbmih->biBitCount; -} - -inline HBITMAP AtlGetDibBitmap(LPBITMAPINFO pbmi) -{ - CDC dc(NULL); - void* pBits = NULL; - - LPBYTE pDibBits = (LPBYTE)pbmi + sizeof(BITMAPINFOHEADER) + AtlGetDibColorTableSize(&pbmi->bmiHeader) * sizeof(RGBQUAD); - HBITMAP hbm = CreateDIBSection(dc, pbmi, DIB_RGB_COLORS, &pBits, NULL, NULL); - if (hbm != NULL) - { - int cbBits = pbmi->bmiHeader.biWidth * pbmi->bmiHeader.biHeight * pbmi->bmiHeader.biBitCount / 8; - SecureHelper::memcpy_x(pBits, cbBits, pDibBits, pbmi->bmiHeader.biSizeImage); - } - - return hbm; -} - -inline HBITMAP AtlCopyBitmap(HBITMAP hbm, SIZE sizeDst, bool bAsBitmap = false) -{ - CDC hdcSrc = CreateCompatibleDC(NULL); - CDC hdcDst = CreateCompatibleDC(NULL); - - CBitmapHandle hbmOld = NULL, hbmOld2 = NULL, bmSrc = hbm; - - CBitmap bmNew = NULL; - - SIZE sizeSrc = { 0 }; - bmSrc.GetSize(sizeSrc); - - hbmOld = hdcSrc.SelectBitmap(bmSrc); - - if (bAsBitmap) - { - bmNew.CreateCompatibleBitmap(hdcSrc, sizeDst.cx, sizeDst.cy); - } - else - { - DIBINFO16 dib16(sizeDst); - LPVOID pBits = NULL; - bmNew = CreateDIBSection(hdcDst, (const BITMAPINFO*)&dib16, DIB_RGB_COLORS, &pBits, NULL, NULL); - } - - ATLASSERT(!bmNew.IsNull()); - - hbmOld2 = hdcDst.SelectBitmap(bmNew); - BOOL bOK = FALSE; - - if ((sizeDst.cx == sizeSrc.cx) && (sizeDst.cy == sizeSrc.cy)) - bOK = hdcDst.BitBlt(0, 0, sizeDst.cx, sizeDst.cy, hdcSrc, 0, 0, SRCCOPY); - else - bOK = hdcDst.StretchBlt(0, 0, sizeDst.cx, sizeDst.cy, hdcSrc, 0, 0, sizeSrc.cx, sizeSrc.cy, SRCCOPY); - - hdcSrc.SelectBitmap(hbmOld); - hdcDst.SelectBitmap(hbmOld2); - - if (bOK == FALSE) - bmNew.DeleteObject(); - - return bmNew.Detach(); -} - -inline HLOCAL AtlCreatePackedDib16(HBITMAP hbm, SIZE size) -{ - DIBSECTION ds = { 0 }; - LPBYTE pDib = NULL; - bool bCopied = false; - - bool bOK = GetObject(hbm, sizeof(ds), &ds) == sizeof(ds); - if ((bOK == FALSE) || (ds.dsBm.bmBits == NULL) || (AtlIsDib16(&ds.dsBmih) == FALSE) || - (ds.dsBmih.biWidth != size.cx ) || (ds.dsBmih.biHeight != size.cy )) - { - if ((hbm = AtlCopyBitmap(hbm, size)) != NULL) - { - bCopied = true; - bOK = GetObject(hbm, sizeof(ds), &ds) == sizeof(ds); - } - else - { - bOK = FALSE; - } - } - - if((bOK != FALSE) && (AtlIsDib16(&ds.dsBmih) != FALSE) && (ds.dsBm.bmBits != NULL)) - { - pDib = (LPBYTE)LocalAlloc(LMEM_ZEROINIT, sizeof(DIBINFO16) + ds.dsBmih.biSizeImage); - if (pDib != NULL) - { - SecureHelper::memcpy_x(pDib, sizeof(DIBINFO16) + ds.dsBmih.biSizeImage, &ds.dsBmih, sizeof(DIBINFO16)); - SecureHelper::memcpy_x(pDib + sizeof(DIBINFO16), ds.dsBmih.biSizeImage, ds.dsBm.bmBits, ds.dsBmih.biSizeImage); - } - } - - if (bCopied == true) - DeleteObject(hbm); - - return (HLOCAL)pDib; -} - -inline bool AtlSetClipboardDib16(HBITMAP hbm, SIZE size, HWND hWnd) -{ - ATLASSERT(::IsWindow(hWnd)); - BOOL bOK = OpenClipboard(hWnd); - if (bOK != FALSE) - { - bOK = EmptyClipboard(); - if (bOK != FALSE) - { - HLOCAL hDib = AtlCreatePackedDib16(hbm, size); - if (hDib != NULL) - { - bOK = SetClipboardData(CF_DIB, hDib) != NULL; - if (bOK == FALSE) - LocalFree(hDib); - } - else - { - bOK = FALSE; - } - } - CloseClipboard(); - } - - return (bOK != FALSE); -} - -inline HBITMAP AtlGetClipboardDib(HWND hWnd) -{ - ATLASSERT(::IsWindow(hWnd) != FALSE); - HBITMAP hbm = NULL; - if (OpenClipboard(hWnd) != FALSE) - { - LPBITMAPINFO pbmi = (LPBITMAPINFO)GetClipboardData(CF_DIB); - if (pbmi != NULL) - hbm = AtlGetDibBitmap(pbmi); - CloseClipboard(); - } - - return hbm; -} - -#endif // _WTL_NO_DIB16 - }; // namespace WTL #endif // __ATLGDI_H__ diff --git a/thirdparty/wtl/atlmisc.h b/thirdparty/wtl/atlmisc.h index ce9d8c8..2ccbc64 100644 --- a/thirdparty/wtl/atlmisc.h +++ b/thirdparty/wtl/atlmisc.h @@ -1,13 +1,10 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. +// Windows Template Library - WTL version 10.0 +// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. +// Microsoft Public License (http://opensource.org/licenses/MS-PL) +// which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLMISC_H__ #define __ATLMISC_H__ @@ -18,2787 +15,66 @@ #error atlmisc.h requires atlapp.h to be included first #endif +#ifndef _WTL_NO_COMPATIBILITY_INCLUDES + #include + #include +#endif // _WTL_NO_COMPATIBILITY_INCLUDES -#ifdef _ATL_TMP_NO_CSTRING - #define _WTL_NO_CSTRING -#endif - -#if defined(_WTL_USE_CSTRING) && defined(_WTL_NO_CSTRING) - #error Conflicting options - both _WTL_USE_CSTRING and _WTL_NO_CSTRING are defined -#endif // defined(_WTL_USE_CSTRING) && defined(_WTL_NO_CSTRING) - -#if !defined(_WTL_USE_CSTRING) && !defined(_WTL_NO_CSTRING) - #define _WTL_USE_CSTRING -#endif // !defined(_WTL_USE_CSTRING) && !defined(_WTL_NO_CSTRING) - -#ifndef _WTL_NO_CSTRING - #if defined(_ATL_USE_CSTRING_FLOAT) && defined(_ATL_MIN_CRT) - #error Cannot use CString floating point formatting with _ATL_MIN_CRT defined - #endif // defined(_ATL_USE_CSTRING_FLOAT) && defined(_ATL_MIN_CRT) -#endif // !_WTL_NO_CSTRING - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CSize -// CPoint -// CRect -// CString -// -// CRecentDocumentListBase -// CRecentDocumentList -// CFindFile -// -// Global functions: -// AtlGetStockPen() -// AtlGetStockBrush() -// AtlGetStockFont() -// AtlGetStockPalette() -// -// AtlCompactPath() - - -namespace WTL -{ - -#ifndef _WTL_NO_WTYPES - -// forward declarations -class CSize; -class CPoint; -class CRect; - -/////////////////////////////////////////////////////////////////////////////// -// CSize - Wrapper for Windows SIZE structure. - -class CSize : public SIZE -{ -public: -// Constructors - CSize() - { - cx = 0; - cy = 0; - } - - CSize(int initCX, int initCY) - { - cx = initCX; - cy = initCY; - } - - CSize(SIZE initSize) - { - *(SIZE*)this = initSize; - } - - CSize(POINT initPt) - { - *(POINT*)this = initPt; - } - - CSize(DWORD dwSize) - { - cx = (short)LOWORD(dwSize); - cy = (short)HIWORD(dwSize); - } - -// Operations - BOOL operator ==(SIZE size) const - { - return (cx == size.cx && cy == size.cy); - } - - BOOL operator !=(SIZE size) const - { - return (cx != size.cx || cy != size.cy); - } - - void operator +=(SIZE size) - { - cx += size.cx; - cy += size.cy; - } - - void operator -=(SIZE size) - { - cx -= size.cx; - cy -= size.cy; - } - - void SetSize(int CX, int CY) - { - cx = CX; - cy = CY; - } - -// Operators returning CSize values - CSize operator +(SIZE size) const - { - return CSize(cx + size.cx, cy + size.cy); - } - - CSize operator -(SIZE size) const - { - return CSize(cx - size.cx, cy - size.cy); - } - - CSize operator -() const - { - return CSize(-cx, -cy); - } - -// Operators returning CPoint values - CPoint operator +(POINT point) const; - CPoint operator -(POINT point) const; - -// Operators returning CRect values - CRect operator +(const RECT* lpRect) const; - CRect operator -(const RECT* lpRect) const; -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CPoint - Wrapper for Windows POINT structure. - -class CPoint : public POINT -{ -public: -// Constructors - CPoint() - { - x = 0; - y = 0; - } - - CPoint(int initX, int initY) - { - x = initX; - y = initY; - } - - CPoint(POINT initPt) - { - *(POINT*)this = initPt; - } - - CPoint(SIZE initSize) - { - *(SIZE*)this = initSize; - } - - CPoint(DWORD dwPoint) - { - x = (short)LOWORD(dwPoint); - y = (short)HIWORD(dwPoint); - } - -// Operations - void Offset(int xOffset, int yOffset) - { - x += xOffset; - y += yOffset; - } - - void Offset(POINT point) - { - x += point.x; - y += point.y; - } - - void Offset(SIZE size) - { - x += size.cx; - y += size.cy; - } - - BOOL operator ==(POINT point) const - { - return (x == point.x && y == point.y); - } - - BOOL operator !=(POINT point) const - { - return (x != point.x || y != point.y); - } - - void operator +=(SIZE size) - { - x += size.cx; - y += size.cy; - } - - void operator -=(SIZE size) - { - x -= size.cx; - y -= size.cy; - } - - void operator +=(POINT point) - { - x += point.x; - y += point.y; - } - - void operator -=(POINT point) - { - x -= point.x; - y -= point.y; - } - - void SetPoint(int X, int Y) - { - x = X; - y = Y; - } - -// Operators returning CPoint values - CPoint operator +(SIZE size) const - { - return CPoint(x + size.cx, y + size.cy); - } - - CPoint operator -(SIZE size) const - { - return CPoint(x - size.cx, y - size.cy); - } - - CPoint operator -() const - { - return CPoint(-x, -y); - } - - CPoint operator +(POINT point) const - { - return CPoint(x + point.x, y + point.y); - } - -// Operators returning CSize values - CSize operator -(POINT point) const - { - return CSize(x - point.x, y - point.y); - } - -// Operators returning CRect values - CRect operator +(const RECT* lpRect) const; - CRect operator -(const RECT* lpRect) const; -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CRect - Wrapper for Windows RECT structure. - -class CRect : public RECT -{ -public: -// Constructors - CRect() - { - left = 0; - top = 0; - right = 0; - bottom = 0; - } - - CRect(int l, int t, int r, int b) - { - left = l; - top = t; - right = r; - bottom = b; - } - - CRect(const RECT& srcRect) - { - ::CopyRect(this, &srcRect); - } - - CRect(LPCRECT lpSrcRect) - { - ::CopyRect(this, lpSrcRect); - } - - CRect(POINT point, SIZE size) - { - right = (left = point.x) + size.cx; - bottom = (top = point.y) + size.cy; - } - - CRect(POINT topLeft, POINT bottomRight) - { - left = topLeft.x; - top = topLeft.y; - right = bottomRight.x; - bottom = bottomRight.y; - } - -// Attributes (in addition to RECT members) - int Width() const - { - return right - left; - } - - int Height() const - { - return bottom - top; - } - - CSize Size() const - { - return CSize(right - left, bottom - top); - } - - CPoint& TopLeft() - { - return *((CPoint*)this); - } - - CPoint& BottomRight() - { - return *((CPoint*)this + 1); - } - - const CPoint& TopLeft() const - { - return *((CPoint*)this); - } - - const CPoint& BottomRight() const - { - return *((CPoint*)this + 1); - } - - CPoint CenterPoint() const - { - return CPoint((left + right) / 2, (top + bottom) / 2); - } - - // convert between CRect and LPRECT/LPCRECT (no need for &) - operator LPRECT() - { - return this; - } - - operator LPCRECT() const - { - return this; - } - - BOOL IsRectEmpty() const - { - return ::IsRectEmpty(this); - } - - BOOL IsRectNull() const - { - return (left == 0 && right == 0 && top == 0 && bottom == 0); - } - - BOOL PtInRect(POINT point) const - { - return ::PtInRect(this, point); - } - -// Operations - void SetRect(int x1, int y1, int x2, int y2) - { - ::SetRect(this, x1, y1, x2, y2); - } - - void SetRect(POINT topLeft, POINT bottomRight) - { - ::SetRect(this, topLeft.x, topLeft.y, bottomRight.x, bottomRight.y); - } - - void SetRectEmpty() - { - ::SetRectEmpty(this); - } - - void CopyRect(LPCRECT lpSrcRect) - { - ::CopyRect(this, lpSrcRect); - } - - BOOL EqualRect(LPCRECT lpRect) const - { - return ::EqualRect(this, lpRect); - } - - void InflateRect(int x, int y) - { - ::InflateRect(this, x, y); - } - - void InflateRect(SIZE size) - { - ::InflateRect(this, size.cx, size.cy); - } - - void InflateRect(LPCRECT lpRect) - { - left -= lpRect->left; - top -= lpRect->top; - right += lpRect->right; - bottom += lpRect->bottom; - } - - void InflateRect(int l, int t, int r, int b) - { - left -= l; - top -= t; - right += r; - bottom += b; - } - - void DeflateRect(int x, int y) - { - ::InflateRect(this, -x, -y); - } - - void DeflateRect(SIZE size) - { - ::InflateRect(this, -size.cx, -size.cy); - } - - void DeflateRect(LPCRECT lpRect) - { - left += lpRect->left; - top += lpRect->top; - right -= lpRect->right; - bottom -= lpRect->bottom; - } - - void DeflateRect(int l, int t, int r, int b) - { - left += l; - top += t; - right -= r; - bottom -= b; - } - - void OffsetRect(int x, int y) - { - ::OffsetRect(this, x, y); - } - void OffsetRect(SIZE size) - { - ::OffsetRect(this, size.cx, size.cy); - } - - void OffsetRect(POINT point) - { - ::OffsetRect(this, point.x, point.y); - } - - void NormalizeRect() - { - int nTemp; - if (left > right) - { - nTemp = left; - left = right; - right = nTemp; - } - if (top > bottom) - { - nTemp = top; - top = bottom; - bottom = nTemp; - } - } - - // absolute position of rectangle - void MoveToY(int y) - { - bottom = Height() + y; - top = y; - } - - void MoveToX(int x) - { - right = Width() + x; - left = x; - } - - void MoveToXY(int x, int y) - { - MoveToX(x); - MoveToY(y); - } - - void MoveToXY(POINT pt) - { - MoveToX(pt.x); - MoveToY(pt.y); - } - - // operations that fill '*this' with result - BOOL IntersectRect(LPCRECT lpRect1, LPCRECT lpRect2) - { - return ::IntersectRect(this, lpRect1, lpRect2); - } - - BOOL UnionRect(LPCRECT lpRect1, LPCRECT lpRect2) - { - return ::UnionRect(this, lpRect1, lpRect2); - } - - BOOL SubtractRect(LPCRECT lpRectSrc1, LPCRECT lpRectSrc2) - { - return ::SubtractRect(this, lpRectSrc1, lpRectSrc2); - } - -// Additional Operations - void operator =(const RECT& srcRect) - { - ::CopyRect(this, &srcRect); - } - - BOOL operator ==(const RECT& rect) const - { - return ::EqualRect(this, &rect); - } - - BOOL operator !=(const RECT& rect) const - { - return !::EqualRect(this, &rect); - } - - void operator +=(POINT point) - { - ::OffsetRect(this, point.x, point.y); - } - - void operator +=(SIZE size) - { - ::OffsetRect(this, size.cx, size.cy); - } - - void operator +=(LPCRECT lpRect) - { - InflateRect(lpRect); - } - - void operator -=(POINT point) - { - ::OffsetRect(this, -point.x, -point.y); - } - - void operator -=(SIZE size) - { - ::OffsetRect(this, -size.cx, -size.cy); - } - - void operator -=(LPCRECT lpRect) - { - DeflateRect(lpRect); - } - - void operator &=(const RECT& rect) - { - ::IntersectRect(this, this, &rect); - } - - void operator |=(const RECT& rect) - { - ::UnionRect(this, this, &rect); - } - -// Operators returning CRect values - CRect operator +(POINT pt) const - { - CRect rect(*this); - ::OffsetRect(&rect, pt.x, pt.y); - return rect; - } - - CRect operator -(POINT pt) const - { - CRect rect(*this); - ::OffsetRect(&rect, -pt.x, -pt.y); - return rect; - } - - CRect operator +(LPCRECT lpRect) const - { - CRect rect(this); - rect.InflateRect(lpRect); - return rect; - } - - CRect operator +(SIZE size) const - { - CRect rect(*this); - ::OffsetRect(&rect, size.cx, size.cy); - return rect; - } - - CRect operator -(SIZE size) const - { - CRect rect(*this); - ::OffsetRect(&rect, -size.cx, -size.cy); - return rect; - } - - CRect operator -(LPCRECT lpRect) const - { - CRect rect(this); - rect.DeflateRect(lpRect); - return rect; - } - - CRect operator &(const RECT& rect2) const - { - CRect rect; - ::IntersectRect(&rect, this, &rect2); - return rect; - } - - CRect operator |(const RECT& rect2) const - { - CRect rect; - ::UnionRect(&rect, this, &rect2); - return rect; - } - - CRect MulDiv(int nMultiplier, int nDivisor) const - { - return CRect( - ::MulDiv(left, nMultiplier, nDivisor), - ::MulDiv(top, nMultiplier, nDivisor), - ::MulDiv(right, nMultiplier, nDivisor), - ::MulDiv(bottom, nMultiplier, nDivisor)); - } -}; - - -// CSize implementation - -inline CPoint CSize::operator +(POINT point) const -{ return CPoint(cx + point.x, cy + point.y); } - -inline CPoint CSize::operator -(POINT point) const -{ return CPoint(cx - point.x, cy - point.y); } - -inline CRect CSize::operator +(const RECT* lpRect) const -{ return CRect(lpRect) + *this; } - -inline CRect CSize::operator -(const RECT* lpRect) const -{ return CRect(lpRect) - *this; } - - -// CPoint implementation - -inline CRect CPoint::operator +(const RECT* lpRect) const -{ return CRect(lpRect) + *this; } - -inline CRect CPoint::operator -(const RECT* lpRect) const -{ return CRect(lpRect) - *this; } - -#endif // !_WTL_NO_WTYPES - - -// WTL::CSize or ATL::CSize scalar operators - -#if !defined(_WTL_NO_SIZE_SCALAR) && (!defined(_WTL_NO_WTYPES) || defined(__ATLTYPES_H__)) - -template -inline CSize operator *(SIZE s, Num n) -{ - return CSize((int)(s.cx * n), (int)(s.cy * n)); -}; - -template -inline void operator *=(SIZE & s, Num n) -{ - s = s * n; -}; - -template -inline CSize operator /(SIZE s, Num n) -{ - return CSize((int)(s.cx / n), (int)(s.cy / n)); -}; - -template -inline void operator /=(SIZE & s, Num n) -{ - s = s / n; -}; - -#endif // !defined(_WTL_NO_SIZE_SCALAR) && (!defined(_WTL_NO_WTYPES) || defined(__ATLTYPES_H__)) - - -/////////////////////////////////////////////////////////////////////////////// -// CString - String class - -#ifndef _WTL_NO_CSTRING - -struct CStringData -{ - long nRefs; // reference count - int nDataLength; - int nAllocLength; - // TCHAR data[nAllocLength] - - TCHAR* data() - { return (TCHAR*)(this + 1); } -}; - -// Globals - -// For an empty string, m_pchData will point here -// (note: avoids special case of checking for NULL m_pchData) -// empty string data (and locked) -_declspec(selectany) int rgInitData[] = { -1, 0, 0, 0 }; -_declspec(selectany) CStringData* _atltmpDataNil = (CStringData*)&rgInitData; -_declspec(selectany) LPCTSTR _atltmpPchNil = (LPCTSTR)(((BYTE*)&rgInitData) + sizeof(CStringData)); - - -class CString -{ -public: -// Constructors - CString() - { - Init(); - } - - CString(const CString& stringSrc) - { - ATLASSERT(stringSrc.GetData()->nRefs != 0); - if (stringSrc.GetData()->nRefs >= 0) - { - ATLASSERT(stringSrc.GetData() != _atltmpDataNil); - m_pchData = stringSrc.m_pchData; - InterlockedIncrement(&GetData()->nRefs); - } - else - { - Init(); - *this = stringSrc.m_pchData; - } - } - - CString(TCHAR ch, int nRepeat = 1) - { - ATLASSERT(!_istlead(ch)); // can't create a lead byte string - Init(); - if (nRepeat >= 1) - { - if(AllocBuffer(nRepeat)) - { -#ifdef _UNICODE - for (int i = 0; i < nRepeat; i++) - m_pchData[i] = ch; -#else - memset(m_pchData, ch, nRepeat); -#endif - } - } - } - - CString(LPCTSTR lpsz) - { - Init(); - if (lpsz != NULL && HIWORD(lpsz) == NULL) - { - UINT nID = LOWORD((DWORD_PTR)lpsz); - if (!LoadString(nID)) - ATLTRACE2(atlTraceUI, 0, _T("Warning: implicit LoadString(%u) in CString failed\n"), nID); - } - else - { - int nLen = SafeStrlen(lpsz); - if (nLen != 0) - { - if(AllocBuffer(nLen)) - SecureHelper::memcpy_x(m_pchData, (nLen + 1) * sizeof(TCHAR), lpsz, nLen * sizeof(TCHAR)); - } - } - } - -#ifdef _UNICODE - CString(LPCSTR lpsz) - { - Init(); -#if defined(_WIN32_WCE) && (_ATL_VER >= 0x0800) - int nSrcLen = (lpsz != NULL) ? ATL::lstrlenA(lpsz) : 0; -#else - int nSrcLen = (lpsz != NULL) ? lstrlenA(lpsz) : 0; -#endif - if (nSrcLen != 0) - { - if(AllocBuffer(nSrcLen)) - { - _mbstowcsz(m_pchData, lpsz, nSrcLen + 1); - ReleaseBuffer(); - } - } - } -#else // !_UNICODE - CString(LPCWSTR lpsz) - { - Init(); - int nSrcLen = (lpsz != NULL) ? (int)wcslen(lpsz) : 0; - if (nSrcLen != 0) - { - if(AllocBuffer(nSrcLen * 2)) - { - _wcstombsz(m_pchData, lpsz, (nSrcLen * 2) + 1); - ReleaseBuffer(); - } - } - } -#endif // !_UNICODE - - CString(LPCTSTR lpch, int nLength) - { - Init(); - if (nLength != 0) - { - if(AllocBuffer(nLength)) - SecureHelper::memcpy_x(m_pchData, (nLength + 1) * sizeof(TCHAR), lpch, nLength * sizeof(TCHAR)); - } - } - -#ifdef _UNICODE - CString(LPCSTR lpsz, int nLength) - { - Init(); - if (nLength != 0) - { - if(AllocBuffer(nLength)) - { - int n = ::MultiByteToWideChar(CP_ACP, 0, lpsz, nLength, m_pchData, nLength + 1); - ReleaseBuffer((n >= 0) ? n : -1); - } - } - } -#else // !_UNICODE - CString(LPCWSTR lpsz, int nLength) - { - Init(); - if (nLength != 0) - { - if(((nLength * 2) > nLength) && AllocBuffer(nLength * 2)) - { - int n = ::WideCharToMultiByte(CP_ACP, 0, lpsz, nLength, m_pchData, (nLength * 2) + 1, NULL, NULL); - ReleaseBuffer((n >= 0) ? n : -1); - } - } - } -#endif // !_UNICODE - - CString(const unsigned char* lpsz) - { - Init(); - *this = (LPCSTR)lpsz; - } - -// Attributes & Operations - int GetLength() const // as an array of characters - { - return GetData()->nDataLength; - } - - BOOL IsEmpty() const - { - return GetData()->nDataLength == 0; - } - - void Empty() // free up the data - { - if (GetData()->nDataLength == 0) - return; - - if (GetData()->nRefs >= 0) - Release(); - else - *this = _T(""); - - ATLASSERT(GetData()->nDataLength == 0); - ATLASSERT(GetData()->nRefs < 0 || GetData()->nAllocLength == 0); - } - - TCHAR GetAt(int nIndex) const // 0 based - { - ATLASSERT(nIndex >= 0); - ATLASSERT(nIndex < GetData()->nDataLength); - return m_pchData[nIndex]; - } - - TCHAR operator [](int nIndex) const // same as GetAt - { - // same as GetAt - ATLASSERT(nIndex >= 0); - ATLASSERT(nIndex < GetData()->nDataLength); - return m_pchData[nIndex]; - } - - void SetAt(int nIndex, TCHAR ch) - { - ATLASSERT(nIndex >= 0); - ATLASSERT(nIndex < GetData()->nDataLength); - - CopyBeforeWrite(); - m_pchData[nIndex] = ch; - } - - operator LPCTSTR() const // as a C string - { - return m_pchData; - } - - // overloaded assignment - CString& operator =(const CString& stringSrc) - { - if (m_pchData != stringSrc.m_pchData) - { - if ((GetData()->nRefs < 0 && GetData() != _atltmpDataNil) || stringSrc.GetData()->nRefs < 0) - { - // actual copy necessary since one of the strings is locked - AssignCopy(stringSrc.GetData()->nDataLength, stringSrc.m_pchData); - } - else - { - // can just copy references around - Release(); - ATLASSERT(stringSrc.GetData() != _atltmpDataNil); - m_pchData = stringSrc.m_pchData; - InterlockedIncrement(&GetData()->nRefs); - } - } - return *this; - } - - CString& operator =(TCHAR ch) - { - ATLASSERT(!_istlead(ch)); // can't set single lead byte - AssignCopy(1, &ch); - return *this; - } - -#ifdef _UNICODE - CString& operator =(char ch) - { - *this = (TCHAR)ch; - return *this; - } -#endif - - CString& operator =(LPCTSTR lpsz) - { - ATLASSERT(lpsz == NULL || _IsValidString(lpsz)); - AssignCopy(SafeStrlen(lpsz), lpsz); - return *this; - } - -#ifdef _UNICODE - CString& operator =(LPCSTR lpsz) - { -#if defined(_WIN32_WCE) && (_ATL_VER >= 0x0800) - int nSrcLen = (lpsz != NULL) ? ATL::lstrlenA(lpsz) : 0; -#else - int nSrcLen = (lpsz != NULL) ? lstrlenA(lpsz) : 0; -#endif - if(AllocBeforeWrite(nSrcLen)) - { - _mbstowcsz(m_pchData, lpsz, nSrcLen + 1); - ReleaseBuffer(); - } - return *this; - } -#else // !_UNICODE - CString& operator =(LPCWSTR lpsz) - { - int nSrcLen = (lpsz != NULL) ? (int)wcslen(lpsz) : 0; - if(AllocBeforeWrite(nSrcLen * 2)) - { - _wcstombsz(m_pchData, lpsz, (nSrcLen * 2) + 1); - ReleaseBuffer(); - } - return *this; - } -#endif // !_UNICODE - - CString& operator =(const unsigned char* lpsz) - { - *this = (LPCSTR)lpsz; - return *this; - } - - // string concatenation - CString& operator +=(const CString& string) - { - ConcatInPlace(string.GetData()->nDataLength, string.m_pchData); - return *this; - } - - CString& operator +=(TCHAR ch) - { - ConcatInPlace(1, &ch); - return *this; - } - -#ifdef _UNICODE - CString& operator +=(char ch) - { - *this += (TCHAR)ch; - return *this; - } -#endif - - CString& operator +=(LPCTSTR lpsz) - { - ATLASSERT(lpsz == NULL || _IsValidString(lpsz)); - ConcatInPlace(SafeStrlen(lpsz), lpsz); - return *this; - } - - friend CString __stdcall operator +(const CString& string1, const CString& string2); - friend CString __stdcall operator +(const CString& string, TCHAR ch); - friend CString __stdcall operator +(TCHAR ch, const CString& string); -#ifdef _UNICODE - friend CString __stdcall operator +(const CString& string, char ch); - friend CString __stdcall operator +(char ch, const CString& string); -#endif - friend CString __stdcall operator +(const CString& string, LPCTSTR lpsz); - friend CString __stdcall operator +(LPCTSTR lpsz, const CString& string); - - // string comparison - int Compare(LPCTSTR lpsz) const // straight character (MBCS/Unicode aware) - { - return _cstrcmp(m_pchData, lpsz); - } - - int CompareNoCase(LPCTSTR lpsz) const // ignore case (MBCS/Unicode aware) - { - return _cstrcmpi(m_pchData, lpsz); - } - -#ifndef _WIN32_WCE - // CString::Collate is often slower than Compare but is MBSC/Unicode - // aware as well as locale-sensitive with respect to sort order. - int Collate(LPCTSTR lpsz) const // NLS aware - { - return _cstrcoll(m_pchData, lpsz); - } - - int CollateNoCase(LPCTSTR lpsz) const // ignore case - { - return _cstrcolli(m_pchData, lpsz); - } -#endif // !_WIN32_WCE - - // simple sub-string extraction - CString Mid(int nFirst, int nCount) const - { - // out-of-bounds requests return sensible things - if (nFirst < 0) - nFirst = 0; - if (nCount < 0) - nCount = 0; - - if (nFirst + nCount > GetData()->nDataLength) - nCount = GetData()->nDataLength - nFirst; - if (nFirst > GetData()->nDataLength) - nCount = 0; - - CString dest; - AllocCopy(dest, nCount, nFirst, 0); - return dest; - } - - CString Mid(int nFirst) const - { - return Mid(nFirst, GetData()->nDataLength - nFirst); - } - - CString Left(int nCount) const - { - if (nCount < 0) - nCount = 0; - else if (nCount > GetData()->nDataLength) - nCount = GetData()->nDataLength; - - CString dest; - AllocCopy(dest, nCount, 0, 0); - return dest; - } - - CString Right(int nCount) const - { - if (nCount < 0) - nCount = 0; - else if (nCount > GetData()->nDataLength) - nCount = GetData()->nDataLength; - - CString dest; - AllocCopy(dest, nCount, GetData()->nDataLength-nCount, 0); - return dest; - } - - CString SpanIncluding(LPCTSTR lpszCharSet) const // strspn equivalent - { - ATLASSERT(_IsValidString(lpszCharSet)); - return Left(_cstrspn(m_pchData, lpszCharSet)); - } - - CString SpanExcluding(LPCTSTR lpszCharSet) const // strcspn equivalent - { - ATLASSERT(_IsValidString(lpszCharSet)); - return Left(_cstrcspn(m_pchData, lpszCharSet)); - } - - // upper/lower/reverse conversion - void MakeUpper() - { - CopyBeforeWrite(); - CharUpper(m_pchData); - } - - void MakeLower() - { - CopyBeforeWrite(); - CharLower(m_pchData); - } - - void MakeReverse() - { - CopyBeforeWrite(); - _cstrrev(m_pchData); - } - - // trimming whitespace (either side) - void TrimRight() - { - CopyBeforeWrite(); - - // find beginning of trailing spaces by starting at beginning (DBCS aware) - LPTSTR lpsz = m_pchData; - LPTSTR lpszLast = NULL; - while (*lpsz != _T('\0')) - { - if (_cstrisspace(*lpsz)) - { - if (lpszLast == NULL) - lpszLast = lpsz; - } - else - { - lpszLast = NULL; - } - lpsz = ::CharNext(lpsz); - } - - if (lpszLast != NULL) - { - // truncate at trailing space start - *lpszLast = _T('\0'); - GetData()->nDataLength = (int)(DWORD_PTR)(lpszLast - m_pchData); - } - } - - void TrimLeft() - { - CopyBeforeWrite(); - - // find first non-space character - LPCTSTR lpsz = m_pchData; - while (_cstrisspace(*lpsz)) - lpsz = ::CharNext(lpsz); - - // fix up data and length - int nDataLength = GetData()->nDataLength - (int)(DWORD_PTR)(lpsz - m_pchData); - SecureHelper::memmove_x(m_pchData, (GetData()->nAllocLength + 1) * sizeof(TCHAR), lpsz, (nDataLength + 1) * sizeof(TCHAR)); - GetData()->nDataLength = nDataLength; - } - - // remove continuous occurrences of chTarget starting from right - void TrimRight(TCHAR chTarget) - { - // find beginning of trailing matches - // by starting at beginning (DBCS aware) - - CopyBeforeWrite(); - LPTSTR lpsz = m_pchData; - LPTSTR lpszLast = NULL; - - while (*lpsz != _T('\0')) - { - if (*lpsz == chTarget) - { - if (lpszLast == NULL) - lpszLast = lpsz; - } - else - lpszLast = NULL; - lpsz = ::CharNext(lpsz); - } - - if (lpszLast != NULL) - { - // truncate at left-most matching character - *lpszLast = _T('\0'); - GetData()->nDataLength = (int)(DWORD_PTR)(lpszLast - m_pchData); - } - } - - // remove continuous occcurrences of characters in passed string, starting from right - void TrimRight(LPCTSTR lpszTargetList) - { - // find beginning of trailing matches by starting at beginning (DBCS aware) - - CopyBeforeWrite(); - LPTSTR lpsz = m_pchData; - LPTSTR lpszLast = NULL; - - while (*lpsz != _T('\0')) - { - TCHAR* pNext = ::CharNext(lpsz); - if(pNext > lpsz + 1) - { - if (_cstrchr_db(lpszTargetList, *lpsz, *(lpsz + 1)) != NULL) - { - if (lpszLast == NULL) - lpszLast = lpsz; - } - else - { - lpszLast = NULL; - } - } - else - { - if (_cstrchr(lpszTargetList, *lpsz) != NULL) - { - if (lpszLast == NULL) - lpszLast = lpsz; - } - else - { - lpszLast = NULL; - } - } - - lpsz = pNext; - } - - if (lpszLast != NULL) - { - // truncate at left-most matching character - *lpszLast = _T('\0'); - GetData()->nDataLength = (int)(DWORD_PTR)(lpszLast - m_pchData); - } - } - - // remove continuous occurrences of chTarget starting from left - void TrimLeft(TCHAR chTarget) - { - // find first non-matching character - - CopyBeforeWrite(); - LPCTSTR lpsz = m_pchData; - - while (chTarget == *lpsz) - lpsz = ::CharNext(lpsz); - - if (lpsz != m_pchData) - { - // fix up data and length - int nDataLength = GetData()->nDataLength - (int)(DWORD_PTR)(lpsz - m_pchData); - SecureHelper::memmove_x(m_pchData, (GetData()->nAllocLength + 1) * sizeof(TCHAR), lpsz, (nDataLength + 1) * sizeof(TCHAR)); - GetData()->nDataLength = nDataLength; - } - } - - // remove continuous occcurrences of characters in passed string, starting from left - void TrimLeft(LPCTSTR lpszTargets) - { - // if we're not trimming anything, we're not doing any work - if (SafeStrlen(lpszTargets) == 0) - return; - - CopyBeforeWrite(); - LPCTSTR lpsz = m_pchData; - - while (*lpsz != _T('\0')) - { - TCHAR* pNext = ::CharNext(lpsz); - if(pNext > lpsz + 1) - { - if (_cstrchr_db(lpszTargets, *lpsz, *(lpsz + 1)) == NULL) - break; - } - else - { - if (_cstrchr(lpszTargets, *lpsz) == NULL) - break; - } - lpsz = pNext; - } - - if (lpsz != m_pchData) - { - // fix up data and length - int nDataLength = GetData()->nDataLength - (int)(DWORD_PTR)(lpsz - m_pchData); - SecureHelper::memmove_x(m_pchData, (GetData()->nAllocLength + 1) * sizeof(TCHAR), lpsz, (nDataLength + 1) * sizeof(TCHAR)); - GetData()->nDataLength = nDataLength; - } - } - - // advanced manipulation - // replace occurrences of chOld with chNew - int Replace(TCHAR chOld, TCHAR chNew) - { - int nCount = 0; - - // short-circuit the nop case - if (chOld != chNew) - { - // otherwise modify each character that matches in the string - CopyBeforeWrite(); - LPTSTR psz = m_pchData; - LPTSTR pszEnd = psz + GetData()->nDataLength; - while (psz < pszEnd) - { - // replace instances of the specified character only - if (*psz == chOld) - { - *psz = chNew; - nCount++; - } - psz = ::CharNext(psz); - } - } - return nCount; - } - - // replace occurrences of substring lpszOld with lpszNew; - // empty lpszNew removes instances of lpszOld - int Replace(LPCTSTR lpszOld, LPCTSTR lpszNew) - { - // can't have empty or NULL lpszOld - - int nSourceLen = SafeStrlen(lpszOld); - if (nSourceLen == 0) - return 0; - int nReplacementLen = SafeStrlen(lpszNew); - - // loop once to figure out the size of the result string - int nCount = 0; - LPTSTR lpszStart = m_pchData; - LPTSTR lpszEnd = m_pchData + GetData()->nDataLength; - LPTSTR lpszTarget = NULL; - while (lpszStart < lpszEnd) - { - while ((lpszTarget = (TCHAR*)_cstrstr(lpszStart, lpszOld)) != NULL) - { - nCount++; - lpszStart = lpszTarget + nSourceLen; - } - lpszStart += lstrlen(lpszStart) + 1; - } - - // if any changes were made, make them - if (nCount > 0) - { - CopyBeforeWrite(); - - // if the buffer is too small, just allocate a new buffer (slow but sure) - int nOldLength = GetData()->nDataLength; - int nNewLength = nOldLength + (nReplacementLen - nSourceLen) * nCount; - if (GetData()->nAllocLength < nNewLength || GetData()->nRefs > 1) - { - CStringData* pOldData = GetData(); - LPTSTR pstr = m_pchData; - if(!AllocBuffer(nNewLength)) - return -1; - SecureHelper::memcpy_x(m_pchData, (nNewLength + 1) * sizeof(TCHAR), pstr, pOldData->nDataLength * sizeof(TCHAR)); - CString::Release(pOldData); - } - // else, we just do it in-place - lpszStart = m_pchData; - lpszEnd = m_pchData + GetData()->nDataLength; - - // loop again to actually do the work - while (lpszStart < lpszEnd) - { - while ((lpszTarget = (TCHAR*)_cstrstr(lpszStart, lpszOld)) != NULL) - { - int nBalance = nOldLength - ((int)(DWORD_PTR)(lpszTarget - m_pchData) + nSourceLen); - int cchBuffLen = GetData()->nAllocLength - (int)(DWORD_PTR)(lpszTarget - m_pchData); - SecureHelper::memmove_x(lpszTarget + nReplacementLen, (cchBuffLen - nReplacementLen + 1) * sizeof(TCHAR), lpszTarget + nSourceLen, nBalance * sizeof(TCHAR)); - SecureHelper::memcpy_x(lpszTarget, (cchBuffLen + 1) * sizeof(TCHAR), lpszNew, nReplacementLen * sizeof(TCHAR)); - lpszStart = lpszTarget + nReplacementLen; - lpszStart[nBalance] = _T('\0'); - nOldLength += (nReplacementLen - nSourceLen); - } - lpszStart += lstrlen(lpszStart) + 1; - } - ATLASSERT(m_pchData[nNewLength] == _T('\0')); - GetData()->nDataLength = nNewLength; - } - - return nCount; - } - - // remove occurrences of chRemove - int Remove(TCHAR chRemove) - { - CopyBeforeWrite(); - - LPTSTR pstrSource = m_pchData; - LPTSTR pstrDest = m_pchData; - LPTSTR pstrEnd = m_pchData + GetData()->nDataLength; - - while (pstrSource < pstrEnd) - { - if (*pstrSource != chRemove) - { - *pstrDest = *pstrSource; - pstrDest = ::CharNext(pstrDest); - } - pstrSource = ::CharNext(pstrSource); - } - *pstrDest = _T('\0'); - int nCount = (int)(DWORD_PTR)(pstrSource - pstrDest); - GetData()->nDataLength -= nCount; - - return nCount; - } - - // insert character at zero-based index; concatenates if index is past end of string - int Insert(int nIndex, TCHAR ch) - { - CopyBeforeWrite(); - - if (nIndex < 0) - nIndex = 0; - - int nNewLength = GetData()->nDataLength; - if (nIndex > nNewLength) - nIndex = nNewLength; - nNewLength++; - - if (GetData()->nAllocLength < nNewLength) - { - CStringData* pOldData = GetData(); - LPTSTR pstr = m_pchData; - if(!AllocBuffer(nNewLength)) - return -1; - SecureHelper::memcpy_x(m_pchData, (nNewLength + 1) * sizeof(TCHAR), pstr, (pOldData->nDataLength + 1) * sizeof(TCHAR)); - CString::Release(pOldData); - } - - // move existing bytes down - SecureHelper::memmove_x(m_pchData + nIndex + 1, (GetData()->nAllocLength - nIndex) * sizeof(TCHAR), m_pchData + nIndex, (nNewLength - nIndex) * sizeof(TCHAR)); - m_pchData[nIndex] = ch; - GetData()->nDataLength = nNewLength; - - return nNewLength; - } - - // insert substring at zero-based index; concatenates if index is past end of string - int Insert(int nIndex, LPCTSTR pstr) - { - if (nIndex < 0) - nIndex = 0; - - int nInsertLength = SafeStrlen(pstr); - int nNewLength = GetData()->nDataLength; - if (nInsertLength > 0) - { - CopyBeforeWrite(); - if (nIndex > nNewLength) - nIndex = nNewLength; - nNewLength += nInsertLength; - - if (GetData()->nAllocLength < nNewLength) - { - CStringData* pOldData = GetData(); - LPTSTR pstr2 = m_pchData; - if(!AllocBuffer(nNewLength)) - return -1; - SecureHelper::memcpy_x(m_pchData, (nNewLength + 1) * sizeof(TCHAR), pstr2, (pOldData->nDataLength + 1) * sizeof(TCHAR)); - CString::Release(pOldData); - } - - // move existing bytes down - SecureHelper::memmove_x(m_pchData + nIndex + nInsertLength, (GetData()->nAllocLength + 1 - nIndex - nInsertLength) * sizeof(TCHAR), m_pchData + nIndex, (nNewLength - nIndex - nInsertLength + 1) * sizeof(TCHAR)); - SecureHelper::memcpy_x(m_pchData + nIndex, (GetData()->nAllocLength + 1 - nIndex) * sizeof(TCHAR), pstr, nInsertLength * sizeof(TCHAR)); - GetData()->nDataLength = nNewLength; - } - - return nNewLength; - } - - // delete nCount characters starting at zero-based index - int Delete(int nIndex, int nCount = 1) - { - if (nIndex < 0) - nIndex = 0; - int nLength = GetData()->nDataLength; - if (nCount > 0 && nIndex < nLength) - { - if((nIndex + nCount) > nLength) - nCount = nLength - nIndex; - CopyBeforeWrite(); - int nBytesToCopy = nLength - (nIndex + nCount) + 1; - - SecureHelper::memmove_x(m_pchData + nIndex, (GetData()->nAllocLength + 1 - nIndex) * sizeof(TCHAR), m_pchData + nIndex + nCount, nBytesToCopy * sizeof(TCHAR)); - nLength -= nCount; - GetData()->nDataLength = nLength; - } - - return nLength; - } - - // searching (return starting index, or -1 if not found) - // look for a single character match - int Find(TCHAR ch) const // like "C" strchr - { - return Find(ch, 0); - } - - int ReverseFind(TCHAR ch) const - { - // find last single character - LPCTSTR lpsz = _cstrrchr(m_pchData, (_TUCHAR)ch); - - // return -1 if not found, distance from beginning otherwise - return (lpsz == NULL) ? -1 : (int)(lpsz - m_pchData); - } - - int Find(TCHAR ch, int nStart) const // starting at index - { - int nLength = GetData()->nDataLength; - if (nStart < 0 || nStart >= nLength) - return -1; - - // find first single character - LPCTSTR lpsz = _cstrchr(m_pchData + nStart, (_TUCHAR)ch); - - // return -1 if not found and index otherwise - return (lpsz == NULL) ? -1 : (int)(lpsz - m_pchData); - } - - int FindOneOf(LPCTSTR lpszCharSet) const - { - ATLASSERT(_IsValidString(lpszCharSet)); - LPCTSTR lpsz = _cstrpbrk(m_pchData, lpszCharSet); - return (lpsz == NULL) ? -1 : (int)(lpsz - m_pchData); - } - - // look for a specific sub-string - // find a sub-string (like strstr) - int Find(LPCTSTR lpszSub) const // like "C" strstr - { - return Find(lpszSub, 0); - } - - int Find(LPCTSTR lpszSub, int nStart) const // starting at index - { - ATLASSERT(_IsValidString(lpszSub)); - - int nLength = GetData()->nDataLength; - if (nStart < 0 || nStart > nLength) - return -1; - - // find first matching substring - LPCTSTR lpsz = _cstrstr(m_pchData + nStart, lpszSub); - - // return -1 for not found, distance from beginning otherwise - return (lpsz == NULL) ? -1 : (int)(lpsz - m_pchData); - } - - // Concatentation for non strings - CString& Append(int n) - { - const int cchBuff = 12; - TCHAR szBuffer[cchBuff] = { 0 }; - SecureHelper::wsprintf_x(szBuffer, cchBuff, _T("%d"), n); - ConcatInPlace(SafeStrlen(szBuffer), szBuffer); - return *this; - } - - // simple formatting - // formatting (using wsprintf style formatting) - BOOL __cdecl Format(LPCTSTR lpszFormat, ...) - { - ATLASSERT(_IsValidString(lpszFormat)); - - va_list argList; - va_start(argList, lpszFormat); - BOOL bRet = FormatV(lpszFormat, argList); - va_end(argList); - return bRet; - } - - BOOL __cdecl Format(UINT nFormatID, ...) - { - CString strFormat; - BOOL bRet = strFormat.LoadString(nFormatID); - ATLASSERT(bRet != 0); - - va_list argList; - va_start(argList, nFormatID); - bRet = FormatV(strFormat, argList); - va_end(argList); - return bRet; - } - - BOOL FormatV(LPCTSTR lpszFormat, va_list argList) - { - ATLASSERT(_IsValidString(lpszFormat)); - - enum _FormatModifiers - { - FORCE_ANSI = 0x10000, - FORCE_UNICODE = 0x20000, - FORCE_INT64 = 0x40000 - }; - - va_list argListSave = argList; - - // make a guess at the maximum length of the resulting string - int nMaxLen = 0; - for (LPCTSTR lpsz = lpszFormat; *lpsz != _T('\0'); lpsz = ::CharNext(lpsz)) - { - // handle '%' character, but watch out for '%%' - if (*lpsz != _T('%') || *(lpsz = ::CharNext(lpsz)) == _T('%')) - { - nMaxLen += (int)(::CharNext(lpsz) - lpsz); - continue; - } - - int nItemLen = 0; - - // handle '%' character with format - int nWidth = 0; - for (; *lpsz != _T('\0'); lpsz = ::CharNext(lpsz)) - { - // check for valid flags - if (*lpsz == _T('#')) - nMaxLen += 2; // for '0x' - else if (*lpsz == _T('*')) - nWidth = va_arg(argList, int); - else if (*lpsz == _T('-') || *lpsz == _T('+') || *lpsz == _T('0') || *lpsz == _T(' ')) - ; - else // hit non-flag character - break; - } - // get width and skip it - if (nWidth == 0) - { - // width indicated by - nWidth = _cstrtoi(lpsz); - for (; *lpsz != _T('\0') && _cstrisdigit(*lpsz); lpsz = ::CharNext(lpsz)) - ; - } - ATLASSERT(nWidth >= 0); - - int nPrecision = 0; - if (*lpsz == _T('.')) - { - // skip past '.' separator (width.precision) - lpsz = ::CharNext(lpsz); - - // get precision and skip it - if (*lpsz == _T('*')) - { - nPrecision = va_arg(argList, int); - lpsz = ::CharNext(lpsz); - } - else - { - nPrecision = _cstrtoi(lpsz); - for (; *lpsz != _T('\0') && _cstrisdigit(*lpsz); lpsz = ::CharNext(lpsz)) - ; - } - ATLASSERT(nPrecision >= 0); - } - - // should be on type modifier or specifier - int nModifier = 0; - if(lpsz[0] == _T('I') && lpsz[1] == _T('6') && lpsz[2] == _T('4')) - { - lpsz += 3; - nModifier = FORCE_INT64; - } - else - { - switch (*lpsz) - { - // modifiers that affect size - case _T('h'): - nModifier = FORCE_ANSI; - lpsz = ::CharNext(lpsz); - break; - case _T('l'): - nModifier = FORCE_UNICODE; - lpsz = ::CharNext(lpsz); - break; - - // modifiers that do not affect size - case _T('F'): - case _T('N'): - case _T('L'): - lpsz = ::CharNext(lpsz); - break; - } - } - - // now should be on specifier - switch (*lpsz | nModifier) - { - // single characters - case _T('c'): - case _T('C'): - nItemLen = 2; - va_arg(argList, TCHAR); - break; - case _T('c') | FORCE_ANSI: - case _T('C') | FORCE_ANSI: - nItemLen = 2; - va_arg(argList, char); - break; - case _T('c') | FORCE_UNICODE: - case _T('C') | FORCE_UNICODE: - nItemLen = 2; - va_arg(argList, WCHAR); - break; - - // strings - case _T('s'): - { - LPCTSTR pstrNextArg = va_arg(argList, LPCTSTR); - if (pstrNextArg == NULL) - { - nItemLen = 6; // "(null)" - } - else - { - nItemLen = lstrlen(pstrNextArg); - nItemLen = max(1, nItemLen); - } - break; - } - - case _T('S'): - { -#ifndef _UNICODE - LPWSTR pstrNextArg = va_arg(argList, LPWSTR); - if (pstrNextArg == NULL) - { - nItemLen = 6; // "(null)" - } - else - { - nItemLen = (int)wcslen(pstrNextArg); - nItemLen = max(1, nItemLen); - } -#else // _UNICODE - LPCSTR pstrNextArg = va_arg(argList, LPCSTR); - if (pstrNextArg == NULL) - { - nItemLen = 6; // "(null)" - } - else - { -#if defined(_WIN32_WCE) && (_ATL_VER >= 0x0800) - nItemLen = ATL::lstrlenA(pstrNextArg); -#else - nItemLen = lstrlenA(pstrNextArg); -#endif - nItemLen = max(1, nItemLen); - } -#endif // _UNICODE - break; - } - - case _T('s') | FORCE_ANSI: - case _T('S') | FORCE_ANSI: - { - LPCSTR pstrNextArg = va_arg(argList, LPCSTR); - if (pstrNextArg == NULL) - { - nItemLen = 6; // "(null)" - } - else - { -#if defined(_WIN32_WCE) && (_ATL_VER >= 0x0800) - nItemLen = ATL::lstrlenA(pstrNextArg); -#else - nItemLen = lstrlenA(pstrNextArg); -#endif - nItemLen = max(1, nItemLen); - } - break; - } - - case _T('s') | FORCE_UNICODE: - case _T('S') | FORCE_UNICODE: - { - LPWSTR pstrNextArg = va_arg(argList, LPWSTR); - if (pstrNextArg == NULL) - { - nItemLen = 6; // "(null)" - } - else - { - nItemLen = (int)wcslen(pstrNextArg); - nItemLen = max(1, nItemLen); - } - break; - } - } - - // adjust nItemLen for strings - if (nItemLen != 0) - { - nItemLen = max(nItemLen, nWidth); - if (nPrecision != 0) - nItemLen = min(nItemLen, nPrecision); - } - else - { - switch (*lpsz) - { - // integers - case _T('d'): - case _T('i'): - case _T('u'): - case _T('x'): - case _T('X'): - case _T('o'): - if (nModifier & FORCE_INT64) - va_arg(argList, __int64); - else - va_arg(argList, int); - nItemLen = 32; - nItemLen = max(nItemLen, nWidth + nPrecision); - break; - -#ifndef _ATL_USE_CSTRING_FLOAT - case _T('e'): - case _T('E'): - case _T('f'): - case _T('g'): - case _T('G'): - ATLASSERT(!"Floating point (%%e, %%E, %%f, %%g, and %%G) is not supported by the WTL::CString class."); -#ifndef _DEBUG - ::OutputDebugString(_T("Floating point (%%e, %%f, %%g, and %%G) is not supported by the WTL::CString class.")); -#ifndef _WIN32_WCE - ::DebugBreak(); -#else // CE specific - DebugBreak(); -#endif // _WIN32_WCE -#endif // !_DEBUG - break; -#else // _ATL_USE_CSTRING_FLOAT - case _T('e'): - case _T('E'): - case _T('g'): - case _T('G'): - va_arg(argList, double); - nItemLen = 128; - nItemLen = max(nItemLen, nWidth + nPrecision); - break; - case _T('f'): - { - double f = va_arg(argList, double); - // 312 == strlen("-1+(309 zeroes).") - // 309 zeroes == max precision of a double - // 6 == adjustment in case precision is not specified, - // which means that the precision defaults to 6 - int cchLen = max(nWidth, 312 + nPrecision + 6); - CTempBuffer buff; - LPTSTR pszTemp = buff.Allocate(cchLen); - if(pszTemp != NULL) - { - SecureHelper::sprintf_x(pszTemp, cchLen, _T("%*.*f"), nWidth, nPrecision + 6, f); - nItemLen = (int)_tcslen(pszTemp); - } - else - { - nItemLen = cchLen; - } - } - break; -#endif // _ATL_USE_CSTRING_FLOAT - - case _T('p'): - va_arg(argList, void*); - nItemLen = 32; - nItemLen = max(nItemLen, nWidth + nPrecision); - break; - - // no output - case _T('n'): - va_arg(argList, int*); - break; - - default: - ATLASSERT(FALSE); // unknown formatting option - } - } - - // adjust nMaxLen for output nItemLen - nMaxLen += nItemLen; - } - - if(GetBuffer(nMaxLen) == NULL) - return FALSE; -#ifndef _ATL_USE_CSTRING_FLOAT - int nRet = SecureHelper::wvsprintf_x(m_pchData, GetAllocLength() + 1, lpszFormat, argListSave); -#else // _ATL_USE_CSTRING_FLOAT - int nRet = SecureHelper::vsprintf_x(m_pchData, GetAllocLength() + 1, lpszFormat, argListSave); -#endif // _ATL_USE_CSTRING_FLOAT - nRet; // ref - ATLASSERT(nRet <= GetAllocLength()); - ReleaseBuffer(); - - va_end(argListSave); - return TRUE; - } - - // formatting for localization (uses FormatMessage API) - // formatting (using FormatMessage style formatting) - BOOL __cdecl FormatMessage(LPCTSTR lpszFormat, ...) - { - // format message into temporary buffer lpszTemp - va_list argList; - va_start(argList, lpszFormat); - LPTSTR lpszTemp; - BOOL bRet = TRUE; - - if (::FormatMessage(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ALLOCATE_BUFFER, - lpszFormat, 0, 0, (LPTSTR)&lpszTemp, 0, &argList) == 0 || lpszTemp == NULL) - bRet = FALSE; - - // assign lpszTemp into the resulting string and free the temporary - *this = lpszTemp; - LocalFree(lpszTemp); - va_end(argList); - return bRet; - } - - BOOL __cdecl FormatMessage(UINT nFormatID, ...) - { - // get format string from string table - CString strFormat; - BOOL bRetTmp = strFormat.LoadString(nFormatID); - bRetTmp; // ref - ATLASSERT(bRetTmp != 0); - - // format message into temporary buffer lpszTemp - va_list argList; - va_start(argList, nFormatID); - LPTSTR lpszTemp; - BOOL bRet = TRUE; - - if (::FormatMessage(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ALLOCATE_BUFFER, - strFormat, 0, 0, (LPTSTR)&lpszTemp, 0, &argList) == 0 || lpszTemp == NULL) - bRet = FALSE; - - // assign lpszTemp into the resulting string and free lpszTemp - *this = lpszTemp; - LocalFree(lpszTemp); - va_end(argList); - return bRet; - } - - // Windows support - BOOL LoadString(UINT nID) // load from string resource (255 chars max.) - { -#ifdef _UNICODE - const int CHAR_FUDGE = 1; // one TCHAR unused is good enough -#else - const int CHAR_FUDGE = 2; // two BYTES unused for case of DBC last char -#endif - - // try fixed buffer first (to avoid wasting space in the heap) - TCHAR szTemp[256] = { 0 }; - int nCount = sizeof(szTemp) / sizeof(szTemp[0]); - int nLen = _LoadString(nID, szTemp, nCount); - if (nCount - nLen > CHAR_FUDGE) - { - *this = szTemp; - return (nLen > 0); - } - - // try buffer size of 512, then larger size until entire string is retrieved - int nSize = 256; - do - { - nSize += 256; - LPTSTR lpstr = GetBuffer(nSize - 1); - if(lpstr == NULL) - { - nLen = 0; - break; - } - nLen = _LoadString(nID, lpstr, nSize); - } while (nSize - nLen <= CHAR_FUDGE); - ReleaseBuffer(); - - return (nLen > 0); - } - -#ifndef _UNICODE - // ANSI <-> OEM support (convert string in place) - void AnsiToOem() - { - CopyBeforeWrite(); - ::AnsiToOem(m_pchData, m_pchData); - } - - void OemToAnsi() - { - CopyBeforeWrite(); - ::OemToAnsi(m_pchData, m_pchData); - } -#endif - -#ifndef _ATL_NO_COM - // OLE BSTR support (use for OLE automation) - BSTR AllocSysString() const - { -#if defined(_UNICODE) || defined(OLE2ANSI) - BSTR bstr = ::SysAllocStringLen(m_pchData, GetData()->nDataLength); -#else - int nLen = MultiByteToWideChar(CP_ACP, 0, m_pchData, - GetData()->nDataLength, NULL, NULL); - BSTR bstr = ::SysAllocStringLen(NULL, nLen); - if(bstr != NULL) - MultiByteToWideChar(CP_ACP, 0, m_pchData, GetData()->nDataLength, bstr, nLen); -#endif - return bstr; - } - - BSTR SetSysString(BSTR* pbstr) const - { -#if defined(_UNICODE) || defined(OLE2ANSI) - ::SysReAllocStringLen(pbstr, m_pchData, GetData()->nDataLength); -#else - int nLen = MultiByteToWideChar(CP_ACP, 0, m_pchData, - GetData()->nDataLength, NULL, NULL); - if(::SysReAllocStringLen(pbstr, NULL, nLen)) - MultiByteToWideChar(CP_ACP, 0, m_pchData, GetData()->nDataLength, *pbstr, nLen); -#endif - ATLASSERT(*pbstr != NULL); - return *pbstr; - } -#endif // !_ATL_NO_COM - - // Access to string implementation buffer as "C" character array - LPTSTR GetBuffer(int nMinBufLength) - { - ATLASSERT(nMinBufLength >= 0); - - if (GetData()->nRefs > 1 || nMinBufLength > GetData()->nAllocLength) - { - // we have to grow the buffer - CStringData* pOldData = GetData(); - int nOldLen = GetData()->nDataLength; // AllocBuffer will tromp it - if (nMinBufLength < nOldLen) - nMinBufLength = nOldLen; - - if(!AllocBuffer(nMinBufLength)) - return NULL; - - SecureHelper::memcpy_x(m_pchData, (nMinBufLength + 1) * sizeof(TCHAR), pOldData->data(), (nOldLen + 1) * sizeof(TCHAR)); - GetData()->nDataLength = nOldLen; - CString::Release(pOldData); - } - ATLASSERT(GetData()->nRefs <= 1); - - // return a pointer to the character storage for this string - ATLASSERT(m_pchData != NULL); - return m_pchData; - } - - void ReleaseBuffer(int nNewLength = -1) - { - CopyBeforeWrite(); // just in case GetBuffer was not called - - if (nNewLength == -1) - nNewLength = lstrlen(m_pchData); // zero terminated - - ATLASSERT(nNewLength <= GetData()->nAllocLength); - GetData()->nDataLength = nNewLength; - m_pchData[nNewLength] = _T('\0'); - } - - LPTSTR GetBufferSetLength(int nNewLength) - { - ATLASSERT(nNewLength >= 0); - - if(GetBuffer(nNewLength) == NULL) - return NULL; - - GetData()->nDataLength = nNewLength; - m_pchData[nNewLength] = _T('\0'); - return m_pchData; - } - - void FreeExtra() - { - ATLASSERT(GetData()->nDataLength <= GetData()->nAllocLength); - if (GetData()->nDataLength != GetData()->nAllocLength) - { - CStringData* pOldData = GetData(); - if(AllocBuffer(GetData()->nDataLength)) - { - SecureHelper::memcpy_x(m_pchData, (GetData()->nAllocLength + 1) * sizeof(TCHAR), pOldData->data(), pOldData->nDataLength * sizeof(TCHAR)); - ATLASSERT(m_pchData[GetData()->nDataLength] == _T('\0')); - CString::Release(pOldData); - } - } - ATLASSERT(GetData() != NULL); - } - - // Use LockBuffer/UnlockBuffer to turn refcounting off - LPTSTR LockBuffer() - { - LPTSTR lpsz = GetBuffer(0); - if(lpsz != NULL) - GetData()->nRefs = -1; - return lpsz; - } - - void UnlockBuffer() - { - ATLASSERT(GetData()->nRefs == -1); - if (GetData() != _atltmpDataNil) - GetData()->nRefs = 1; - } - -// Implementation -public: - ~CString() // free any attached data - { - if (GetData() != _atltmpDataNil) - { - if (InterlockedDecrement(&GetData()->nRefs) <= 0) - delete[] (BYTE*)GetData(); - } - } - - int GetAllocLength() const - { - return GetData()->nAllocLength; - } - - static BOOL __stdcall _IsValidString(LPCTSTR lpsz, int /*nLength*/ = -1) - { - return (lpsz != NULL) ? TRUE : FALSE; - } - -protected: - LPTSTR m_pchData; // pointer to ref counted string data - - // implementation helpers - CStringData* GetData() const - { - ATLASSERT(m_pchData != NULL); - return ((CStringData*)m_pchData) - 1; - } - - void Init() - { - m_pchData = _GetEmptyString().m_pchData; - } - - BOOL AllocCopy(CString& dest, int nCopyLen, int nCopyIndex, int nExtraLen) const - { - // will clone the data attached to this string - // allocating 'nExtraLen' characters - // Places results in uninitialized string 'dest' - // Will copy the part or all of original data to start of new string - - BOOL bRet = FALSE; - int nNewLen = nCopyLen + nExtraLen; - if (nNewLen == 0) - { - dest.Init(); - bRet = TRUE; - } - else if(nNewLen >= nCopyLen) - { - if(dest.AllocBuffer(nNewLen)) - { - SecureHelper::memcpy_x(dest.m_pchData, (nNewLen + 1) * sizeof(TCHAR), m_pchData + nCopyIndex, nCopyLen * sizeof(TCHAR)); - bRet = TRUE; - } - } - - return bRet; - } - - // always allocate one extra character for '\0' termination - // assumes [optimistically] that data length will equal allocation length - BOOL AllocBuffer(int nLen) - { - ATLASSERT(nLen >= 0); - ATLASSERT(nLen <= INT_MAX - 1); // max size (enough room for 1 extra) - - if (nLen == 0) - { - Init(); - } - else - { - CStringData* pData = NULL; - ATLTRY(pData = (CStringData*)new BYTE[sizeof(CStringData) + (nLen + 1) * sizeof(TCHAR)]); - if(pData == NULL) - return FALSE; - - pData->nRefs = 1; - pData->data()[nLen] = _T('\0'); - pData->nDataLength = nLen; - pData->nAllocLength = nLen; - m_pchData = pData->data(); - } - - return TRUE; - } - - // Assignment operators - // All assign a new value to the string - // (a) first see if the buffer is big enough - // (b) if enough room, copy on top of old buffer, set size and type - // (c) otherwise free old string data, and create a new one - // - // All routines return the new string (but as a 'const CString&' so that - // assigning it again will cause a copy, eg: s1 = s2 = "hi there". - // - void AssignCopy(int nSrcLen, LPCTSTR lpszSrcData) - { - if(AllocBeforeWrite(nSrcLen)) - { - SecureHelper::memcpy_x(m_pchData, (nSrcLen + 1) * sizeof(TCHAR), lpszSrcData, nSrcLen * sizeof(TCHAR)); - GetData()->nDataLength = nSrcLen; - m_pchData[nSrcLen] = _T('\0'); - } - } - - // Concatenation - // NOTE: "operator +" is done as friend functions for simplicity - // There are three variants: - // CString + CString - // and for ? = TCHAR, LPCTSTR - // CString + ? - // ? + CString - BOOL ConcatCopy(int nSrc1Len, LPCTSTR lpszSrc1Data, int nSrc2Len, LPCTSTR lpszSrc2Data) - { - // -- master concatenation routine - // Concatenate two sources - // -- assume that 'this' is a new CString object - - BOOL bRet = TRUE; - int nNewLen = nSrc1Len + nSrc2Len; - if(nNewLen < nSrc1Len || nNewLen < nSrc2Len) - { - bRet = FALSE; - } - else if(nNewLen != 0) - { - bRet = AllocBuffer(nNewLen); - if (bRet) - { - SecureHelper::memcpy_x(m_pchData, (nNewLen + 1) * sizeof(TCHAR), lpszSrc1Data, nSrc1Len * sizeof(TCHAR)); - SecureHelper::memcpy_x(m_pchData + nSrc1Len, (nNewLen + 1 - nSrc1Len) * sizeof(TCHAR), lpszSrc2Data, nSrc2Len * sizeof(TCHAR)); - } - } - return bRet; - } - - void ConcatInPlace(int nSrcLen, LPCTSTR lpszSrcData) - { - // -- the main routine for += operators - - // concatenating an empty string is a no-op! - if (nSrcLen == 0) - return; - - // if the buffer is too small, or we have a width mis-match, just - // allocate a new buffer (slow but sure) - if (GetData()->nRefs > 1 || GetData()->nDataLength + nSrcLen > GetData()->nAllocLength) - { - // we have to grow the buffer, use the ConcatCopy routine - CStringData* pOldData = GetData(); - if (ConcatCopy(GetData()->nDataLength, m_pchData, nSrcLen, lpszSrcData)) - { - ATLASSERT(pOldData != NULL); - CString::Release(pOldData); - } - } - else - { - // fast concatenation when buffer big enough - SecureHelper::memcpy_x(m_pchData + GetData()->nDataLength, (GetData()->nAllocLength + 1) * sizeof(TCHAR), lpszSrcData, nSrcLen * sizeof(TCHAR)); - GetData()->nDataLength += nSrcLen; - ATLASSERT(GetData()->nDataLength <= GetData()->nAllocLength); - m_pchData[GetData()->nDataLength] = _T('\0'); - } - } - - void CopyBeforeWrite() - { - if (GetData()->nRefs > 1) - { - CStringData* pData = GetData(); - Release(); - if(AllocBuffer(pData->nDataLength)) - SecureHelper::memcpy_x(m_pchData, (GetData()->nAllocLength + 1) * sizeof(TCHAR), pData->data(), (pData->nDataLength + 1) * sizeof(TCHAR)); - } - ATLASSERT(GetData()->nRefs <= 1); - } - - BOOL AllocBeforeWrite(int nLen) - { - BOOL bRet = TRUE; - if (GetData()->nRefs > 1 || nLen > GetData()->nAllocLength) - { - Release(); - bRet = AllocBuffer(nLen); - } - ATLASSERT(GetData()->nRefs <= 1); - return bRet; - } - - void Release() - { - if (GetData() != _atltmpDataNil) - { - ATLASSERT(GetData()->nRefs != 0); - if (InterlockedDecrement(&GetData()->nRefs) <= 0) - delete[] (BYTE*)GetData(); - Init(); - } - } - - static void PASCAL Release(CStringData* pData) - { - if (pData != _atltmpDataNil) - { - ATLASSERT(pData->nRefs != 0); - if (InterlockedDecrement(&pData->nRefs) <= 0) - delete[] (BYTE*)pData; - } - } - - static int PASCAL SafeStrlen(LPCTSTR lpsz) - { - return (lpsz == NULL) ? 0 : lstrlen(lpsz); - } - - static int __stdcall _LoadString(UINT nID, LPTSTR lpszBuf, UINT nMaxBuf) - { -#ifdef _DEBUG - // LoadString without annoying warning from the Debug kernel if the - // segment containing the string is not present - if (::FindResource(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE((nID >> 4) + 1), RT_STRING) == NULL) - { - lpszBuf[0] = _T('\0'); - return 0; // not found - } -#endif // _DEBUG - - int nLen = ::LoadString(ModuleHelper::GetResourceInstance(), nID, lpszBuf, nMaxBuf); - if (nLen == 0) - lpszBuf[0] = _T('\0'); - - return nLen; - } - - static const CString& __stdcall _GetEmptyString() - { - return *(CString*)&_atltmpPchNil; - } - -// CString conversion helpers - static int __cdecl _wcstombsz(char* mbstr, const wchar_t* wcstr, size_t count) - { - if (count == 0 && mbstr != NULL) - return 0; - - int result = ::WideCharToMultiByte(CP_ACP, 0, wcstr, -1, mbstr, (int)count, NULL, NULL); - ATLASSERT(mbstr == NULL || result <= (int)count); - if (result > 0) - mbstr[result - 1] = 0; - return result; - } - - static int __cdecl _mbstowcsz(wchar_t* wcstr, const char* mbstr, size_t count) - { - if (count == 0 && wcstr != NULL) - return 0; - - int result = ::MultiByteToWideChar(CP_ACP, 0, mbstr, -1, wcstr, (int)count); - ATLASSERT(wcstr == NULL || result <= (int)count); - if (result > 0) - wcstr[result - 1] = 0; - return result; - } - -// Helpers to avoid CRT startup code -#ifdef _ATL_MIN_CRT - static const TCHAR* _cstrchr(const TCHAR* p, TCHAR ch) - { - // strchr for '\0' should succeed - while (*p != 0) - { - if (*p == ch) - break; - p = ::CharNext(p); - } - return (*p == ch) ? p : NULL; - } - - static TCHAR* _cstrrev(TCHAR* pStr) - { - // optimize NULL, zero-length, and single-char case - if ((pStr == NULL) || (pStr[0] == _T('\0')) || (pStr[1] == _T('\0'))) - return pStr; - - TCHAR* p = pStr; - - while (*p != 0) - { - TCHAR* pNext = ::CharNext(p); - if(pNext > p + 1) - { - char p1 = *(char*)p; - *(char*)p = *(char*)(p + 1); - *(char*)(p + 1) = p1; - } - p = pNext; - } - - p--; - TCHAR* q = pStr; - - while (q < p) - { - TCHAR t = *q; - *q = *p; - *p = t; - q++; - p--; - } - return pStr; - } - - static const TCHAR* _cstrstr(const TCHAR* pStr, const TCHAR* pCharSet) - { - int nLen = lstrlen(pCharSet); - if (nLen == 0) - return (TCHAR*)pStr; - - const TCHAR* pRet = NULL; - const TCHAR* pCur = pStr; - while((pCur = _cstrchr(pCur, *pCharSet)) != NULL) - { - if(memcmp(pCur, pCharSet, nLen * sizeof(TCHAR)) == 0) - { - pRet = pCur; - break; - } - pCur = ::CharNext(pCur); - } - return pRet; - } - - static int _cstrspn(const TCHAR* pStr, const TCHAR* pCharSet) - { - int nRet = 0; - const TCHAR* p = pStr; - while (*p != 0) - { - const TCHAR* pNext = ::CharNext(p); - if(pNext > p + 1) - { - if(_cstrchr_db(pCharSet, *p, *(p + 1)) == NULL) - break; - nRet += 2; - } - else - { - if(_cstrchr(pCharSet, *p) == NULL) - break; - nRet++; - } - p = pNext; - } - return nRet; - } - - static int _cstrcspn(const TCHAR* pStr, const TCHAR* pCharSet) - { - int nRet = 0; - TCHAR* p = (TCHAR*)pStr; - while (*p != 0) - { - TCHAR* pNext = ::CharNext(p); - if(pNext > p + 1) - { - if(_cstrchr_db(pCharSet, *p, *(p + 1)) != NULL) - break; - nRet += 2; - } - else - { - if(_cstrchr(pCharSet, *p) != NULL) - break; - nRet++; - } - p = pNext; - } - return nRet; - } - - static const TCHAR* _cstrpbrk(const TCHAR* p, const TCHAR* lpszCharSet) - { - int n = _cstrcspn(p, lpszCharSet); - return (p[n] != 0) ? &p[n] : NULL; - } - - static int _cstrcmp(const TCHAR* pstrOne, const TCHAR* pstrOther) - { - return lstrcmp(pstrOne, pstrOther); - } - - static int _cstrcmpi(const TCHAR* pstrOne, const TCHAR* pstrOther) - { - return lstrcmpi(pstrOne, pstrOther); - } - - static int _cstrcoll(const TCHAR* pstrOne, const TCHAR* pstrOther) - { - int nRet = CompareString(GetThreadLocale(), 0, pstrOne, -1, pstrOther, -1); - ATLASSERT(nRet != 0); - return nRet - 2; // convert to strcmp convention - } - - static int _cstrcolli(const TCHAR* pstrOne, const TCHAR* pstrOther) - { - int nRet = CompareString(GetThreadLocale(), NORM_IGNORECASE, pstrOne, -1, pstrOther, -1); - ATLASSERT(nRet != 0); - return nRet - 2; // convert to strcmp convention - } -#else // !_ATL_MIN_CRT - static const TCHAR* _cstrchr(const TCHAR* p, TCHAR ch) - { - return _tcschr(p, ch); - } - - static TCHAR* _cstrrev(TCHAR* pStr) - { - return _tcsrev(pStr); - } - - static const TCHAR* _cstrstr(const TCHAR* pStr, const TCHAR* pCharSet) - { - return _tcsstr(pStr, pCharSet); - } - - static int _cstrspn(const TCHAR* pStr, const TCHAR* pCharSet) - { - return (int)_tcsspn(pStr, pCharSet); - } - - static int _cstrcspn(const TCHAR* pStr, const TCHAR* pCharSet) - { - return (int)_tcscspn(pStr, pCharSet); - } - - static const TCHAR* _cstrpbrk(const TCHAR* p, const TCHAR* lpszCharSet) - { - return _tcspbrk(p, lpszCharSet); - } - - static int _cstrcmp(const TCHAR* pstrOne, const TCHAR* pstrOther) - { - return _tcscmp(pstrOne, pstrOther); - } - - static int _cstrcmpi(const TCHAR* pstrOne, const TCHAR* pstrOther) - { - return _tcsicmp(pstrOne, pstrOther); - } - -#ifndef _WIN32_WCE - static int _cstrcoll(const TCHAR* pstrOne, const TCHAR* pstrOther) - { - return _tcscoll(pstrOne, pstrOther); - } - - static int _cstrcolli(const TCHAR* pstrOne, const TCHAR* pstrOther) - { - return _tcsicoll(pstrOne, pstrOther); - } -#endif // !_WIN32_WCE -#endif // !_ATL_MIN_CRT - - static const TCHAR* _cstrrchr(const TCHAR* p, TCHAR ch) - { - return MinCrtHelper::_strrchr(p, ch); - } - - static int _cstrisdigit(TCHAR ch) - { - return MinCrtHelper::_isdigit(ch); - } - - static int _cstrisspace(TCHAR ch) - { - return MinCrtHelper::_isspace(ch); - } - - static int _cstrtoi(const TCHAR* nptr) - { - return MinCrtHelper::_atoi(nptr); - } - - static const TCHAR* _cstrchr_db(const TCHAR* p, TCHAR ch1, TCHAR ch2) - { - const TCHAR* lpsz = NULL; - while (*p != 0) - { - if (*p == ch1 && *(p + 1) == ch2) - { - lpsz = p; - break; - } - p = ::CharNext(p); - } - return lpsz; - } -}; - - -// Compare helpers - -inline bool __stdcall operator ==(const CString& s1, const CString& s2) -{ return s1.Compare(s2) == 0; } - -inline bool __stdcall operator ==(const CString& s1, LPCTSTR s2) -{ return s1.Compare(s2) == 0; } - -inline bool __stdcall operator ==(LPCTSTR s1, const CString& s2) -{ return s2.Compare(s1) == 0; } - -inline bool __stdcall operator !=(const CString& s1, const CString& s2) -{ return s1.Compare(s2) != 0; } - -inline bool __stdcall operator !=(const CString& s1, LPCTSTR s2) -{ return s1.Compare(s2) != 0; } - -inline bool __stdcall operator !=(LPCTSTR s1, const CString& s2) -{ return s2.Compare(s1) != 0; } - -inline bool __stdcall operator <(const CString& s1, const CString& s2) -{ return s1.Compare(s2) < 0; } - -inline bool __stdcall operator <(const CString& s1, LPCTSTR s2) -{ return s1.Compare(s2) < 0; } - -inline bool __stdcall operator <(LPCTSTR s1, const CString& s2) -{ return s2.Compare(s1) > 0; } - -inline bool __stdcall operator >(const CString& s1, const CString& s2) -{ return s1.Compare(s2) > 0; } - -inline bool __stdcall operator >(const CString& s1, LPCTSTR s2) -{ return s1.Compare(s2) > 0; } - -inline bool __stdcall operator >(LPCTSTR s1, const CString& s2) -{ return s2.Compare(s1) < 0; } - -inline bool __stdcall operator <=(const CString& s1, const CString& s2) -{ return s1.Compare(s2) <= 0; } - -inline bool __stdcall operator <=(const CString& s1, LPCTSTR s2) -{ return s1.Compare(s2) <= 0; } - -inline bool __stdcall operator <=(LPCTSTR s1, const CString& s2) -{ return s2.Compare(s1) >= 0; } - -inline bool __stdcall operator >=(const CString& s1, const CString& s2) -{ return s1.Compare(s2) >= 0; } - -inline bool __stdcall operator >=(const CString& s1, LPCTSTR s2) -{ return s1.Compare(s2) >= 0; } - -inline bool __stdcall operator >=(LPCTSTR s1, const CString& s2) -{ return s2.Compare(s1) <= 0; } +/////////////////////////////////////////////////////////////////////////////// +// Classes in this file: +// +// CRecentDocumentListBase +// CRecentDocumentList +// CFindFile +// +// Global functions: +// AtlGetStockPen() +// AtlGetStockBrush() +// AtlGetStockFont() +// AtlGetStockPalette() +// +// AtlCompactPath() -// CString "operator +" functions -inline CString __stdcall operator +(const CString& string1, const CString& string2) +namespace WTL { - CString s; - s.ConcatCopy(string1.GetData()->nDataLength, string1.m_pchData, string2.GetData()->nDataLength, string2.m_pchData); - return s; -} -inline CString __stdcall operator +(const CString& string, TCHAR ch) -{ - CString s; - s.ConcatCopy(string.GetData()->nDataLength, string.m_pchData, 1, &ch); - return s; -} +/////////////////////////////////////////////////////////////////////////////// +// CSize scalar operators -inline CString __stdcall operator +(TCHAR ch, const CString& string) -{ - CString s; - s.ConcatCopy(1, &ch, string.GetData()->nDataLength, string.m_pchData); - return s; -} +#if !defined(_WTL_NO_SIZE_SCALAR) && defined(__ATLTYPES_H__) -#ifdef _UNICODE -inline CString __stdcall operator +(const CString& string, char ch) +template +inline CSize operator *(SIZE s, Num n) { - return string + (TCHAR)ch; -} + return CSize((int)(s.cx * n), (int)(s.cy * n)); +}; -inline CString __stdcall operator +(char ch, const CString& string) +template +inline void operator *=(SIZE & s, Num n) { - return (TCHAR)ch + string; -} -#endif // _UNICODE + s = s * n; +}; -inline CString __stdcall operator +(const CString& string, LPCTSTR lpsz) +template +inline CSize operator /(SIZE s, Num n) { - ATLASSERT(lpsz == NULL || CString::_IsValidString(lpsz)); - CString s; - s.ConcatCopy(string.GetData()->nDataLength, string.m_pchData, CString::SafeStrlen(lpsz), lpsz); - return s; -} + return CSize((int)(s.cx / n), (int)(s.cy / n)); +}; -inline CString __stdcall operator +(LPCTSTR lpsz, const CString& string) +template +inline void operator /=(SIZE & s, Num n) { - ATLASSERT(lpsz == NULL || CString::_IsValidString(lpsz)); - CString s; - s.ConcatCopy(CString::SafeStrlen(lpsz), lpsz, string.GetData()->nDataLength, string.m_pchData); - return s; -} + s = s / n; +}; -#endif // !_WTL_NO_CSTRING +#endif // !defined(_WTL_NO_SIZE_SCALAR) && defined(__ATLTYPES_H__) /////////////////////////////////////////////////////////////////////////////// // CRecentDocumentList - MRU List Support -#ifndef _WIN32_WCE - #ifndef _WTL_MRUEMPTY_TEXT #define _WTL_MRUEMPTY_TEXT _T("(empty)") #endif @@ -2852,13 +128,13 @@ class CRecentDocumentListBase void SetMenuHandle(HMENU hMenu) { - ATLASSERT(hMenu == NULL || ::IsMenu(hMenu)); + ATLASSERT((hMenu == NULL) || ::IsMenu(hMenu)); m_hMenu = hMenu; - if(m_hMenu == NULL || (::GetMenuString(m_hMenu, t_nFirstID, m_szNoEntries, t_cchItemLen, MF_BYCOMMAND) == 0)) + if((m_hMenu == NULL) || (::GetMenuString(m_hMenu, t_nFirstID, m_szNoEntries, t_cchItemLen, MF_BYCOMMAND) == 0)) { T* pT = static_cast(this); pT; // avoid level 4 warning - SecureHelper::strncpy_x(m_szNoEntries, _countof(m_szNoEntries), pT->GetMRUEmptyText(), _TRUNCATE); + ATL::Checked::tcsncpy_s(m_szNoEntries, _countof(m_szNoEntries), pT->GetMRUEmptyText(), _TRUNCATE); } } @@ -2869,7 +145,7 @@ class CRecentDocumentListBase void SetMaxEntries(int nMaxEntries) { - ATLASSERT(nMaxEntries >= m_nMaxEntries_Min && nMaxEntries <= m_nMaxEntries_Max); + ATLASSERT((nMaxEntries >= m_nMaxEntries_Min) && (nMaxEntries <= m_nMaxEntries_Max)); if(nMaxEntries < m_nMaxEntries_Min) nMaxEntries = m_nMaxEntries_Min; else if(nMaxEntries > m_nMaxEntries_Max) @@ -2884,7 +160,7 @@ class CRecentDocumentListBase void SetMaxItemLength(int cchMaxLen) { - ATLASSERT((cchMaxLen >= m_cchMaxItemLen_Min && cchMaxLen <= m_cchMaxItemLen_Max) || cchMaxLen == -1); + ATLASSERT(((cchMaxLen >= m_cchMaxItemLen_Min) && (cchMaxLen <= m_cchMaxItemLen_Max)) || (cchMaxLen == -1)); if(cchMaxLen != -1) { if(cchMaxLen < m_cchMaxItemLen_Min) @@ -2901,8 +177,8 @@ class CRecentDocumentListBase BOOL AddToList(LPCTSTR lpstrDocName) { _DocEntry de; - errno_t nRet = SecureHelper::strncpy_x(de.szDocName, _countof(de.szDocName), lpstrDocName, _TRUNCATE); - if(nRet != 0 && nRet != STRUNCATE) + errno_t nRet = ATL::Checked::tcsncpy_s(de.szDocName, _countof(de.szDocName), lpstrDocName, _TRUNCATE); + if((nRet != 0) && (nRet != STRUNCATE)) return FALSE; for(int i = 0; i < m_arrDocs.GetSize(); i++) @@ -2928,9 +204,7 @@ class CRecentDocumentListBase // This function is deprecated because it is not safe. // Use the version below that accepts the buffer length. -#if (_MSC_VER >= 1300) __declspec(deprecated) -#endif BOOL GetFromList(int /*nItemID*/, LPTSTR /*lpstrDocName*/) { ATLASSERT(FALSE); @@ -2940,25 +214,25 @@ class CRecentDocumentListBase BOOL GetFromList(int nItemID, LPTSTR lpstrDocName, int cchLength) { int nIndex = m_arrDocs.GetSize() - (nItemID - t_nFirstID) - 1; - if(nIndex < 0 || nIndex >= m_arrDocs.GetSize()) + if((nIndex < 0) || (nIndex >= m_arrDocs.GetSize())) return FALSE; if(lstrlen(m_arrDocs[nIndex].szDocName) >= cchLength) return FALSE; - SecureHelper::strcpy_x(lpstrDocName, cchLength, m_arrDocs[nIndex].szDocName); + ATL::Checked::tcscpy_s(lpstrDocName, cchLength, m_arrDocs[nIndex].szDocName); return TRUE; } -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - BOOL GetFromList(int nItemID, _CSTRING_NS::CString& strDocName) +#ifdef __ATLSTR_H__ + BOOL GetFromList(int nItemID, ATL::CString& strDocName) { int nIndex = m_arrDocs.GetSize() - (nItemID - t_nFirstID) - 1; - if(nIndex < 0 || nIndex >= m_arrDocs.GetSize()) + if((nIndex < 0) || (nIndex >= m_arrDocs.GetSize())) return FALSE; strDocName = m_arrDocs[nIndex].szDocName; return TRUE; } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) +#endif // __ATLSTR_H__ BOOL RemoveFromList(int nItemID) { @@ -2975,7 +249,7 @@ class CRecentDocumentListBase BOOL MoveToTop(int nItemID) { int nIndex = m_arrDocs.GetSize() - (nItemID - t_nFirstID) - 1; - if(nIndex < 0 || nIndex >= m_arrDocs.GetSize()) + if((nIndex < 0) || (nIndex >= m_arrDocs.GetSize())) return FALSE; _DocEntry de; de = m_arrDocs[nIndex]; @@ -2992,8 +266,8 @@ class CRecentDocumentListBase BOOL ReadFromRegistry(LPCTSTR lpstrRegKey) { T* pT = static_cast(this); - CRegKeyEx rkParent; - CRegKeyEx rk; + ATL::CRegKey rkParent; + ATL::CRegKey rk; LONG lRet = rkParent.Open(HKEY_CURRENT_USER, lpstrRegKey); if(lRet != ERROR_SUCCESS) @@ -3016,12 +290,12 @@ class CRecentDocumentListBase for(int nItem = m_nMaxEntries; nItem > 0; nItem--) { TCHAR szBuff[m_cchItemNameLen] = { 0 }; - SecureHelper::wsprintf_x(szBuff, m_cchItemNameLen, pT->GetRegItemName(), nItem); + _stprintf_s(szBuff, m_cchItemNameLen, pT->GetRegItemName(), nItem); ULONG ulCount = t_cchItemLen; lRet = rk.QueryStringValue(szBuff, szRetString, &ulCount); if(lRet == ERROR_SUCCESS) { - SecureHelper::strcpy_x(de.szDocName, _countof(de.szDocName), szRetString); + ATL::Checked::tcscpy_s(de.szDocName, _countof(de.szDocName), szRetString); m_arrDocs.Add(de); } } @@ -3036,8 +310,8 @@ class CRecentDocumentListBase { T* pT = static_cast(this); pT; // avoid level 4 warning - CRegKeyEx rkParent; - CRegKeyEx rk; + ATL::CRegKey rkParent; + ATL::CRegKey rk; LONG lRet = rkParent.Create(HKEY_CURRENT_USER, lpstrRegKey); if(lRet != ERROR_SUCCESS) @@ -3054,7 +328,7 @@ class CRecentDocumentListBase for(nItem = m_arrDocs.GetSize(); nItem > 0; nItem--) { TCHAR szBuff[m_cchItemNameLen] = { 0 }; - SecureHelper::wsprintf_x(szBuff, m_cchItemNameLen, pT->GetRegItemName(), nItem); + _stprintf_s(szBuff, m_cchItemNameLen, pT->GetRegItemName(), nItem); TCHAR szDocName[t_cchItemLen] = { 0 }; GetFromList(t_nFirstID + nItem - 1, szDocName, t_cchItemLen); lRet = rk.SetStringValue(szBuff, szDocName); @@ -3062,10 +336,10 @@ class CRecentDocumentListBase } // delete unused keys - for(nItem = m_arrDocs.GetSize() + 1; nItem < m_nMaxEntries_Max; nItem++) + for(nItem = m_arrDocs.GetSize() + 1; nItem <= m_nMaxEntries_Max; nItem++) { TCHAR szBuff[m_cchItemNameLen] = { 0 }; - SecureHelper::wsprintf_x(szBuff, m_cchItemNameLen, pT->GetRegItemName(), nItem); + _stprintf_s(szBuff, m_cchItemNameLen, pT->GetRegItemName(), nItem); rk.DeleteValue(szBuff); } @@ -3083,35 +357,38 @@ class CRecentDocumentListBase ATLASSERT(::IsMenu(m_hMenu)); int nItems = ::GetMenuItemCount(m_hMenu); - int nInsertPoint; - for(nInsertPoint = 0; nInsertPoint < nItems; nInsertPoint++) + int nInsertPoint = 0; + for(int i = 0; i < nItems; i++) { CMenuItemInfo mi; mi.fMask = MIIM_ID; - ::GetMenuItemInfo(m_hMenu, nInsertPoint, TRUE, &mi); + ::GetMenuItemInfo(m_hMenu, i, TRUE, &mi); if (mi.wID == t_nFirstID) + { + nInsertPoint = i; break; + } } - ATLASSERT(nInsertPoint < nItems && "You need a menu item with an ID = t_nFirstID"); - int nItem; - for(nItem = t_nFirstID; nItem < t_nFirstID + m_nMaxEntries; nItem++) + ATLASSERT((nInsertPoint < nItems) && "You need a menu item with an ID = t_nFirstID"); + + for(int j = t_nFirstID; j < (t_nFirstID + m_nMaxEntries); j++) { // keep the first one as an insertion point - if (nItem != t_nFirstID) - ::DeleteMenu(m_hMenu, nItem, MF_BYCOMMAND); + if (j != t_nFirstID) + ::DeleteMenu(m_hMenu, j, MF_BYCOMMAND); } TCHAR szItemText[t_cchItemLen + 6] = { 0 }; // add space for &, 2 digits, and a space int nSize = m_arrDocs.GetSize(); - nItem = 0; + int nItem = 0; if(nSize > 0) { for(nItem = 0; nItem < nSize; nItem++) { if(m_cchMaxItemLen == -1) { - SecureHelper::wsprintf_x(szItemText, t_cchItemLen + 6, _T("&%i %s"), nItem + 1, m_arrDocs[nSize - 1 - nItem].szDocName); + _stprintf_s(szItemText, t_cchItemLen + 6, _T("&%i %s"), nItem + 1, m_arrDocs[nSize - 1 - nItem].szDocName); } else { @@ -3121,8 +398,9 @@ class CRecentDocumentListBase bool bRet = pT->CompactDocumentName(szBuff, m_arrDocs[nSize - 1 - nItem].szDocName, m_cchMaxItemLen); bRet; // avoid level 4 warning ATLASSERT(bRet); - SecureHelper::wsprintf_x(szItemText, t_cchItemLen + 6, _T("&%i %s"), nItem + 1, szBuff); + _stprintf_s(szItemText, t_cchItemLen + 6, _T("&%i %s"), nItem + 1, szBuff); } + ::InsertMenu(m_hMenu, nInsertPoint + nItem, MF_BYPOSITION | MF_STRING, t_nFirstID + nItem, szItemText); } } @@ -3174,8 +452,6 @@ class CRecentDocumentList : public CRecentDocumentListBase // nothing here }; -#endif // _WIN32_WCE - /////////////////////////////////////////////////////////////////////////////// // CFindFile - file search helper class @@ -3226,7 +502,7 @@ class CFindFile return FALSE; if(m_bFound) - SecureHelper::strcpy_x(lpstrFileName, cchLength, m_fd.cFileName); + ATL::Checked::tcscpy_s(lpstrFileName, cchLength, m_fd.cFileName); return m_bFound; } @@ -3236,34 +512,28 @@ class CFindFile ATLASSERT(m_hFind != NULL); int nLen = lstrlen(m_lpszRoot); -#ifndef _WIN32_WCE ATLASSERT(nLen > 0); if(nLen == 0) return FALSE; - bool bAddSep = (m_lpszRoot[nLen - 1] != _T('\\') && m_lpszRoot[nLen - 1] !=_T('/')); -#else // CE specific - // allow diskless devices (nLen == 0) - bool bAddSep = ((nLen == 0) || (m_lpszRoot[nLen - 1] != _T('\\') && m_lpszRoot[nLen - 1] !=_T('/'))); -#endif // _WIN32_WCE + bool bAddSep = ((m_lpszRoot[nLen - 1] != _T('\\')) && (m_lpszRoot[nLen - 1] !=_T('/'))); if((lstrlen(m_lpszRoot) + (bAddSep ? 1 : 0)) >= cchLength) return FALSE; - SecureHelper::strcpy_x(lpstrFilePath, cchLength, m_lpszRoot); + ATL::Checked::tcscpy_s(lpstrFilePath, cchLength, m_lpszRoot); if(bAddSep) { TCHAR szSeparator[2] = { m_chDirSeparator, 0 }; - SecureHelper::strcat_x(lpstrFilePath, cchLength, szSeparator); + ATL::Checked::tcscat_s(lpstrFilePath, cchLength, szSeparator); } - SecureHelper::strcat_x(lpstrFilePath, cchLength, m_fd.cFileName); + ATL::Checked::tcscat_s(lpstrFilePath, cchLength, m_fd.cFileName); return TRUE; } -#ifndef _WIN32_WCE BOOL GetFileTitle(LPTSTR lpstrFileTitle, int cchLength) const { ATLASSERT(m_hFind != NULL); @@ -3272,19 +542,18 @@ class CFindFile if(!GetFileName(szBuff, MAX_PATH)) return FALSE; - if(lstrlen(szBuff) >= cchLength || cchLength < 1) + if((lstrlen(szBuff) >= cchLength) || (cchLength < 1)) return FALSE; // find the last dot - LPTSTR pstrDot = MinCrtHelper::_strrchr(szBuff, _T('.')); + LPTSTR pstrDot = _tcsrchr(szBuff, _T('.')); if(pstrDot != NULL) *pstrDot = 0; - SecureHelper::strcpy_x(lpstrFileTitle, cchLength, szBuff); + ATL::Checked::tcscpy_s(lpstrFileTitle, cchLength, szBuff); return TRUE; } -#endif // !_WIN32_WCE BOOL GetFileURL(LPTSTR lpstrFileURL, int cchLength) const { @@ -3296,8 +565,8 @@ class CFindFile LPCTSTR lpstrFileURLPrefix = _T("file://"); if(lstrlen(szBuff) + lstrlen(lpstrFileURLPrefix) >= cchLength) return FALSE; - SecureHelper::strcpy_x(lpstrFileURL, cchLength, lpstrFileURLPrefix); - SecureHelper::strcat_x(lpstrFileURL, cchLength, szBuff); + ATL::Checked::tcscpy_s(lpstrFileURL, cchLength, lpstrFileURLPrefix); + ATL::Checked::tcscat_s(lpstrFileURL, cchLength, szBuff); return TRUE; } @@ -3308,81 +577,74 @@ class CFindFile if(lstrlen(m_lpszRoot) >= cchLength) return FALSE; - SecureHelper::strcpy_x(lpstrRoot, cchLength, m_lpszRoot); + ATL::Checked::tcscpy_s(lpstrRoot, cchLength, m_lpszRoot); return TRUE; } -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - _CSTRING_NS::CString GetFileName() const +#ifdef __ATLSTR_H__ + ATL::CString GetFileName() const { ATLASSERT(m_hFind != NULL); - _CSTRING_NS::CString ret; + ATL::CString ret; if(m_bFound) ret = m_fd.cFileName; return ret; } - _CSTRING_NS::CString GetFilePath() const + ATL::CString GetFilePath() const { ATLASSERT(m_hFind != NULL); - _CSTRING_NS::CString strResult = m_lpszRoot; + ATL::CString strResult = m_lpszRoot; int nLen = strResult.GetLength(); -#ifndef _WIN32_WCE ATLASSERT(nLen > 0); if(nLen == 0) return strResult; if((strResult[nLen - 1] != _T('\\')) && (strResult[nLen - 1] != _T('/'))) -#else // CE specific - // allow diskless devices (nLen == 0) - if((nLen == 0) || ((strResult[nLen - 1] != _T('\\')) && (strResult[nLen - 1] != _T('/')))) -#endif // _WIN32_WCE strResult += m_chDirSeparator; strResult += GetFileName(); return strResult; } -#ifndef _WIN32_WCE - _CSTRING_NS::CString GetFileTitle() const + ATL::CString GetFileTitle() const { ATLASSERT(m_hFind != NULL); - _CSTRING_NS::CString strResult; + ATL::CString strResult; GetFileTitle(strResult.GetBuffer(MAX_PATH), MAX_PATH); strResult.ReleaseBuffer(); return strResult; } -#endif // !_WIN32_WCE - _CSTRING_NS::CString GetFileURL() const + ATL::CString GetFileURL() const { ATLASSERT(m_hFind != NULL); - _CSTRING_NS::CString strResult("file://"); + ATL::CString strResult("file://"); strResult += GetFilePath(); return strResult; } - _CSTRING_NS::CString GetRoot() const + ATL::CString GetRoot() const { ATLASSERT(m_hFind != NULL); - _CSTRING_NS::CString str = m_lpszRoot; + ATL::CString str = m_lpszRoot; return str; } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) +#endif // __ATLSTR_H__ BOOL GetLastWriteTime(FILETIME* pTimeStamp) const { ATLASSERT(m_hFind != NULL); ATLASSERT(pTimeStamp != NULL); - if(m_bFound && pTimeStamp != NULL) + if(m_bFound && (pTimeStamp != NULL)) { *pTimeStamp = m_fd.ftLastWriteTime; return TRUE; @@ -3396,7 +658,7 @@ class CFindFile ATLASSERT(m_hFind != NULL); ATLASSERT(pTimeStamp != NULL); - if(m_bFound && pTimeStamp != NULL) + if(m_bFound && (pTimeStamp != NULL)) { *pTimeStamp = m_fd.ftLastAccessTime; return TRUE; @@ -3409,7 +671,7 @@ class CFindFile { ATLASSERT(m_hFind != NULL); - if(m_bFound && pTimeStamp != NULL) + if(m_bFound && (pTimeStamp != NULL)) { *pTimeStamp = m_fd.ftCreationTime; return TRUE; @@ -3438,7 +700,7 @@ class CFindFile BOOL bResult = FALSE; if(m_bFound && IsDirectory()) { - if(m_fd.cFileName[0] == _T('.') && (m_fd.cFileName[1] == _T('\0') || (m_fd.cFileName[1] == _T('.') && m_fd.cFileName[2] == _T('\0')))) + if((m_fd.cFileName[0] == _T('.')) && ((m_fd.cFileName[1] == _T('\0')) || ((m_fd.cFileName[1] == _T('.')) && (m_fd.cFileName[2] == _T('\0'))))) bResult = TRUE; } @@ -3500,19 +762,14 @@ class CFindFile return FALSE; } - SecureHelper::strcpy_x(m_fd.cFileName, _countof(m_fd.cFileName), pstrName); + ATL::Checked::tcscpy_s(m_fd.cFileName, _countof(m_fd.cFileName), pstrName); m_hFind = ::FindFirstFile(pstrName, &m_fd); if(m_hFind == INVALID_HANDLE_VALUE) return FALSE; -#ifndef _WIN32_WCE bool bFullPath = (::GetFullPathName(pstrName, MAX_PATH, m_lpszRoot, NULL) != 0); -#else // CE specific - errno_t nRet = SecureHelper::strncpy_x(m_lpszRoot, _countof(m_lpszRoot), pstrName, _TRUNCATE); - bool bFullPath = (nRet == 0 || nRet == STRUNCATE); -#endif // _WIN32_WCE // passed name isn't a valid path but was found by the API ATLASSERT(bFullPath); @@ -3525,10 +782,10 @@ class CFindFile else { // find the last forward or backward whack - LPTSTR pstrBack = MinCrtHelper::_strrchr(m_lpszRoot, _T('\\')); - LPTSTR pstrFront = MinCrtHelper::_strrchr(m_lpszRoot, _T('/')); + LPTSTR pstrBack = _tcsrchr(m_lpszRoot, _T('\\')); + LPTSTR pstrFront = _tcsrchr(m_lpszRoot, _T('/')); - if(pstrFront != NULL || pstrBack != NULL) + if((pstrFront != NULL) || (pstrBack != NULL)) { if(pstrFront == NULL) pstrFront = m_lpszRoot; @@ -3568,7 +825,7 @@ class CFindFile { m_bFound = FALSE; - if(m_hFind != NULL && m_hFind != INVALID_HANDLE_VALUE) + if((m_hFind != NULL) && (m_hFind != INVALID_HANDLE_VALUE)) { ::FindClose(m_hFind); m_hFind = NULL; @@ -3582,31 +839,19 @@ class CFindFile inline HPEN AtlGetStockPen(int nPen) { -#if (_WIN32_WINNT >= 0x0500) && !defined(_WIN32_WCE) - ATLASSERT(nPen == WHITE_PEN || nPen == BLACK_PEN || nPen == NULL_PEN || nPen == DC_PEN); -#else - ATLASSERT(nPen == WHITE_PEN || nPen == BLACK_PEN || nPen == NULL_PEN); -#endif + ATLASSERT((nPen == WHITE_PEN) || (nPen == BLACK_PEN) || (nPen == NULL_PEN) || (nPen == DC_PEN)); return (HPEN)::GetStockObject(nPen); } inline HBRUSH AtlGetStockBrush(int nBrush) { -#if (_WIN32_WINNT >= 0x0500) && !defined(_WIN32_WCE) - ATLASSERT((nBrush >= WHITE_BRUSH && nBrush <= HOLLOW_BRUSH) || nBrush == DC_BRUSH); -#else - ATLASSERT(nBrush >= WHITE_BRUSH && nBrush <= HOLLOW_BRUSH); -#endif + ATLASSERT(((nBrush >= WHITE_BRUSH) && (nBrush <= HOLLOW_BRUSH)) || (nBrush == DC_BRUSH)); return (HBRUSH)::GetStockObject(nBrush); } inline HFONT AtlGetStockFont(int nFont) { -#ifndef _WIN32_WCE - ATLASSERT((nFont >= OEM_FIXED_FONT && nFont <= SYSTEM_FIXED_FONT) || nFont == DEFAULT_GUI_FONT); -#else // CE specific - ATLASSERT(nFont == SYSTEM_FONT); -#endif // _WIN32_WCE + ATLASSERT(((nFont >= OEM_FIXED_FONT) && (nFont <= SYSTEM_FIXED_FONT)) || (nFont == DEFAULT_GUI_FONT)); return (HFONT)::GetStockObject(nFont); } @@ -3649,7 +894,7 @@ inline bool AtlCompactPath(LPTSTR lpstrOut, LPCTSTR lpstrIn, int cchLen) if(lstrlen(lpstrIn) < cchLen) { - SecureHelper::strcpy_x(lpstrOut, cchLen, lpstrIn); + ATL::Checked::tcscpy_s(lpstrOut, cchLen, lpstrIn); return true; } @@ -3667,23 +912,23 @@ inline bool AtlCompactPath(LPTSTR lpstrOut, LPCTSTR lpstrIn, int cchLen) LPCTSTR lpstrFileName = lpstrIn; for(LPCTSTR pPath = lpstrIn; *pPath; pPath = ::CharNext(pPath)) { - if((pPath[0] == _T('\\') || pPath[0] == _T(':') || pPath[0] == _T('/')) - && pPath[1] && pPath[1] != _T('\\') && pPath[1] != _T('/')) + if(((pPath[0] == _T('\\')) || (pPath[0] == _T(':')) || (pPath[0] == _T('/'))) + && pPath[1] && (pPath[1] != _T('\\')) && (pPath[1] != _T('/'))) lpstrFileName = pPath + 1; } int cchFileName = lstrlen(lpstrFileName); // handle just the filename without a path - if(lpstrFileName == lpstrIn && cchLen > cchEndEllipsis) + if((lpstrFileName == lpstrIn) && (cchLen > cchEndEllipsis)) { - bool bRet = (SecureHelper::strncpy_x(lpstrOut, cchLen, lpstrIn, cchLen - cchEndEllipsis - 1) == 0); + bool bRet = (ATL::Checked::tcsncpy_s(lpstrOut, cchLen, lpstrIn, cchLen - cchEndEllipsis - 1) == 0); if(bRet) { #ifndef _UNICODE if(_IsDBCSTrailByte(lpstrIn, cchLen - cchEndEllipsis)) lpstrOut[cchLen - cchEndEllipsis - 1] = 0; #endif // _UNICODE - SecureHelper::strcat_x(lpstrOut, cchLen, szEllipsis); + ATL::Checked::tcscat_s(lpstrOut, cchLen, szEllipsis); } return bRet; } @@ -3704,38 +949,34 @@ inline bool AtlCompactPath(LPTSTR lpstrOut, LPCTSTR lpstrIn, int cchLen) cchToCopy = 0; #ifndef _UNICODE - if(cchToCopy > 0 && _IsDBCSTrailByte(lpstrIn, cchToCopy)) + if((cchToCopy > 0) && _IsDBCSTrailByte(lpstrIn, cchToCopy)) cchToCopy--; #endif // _UNICODE - bool bRet = (SecureHelper::strncpy_x(lpstrOut, cchLen, lpstrIn, cchToCopy) == 0); + bool bRet = (ATL::Checked::tcsncpy_s(lpstrOut, cchLen, lpstrIn, cchToCopy) == 0); if(!bRet) return false; // add ellipsis - SecureHelper::strcat_x(lpstrOut, cchLen, szEllipsis); - if(!bRet) - return false; + ATL::Checked::tcscat_s(lpstrOut, cchLen, szEllipsis); TCHAR szSlash[2] = { chSlash, 0 }; - SecureHelper::strcat_x(lpstrOut, cchLen, szSlash); - if(!bRet) - return false; + ATL::Checked::tcscat_s(lpstrOut, cchLen, szSlash); // add filename (and ellipsis, if needed) if(cchLen > (cchMidEllipsis + cchFileName)) { - SecureHelper::strcat_x(lpstrOut, cchLen, lpstrFileName); + ATL::Checked::tcscat_s(lpstrOut, cchLen, lpstrFileName); } else { cchToCopy = cchLen - cchMidEllipsis - cchEndEllipsis - 1; #ifndef _UNICODE - if(cchToCopy > 0 && _IsDBCSTrailByte(lpstrFileName, cchToCopy)) + if((cchToCopy > 0) && _IsDBCSTrailByte(lpstrFileName, cchToCopy)) cchToCopy--; #endif // _UNICODE - bRet = (SecureHelper::strncpy_x(&lpstrOut[cchMidEllipsis], cchLen - cchMidEllipsis, lpstrFileName, cchToCopy) == 0); + bRet = (ATL::Checked::tcsncpy_s(&lpstrOut[cchMidEllipsis], cchLen - cchMidEllipsis, lpstrFileName, cchToCopy) == 0); if(bRet) - SecureHelper::strcat_x(lpstrOut, cchLen, szEllipsis); + ATL::Checked::tcscat_s(lpstrOut, cchLen, szEllipsis); } return bRet; diff --git a/thirdparty/wtl/atlprint.h b/thirdparty/wtl/atlprint.h index 5903494..504c40d 100644 --- a/thirdparty/wtl/atlprint.h +++ b/thirdparty/wtl/atlprint.h @@ -1,23 +1,16 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. +// Windows Template Library - WTL version 10.0 +// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. +// Microsoft Public License (http://opensource.org/licenses/MS-PL) +// which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLPRINT_H__ #define __ATLPRINT_H__ #pragma once -#ifdef _WIN32_WCE - #error atlprint.h is not supported on Windows CE -#endif - #ifndef __ATLAPP_H__ #error atlprint.h requires atlapp.h to be included first #endif @@ -63,11 +56,8 @@ template <> class _printer_info<4> { public: typedef PRINTER_INFO_4 infotype; }; template <> class _printer_info<5> { public: typedef PRINTER_INFO_5 infotype; }; template <> class _printer_info<6> { public: typedef PRINTER_INFO_6 infotype; }; template <> class _printer_info<7> { public: typedef PRINTER_INFO_7 infotype; }; -// these are not in the old (vc6.0) headers -#ifdef _ATL_USE_NEW_PRINTER_INFO template <> class _printer_info<8> { public: typedef PRINTER_INFO_8 infotype; }; template <> class _printer_info<9> { public: typedef PRINTER_INFO_9 infotype; }; -#endif // _ATL_USE_NEW_PRINTER_INFO template @@ -256,7 +246,7 @@ class CPrinterT memset(pv, 0, nLen); pdev->wDeviceOffset = sizeof(DEVNAMES) / sizeof(TCHAR); pv = pv + sizeof(DEVNAMES); // now points to end - SecureHelper::strcpy_x((LPTSTR)pv, lstrlen(lpszPrinterName) + 1, lpszPrinterName); + ATL::Checked::tcscpy_s((LPTSTR)pv, lstrlen(lpszPrinterName) + 1, lpszPrinterName); ::GlobalUnlock(h); } } @@ -380,7 +370,7 @@ class CDevModeT if (h != NULL) { void* p = ::GlobalLock(h); - SecureHelper::memcpy_x(p, nSize, pdm, nSize); + ATL::Checked::memcpy_s(p, nSize, pdm, nSize); ::GlobalUnlock(h); } Attach(h); @@ -408,7 +398,7 @@ class CDevModeT if (h != NULL) { void* p = ::GlobalLock(h); - SecureHelper::memcpy_x(p, nSize, m_pDevMode, nSize); + ATL::Checked::memcpy_s(p, nSize, m_pDevMode, nSize); ::GlobalUnlock(h); } return h; @@ -420,7 +410,7 @@ class CDevModeT { bool bRet = false; LONG nLen = ::DocumentProperties(NULL, hPrinter, NULL, NULL, NULL, 0); - CTempBuffer buff; + ATL::CTempBuffer buff; DEVMODE* pdm = buff.AllocateBytes(nLen); if(pdm != NULL) { @@ -442,7 +432,7 @@ class CDevModeT bool bRet = false; LONG nLen = ::DocumentProperties(hWnd, hPrinter, pi.m_pi->pName, NULL, NULL, 0); - CTempBuffer buff; + ATL::CTempBuffer buff; DEVMODE* pdm = buff.AllocateBytes(nLen); if(pdm != NULL) { @@ -628,7 +618,7 @@ class CPrintJob // Create a thread and return DWORD dwThreadID = 0; -#if !defined(_ATL_MIN_CRT) && defined(_MT) +#ifdef _MT HANDLE hThread = (HANDLE)_beginthreadex(NULL, 0, (UINT (WINAPI*)(void*))StartProc, this, 0, (UINT*)&dwThreadID); #else HANDLE hThread = ::CreateThread(NULL, 0, StartProc, (void*)this, 0, &dwThreadID); @@ -885,7 +875,7 @@ class ATL_NO_VTABLE CPrintPreviewWindowImpl : public ATL::CWindowImplm_hWnd); pT->DoPrePaint(dc.m_hDC, rc); pT->DoPaint(dc.m_hDC, rc); } @@ -897,7 +887,7 @@ class ATL_NO_VTABLE CPrintPreviewWindowImpl : public ATL::CWindowImplGetClientRect(&rcClient); RECT rcArea = rcClient; T* pT = static_cast(this); pT; // avoid level 4 warning @@ -943,7 +933,7 @@ class ATL_NO_VTABLE CZoomPrintPreviewWindowImpl : public CPrintPreviewWindowImpl CZoomPrintPreviewWindowImpl() { - SetScrollExtendedStyle(SCRL_DISABLENOSCROLL); + this->SetScrollExtendedStyle(SCRL_DISABLENOSCROLL); InitZoom(); } @@ -951,9 +941,9 @@ class ATL_NO_VTABLE CZoomPrintPreviewWindowImpl : public CPrintPreviewWindowImpl void InitZoom() { m_bSized = false; - m_nZoomMode = ZOOMMODE_OFF; - m_fZoomScaleMin = 1.0; - m_fZoomScale = 1.0; + this->m_nZoomMode = ZOOMMODE_OFF; + this->m_fZoomScaleMin = 1.0; + this->m_fZoomScale = 1.0; } BEGIN_MSG_MAP(CZoomPrintPreviewWindowImpl) @@ -961,9 +951,7 @@ class ATL_NO_VTABLE CZoomPrintPreviewWindowImpl : public CPrintPreviewWindowImpl MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel) -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) + MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) MESSAGE_HANDLER(WM_LBUTTONDOWN, CZoomScrollImpl< T >::OnLButtonDown) MESSAGE_HANDLER(WM_MOUSEMOVE, CZoomScrollImpl< T >::OnMouseMove) @@ -991,14 +979,14 @@ class ATL_NO_VTABLE CZoomPrintPreviewWindowImpl : public CPrintPreviewWindowImpl LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { SIZE sizeClient = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)}; - POINT ptOffset = m_ptOffset; - SIZE sizeAll = m_sizeAll; - SetScrollSize(sizeClient); + POINT ptOffset = this->m_ptOffset; + SIZE sizeAll = this->m_sizeAll; + this->SetScrollSize(sizeClient); if(sizeAll.cx > 0) - ptOffset.x = ::MulDiv(ptOffset.x, m_sizeAll.cx, sizeAll.cx); + ptOffset.x = ::MulDiv(ptOffset.x, this->m_sizeAll.cx, sizeAll.cx); if(sizeAll.cy > 0) - ptOffset.y = ::MulDiv(ptOffset.y, m_sizeAll.cy, sizeAll.cy); - SetScrollOffset(ptOffset); + ptOffset.y = ::MulDiv(ptOffset.y, this->m_sizeAll.cy, sizeAll.cy); + this->SetScrollOffset(ptOffset); CScrollImpl< T >::OnSize(uMsg, wParam, lParam, bHandled); if(!m_bSized) { @@ -1026,11 +1014,11 @@ class ATL_NO_VTABLE CZoomPrintPreviewWindowImpl : public CPrintPreviewWindowImpl int nMapModeSav = dc.GetMapMode(); dc.SetMapMode(MM_ANISOTROPIC); SIZE szWindowExt = { 0, 0 }; - dc.SetWindowExt(m_sizeLogAll, &szWindowExt); + dc.SetWindowExt(this->m_sizeLogAll, &szWindowExt); SIZE szViewportExt = { 0, 0 }; - dc.SetViewportExt(m_sizeAll, &szViewportExt); + dc.SetViewportExt(this->m_sizeAll, &szViewportExt); POINT ptViewportOrg = { 0, 0 }; - dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y, &ptViewportOrg); + dc.SetViewportOrg(-this->m_ptOffset.x, -this->m_ptOffset.y, &ptViewportOrg); pT->DoPrePaint(dc, rc); pT->DoPaint(dc, rc); @@ -1059,8 +1047,8 @@ class ATL_NO_VTABLE CZoomPrintPreviewWindowImpl : public CPrintPreviewWindowImpl void DoPrePaint(CDCHandle dc, RECT& rc) { - RECT rcClient; - GetClientRect(&rcClient); + RECT rcClient = { 0 }; + this->GetClientRect(&rcClient); RECT rcArea = rcClient; T* pT = static_cast(this); pT; // avoid level 4 warning @@ -1069,7 +1057,7 @@ class ATL_NO_VTABLE CZoomPrintPreviewWindowImpl : public CPrintPreviewWindowImpl rcArea.right = rcArea.left; if (rcArea.top > rcArea.bottom) rcArea.bottom = rcArea.top; - GetPageRect(rcArea, &rc); + this->GetPageRect(rcArea, &rc); HBRUSH hbrOld = dc.SelectBrush(::GetSysColorBrush(COLOR_BTNSHADOW)); dc.PatBlt(rcClient.left, rcClient.top, rc.left - rcClient.left, rcClient.bottom - rcClient.top, PATCOPY); dc.PatBlt(rc.left, rcClient.top, rc.right - rc.left, rc.top - rcClient.top, PATCOPY); @@ -1085,13 +1073,13 @@ class ATL_NO_VTABLE CZoomPrintPreviewWindowImpl : public CPrintPreviewWindowImpl void DoPaint(CDCHandle dc, RECT& rc) { - CEnhMetaFileInfo emfinfo(m_meta); + CEnhMetaFileInfo emfinfo(this->m_meta); ENHMETAHEADER* pmh = emfinfo.GetEnhMetaFileHeader(); - int nOffsetX = MulDiv(m_sizeCurPhysOffset.cx, rc.right-rc.left, pmh->szlDevice.cx); - int nOffsetY = MulDiv(m_sizeCurPhysOffset.cy, rc.bottom-rc.top, pmh->szlDevice.cy); + int nOffsetX = MulDiv(this->m_sizeCurPhysOffset.cx, rc.right-rc.left, pmh->szlDevice.cx); + int nOffsetY = MulDiv(this->m_sizeCurPhysOffset.cy, rc.bottom-rc.top, pmh->szlDevice.cy); dc.OffsetWindowOrg(-nOffsetX, -nOffsetY); - dc.PlayMetaFile(m_meta, &rc); + dc.PlayMetaFile(this->m_meta, &rc); } }; diff --git a/thirdparty/wtl/atlres.h b/thirdparty/wtl/atlres.h index 4a5d8af..aed58f1 100644 --- a/thirdparty/wtl/atlres.h +++ b/thirdparty/wtl/atlres.h @@ -1,46 +1,37 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. +// Windows Template Library - WTL version 10.0 +// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. +// Microsoft Public License (http://opensource.org/licenses/MS-PL) +// which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLRES_H__ #define __ATLRES_H__ #pragma once -#if defined(_WIN32_WCE) && !defined(__ATLRESCE_H__) - #error Use atlresCE.h instead of atlres.h for Windows CE -#endif - #ifdef RC_INVOKED #ifndef _INC_WINDOWS #define _INC_WINDOWS - #ifndef _WIN32_WCE - #define VS_VERSION_INFO 1 + #define VS_VERSION_INFO 1 - #ifdef APSTUDIO_INVOKED - #define APSTUDIO_HIDDEN_SYMBOLS // Ignore following symbols - #endif // APSTUDIO_INVOKED + #ifdef APSTUDIO_INVOKED + #define APSTUDIO_HIDDEN_SYMBOLS // Ignore following symbols + #endif // APSTUDIO_INVOKED - #ifndef WINVER - #define WINVER 0x0400 // default to Windows Version 4.0 - #endif // !WINVER + #ifndef WINVER + #define WINVER 0x0500 + #endif // !WINVER - #include + #include // operation messages sent to DLGINIT - #define LB_ADDSTRING (WM_USER+1) - #define CB_ADDSTRING (WM_USER+3) - #endif // !_WIN32_WCE + #define LB_ADDSTRING (WM_USER+1) + #define CB_ADDSTRING (WM_USER+3) #ifdef APSTUDIO_INVOKED #undef APSTUDIO_HIDDEN_SYMBOLS @@ -150,6 +141,9 @@ #define ID_EDIT_SELECT_ALL 0xE12A #define ID_EDIT_UNDO 0xE12B #define ID_EDIT_REDO 0xE12C +#define ID_EDIT_DELETE ID_EDIT_CLEAR +#define ID_EDIT_FIND_NEXT ID_EDIT_REPEAT +#define ID_EDIT_FIND_PREVIOUS 0xE12D // Window commands #define ID_WINDOW_NEW 0xE130 @@ -184,6 +178,8 @@ #define ID_NEXT_PANE 0xE150 #define ID_PREV_PANE 0xE151 #define ID_PANE_CLOSE 0xE152 +#define ID_PANE_NEXT ID_NEXT_PANE +#define ID_PANE_PREVIOUS ID_PREV_PANE // Format #define ID_FORMAT_FONT 0xE160 @@ -217,7 +213,7 @@ #define ID_VIEW_TOOLBAR 0xE800 #define ID_VIEW_STATUS_BAR 0xE801 #define ID_VIEW_REFRESH 0xE803 -#define ID_VIEW_RIBBON 0xE804 // Ribbon +#define ID_VIEW_RIBBON 0xE804 /////////////////////////////////////////////////////////////////////////////// // Standard control IDs diff --git a/thirdparty/wtl/atlresce.h b/thirdparty/wtl/atlresce.h deleted file mode 100644 index 96211ee..0000000 --- a/thirdparty/wtl/atlresce.h +++ /dev/null @@ -1,93 +0,0 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLRESCE_H__ -#define __ATLRESCE_H__ - -#pragma once - -#ifndef _WIN32_WCE - #error atlresCE.h is only for Windows CE -#endif - - -#ifdef RC_INVOKED -#ifndef _INC_WINDOWS - - #define VS_VERSION_INFO 1 - - #ifdef APSTUDIO_INVOKED - #define APSTUDIO_HIDDEN_SYMBOLS // Ignore following symbols - #endif // APSTUDIO_INVOKED - - #ifndef WINVER - #define WINVER 0x0400 // default to Windows Version 4.0 - #endif // !WINVER - - #if !defined(WCEOLE_ENABLE_DIALOGEX) - #define DIALOGEX DIALOG DISCARDABLE - #endif - - #include - #define SHMENUBAR RCDATA - - #if defined(SHELLSDK_MODULES_AYGSHELL) - #include - #else - #define NOMENU 0xFFFF - #define IDS_SHNEW 1 - #define IDM_SHAREDNEW 10 - #define IDM_SHAREDNEWDEFAULT 11 - #endif - #ifndef I_IMAGENONE - #define I_IMAGENONE (-2) - #endif - - #include - -#endif // !_INC_WINDOWS -#endif // RC_INVOKED - -#include "atlres.h" - -#ifdef APSTUDIO_INVOKED - #undef APSTUDIO_HIDDEN_SYMBOLS -#endif // APSTUDIO_INVOKED - -// Visual Studio dialog editor bug fix -#ifndef DS_FIXEDSYS - #define DS_FIXEDSYS 0 -#endif - -#define IDC_INFOSTATIC 0xFFFE // == IDC_STATIC -1 - -/////////////////////////////////////////////////////////////////////////////// -// Smartphone and PPC 2005 Resource IDs - -// Command and associated string resource IDs -#define ID_MENU_OK 0xE790 -#define ID_MENU_CANCEL 0xE791 -#define ID_MENU 0xE792 -#define ID_ACTION 0xE793 -#define ID_VIEW_FULLSCREEN 0xE802 - -// MenuBar resource IDs -#define ATL_IDM_MENU_DONE 0xE701 -#define ATL_IDM_MENU_CANCEL 0xE702 -#define ATL_IDM_MENU_DONECANCEL 0xE703 - -// Default device MenuBar control ID and MenuBar resource ID -#define ATL_IDW_MENU_BAR 0xE802 - -// SmartPhone spinned controls ID offset for CSpinCtrl -#define ATL_IDW_SPIN_ID 9999 - -#endif // __ATLRESCE_H__ diff --git a/thirdparty/wtl/atlribbon.h b/thirdparty/wtl/atlribbon.h index c1dfd0f..8b82278 100644 --- a/thirdparty/wtl/atlribbon.h +++ b/thirdparty/wtl/atlribbon.h @@ -1,13 +1,10 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. +// Windows Template Library - WTL version 10.0 +// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. +// Microsoft Public License (http://opensource.org/licenses/MS-PL) +// which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLRIBBON_H__ #define __ATLRIBBON_H__ @@ -26,35 +23,27 @@ #error atlribbon.h requires the Windows 7 SDK or higher #endif -#ifdef _WIN32_WCE - #error atlribbon.h is not supported on Windows CE -#endif - #ifndef __ATLAPP_H__ #error atlribbon.h requires atlapp.h to be included first #endif -#if (_ATL_VER < 0x0700) - #include - #pragma comment(lib, "shlwapi.lib") -#endif - #include // for RecentDocumentList classes #include // for Frame and UpdateUI classes #include // required for atlctrlw.h #include // for CCommandBarCtrl -#if !defined(_WTL_USE_CSTRING) && !defined(__ATLSTR_H__) - #pragma warning(disable : 4530) // unwind semantics not enabled +#ifndef __ATLSTR_H__ + #pragma warning(push) + #pragma warning(disable: 4530) // unwind semantics not enabled #include - #pragma warning(default : 4530) + #pragma warning(pop) #endif #include #pragma comment(lib, "dwmapi.lib") -#include -#include +#include "UIRibbon.h" +#include "UIRibbonPropertyHelpers.h" #pragma comment(lib, "propsys.lib") #include // for CHARFORMAT2 @@ -136,17 +125,17 @@ class CRibbonUpdateUI : public CAutoUpdateUI UPDUI_PERSIST = 0x0020 }; - bool IsRibbonElement(const _AtlUpdateUIMap& UIMap) + bool IsRibbonElement(const CUpdateUIBase::_AtlUpdateUIMap& UIMap) { return (UIMap.m_wType & UPDUI_RIBBON) != 0; } bool IsRibbonID(UINT nID) { - for(int i = 0; i < m_arrUIMap.GetSize(); i++) + for(int i = 0; i < this->m_arrUIMap.GetSize(); i++) { - if(m_arrUIMap[i].m_nID == nID) - return IsRibbonElement(m_arrUIMap[i]); + if(this->m_arrUIMap[i].m_nID == nID) + return IsRibbonElement(this->m_arrUIMap[i]); } return false; @@ -155,12 +144,12 @@ class CRibbonUpdateUI : public CAutoUpdateUI // Element bool UIAddRibbonElement(UINT nID) { - return UIAddElement(nID); + return this->UIAddElement(nID); } bool UIRemoveRibbonElement(UINT nID) { - return UIRemoveElement(nID); + return this->UIRemoveElement(nID); } bool UIPersistElement(UINT nID, bool bPersist = true) @@ -182,23 +171,26 @@ class CRibbonUpdateUI : public CAutoUpdateUI BOOL UISetText(int nID, UINT uIdResource, BOOL bForceUpdate = FALSE) { - CTempBuffer sText(RIBBONUI_MAX_TEXT); - return AtlLoadString(uIdResource, sText, RIBBONUI_MAX_TEXT) ? - UISetText(nID, sText, bForceUpdate) : - E_FAIL; + ATL::CTempBuffer sText(RIBBONUI_MAX_TEXT); + int nRet = ATL::AtlLoadString(uIdResource, sText, RIBBONUI_MAX_TEXT); + if(nRet > 0) + UISetText(nID, sText, bForceUpdate); + return (nRet > 0) ? TRUE : FALSE; } LPCTSTR UIGetText(int nID) { T* pT = static_cast(this); - LPCTSTR sUI = CAutoUpdateUI::UIGetText(nID); + LPCTSTR sUI = CAutoUpdateUI::UIGetText(nID); // replace 'tab' by 'space' for RibbonUI elements if (sUI && pT->IsRibbonUI() && IsRibbonID(nID) && wcschr(sUI, L'\t')) { static WCHAR sText[RIBBONUI_MAX_TEXT] = { 0 }; wcscpy_s(sText, sUI); - *wcschr(sText, L'\t') = L' '; + WCHAR* pch = wcschr(sText, L'\t'); + if (pch != NULL) + *pch = L' '; return sText; } else @@ -243,8 +235,8 @@ namespace RibbonUI { // Minimal string allocation support for various PROPERTYKEY values -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - typedef _CSTRING_NS::CString Text; +#ifdef __ATLSTR_H__ + typedef ATL::CString Text; #else class Text : public std::wstring { @@ -268,7 +260,7 @@ namespace RibbonUI return static_cast(std::wstring::operator =(s)); } }; -#endif +#endif // __ATLSTR_H__ // PROPERTYKEY enum and helpers enum k_KEY @@ -374,20 +366,20 @@ struct CharFormat : CHARFORMAT2 // Default constructor CharFormat() { - cbSize = sizeof CHARFORMAT2; + cbSize = sizeof(CHARFORMAT2); Reset(); } // Copy constructor CharFormat(const CharFormat& cf) { - CopyMemory(this, &cf, sizeof CHARFORMAT2); + ::CopyMemory(this, &cf, sizeof(CHARFORMAT2)); } // Assign operator CharFormat& operator =(const CharFormat& cf) { - CopyMemory(this, &cf, sizeof CHARFORMAT2); + ::CopyMemory(this, &cf, sizeof(CHARFORMAT2)); return (*this); } @@ -409,15 +401,15 @@ struct CharFormat : CHARFORMAT2 { &CharFormat::Getk_Family, &CharFormat::Getk_FontProperties_Size, - &CharFormat::Getk_MaskEffect, - &CharFormat::Getk_MaskEffect, - &CharFormat::Getk_MaskEffect, - &CharFormat::Getk_MaskEffect, - &CharFormat::Getk_VerticalPositioning, - &CharFormat::Getk_Color, - &CharFormat::Getk_Color, - &CharFormat::Getk_ColorType, - &CharFormat::Getk_ColorType, + &CharFormat::Getk_MaskEffectBold, + &CharFormat::Getk_MaskEffectItalic, + &CharFormat::Getk_MaskEffectUnderline, + &CharFormat::Getk_MaskEffectStrikeout, + &CharFormat::Getk_VerticalPositioning, + &CharFormat::Getk_Color, + &CharFormat::Getk_ColorBack, + &CharFormat::Getk_ColorType, + &CharFormat::Getk_ColorTypeBack, }; DWORD nProps = 0; @@ -473,9 +465,9 @@ struct CharFormat : CHARFORMAT2 { if (SUCCEEDED(pStore->GetValue(UI_PKEY_FontProperties_Size, &propvar))) { - DECIMAL decSize; + DECIMAL decSize = { 0 }; UIPropertyToDecimal(UI_PKEY_FontProperties_Size, propvar, &decSize); - DOUBLE dSize; + DOUBLE dSize = 0; VarR8FromDec(&decSize, &dSize); if (dSize > 0) { @@ -485,18 +477,37 @@ struct CharFormat : CHARFORMAT2 } } - template - void Getk_MaskEffect(IPropertyStore* pStore) + void Getk_MaskEffectBold(IPropertyStore* pStore) + { + Getk_MaskEffectAll(pStore, CFM_BOLD, CFE_BOLD, UI_PKEY_FontProperties_Bold); + } + + void Getk_MaskEffectItalic(IPropertyStore* pStore) + { + Getk_MaskEffectAll(pStore, CFM_ITALIC, CFE_ITALIC, UI_PKEY_FontProperties_Italic); + } + + void Getk_MaskEffectUnderline(IPropertyStore* pStore) + { + Getk_MaskEffectAll(pStore, CFM_UNDERLINE, CFE_UNDERLINE, UI_PKEY_FontProperties_Underline); + } + + void Getk_MaskEffectStrikeout(IPropertyStore* pStore) + { + Getk_MaskEffectAll(pStore, CFM_STRIKEOUT, CFE_STRIKEOUT, UI_PKEY_FontProperties_Strikethrough); + } + + void Getk_MaskEffectAll(IPropertyStore* pStore, DWORD _dwMask, DWORD _dwEffects, REFPROPERTYKEY key) { if (SUCCEEDED(pStore->GetValue(key, &propvar))) { UIPropertyToUInt32(key, propvar, &uValue); if ((UI_FONTPROPERTIES)uValue != UI_FONTPROPERTIES_NOTAVAILABLE) { - dwMask |= t_dwMask; - dwEffects |= ((UI_FONTPROPERTIES) uValue == UI_FONTPROPERTIES_SET) ? t_dwEffects : 0; + dwMask |= _dwMask; + dwEffects |= ((UI_FONTPROPERTIES)uValue == UI_FONTPROPERTIES_SET) ? _dwEffects : 0; } - } + } } void Getk_VerticalPositioning(IPropertyStore* pStore) @@ -516,32 +527,51 @@ struct CharFormat : CHARFORMAT2 } } - template void Getk_Color(IPropertyStore* pStore) { - UINT32 color; + Getk_ColorAll(pStore, CFM_COLOR, UI_PKEY_FontProperties_ForegroundColor); + } + + void Getk_ColorBack(IPropertyStore* pStore) + { + Getk_ColorAll(pStore, CFM_BACKCOLOR, UI_PKEY_FontProperties_BackgroundColor); + } + + void Getk_ColorAll(IPropertyStore* pStore, DWORD _dwMask, REFPROPERTYKEY key) + { + UINT32 color = 0; if (SUCCEEDED(pStore->GetValue(key, &propvar))) { UIPropertyToUInt32(key, propvar, &color); - dwMask |= t_dwMask; + dwMask |= _dwMask; - if (t_dwMask == CFM_COLOR) + if (_dwMask == CFM_COLOR) crTextColor = color; else crBackColor = color; } } - template void Getk_ColorType(IPropertyStore* pStore) + { + Getk_ColorTypeAll(pStore, CFM_COLOR, CFE_AUTOCOLOR, UI_SWATCHCOLORTYPE_AUTOMATIC, UI_PKEY_FontProperties_ForegroundColor); + + } + + void Getk_ColorTypeBack(IPropertyStore* pStore) + { + Getk_ColorTypeAll(pStore, CFM_BACKCOLOR, CFE_AUTOBACKCOLOR, UI_SWATCHCOLORTYPE_NOCOLOR, UI_PKEY_FontProperties_BackgroundColor); + } + + void Getk_ColorTypeAll(IPropertyStore* pStore, DWORD _dwMask, DWORD _dwEffects, UI_SWATCHCOLORTYPE _type, REFPROPERTYKEY key) { if (SUCCEEDED(pStore->GetValue(key, &propvar))) { UIPropertyToUInt32(key, propvar, &uValue); - if (t_type == (UI_SWATCHCOLORTYPE)uValue) + if (_type == (UI_SWATCHCOLORTYPE)uValue) { - dwMask |= t_dwMask; - dwEffects |= t_dwEffects; + dwMask |= _dwMask; + dwEffects |= _dwEffects; } } } @@ -549,17 +579,17 @@ struct CharFormat : CHARFORMAT2 // Put functions void PutMaskEffect(WORD dwMaskVal, WORD dwEffectVal, REFPROPERTYKEY key, IPropertyStore* pStore) { - PROPVARIANT propvar; + PROPVARIANT var; UI_FONTPROPERTIES uProp = UI_FONTPROPERTIES_NOTAVAILABLE; if ((dwMask & dwMaskVal) != 0) uProp = dwEffects & dwEffectVal ? UI_FONTPROPERTIES_SET : UI_FONTPROPERTIES_NOTSET; - SetPropertyVal(key, uProp, &propvar); - pStore->SetValue(key, propvar); + SetPropertyVal(key, uProp, &var); + pStore->SetValue(key, var); } void PutVerticalPos(IPropertyStore* pStore) { - PROPVARIANT propvar; + PROPVARIANT var; UI_FONTVERTICALPOSITION uProp = UI_FONTVERTICALPOSITION_NOTAVAILABLE; if ((dwMask & CFE_SUBSCRIPT) != 0) @@ -577,21 +607,21 @@ struct CharFormat : CHARFORMAT2 uProp = UI_FONTVERTICALPOSITION_SUBSCRIPT; } - SetPropertyVal(UI_PKEY_FontProperties_VerticalPositioning, uProp, &propvar); - pStore->SetValue(UI_PKEY_FontProperties_VerticalPositioning, propvar); + SetPropertyVal(UI_PKEY_FontProperties_VerticalPositioning, uProp, &var); + pStore->SetValue(UI_PKEY_FontProperties_VerticalPositioning, var); } void PutFace(IPropertyStore* pStore) { - PROPVARIANT propvar; + PROPVARIANT var; SetPropertyVal(UI_PKEY_FontProperties_Family, - dwMask & CFM_FACE ? szFaceName : L"", &propvar); - pStore->SetValue(UI_PKEY_FontProperties_Family, propvar); + dwMask & CFM_FACE ? szFaceName : L"", &var); + pStore->SetValue(UI_PKEY_FontProperties_Family, var); } void PutSize(IPropertyStore* pStore) { - PROPVARIANT propvar; + PROPVARIANT var; DECIMAL decVal; if ((dwMask & CFM_SIZE) != 0) @@ -599,13 +629,14 @@ struct CharFormat : CHARFORMAT2 else VarDecFromI4(0, &decVal); - SetPropertyVal(UI_PKEY_FontProperties_Size, &decVal, &propvar); - pStore->SetValue(UI_PKEY_FontProperties_Size, propvar); + SetPropertyVal(UI_PKEY_FontProperties_Size, &decVal, &var); + pStore->SetValue(UI_PKEY_FontProperties_Size, var); } void PutColor(IPropertyStore* pStore) { if ((dwMask & CFM_COLOR) != 0) + { if ((dwEffects & CFE_AUTOCOLOR) == 0) { SetPropertyVal(UI_PKEY_FontProperties_ForegroundColorType, UI_SWATCHCOLORTYPE_RGB, &propvar); @@ -619,6 +650,7 @@ struct CharFormat : CHARFORMAT2 SetPropertyVal(UI_PKEY_FontProperties_ForegroundColorType, UI_SWATCHCOLORTYPE_AUTOMATIC, &propvar); pStore->SetValue(UI_PKEY_FontProperties_ForegroundColorType, propvar); } + } } void PutBackColor(IPropertyStore* pStore) @@ -786,7 +818,7 @@ class CommandCtrlImpl : public CtrlImpl const INT iImage = k_(key) - k_LargeImage; if (m_hbm[iImage].IsNull()) - m_hbm[iImage] = GetWndRibbon().OnRibbonQueryImage(GetID(), key); + m_hbm[iImage] = this->GetWndRibbon().OnRibbonQueryImage(this->GetID(), key); return m_hbm[iImage].IsNull() ? E_NOTIMPL : @@ -796,11 +828,11 @@ class CommandCtrlImpl : public CtrlImpl virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) { - ATLASSERT (nCmdID == GetID()); + ATLASSERT (nCmdID == this->GetID()); return (k_(key) <= k_SmallHighContrastImage) && (k_(key) >= k_LargeImage) ? OnGetImage(key, ppropvarNewValue) : - CtrlImpl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); + CtrlImpl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); } }; @@ -810,6 +842,10 @@ class CommandCtrlImpl : public CtrlImpl // ItemProperty class: ribbon callback for each item in a collection // + +#pragma warning(push) +#pragma warning(disable: 4512) // assignment operator could not be generated + template class ItemProperty : public IUISimplePropertySet { @@ -851,6 +887,8 @@ class ItemProperty : public IUISimplePropertySet } }; +#pragma warning(pop) + // CollectionImplBase: base class for all RibbonUI collections // @@ -887,11 +925,11 @@ class CollectionImpl : public CollectionImplBaseClear(); for (UINT i = 0; i < m_size; i++) { - if FAILED(hr = pIUICollection->Add(m_apItems[i])) + if FAILED(hr = pIUICollection->Add(this->m_apItems[i])) break; } ATLASSERT(SUCCEEDED(hr)); @@ -1014,9 +1052,9 @@ class CollectionImpl : public CollectionImplBase pIUICategory(ppropvarCurrentValue->punkVal); ATLASSERT(pIUICategory.p); hr = pIUICategory->Clear(); - for (UINT i = t_items; i < t_items + t_categories; i++) + for (UINT i = t_items; i < (t_items + t_categories); i++) { - if FAILED(hr = pIUICategory->Add(m_apItems[i])) + if FAILED(hr = pIUICategory->Add(this->m_apItems[i])) break; } ATLASSERT(SUCCEEDED(hr)); @@ -1086,7 +1124,7 @@ class TextCollectionImpl : public CollectionImpl } else { - return Collection::DoGetItem(uItem, key, value); + return CollectionImpl::Collection::DoGetItem(uItem, key, value); } } @@ -1107,7 +1145,7 @@ class TextCollectionImpl : public CollectionImpl } else { - return Collection::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); + return CollectionImpl::Collection::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); } } }; @@ -1123,7 +1161,7 @@ class ItemCollectionImpl : public TextCollectionImpl::TextCollection::DoGetItem(uItem, key, value); } } }; @@ -1205,8 +1243,8 @@ class CommandCollectionImpl : public CollectionImplInvalidateItems() : S_OK; } HRESULT SetItemCommandType(UINT uItem, UI_COMMANDTYPE type, bool bUpdate = false) @@ -1235,7 +1273,7 @@ class CommandCollectionImpl : public CollectionImplInvalidateItems() : S_OK; } // Implementation @@ -1259,7 +1297,7 @@ class CommandCollectionImpl : public CollectionImpl::Collection::DoGetItem(uItem, key, value); break; } @@ -1336,7 +1374,7 @@ class CollectionCtrlImpl : public CommandCtrlImpl, public TCollection virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) { - ATLASSERT(nCmdID == GetID()); + ATLASSERT(nCmdID == this->GetID()); ATLASSERT(ppropvarNewValue); HRESULT hr = Collection::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); @@ -1350,12 +1388,12 @@ class CollectionCtrlImpl : public CommandCtrlImpl, public TCollection const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, IUISimplePropertySet* /*pCommandExecutionProperties*/) { - ATLASSERT (nCmdID == GetID()); + ATLASSERT (nCmdID == this->GetID()); nCmdID; // avoid level4 warning if (key == NULL) // gallery button pressed { - GetWndRibbon().OnRibbonItemSelected(GetID(), UI_EXECUTIONVERB_EXECUTE, UI_COLLECTION_INVALIDINDEX); + this->GetWndRibbon().OnRibbonItemSelected(this->GetID(), UI_EXECUTIONVERB_EXECUTE, UI_COLLECTION_INVALIDINDEX); return S_OK; } @@ -1368,7 +1406,7 @@ class CollectionCtrlImpl : public CommandCtrlImpl, public TCollection if (SUCCEEDED(hr)) { - if (GetWndRibbon().OnRibbonItemSelected(GetID(), verb, uSel)) + if (this->GetWndRibbon().OnRibbonItemSelected(this->GetID(), verb, uSel)) TCollection::Select(uSel); } @@ -1396,28 +1434,28 @@ class ToolbarGalleryCtrlImpl : public CollectionCtrlImplm_aCmdType[j] = UI_COMMANDTYPE_ACTION; + this->m_auCmd[j++] = pItems[i]; } } if (j < t_size) - Resize(j); + this->Resize(j); } HRESULT DoGetItem(UINT uItem, REFPROPERTYKEY key, PROPVARIANT *value) { - ATLASSERT(uItem < m_size); - ATLASSERT(m_auCmd[uItem]); + ATLASSERT(uItem < this->m_size); + ATLASSERT(this->m_auCmd[uItem]); HRESULT hr = E_FAIL; switch (k_(key)) { case k_CommandId: - hr = SetPropertyVal(key, m_auCmd[uItem], value); + hr = SetPropertyVal(key, this->m_auCmd[uItem], value); break; case k_CommandType: - hr = SetPropertyVal(key, UINT32(m_aCmdType[uItem]), value); + hr = SetPropertyVal(key, UINT32(this->m_aCmdType[uItem]), value); break; case k_CategoryId: hr = SetPropertyVal(key, UI_COLLECTION_INVALIDINDEX, value); @@ -1463,7 +1501,7 @@ class SimpleCollectionCtrlImpl : virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) { - ATLASSERT(nCmdID == GetID()); + ATLASSERT(nCmdID == this->GetID()); ATLASSERT(ppropvarNewValue != NULL); HRESULT hr = S_OK; @@ -1476,7 +1514,7 @@ class SimpleCollectionCtrlImpl : hr = pIUICollection->Clear(); for (UINT i = 0; i < t_size; i++) { - if FAILED(hr = pIUICollection->Add(m_apItems[i])) + if FAILED(hr = pIUICollection->Add(this->m_apItems[i])) break; } ATLASSERT(SUCCEEDED(hr)); @@ -1486,7 +1524,7 @@ class SimpleCollectionCtrlImpl : hr = SetPropertyVal(UI_PKEY_SelectedItem, m_uSelected, ppropvarNewValue); break; default: - hr = CommandCtrlImpl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); + hr = CommandCtrlImpl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); break; } @@ -1497,20 +1535,20 @@ class SimpleCollectionCtrlImpl : const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, IUISimplePropertySet* /*pCommandExecutionProperties*/) { - ATLASSERT (nCmdID == GetID()); + ATLASSERT (nCmdID == this->GetID()); nCmdID; // avoid level 4 warning HRESULT hr = S_OK; if (key == NULL) // gallery button pressed { - GetWndRibbon().OnRibbonItemSelected(GetID(), UI_EXECUTIONVERB_EXECUTE, UI_COLLECTION_INVALIDINDEX); + this->GetWndRibbon().OnRibbonItemSelected(this->GetID(), UI_EXECUTIONVERB_EXECUTE, UI_COLLECTION_INVALIDINDEX); return hr; } ATLASSERT(k_(*key) == k_SelectedItem); ATLASSERT(ppropvarValue); if SUCCEEDED(hr = UIPropertyToUInt32(*key, *ppropvarValue, &m_uSelected)) - GetWndRibbon().OnRibbonItemSelected(GetID(), verb, m_uSelected); + this->GetWndRibbon().OnRibbonItemSelected(this->GetID(), verb, m_uSelected); return hr; } @@ -1531,14 +1569,14 @@ class RecentItemsCtrlImpl : // Implementation HRESULT OnGetItem(UINT uItem, REFPROPERTYKEY key, PROPVARIANT *value) { - ATLASSERT((INT)uItem < GetMaxEntries()); + ATLASSERT((INT)uItem < this->GetMaxEntries()); - LPCWSTR sPath = m_arrDocs[uItem].szDocName; + LPCWSTR sPath = this->m_arrDocs[uItem].szDocName; HRESULT hr = E_NOTIMPL; switch (k_(key)) { case k_Label: - hr = SetPropertyVal(key, GetWndRibbon().OnRibbonQueryRecentItemName(sPath), value); + hr = SetPropertyVal(key, this->GetWndRibbon().OnRibbonQueryRecentItemName(sPath), value); break; case k_LabelDescription: hr = SetPropertyVal(key, sPath, value); @@ -1554,25 +1592,25 @@ class RecentItemsCtrlImpl : virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) { - ATLASSERT(nCmdID == GetID()); + ATLASSERT(nCmdID == this->GetID()); ATLASSERT(ppropvarNewValue); HRESULT hr = S_OK; switch (k_(key)) { case k_RecentItems: - if (SAFEARRAY* psa = SafeArrayCreateVector(VT_UNKNOWN, 0, m_arrDocs.GetSize())) + if (SAFEARRAY* psa = SafeArrayCreateVector(VT_UNKNOWN, 0, this->m_arrDocs.GetSize())) { - const int iLastIndex = m_arrDocs.GetSize() - 1; + const int iLastIndex = this->m_arrDocs.GetSize() - 1; for (LONG i = 0; i <= iLastIndex; i++) - SafeArrayPutElement(psa, &i, m_apItems[iLastIndex - i]); // reverse order + SafeArrayPutElement(psa, &i, this->m_apItems[iLastIndex - i]); // reverse order hr = SetPropertyVal(key, psa, ppropvarNewValue); SafeArrayDestroy(psa); } break; default: - hr = CtrlImpl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); + hr = CtrlImpl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); break; } @@ -1583,7 +1621,7 @@ class RecentItemsCtrlImpl : const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, IUISimplePropertySet* /*pCommandExecutionProperties*/) { - ATLASSERT(nCmdID == GetID()); + ATLASSERT(nCmdID == this->GetID()); nCmdID; // avoid level 4 warning ATLASSERT(verb == UI_EXECUTIONVERB_EXECUTE); verb; // avoid level 4 warning @@ -1594,8 +1632,8 @@ class RecentItemsCtrlImpl : HRESULT hr = UIPropertyToUInt32(*key, *ppropvarValue, &uSel); if SUCCEEDED(hr) { - ATLASSERT(uSel < (UINT)GetMaxEntries()); - GetWndRibbon().DefCommandExecute(ID_FILE_MRU_FIRST + uSel); + ATLASSERT(uSel < (UINT)this->GetMaxEntries()); + this->GetWndRibbon().DefCommandExecute(ID_FILE_MRU_FIRST + uSel); } return hr; @@ -1620,7 +1658,7 @@ class FontCtrlImpl : public CtrlImpl const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, IUISimplePropertySet* pCommandExecutionProperties) { - ATLASSERT (nCmdID == GetID()); + ATLASSERT (nCmdID == this->GetID()); nCmdID; // avoid level 4 warning ATLASSERT ((key) && (k_(*key) == k_FontProperties)); key; // avoid level 4 warning @@ -1647,7 +1685,7 @@ class FontCtrlImpl : public CtrlImpl } if (SUCCEEDED(hr)) - GetWndRibbon().OnRibbonFontCtrlExecute(GetID(), verb, &m_cf); + this->GetWndRibbon().OnRibbonFontCtrlExecute(this->GetID(), verb, &m_cf); else ATLASSERT(FALSE); @@ -1657,7 +1695,7 @@ class FontCtrlImpl : public CtrlImpl virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) { - if ((k_(key) == k_FontProperties) && (GetWndRibbon().OnRibbonQueryFont(t_ID, m_cf))) + if ((k_(key) == k_FontProperties) && (this->GetWndRibbon().OnRibbonQueryFont(t_ID, m_cf))) { ATL::CComQIPtr pStore(ppropvarCurrentValue->punkVal); m_cf >> pStore; @@ -1665,7 +1703,7 @@ class FontCtrlImpl : public CtrlImpl } else { - return CtrlImpl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); + return CtrlImpl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); } } }; @@ -1720,7 +1758,7 @@ class ColorCtrlImpl : public CommandCtrlImpl { PROPVARIANT var; if SUCCEEDED(InitPropVariantFromUInt32Vector(m_aColors[ic].GetData(), m_aColors[ic].GetSize(), &var)) - return SetProperty(key, var); + return this->SetProperty(key, var); else return E_INVALIDARG; } @@ -1743,7 +1781,7 @@ class ColorCtrlImpl : public CommandCtrlImpl { PROPVARIANT var; if SUCCEEDED(InitPropVariantFromStringVector(m_aTooltips[ic].GetData(), m_aTooltips[ic].GetSize(), &var)) - return SetProperty(key, var); + return this->SetProperty(key, var); else return E_INVALIDARG; } @@ -1758,7 +1796,7 @@ class ColorCtrlImpl : public CommandCtrlImpl const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, IUISimplePropertySet* pCommandExecutionProperties) { - ATLASSERT (nCmdID == GetID()); + ATLASSERT (nCmdID == this->GetID()); nCmdID; // avoid level 4 warning ATLASSERT (key && (k_(*key) == k_ColorType)); key; // avoid level 4 warning @@ -1776,7 +1814,7 @@ class ColorCtrlImpl : public CommandCtrlImpl } if SUCCEEDED(hr) - GetWndRibbon().OnRibbonColorCtrlExecute(GetID(), verb, (UI_SWATCHCOLORTYPE)m_colorType/*uType*/, m_color); + this->GetWndRibbon().OnRibbonColorCtrlExecute(this->GetID(), verb, (UI_SWATCHCOLORTYPE)m_colorType/*uType*/, m_color); else ATLASSERT(FALSE); // something was wrong @@ -1786,7 +1824,7 @@ class ColorCtrlImpl : public CommandCtrlImpl virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) { - ATLASSERT (nCmdID == GetID()); + ATLASSERT (nCmdID == this->GetID()); HRESULT hr = E_NOTIMPL; @@ -1797,7 +1835,7 @@ class ColorCtrlImpl : public CommandCtrlImpl break; case k_Color: if (m_color == 0x800080) /*MAGENTA*/ - m_color = GetWndRibbon().OnRibbonQueryColor(GetID()); + m_color = this->GetWndRibbon().OnRibbonQueryColor(this->GetID()); hr = SetPropertyVal(key, m_color, ppropvarNewValue); break; case k_ColorMode: @@ -1811,7 +1849,7 @@ class ColorCtrlImpl : public CommandCtrlImpl { const UINT iLabel = k_(key) - k_ThemeColorsCategoryLabel; if (m_sLabels[iLabel].IsEmpty()) - if (LPCWSTR psLabel = GetWndRibbon().OnRibbonQueryColorLabel(GetID(), key)) + if (LPCWSTR psLabel = this->GetWndRibbon().OnRibbonQueryColorLabel(this->GetID(), key)) m_sLabels[iLabel] = psLabel; if (!m_sLabels[iLabel].IsEmpty()) hr = SetPropertyVal(key, (LPCWSTR)m_sLabels[iLabel], ppropvarNewValue); @@ -1822,7 +1860,7 @@ class ColorCtrlImpl : public CommandCtrlImpl { const INT ic = k_(key) - k_ThemeColors; if (!m_aColors[ic].GetSize()) - if (COLORREF* pColor = GetWndRibbon().OnRibbonQueryColorArray(GetID(), key)) + if (COLORREF* pColor = this->GetWndRibbon().OnRibbonQueryColorArray(this->GetID(), key)) SetColorArray(key, pColor); if (INT iMax = m_aColors[ic].GetSize()) hr = InitPropVariantFromUInt32Vector(m_aColors[ic].GetData(), iMax, ppropvarNewValue); @@ -1833,14 +1871,14 @@ class ColorCtrlImpl : public CommandCtrlImpl { const INT ic = k_(key) - k_ThemeColorsTooltips; if (m_aTooltips[ic].GetSize() == 0) - if (LPCWSTR* ppsTT = GetWndRibbon().OnRibbonQueryColorTooltips(GetID(), key)) + if (LPCWSTR* ppsTT = this->GetWndRibbon().OnRibbonQueryColorTooltips(this->GetID(), key)) SetColorTooltips(key, ppsTT); if (INT iMax = m_aTooltips[ic].GetSize()) hr = InitPropVariantFromStringVector(m_aTooltips[ic].GetData(), iMax, ppropvarNewValue); } break; default: - hr = CommandCtrlImpl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); + hr = CommandCtrlImpl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); break; } @@ -1951,12 +1989,12 @@ class SpinnerCtrlImpl : public CtrlImpl HRESULT QueryValue(REFPROPERTYKEY key, LONG* plVal) { - return GetWndRibbon().OnRibbonQuerySpinnerValue(GetID(), key, plVal); + return this->GetWndRibbon().OnRibbonQuerySpinnerValue(this->GetID(), key, plVal) ? S_OK : S_FALSE; } HRESULT QueryValue(REFPROPERTYKEY key, DOUBLE* pdVal) { - return GetWndRibbon().OnRibbonQueryFloatSpinnerValue(GetID(), key, pdVal); + return this->GetWndRibbon().OnRibbonQueryFloatSpinnerValue(this->GetID(), key, pdVal) ? S_OK : S_FALSE; } HRESULT OnGetValue(REFPROPERTYKEY key, PROPVARIANT* ppv) @@ -1981,7 +2019,7 @@ class SpinnerCtrlImpl : public CtrlImpl HRESULT OnGetText(REFPROPERTYKEY key, Text& sVal, PROPVARIANT* ppv) { - if (LPCWSTR sNew = GetWndRibbon().OnRibbonQueryText(GetID(), key)) + if (LPCWSTR sNew = this->GetWndRibbon().OnRibbonQueryText(this->GetID(), key)) sVal = sNew; return SetPropertyVal(key, (LPCWSTR)sVal, ppv); } @@ -1990,7 +2028,7 @@ class SpinnerCtrlImpl : public CtrlImpl const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, IUISimplePropertySet* /*pCommandExecutionProperties*/) { - ATLASSERT (nCmdID == GetID()); + ATLASSERT (nCmdID == this->GetID()); nCmdID; // avoid level 4 warning ATLASSERT (key && (k_(*key) == k_DecimalValue)); key; // avoid level 4 warning @@ -2002,7 +2040,7 @@ class SpinnerCtrlImpl : public CtrlImpl HRESULT hr = UIPropertyToDecimal(UI_PKEY_DecimalValue, *ppropvarValue, &decVal); hr = InitVal(m_Values[0], &decVal); - GetWndRibbon().OnRibbonSpinnerCtrlExecute(GetID(), &m_Values[0]); + this->GetWndRibbon().OnRibbonSpinnerCtrlExecute(this->GetID(), &m_Values[0]); return hr; } @@ -2010,7 +2048,7 @@ class SpinnerCtrlImpl : public CtrlImpl virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) { - ATLASSERT (nCmdID == GetID()); + ATLASSERT (nCmdID == this->GetID()); HRESULT hr = E_NOTIMPL; switch (k_(key)) @@ -2031,7 +2069,7 @@ class SpinnerCtrlImpl : public CtrlImpl return OnGetText(key, m_RepresentativeString, ppropvarNewValue); break; default: - hr = CtrlImpl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); + hr = CtrlImpl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); break; } @@ -2085,10 +2123,10 @@ class CRibbonImpl : if (RunTimeHelper::IsRibbonUIAvailable()) hr = m_pIUIFramework.CoCreateInstance(CLSID_UIRibbonFramework); else - ATLTRACE(L"Ribbon UI not available\n"); + ATLTRACE2(atlTraceUI, 0, _T("Ribbon UI not available\n")); if FAILED(hr) - ATLTRACE(L"Ribbon construction failed\n"); + ATLTRACE2(atlTraceUI, 0, _T("Ribbon construction failed\n")); ATLASSERT(SUCCEEDED(hr)); } @@ -2473,10 +2511,10 @@ class CRibbonImpl : UI_CONTEXTAVAILABILITY OnRibbonQueryTabAvail(UINT nCmdID) { - DWORD dwState = UIGetState(nCmdID); - return ((dwState & UPDUI_DISABLED) == UPDUI_DISABLED) ? + DWORD dwState = this->UIGetState(nCmdID); + return ((dwState & CUpdateUIBase::UPDUI_DISABLED) == CUpdateUIBase::UPDUI_DISABLED) ? UI_CONTEXTAVAILABILITY_NOTAVAILABLE : - (((dwState & UPDUI_CHECKED) == UPDUI_CHECKED) ? + (((dwState & CUpdateUIBase::UPDUI_CHECKED) == CUpdateUIBase::UPDUI_CHECKED) ? UI_CONTEXTAVAILABILITY_ACTIVE : UI_CONTEXTAVAILABILITY_AVAILABLE); } @@ -2600,15 +2638,15 @@ class CRibbonImpl : bool DefRibbonQueryState(UINT nCmdID, REFPROPERTYKEY key) { - DWORD dwState = UIGetState(nCmdID); + DWORD dwState = this->UIGetState(nCmdID); bool bRet = false; switch (k_(key)) { case k_BooleanValue: - bRet = (dwState & UPDUI_CHECKED) == UPDUI_CHECKED; + bRet = (dwState & CUpdateUIBase::UPDUI_CHECKED) == CUpdateUIBase::UPDUI_CHECKED; break; case k_Enabled: - bRet = (dwState & UPDUI_DISABLED) != UPDUI_DISABLED; + bRet = (dwState & CUpdateUIBase::UPDUI_DISABLED) != CUpdateUIBase::UPDUI_DISABLED; break; default: ATLASSERT(FALSE); @@ -2623,9 +2661,9 @@ class CRibbonImpl : static WCHAR sText[RIBBONUI_MAX_TEXT] = { 0 }; if (k_(key) == k_Label) - return UIGetText(nCmdID); + return this->UIGetText(nCmdID); - if (AtlLoadString(nCmdID, sText, RIBBONUI_MAX_TEXT)) + if (ATL::AtlLoadString(nCmdID, sText, RIBBONUI_MAX_TEXT)) { PWCHAR pTitle = wcschr(sText, L'\n'); switch (k_(key)) @@ -2754,7 +2792,7 @@ class CRibbonImpl : STDMETHODIMP OnCreateUICommand(UINT32 nCmdID, UI_COMMANDTYPE typeID, IUICommandHandler** ppCommandHandler) { - UIAddRibbonElement(nCmdID); + this->UIAddRibbonElement(nCmdID); if (typeID == UI_COMMANDTYPE_CONTEXT) CUpdateUIBase::UIEnable(nCmdID, false); *ppCommandHandler = this; @@ -2763,7 +2801,7 @@ class CRibbonImpl : STDMETHODIMP OnDestroyUICommand(UINT32 nCmdID, UI_COMMANDTYPE, IUICommandHandler*) { - UIRemoveRibbonElement(nCmdID); + this->UIRemoveRibbonElement(nCmdID); return S_OK; } @@ -2856,7 +2894,7 @@ class CRibbonImpl : { if(k_(*key) != k_BooleanValue) { - ATLTRACE(L"Control ID %d is not handled\n", nCmdID); + ATLTRACE2(atlTraceUI, 0, _T("Control ID %d is not handled\n"), nCmdID); return E_NOTIMPL; } BOOL bChecked = FALSE; @@ -2992,7 +3030,7 @@ class CRibbonImpl : public: CRibbonFloatSpinnerCtrl() { - m_Values[4] = 1; // 1 decimal + this->m_Values[4] = 1; // 1 decimal } }; @@ -3013,13 +3051,14 @@ template __declspec(selectany) T* CRibbonImpl::pWndRibbon; // Control map element -#pragma warning (disable : 4510 610) // missing default constructor +#pragma warning(push) +#pragma warning(disable: 4510 610 4512) // missing default constructor, can't be instatiated, assignment operator could not be generated typedef struct { UINT uID; ICtrl& ctrl; } _ribbonCtrl; -#pragma warning (default : 4510 610) // missing default constructor +#pragma warning(pop) }; // namespace RibbonUI @@ -3029,12 +3068,12 @@ typedef struct // Control map macros #define BEGIN_RIBBON_CONTROL_MAP(theClass) \ - RibbonUI::ICtrl& GetRibbonCtrl(UINT id) \ + WTL::RibbonUI::ICtrl& GetRibbonCtrl(UINT id) \ { \ - RibbonUI::_ribbonCtrl _ctrls[] = \ + WTL::RibbonUI::_ribbonCtrl _ctrls[] = \ { -#define RIBBON_CONTROL(member) {member.GetID(), static_cast(member)}, +#define RIBBON_CONTROL(member) {member.GetID(), static_cast(member)}, #define END_RIBBON_CONTROL_MAP() \ {0, *this} \ @@ -3048,7 +3087,7 @@ typedef struct // Control message map macros #define RIBBON_GALLERY_CONTROL_HANDLER(id, func) \ - if(uMsg == WM_COMMAND && id == LOWORD(wParam)) \ + if((uMsg == WM_COMMAND) && (id == LOWORD(wParam))) \ { \ bHandled = TRUE; \ lResult = func((UI_EXECUTIONVERB)HIWORD(wParam), LOWORD(wParam), (UINT)lParam, bHandled); \ @@ -3060,7 +3099,7 @@ typedef struct RIBBON_GALLERY_CONTROL_HANDLER(id, func) #define RIBBON_FONT_CONTROL_HANDLER(id, func) \ - if(uMsg == WM_COMMAND && id == LOWORD(wParam)) \ + if((uMsg == WM_COMMAND) && (id == LOWORD(wParam))) \ { \ bHandled = TRUE; \ lResult = func((UI_EXECUTIONVERB)HIWORD(wParam), LOWORD(wParam), (CHARFORMAT2*)lParam, bHandled); \ @@ -3069,7 +3108,7 @@ typedef struct } #define RIBBON_COLOR_CONTROL_HANDLER(id, func) \ - if(uMsg == WM_COMMAND && id == LOWORD(wParam)) \ + if((uMsg == WM_COMMAND) && (id == LOWORD(wParam))) \ { \ bHandled = TRUE; \ lResult = func((UI_EXECUTIONVERB)HIWORD(wParam), LOWORD(wParam), (COLORREF)lParam, bHandled); \ @@ -3078,7 +3117,7 @@ typedef struct } #define RIBBON_SPINNER_CONTROL_HANDLER(id, func) \ - if(uMsg == WM_COMMAND && id == wParam) \ + if((uMsg == WM_COMMAND) && (id == wParam)) \ { \ bHandled = TRUE; \ lResult = func((WORD)wParam, (LONG)lParam, bHandled); \ @@ -3087,7 +3126,7 @@ typedef struct } #define RIBBON_FLOATSPINNER_CONTROL_HANDLER(id, func) \ - if(uMsg == WM_COMMAND && id == wParam) \ + if((uMsg == WM_COMMAND) && (id == wParam)) \ { \ bHandled = TRUE; \ lResult = func((WORD)wParam, (DOUBLE*)lParam, bHandled); \ @@ -3133,14 +3172,14 @@ class ATL_NO_VTABLE CRibbonFrameWindowImplBase : public TFrameImpl, public Ribbo void ResetFrame() { const MARGINS margins = { 0 }; - ::DwmExtendFrameIntoClientArea(m_hWnd, &margins); + ::DwmExtendFrameIntoClientArea(this->m_hWnd, &margins); } INT CalcWin7Fix() { ResetFrame(); RECT rc = { 0 }; - ::AdjustWindowRectEx(&rc, T::GetWndStyle(0), GetMenu() != NULL, T::GetWndExStyle(0)); + ::AdjustWindowRectEx(&rc, T::GetWndStyle(0), this->GetMenu() != NULL, T::GetWndExStyle(0)); return -rc.top; } @@ -3222,11 +3261,11 @@ class ATL_NO_VTABLE CRibbonFrameWindowImplBase : public TFrameImpl, public Ribbo return (HBITMAP)::CopyImage(hbm, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION); } - return DefRibbonQueryImage(nCmdID); + return this->DefRibbonQueryImage(nCmdID); } BEGIN_MSG_MAP(CRibbonFrameWindowImplBase) - if (!IsRibbonUI() && NeedWin7Fix()) + if (!this->IsRibbonUI() && NeedWin7Fix()) { MESSAGE_HANDLER(WM_SIZING, OnSizing) MESSAGE_HANDLER(WM_SIZE, OnSize) @@ -3245,10 +3284,10 @@ class ATL_NO_VTABLE CRibbonFrameWindowImplBase : public TFrameImpl, public Ribbo case WMSZ_TOP: case WMSZ_TOPLEFT: case WMSZ_TOPRIGHT: - SetWindowPos(NULL, (LPRECT)lParam, SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED); + this->SetWindowPos(NULL, (LPRECT)lParam, SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED); break; default: - DefWindowProc(); + this->DefWindowProc(); break; } @@ -3258,7 +3297,7 @@ class ATL_NO_VTABLE CRibbonFrameWindowImplBase : public TFrameImpl, public Ribbo LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { if (wParam != SIZE_MINIMIZED) - SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); + this->SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); bHandled = FALSE; return 1; @@ -3267,7 +3306,7 @@ class ATL_NO_VTABLE CRibbonFrameWindowImplBase : public TFrameImpl, public Ribbo LRESULT OnActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { if(wParam != WA_INACTIVE) - SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); + this->SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); bHandled = FALSE; return 1; @@ -3275,9 +3314,9 @@ class ATL_NO_VTABLE CRibbonFrameWindowImplBase : public TFrameImpl, public Ribbo LRESULT OnNCCalcSize(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { - ATLASSERT(!IsRibbonUI() && NeedWin7Fix()); + ATLASSERT(!this->IsRibbonUI() && NeedWin7Fix()); - LRESULT lRet = DefWindowProc(); + LRESULT lRet = this->DefWindowProc(); if(wParam) { @@ -3292,23 +3331,23 @@ class ATL_NO_VTABLE CRibbonFrameWindowImplBase : public TFrameImpl, public Ribbo void UpdateLayout(BOOL bResizeBars = TRUE) { RECT rect = { 0 }; - GetClientRect(&rect); + this->GetClientRect(&rect); - if (IsRibbonUI() && !IsRibbonHidden()) + if (this->IsRibbonUI() && !this->IsRibbonHidden()) { - rect.top += GetRibbonHeight(); + rect.top += this->GetRibbonHeight(); } - else if (!IsRibbonUI() && NeedWin7Fix()) + else if (!this->IsRibbonUI() && NeedWin7Fix()) { ResetFrame(); } // position bars and offset their dimensions - UpdateBarsPosition(rect, bResizeBars); + this->UpdateBarsPosition(rect, bResizeBars); // resize client window - if(m_hWndClient != NULL) - ::SetWindowPos(m_hWndClient, NULL, rect.left, rect.top, + if(this->m_hWndClient != NULL) + ::SetWindowPos(this->m_hWndClient, NULL, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_NOACTIVATE); } @@ -3357,11 +3396,11 @@ class CRibbonPersist ATLASSERT(m_Key.m_hKey); } - CRegKeyEx m_Key; + ATL::CRegKey m_Key; LONG Save(bool bRibbonUI, HGLOBAL hgSettings = NULL) { - CRegKeyEx key; + ATL::CRegKey key; const DWORD dwUI = bRibbonUI; LONG lRet = key.Create(m_Key, L"Ribbon"); @@ -3393,7 +3432,7 @@ class CRibbonPersist { ATLASSERT(hgSettings == NULL); - CRegKeyEx key; + ATL::CRegKey key; LONG lRet = key.Open(m_Key, L"Ribbon"); if(lRet != ERROR_SUCCESS) diff --git a/thirdparty/wtl/atlscrl.h b/thirdparty/wtl/atlscrl.h index e93d07b..ffcb8f2 100644 --- a/thirdparty/wtl/atlscrl.h +++ b/thirdparty/wtl/atlscrl.h @@ -1,13 +1,10 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. +// Windows Template Library - WTL version 10.0 +// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. +// Microsoft Public License (http://opensource.org/licenses/MS-PL) +// which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLSCRL_H__ #define __ATLSCRL_H__ @@ -22,14 +19,6 @@ #error atlscrl.h requires atlwin.h to be included first #endif -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - #include -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - -#ifndef GET_WHEEL_DELTA_WPARAM - #define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam)) -#endif - /////////////////////////////////////////////////////////////////////////////// // Classes in this file: @@ -54,9 +43,7 @@ namespace WTL #define SCRL_SCROLLCHILDREN 0x00000001 #define SCRL_ERASEBACKGROUND 0x00000002 #define SCRL_NOTHUMBTRACKING 0x00000004 -#if (WINVER >= 0x0500) #define SCRL_SMOOTHSCROLL 0x00000008 -#endif // (WINVER >= 0x0500) #define SCRL_DISABLENOSCROLLV 0x00000010 #define SCRL_DISABLENOSCROLLH 0x00000020 #define SCRL_DISABLENOSCROLL (SCRL_DISABLENOSCROLLV | SCRL_DISABLENOSCROLLH) @@ -75,10 +62,6 @@ class CScrollImpl SIZE m_sizeClient; int m_zDelta; // current wheel value int m_nWheelLines; // number of lines to scroll on wheel -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - // Note that this message must be forwarded from a top level window - UINT m_uMsgMouseWheel; // MSH_MOUSEWHEEL -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) int m_zHDelta; // current horizontal wheel value int m_nHWheelChars; // number of chars to scroll on horizontal wheel UINT m_uScrollFlags; @@ -86,9 +69,6 @@ class CScrollImpl // Constructor CScrollImpl() : m_zDelta(0), m_nWheelLines(3), -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - m_uMsgMouseWheel(0U), -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) m_zHDelta(0), m_nHWheelChars(3), m_uScrollFlags(0U), m_dwExtendedStyle(0) { @@ -123,9 +103,7 @@ class CScrollImpl T* pT = static_cast(this); pT; // avoid level 4 warning m_uScrollFlags = pT->uSCROLL_FLAGS | (IsScrollingChildren() ? SW_SCROLLCHILDREN : 0) | (IsErasingBackground() ? SW_ERASE : 0); -#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) m_uScrollFlags |= (IsSmoothScroll() ? SW_SMOOTHSCROLL : 0); -#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) return dwPrevStyle; } @@ -163,7 +141,7 @@ class CScrollImpl } // Move all children if needed - if(IsScrollingChildren() && (dx != 0 || dy != 0)) + if(IsScrollingChildren() && ((dx != 0) || (dy != 0))) { for(HWND hWndChild = ::GetWindow(pT->m_hWnd, GW_CHILD); hWndChild != NULL; hWndChild = ::GetWindow(hWndChild, GW_HWNDNEXT)) { @@ -238,7 +216,7 @@ class CScrollImpl } // Move all children if needed - if(IsScrollingChildren() && (dx != 0 || dy != 0)) + if(IsScrollingChildren() && ((dx != 0) || (dy != 0))) { for(HWND hWndChild = ::GetWindow(pT->m_hWnd, GW_CHILD); hWndChild != NULL; hWndChild = ::GetWindow(hWndChild, GW_HWNDNEXT)) { @@ -269,8 +247,8 @@ class CScrollImpl // line operations void SetScrollLine(int cxLine, int cyLine) { - ATLASSERT(cxLine >= 0 && cyLine >= 0); - ATLASSERT(m_sizeAll.cx != 0 && m_sizeAll.cy != 0); + ATLASSERT((cxLine >= 0) && (cyLine >= 0)); + ATLASSERT((m_sizeAll.cx != 0) && (m_sizeAll.cy != 0)); m_sizeLine.cx = T::CalcLineOrPage(cxLine, m_sizeAll.cx, 100); m_sizeLine.cy = T::CalcLineOrPage(cyLine, m_sizeAll.cy, 100); @@ -289,8 +267,8 @@ class CScrollImpl // page operations void SetScrollPage(int cxPage, int cyPage) { - ATLASSERT(cxPage >= 0 && cyPage >= 0); - ATLASSERT(m_sizeAll.cx != 0 && m_sizeAll.cy != 0); + ATLASSERT((cxPage >= 0) && (cyPage >= 0)); + ATLASSERT((m_sizeAll.cx != 0) && (m_sizeAll.cy != 0)); m_sizePage.cx = T::CalcLineOrPage(cxPage, m_sizeAll.cx, 10); m_sizePage.cy = T::CalcLineOrPage(cyPage, m_sizeAll.cy, 10); @@ -430,6 +408,7 @@ class CScrollImpl RECT rect = { 0 }; ::GetWindowRect(hWnd, &rect); + ::OffsetRect(&rect, m_ptOffset.x, m_ptOffset.y); ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rect, 2); ScrollToView(rect); } @@ -439,16 +418,11 @@ class CScrollImpl MESSAGE_HANDLER(WM_VSCROLL, OnVScroll) MESSAGE_HANDLER(WM_HSCROLL, OnHScroll) MESSAGE_HANDLER(WM_MOUSEWHEEL, OnMouseWheel) -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - MESSAGE_HANDLER(m_uMsgMouseWheel, OnMouseWheel) -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) MESSAGE_HANDLER(WM_MOUSEHWHEEL, OnMouseHWheel) MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) MESSAGE_HANDLER(WM_SIZE, OnSize) MESSAGE_HANDLER(WM_PAINT, OnPaint) -#ifndef _WIN32_WCE MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) -#endif // !_WIN32_WCE // standard scroll commands ALT_MSG_MAP(1) COMMAND_ID_HANDLER(ID_SCROLL_UP, OnScrollUp) @@ -467,7 +441,9 @@ class CScrollImpl LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { - GetSystemSettings(); + T* pT = static_cast(this); + pT->GetSystemSettings(); + bHandled = FALSE; return 1; } @@ -488,17 +464,12 @@ class CScrollImpl return 0; } - LRESULT OnMouseWheel(UINT uMsg, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) + LRESULT OnMouseWheel(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); -#if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400) || defined(_WIN32_WCE) - uMsg; int zDelta = (int)GET_WHEEL_DELTA_WPARAM(wParam); -#else - int zDelta = (uMsg == WM_MOUSEWHEEL) ? (int)GET_WHEEL_DELTA_WPARAM(wParam) : (int)wParam; -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400) || defined(_WIN32_WCE)) int nScrollCode = (m_nWheelLines == WHEEL_PAGESCROLL) ? ((zDelta > 0) ? SB_PAGEUP : SB_PAGEDOWN) : ((zDelta > 0) ? SB_LINEUP : SB_LINEDOWN); m_zDelta += zDelta; // cumulative int zTotal = (m_nWheelLines == WHEEL_PAGESCROLL) ? abs(m_zDelta) : abs(m_zDelta) * m_nWheelLines; @@ -510,7 +481,7 @@ class CScrollImpl pT->UpdateWindow(); } } - else // can't scroll vertically, scroll horizontally + else if(m_sizeAll.cx > m_sizeClient.cx) // can't scroll vertically, scroll horizontally { for(int i = 0; i < zTotal; i += WHEEL_DELTA) { @@ -556,43 +527,7 @@ class CScrollImpl T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); - m_sizeClient.cx = GET_X_LPARAM(lParam); - m_sizeClient.cy = GET_Y_LPARAM(lParam); - - // block: set horizontal scroll bar - { - SCROLLINFO si = { sizeof(SCROLLINFO) }; - si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; - si.nMin = 0; - si.nMax = m_sizeAll.cx - 1; - if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLH) != 0) - si.fMask |= SIF_DISABLENOSCROLL; - si.nPage = m_sizeClient.cx; - si.nPos = m_ptOffset.x; - pT->SetScrollInfo(SB_HORZ, &si, TRUE); - } - - // block: set vertical scroll bar - { - SCROLLINFO si = { sizeof(SCROLLINFO) }; - si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; - si.nMin = 0; - si.nMax = m_sizeAll.cy - 1; - if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLV) != 0) - si.fMask |= SIF_DISABLENOSCROLL; - si.nPage = m_sizeClient.cy; - si.nPos = m_ptOffset.y; - pT->SetScrollInfo(SB_VERT, &si, TRUE); - } - - int x = m_ptOffset.x; - int y = m_ptOffset.y; - if(pT->AdjustScrollOffset(x, y)) - { - // Children will be moved in SetScrollOffset, if needed - pT->ScrollWindowEx(m_ptOffset.x - x, m_ptOffset.y - y, (m_uScrollFlags & ~SCRL_SCROLLCHILDREN)); - SetScrollOffset(x, y, FALSE); - } + pT->DoSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); bHandled = FALSE; return 1; @@ -700,6 +635,49 @@ class CScrollImpl } // Implementation + void DoSize(int cx, int cy) + { + m_sizeClient.cx = cx; + m_sizeClient.cy = cy; + + T* pT = static_cast(this); + + // block: set horizontal scroll bar + { + SCROLLINFO si = { sizeof(SCROLLINFO) }; + si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; + si.nMin = 0; + si.nMax = m_sizeAll.cx - 1; + if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLH) != 0) + si.fMask |= SIF_DISABLENOSCROLL; + si.nPage = m_sizeClient.cx; + si.nPos = m_ptOffset.x; + pT->SetScrollInfo(SB_HORZ, &si, TRUE); + } + + // block: set vertical scroll bar + { + SCROLLINFO si = { sizeof(SCROLLINFO) }; + si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; + si.nMin = 0; + si.nMax = m_sizeAll.cy - 1; + if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLV) != 0) + si.fMask |= SIF_DISABLENOSCROLL; + si.nPage = m_sizeClient.cy; + si.nPos = m_ptOffset.y; + pT->SetScrollInfo(SB_VERT, &si, TRUE); + } + + int x = m_ptOffset.x; + int y = m_ptOffset.y; + if(pT->AdjustScrollOffset(x, y)) + { + // Children will be moved in SetScrollOffset, if needed + pT->ScrollWindowEx(m_ptOffset.x - x, m_ptOffset.y - y, (m_uScrollFlags & ~SCRL_SCROLLCHILDREN)); + SetScrollOffset(x, y, FALSE); + } + } + void DoScroll(int nType, int nScrollCode, int& cxyOffset, int cxySizeAll, int cxySizePage, int cxySizeLine) { T* pT = static_cast(this); @@ -792,7 +770,7 @@ class CScrollImpl break; } - if(bUpdate && cxyScroll != 0) + if(bUpdate && (cxyScroll != 0)) { pT->SetScrollPos(nType, cxyOffset, TRUE); if(nType == SB_VERT) @@ -835,35 +813,17 @@ class CScrollImpl else if(y < 0) y = 0; - return (x != xOld || y != yOld); + return ((x != xOld) || (y != yOld)); } void GetSystemSettings() { -#ifndef _WIN32_WCE -#ifndef SPI_GETWHEELSCROLLLINES - const UINT SPI_GETWHEELSCROLLLINES = 104; -#endif // !SPI_GETWHEELSCROLLLINES ::SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &m_nWheelLines, 0); #ifndef SPI_GETWHEELSCROLLCHARS const UINT SPI_GETWHEELSCROLLCHARS = 0x006C; -#endif // !SPI_GETWHEELSCROLLCHARS +#endif ::SystemParametersInfo(SPI_GETWHEELSCROLLCHARS, 0, &m_nHWheelChars, 0); - -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - if(m_uMsgMouseWheel != 0) - m_uMsgMouseWheel = ::RegisterWindowMessage(MSH_MOUSEWHEEL); - - HWND hWndWheel = FindWindow(MSH_WHEELMODULE_CLASS, MSH_WHEELMODULE_TITLE); - if(::IsWindow(hWndWheel)) - { - UINT uMsgScrollLines = ::RegisterWindowMessage(MSH_SCROLL_LINES); - if(uMsgScrollLines != 0) - m_nWheelLines = (int)::SendMessage(hWndWheel, uMsgScrollLines, 0, 0L); - } -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) -#endif // !_WIN32_WCE } bool IsScrollingChildren() const @@ -881,12 +841,10 @@ class CScrollImpl return (m_dwExtendedStyle & SCRL_NOTHUMBTRACKING) != 0; } -#if (WINVER >= 0x0500) bool IsSmoothScroll() const { return (m_dwExtendedStyle & SCRL_SMOOTHSCROLL) != 0; } -#endif // (WINVER >= 0x0500) }; @@ -897,20 +855,31 @@ template , public CScrollImpl< T > { public: + BOOL SubclassWindow(HWND hWnd) + { + BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits >::SubclassWindow(hWnd); + if(bRet != FALSE) + { + T* pT = static_cast(this); + pT->GetSystemSettings(); + + RECT rect = { 0 }; + GetClientRect(&rect); + pT->DoSize(rect.right, rect.bottom); + } + + return bRet; + } + BEGIN_MSG_MAP(CScrollWindowImpl) MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) - MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel) -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) && !defined(_WIN32_WCE) MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) MESSAGE_HANDLER(WM_SIZE, CScrollImpl< T >::OnSize) MESSAGE_HANDLER(WM_PAINT, CScrollImpl< T >::OnPaint) -#ifndef _WIN32_WCE MESSAGE_HANDLER(WM_PRINTCLIENT, CScrollImpl< T >::OnPaint) -#endif // !_WIN32_WCE ALT_MSG_MAP(1) COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl< T >::OnScrollUp) COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl< T >::OnScrollDown) @@ -931,8 +900,6 @@ class ATL_NO_VTABLE CScrollWindowImpl : public ATL::CWindowImpl class CMapScrollImpl : public CScrollImpl< T > { @@ -956,20 +923,20 @@ class CMapScrollImpl : public CScrollImpl< T > // mapping mode operations void SetScrollMapMode(int nMapMode) { - ATLASSERT(nMapMode >= MM_MIN && nMapMode <= MM_MAX_FIXEDSCALE); + ATLASSERT((nMapMode >= MM_MIN) && (nMapMode <= MM_MAX_FIXEDSCALE)); m_nMapMode = nMapMode; } int GetScrollMapMode() const { - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); + ATLASSERT((m_nMapMode >= MM_MIN) && (m_nMapMode <= MM_MAX_FIXEDSCALE)); return m_nMapMode; } // offset operations void SetScrollOffset(int x, int y, BOOL bRedraw = TRUE) { - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); + ATLASSERT((m_nMapMode >= MM_MIN) && (m_nMapMode <= MM_MAX_FIXEDSCALE)); POINT ptOff = { x, y }; // block: convert logical to device units { @@ -987,7 +954,7 @@ class CMapScrollImpl : public CScrollImpl< T > void GetScrollOffset(POINT& ptOffset) const { - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); + ATLASSERT((m_nMapMode >= MM_MIN) && (m_nMapMode <= MM_MAX_FIXEDSCALE)); ptOffset = m_ptOffset; // block: convert device to logical units { @@ -1000,8 +967,8 @@ class CMapScrollImpl : public CScrollImpl< T > // size operations void SetScrollSize(int xMin, int yMin, int xMax, int yMax, BOOL bRedraw = TRUE, bool bResetOffset = true) { - ATLASSERT(xMax > xMin && yMax > yMin); - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); + ATLASSERT((xMax > xMin) && (yMax > yMin)); + ATLASSERT((m_nMapMode >= MM_MIN) && (m_nMapMode <= MM_MAX_FIXEDSCALE)); ::SetRect(&m_rectLogAll, xMin, yMin, xMax, yMax); @@ -1036,15 +1003,15 @@ class CMapScrollImpl : public CScrollImpl< T > void GetScrollSize(RECT& rcScroll) const { - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); + ATLASSERT((m_nMapMode >= MM_MIN) && (m_nMapMode <= MM_MAX_FIXEDSCALE)); rcScroll = m_rectLogAll; } // line operations void SetScrollLine(int cxLine, int cyLine) { - ATLASSERT(cxLine >= 0 && cyLine >= 0); - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); + ATLASSERT((cxLine >= 0) && (cyLine >= 0)); + ATLASSERT((m_nMapMode >= MM_MIN) && (m_nMapMode <= MM_MAX_FIXEDSCALE)); m_sizeLogLine.cx = cxLine; m_sizeLogLine.cy = cyLine; @@ -1065,15 +1032,15 @@ class CMapScrollImpl : public CScrollImpl< T > void GetScrollLine(SIZE& sizeLine) const { - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); + ATLASSERT((m_nMapMode >= MM_MIN) && (m_nMapMode <= MM_MAX_FIXEDSCALE)); sizeLine = m_sizeLogLine; } // page operations void SetScrollPage(int cxPage, int cyPage) { - ATLASSERT(cxPage >= 0 && cyPage >= 0); - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); + ATLASSERT((cxPage >= 0) && (cyPage >= 0)); + ATLASSERT((m_nMapMode >= MM_MIN) && (m_nMapMode <= MM_MAX_FIXEDSCALE)); m_sizeLogPage.cx = cxPage; m_sizeLogPage.cy = cyPage; @@ -1094,7 +1061,7 @@ class CMapScrollImpl : public CScrollImpl< T > void GetScrollPage(SIZE& sizePage) const { - ATLASSERT(m_nMapMode >= MM_MIN && m_nMapMode <= MM_MAX_FIXEDSCALE); + ATLASSERT((m_nMapMode >= MM_MIN) && (m_nMapMode <= MM_MAX_FIXEDSCALE)); sizePage = m_sizeLogPage; } @@ -1102,9 +1069,6 @@ class CMapScrollImpl : public CScrollImpl< T > MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel) -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) MESSAGE_HANDLER(WM_SIZE, CScrollImpl< T >::OnSize) @@ -1136,9 +1100,9 @@ class CMapScrollImpl : public CScrollImpl< T > dc.SetMapMode(m_nMapMode); POINT ptViewportOrg = { 0, 0 }; if(m_nMapMode == MM_TEXT) - dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y, &ptViewportOrg); + dc.SetViewportOrg(-this->m_ptOffset.x, -this->m_ptOffset.y, &ptViewportOrg); else - dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y + m_sizeAll.cy, &ptViewportOrg); + dc.SetViewportOrg(-this->m_ptOffset.x, -this->m_ptOffset.y + this->m_sizeAll.cy, &ptViewportOrg); POINT ptWindowOrg = { 0, 0 }; dc.SetWindowOrg(m_rectLogAll.left, m_rectLogAll.top, &ptWindowOrg); @@ -1153,9 +1117,9 @@ class CMapScrollImpl : public CScrollImpl< T > CPaintDC dc(pT->m_hWnd); dc.SetMapMode(m_nMapMode); if(m_nMapMode == MM_TEXT) - dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y); + dc.SetViewportOrg(-this->m_ptOffset.x, -this->m_ptOffset.y); else - dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y + m_sizeAll.cy); + dc.SetViewportOrg(-this->m_ptOffset.x, -this->m_ptOffset.y + this->m_sizeAll.cy); dc.SetWindowOrg(m_rectLogAll.left, m_rectLogAll.top); pT->DoPaint(dc.m_hDC); } @@ -1163,25 +1127,34 @@ class CMapScrollImpl : public CScrollImpl< T > } }; -#endif // !_WIN32_WCE - /////////////////////////////////////////////////////////////////////////////// // CMapScrollWindowImpl - Implements scrolling window with mapping -#ifndef _WIN32_WCE - template class ATL_NO_VTABLE CMapScrollWindowImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CMapScrollImpl< T > { public: + BOOL SubclassWindow(HWND hWnd) + { + BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits >::SubclassWindow(hWnd); + if(bRet != FALSE) + { + T* pT = static_cast(this); + pT->GetSystemSettings(); + + RECT rect = { 0 }; + GetClientRect(&rect); + pT->DoSize(rect.right, rect.bottom); + } + + return bRet; + } + BEGIN_MSG_MAP(CMapScrollWindowImpl) MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel) -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) MESSAGE_HANDLER(WM_SIZE, CScrollImpl< T >::OnSize) @@ -1203,13 +1176,11 @@ class ATL_NO_VTABLE CMapScrollWindowImpl : public ATL::CWindowImpl< T, TBase, TW END_MSG_MAP() }; -#endif // !_WIN32_WCE - /////////////////////////////////////////////////////////////////////////////// // CFSBWindow - Use as a base instead of CWindow to get flat scroll bar support -#if defined(__ATLCTRLS_H__) && (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) +#ifdef __ATLCTRLS_H__ template class CFSBWindowT : public TBase, public CFlatScrollBarImpl > @@ -1229,33 +1200,31 @@ class CFSBWindowT : public TBase, public CFlatScrollBarImpl // (only those methods that are used by scroll window classes) int SetScrollPos(int nBar, int nPos, BOOL bRedraw = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return FlatSB_SetScrollPos(nBar, nPos, bRedraw); + ATLASSERT(::IsWindow(this->m_hWnd)); + return this->FlatSB_SetScrollPos(nBar, nPos, bRedraw); } BOOL GetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo) { - ATLASSERT(::IsWindow(m_hWnd)); - return FlatSB_GetScrollInfo(nBar, lpScrollInfo); + ATLASSERT(::IsWindow(this->m_hWnd)); + return this->FlatSB_GetScrollInfo(nBar, lpScrollInfo); } BOOL SetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo, BOOL bRedraw = TRUE) { - ATLASSERT(::IsWindow(m_hWnd)); - return FlatSB_SetScrollInfo(nBar, lpScrollInfo, bRedraw); + ATLASSERT(::IsWindow(this->m_hWnd)); + return this->FlatSB_SetScrollInfo(nBar, lpScrollInfo, bRedraw); } }; typedef CFSBWindowT CFSBWindow; -#endif // defined(__ATLCTRLS_H__) && (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE) +#endif // __ATLCTRLS_H__ /////////////////////////////////////////////////////////////////////////////// // CZoomScrollImpl - Provides zooming and scrolling support to any window -#ifndef _WIN32_WCE - // The zoom modes that can be set with the SetZoomMode method enum { @@ -1273,24 +1242,35 @@ class CZoomScrollImpl : public CScrollImpl< T > public: enum { m_cxyMinZoomRect = 12 }; // min rect size to zoom in on rect. + struct _ChildPlacement + { + HWND hWnd; + int x; + int y; + int cx; + int cy; + + bool operator ==(const _ChildPlacement& cp) const { return (memcmp(this, &cp, sizeof(_ChildPlacement)) == 0); } + }; + // Data members SIZE m_sizeLogAll; SIZE m_sizeLogLine; SIZE m_sizeLogPage; float m_fZoomScale; float m_fZoomScaleMin; + float m_fZoomScaleMax; float m_fZoomDelta; // Used in ZOOMMODE_IN and ZOOMMODE_OUT on left-button click. int m_nZoomMode; RECT m_rcTrack; bool m_bTracking; + bool m_bZoomChildren; + ATL::CSimpleArray<_ChildPlacement> m_arrChildren; + // Constructor - CZoomScrollImpl(): - m_fZoomScale(1.0), - m_fZoomScaleMin(0.5), - m_fZoomDelta(0.5), - m_nZoomMode(ZOOMMODE_OFF), - m_bTracking(false) + CZoomScrollImpl(): m_fZoomScale(1.0f), m_fZoomScaleMin(0.1f), m_fZoomScaleMax(100.0f), m_fZoomDelta(0.5f), + m_nZoomMode(ZOOMMODE_OFF), m_bTracking(false), m_bZoomChildren(false) { m_sizeLogAll.cx = 0; m_sizeLogAll.cy = 0; @@ -1302,14 +1282,13 @@ class CZoomScrollImpl : public CScrollImpl< T > } // Attributes & Operations - // size operations void SetScrollSize(int cxLog, int cyLog, BOOL bRedraw = TRUE, bool bResetOffset = true) { - ATLASSERT(cxLog >= 0 && cyLog >= 0); + ATLASSERT((cxLog >= 0) && (cyLog >= 0)); // Set up the defaults - if (cxLog == 0 && cyLog == 0) + if((cxLog == 0) && (cyLog == 0)) { cxLog = 1; cyLog = 1; @@ -1337,7 +1316,7 @@ class CZoomScrollImpl : public CScrollImpl< T > // line operations void SetScrollLine(int cxLogLine, int cyLogLine) { - ATLASSERT(cxLogLine >= 0 && cyLogLine >= 0); + ATLASSERT((cxLogLine >= 0) && (cyLogLine >= 0)); m_sizeLogLine.cx = cxLogLine; m_sizeLogLine.cy = cyLogLine; @@ -1361,7 +1340,7 @@ class CZoomScrollImpl : public CScrollImpl< T > // page operations void SetScrollPage(int cxLogPage, int cyLogPage) { - ATLASSERT(cxLogPage >= 0 && cyLogPage >= 0); + ATLASSERT((cxLogPage >= 0) && (cyLogPage >= 0)); m_sizeLogPage.cx = cxLogPage; m_sizeLogPage.cy = cyLogPage; @@ -1385,10 +1364,15 @@ class CZoomScrollImpl : public CScrollImpl< T > void SetZoomScale(float fZoomScale) { - ATLASSERT(fZoomScale > 0); + ATLASSERT(fZoomScale > 0.0f); + if(fZoomScale <= 0.0f) + return; - if(fZoomScale > 0 && fZoomScale >= m_fZoomScaleMin) - m_fZoomScale = fZoomScale; + m_fZoomScale = fZoomScale; + if(m_fZoomScale < m_fZoomScaleMin) + m_fZoomScale = m_fZoomScaleMin; + else if(m_fZoomScale > m_fZoomScaleMax) + m_fZoomScale = m_fZoomScaleMax; } float GetZoomScale() const @@ -1398,6 +1382,9 @@ class CZoomScrollImpl : public CScrollImpl< T > void SetZoomScaleMin(float fZoomScaleMin) { + ATLASSERT(fZoomScaleMin > 0.0f); + ATLASSERT(fZoomScaleMin <= m_fZoomScaleMax); + m_fZoomScaleMin = fZoomScaleMin; } @@ -1406,11 +1393,24 @@ class CZoomScrollImpl : public CScrollImpl< T > return m_fZoomScaleMin; } + void SetZoomScaleMax(float fZoomScaleMax) + { + ATLASSERT(fZoomScaleMax > 0.0f); + ATLASSERT(m_fZoomScaleMin <= fZoomScaleMax); + + m_fZoomScaleMax = fZoomScaleMax; + } + + float GetZoomScaleMax() const + { + return m_fZoomScaleMax; + } + void SetZoomDelta(float fZoomDelta) { - ATLASSERT(fZoomDelta >= 0); + ATLASSERT(fZoomDelta >= 0.0f); - if(fZoomDelta >= 0) + if(fZoomDelta >= 0.0f) m_fZoomDelta = fZoomDelta; } @@ -1429,12 +1429,47 @@ class CZoomScrollImpl : public CScrollImpl< T > return m_nZoomMode; } + void SetZoomChildren(bool bEnable = true) + { + T* pT = static_cast(this); + ATLASSERT(::IsWindow(pT->m_hWnd)); + + m_bZoomChildren = bEnable; + + m_arrChildren.RemoveAll(); + if(m_bZoomChildren) + { + for(HWND hWndChild = ::GetWindow(pT->m_hWnd, GW_CHILD); hWndChild != NULL; hWndChild = ::GetWindow(hWndChild, GW_HWNDNEXT)) + { + RECT rect = { 0 }; + ::GetWindowRect(hWndChild, &rect); + ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rect, 2); + + _ChildPlacement cp = { 0 }; + cp.hWnd = hWndChild; + cp.x = rect.left; + cp.y = rect.top; + cp.cx = rect.right - rect.left; + cp.cy = rect.bottom - rect.top; + m_arrChildren.Add(cp); + } + } + } + + bool GetZoomChildren() const + { + return m_bZoomChildren; + } + void Zoom(int x, int y, float fZoomScale) { - if(fZoomScale <= 0) + if(fZoomScale <= 0.0f) return; - fZoomScale = max(fZoomScale, m_fZoomScaleMin); + if(fZoomScale < m_fZoomScaleMin) + fZoomScale = m_fZoomScaleMin; + else if(fZoomScale > m_fZoomScaleMax) + fZoomScale = m_fZoomScaleMax; T* pT = static_cast(this); POINT pt = { x, y }; @@ -1459,41 +1494,42 @@ class CZoomScrollImpl : public CScrollImpl< T > pT->NormalizeRect(rcZoom); SIZE size = { rcZoom.right - rcZoom.left, rcZoom.bottom - rcZoom.top }; POINT pt = { rcZoom.left + size.cx / 2, rcZoom.top + size.cy / 2 }; - if(size.cx < m_cxyMinZoomRect || size.cy < m_cxyMinZoomRect) + if((size.cx < m_cxyMinZoomRect) || (size.cy < m_cxyMinZoomRect)) { pT->Zoom(pt, m_fZoomScale + m_fZoomDelta); return; } - ATLASSERT(size.cx > 0 && size.cy > 0); + ATLASSERT((size.cx > 0) && (size.cy > 0)); - float fScaleH = (float)(m_sizeClient.cx + 1) / (float)size.cx; - float fScaleV = (float)(m_sizeClient.cy + 1) / (float)size.cy; - float fZoomScale = min(fScaleH, fScaleV) * m_fZoomScale; + float fScaleH = (float)(this->m_sizeClient.cx + 1) / (float)size.cx; + float fScaleV = (float)(this->m_sizeClient.cy + 1) / (float)size.cy; + float fZoomScale = __min(fScaleH, fScaleV) * m_fZoomScale; pT->Zoom(pt, fZoomScale); } void Zoom(float fZoomScale, bool bCenter = true) { - if(fZoomScale <= 0) + if(fZoomScale <= 0.0f) return; - fZoomScale = max(fZoomScale, m_fZoomScaleMin); - + if(fZoomScale < m_fZoomScaleMin) + fZoomScale = m_fZoomScaleMin; + else if(fZoomScale > m_fZoomScaleMax) + fZoomScale = m_fZoomScaleMax; T* pT = static_cast(this); POINT pt = { 0 }; if(bCenter) { - RECT rc; - ::GetClientRect(pT->m_hWnd, &rc); - pt.x = rc.right / 2; - pt.y = rc.bottom / 2; + RECT rcClient = { 0 }; + ::GetClientRect(pT->m_hWnd, &rcClient); + pt.x = rcClient.right / 2; + pt.y = rcClient.bottom / 2; pT->ViewDPtoLP(&pt); } // Modify the Viewport extent - m_fZoomScale = fZoomScale; SIZE sizeAll = { 0 }; sizeAll.cx = (int)((float)m_sizeLogAll.cx * fZoomScale); sizeAll.cy = (int)((float)m_sizeLogAll.cy * fZoomScale); @@ -1501,18 +1537,55 @@ class CZoomScrollImpl : public CScrollImpl< T > // Update scroll bars and window CScrollImpl< T >::SetScrollSize(sizeAll); + // Zoom all children if needed + if(m_bZoomChildren && (m_fZoomScale != fZoomScale)) + { + for(int i = 0; i < m_arrChildren.GetSize(); i++) + { + ATLASSERT(::IsWindow(m_arrChildren[i].hWnd)); + + ::SetWindowPos(m_arrChildren[i].hWnd, NULL, + (int)((float)m_arrChildren[i].x * fZoomScale + 0.5f), + (int)((float)m_arrChildren[i].y * fZoomScale + 0.5f), + (int)((float)m_arrChildren[i].cx * fZoomScale + 0.5f), + (int)((float)m_arrChildren[i].cy * fZoomScale + 0.5f), + SWP_NOZORDER | SWP_NOACTIVATE); + } + } + + // Set new zoom scale + m_fZoomScale = fZoomScale; + if(bCenter) pT->CenterOnLogicalPoint(pt); } + void ZoomIn(bool bCenter = true) + { + T* pT = static_cast(this); + pT->Zoom(m_fZoomScale + m_fZoomDelta, bCenter); + } + + void ZoomOut(bool bCenter = true) + { + T* pT = static_cast(this); + pT->Zoom(m_fZoomScale - m_fZoomDelta, bCenter); + } + + void ZoomDefault(bool bCenter = true) + { + T* pT = static_cast(this); + pT->Zoom(1.0f, bCenter); + } + // Helper functions void PrepareDC(CDCHandle dc) { - ATLASSERT(m_sizeAll.cx >= 0 && m_sizeAll.cy >= 0); + ATLASSERT((this->m_sizeAll.cx >= 0) && (this->m_sizeAll.cy >= 0)); dc.SetMapMode(MM_ANISOTROPIC); - dc.SetWindowExt(m_sizeLogAll); - dc.SetViewportExt(m_sizeAll); - dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y); + dc.SetWindowExt(this->m_sizeLogAll); + dc.SetViewportExt(this->m_sizeAll); + dc.SetViewportOrg(-this->m_ptOffset.x, -this->m_ptOffset.y); } void ViewDPtoLP(LPPOINT lpPoints, int nCount = 1) @@ -1539,42 +1612,42 @@ class CZoomScrollImpl : public CScrollImpl< T > void ClientToDevice(POINT &pt) { - pt.x += m_ptOffset.x; - pt.y += m_ptOffset.y; + pt.x += this->m_ptOffset.x; + pt.y += this->m_ptOffset.y; } void DeviceToClient(POINT &pt) { - pt.x -= m_ptOffset.x; - pt.y -= m_ptOffset.y; + pt.x -= this->m_ptOffset.x; + pt.y -= this->m_ptOffset.y; } void CenterOnPoint(POINT pt) { T* pT = static_cast(this); - RECT rect; + RECT rect = { 0 }; pT->GetClientRect(&rect); - int xOfs = pt.x - (rect.right / 2) + m_ptOffset.x; + int xOfs = pt.x - (rect.right / 2) + this->m_ptOffset.x; if(xOfs < 0) { xOfs = 0; } else { - int xMax = max((int)(m_sizeAll.cx - rect.right), 0); + int xMax = __max((int)(this->m_sizeAll.cx - rect.right), 0); if(xOfs > xMax) xOfs = xMax; } - int yOfs = pt.y - (rect.bottom / 2) + m_ptOffset.y; + int yOfs = pt.y - (rect.bottom / 2) + this->m_ptOffset.y; if(yOfs < 0) { yOfs = 0; } else { - int yMax = max((int)(m_sizeAll.cy - rect.bottom), 0); + int yMax = __max((int)(this->m_sizeAll.cy - rect.bottom), 0); if(yOfs > yMax) yOfs = yMax; } @@ -1592,8 +1665,8 @@ class CZoomScrollImpl : public CScrollImpl< T > BOOL PtInDevRect(POINT pt) { - RECT rc = { 0, 0, m_sizeAll.cx, m_sizeAll.cy }; - ::OffsetRect(&rc, -m_ptOffset.x, -m_ptOffset.y); + RECT rc = { 0, 0, this->m_sizeAll.cx, this->m_sizeAll.cy }; + ::OffsetRect(&rc, -this->m_ptOffset.x, -this->m_ptOffset.y); return ::PtInRect(&rc, pt); } @@ -1605,6 +1678,7 @@ class CZoomScrollImpl : public CScrollImpl< T > rc.right = rc.left; rc.left = r; } + if(rc.top > rc.bottom) { int b = rc.bottom; @@ -1631,18 +1705,23 @@ class CZoomScrollImpl : public CScrollImpl< T > { T* pT = static_cast(this); int nId = pT->GetDlgCtrlID(); - NMHDR nmhdr = { pT->m_hWnd, nId, ZSN_ZOOMCHANGED }; + NMHDR nmhdr = { pT->m_hWnd, (UINT_PTR)nId, ZSN_ZOOMCHANGED }; ::SendMessage(pT->GetParent(), WM_NOTIFY, (WPARAM)nId, (LPARAM)&nmhdr); } + void DoWheelZoom(int zDelta) + { + float fZoomScale = m_fZoomScale + ((zDelta > 0) ? m_fZoomDelta : -m_fZoomDelta); + T* pT = static_cast(this); + pT->Zoom(fZoomScale); + pT->NotifyParentZoomChanged(); + } + BEGIN_MSG_MAP(CZoomScrollImpl) MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor) MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) - MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel) -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) + MESSAGE_HANDLER(WM_MOUSEWHEEL, OnMouseWheel) MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) MESSAGE_HANDLER(WM_SIZE, CScrollImpl< T >::OnSize) @@ -1667,12 +1746,50 @@ class CZoomScrollImpl : public CScrollImpl< T > COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl< T >::OnScrollAllRight) END_MSG_MAP() + LRESULT OnSetCursor(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + if((LOWORD(lParam) == HTCLIENT) && (m_nZoomMode != ZOOMMODE_OFF)) + { + T* pT = static_cast(this); + if((HWND)wParam == pT->m_hWnd) + { + DWORD dwPos = ::GetMessagePos(); + POINT pt = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) }; + pT->ScreenToClient(&pt); + if(pT->PtInDevRect(pt)) + { + ::SetCursor(::LoadCursor(NULL, IDC_CROSS)); + return 1; + } + } + } + + bHandled = FALSE; + return 0; + } + + LRESULT OnMouseWheel(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + if((GET_KEYSTATE_WPARAM(wParam) & MK_CONTROL) != 0) // handle zoom if Ctrl is pressed + { + int zDelta = (int)GET_WHEEL_DELTA_WPARAM(wParam); + T* pT = static_cast(this); + pT->DoWheelZoom(zDelta); + } + else + { + CScrollImpl< T >::OnMouseWheel(uMsg, wParam, lParam, bHandled); + } + + return 0; + } + LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); - ATLASSERT(m_sizeLogAll.cx >= 0 && m_sizeLogAll.cy >= 0); - ATLASSERT(m_sizeAll.cx >= 0 && m_sizeAll.cy >= 0); + ATLASSERT((m_sizeLogAll.cx >= 0) && (m_sizeLogAll.cy >= 0)); + ATLASSERT((this->m_sizeAll.cx >= 0) && (this->m_sizeAll.cy >= 0)); if(wParam != NULL) { @@ -1682,9 +1799,9 @@ class CZoomScrollImpl : public CScrollImpl< T > SIZE szWindowExt = { 0, 0 }; dc.SetWindowExt(m_sizeLogAll, &szWindowExt); SIZE szViewportExt = { 0, 0 }; - dc.SetViewportExt(m_sizeAll, &szViewportExt); + dc.SetViewportExt(this->m_sizeAll, &szViewportExt); POINT ptViewportOrg = { 0, 0 }; - dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y, &ptViewportOrg); + dc.SetViewportOrg(-this->m_ptOffset.x, -this->m_ptOffset.y, &ptViewportOrg); pT->DoPaint(dc); @@ -1699,12 +1816,13 @@ class CZoomScrollImpl : public CScrollImpl< T > pT->PrepareDC(dc.m_hDC); pT->DoPaint(dc.m_hDC); } + return 0; } LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { - if(m_nZoomMode == ZOOMMODE_IN && !m_bTracking) + if((m_nZoomMode == ZOOMMODE_IN) && !m_bTracking) { T* pT = static_cast(this); POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; @@ -1715,6 +1833,7 @@ class CZoomScrollImpl : public CScrollImpl< T > ::SetRect(&m_rcTrack, pt.x, pt.y, pt.x, pt.y); } } + bHandled = FALSE; return 0; } @@ -1733,6 +1852,7 @@ class CZoomScrollImpl : public CScrollImpl< T > pT->DrawTrackRect(); } } + bHandled = FALSE; return 0; } @@ -1746,6 +1866,7 @@ class CZoomScrollImpl : public CScrollImpl< T > pT->Zoom(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), m_fZoomScale - m_fZoomDelta); pT->NotifyParentZoomChanged(); } + bHandled = FALSE; return 0; } @@ -1761,30 +1882,10 @@ class CZoomScrollImpl : public CScrollImpl< T > pT->NotifyParentZoomChanged(); ::SetRectEmpty(&m_rcTrack); } - bHandled = FALSE; - return 0; - } - LRESULT OnSetCursor(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - if(LOWORD(lParam) == HTCLIENT && m_nZoomMode != ZOOMMODE_OFF) - { - T* pT = static_cast(this); - if((HWND)wParam == pT->m_hWnd) - { - DWORD dwPos = ::GetMessagePos(); - POINT pt = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) }; - pT->ScreenToClient(&pt); - if(pT->PtInDevRect(pt)) - { - ::SetCursor(::LoadCursor(NULL, IDC_CROSS)); - return 1; - } - } - } bHandled = FALSE; return 0; - } + } }; /////////////////////////////////////////////////////////////////////////////// @@ -1794,14 +1895,27 @@ template , public CZoomScrollImpl< T > { public: + BOOL SubclassWindow(HWND hWnd) + { + BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits >::SubclassWindow(hWnd); + if(bRet != FALSE) + { + T* pT = static_cast(this); + pT->GetSystemSettings(); + + RECT rect = { 0 }; + GetClientRect(&rect); + pT->DoSize(rect.right, rect.bottom); + } + + return bRet; + } + BEGIN_MSG_MAP(CZoomScrollWindowImpl) MESSAGE_HANDLER(WM_SETCURSOR, CZoomScrollImpl< T >::OnSetCursor) MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) - MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) -#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) - MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel) -#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)) + MESSAGE_HANDLER(WM_MOUSEWHEEL, CZoomScrollImpl< T >::OnMouseWheel) MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) MESSAGE_HANDLER(WM_SIZE, CScrollImpl< T >::OnSize) @@ -1827,8 +1941,6 @@ class ATL_NO_VTABLE CZoomScrollWindowImpl : public ATL::CWindowImpl< T, TBase, T END_MSG_MAP() }; -#endif // !_WIN32_WCE - /////////////////////////////////////////////////////////////////////////////// // CScrollContainer @@ -1877,7 +1989,7 @@ class ATL_NO_VTABLE CScrollContainerImpl : public CScrollWindowImpl< T, TBase, T { RECT rect = { 0 }; m_wndClient.GetWindowRect(&rect); - if((rect.right - rect.left) > 0 && (rect.bottom - rect.top) > 0) + if(((rect.right - rect.left) > 0) && ((rect.bottom - rect.top) > 0)) SetScrollSize(rect.right - rect.left, rect.bottom - rect.top, FALSE); } @@ -1895,7 +2007,6 @@ class ATL_NO_VTABLE CScrollContainerImpl : public CScrollWindowImpl< T, TBase, T BEGIN_MSG_MAP(CScrollContainerImpl) MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) - MESSAGE_HANDLER(WM_SIZE, OnSize) CHAIN_MSG_MAP(_baseClass) FORWARD_NOTIFICATIONS() ALT_MSG_MAP(1) @@ -1915,27 +2026,24 @@ class ATL_NO_VTABLE CScrollContainerImpl : public CScrollWindowImpl< T, TBase, T return 1; // no background needed } - LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) +// Overrides for CScrollWindowImpl + void DoSize(int cx, int cy) { - BOOL bTmp = TRUE; - LRESULT lRet = _baseClass::OnSize(uMsg, wParam, lParam, bTmp); + _baseClass::DoSize(cx, cy); T* pT = static_cast(this); pT->UpdateLayout(); - - return lRet; } -// Overrides for CScrollWindowImpl void DoPaint(CDCHandle dc) { - if(!m_bAutoSizeClient || m_wndClient.m_hWnd == NULL) + if(!m_bAutoSizeClient || (m_wndClient.m_hWnd == NULL)) { T* pT = static_cast(this); RECT rect = { 0 }; pT->GetContainerRect(rect); - if(m_bDrawEdgeIfEmpty && m_wndClient.m_hWnd == NULL) + if(m_bDrawEdgeIfEmpty && (m_wndClient.m_hWnd == NULL)) dc.DrawEdge(&rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST); dc.FillRect(&rect, COLOR_APPWORKSPACE); @@ -1968,9 +2076,9 @@ class ATL_NO_VTABLE CScrollContainerImpl : public CScrollWindowImpl< T, TBase, T // Implementation - overrideable methods void UpdateLayout() { - ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT(::IsWindow(this->m_hWnd)); - if(m_bAutoSizeClient && m_wndClient.m_hWnd != NULL) + if(m_bAutoSizeClient && (m_wndClient.m_hWnd != NULL)) { T* pT = static_cast(this); RECT rect = { 0 }; @@ -1980,19 +2088,19 @@ class ATL_NO_VTABLE CScrollContainerImpl : public CScrollWindowImpl< T, TBase, T } else { - Invalidate(); + this->Invalidate(); } } void GetContainerRect(RECT& rect) { - GetClientRect(&rect); + this->GetClientRect(&rect); - if(rect.right < m_sizeAll.cx) - rect.right = m_sizeAll.cx; + if(rect.right < this->m_sizeAll.cx) + rect.right = this->m_sizeAll.cx; - if(rect.bottom < m_sizeAll.cy) - rect.bottom = m_sizeAll.cy; + if(rect.bottom < this->m_sizeAll.cy) + rect.bottom = this->m_sizeAll.cy; } }; diff --git a/thirdparty/wtl/atlsplit.h b/thirdparty/wtl/atlsplit.h index 8afffda..e9ec2e6 100644 --- a/thirdparty/wtl/atlsplit.h +++ b/thirdparty/wtl/atlsplit.h @@ -1,13 +1,10 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. +// Windows Template Library - WTL version 10.0 +// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. +// Microsoft Public License (http://opensource.org/licenses/MS-PL) +// which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLSPLIT_H__ #define __ATLSPLIT_H__ @@ -26,9 +23,9 @@ /////////////////////////////////////////////////////////////////////////////// // Classes in this file: // -// CSplitterImpl -// CSplitterWindowImpl -// CSplitterWindowT +// CSplitterImpl +// CSplitterWindowImpl +// CSplitterWindowT - CSplitterWindow, CHorSplitterWindow namespace WTL @@ -53,58 +50,48 @@ namespace WTL #define SPLIT_FIXEDBARSIZE 0x00000010 // Note: SPLIT_PROPORTIONAL and SPLIT_RIGHTALIGNED/SPLIT_BOTTOMALIGNED are -// mutually exclusive. If both are set, splitter defaults to SPLIT_PROPORTIONAL +// mutually exclusive. If both are set, splitter defaults to SPLIT_PROPORTIONAL. +// SPLIT_GRADIENTBAR doesn't work with _ATL_NO_MSIMG -template +template class CSplitterImpl { public: - enum { m_nPanesCount = 2, m_nPropMax = 10000 }; + enum { m_nPanesCount = 2, m_nPropMax = 10000, m_cxyStep = 10 }; + bool m_bVertical; HWND m_hWndPane[m_nPanesCount]; RECT m_rcSplitter; - int m_xySplitterPos; + int m_xySplitterPos; // splitter bar position + int m_xySplitterPosNew; // internal - new position while moving + HWND m_hWndFocusSave; int m_nDefActivePane; int m_cxySplitBar; // splitter bar width/height - static HCURSOR m_hCursor; + HCURSOR m_hCursor; int m_cxyMin; // minimum pane size int m_cxyBarEdge; // splitter bar edge bool m_bFullDrag; - int m_cxyDragOffset; + int m_cxyDragOffset; // internal int m_nProportionalPos; bool m_bUpdateProportionalPos; - DWORD m_dwExtendedStyle; // splitter specific extended styles - int m_nSinglePane; // single pane mode + DWORD m_dwExtendedStyle; // splitter specific extended styles + int m_nSinglePane; // single pane mode + int m_xySplitterDefPos; // default position + bool m_bProportionalDefPos; // porportinal def pos // Constructor - CSplitterImpl() : - m_xySplitterPos(-1), m_nDefActivePane(SPLIT_PANE_NONE), - m_cxySplitBar(4), m_cxyMin(0), m_cxyBarEdge(0), m_bFullDrag(true), - m_cxyDragOffset(0), m_nProportionalPos(0), m_bUpdateProportionalPos(true), - m_dwExtendedStyle(SPLIT_PROPORTIONAL), - m_nSinglePane(SPLIT_PANE_NONE) + CSplitterImpl(bool bVertical = true) : + m_bVertical(bVertical), m_xySplitterPos(-1), m_xySplitterPosNew(-1), m_hWndFocusSave(NULL), + m_nDefActivePane(SPLIT_PANE_NONE), m_cxySplitBar(4), m_hCursor(NULL), m_cxyMin(0), m_cxyBarEdge(0), + m_bFullDrag(true), m_cxyDragOffset(0), m_nProportionalPos(0), m_bUpdateProportionalPos(true), + m_dwExtendedStyle(SPLIT_PROPORTIONAL), m_nSinglePane(SPLIT_PANE_NONE), + m_xySplitterDefPos(-1), m_bProportionalDefPos(false) { m_hWndPane[SPLIT_PANE_LEFT] = NULL; m_hWndPane[SPLIT_PANE_RIGHT] = NULL; ::SetRectEmpty(&m_rcSplitter); - - if(m_hCursor == NULL) - { - CStaticDataInitCriticalSectionLock lock; - if(FAILED(lock.Lock())) - { - ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CSplitterImpl::CSplitterImpl.\n")); - ATLASSERT(FALSE); - return; - } - - if(m_hCursor == NULL) - m_hCursor = ::LoadCursor(NULL, t_bVertical ? IDC_SIZEWE : IDC_SIZENS); - - lock.Unlock(); - } } // Attributes @@ -137,17 +124,33 @@ class CSplitterImpl bool SetSplitterPos(int xyPos = -1, bool bUpdate = true) { - if(xyPos == -1) // -1 == middle + if(xyPos == -1) // -1 == default position { - if(t_bVertical) - xyPos = (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) / 2; - else - xyPos = (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge) / 2; + if(m_bProportionalDefPos) + { + ATLASSERT((m_xySplitterDefPos >= 0) && (m_xySplitterDefPos <= m_nPropMax)); + + if(m_bVertical) + xyPos = ::MulDiv(m_xySplitterDefPos, m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge, m_nPropMax); + else + xyPos = ::MulDiv(m_xySplitterDefPos, m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge, m_nPropMax); + } + else if(m_xySplitterDefPos != -1) + { + xyPos = m_xySplitterDefPos; + } + else // not set, use middle position + { + if(m_bVertical) + xyPos = (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) / 2; + else + xyPos = (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge) / 2; + } } // Adjust if out of valid range int cxyMax = 0; - if(t_bVertical) + if(m_bVertical) cxyMax = m_rcSplitter.right - m_rcSplitter.left; else cxyMax = m_rcSplitter.bottom - m_rcSplitter.top; @@ -179,9 +182,14 @@ class CSplitterImpl return bRet; } + int GetSplitterPos() const + { + return m_xySplitterPos; + } + void SetSplitterPosPct(int nPct, bool bUpdate = true) { - ATLASSERT(nPct >= 0 && nPct <= 100); + ATLASSERT((nPct >= 0) && (nPct <= 100)); m_nProportionalPos = ::MulDiv(nPct, m_nPropMax, 100); UpdateProportionalPos(); @@ -190,20 +198,21 @@ class CSplitterImpl UpdateSplitterLayout(); } - int GetSplitterPos() const + int GetSplitterPosPct() const { - return m_xySplitterPos; + int cxyTotal = m_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); + return ((cxyTotal > 0) && (m_xySplitterPos >= 0)) ? (::MulDiv(m_xySplitterPos, m_nPropMax, cxyTotal) / 100) : -1; } bool SetSinglePaneMode(int nPane = SPLIT_PANE_NONE) { - ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT || nPane == SPLIT_PANE_NONE); - if(!(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT || nPane == SPLIT_PANE_NONE)) + ATLASSERT((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT) || (nPane == SPLIT_PANE_NONE)); + if(!((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT) || (nPane == SPLIT_PANE_NONE))) return false; if(nPane != SPLIT_PANE_NONE) { - if(!::IsWindowVisible(m_hWndPane[nPane])) + if(::IsWindowVisible(m_hWndPane[nPane]) == FALSE) ::ShowWindow(m_hWndPane[nPane], SW_SHOW); int nOtherPane = (nPane == SPLIT_PANE_LEFT) ? SPLIT_PANE_RIGHT : SPLIT_PANE_LEFT; ::ShowWindow(m_hWndPane[nOtherPane], SW_HIDE); @@ -218,6 +227,7 @@ class CSplitterImpl m_nSinglePane = nPane; UpdateSplitterLayout(); + return true; } @@ -238,55 +248,73 @@ class CSplitterImpl m_dwExtendedStyle = dwExtendedStyle; else m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); + #ifdef _DEBUG if(IsProportional() && IsRightAligned()) ATLTRACE2(atlTraceUI, 0, _T("CSplitterImpl::SetSplitterExtendedStyle - SPLIT_PROPORTIONAL and SPLIT_RIGHTALIGNED are mutually exclusive, defaulting to SPLIT_PROPORTIONAL.\n")); #endif // _DEBUG + return dwPrevStyle; } + void SetSplitterDefaultPos(int xyPos = -1) + { + m_xySplitterDefPos = xyPos; + m_bProportionalDefPos = false; + } + + void SetSplitterDefaultPosPct(int nPct) + { + ATLASSERT((nPct >= 0) && (nPct <= 100)); + + m_xySplitterDefPos = ::MulDiv(nPct, m_nPropMax, 100); + m_bProportionalDefPos = true; + } + // Splitter operations void SetSplitterPanes(HWND hWndLeftTop, HWND hWndRightBottom, bool bUpdate = true) { m_hWndPane[SPLIT_PANE_LEFT] = hWndLeftTop; m_hWndPane[SPLIT_PANE_RIGHT] = hWndRightBottom; - ATLASSERT(m_hWndPane[SPLIT_PANE_LEFT] == NULL || m_hWndPane[SPLIT_PANE_RIGHT] == NULL || m_hWndPane[SPLIT_PANE_LEFT] != m_hWndPane[SPLIT_PANE_RIGHT]); + ATLASSERT((m_hWndPane[SPLIT_PANE_LEFT] == NULL) || (m_hWndPane[SPLIT_PANE_RIGHT] == NULL) || (m_hWndPane[SPLIT_PANE_LEFT] != m_hWndPane[SPLIT_PANE_RIGHT])); if(bUpdate) UpdateSplitterLayout(); } bool SetSplitterPane(int nPane, HWND hWnd, bool bUpdate = true) { - ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT); - - if(nPane != SPLIT_PANE_LEFT && nPane != SPLIT_PANE_RIGHT) + ATLASSERT((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT)); + if((nPane != SPLIT_PANE_LEFT) && (nPane != SPLIT_PANE_RIGHT)) return false; + m_hWndPane[nPane] = hWnd; - ATLASSERT(m_hWndPane[SPLIT_PANE_LEFT] == NULL || m_hWndPane[SPLIT_PANE_RIGHT] == NULL || m_hWndPane[SPLIT_PANE_LEFT] != m_hWndPane[SPLIT_PANE_RIGHT]); + ATLASSERT((m_hWndPane[SPLIT_PANE_LEFT] == NULL) || (m_hWndPane[SPLIT_PANE_RIGHT] == NULL) || (m_hWndPane[SPLIT_PANE_LEFT] != m_hWndPane[SPLIT_PANE_RIGHT])); if(bUpdate) UpdateSplitterLayout(); + return true; } HWND GetSplitterPane(int nPane) const { - ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT); + ATLASSERT((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT)); + if((nPane != SPLIT_PANE_LEFT) && (nPane != SPLIT_PANE_RIGHT)) + return NULL; - if(nPane != SPLIT_PANE_LEFT && nPane != SPLIT_PANE_RIGHT) - return false; return m_hWndPane[nPane]; } bool SetActivePane(int nPane) { - ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT); - - if(nPane != SPLIT_PANE_LEFT && nPane != SPLIT_PANE_RIGHT) + ATLASSERT((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT)); + if((nPane != SPLIT_PANE_LEFT) && (nPane != SPLIT_PANE_RIGHT)) return false; - if(m_nSinglePane != SPLIT_PANE_NONE && nPane != m_nSinglePane) + if((m_nSinglePane != SPLIT_PANE_NONE) && (nPane != m_nSinglePane)) return false; + ::SetFocus(m_hWndPane[nPane]); m_nDefActivePane = nPane; + return true; } @@ -298,13 +326,14 @@ class CSplitterImpl { for(int nPane = 0; nPane < m_nPanesCount; nPane++) { - if(hWndFocus == m_hWndPane[nPane] || ::IsChild(m_hWndPane[nPane], hWndFocus)) + if((hWndFocus == m_hWndPane[nPane]) || (::IsChild(m_hWndPane[nPane], hWndFocus) != FALSE)) { nRet = nPane; break; } } } + return nRet; } @@ -326,16 +355,18 @@ class CSplitterImpl break; } } + return SetActivePane(nPane); } bool SetDefaultActivePane(int nPane) { - ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT); - - if(nPane != SPLIT_PANE_LEFT && nPane != SPLIT_PANE_RIGHT) + ATLASSERT((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT)); + if((nPane != SPLIT_PANE_LEFT) && (nPane != SPLIT_PANE_RIGHT)) return false; + m_nDefActivePane = nPane; + return true; } @@ -349,6 +380,7 @@ class CSplitterImpl return true; } } + return false; // not found } @@ -360,7 +392,7 @@ class CSplitterImpl void DrawSplitter(CDCHandle dc) { ATLASSERT(dc.m_hDC != NULL); - if(m_nSinglePane == SPLIT_PANE_NONE && m_xySplitterPos == -1) + if((m_nSinglePane == SPLIT_PANE_NONE) && (m_xySplitterPos == -1)) return; T* pT = static_cast(this); @@ -381,6 +413,61 @@ class CSplitterImpl } } + // call to initiate moving splitter bar with keyboard + void MoveSplitterBar() + { + T* pT = static_cast(this); + + int x = 0; + int y = 0; + if(m_bVertical) + { + x = m_xySplitterPos + (m_cxySplitBar / 2) + m_cxyBarEdge; + y = (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge) / 2; + } + else + { + x = (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) / 2; + y = m_xySplitterPos + (m_cxySplitBar / 2) + m_cxyBarEdge; + } + + POINT pt = { x, y }; + pT->ClientToScreen(&pt); + ::SetCursorPos(pt.x, pt.y); + + m_xySplitterPosNew = m_xySplitterPos; + pT->SetCapture(); + m_hWndFocusSave = pT->SetFocus(); + ::SetCursor(m_hCursor); + if(!m_bFullDrag) + DrawGhostBar(); + if(m_bVertical) + m_cxyDragOffset = x - m_rcSplitter.left - m_xySplitterPos; + else + m_cxyDragOffset = y - m_rcSplitter.top - m_xySplitterPos; + } + + void SetOrientation(bool bVertical, bool bUpdate = true) + { + if(m_bVertical != bVertical) + { + m_bVertical = bVertical; + + m_hCursor = ::LoadCursor(NULL, m_bVertical ? IDC_SIZEWE : IDC_SIZENS); + + T* pT = static_cast(this); + pT->GetSystemSettings(false); + + if(m_bVertical) + m_xySplitterPos = ::MulDiv(m_xySplitterPos, m_rcSplitter.right - m_rcSplitter.left, m_rcSplitter.bottom - m_rcSplitter.top); + else + m_xySplitterPos = ::MulDiv(m_xySplitterPos, m_rcSplitter.bottom - m_rcSplitter.top, m_rcSplitter.right - m_rcSplitter.left); + } + + if(bUpdate) + UpdateSplitterLayout(); + } + // Overrideables void DrawSplitterBar(CDCHandle dc) { @@ -389,23 +476,22 @@ class CSplitterImpl { dc.FillRect(&rect, COLOR_3DFACE); -#if (!defined(_WIN32_WCE) || (_WIN32_WCE >= 420)) +#ifndef _ATL_NO_MSIMG if((m_dwExtendedStyle & SPLIT_GRADIENTBAR) != 0) { RECT rect2 = rect; - if(t_bVertical) + if(m_bVertical) rect2.left = (rect.left + rect.right) / 2 - 1; else rect2.top = (rect.top + rect.bottom) / 2 - 1; - dc.GradientFillRect(rect2, ::GetSysColor(COLOR_3DFACE), ::GetSysColor(COLOR_3DSHADOW), t_bVertical); + dc.GradientFillRect(rect2, ::GetSysColor(COLOR_3DFACE), ::GetSysColor(COLOR_3DSHADOW), m_bVertical); } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 420) - +#endif // draw 3D edge if needed T* pT = static_cast(this); if((pT->GetExStyle() & WS_EX_CLIENTEDGE) != 0) - dc.DrawEdge(&rect, EDGE_RAISED, t_bVertical ? (BF_LEFT | BF_RIGHT) : (BF_TOP | BF_BOTTOM)); + dc.DrawEdge(&rect, EDGE_RAISED, m_bVertical ? (BF_LEFT | BF_RIGHT) : (BF_TOP | BF_BOTTOM)); } } @@ -426,9 +512,7 @@ class CSplitterImpl BEGIN_MSG_MAP(CSplitterImpl) MESSAGE_HANDLER(WM_CREATE, OnCreate) MESSAGE_HANDLER(WM_PAINT, OnPaint) -#ifndef _WIN32_WCE MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) -#endif // !_WIN32_WCE if(IsInteractive()) { MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor) @@ -437,39 +521,48 @@ class CSplitterImpl MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDoubleClick) MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged) + MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown) } MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) -#ifndef _WIN32_WCE MESSAGE_HANDLER(WM_MOUSEACTIVATE, OnMouseActivate) -#endif // !_WIN32_WCE MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) END_MSG_MAP() LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { T* pT = static_cast(this); - pT->GetSystemSettings(false); + pT->Init(); bHandled = FALSE; return 1; } - LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); + // try setting position if not set - if(m_nSinglePane == SPLIT_PANE_NONE && m_xySplitterPos == -1) + if((m_nSinglePane == SPLIT_PANE_NONE) && (m_xySplitterPos == -1)) pT->SetSplitterPos(); + // do painting - CPaintDC dc(pT->m_hWnd); - pT->DrawSplitter(dc.m_hDC); + if(wParam != NULL) + { + pT->DrawSplitter((HDC)wParam); + } + else + { + CPaintDC dc(pT->m_hWnd); + pT->DrawSplitter(dc.m_hDC); + } + return 0; } LRESULT OnSetCursor(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { T* pT = static_cast(this); - if((HWND)wParam == pT->m_hWnd && LOWORD(lParam) == HTCLIENT) + if(((HWND)wParam == pT->m_hWnd) && (LOWORD(lParam) == HTCLIENT)) { DWORD dwPos = ::GetMessagePos(); POINT ptPos = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) }; @@ -482,20 +575,20 @@ class CSplitterImpl return 0; } - LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { T* pT = static_cast(this); int xPos = GET_X_LPARAM(lParam); int yPos = GET_Y_LPARAM(lParam); - if((wParam & MK_LBUTTON) && ::GetCapture() == pT->m_hWnd) + if(::GetCapture() == pT->m_hWnd) { int xyNewSplitPos = 0; - if(t_bVertical) + if(m_bVertical) xyNewSplitPos = xPos - m_rcSplitter.left - m_cxyDragOffset; else xyNewSplitPos = yPos - m_rcSplitter.top - m_cxyDragOffset; - if(xyNewSplitPos == -1) // avoid -1, that means middle + if(xyNewSplitPos == -1) // avoid -1, that means default position xyNewSplitPos = -2; if(m_xySplitterPos != xyNewSplitPos) @@ -525,27 +618,40 @@ class CSplitterImpl LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { + T* pT = static_cast(this); int xPos = GET_X_LPARAM(lParam); int yPos = GET_Y_LPARAM(lParam); - if(IsOverSplitterBar(xPos, yPos)) + if((::GetCapture() != pT->m_hWnd) && IsOverSplitterBar(xPos, yPos)) { - T* pT = static_cast(this); + m_xySplitterPosNew = m_xySplitterPos; pT->SetCapture(); + m_hWndFocusSave = pT->SetFocus(); ::SetCursor(m_hCursor); if(!m_bFullDrag) DrawGhostBar(); - if(t_bVertical) + if(m_bVertical) m_cxyDragOffset = xPos - m_rcSplitter.left - m_xySplitterPos; else m_cxyDragOffset = yPos - m_rcSplitter.top - m_xySplitterPos; } + else if((::GetCapture() == pT->m_hWnd) && !IsOverSplitterBar(xPos, yPos)) + { + ::ReleaseCapture(); + } + bHandled = FALSE; return 1; } LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { - ::ReleaseCapture(); + T* pT = static_cast(this); + if(::GetCapture() == pT->m_hWnd) + { + m_xySplitterPosNew = m_xySplitterPos; + ::ReleaseCapture(); + } + bHandled = FALSE; return 1; } @@ -553,43 +659,112 @@ class CSplitterImpl LRESULT OnLButtonDoubleClick(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); - pT->SetSplitterPos(); // middle + pT->SetSplitterPos(); // default + return 0; } LRESULT OnCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { if(!m_bFullDrag) - { DrawGhostBar(); + + if((m_xySplitterPosNew != -1) && (!m_bFullDrag || (m_xySplitterPos != m_xySplitterPosNew))) + { + m_xySplitterPos = m_xySplitterPosNew; + m_xySplitterPosNew = -1; UpdateSplitterLayout(); T* pT = static_cast(this); pT->UpdateWindow(); } + + if(m_hWndFocusSave != NULL) + ::SetFocus(m_hWndFocusSave); + return 0; } - LRESULT OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM, BOOL& bHandled) + LRESULT OnKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { - if(m_nSinglePane == SPLIT_PANE_NONE) + T* pT = static_cast(this); + if(::GetCapture() == pT->m_hWnd) { - if(m_nDefActivePane == SPLIT_PANE_LEFT || m_nDefActivePane == SPLIT_PANE_RIGHT) - ::SetFocus(m_hWndPane[m_nDefActivePane]); + switch(wParam) + { + case VK_RETURN: + m_xySplitterPosNew = m_xySplitterPos; + case VK_ESCAPE: + ::ReleaseCapture(); + break; + case VK_LEFT: + case VK_RIGHT: + if(m_bVertical) + { + POINT pt = { 0, 0 }; + ::GetCursorPos(&pt); + int xyPos = m_xySplitterPos + ((wParam == VK_LEFT) ? -pT->m_cxyStep : pT->m_cxyStep); + int cxyMax = m_rcSplitter.right - m_rcSplitter.left; + if(xyPos < (m_cxyMin + m_cxyBarEdge)) + xyPos = m_cxyMin; + else if(xyPos > (cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin)) + xyPos = cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin; + pt.x += xyPos - m_xySplitterPos; + ::SetCursorPos(pt.x, pt.y); + } + break; + case VK_UP: + case VK_DOWN: + if(!m_bVertical) + { + POINT pt = { 0, 0 }; + ::GetCursorPos(&pt); + int xyPos = m_xySplitterPos + ((wParam == VK_UP) ? -pT->m_cxyStep : pT->m_cxyStep); + int cxyMax = m_rcSplitter.bottom - m_rcSplitter.top; + if(xyPos < (m_cxyMin + m_cxyBarEdge)) + xyPos = m_cxyMin; + else if(xyPos > (cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin)) + xyPos = cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin; + pt.y += xyPos - m_xySplitterPos; + ::SetCursorPos(pt.x, pt.y); + } + break; + default: + break; + } } else { - ::SetFocus(m_hWndPane[m_nSinglePane]); + bHandled = FALSE; } + + return 0; + } + + LRESULT OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM, BOOL& bHandled) + { + T* pT = static_cast(this); + if(::GetCapture() != pT->m_hWnd) + { + if(m_nSinglePane == SPLIT_PANE_NONE) + { + if((m_nDefActivePane == SPLIT_PANE_LEFT) || (m_nDefActivePane == SPLIT_PANE_RIGHT)) + ::SetFocus(m_hWndPane[m_nDefActivePane]); + } + else + { + ::SetFocus(m_hWndPane[m_nSinglePane]); + } + } + bHandled = FALSE; return 1; } -#ifndef _WIN32_WCE LRESULT OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { T* pT = static_cast(this); LRESULT lRet = pT->DefWindowProc(uMsg, wParam, lParam); - if(lRet == MA_ACTIVATE || lRet == MA_ACTIVATEANDEAT) + if((lRet == MA_ACTIVATE) || (lRet == MA_ACTIVATEANDEAT)) { DWORD dwPos = ::GetMessagePos(); POINT pt = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) }; @@ -597,16 +772,16 @@ class CSplitterImpl RECT rcPane = { 0 }; for(int nPane = 0; nPane < m_nPanesCount; nPane++) { - if(GetSplitterPaneRect(nPane, &rcPane) && ::PtInRect(&rcPane, pt)) + if(GetSplitterPaneRect(nPane, &rcPane) && (::PtInRect(&rcPane, pt) != FALSE)) { m_nDefActivePane = nPane; break; } } } + return lRet; } -#endif // !_WIN32_WCE LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { @@ -617,9 +792,17 @@ class CSplitterImpl } // Implementation - internal helpers + void Init() + { + m_hCursor = ::LoadCursor(NULL, m_bVertical ? IDC_SIZEWE : IDC_SIZENS); + + T* pT = static_cast(this); + pT->GetSystemSettings(false); + } + void UpdateSplitterLayout() { - if(m_nSinglePane == SPLIT_PANE_NONE && m_xySplitterPos == -1) + if((m_nSinglePane == SPLIT_PANE_NONE) && (m_xySplitterPos == -1)) return; T* pT = static_cast(this); @@ -655,10 +838,10 @@ class CSplitterImpl bool GetSplitterBarRect(LPRECT lpRect) const { ATLASSERT(lpRect != NULL); - if(m_nSinglePane != SPLIT_PANE_NONE || m_xySplitterPos == -1) + if((m_nSinglePane != SPLIT_PANE_NONE) || (m_xySplitterPos == -1)) return false; - if(t_bVertical) + if(m_bVertical) { lpRect->left = m_rcSplitter.left + m_xySplitterPos; lpRect->top = m_rcSplitter.top; @@ -678,7 +861,7 @@ class CSplitterImpl bool GetSplitterPaneRect(int nPane, LPRECT lpRect) const { - ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT); + ATLASSERT((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT)); ATLASSERT(lpRect != NULL); bool bRet = true; if(m_nSinglePane != SPLIT_PANE_NONE) @@ -690,7 +873,7 @@ class CSplitterImpl } else if(nPane == SPLIT_PANE_LEFT) { - if(t_bVertical) + if(m_bVertical) { lpRect->left = m_rcSplitter.left; lpRect->top = m_rcSplitter.top; @@ -707,7 +890,7 @@ class CSplitterImpl } else if(nPane == SPLIT_PANE_RIGHT) { - if(t_bVertical) + if(m_bVertical) { lpRect->left = m_rcSplitter.left + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge; lpRect->top = m_rcSplitter.top; @@ -726,25 +909,27 @@ class CSplitterImpl { bRet = false; } + return bRet; } bool IsOverSplitterRect(int x, int y) const { // -1 == don't check - return ((x == -1 || (x >= m_rcSplitter.left && x <= m_rcSplitter.right)) && - (y == -1 || (y >= m_rcSplitter.top && y <= m_rcSplitter.bottom))); + return (((x == -1) || ((x >= m_rcSplitter.left) && (x <= m_rcSplitter.right))) && + ((y == -1) || ((y >= m_rcSplitter.top) && (y <= m_rcSplitter.bottom)))); } bool IsOverSplitterBar(int x, int y) const { if(m_nSinglePane != SPLIT_PANE_NONE) return false; - if(m_xySplitterPos == -1 || !IsOverSplitterRect(x, y)) + if((m_xySplitterPos == -1) || !IsOverSplitterRect(x, y)) return false; - int xy = t_bVertical ? x : y; - int xyOff = t_bVertical ? m_rcSplitter.left : m_rcSplitter.top; - return ((xy >= (xyOff + m_xySplitterPos)) && (xy < xyOff + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge)); + int xy = m_bVertical ? x : y; + int xyOff = m_bVertical ? m_rcSplitter.left : m_rcSplitter.top; + + return ((xy >= (xyOff + m_xySplitterPos)) && (xy < (xyOff + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge))); } void DrawGhostBar() @@ -761,7 +946,7 @@ class CSplitterImpl // invert the brush pattern (looks just like frame window sizing) CWindowDC dc(pT->m_hWnd); - CBrush brush = CDCHandle::GetHalftoneBrush(); + CBrush brush(CDCHandle::GetHalftoneBrush()); if(brush.m_hBrush != NULL) { CBrushHandle brushOld = dc.SelectBrush(brush); @@ -775,28 +960,22 @@ class CSplitterImpl { if((m_dwExtendedStyle & SPLIT_FIXEDBARSIZE) == 0) { -#ifndef _WIN32_WCE - m_cxySplitBar = ::GetSystemMetrics(t_bVertical ? SM_CXSIZEFRAME : SM_CYSIZEFRAME); -#else // CE specific - m_cxySplitBar = 2 * ::GetSystemMetrics(t_bVertical ? SM_CXEDGE : SM_CYEDGE); -#endif // _WIN32_WCE + m_cxySplitBar = ::GetSystemMetrics(m_bVertical ? SM_CXSIZEFRAME : SM_CYSIZEFRAME); } T* pT = static_cast(this); - if((pT->GetExStyle() & WS_EX_CLIENTEDGE)) + if((pT->GetExStyle() & WS_EX_CLIENTEDGE) != 0) { - m_cxyBarEdge = 2 * ::GetSystemMetrics(t_bVertical ? SM_CXEDGE : SM_CYEDGE); + m_cxyBarEdge = 2 * ::GetSystemMetrics(m_bVertical ? SM_CXEDGE : SM_CYEDGE); m_cxyMin = 0; } else { m_cxyBarEdge = 0; - m_cxyMin = 2 * ::GetSystemMetrics(t_bVertical ? SM_CXEDGE : SM_CYEDGE); + m_cxyMin = 2 * ::GetSystemMetrics(m_bVertical ? SM_CXEDGE : SM_CYEDGE); } -#ifndef _WIN32_WCE ::SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &m_bFullDrag, 0); -#endif // !_WIN32_WCE if(bUpdate) UpdateSplitterLayout(); @@ -809,7 +988,7 @@ class CSplitterImpl void StoreProportionalPos() { - int cxyTotal = t_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); + int cxyTotal = m_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); if(cxyTotal > 0) m_nProportionalPos = ::MulDiv(m_xySplitterPos, m_nPropMax, cxyTotal); else @@ -819,7 +998,7 @@ class CSplitterImpl void UpdateProportionalPos() { - int cxyTotal = t_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); + int cxyTotal = m_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); if(cxyTotal > 0) { int xyNewPos = ::MulDiv(m_nProportionalPos, cxyTotal, m_nPropMax); @@ -836,7 +1015,7 @@ class CSplitterImpl void StoreRightAlignPos() { - int cxyTotal = t_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); + int cxyTotal = m_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); if(cxyTotal > 0) m_nProportionalPos = cxyTotal - m_xySplitterPos; else @@ -846,7 +1025,7 @@ class CSplitterImpl void UpdateRightAlignPos() { - int cxyTotal = t_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); + int cxyTotal = m_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); if(cxyTotal > 0) { m_bUpdateProportionalPos = false; @@ -861,24 +1040,37 @@ class CSplitterImpl } }; -template HCURSOR CSplitterImpl< T, t_bVertical>::m_hCursor = NULL; - /////////////////////////////////////////////////////////////////////////////// // CSplitterWindowImpl - Implements a splitter window -template -class ATL_NO_VTABLE CSplitterWindowImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CSplitterImpl< T , t_bVertical > +template +class ATL_NO_VTABLE CSplitterWindowImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CSplitterImpl< T > { public: DECLARE_WND_CLASS_EX(NULL, CS_DBLCLKS, COLOR_WINDOW) - typedef CSplitterImpl< T , t_bVertical > _baseClass; + CSplitterWindowImpl(bool bVertical = true) : CSplitterImpl< T >(bVertical) + { } + + BOOL SubclassWindow(HWND hWnd) + { + BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits >::SubclassWindow(hWnd); + if(bRet != FALSE) + { + T* pT = static_cast(this); + pT->Init(); + + SetSplitterRect(); + } + + return bRet; + } BEGIN_MSG_MAP(CSplitterWindowImpl) MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) MESSAGE_HANDLER(WM_SIZE, OnSize) - CHAIN_MSG_MAP(_baseClass) + CHAIN_MSG_MAP(CSplitterImpl< T >) FORWARD_NOTIFICATIONS() END_MSG_MAP() @@ -891,7 +1083,7 @@ class ATL_NO_VTABLE CSplitterWindowImpl : public ATL::CWindowImpl< T, TBase, TWi LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { if(wParam != SIZE_MINIMIZED) - SetSplitterRect(); + this->SetSplitterRect(); bHandled = FALSE; return 1; @@ -900,13 +1092,16 @@ class ATL_NO_VTABLE CSplitterWindowImpl : public ATL::CWindowImpl< T, TBase, TWi /////////////////////////////////////////////////////////////////////////////// -// CSplitterWindow - Implements a splitter window to be used as is +// CSplitterWindow/CHorSplitterWindow - Implements splitter windows to be used as is template -class CSplitterWindowT : public CSplitterWindowImpl, t_bVertical> +class CSplitterWindowT : public CSplitterWindowImpl > { public: DECLARE_WND_CLASS_EX(_T("WTL_SplitterWindow"), CS_DBLCLKS, COLOR_WINDOW) + + CSplitterWindowT() : CSplitterWindowImpl >(t_bVertical) + { } }; typedef CSplitterWindowT CSplitterWindow; diff --git a/thirdparty/wtl/atltheme.h b/thirdparty/wtl/atltheme.h index a5168b9..ba9d168 100644 --- a/thirdparty/wtl/atltheme.h +++ b/thirdparty/wtl/atltheme.h @@ -1,23 +1,16 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. +// Windows Template Library - WTL version 10.0 +// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. +// Microsoft Public License (http://opensource.org/licenses/MS-PL) +// which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLTHEME_H__ #define __ATLTHEME_H__ #pragma once -#ifdef _WIN32_WCE - #error atltheme.h is not supported on Windows CE -#endif - #ifndef __ATLAPP_H__ #error atltheme.h requires atlapp.h to be included first #endif @@ -26,22 +19,7 @@ #error atltheme.h requires atlwin.h to be included first #endif -#if (_WIN32_WINNT < 0x0501) - #error atltheme.h requires _WIN32_WINNT >= 0x0501 -#endif // (_WIN32_WINNT < 0x0501) - -#if defined(_WTL_USE_VSSYM32) || (defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN)) - #include -#else - #ifndef TMSCHEMA_H - #include - #endif -#endif - -#ifndef _UXTHEME_H_ -#include -#endif -#pragma comment(lib, "uxtheme.lib") +#include // Note: To create an application that also runs on older versions of Windows, // use delay load of uxtheme.dll and ensure that no calls to the Theme API are @@ -61,18 +39,6 @@ // Delay load is NOT AUTOMATIC for VC++ 7, you have to link to delayimp.lib, // and add uxtheme.dll in the Linker.Input.Delay Loaded DLLs section of the // project properties. -#if (_MSC_VER < 1300) && !defined(_WTL_NO_THEME_DELAYLOAD) - #pragma comment(lib, "delayimp.lib") - #pragma comment(linker, "/delayload:uxtheme.dll") -#endif // (_MSC_VER < 1300) && !defined(_WTL_NO_THEME_DELAYLOAD) - -// Hack: Signatures in uxtheme.h changed - the only way to check which variant of uxtheme.h -// is included is to check for presence of new defines MAX_THEMECOLOR and MAX_THEMESIZE -#ifndef _WTL_NEW_UXTHEME - #if defined(MAX_THEMECOLOR) && defined(MAX_THEMESIZE) - #define _WTL_NEW_UXTHEME - #endif // defined(MAX_THEMECOLOR) && defined(MAX_THEMESIZE) -#endif // _WTL_NEW_UXTHEME /////////////////////////////////////////////////////////////////////////////// @@ -197,11 +163,14 @@ class CTheme return ::DrawThemeBackground(m_hTheme, hDC, nPartID, nStateID, pRect, pClipRect); } +// Missing in original uxtheme.h +#ifdef DTBG_CLIPRECT HRESULT DrawThemeBackgroundEx(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, const DTBGOPTS* pOptions = NULL) { ATLASSERT(m_hTheme != NULL); return ::DrawThemeBackgroundEx(m_hTheme, hDC, nPartID, nStateID, pRect, pOptions); } +#endif // DTBG_CLIPRECT HRESULT DrawThemeText(HDC hDC, int nPartID, int nStateID, LPCWSTR pszText, int nCharCount, DWORD dwTextFlags, DWORD dwTextFlags2, LPCRECT pRect) { @@ -221,7 +190,7 @@ class CTheme return ::GetThemeBackgroundExtent(m_hTheme, hDC, nPartID, nStateID, pContentRect, pExtentRect); } - HRESULT GetThemePartSize(HDC hDC, int nPartID, int nStateID, LPRECT pRect, enum THEMESIZE eSize, LPSIZE pSize) const + HRESULT GetThemePartSize(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, enum THEMESIZE eSize, LPSIZE pSize) const { ATLASSERT(m_hTheme != NULL); return ::GetThemePartSize(m_hTheme, hDC, nPartID, nStateID, pRect, eSize, pSize); @@ -236,12 +205,7 @@ class CTheme HRESULT GetThemeTextMetrics(HDC hDC, int nPartID, int nStateID, PTEXTMETRICW pTextMetric) const { ATLASSERT(m_hTheme != NULL); -#ifdef _WTL_NEW_UXTHEME return ::GetThemeTextMetrics(m_hTheme, hDC, nPartID, nStateID, pTextMetric); -#else // !_WTL_NEW_UXTHEME - // Note: The cast to PTEXTMETRIC is because uxtheme.h incorrectly uses it instead of PTEXTMETRICW - return ::GetThemeTextMetrics(m_hTheme, hDC, nPartID, nStateID, (PTEXTMETRIC)pTextMetric); -#endif // !_WTL_NEW_UXTHEME } HRESULT GetThemeBackgroundRegion(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, HRGN* pRegion) const @@ -326,23 +290,13 @@ class CTheme HRESULT GetThemeFont(int nPartID, HDC hDC, int nStateID, int nPropID, LOGFONTW* pFont) const { ATLASSERT(m_hTheme != NULL); -#ifdef _WTL_NEW_UXTHEME return ::GetThemeFont(m_hTheme, hDC, nPartID, nStateID, nPropID, pFont); -#else // !_WTL_NEW_UXTHEME - // Note: The cast to LOGFONT* is because uxtheme.h incorrectly uses it instead of LOGFONTW* - return ::GetThemeFont(m_hTheme, hDC, nPartID, nStateID, nPropID, (LOGFONT*)pFont); -#endif // !_WTL_NEW_UXTHEME } HRESULT GetThemeFont(HDC hDC, int nPartID, int nStateID, int nPropID, LOGFONTW* pFont) const { ATLASSERT(m_hTheme != NULL); -#ifdef _WTL_NEW_UXTHEME return ::GetThemeFont(m_hTheme, hDC, nPartID, nStateID, nPropID, pFont); -#else // !_WTL_NEW_UXTHEME - // Note: The cast to LOGFONT* is because uxtheme.h incorrectly uses it instead of LOGFONTW* - return ::GetThemeFont(m_hTheme, hDC, nPartID, nStateID, nPropID, (LOGFONT*)pFont); -#endif // !_WTL_NEW_UXTHEME } HRESULT GetThemeRect(int nPartID, int nStateID, int nPropID, LPRECT pRect) const @@ -402,12 +356,7 @@ class CTheme HRESULT GetThemeSysFont(int nFontID, LOGFONTW* plf) const { ATLASSERT(m_hTheme != NULL); -#ifdef _WTL_NEW_UXTHEME return ::GetThemeSysFont(m_hTheme, nFontID, plf); -#else // !_WTL_NEW_UXTHEME - // Note: The cast to LOGFONT* is because uxtheme.h incorrectly uses it instead of LOGFONTW* - return ::GetThemeSysFont(m_hTheme, nFontID, (LOGFONT*)plf); -#endif // !_WTL_NEW_UXTHEME } HRESULT GetThemeSysString(int nStringID, LPWSTR pszStringBuff, int cchMaxStringChars) const @@ -422,7 +371,6 @@ class CTheme return ::GetThemeSysInt(m_hTheme, nIntID, pnValue); } -#ifdef _WTL_NEW_UXTHEME HTHEME OpenThemeDataEx(HWND hWnd, LPCWSTR pszClassList, DWORD dwFlags) { if(!IsThemingSupported()) @@ -433,6 +381,7 @@ class CTheme return m_hTheme; } +#if (_WIN32_WINNT >= 0x0600) HRESULT DrawThemeTextEx(HDC hDC, int nPartID, int nStateID, LPCWSTR pszText, int cchText, DWORD dwTextFlags, LPRECT lpRect, const DTTOPTS* pOptions) { ATLASSERT(m_hTheme != NULL); @@ -444,7 +393,7 @@ class CTheme ATLASSERT(m_hTheme != NULL); return ::GetThemeTransitionDuration(m_hTheme, nPartID, nFromStateID, nToStateID, nPropID, &dwDuration); } -#endif // _WTL_NEW_UXTHEME +#endif // (_WIN32_WINNT >= 0x0600) #if (_WIN32_WINNT >= 0x0600) HRESULT GetThemeBitmap(int nPartID, int nStateID, int nPropID, ULONG uFlags, HBITMAP& hBitmap) @@ -459,6 +408,26 @@ class CTheme return ::GetThemeStream(m_hTheme, nPartID, nStateID, nPropID, ppvStream, pcbStream, hInstance); } #endif // (_WIN32_WINNT >= 0x0600) + +#if (_WIN32_WINNT >= 0x0602) + HRESULT GetThemeAnimationProperty(int iStoryboardId, int iTargetId, TA_PROPERTY eProperty, VOID* pvProperty, DWORD cbSize, DWORD* pcbSizeOut) + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeAnimationProperty(m_hTheme, iStoryboardId, iTargetId, eProperty, pvProperty, cbSize, pcbSizeOut); + } + + HRESULT GetThemeAnimationTransform(int iStoryboardId, int iTargetId, DWORD dwTransformIndex, TA_TRANSFORM* pTransform, DWORD cbSize, DWORD* pcbSizeOut) + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeAnimationTransform(m_hTheme, iStoryboardId, iTargetId, dwTransformIndex, pTransform, cbSize, pcbSizeOut); + } + + HRESULT GetThemeTimingFunction(int iTimingFunctionId, TA_TIMINGFUNCTION* pTimingFunction, DWORD cbSize, DWORD* pcbSizeOut) + { + ATLASSERT(m_hTheme != NULL); + return ::GetThemeTimingFunction(m_hTheme, iTimingFunctionId, pTimingFunction, cbSize, pcbSizeOut); + } +#endif // (_WIN32_WINNT >= 0x0602) }; __declspec(selectany) int CTheme::m_nIsThemingSupported = -1; @@ -493,17 +462,17 @@ inline bool AtlDrawThemeClientEdge(HTHEME hTheme, HWND hWnd, HRGN hRgnUpdate = N return false; // Get border size - int cxBorder = GetSystemMetrics(SM_CXBORDER); - int cyBorder = GetSystemMetrics(SM_CYBORDER); + int cxBorder = ::GetSystemMetrics(SM_CXBORDER); + int cyBorder = ::GetSystemMetrics(SM_CYBORDER); if(SUCCEEDED(::GetThemeInt(hTheme, nPartID, nStateID, TMT_SIZINGBORDERWIDTH, &cxBorder))) cyBorder = cxBorder; - RECT rect; + RECT rect = { 0 }; ::GetWindowRect(hWnd, &rect); // Remove the client edge from the update region - int cxEdge = GetSystemMetrics(SM_CXEDGE); - int cyEdge = GetSystemMetrics(SM_CYEDGE); + int cxEdge = ::GetSystemMetrics(SM_CXEDGE); + int cyEdge = ::GetSystemMetrics(SM_CYEDGE); ::InflateRect(&rect, -cxEdge, -cyEdge); CRgn rgn; rgn.CreateRectRgnIndirect(&rect); @@ -522,15 +491,10 @@ inline bool AtlDrawThemeClientEdge(HTHEME hTheme, HWND hWnd, HRGN hRgnUpdate = N ::DrawThemeBackground(hTheme, dc, nPartID, nStateID, &rect, NULL); // Use background brush too, since theme border might not cover everything - if(cxBorder < cxEdge && cyBorder < cyEdge) + if((cxBorder < cxEdge) && (cyBorder < cyEdge)) { if(hBrush == NULL) -// need conditional code because types don't match in winuser.h -#ifdef _WIN64 hBrush = (HBRUSH)::GetClassLongPtr(hWnd, GCLP_HBRBACKGROUND); -#else - hBrush = (HBRUSH)UlongToPtr(::GetClassLongPtr(hWnd, GCLP_HBRBACKGROUND)); -#endif ::InflateRect(&rect, cxBorder - cxEdge, cyBorder - cyEdge); dc.FillRect(&rect, hBrush); @@ -580,7 +544,7 @@ class CThemeImpl : public TBase if(m_lpstrThemeClassList == NULL) return false; - SecureHelper::strcpyW_x(m_lpstrThemeClassList, cchLen, lpstrThemeClassList); + ATL::Checked::wcscpy_s(m_lpstrThemeClassList, cchLen, lpstrThemeClassList); return true; } @@ -591,7 +555,7 @@ class CThemeImpl : public TBase if(cchListBuffer < cchLen) return false; - SecureHelper::strcpyW_x(lpstrThemeClassList, cchListBuffer, m_lpstrThemeClassList); + ATL::Checked::wcscpy_s(lpstrThemeClassList, cchListBuffer, m_lpstrThemeClassList); return true; } @@ -608,6 +572,7 @@ class CThemeImpl : public TBase m_dwExtendedStyle = dwExtendedStyle; else m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); + return dwPrevStyle; } @@ -624,7 +589,8 @@ class CThemeImpl : public TBase ATLASSERT(m_lpstrThemeClassList != NULL); if(m_lpstrThemeClassList == NULL) return NULL; - CloseThemeData(); + this->CloseThemeData(); + return TBase::OpenThemeData(pT->m_hWnd, m_lpstrThemeClassList); } @@ -632,6 +598,7 @@ class CThemeImpl : public TBase { if(!SetThemeClassList(pszClassList)) return NULL; + return OpenThemeData(); } @@ -682,14 +649,10 @@ class CThemeImpl : public TBase T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); -#ifdef _WTL_NEW_UXTHEME return ::DrawThemeParentBackground(pT->m_hWnd, hDC, pRect); -#else - return ::DrawThemeParentBackground(pT->m_hWnd, hDC, (RECT*)pRect); -#endif } -#ifdef _WTL_NEW_UXTHEME +#if (_WIN32_WINNT >= 0x0600) HRESULT SetWindowThemeAttribute(WINDOWTHEMEATTRIBUTETYPE type, PVOID pvAttribute, DWORD cbAttribute) { if(!IsThemingSupported()) @@ -720,7 +683,7 @@ class CThemeImpl : public TBase ATLASSERT(::IsWindow(pT->m_hWnd)); return ::DrawThemeParentBackgroundEx(pT->m_hWnd, hDC, dwFlags, lpRect); } -#endif // _WTL_NEW_UXTHEME +#endif // (_WIN32_WINNT >= 0x0600) // Message map and handlers // Note: If you handle any of these messages in your derived class, @@ -736,22 +699,25 @@ class CThemeImpl : public TBase { if(m_lpstrThemeClassList != NULL) OpenThemeData(); + bHandled = FALSE; return 1; } LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { - CloseThemeData(); + this->CloseThemeData(); + bHandled = FALSE; return 1; } LRESULT OnThemeChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { - CloseThemeData(); + this->CloseThemeData(); if(m_lpstrThemeClassList != NULL) - OpenThemeData(); + this->OpenThemeData(); + bHandled = FALSE; return 1; } @@ -762,20 +728,21 @@ class CThemeImpl : public TBase ATLASSERT(::IsWindow(pT->m_hWnd)); LRESULT lRet = 0; bHandled = FALSE; - if(IsThemingSupported() && ((pT->GetExStyle() & WS_EX_CLIENTEDGE) != 0)) + if(this->IsThemingSupported() && ((pT->GetExStyle() & WS_EX_CLIENTEDGE) != 0)) { if((m_dwExtendedStyle & THEME_EX_3DCLIENTEDGE) != 0) { lRet = ::DefWindowProc(pT->m_hWnd, uMsg, wParam, lParam); bHandled = TRUE; } - else if((m_hTheme != NULL) && ((m_dwExtendedStyle & THEME_EX_THEMECLIENTEDGE) != 0)) + else if((this->m_hTheme != NULL) && ((m_dwExtendedStyle & THEME_EX_THEMECLIENTEDGE) != 0)) { HRGN hRgn = (wParam != 1) ? (HRGN)wParam : NULL; if(pT->DrawThemeClientEdge(hRgn)) bHandled = TRUE; } } + return lRet; } @@ -783,14 +750,14 @@ class CThemeImpl : public TBase bool DrawThemeClientEdge(HRGN hRgnUpdate) { T* pT = static_cast(this); - return AtlDrawThemeClientEdge(m_hTheme, pT->m_hWnd, hRgnUpdate, NULL, 0, 0); + return AtlDrawThemeClientEdge(this->m_hTheme, pT->m_hWnd, hRgnUpdate, NULL, 0, 0); } }; /////////////////////////////////////////////////////////////////////////////// // Buffered Paint and Animation -#ifdef _WTL_NEW_UXTHEME +#if (_WIN32_WINNT >= 0x0600) /////////////////////////////////////////////////////////////////////////////// // CBufferedPaintBase - Buffered Paint support for othe classes @@ -1051,6 +1018,11 @@ class CBufferedAnimation { return (::BufferedPaintRenderAnimation(hWnd, hDC) != FALSE); } + + static HRESULT StopAllAnimations(HWND hWnd) + { + return ::BufferedPaintStopAllAnimations(hWnd); + } }; @@ -1211,7 +1183,7 @@ class ATL_NO_VTABLE CBufferedAnimationWindowImpl : END_MSG_MAP() }; -#endif // _WTL_NEW_UXTHEME +#endif // (_WIN32_WINNT >= 0x0600) }; // namespace WTL diff --git a/thirdparty/wtl/atluser.h b/thirdparty/wtl/atluser.h index 087c3b9..5e35234 100644 --- a/thirdparty/wtl/atluser.h +++ b/thirdparty/wtl/atluser.h @@ -1,13 +1,10 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. +// Windows Template Library - WTL version 10.0 +// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. +// Microsoft Public License (http://opensource.org/licenses/MS-PL) +// which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLUSER_H__ #define __ATLUSER_H__ @@ -57,7 +54,7 @@ namespace WTL inline int AtlMessageBox(HWND hWndOwner, ATL::_U_STRINGorID message, ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uType = MB_OK | MB_ICONINFORMATION) { - ATLASSERT(hWndOwner == NULL || ::IsWindow(hWndOwner)); + ATLASSERT((hWndOwner == NULL) || ::IsWindow(hWndOwner)); LPTSTR lpstrMessage = NULL; if(IS_INTRESOURCE(message.m_lpstr)) @@ -81,7 +78,7 @@ inline int AtlMessageBox(HWND hWndOwner, ATL::_U_STRINGorID message, ATL::_U_STR } LPTSTR lpstrTitle = NULL; - if(IS_INTRESOURCE(title.m_lpstr) && LOWORD(title.m_lpstr) != 0) + if(IS_INTRESOURCE(title.m_lpstr) && (LOWORD(title.m_lpstr) != 0)) { for(int nLen = 256; ; nLen *= 2) { @@ -113,19 +110,6 @@ inline int AtlMessageBox(HWND hWndOwner, ATL::_U_STRINGorID message, ATL::_U_STR /////////////////////////////////////////////////////////////////////////////// // CMenu -#if (WINVER >= 0x0500) - #ifndef MII_SIZEOF_STRUCT - #define MII_SIZEOF_STRUCT(structname, member) (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0)))) + sizeof(((structname*)0)->member)) - #endif - #define MENUITEMINFO_SIZE_VERSION_400A MII_SIZEOF_STRUCT(MENUITEMINFOA, cch) - #define MENUITEMINFO_SIZE_VERSION_400W MII_SIZEOF_STRUCT(MENUITEMINFOW, cch) - #ifdef UNICODE - #define MENUITEMINFO_SIZE_VERSION_400 MENUITEMINFO_SIZE_VERSION_400W - #else - #define MENUITEMINFO_SIZE_VERSION_400 MENUITEMINFO_SIZE_VERSION_400A - #endif // !UNICODE -#endif // (WINVER >= 0x0500) - class CMenuItemInfo : public MENUITEMINFO { public: @@ -133,14 +117,6 @@ class CMenuItemInfo : public MENUITEMINFO { memset(this, 0, sizeof(MENUITEMINFO)); cbSize = sizeof(MENUITEMINFO); -#if (WINVER >= 0x0500) - // adjust struct size if running on older version of Windows - if(AtlIsOldWindows()) - { - ATLASSERT(cbSize > MENUITEMINFO_SIZE_VERSION_400); // must be - cbSize = MENUITEMINFO_SIZE_VERSION_400; - } -#endif // (WINVER >= 0x0500) } }; @@ -164,7 +140,7 @@ class CMenuT ~CMenuT() { - if(t_bManaged && m_hMenu != NULL) + if(t_bManaged && (m_hMenu != NULL)) DestroyMenu(); } @@ -177,7 +153,7 @@ class CMenuT void Attach(HMENU hMenuNew) { ATLASSERT(::IsMenu(hMenuNew)); - if(t_bManaged && m_hMenu != NULL && m_hMenu != hMenuNew) + if(t_bManaged && (m_hMenu != NULL) && (m_hMenu != hMenuNew)) ::DestroyMenu(m_hMenu); m_hMenu = hMenuNew; } @@ -220,14 +196,12 @@ class CMenuT return (m_hMenu != NULL) ? TRUE : FALSE; } -#ifndef _WIN32_WCE BOOL LoadMenuIndirect(const void* lpMenuTemplate) { ATLASSERT(m_hMenu == NULL); m_hMenu = ::LoadMenuIndirect(lpMenuTemplate); return (m_hMenu != NULL) ? TRUE : FALSE; } -#endif // !_WIN32_WCE BOOL DestroyMenu() { @@ -249,27 +223,17 @@ class CMenuT BOOL TrackPopupMenu(UINT nFlags, int x, int y, HWND hWnd, LPCRECT lpRect = NULL) { ATLASSERT(::IsMenu(m_hMenu)); -#ifndef _WIN32_WCE -#if (WINVER >= 0x0500) x = _FixTrackMenuPopupX(x, y); -#endif // !(WINVER >= 0x0500) return ::TrackPopupMenu(m_hMenu, nFlags, x, y, 0, hWnd, lpRect); -#else // CE specific - lpRect; - return ::TrackPopupMenuEx(m_hMenu, nFlags, x, y, hWnd, NULL); -#endif // _WIN32_WCE } BOOL TrackPopupMenuEx(UINT uFlags, int x, int y, HWND hWnd, LPTPMPARAMS lptpm = NULL) { ATLASSERT(::IsMenu(m_hMenu)); -#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) x = _FixTrackMenuPopupX(x, y); -#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) return ::TrackPopupMenuEx(m_hMenu, uFlags, x, y, hWnd, lptpm); } -#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) // helper that fixes popup menu X position when it's off-screen static int _FixTrackMenuPopupX(int x, int y) { @@ -305,7 +269,6 @@ class CMenuT ATLASSERT(::IsMenu(m_hMenu)); return ::SetMenuInfo(m_hMenu, lpMenuInfo); } -#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) // Menu Item Operations BOOL AppendMenu(UINT nFlags, UINT_PTR nIDNewItem = 0, LPCTSTR lpszNewItem = NULL) @@ -321,7 +284,6 @@ class CMenuT return ::AppendMenu(m_hMenu, nFlags | MF_POPUP, (UINT_PTR)hSubMenu, lpszNewItem); } -#ifndef _WIN32_WCE BOOL AppendMenu(UINT nFlags, UINT_PTR nIDNewItem, HBITMAP hBmp) { ATLASSERT(::IsMenu(m_hMenu)); @@ -334,7 +296,6 @@ class CMenuT ATLASSERT(::IsMenu(hSubMenu)); return ::AppendMenu(m_hMenu, nFlags | (MF_BITMAP | MF_POPUP), (UINT_PTR)hSubMenu, (LPCTSTR)hBmp); } -#endif // !_WIN32_WCE UINT CheckMenuItem(UINT nIDCheckItem, UINT nCheck) { @@ -348,7 +309,6 @@ class CMenuT return ::EnableMenuItem(m_hMenu, nIDEnableItem, nEnable); } -#ifndef _WIN32_WCE BOOL HiliteMenuItem(HWND hWnd, UINT uIDHiliteItem, UINT uHilite) { ATLASSERT(::IsMenu(m_hMenu)); @@ -385,7 +345,6 @@ class CMenuT return ::GetMenuString(m_hMenu, nIDItem, NULL, 0, nFlags); } -#ifndef _ATL_NO_COM BOOL GetMenuString(UINT nIDItem, BSTR& bstrText, UINT nFlags) const { USES_CONVERSION; @@ -400,7 +359,7 @@ class CMenuT } nLen++; // increment to include terminating NULL char - CTempBuffer buff; + ATL::CTempBuffer buff; LPTSTR lpszText = buff.Allocate(nLen); if(lpszText == NULL) return FALSE; @@ -411,42 +370,9 @@ class CMenuT bstrText = ::SysAllocString(T2OLE(lpszText)); return (bstrText != NULL) ? TRUE : FALSE; } -#endif // !_ATL_NO_COM - -#elif (_ATL_VER >= 0x0800) - int GetMenuItemCount() const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ATL::GetMenuItemCount(m_hMenu); - } - - UINT GetMenuItemID(int nPos) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ATL::GetMenuItemID(m_hMenu, nPos); - } - - UINT GetMenuState(UINT nID, UINT nFlags) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ATL::GetMenuState(m_hMenu, nID, nFlags); - } - int GetMenuString(UINT nIDItem, LPTSTR lpString, int nMaxCount, UINT nFlags) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ATL::GetMenuString(m_hMenu, nIDItem, lpString, nMaxCount, nFlags); - } - - int GetMenuStringLen(UINT nIDItem, UINT nFlags) const - { - ATLASSERT(::IsMenu(m_hMenu)); - return ATL::GetMenuString(m_hMenu, nIDItem, NULL, 0, nFlags); - } -#endif // (_ATL_VER >= 0x0800) - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - int GetMenuString(UINT nIDItem, _CSTRING_NS::CString& strText, UINT nFlags) const +#ifdef __ATLSTR_H__ + int GetMenuString(UINT nIDItem, ATL::CString& strText, UINT nFlags) const { ATLASSERT(::IsMenu(m_hMenu)); @@ -462,7 +388,7 @@ class CMenuT strText.ReleaseBuffer(); return nRet; } -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) +#endif // __ATLSTR_H__ CMenuHandle GetSubMenu(int nPos) const { @@ -483,7 +409,6 @@ class CMenuT return ::InsertMenu(m_hMenu, nPosition, nFlags | MF_POPUP, (UINT_PTR)hSubMenu, lpszNewItem); } -#ifndef _WIN32_WCE BOOL InsertMenu(UINT nPosition, UINT nFlags, UINT_PTR nIDNewItem, HBITMAP hBmp) { ATLASSERT(::IsMenu(m_hMenu)); @@ -522,7 +447,6 @@ class CMenuT ATLASSERT(::IsMenu(hSubMenu)); return ::ModifyMenu(m_hMenu, nPosition, nFlags | (MF_BITMAP | MF_POPUP), (UINT_PTR)hSubMenu, (LPCTSTR)hBmp); } -#endif // !_WIN32_WCE BOOL RemoveMenu(UINT nPosition, UINT nFlags) { @@ -530,13 +454,11 @@ class CMenuT return ::RemoveMenu(m_hMenu, nPosition, nFlags); } -#ifndef _WIN32_WCE BOOL SetMenuItemBitmaps(UINT nPosition, UINT nFlags, HBITMAP hBmpUnchecked, HBITMAP hBmpChecked) { ATLASSERT(::IsMenu(m_hMenu)); return ::SetMenuItemBitmaps(m_hMenu, nPosition, nFlags, hBmpUnchecked, hBmpChecked); } -#endif // !_WIN32_WCE BOOL CheckMenuRadioItem(UINT nIDFirst, UINT nIDLast, UINT nIDItem, UINT nFlags) { @@ -556,7 +478,6 @@ class CMenuT return (BOOL)::SetMenuItemInfo(m_hMenu, uItem, bByPosition, lpmii); } -#ifndef _WIN32_WCE BOOL InsertMenuItem(UINT uItem, BOOL bByPosition, LPMENUITEMINFO lpmii) { ATLASSERT(::IsMenu(m_hMenu)); @@ -599,7 +520,6 @@ class CMenuT ATLASSERT(::IsMenu(m_hMenu)); return ::GetMenuContextHelpId(m_hMenu); } -#endif // !_WIN32_WCE }; @@ -618,7 +538,7 @@ class CAcceleratorT ~CAcceleratorT() { - if(t_bManaged && m_hAccel != NULL) + if(t_bManaged && (m_hAccel != NULL)) ::DestroyAcceleratorTable(m_hAccel); } @@ -630,7 +550,7 @@ class CAcceleratorT void Attach(HACCEL hAccel) { - if(t_bManaged && m_hAccel != NULL) + if(t_bManaged && (m_hAccel != NULL)) ::DestroyAcceleratorTable(m_hAccel); m_hAccel = hAccel; } @@ -672,7 +592,6 @@ class CAcceleratorT } // Operations -#ifndef _WIN32_WCE int CopyAcceleratorTable(LPACCEL lpAccelDst, int cEntries) { ATLASSERT(m_hAccel != NULL); @@ -685,7 +604,6 @@ class CAcceleratorT ATLASSERT(m_hAccel != NULL); return ::CopyAcceleratorTable(m_hAccel, NULL, 0); } -#endif // !_WIN32_WCE BOOL TranslateAccelerator(HWND hWnd, LPMSG pMsg) { @@ -715,7 +633,7 @@ class CIconT ~CIconT() { - if(t_bManaged && m_hIcon != NULL) + if(t_bManaged && (m_hIcon != NULL)) ::DestroyIcon(m_hIcon); } @@ -727,7 +645,7 @@ class CIconT void Attach(HICON hIcon) { - if(t_bManaged && m_hIcon != NULL) + if(t_bManaged && (m_hIcon != NULL)) ::DestroyIcon(m_hIcon); m_hIcon = hIcon; } @@ -758,7 +676,6 @@ class CIconT return m_hIcon; } -#ifndef _WIN32_WCE HICON LoadOEMIcon(LPCTSTR lpstrIconName) { ATLASSERT(m_hIcon == NULL); @@ -792,7 +709,6 @@ class CIconT m_hIcon = ::CreateIconFromResourceEx(pbBits, cbBits, TRUE, dwVersion, cxDesired, cyDesired, uFlags); return m_hIcon; } -#endif // !_WIN32_WCE HICON CreateIconIndirect(PICONINFO pIconInfo) { @@ -802,7 +718,6 @@ class CIconT return m_hIcon; } -#ifndef _WIN32_WCE HICON ExtractIcon(LPCTSTR lpszExeFileName, UINT nIconIndex) { ATLASSERT(m_hIcon == NULL); @@ -819,7 +734,6 @@ class CIconT m_hIcon = ::ExtractAssociatedIcon(hInst, lpIconPath, lpiIcon); return m_hIcon; } -#endif // !_WIN32_WCE BOOL DestroyIcon() { @@ -831,7 +745,6 @@ class CIconT } // Operations -#ifndef _WIN32_WCE HICON CopyIcon() { ATLASSERT(m_hIcon != NULL); @@ -843,26 +756,17 @@ class CIconT ATLASSERT(m_hIcon != NULL); return ::DuplicateIcon(NULL, m_hIcon); } -#endif // !_WIN32_WCE BOOL DrawIcon(HDC hDC, int x, int y) { ATLASSERT(m_hIcon != NULL); -#ifndef _WIN32_WCE return ::DrawIcon(hDC, x, y, m_hIcon); -#else // CE specific - return ::DrawIconEx(hDC, x, y, m_hIcon, 0, 0, 0, NULL, DI_NORMAL); -#endif // _WIN32_WCE } BOOL DrawIcon(HDC hDC, POINT pt) { ATLASSERT(m_hIcon != NULL); -#ifndef _WIN32_WCE return ::DrawIcon(hDC, pt.x, pt.y, m_hIcon); -#else // CE specific - return ::DrawIconEx(hDC, pt.x, pt.y, m_hIcon, 0, 0, 0, NULL, DI_NORMAL); -#endif // _WIN32_WCE } BOOL DrawIconEx(HDC hDC, int x, int y, int cxWidth, int cyWidth, UINT uStepIfAniCur = 0, HBRUSH hbrFlickerFreeDraw = NULL, UINT uFlags = DI_NORMAL) @@ -877,7 +781,6 @@ class CIconT return ::DrawIconEx(hDC, pt.x, pt.y, m_hIcon, size.cx, size.cy, uStepIfAniCur, hbrFlickerFreeDraw, uFlags); } -#ifndef _WIN32_WCE BOOL GetIconInfo(PICONINFO pIconInfo) const { ATLASSERT(m_hIcon != NULL); @@ -924,22 +827,19 @@ class CIconT return ::LoadIconWithScaleDown(NULL, (LPCWSTR)lpstrIconName, cx, cy, &m_hIcon); } #endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) -#endif // !_WIN32_WCE // Helper -#ifndef _WIN32_WCE static bool IsOEMIcon(LPCTSTR lpstrIconName) { #if (WINVER >= 0x0600) - return (lpstrIconName == IDI_APPLICATION || lpstrIconName == IDI_ASTERISK || lpstrIconName == IDI_EXCLAMATION || - lpstrIconName == IDI_HAND || lpstrIconName == IDI_QUESTION || lpstrIconName == IDI_WINLOGO || - lpstrIconName == IDI_SHIELD); + return ((lpstrIconName == IDI_APPLICATION) || (lpstrIconName == IDI_ASTERISK) || (lpstrIconName == IDI_EXCLAMATION) || + (lpstrIconName == IDI_HAND) || (lpstrIconName == IDI_QUESTION) || (lpstrIconName == IDI_WINLOGO) || + (lpstrIconName == IDI_SHIELD)); #else // !(WINVER >= 0x0600) - return (lpstrIconName == IDI_APPLICATION || lpstrIconName == IDI_ASTERISK || lpstrIconName == IDI_EXCLAMATION || - lpstrIconName == IDI_HAND || lpstrIconName == IDI_QUESTION || lpstrIconName == IDI_WINLOGO); + return ((lpstrIconName == IDI_APPLICATION) || (lpstrIconName == IDI_ASTERISK) || (lpstrIconName == IDI_EXCLAMATION) || + (lpstrIconName == IDI_HAND) || (lpstrIconName == IDI_QUESTION) || (lpstrIconName == IDI_WINLOGO)); #endif // !(WINVER >= 0x0600) } -#endif // !_WIN32_WCE }; typedef CIconT CIconHandle; @@ -966,7 +866,7 @@ class CCursorT ~CCursorT() { - if(t_bManaged && m_hCursor != NULL) + if(t_bManaged && (m_hCursor != NULL)) DestroyCursor(); } @@ -978,7 +878,7 @@ class CCursorT void Attach(HCURSOR hCursor) { - if(t_bManaged && m_hCursor != NULL) + if(t_bManaged && (m_hCursor != NULL)) DestroyCursor(); m_hCursor = hCursor; } @@ -1005,20 +905,12 @@ class CCursorT HCURSOR LoadSysCursor(LPCTSTR lpstrCursorName) { ATLASSERT(m_hCursor == NULL); -#if (WINVER >= 0x0500) - ATLASSERT(lpstrCursorName == IDC_ARROW || lpstrCursorName == IDC_IBEAM || lpstrCursorName == IDC_WAIT || - lpstrCursorName == IDC_CROSS || lpstrCursorName == IDC_UPARROW || lpstrCursorName == IDC_SIZE || - lpstrCursorName == IDC_ICON || lpstrCursorName == IDC_SIZENWSE || lpstrCursorName == IDC_SIZENESW || - lpstrCursorName == IDC_SIZEWE || lpstrCursorName == IDC_SIZENS || lpstrCursorName == IDC_SIZEALL || - lpstrCursorName == IDC_NO || lpstrCursorName == IDC_APPSTARTING || lpstrCursorName == IDC_HELP || - lpstrCursorName == IDC_HAND); -#else // !(WINVER >= 0x0500) - ATLASSERT(lpstrCursorName == IDC_ARROW || lpstrCursorName == IDC_IBEAM || lpstrCursorName == IDC_WAIT || - lpstrCursorName == IDC_CROSS || lpstrCursorName == IDC_UPARROW || lpstrCursorName == IDC_SIZE || - lpstrCursorName == IDC_ICON || lpstrCursorName == IDC_SIZENWSE || lpstrCursorName == IDC_SIZENESW || - lpstrCursorName == IDC_SIZEWE || lpstrCursorName == IDC_SIZENS || lpstrCursorName == IDC_SIZEALL || - lpstrCursorName == IDC_NO || lpstrCursorName == IDC_APPSTARTING || lpstrCursorName == IDC_HELP); -#endif // !(WINVER >= 0x0500) + ATLASSERT((lpstrCursorName == IDC_ARROW) || (lpstrCursorName == IDC_IBEAM) || (lpstrCursorName == IDC_WAIT) || + (lpstrCursorName == IDC_CROSS) || (lpstrCursorName == IDC_UPARROW) || (lpstrCursorName == IDC_SIZE) || + (lpstrCursorName == IDC_ICON) || (lpstrCursorName == IDC_SIZENWSE) || (lpstrCursorName == IDC_SIZENESW) || + (lpstrCursorName == IDC_SIZEWE) || (lpstrCursorName == IDC_SIZENS) || (lpstrCursorName == IDC_SIZEALL) || + (lpstrCursorName == IDC_NO) || (lpstrCursorName == IDC_APPSTARTING) || (lpstrCursorName == IDC_HELP) || + (lpstrCursorName == IDC_HAND)); m_hCursor = ::LoadCursor(NULL, lpstrCursorName); return m_hCursor; } @@ -1036,7 +928,6 @@ class CCursorT return m_hCursor; } -#ifndef _WIN32_WCE HCURSOR LoadCursorFromFile(LPCTSTR pstrFilename) { ATLASSERT(m_hCursor == NULL); @@ -1044,18 +935,14 @@ class CCursorT m_hCursor = ::LoadCursorFromFile(pstrFilename); return m_hCursor; } -#endif // !_WIN32_WCE -#if !defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))) HCURSOR CreateCursor(int xHotSpot, int yHotSpot, int nWidth, int nHeight, CONST VOID *pvANDPlane, CONST VOID *pvXORPlane) { ATLASSERT(m_hCursor == NULL); m_hCursor = ::CreateCursor(ModuleHelper::GetResourceInstance(), xHotSpot, yHotSpot, nWidth, nHeight, pvANDPlane, pvXORPlane); return m_hCursor; } -#endif // !defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))) -#ifndef _WIN32_WCE HCURSOR CreateCursorFromResource(PBYTE pBits, DWORD dwResSize, DWORD dwVersion = 0x00030000) { ATLASSERT(m_hCursor == NULL); @@ -1072,39 +959,29 @@ class CCursorT m_hCursor = (HCURSOR)::CreateIconFromResourceEx(pbBits, cbBits, FALSE, dwVersion, cxDesired, cyDesired, uFlags); return m_hCursor; } -#endif // !_WIN32_WCE BOOL DestroyCursor() { ATLASSERT(m_hCursor != NULL); -#if !defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))) BOOL bRet = ::DestroyCursor(m_hCursor); if(bRet != FALSE) m_hCursor = NULL; return bRet; -#else // !(!defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)))) - ATLTRACE2(atlTraceUI, 0, _T("Warning: This version of Windows CE does not have ::DestroyCursor()\n")); - return FALSE; -#endif // !(!defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)))) } // Operations -#ifndef _WIN32_WCE HCURSOR CopyCursor() { ATLASSERT(m_hCursor != NULL); return (HCURSOR)::CopyIcon((HICON)m_hCursor); } -#endif // !_WIN32_WCE -#if (WINVER >= 0x0500) && !defined(_WIN32_WCE) BOOL GetCursorInfo(LPCURSORINFO pCursorInfo) { ATLASSERT(m_hCursor != NULL); ATLASSERT(pCursorInfo != NULL); return ::GetCursorInfo(pCursorInfo); } -#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE) }; typedef CCursorT CCursorHandle; @@ -1151,13 +1028,12 @@ class CResource return true; } -#ifndef _WIN32_WCE - bool LoadEx(ATL::_U_STRINGorID Type, ATL::_U_STRINGorID ID, WORD wLanguage) + bool LoadEx(ATL::_U_STRINGorID ID, ATL::_U_STRINGorID Type, WORD wLanguage) { ATLASSERT(m_hResource == NULL); ATLASSERT(m_hGlobal == NULL); - m_hResource = ::FindResourceEx(ModuleHelper::GetResourceInstance(), ID.m_lpstr, Type.m_lpstr, wLanguage); + m_hResource = ::FindResourceEx(ModuleHelper::GetResourceInstance(), Type.m_lpstr, ID.m_lpstr, wLanguage); if(m_hResource == NULL) return false; @@ -1170,7 +1046,6 @@ class CResource return true; } -#endif // !_WIN32_WCE // Misc. operations DWORD GetSize() const @@ -1237,8 +1112,8 @@ inline HBITMAP AtlLoadBitmap(ATL::_U_STRINGorID bitmap) inline HBITMAP AtlLoadSysBitmap(ATL::_U_STRINGorID bitmap) { #ifdef _DEBUG - WORD wID = (WORD)bitmap.m_lpstr; - ATLASSERT(wID >= 32734 && wID <= 32767); + WORD wID = LOWORD(bitmap.m_lpstr); + ATLASSERT((wID >= 32734) && (wID <= 32767)); #endif // _DEBUG return ::LoadBitmap(NULL, bitmap.m_lpstr); } @@ -1251,20 +1126,12 @@ inline HCURSOR AtlLoadCursor(ATL::_U_STRINGorID cursor) inline HCURSOR AtlLoadSysCursor(LPCTSTR lpCursorName) { -#if (WINVER >= 0x0500) - ATLASSERT(lpCursorName == IDC_ARROW || lpCursorName == IDC_IBEAM || lpCursorName == IDC_WAIT || - lpCursorName == IDC_CROSS || lpCursorName == IDC_UPARROW || lpCursorName == IDC_SIZE || - lpCursorName == IDC_ICON || lpCursorName == IDC_SIZENWSE || lpCursorName == IDC_SIZENESW || - lpCursorName == IDC_SIZEWE || lpCursorName == IDC_SIZENS || lpCursorName == IDC_SIZEALL || - lpCursorName == IDC_NO || lpCursorName == IDC_APPSTARTING || lpCursorName == IDC_HELP || - lpCursorName == IDC_HAND); -#else // !(WINVER >= 0x0500) - ATLASSERT(lpCursorName == IDC_ARROW || lpCursorName == IDC_IBEAM || lpCursorName == IDC_WAIT || - lpCursorName == IDC_CROSS || lpCursorName == IDC_UPARROW || lpCursorName == IDC_SIZE || - lpCursorName == IDC_ICON || lpCursorName == IDC_SIZENWSE || lpCursorName == IDC_SIZENESW || - lpCursorName == IDC_SIZEWE || lpCursorName == IDC_SIZENS || lpCursorName == IDC_SIZEALL || - lpCursorName == IDC_NO || lpCursorName == IDC_APPSTARTING || lpCursorName == IDC_HELP); -#endif // !(WINVER >= 0x0500) + ATLASSERT((lpCursorName == IDC_ARROW) || (lpCursorName == IDC_IBEAM) || (lpCursorName == IDC_WAIT) || + (lpCursorName == IDC_CROSS) || (lpCursorName == IDC_UPARROW) || (lpCursorName == IDC_SIZE) || + (lpCursorName == IDC_ICON) || (lpCursorName == IDC_SIZENWSE) || (lpCursorName == IDC_SIZENESW) || + (lpCursorName == IDC_SIZEWE) || (lpCursorName == IDC_SIZENS) || (lpCursorName == IDC_SIZEALL) || + (lpCursorName == IDC_NO) || (lpCursorName == IDC_APPSTARTING) || (lpCursorName == IDC_HELP) || + (lpCursorName == IDC_HAND)); return ::LoadCursor(NULL, lpCursorName); } @@ -1273,20 +1140,18 @@ inline HICON AtlLoadIcon(ATL::_U_STRINGorID icon) return ::LoadIcon(ModuleHelper::GetResourceInstance(), icon.m_lpstr); } -#ifndef _WIN32_WCE inline HICON AtlLoadSysIcon(LPCTSTR lpIconName) { #if (WINVER >= 0x0600) - ATLASSERT(lpIconName == IDI_APPLICATION || lpIconName == IDI_ASTERISK || lpIconName == IDI_EXCLAMATION || - lpIconName == IDI_HAND || lpIconName == IDI_QUESTION || lpIconName == IDI_WINLOGO || - lpIconName == IDI_SHIELD); + ATLASSERT((lpIconName == IDI_APPLICATION) || (lpIconName == IDI_ASTERISK) || (lpIconName == IDI_EXCLAMATION) || + (lpIconName == IDI_HAND) || (lpIconName == IDI_QUESTION) || (lpIconName == IDI_WINLOGO) || + (lpIconName == IDI_SHIELD)); #else // !(WINVER >= 0x0600) - ATLASSERT(lpIconName == IDI_APPLICATION || lpIconName == IDI_ASTERISK || lpIconName == IDI_EXCLAMATION || - lpIconName == IDI_HAND || lpIconName == IDI_QUESTION || lpIconName == IDI_WINLOGO); + ATLASSERT((lpIconName == IDI_APPLICATION) || (lpIconName == IDI_ASTERISK) || (lpIconName == IDI_EXCLAMATION) || + (lpIconName == IDI_HAND) || (lpIconName == IDI_QUESTION) || (lpIconName == IDI_WINLOGO)); #endif // !(WINVER >= 0x0600) return ::LoadIcon(NULL, lpIconName); } -#endif // !_WIN32_WCE inline HBITMAP AtlLoadBitmapImage(ATL::_U_STRINGorID bitmap, UINT fuLoad = LR_DEFAULTCOLOR) { @@ -1306,7 +1171,7 @@ inline HICON AtlLoadIconImage(ATL::_U_STRINGorID icon, UINT fuLoad = LR_DEFAULTC #ifdef OEMRESOURCE inline HBITMAP AtlLoadSysBitmapImage(WORD wBitmapID, UINT fuLoad = LR_DEFAULTCOLOR) { - ATLASSERT(wBitmapID >= 32734 && wBitmapID <= 32767); + ATLASSERT((wBitmapID >= 32734) && (wBitmapID <= 32767)); ATLASSERT((fuLoad & LR_LOADFROMFILE) == 0); // this one doesn't load from a file return (HBITMAP)::LoadImage(NULL, MAKEINTRESOURCE(wBitmapID), IMAGE_BITMAP, 0, 0, fuLoad); } @@ -1315,8 +1180,8 @@ inline HBITMAP AtlLoadSysBitmapImage(WORD wBitmapID, UINT fuLoad = LR_DEFAULTCOL inline HCURSOR AtlLoadSysCursorImage(ATL::_U_STRINGorID cursor, UINT fuLoad = LR_DEFAULTCOLOR | LR_DEFAULTSIZE, int cxDesired = 0, int cyDesired = 0) { #ifdef _DEBUG - WORD wID = (WORD)cursor.m_lpstr; - ATLASSERT((wID >= 32512 && wID <= 32516) || (wID >= 32640 && wID <= 32648) || (wID == 32650) || (wID == 32651)); + WORD wID = LOWORD(cursor.m_lpstr); + ATLASSERT(((wID >= 32512) && (wID <= 32516)) || ((wID >= 32640) && (wID <= 32648)) || (wID == 32650) || (wID == 32651)); ATLASSERT((fuLoad & LR_LOADFROMFILE) == 0); // this one doesn't load from a file #endif // _DEBUG return (HCURSOR)::LoadImage(NULL, cursor.m_lpstr, IMAGE_CURSOR, cxDesired, cyDesired, fuLoad); @@ -1325,37 +1190,13 @@ inline HCURSOR AtlLoadSysCursorImage(ATL::_U_STRINGorID cursor, UINT fuLoad = LR inline HICON AtlLoadSysIconImage(ATL::_U_STRINGorID icon, UINT fuLoad = LR_DEFAULTCOLOR | LR_DEFAULTSIZE, int cxDesired = 0, int cyDesired = 0) { #ifdef _DEBUG - WORD wID = (WORD)icon.m_lpstr; - ATLASSERT(wID >= 32512 && wID <= 32517); + WORD wID = LOWORD(icon.m_lpstr); + ATLASSERT((wID >= 32512) && (wID <= 32517)); ATLASSERT((fuLoad & LR_LOADFROMFILE) == 0); // this one doesn't load from a file #endif // _DEBUG return (HICON)::LoadImage(NULL, icon.m_lpstr, IMAGE_ICON, cxDesired, cyDesired, fuLoad); } -#if (_ATL_VER < 0x0700) -inline int AtlLoadString(UINT uID, LPTSTR lpBuffer, int nBufferMax) -{ - return ::LoadString(ModuleHelper::GetResourceInstance(), uID, lpBuffer, nBufferMax); -} -#else - -using ATL::AtlLoadString; - -#endif // (_ATL_VER < 0x0700) - -#ifdef _WIN32_WCE // CE only direct access to the resource -inline LPCTSTR AtlLoadString(UINT uID) -{ - LPCTSTR s = (LPCTSTR)::LoadString(ModuleHelper::GetResourceInstance(), uID, NULL, 0); -#ifdef DEBUG // Check for null-termination - if(s != NULL) - // Note: RC -n compiles null-terminated resource strings - ATLASSERT(s[*((WORD*)s -1) - 1] == L'\0'); -#endif - return s; -} -#endif // _WIN32_WCE - inline bool AtlLoadString(UINT uID, BSTR& bstrText) { USES_CONVERSION; diff --git a/thirdparty/wtl/atlwince.h b/thirdparty/wtl/atlwince.h deleted file mode 100644 index 3e80e22..0000000 --- a/thirdparty/wtl/atlwince.h +++ /dev/null @@ -1,2987 +0,0 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLWINCE_H__ -#define __ATLWINCE_H__ - -#pragma once - -#ifndef __ATLAPP_H__ - #error atlwince.h requires atlapp.h to be included first -#endif - -#ifndef __ATLWIN_H__ - #error atlwince.h requires atlwin.h to be included first -#endif - -#ifndef _WIN32_WCE - #error atlwince.h compiles under Windows CE only -#endif - -#if (_WIN32_WCE < 300) - #error atlwince.h requires Windows CE 3.0 or higher. -#endif - -#if defined(WIN32_PLATFORM_WFSP) && _MSC_VER < 1400 // EVC compiling SmartPhone code - #if (WIN32_PLATFORM_WFSP < 200) - #error atlwince.h requires Smartphone 2003 or higher - #endif -#endif // WIN32_PLATFORM_WFSP - -#if defined(WIN32_PLATFORM_PSPC) && _MSC_VER < 1400 // EVC compiling Pocket PC code - #if (WIN32_PLATFORM_PSPC < 310) - #error atlwince.h requires Pocket PC 2002 or higher - #endif -#endif // WIN32_PLATFORM_PSPC - -#if !defined(_AYGSHELL_H_) && !defined(__AYGSHELL_H__) - #error atlwince.h requires aygshell.h to be included first -#else - #if defined(WIN32_PLATFORM_WFSP) && !defined(_TPCSHELL_H_) - #error SmartPhone dialog classes require tpcshell.h to be included first - #endif -#endif - -#if (_MSC_VER >= 1400) // VS2005 - #include - #define _WTL_CE_DRA -#endif // (_MSC_VER >= 1400) - -#if !defined(_WTL_CE_NO_DIALOGS) && !defined(__ATLFRAME_H__) - #error Orientation aware dialog classes require atlframe.h to be included first -#endif - -#if !defined(_WTL_CE_NO_APPWINDOW) && !defined(__ATLFRAME_H__) - #error Application window class require atlframe.h to be included first -#endif - -#if !defined(_WTL_CE_NO_ZOOMSCROLL) && !defined(__ATLSCRL_H__) - #error ZoomScroll implementation requires atlscrl.h to be included first -#endif - -#if !defined(_WTL_CE_NO_ZOOMSCROLL) - #if !(defined(__ATLTYPES_H__) || (defined(__ATLMISC_H__) && !defined(_WTL_NO_WTYPES))) - #error ZoomScroll requires _WTL_NO_WTYPES not to be defined and either atlmisc.h or atltypes.h to be included first - #endif // !(defined(__ATLTYPES_H__) || (defined(__ATLMISC_H__) && !defined(_WTL_NO_WTYPES))) -#endif // !defined(_WTL_CE_NO_ZOOMSCROLL) - -#if !defined(WIN32_PLATFORM_WFSP) && !defined(WIN32_PLATFORM_PSPC) - #define _WTL_CE_NO_CONTROLS -#endif // !defined(WIN32_PLATFORM_WFSP) && !defined(WIN32_PLATFORM_PSPC) - -#ifndef _WTL_CE_NO_CONTROLS - #ifndef __ATLCTRLS_H__ - #error The PPC/SmartPhone controls classes require atlctrls.h to be included first - #endif - - #include - #pragma comment(lib, "htmlview.lib") - - #include - #pragma comment(lib, "voicectl.lib") - - #ifdef WIN32_PLATFORM_PSPC - #include - #pragma comment(lib, "richink.lib") - - #include - #pragma comment(lib, "inkx.lib") - - #include - #pragma comment(lib, "doclist.lib") - #endif -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// Classes in this file: -// -// CStdDialogBase : Standard PPC/SmartPhone dialog base class -// CStdDialogImplBase - Base implementation of standard dialog -// CStdDialogImpl : Standard dialog implementation -// CStdIndirectDialogImpl - implementation of standard indirect PPC/SmartPhone dialog -// CStdAxDialogImpl : Standard AxDialog implementation -// CStdSimpleDialog : Standard simple dialog -// CStdDialogResizeImplBase - Base implementation of orientation resizing standard dialog -// CStdDialogResizeImpl : Orientation resizing standard dialog implementation -// CStdAxDialogResizeImpl - implementation of orientation resizing standard AxDialog -// CStdSimpleDialogResizeImpl : Standard resizing simple dialog implementation -// CStdOrientedDialogBase - Oriented PPC standard dialog base class -// CStdOrientedDialogImplBase - Oriented PPC standard dialog base implementation -// CStdOrientedDialogImpl : Oriented PPC standard dialog implementation -// CStdAxOrientedDialogImpl - Oriented PPC standard AxDialog implementation -// CStdSimpleOrientedDialog : Standard simple orientable dialog -// -// CAppInfoBase : Helper for application state save/restore to registry -// CAppInfoT : CAppInfoBase constructed from a CAppWindow -// CAppWindowBase : Base class for PPC/SmartPhone well-behaved application window or dialog -// CAppWindow : PPC/SmartPhone well-behaved application window class -// CAppDialog : PPC/SmartPhone well-behaved application dialog class -// CAppStdDialogImplBase - Base implementation of standard application dialogs -// CAppStdDialogImpl : Implementation of standard application dialog -// CAppStdDialogResizeImpl - implementation of orientation resizing standard application dialog -// CAppStdAxDialogImpl - Implementation of standard application AxDialog -// CAppStdAxDialogResizeImpl - implementation of orientation resizing standard application AxDialog -// CAppStdOrientedDialogImpl - implementation of oriented PPC standard application dialog -// CAppStdAxOrientedDialogImpl - implementation of oriented PPC standard application AxDialog -// -// CFullScreenFrame : Full screen frame class -// -// CZoomScrollImpl : WinCE zooming implementation -// -// CBottomTabViewImpl - CBottomTabView -// CHtmlCtrlT - CHtmlCtrl -// CRichInkCtrlT - CRichInkCtrl -// CInkXCtrlT - CInkXCtrl -// CVoiceRecorderCtrlT - CVoiceRecorderCtrl -// CDocListCtrlT - CDocListCtrl -// CCapEditT - CCapEdit -// CTTStaticT - CTTStatic -// CTTButtonT - CTTButton -// -// CSpinCtrlT - CSpinCtrl : SmartPhone specific UpDown control -// CSpinned : SmartPhone association of control and Spin -// CSpinListBox : SmartPhone spinned ListBox control -// CExpandListBox : SmartPhone expandable ListBox control -// CExpandEdit : SmartPhone expandable Edit control -// CExpandCapEdit : SmartPhone expandable CapEdit control -// -// Global functions: -// AtlCreateMenuBar() -// AtlCreateEmptyMenuBar() -// AtlIsEditFocus() -// AtlActivateBackKey() - -namespace WTL -{ - -/////////////////////////////////////////////////////////////////////////////// -// MenuBar creation functions for property sheets and dialogs -// Frame windows use CreateSimpleCEMenuBar - -inline HWND AtlCreateMenuBar(SHMENUBARINFO& mbi) -{ - ATLASSERT(::IsWindow(mbi.hwndParent)); - ATLVERIFY(::SHCreateMenuBar(&mbi) != FALSE); - return mbi.hwndMB; -}; - -inline HWND AtlCreateMenuBar(HWND hWnd, UINT nToolBarId = ATL_IDW_TOOLBAR, DWORD dwFlags = 0, int nBmpId = 0, int cBmpImages = 0, COLORREF clrBk = 0) -{ - SHMENUBARINFO mbi = { sizeof(mbi), hWnd, dwFlags, nToolBarId, ModuleHelper::GetResourceInstance(), nBmpId, cBmpImages, 0, clrBk }; - return AtlCreateMenuBar(mbi); -} - -inline HWND AtlCreateEmptyMenuBar(HWND hWnd, bool bSip = true) -{ - SHMENUBARINFO embi = { sizeof(SHMENUBARINFO), hWnd, SHCMBF_EMPTYBAR }; - if (!bSip) - embi.dwFlags |= SHCMBF_HIDESIPBUTTON; - - return AtlCreateMenuBar(embi); -} - -/////////////////////////////////////////////////////////////////////////////// -// Helper functions for SmartPhone back key handling - -inline bool AtlIsEditFocus() -{ - ATL::CWindow wCtrl = GetFocus(); - if (wCtrl.IsWindow()) - { - TCHAR szClassName[8] = {0}; - ATLVERIFY(::GetClassName(wCtrl.m_hWnd, szClassName, 8)); - return !_tcscmp(szClassName, _T("Edit")) || !_tcscmp(szClassName, WC_CAPEDIT); - } - return false; -} - -#if defined WIN32_PLATFORM_WFSP -inline void AtlActivateBackKey(HWND hMenuBar) -{ - ATLASSERT(::IsWindow(hMenuBar)); - ::SendMessage(hMenuBar, SHCMBM_OVERRIDEKEY, VK_TBACK, - MAKELPARAM(SHMBOF_NODEFAULT | SHMBOF_NOTIFY, SHMBOF_NODEFAULT | SHMBOF_NOTIFY)); -} -#endif // WIN32_PLATFORM_WFSP - -// --- Standard PPC/SmartPhone dialogs --- - -#ifndef _WTL_CE_NO_DIALOGS - -/////////////////////////////////////////////////////////////////////////////// -// CStdDialogBase - base class for standard PPC/SmartPhone dialogs - -#define WTL_STD_SHIDIF SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN | SHIDIF_SIZEDLGFULLSCREEN -#define WTL_SP_SHIDIF SHIDIF_SIZEDLGFULLSCREEN - -// Title setting macros -#define WTL_DLG_TITLEHEIGHT(iHeight) static const int GetTitleHeight(){return iHeight;} -#define WTL_DLG_NOTITLE WTL_DLG_TITLEHEIGHT(0) - -/////////////////////////////////////////////////////////////////////////////// -// CStdDialogBase - Base class for standard PPC/SmartPhone dialog - -template -class CStdDialogBase -{ -public: -#ifdef WIN32_PLATFORM_PSPC -// Pocket PC only Dialog title handling - const int nTitleHeight; - - CStdDialogBase() : nTitleHeight(T::GetTitleHeight()) - { } - -// Overloads - BOOL GetClientRect(LPRECT lpRect) - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - BOOL bRes = ::GetClientRect(pT->m_hWnd, lpRect); - if (nTitleHeight) - lpRect->top += nTitleHeight + 1; - return bRes; - } - - BOOL SetWindowText(LPCTSTR lpszString) - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - BOOL bRes = ::SetWindowText(pT->m_hWnd, lpszString); - if (nTitleHeight != 0) - pT->DoPaintTitle(); - return bRes; - } - -// Overrideables - static const int GetTitleHeight() - { - #ifdef _WTL_CE_DRA - return DRA::SCALEY(24); - #else // !_WTL_CE_DRA - CWindowDC dc(NULL); - return dc.GetDeviceCaps(LOGPIXELSY) >> 2; // LOGPIXELSY * 24 / 96, - #endif // !_WTL_CE_DRA - } - - // Title painting - bool DoPaintTitle() - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - TCHAR sTitle[48] = { 0 }; - - // Preparation - CPaintDC dc(pT->m_hWnd); - CFont fontTitle = AtlCreateBoldFont(); - CFontHandle fontOld = dc.SelectFont(fontTitle); - dc.SetTextColor(GetSysColor(COLOR_HIGHLIGHT)); - int nLen = pT->GetWindowText(sTitle, 48); - int nWidth = dc.GetDeviceCaps(HORZRES); - - // Display title text - RECT rTitle = { 0, 0, nWidth, nTitleHeight }; - dc.FillRect(&rTitle, COLOR_3DHIGHLIGHT); - #ifdef _WTL_CE_DRA - rTitle.left = DRA::SCALEX(8); - #else // !_WTL_CE_DRA - rTitle.left = nTitleHeight / 3; // 8 == 24 / 3 - #endif // !_WTL_CE_DRA - dc.DrawText(sTitle, nLen, &rTitle, DT_VCENTER | DT_SINGLELINE); - dc.SelectFont(fontOld); - - // Draw bottom line, 2 pixels thick if HI_RES_AWARE - CPenHandle penOld = dc.SelectStockPen(BLACK_PEN); - POINT line[4] = {{0, nTitleHeight}, {nWidth, nTitleHeight}, {0, nTitleHeight - 1}, {nWidth, nTitleHeight - 1}}; - - #ifdef _WTL_CE_DRA - int nSeg = DRA::SCALEY(1); - #else // !_WTL_CE_DRA - int nSeg = nTitleHeight / 24; - #endif // !_WTL_CE_DRA - - dc.Polyline(line, nSeg <= 2 ? nSeg * 2 : 4); - dc.SelectPen(penOld); - - return false; - } - - // Title preparation: move the dialog controls down to make room for title - void DialogTitleInit() - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - - ATL::CWindow wCtl = pT->GetWindow(GW_CHILD); - while (wCtl.IsWindow()) - { - RECT rCtl = { 0 }; - wCtl.GetWindowRect(&rCtl); - ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rCtl, 2); - ::OffsetRect(&rCtl, 0, nTitleHeight); - wCtl.MoveWindow(&rCtl, FALSE); - wCtl = wCtl.GetWindow(GW_HWNDNEXT); - } - } - - // SIP management - void DoSipInfo() - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - - SIPINFO si = {sizeof(SIPINFO)}; - SipGetInfo(&si); - if ((si.fdwFlags & SIPF_ON) ^ SIPF_ON) - si.rcVisibleDesktop.bottom = si.rcSipRect.bottom; - pT->MoveWindow(&si.rcVisibleDesktop, FALSE); - } - -// Title painting handler - LRESULT OnPaintTitle(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - T* pT = static_cast(this); - return bHandled = nTitleHeight ? pT->DoPaintTitle() : FALSE; - } - -// SIP handler - LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - T* pT = static_cast(this); - if (wParam == SPI_SETSIPINFO) - { - pT->DoSipInfo(); - return TRUE; - } - return bHandled = FALSE; - } - -#elif defined WIN32_PLATFORM_WFSP -// SmartPhone VK_TBACK key standard management - LRESULT OnHotKey(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - const UINT uModif = (UINT)LOWORD(lParam); - const UINT uVirtKey = (UINT)HIWORD(lParam); - - if(uVirtKey == VK_TBACK) - if (AtlIsEditFocus()) - ::SHSendBackToFocusWindow(uMsg, wParam, lParam); - else if (uModif & MOD_KEYUP) - pT->StdCloseDialog(IDCANCEL); - return 1; - } - - // SmartPhone MenuBar and VK_TBACK key initialization - void StdSPInit() - { - T* pT = static_cast(this); - HWND hMenuBar = ::SHFindMenuBar(pT->m_hWnd); - - if (!hMenuBar && (t_shidiFlags & SHIDIF_DONEBUTTON)) - hMenuBar = CreateMenuBar(ATL_IDM_MENU_DONE); - - if(hMenuBar != NULL) - AtlActivateBackKey(hMenuBar); - } - - void SetStaticBold() - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - - CFontHandle fontBold = AtlCreateBoldFont(pT->GetFont()); - - ATL::CWindow wCtl = pT->GetWindow(GW_CHILD); - - while (wCtl.IsWindow()) - { - if ((short int)wCtl.GetDlgCtrlID() == IDC_STATIC) - wCtl.SetFont(fontBold); - wCtl = wCtl.GetWindow(GW_HWNDNEXT); - } - } -#endif // WIN32_PLATFORM_WFSP - -// Platform dependant initialization - void StdPlatformInit() - { - T* pT = static_cast(this); -#ifdef WIN32_PLATFORM_PSPC // Pocket PC title initialization - if (nTitleHeight != 0) - pT->DialogTitleInit(); -#elif defined(WIN32_PLATFORM_WFSP) - pT->StdSPInit(); - SetStaticBold(); -#endif // WIN32_PLATFORM_WFSP - } - - // Menu bar creation - HWND CreateMenuBar(UINT uiMB = T::IDD, int nBmpImages = 0) - { - T* pT = static_cast(this); - return AtlCreateMenuBar(pT->m_hWnd, uiMB, 0, nBmpImages ? uiMB : 0, nBmpImages); - } - - // Dialog closing - void StdCloseDialog(WORD wID) - { - T* pT = static_cast(this); - if (t_bModal) - ::EndDialog(pT->m_hWnd, wID); - else - pT->DestroyWindow(); - } - - // Shell dialog layout initialization - void StdShidInit() - { - T* pT = static_cast(this); - SHINITDLGINFO shidi = { SHIDIM_FLAGS, pT->m_hWnd, t_shidiFlags }; - ::SHInitDialog(&shidi); - } - -// IDC_INFOSTATIC background setting - LRESULT OnColorStatic(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - if (::GetDlgCtrlID((HWND)lParam) == IDC_INFOSTATIC) - { - ::SetBkMode((HDC)wParam, TRANSPARENT); - return (LRESULT)::GetSysColorBrush(COLOR_INFOBK); - } - return bHandled = FALSE; - } - -// Menu dialog ending - LRESULT OnMenuClose(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->StdCloseDialog((WORD)(wID - ID_MENU_OK + IDOK)); - return 0; - } - -// Standard dialog ending: may be used with any command - LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->StdCloseDialog(wID); - return 0; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CStdDialogImplBase - Base implementation of standard PPC/SmartPhone dialog - -template > -class ATL_NO_VTABLE CStdDialogImplBase : - public TBase, - public CStdDialogBase -{ -public: -#ifdef WIN32_PLATFORM_PSPC - BOOL GetClientRect(LPRECT lpRect) - { - return CStdDialogBase::GetClientRect(lpRect); - } - - BOOL SetWindowText(LPCTSTR lpszString) - { - return CStdDialogBase::SetWindowText(lpszString); - } -#endif - - BEGIN_MSG_MAP(CStdDialogImplBase) -#ifdef WIN32_PLATFORM_PSPC // Pocket PC title and SIP - MESSAGE_HANDLER(WM_PAINT, OnPaintTitle) - MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) -#elif defined(WIN32_PLATFORM_WFSP) // SmartPhone VK_TBACK key - MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) -#endif - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, OnCloseCmd) - COMMAND_RANGE_HANDLER(ID_MENU_OK, ID_MENU_CANCEL, OnMenuClose) - END_MSG_MAP() - - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifdef _DEBUG - T* pT = static_cast(this); - ATLASSERT(t_bModal == pT->m_bModal); -#endif - StdPlatformInit(); - StdShidInit(); - return bHandled = FALSE; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CStdDialogImpl - implementation of standard PPC/SmartPhone dialog - -template -class ATL_NO_VTABLE CStdDialogImpl : public CStdDialogImplBase< T, t_shidiFlags, t_bModal> -{}; - -/////////////////////////////////////////////////////////////////////////////// -// CStdIndirectDialogImpl - implementation of standard indirect PPC/SmartPhone dialog - -#if defined __ATLDLGS_H__ - -template -class ATL_NO_VTABLE CStdIndirectDialogImpl : - public CIndirectDialogImpl< T, CMemDlgTemplate, CStdDialogImpl > -{ -public: - typedef CIndirectDialogImpl< T, CMemDlgTemplate, CStdDialogImpl > _baseClass; - typedef CStdDialogImpl _baseStd; - - void CheckStyle() - { - // Mobile devices don't support DLGTEMPLATEEX - ATLASSERT(!m_Template.IsTemplateEx()); - - // Standard dialogs need only DS_CENTER - DWORD &dwStyle = m_Template.GetTemplatePtr()->style; - if (dwStyle & DS_CENTER) - if(t_bModal) - { - ATLASSERT((dwStyle & WS_CHILD) != WS_CHILD); - dwStyle |= WS_POPUP; - } - else - { - if((dwStyle & WS_CHILD) != WS_CHILD) - dwStyle |= WS_POPUP; - } - } - - INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow(), LPARAM dwInitParam = NULL) - { - ATLASSERT(t_bModal); - - if (!m_Template.IsValid()) - CreateTemplate(); - - CheckStyle(); - - return _baseClass::DoModal(hWndParent, dwInitParam); - } - - HWND Create(HWND hWndParent, LPARAM dwInitParam = NULL) - { - ATLASSERT(!t_bModal); - - if (!m_Template.IsValid()) - CreateTemplate(); - - CheckStyle(); - - return _baseClass::Create(hWndParent, dwInitParam); - } - - BEGIN_MSG_MAP(CStdIndirectDialogImpl) - CHAIN_MSG_MAP(_baseStd) - END_MSG_MAP() - -}; - -#endif // defined __ATLDLGS_H__ - -#ifndef _ATL_NO_HOSTING - -/////////////////////////////////////////////////////////////////////////////// -// CStdAxDialogImpl - implementation of standard PPC/SmartPhone AxDialog - -template -class ATL_NO_VTABLE CStdAxDialogImpl : public CStdDialogImplBase< T, t_shidiFlags, t_bModal, ATL::CAxDialogImpl< T > > -{}; -#endif // _ATL_NO_HOSTING - -/////////////////////////////////////////////////////////////////////////////// -// CStdSimpleDialog - standard PPC/SmartPhone simple dialog with SHIDIF_xxx flags - -template -class CStdSimpleDialog : - public ATL::CSimpleDialog, - public CStdDialogBase, t_shidiFlags> -{ -public: - typedef CStdDialogBase, t_shidiFlags> baseClass; - -#ifdef WIN32_PLATFORM_PSPC - BOOL GetClientRect(LPRECT lpRect) - { - return baseClass::GetClientRect(lpRect); - } - - BOOL SetWindowText(LPCTSTR lpszString) - { - return baseClass::SetWindowText(lpszString); - } -#endif - - BEGIN_MSG_MAP(CStdSimpleDialog) -#ifdef WIN32_PLATFORM_PSPC // Pocket PC title and SIP - MESSAGE_HANDLER(WM_PAINT, OnPaintTitle) - MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) -#elif defined(WIN32_PLATFORM_WFSP) // SmartPhone VK_TBACK key - MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) -#endif - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_RANGE_HANDLER(ID_MENU_OK, ID_MENU_CANCEL, OnMenuClose) - COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, baseClass::OnCloseCmd) - END_MSG_MAP() - - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - StdPlatformInit(); - StdShidInit(); - return bHandled = FALSE; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CStdDialogResizeImplBase - Base implementation of orientation resizing standard PPC/SmartPhone dialog - -template > -class ATL_NO_VTABLE CStdDialogResizeImplBase : - public CStdDialogImplBase< T, t_shidiFlags, t_bModal, TBase>, - public CDialogResize -{ -public: - // Note: BEGIN_DLGRESIZE_MAP is required in the derived class. - - BEGIN_MSG_MAP(CStdResizeDialogImplBase) -#ifdef WIN32_PLATFORM_PSPC // Pocket PC title - MESSAGE_HANDLER(WM_PAINT, OnPaintTitle) -#elif defined(WIN32_PLATFORM_WFSP) // SmartPhone VK_TBACK key - MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) -#endif - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, OnCloseCmd) - COMMAND_RANGE_HANDLER(ID_MENU_OK, ID_MENU_CANCEL, OnMenuClose) - CHAIN_MSG_MAP(CDialogResize< T >) - END_MSG_MAP() - - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifdef _DEBUG - T* pT = static_cast(this); - ATLASSERT(t_bModal == pT->m_bModal); -#endif - StdPlatformInit(); - DlgResize_Init(FALSE); - StdShidInit(); - return bHandled = FALSE; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CStdDialogResizeImpl - implementation of orientation resizing standard PPC/SmartPhone dialog - -template -class ATL_NO_VTABLE CStdDialogResizeImpl : public CStdDialogResizeImplBase< T, t_shidiFlags, t_bModal> -{}; - -#ifndef _ATL_NO_HOSTING - -/////////////////////////////////////////////////////////////////////////////// -// CStdAxDialogResizeImpl - implementation of orientation resizing standard PPC/SmartPhone AxDialog - -template -class ATL_NO_VTABLE CStdAxDialogResizeImpl : public CStdDialogResizeImplBase< T, t_shidiFlags, t_bModal, ATL::CAxDialogImpl > -{}; -#endif // _ATL_NO_HOSTING - -/////////////////////////////////////////////////////////////////////////////// -// CStdSimpleDialogResizeImpl - implementation of standard resizing simple dialog with SHIDIF_xxx flags - -// Usage: -// class CMyDlg : public CStdSimpleDialogResize -// { -// public: -// BEGIN_DLGRESIZE_MAP(CMyDlg) -// ... -// END_DLGRESIZE_MAP() -// }; - -template -class ATL_NO_VTABLE CStdSimpleDialogResizeImpl : - public CStdSimpleDialog, - public CDialogResize< T > -{ -public: - typedef CStdSimpleDialog::baseClass baseClass; - - BEGIN_MSG_MAP(CStdSimpleDialogResizeImpl) -#ifdef WIN32_PLATFORM_PSPC // Pocket PC title - MESSAGE_HANDLER(WM_PAINT, OnPaintTitle) -#elif defined(WIN32_PLATFORM_WFSP) // SmartPhone VK_TBACK key - MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) -#endif - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, baseClass::OnCloseCmd) - COMMAND_RANGE_HANDLER(ID_MENU_OK, ID_MENU_CANCEL, OnMenuClose) - CHAIN_MSG_MAP(CDialogResize< T >) - END_MSG_MAP() - - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - StdPlatformInit(); - DlgResize_Init(FALSE); - StdShidInit(); - return bHandled = FALSE; - } -}; - -#if defined(_WTL_CE_DRA) && defined(WIN32_PLATFORM_PSPC) - -/////////////////////////////////////////////////////////////////////////////// -// CStdOrientedDialogBase - Oriented PPC standard dialog base class - -template -class CStdOrientedDialogBase -{ -public: -// Operation - BOOL SetOrientation(DRA::DisplayMode mode) - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - ATLASSERT(mode == DRA::GetDisplayMode()); - - // Derived dialog must enumerate TWO dialog templates with the same control ids and types ie: - // enum { IDD = IDD_MYDLG, IDD_LANDSCAPE = IDD_MYDLG_L }; - UINT iResource = (mode == DRA::Landscape)? T::IDD_LANDSCAPE : T::IDD; - - BOOL bRes = DRA::RelayoutDialog(ModuleHelper::GetResourceInstance(), pT->m_hWnd, MAKEINTRESOURCE(iResource)); - pT->OnOrientation(mode); - return bRes; - } - -// Override - void OnOrientation(DRA::DisplayMode /*mode*/) - {} - -// Message handlers - LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - if (wParam == SETTINGCHANGE_RESET) - { - SetOrientation(DRA::GetDisplayMode()); - pT->StdPlatformInit(); - pT->StdShidInit(); - } - else if (wParam == SPI_SETSIPINFO) - { - pT->DoSipInfo(); - return TRUE; - } - return bHandled = FALSE; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CStdOrientedDialogImplBase - Oriented PPC standard dialog base implementation - -template > -class ATL_NO_VTABLE CStdOrientedDialogImplBase : - public CStdDialogImplBase< T, t_shidiFlags, t_bModal, TBase>, - public CStdOrientedDialogBase -{ -public: - BEGIN_MSG_MAP(CStdOrientedDialogImpl) - MESSAGE_HANDLER(WM_PAINT, OnPaintTitle) - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - MESSAGE_HANDLER(WM_SETTINGCHANGE, CStdOrientedDialogBase::OnSettingChange) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, OnCloseCmd) - COMMAND_RANGE_HANDLER(ID_MENU_OK, ID_MENU_CANCEL, OnMenuClose) - END_MSG_MAP() - - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - T* pT = static_cast(this); -#ifdef _DEBUG - ATLASSERT(t_bModal == pT->m_bModal); -#endif - if (DRA::GetDisplayMode() == DRA::Landscape) - SetOrientation(DRA::Landscape); - pT->StdPlatformInit(); - pT->StdShidInit(); - return bHandled = FALSE; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CStdOrientedDialogImpl - Oriented PPC standard dialog implementation - -template -class ATL_NO_VTABLE CStdOrientedDialogImpl : public CStdOrientedDialogImplBase< T, t_shidiFlags, t_bModal> -{}; - -#ifndef _ATL_NO_HOSTING -/////////////////////////////////////////////////////////////////////////////// -// CStdAxOrientedDialogImpl - Oriented PPC standard AxDialog implementation - -template -class ATL_NO_VTABLE CStdAxOrientedDialogImpl : public CStdOrientedDialogImplBase< T, t_shidiFlags, t_bModal, ATL::CAxDialogImpl > -{}; -#endif // _ATL_NO_HOSTING - -/////////////////////////////////////////////////////////////////////////////// -// CStdSimpleOrientedDialog - Standard simple orientable dialog - -template -class CStdSimpleOrientedDialog : - public CStdSimpleDialog, - public CStdOrientedDialogBase > -{ -public: - typedef CStdSimpleDialog::baseClass baseClass; - typedef CStdOrientedDialogBase > baseOriented; - - enum {IDD = t_wDlgTemplateID, IDD_LANDSCAPE = t_wDlgLandscapeID}; - - BEGIN_MSG_MAP(CStdSimpleDialog) - MESSAGE_HANDLER(WM_PAINT, OnPaintTitle) - MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnColorStatic) - MESSAGE_HANDLER(WM_SETTINGCHANGE, baseOriented::OnSettingChange) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, baseClass::OnCloseCmd) - COMMAND_RANGE_HANDLER(ID_MENU_OK, ID_MENU_CANCEL, OnMenuClose) - END_MSG_MAP() - - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - if (DRA::GetDisplayMode() == DRA::Landscape) - SetOrientation(DRA::Landscape); - StdPlatformInit(); - StdShidInit(); - return bHandled = FALSE; - } -}; - -#endif // _WTL_CE_DRA - - -#endif // _WTL_CE_NO_DIALOGS - - -// --- PPC/SmartPhone application window and helpers --- - -#ifndef _WTL_CE_NO_APPWINDOW - -/////////////////////////////////////////////////////////////////////////////// -// CAppInfoBase - Helper for application state save/restore to registry - -class CAppInfoBase -{ -public: - CRegKeyEx m_Key; - - CAppInfoBase(ATL::_U_STRINGorID sAppKey) - { - m_Key.Create(HKEY_CURRENT_USER, sAppKey.m_lpstr); - ATLASSERT(m_Key.m_hKey); - } - - template - LONG Save(V& val, ATL::_U_STRINGorID sName) - { - return m_Key.SetBinaryValue(sName.m_lpstr, &val, sizeof(V)); - } - - template - LONG Save(int nb, V& val0, ATL::_U_STRINGorID sName) - { - return m_Key.SetBinaryValue(sName.m_lpstr, &val0, nb * sizeof(V)); - } - - template - LONG Restore(V& val, ATL::_U_STRINGorID sName) - { - ULONG bufSize = sizeof(V); - return m_Key.QueryBinaryValue(sName.m_lpstr, &val, &bufSize); - } - - template - LONG Restore(int nb, V& val0, ATL::_U_STRINGorID sName) - { - ULONG bufSize = nb * sizeof(V); - return m_Key.QueryBinaryValue(sName.m_lpstr, &val0, &bufSize); - } - -#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - LONG Save(_CSTRING_NS::CString& sval, ATL::_U_STRINGorID sName) - { - return m_Key.SetStringValue(sName.m_lpstr, sval); - } - - LONG Restore(_CSTRING_NS::CString& sval, ATL::_U_STRINGorID sName) - { - DWORD size = MAX_PATH; - LONG res = m_Key.QueryStringValue(sName.m_lpstr, sval.GetBuffer(size), &size); - sval.ReleaseBuffer(); - return res; - } -#else - #pragma message("Warning: CAppInfoBase compiles without CString support. Do not use CString in Save or Restore.") -#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) - - LONG Save(LPCTSTR sval, ATL::_U_STRINGorID sName) - { - return m_Key.SetStringValue(sName.m_lpstr, sval); - } - - LONG Restore(LPTSTR sval, ATL::_U_STRINGorID sName, DWORD *plength) - { - return m_Key.QueryStringValue(sName.m_lpstr, sval, plength); - } - - LONG Delete(ATL::_U_STRINGorID sName) - { - return m_Key.DeleteValue(sName.m_lpstr); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CAppInfoT - CAppInfoBase constructed from a class with T::GetAppKey() - -// Macro for declaring AppKey -#define DECLARE_APPKEY(uAppKey) \ - static LPCTSTR GetAppKey() \ - { \ - static LPCTSTR sAppKey = ATL::_U_STRINGorID(uAppKey).m_lpstr; \ - return sAppKey; \ - } - -template -class CAppInfoT : public CAppInfoBase -{ -public: - CAppInfoT() : CAppInfoBase(T::GetAppKey()){} -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CAppWindowBase - Base class for PPC/SmartPhone "well-behaved" application window or dialog - -// Macros for declaring frame WNDCLASS and AppKey -#define DECLARE_APP_FRAME_CLASS(WndClassName, uCommonResourceID, uAppKey) \ - DECLARE_FRAME_WND_CLASS(WndClassName, uCommonResourceID) \ - DECLARE_APPKEY(uAppKey) - -#define DECLARE_APP_FRAME_CLASS_EX(WndClassName, uCommonResourceID, style, bkgnd, uAppKey) \ - DECLARE_FRAME_WND_CLASS_EX(WndClassName, uCommonResourceID, style, bkgnd) \ - DECLARE_APPKEY(uAppKey) - -template -class CAppWindowBase -{ -public: - typedef class CAppInfoT< T > CAppInfo; - -#ifndef WIN32_PLATFORM_WFSP - SHACTIVATEINFO m_sai; // NoOp on SmartPhones -#endif // WIN32_PLATFORM_WFSP - - bool m_bHibernate; - - CAppWindowBase< T >() : m_bHibernate(false) - { -#ifndef WIN32_PLATFORM_WFSP - SHACTIVATEINFO sai = { sizeof(SHACTIVATEINFO) }; - m_sai = sai; -#endif // WIN32_PLATFORM_WFSP - }; - - // Same as WTL 7.1 AppWizard generated ActivatePreviousInstance + SendMessage WM_COPYDATA - static HRESULT ActivatePreviousInstance(HINSTANCE hInstance, LPCTSTR lpstrCmdLine, bool bDialog) - { - // requires T does DECLARE_APP_FRAME_CLASS, DECLARE_APP_FRAME_CLASS_EX or DECLARE_APP_DLG_CLASS - CFrameWndClassInfo& classInfo = T::GetWndClassInfo(); - - ATLVERIFY(::LoadString(hInstance, classInfo.m_uCommonResourceID, classInfo.m_szAutoName, sizeof(classInfo.m_szAutoName)/sizeof(classInfo.m_szAutoName[0])) != 0); - - classInfo.m_wc.lpszClassName = classInfo.m_szAutoName; - - const TCHAR* pszClass = classInfo.m_wc.lpszClassName; - - if(NULL == pszClass || '\0' == *pszClass) - { - return E_FAIL; - } - - const DWORD dRetryInterval = 100; - const int iMaxRetries = 25; - - for(int i = 0; i < iMaxRetries; ++i) - { - HANDLE hMutex = CreateMutex(NULL, FALSE, pszClass); - - DWORD dw = GetLastError(); - - if(NULL == hMutex) - { - HRESULT hr; - - switch(dw) - { - case ERROR_INVALID_HANDLE: - // A non-mutext object with this name already exists. - hr = E_INVALIDARG; - break; - default: - // This should never happen... - hr = E_FAIL; - } - - return hr; - } - - // If the mutex already exists, then there should be another instance running - if(dw == ERROR_ALREADY_EXISTS) - { - CloseHandle(hMutex); - - HWND hwnd = NULL; - if (bDialog) - hwnd = FindWindow(NULL, pszClass); - else - hwnd = FindWindow(pszClass, NULL); - - if(hwnd == NULL) - { - Sleep(dRetryInterval); - continue; - } - else - { - // Transmit our params to previous instance - if (lpstrCmdLine && *lpstrCmdLine) - { - COPYDATASTRUCT cd = { NULL, sizeof(TCHAR) * (wcslen(lpstrCmdLine) + 1), (PVOID)lpstrCmdLine }; - ::SendMessage(hwnd, WM_COPYDATA, NULL, (LPARAM)&cd); - } - // Set the previous instance as the foreground window - if(0 != SetForegroundWindow(reinterpret_cast(reinterpret_cast(hwnd) | 0x1))) - return S_FALSE; - } - } - else - { - return S_OK; - } - } - return S_OK; - } - -// Operations overriden in derived class - bool AppHibernate(bool /*bHibernate*/) - { - return false; - } - - bool AppNewInstance(LPCTSTR /*lpstrCmdLine*/) - { - return false; - } - - void AppSave() - { - } - -#ifdef WIN32_PLATFORM_WFSP - void AppBackKey() - { - ::SHNavigateBack(); - } -#endif - -// Message map and handlers - BEGIN_MSG_MAP(CAppWindowBase) - MESSAGE_HANDLER(WM_ACTIVATE, OnActivate) -#ifdef WIN32_PLATFORM_WFSP - MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) -#else - MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) -#endif // WIN32_PLATFORM_WFSP - MESSAGE_HANDLER(WM_HIBERNATE, OnHibernate) - MESSAGE_HANDLER(WM_COPYDATA, OnNewInstance) - MESSAGE_HANDLER(WM_CLOSE, OnClose) - END_MSG_MAP() - - LRESULT OnActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - T* pT = static_cast(this); - if (m_bHibernate) - m_bHibernate = pT->AppHibernate(false); -#ifndef WIN32_PLATFORM_WFSP - ::SHHandleWMActivate(pT->m_hWnd, wParam, lParam, &m_sai, 0); -#else - wParam; - lParam; -#endif // WIN32_PLATFORM_WFSP - return bHandled = FALSE; - } - -#ifdef WIN32_PLATFORM_WFSP -// SmartPhone VK_TBACK key standard management - LRESULT OnHotKey(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - const UINT uModif = (UINT)LOWORD(lParam); - const UINT uVirtKey = (UINT)HIWORD(lParam); - if(uVirtKey == VK_TBACK) - if (AtlIsEditFocus()) - ::SHSendBackToFocusWindow(uMsg, wParam, lParam); - else if (uModif & MOD_KEYUP) - pT->AppBackKey(); - return 1; - } - -#else // !WIN32_PLATFORM_WFSP -// PPC SIP handling - LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - T* pT = static_cast(this); - bHandled = FALSE; - return ::SHHandleWMSettingChange(pT->m_hWnd, wParam, lParam, &m_sai); - } -#endif // !WIN32_PLATFORM_WFSP - - LRESULT OnHibernate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - return m_bHibernate = pT->AppHibernate(true); - } - - LRESULT OnNewInstance(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - PCOPYDATASTRUCT pcds = (PCOPYDATASTRUCT)lParam; - return pT->AppNewInstance((LPCTSTR)pcds->lpData); - } - - LRESULT OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) - { - T* pT = static_cast(this); - pT->AppSave(); - bHandled = FALSE; - return 1; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CAppWindow - PPC/SmartPhone "well-behaved" application window class - -template -class CAppWindow : public CAppWindowBase< T > -{ -public: - // Same as WTL 7.1 AppWizard generated Run + lpstrCmdLine in CreateEx - static int AppRun(LPTSTR lpstrCmdLine = NULL, int nCmdShow = SW_SHOWNORMAL) - { - CMessageLoop theLoop; - _Module.AddMessageLoop(&theLoop); - - T wndMain; - - if(wndMain.CreateEx(NULL, NULL, 0, 0, lpstrCmdLine) == NULL) - { - ATLTRACE2(atlTraceUI, 0, _T("Main window creation failed!\n")); - return 0; - } - - wndMain.ShowWindow(nCmdShow); - - int nRet = theLoop.Run(); - - _Module.RemoveMessageLoop(); - return nRet; - } - - static HRESULT ActivatePreviousInstance(HINSTANCE hInstance, LPCTSTR lpstrCmdLine) - { - return CAppWindowBase< T >::ActivatePreviousInstance(hInstance, lpstrCmdLine, false); - } -}; - - -#ifndef _WTL_CE_NO_DIALOGS - -/////////////////////////////////////////////////////////////////////////////// -// CAppDialog - PPC/SmartPhone "well-behaved" dialog application class - -// Macro for declaring dialog WNDCLASS and AppKey -#define DECLARE_APP_DLG_CLASS(WndClassName, uCommonResourceID, uAppKey) \ - static WTL::CFrameWndClassInfo& GetWndClassInfo() \ - { \ - static WTL::CFrameWndClassInfo wc = \ - { \ - { 0, (WNDPROC)StartDialogProc, \ - 0, 0, NULL, NULL, NULL, (HBRUSH)(COLOR_WINDOW + 1), NULL, WndClassName }, \ - NULL, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ - }; \ - return wc; \ - }; \ - DECLARE_APPKEY(uAppKey) - -template -class CAppDialog : public CAppWindowBase< T > -{ -public: - static int AppRun(LPTSTR lpstrCmdLine = NULL, int nCmdShow = SW_SHOWNORMAL) - { - CMessageLoop theLoop; - _Module.AddMessageLoop(&theLoop); - - T dlgMain; - - if(dlgMain.Create(NULL, (LPARAM)lpstrCmdLine) == NULL) - { - ATLTRACE2(atlTraceUI, 0, _T("Main dialog creation failed!\n")); - return 0; - } - - dlgMain.ShowWindow(nCmdShow); - - int nRet = theLoop.Run(); - - _Module.RemoveMessageLoop(); - return nRet; - } - - static HRESULT ActivatePreviousInstance(HINSTANCE hInstance, LPCTSTR lpstrCmdLine) - { - return CAppWindowBase< T >::ActivatePreviousInstance(hInstance, lpstrCmdLine, true); - }; -}; - -// PPC/SmartPhone standard application dialogs - -#ifdef WIN32_PLATFORM_WFSP -#define WTL_APP_SHIDIF WTL_SP_SHIDIF -#else -#define WTL_APP_SHIDIF WTL_STD_SHIDIF -#endif - -/////////////////////////////////////////////////////////////////////////////// -// CAppStdDialogImplBase - Base implementation of standard application dialogs - -template -class ATL_NO_VTABLE CAppStdDialogImplBase : - public TImplBase, - public CAppDialog< T > -{ -public: - WTL_DLG_NOTITLE; - - void StdCloseDialog(int nVal) - { - T* pT = static_cast(this); - if (nVal != IDCANCEL) - pT->AppSave(); - if (t_bModal == false) - { - pT->DestroyWindow(); - ::PostQuitMessage(nVal); - } - else - ::EndDialog(pT->m_hWnd, nVal); - } - - BEGIN_MSG_MAP(CAppStdDialogImplBase) - MESSAGE_HANDLER(WM_CLOSE, OnSystemClose) - CHAIN_MSG_MAP(TImplBase) - CHAIN_MSG_MAP(CAppDialog< T >) - END_MSG_MAP() - - LRESULT OnSystemClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - T* pT = static_cast(this); - pT->StdCloseDialog(IDCANCEL); - return 0; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// CAppStdDialogImpl - Implementation of standard application dialog - -template -class ATL_NO_VTABLE CAppStdDialogImpl : - public CAppStdDialogImplBase, t_shidiFlags, t_bModal> -{}; - -/////////////////////////////////////////////////////////////////////////////// -// CAppStdDialogResizeImpl - implementation of orientation resizing standard application dialog - -template -class ATL_NO_VTABLE CAppStdDialogResizeImpl : - public CAppStdDialogImplBase, t_shidiFlags, t_bModal> -{}; - -#ifndef _ATL_NO_HOSTING -/////////////////////////////////////////////////////////////////////////////// -// CAppStdAxDialogImpl - Implementation of standard application AxDialog - -template -class ATL_NO_VTABLE CAppStdAxDialogImpl : - public CAppStdDialogImplBase, t_shidiFlags, t_bModal> -{}; - -/////////////////////////////////////////////////////////////////////////////// -// CAppStdAxDialogResizeImpl - implementation of orientation resizing standard application AxDialog - -template -class ATL_NO_VTABLE CAppStdAxDialogResizeImpl : - public CAppStdDialogImplBase, t_shidiFlags, t_bModal> -{}; -#endif // _ATL_NO_HOSTING - -#if defined(_WTL_CE_DRA) && defined(WIN32_PLATFORM_PSPC) -/////////////////////////////////////////////////////////////////////////////// -// CAppStdOrientedDialogImpl - implementation of oriented PPC standard application dialog - -template -class ATL_NO_VTABLE CAppStdOrientedDialogImpl : - public CAppStdDialogImplBase, t_shidiFlags, t_bModal> -{}; - -#ifndef _ATL_NO_HOSTING -/////////////////////////////////////////////////////////////////////////////// -// CAppStdAxOrientedDialogImpl - implementation of oriented PPC standard application AxDialog - -template -class ATL_NO_VTABLE CAppStdAxOrientedDialogImpl : - public CAppStdDialogImplBase, t_shidiFlags, t_bModal> -{}; -#endif // _ATL_NO_HOSTING - -#endif // defined(_WTL_CE_DRA) && defined(WIN32_PLATFORM_PSPC) - -#endif // _WTL_CE_NO_DIALOGS - -#endif // _WTL_CE_NO_APPWINDOW - - -// --- Full screen support --- - -#ifndef _WTL_CE_NO_FULLSCREEN - -/////////////////////////////////////////////////////////////////////////////// -// CFullScreenFrame - full screen frame implementation - -template -class CFullScreenFrame -{ -public: - bool m_bFullScreen; - - CFullScreenFrame() : m_bFullScreen(false) - { } - -// Operation - void SetFullScreen(bool bFull) - { - m_bFullScreen = bFull; - ShowTaskBar(!bFull, false); - ShowMenuBar(!bFull); - } - -// Manage TaskBar for modal dialogs and property sheets - template - int FSDoModal(D& dlg) - { - T* pT = static_cast(this); - pT; // avoid level 4 warning - ATLASSERT(pT->IsWindow()); - if (m_bFullScreen) // Show taskbar if hidden - ShowTaskBar(true, false); - int iRet = dlg.DoModal(); - if (m_bFullScreen) // Hide taskbar if restored - ShowTaskBar(false); - return iRet; - } - -// Implementation - void ShowMenuBar(bool bShow) - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - ATL::CWindow MenuBar = pT->m_hWndCECommandBar; - ATLASSERT(MenuBar.IsWindow()); - MenuBar.ShowWindow(bShow ? SW_SHOWNORMAL : SW_HIDE); - pT->SizeToMenuBar(); - } - - void ShowTaskBar(bool bShow, bool bRepaint = true) - { - T* pT = static_cast(this); - ATLASSERT(pT->IsWindow()); - RECT rect = { 0 }; - SystemParametersInfo(SPI_GETWORKAREA, NULL, &rect, FALSE); - if (!bShow) - rect.top = 0; - -#ifdef WIN32_PLATFORM_PSPC // Pocket PC code - UINT uShow = t_bHasSip ? SHFS_SHOWTASKBAR | SHFS_SHOWSIPBUTTON : SHFS_SHOWTASKBAR | SHFS_HIDESIPBUTTON; - SHFullScreen(pT->m_hWnd, bShow ? uShow : SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON); -#elif _WIN32_WCE > 0x500 // Smartphone 2005 code - SHFullScreen(pT->m_hWnd, bShow ? SHFS_SHOWTASKBAR : SHFS_HIDETASKBAR); -#else // Smartphone 2003 - HWND hTaskBar = FindWindow(_T("tray"), NULL); - ATLASSERT(::IsWindow(hTaskBar)); - ::ShowWindow(hTaskBar, bShow ? SW_SHOW : SW_HIDE); -#endif // WIN32_PLATFORM_PSPC - - pT->MoveWindow(&rect, bRepaint); - } - -// Message map and handler - BEGIN_MSG_MAP(CFullScreenFrame) - MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) - MESSAGE_HANDLER(WM_ACTIVATE, OnActivate) - END_MSG_MAP() - - LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { -#ifndef SETTINGCHANGE_RESET // not defined for PPC 2002 - #define SETTINGCHANGE_RESET SPI_SETWORKAREA -#endif - if (m_bFullScreen && (wParam == SETTINGCHANGE_RESET)) - SetFullScreen(m_bFullScreen); - return bHandled = FALSE; - } - - LRESULT OnActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - if (m_bFullScreen) - { - ShowTaskBar(!wParam); - ShowMenuBar(!wParam); - } - return bHandled = FALSE; - } -}; - -#endif // _WTL_CE_NO_FULLSCREEN - - -// --- WinCE zoom support --- - -#ifndef _WTL_CE_NO_ZOOMSCROLL - -/////////////////////////////////////////////////////////////////////////////// -// CZoomScrollImpl - WinCE zooming implementation on top of CScrollImpl - -template -class CZoomScrollImpl: public CScrollImpl< T > -{ -public: -// Data members - _WTYPES_NS::CSize m_sizeTrue; - double m_fzoom; - -// Creation - CZoomScrollImpl() : m_sizeTrue(0), m_fzoom(1.) - { } - -// Zoom operations and access - void SetZoomScrollSize(_WTYPES_NS::CSize sizeTrue, double fzoom = 1., BOOL bRedraw = TRUE) - { - ATLASSERT(fzoom > 0.); - m_sizeTrue = sizeTrue; - m_fzoom = fzoom; - - CScrollImpl< T >::SetScrollSize(sizeTrue / fzoom, bRedraw); - } - - void SetZoomScrollSize(int cx, int cy, double fzoom=1., BOOL bRedraw = TRUE) - { - SetZoomScrollSize(_WTYPES_NS::CSize(cx, cy), fzoom, bRedraw); - } - - void SetZoom(double fzoom, BOOL bRedraw = TRUE) - { - _WTYPES_NS::CPoint ptCenter = WndtoTrue(m_sizeClient / 2); - _WTYPES_NS::CSize sizePage = GetScrollPage(); - _WTYPES_NS::CSize sizeLine = GetScrollLine(); - - SetZoomScrollSize(GetScrollSize(), fzoom, bRedraw); - - SetScrollLine(sizeLine); - SetScrollPage(sizePage); - _WTYPES_NS::CPoint ptOffset = ptCenter - (m_sizeClient / 2) * fzoom; - SetScrollOffset(ptOffset, bRedraw); - } - - double GetZoom() - { - return m_fzoom; - } - -// CScrollImpl overrides - void SetScrollOffset(int x, int y, BOOL bRedraw = TRUE) - { - CScrollImpl< T >::SetScrollOffset((int)(x / m_fzoom), (int)(y / m_fzoom), bRedraw); - } - - void SetScrollOffset(POINT ptOffset, BOOL bRedraw = TRUE) - { - SetScrollOffset(ptOffset.x, ptOffset.y, bRedraw); - } - - void GetScrollOffset(POINT& ptOffset) - { - ptOffset.x = (LONG)(m_ptOffset.x * m_fzoom); - ptOffset.y = (LONG)(m_ptOffset.y * m_fzoom); - } - - void SetScrollSize(int cx, int cy, BOOL bRedraw = TRUE) - { - SetZoomScrollSize(cx, cy, GetZoom(), bRedraw); - } - - void SetScrollSize(SIZE sizeTrue, BOOL bRedraw = TRUE) - { - SetZoomScrollSize(sizeTrue, GetZoom(), bRedraw); - } - - void GetScrollSize(SIZE& sizeTrue) const - { - sizeTrue = m_sizeTrue; - } - - void SetScrollPage(int cxPage, int cyPage) - { - SetScrollPage(_WTYPES_NS::CSize(cxPage, cyPage)); - } - - void SetScrollPage(SIZE sizePage) - { - CScrollImpl< T >::SetScrollPage(sizePage / m_fzoom); - } - - void GetScrollPage(SIZE& sizePage) const - { - sizePage = m_sizePage * m_fzoom; - } - - void SetScrollLine(int cxLine, int cyLine) - { - SetScrollLine(_WTYPES_NS::CSize(cxLine, cyLine)); - } - - void SetScrollLine(SIZE sizeLine) - { - CScrollImpl< T >::SetScrollLine(sizeLine / m_fzoom); - } - - void GetScrollLine(SIZE& sizeLine) const - { - sizeLine = m_sizeLine * m_fzoom; - } - -// Data access complements - _WTYPES_NS::CSize GetScrollSize() - { - return m_sizeTrue; - } - - _WTYPES_NS::CSize GetScrollPage() - { - return m_sizePage * m_fzoom; - } - - _WTYPES_NS::CSize GetScrollLine() - { - return m_sizeLine * m_fzoom; - } - - _WTYPES_NS::CPoint GetScrollOffset() - { - return (_WTYPES_NS::CSize)m_ptOffset * m_fzoom; - } - -// Helper coordinate functions - _WTYPES_NS::CPoint WndtoTrue(CPoint ptW) - { - return (_WTYPES_NS::CSize)ptW * GetZoom() + GetScrollOffset(); - } - - void WndtoTrue(LPPOINT aptW, int nPts) // in place coord transformation - { - for (int i = 0 ; i < nPts ; i++) - aptW[i] = WndtoTrue(aptW[i]); - } - - void WndtoTrue(LPRECT prectW) // in place coord transformation - { - WndtoTrue((LPPOINT)prectW, 2); - } - - _WTYPES_NS::CPoint TruetoWnd(CPoint ptT) - { - return (ptT - GetScrollOffset()) / GetZoom(); - } - - void TruetoWnd(LPPOINT aptT, int nPts) // in place coord transformation - { - for (int i = 0 ; i < nPts ; i++) - aptT[i] = TruetoWnd(aptT[i]); - } - - void TruetoWnd(LPRECT prectT) // in place coord transformation - { - TruetoWnd((LPPOINT)prectT, 2); - } - -// Drawing operations : assume adequate setting of data members - BOOL Draw(HBITMAP hbm, HDC hdestDC, DWORD dwROP = SRCCOPY) - { - CDC memDC = CreateCompatibleDC(hdestDC); - CBitmapHandle bmpOld = memDC.SelectBitmap(hbm); - BOOL bRes = Draw(memDC, hdestDC, dwROP); - memDC.SelectBitmap(bmpOld); - return bRes; - } - - BOOL Draw(HDC hsourceDC, HDC hdestDC, DWORD dwROP = SRCCOPY) - { - CDCHandle destDC = hdestDC; - destDC.SetViewportOrg(0,0); - _WTYPES_NS::CPoint ptOffset = GetScrollOffset(); - _WTYPES_NS::CSize sizeZClient = m_sizeClient * GetZoom(); - return destDC.StretchBlt(0, 0, m_sizeClient.cx, m_sizeClient.cy, hsourceDC, ptOffset.x, ptOffset.y, sizeZClient.cx, sizeZClient.cy, dwROP); - } - -#ifdef _IMAGING_H - BOOL Draw(IImage* pIImage, HDC hdestDC) - { - CDCHandle destDC = hdestDC; - destDC.SetViewportOrg(0,0); - return SUCCEEDED(pIImage->Draw(destDC, _WTYPES_NS::CRect(-_WTYPES_NS::CPoint(m_ptOffset), m_sizeAll), NULL)); - } -#endif - -// Message map and handlers - BEGIN_MSG_MAP(CZoomScrollImpl< T >) - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd) - CHAIN_MSG_MAP(CScrollImpl< T >) - END_MSG_MAP() - - LRESULT OnEraseBkgnd(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) - { - T* pT = static_cast(this); - ATLASSERT(::IsWindow(pT->m_hWnd)); - if ((GetScrollExtendedStyle() & SCRL_ERASEBACKGROUND)) - { - _WTYPES_NS::CRect rect; - pT->GetClientRect(rect); - _WTYPES_NS::CSize sizeClient=rect.Size(); - - if (m_sizeAll.cx < sizeClient.cx || m_sizeAll.cy < sizeClient.cy) - { - CDCHandle hdc = (HDC)wParam; - HBRUSH hbr = GetSysColorBrush((int)T::GetWndClassInfo().m_wc.hbrBackground - 1); - - if (m_sizeAll.cx < sizeClient.cx) - { - _WTYPES_NS::CRect rectBG(_WTYPES_NS::CPoint(m_sizeAll.cx, 0), sizeClient); - hdc.FillRect(rectBG, hbr); - } - - if (m_sizeAll.cy < sizeClient.cy) - { - _WTYPES_NS::CRect rectBG(_WTYPES_NS::CPoint(0, m_sizeAll.cy), sizeClient); - hdc.FillRect(rectBG, hbr); - } - } - } - else - { - bHandled = FALSE; - } - - return 1; - } -}; - -#endif // _WTL_CE_NO_ZOOMSCROLL - -#ifndef _WTL_CE_NO_CONTROLS - -// --- PPC bottom TabView control --- - -#if defined(__ATLCTRLX_H__) && defined(WIN32_PLATFORM_PSPC) - -/////////////////////////////////////////////////////////////////////////////// -// CBottomTabViewImpl - -template -class ATL_NO_VTABLE CBottomTabViewImpl : public CTabViewImpl -{ -public: - DECLARE_WND_CLASS_EX(NULL, 0, COLOR_APPWORKSPACE) - -// Implementation overrideables - bool CreateTabControl() - { - m_tab.Create(m_hWnd, rcDefault, NULL, WS_CHILD | TCS_BOTTOM, 0, m_nTabID); - - ATLASSERT(m_tab.m_hWnd != NULL); - if(m_tab.m_hWnd == NULL) - return false; - - m_tab.SendMessage(CCM_SETVERSION, COMCTL32_VERSION); - m_tab.SetItemExtra(sizeof(TABVIEWPAGE)); - - T* pT = static_cast(this); - m_cyTabHeight = pT->CalcTabHeight(); - - return true; - } - - int CalcTabHeight() - { - int nCount = m_tab.GetItemCount(); - TCITEMEXTRA tcix = { 0 }; - tcix.tciheader.mask = TCIF_TEXT; - tcix.tciheader.pszText = _T("NS"); - int nIndex = m_tab.InsertItem(nCount, tcix); - - RECT rect = { 0 }; - SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0); - RECT rcWnd = rect; - - m_tab.AdjustRect(FALSE, &rect); - rcWnd.top = rect.bottom; - ::AdjustWindowRectEx(&rcWnd, m_tab.GetStyle(), FALSE, m_tab.GetExStyle()); - m_tab.DeleteItem(nIndex); - - return rcWnd.bottom - rcWnd.top; - } - - void UpdateLayout() - { - RECT rect; - GetClientRect(&rect); - - if(m_tab.IsWindow() && ((m_tab.GetStyle() & WS_VISIBLE) != 0)) - m_tab.SetWindowPos(NULL, 0, rect.bottom - m_cyTabHeight, rect.right - rect.left, m_cyTabHeight, SWP_NOZORDER /*| SWP_SHOWWINDOW*/); - - if(m_nActivePage != -1) - ::SetWindowPos(GetPageHWND(m_nActivePage), NULL, 0, 0, rect.right - rect.left, rect.bottom - m_cyTabHeight, SWP_NOZORDER); - } - -}; - -class CBottomTabView : public CBottomTabViewImpl -{ -public: - DECLARE_WND_CLASS_EX(_T("WTL_BottomTabView"), 0, COLOR_APPWORKSPACE) -}; - -#endif // defined(__ATLCTRLX_H__) && defined(WIN32_PLATFORM_PSPC) - - -// --- PPC/SmartPhone controls --- - -//////////////////////////////////////////////////////////////////////////////// -// These are wrapper classes for the Pocket PC 2002/2003 and SmartPhone 2003 controls -// To implement a window based on a control, use following: -// Example: Implementing a window based on a Html control -// -// class CMyHtml : CWindowImpl -// { -// public: -// BEGIN_MSG_MAP(CMyHtml) -// // put your message handler entries here -// END_MSG_MAP() -// }; -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// CHtmlCtrl - -template -class CHtmlCtrlT : public TBase -{ -public: -// Constructors - CHtmlCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CHtmlCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - HWND hWnd = TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - ATLASSERT(hWnd != NULL); // Did you remember to call InitHTMLControl(hInstance) ?? - return hWnd; - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_HTML; - } - -#if (_WIN32_WCE >= 400) - void AddStyle(LPCWSTR pszStyle) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ADDSTYLE, 0, (LPARAM)pszStyle); - } -#endif // (_WIN32_WCE >= 400) - - void AddText(BOOL bPlainText, LPCSTR pszText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ADDTEXT, (WPARAM)bPlainText, (LPARAM)pszText); - } - - void AddHTML(LPCSTR pszHTML) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ADDTEXT, (WPARAM)FALSE, (LPARAM)pszHTML); - } - - void AddText(BOOL bPlainText, LPCWSTR pszText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ADDTEXTW, (WPARAM)bPlainText, (LPARAM)pszText); - } - - void AddHTML(LPCWSTR pszHTML) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ADDTEXTW, (WPARAM)FALSE, (LPARAM)pszHTML); - } - - void Anchor(LPCSTR pszAnchor) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ANCHOR, 0, (LPARAM)pszAnchor); - } - - void Anchor(LPCWSTR pszAnchor) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ANCHORW, 0, (LPARAM)pszAnchor); - } - -#if (_WIN32_WCE >= 420) - void GetBrowserDispatch(IDispatch** ppDispatch) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(ppDispatch); - ATLASSERT(*ppDispatch==NULL); - ::SendMessage(m_hWnd, DTM_BROWSERDISPATCH, 0, (LPARAM)ppDispatch); - } - void GetDocumentDispatch(IDispatch** ppDispatch) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(ppDispatch); - ATLASSERT(*ppDispatch==NULL); - ::SendMessage(m_hWnd, DTM_DOCUMENTDISPATCH , 0, (LPARAM)ppDispatch); - } -#endif // (_WIN32_WCE >= 420) - - void Clear() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_CLEAR, 0, 0L); - } - - void EnableClearType(BOOL bEnable = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ENABLECLEARTYPE, 0, (LPARAM)bEnable); - } - - void EnableContextMenu(BOOL bEnable = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ENABLECONTEXTMENU, 0, (LPARAM)bEnable); - } - - void EnableScripting(BOOL bEnable = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ENABLESCRIPTING, 0, (LPARAM)bEnable); - } - - void EnableShrink(BOOL bEnable = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ENABLESHRINK, 0, (LPARAM)bEnable); - } - - void EndOfSource() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ENDOFSOURCE, 0, 0L); - } - - void ImageFail(DWORD dwCookie) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_IMAGEFAIL, 0, (LPARAM)dwCookie); - } - - int GetLayoutHeight() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, DTM_LAYOUTHEIGHT, 0, 0L); - } - - int GetLayoutWidth() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, DTM_LAYOUTWIDTH, 0, 0L); - } - - void Navigate(LPCTSTR pstrURL, UINT uFlags = 0) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pstrURL); - ::SendMessage(m_hWnd, DTM_NAVIGATE, (WPARAM)uFlags, (LPARAM)pstrURL); - } - - void SelectAll() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_SELECTALL, 0, 0L); - } - - void SetImage(INLINEIMAGEINFO* pImageInfo) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pImageInfo); - ::SendMessage(m_hWnd, DTM_SETIMAGE, 0, (LPARAM)pImageInfo); - } - - void ZoomLevel(int iLevel) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_ZOOMLEVEL, 0, (LPARAM)iLevel); - } - -#if (_WIN32_WCE >= 400) - void Stop() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DTM_STOP, 0, 0L); - } -#endif // (_WIN32_WCE >= 400) - - void GetScriptDispatch(IDispatch** ppDispatch) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(ppDispatch); - ATLASSERT(*ppDispatch==NULL); - ::SendMessage(m_hWnd, DTM_SCRIPTDISPATCH, 0, (LPARAM)ppDispatch); - } -}; - -typedef CHtmlCtrlT CHtmlCtrl; - - -#ifdef WIN32_PLATFORM_PSPC - -/////////////////////////////////////////////////////////////////////////////// -// CRichInkCtrl - -template -class CRichInkCtrlT : public TBase -{ -public: -// Constructors - CRichInkCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CRichInkCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - HWND hWnd = TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - ATLASSERT(hWnd != NULL); // Did you remember to call InitRichInkDLL() ?? - return hWnd; - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_RICHINK; - } - - BOOL CanPaste(UINT uFormat = 0) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_CANPASTE, (WPARAM)uFormat, 0L); - } - - BOOL CanRedo() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_CANREDO, 0, 0L); - } - - BOOL CanUndo() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_CANUNDO, 0, 0L); - } - - void ClearAll(BOOL bRepaint = TRUE) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_CLEARALL, (WPARAM)bRepaint, 0L); - } - - BOOL GetModify() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, EM_GETMODIFY, 0, 0L); - } - - UINT GetPageStyle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_GETPAGESTYLE, 0, 0L); - } - - UINT GetPenMode() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_GETPENMODE, 0, 0L); - } - - UINT GetViewStyle() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_GETVIEW, 0, 0L); - } - - UINT GetWrapMode() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_GETWRAPMODE, 0, 0L); - } - - UINT GetZoomPercent() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_GETZOOMPERCENT, 0, 0L); - } - - void InsertLinks(LPWSTR lpString, int cchLength = -1) - { - ATLASSERT(::IsWindow(m_hWnd)); - if(cchLength == -1) - cchLength = lstrlen(lpString); - ::SendMessage(m_hWnd, EM_INSERTLINKS, (WPARAM)cchLength, (LPARAM)lpString); - } - - void RedoEvent() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_REDOEVENT, 0, 0L); - } - - UINT SetInkLayer(UINT uLayer) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (UINT)::SendMessage(m_hWnd, EM_SETINKLAYER, (WPARAM)uLayer, 0L); - } - - void SetPageStyle(UINT uStyle) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETPAGESTYLE, (WPARAM)uStyle, 0L); - } - - void SetPenMode(UINT uMode) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETPENMODE, (WPARAM)uMode, 0L); - } - - void SetViewStyle(UINT uStyle) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETVIEW, (WPARAM)uStyle, 0L); - } - - void SetViewAttributes(VIEWATTRIBUTES* pAttribs) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pAttribs); - ::SendMessage(m_hWnd, EM_SETVIEWATTRIBUTES, 0, (LPARAM)pAttribs); - } - - void SetWrapMode(UINT uMode) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETWRAPMODE, (WPARAM)uMode, 0L); - } - - void SetZoomPercent(UINT uPercent) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETZOOMPERCENT, (WPARAM)uPercent, 0L); - } - - LONG StreamIn(UINT uFormat, EDITSTREAM& es) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_STREAMIN, (WPARAM)uFormat, (LPARAM)&es); - } - - LONG StreamOut(UINT uFormat, EDITSTREAM& es) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (LONG)::SendMessage(m_hWnd, EM_STREAMOUT, (WPARAM)uFormat, (LPARAM)&es); - } - - void UndoEvent() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_UNDOEVENT, 0, 0L); - } - - void Undo() - { - UndoEvent(); - } - -// Standard EM_xxx messages - DWORD GetSel() const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetViewStyle() != VT_DRAWINGVIEW); - return (DWORD)::SendMessage(m_hWnd, EM_GETSEL, 0, 0L); - } - - void GetSel(int& nStartChar, int& nEndChar) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetViewStyle() != VT_DRAWINGVIEW); - ::SendMessage(m_hWnd, EM_GETSEL, (WPARAM)&nStartChar, (LPARAM)&nEndChar); - } - - void SetSel(int nStartChar, int nEndChar) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetViewStyle() != VT_DRAWINGVIEW); - ::SendMessage(m_hWnd, EM_SETSEL, nStartChar, nEndChar); - } - - void ReplaceSel(LPCTSTR lpszNewText, BOOL bCanUndo = FALSE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(GetViewStyle() != VT_DRAWINGVIEW); - ::SendMessage(m_hWnd, EM_REPLACESEL, (WPARAM)bCanUndo, (LPARAM)lpszNewText); - } - - void SetModify(BOOL bModified = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, EM_SETMODIFY, (WPARAM)bModified, 0L); - } - - int GetTextLength() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, WM_GETTEXTLENGTH, 0, 0L); - } - -// Clipboard operations - void Clear() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_CLEAR, 0, 0L); - } - - void Copy() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_COPY, 0, 0L); - } - - void Cut() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_CUT, 0, 0L); - } - - void Paste() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, WM_PASTE, 0, 0L); - } -}; - -typedef CRichInkCtrlT CRichInkCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CInkXCtrl - -template -class CInkXCtrlT : public TBase -{ -public: -// Constructors - CInkXCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CInkXCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - HWND hWnd = TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - ATLASSERT(hWnd != NULL); // Did you remember to call InitInkX() ?? - return hWnd; - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_INKX; - } - - static UINT GetHotRecordingMessage() - { - return ::RegisterWindowMessage(szHotRecording); - } - - void ClearAll() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IM_CLEARALL, 0, 0L); - } - - int GetData(BYTE* lpBuffer, INT cbBuffer) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(lpBuffer); - return (int)::SendMessage(m_hWnd, IM_GETDATA, (WPARAM)cbBuffer, (LPARAM)lpBuffer); - } - - int GetDataLen() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, IM_GETDATALEN, 0, 0L); - } - - CRichInkCtrl GetRichInk() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HWND)::SendMessage(m_hWnd, IM_GETRICHINK, 0, 0L); - } - - BOOL IsRecording() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, IM_RECORDING, 0, 0L); - } - - void ReInit() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IM_REINIT, 0, 0L); - } - - void SetData(const BYTE* lpInkData, INT cbInkData) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(lpInkData); - ::SendMessage(m_hWnd, IM_SETDATA, (WPARAM)cbInkData, (LPARAM)lpInkData); - } - - void VoicePlay() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IM_VOICE_PLAY, 0, 0L); - } - - BOOL IsVoicePlaying() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, IM_VOICE_PLAYING, 0, 0L); - } - - BOOL VoiceRecord() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, IM_VOICE_RECORD, 0, 0L); - } - - void VoiceStop() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IM_VOICE_STOP, 0, 0L); - } - - void ShowVoiceBar(BOOL bShow = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, IM_VOICEBAR, (WPARAM)bShow, 0L); - } -}; - -typedef CInkXCtrlT CInkXCtrl; - -#endif // WIN32_PLATFORM_PSPC - - -/////////////////////////////////////////////////////////////////////////////// -// CVoiceRecorderCtrl - -template -class CVoiceRecorderCtrlT : public TBase -{ -public: -// Constructors - CVoiceRecorderCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CVoiceRecorderCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, const POINT pt, LPTSTR pstrFileName, UINT nID, DWORD dwStyle = 0) - { - ATLASSERT(pstrFileName != NULL); - CM_VOICE_RECORDER cmvr = { 0 }; - cmvr.cb = sizeof(CM_VOICE_RECORDER); - cmvr.dwStyle = dwStyle; - cmvr.xPos = pt.x; - cmvr.yPos = pt.y; - cmvr.hwndParent = hWndParent; - cmvr.id = nID; - cmvr.lpszRecordFileName = pstrFileName; - m_hWnd = VoiceRecorder_Create(&cmvr); - return m_hWnd; - } - - HWND Create(LPCM_VOICE_RECORDER pAttribs) - { - ATLASSERT(pAttribs); - m_hWnd = VoiceRecorder_Create(pAttribs); - return m_hWnd; - } - -// Attributes - void Record() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, VRM_RECORD, 0, 0L); - } - - void Play() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, VRM_PLAY, 0, 0L); - } - - void Stop() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, VRM_STOP, 0, 0L); - } - - void Cancel() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, VRM_CANCEL, 0, 0L); - } - - void Done() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, VRM_OK, 0, 0L); - } -}; - -typedef CVoiceRecorderCtrlT CVoiceRecorderCtrl; - - -#ifdef WIN32_PLATFORM_PSPC - -/////////////////////////////////////////////////////////////////////////////// -// CDocListCtrl - -template -class CDocListCtrlT : public TBase -{ -public: -// Attributes - DOCLISTCREATE m_dlc; - TCHAR m_szPath[MAX_PATH]; - -// Constructors - CDocListCtrlT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CDocListCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, WORD wId, LPCTSTR pszFolder = NULL, LPCTSTR pstrFilter = NULL, - WORD wFilterIndex = 0, DWORD dwFlags = DLF_SHOWEXTENSION) - { - ATLASSERT(pstrFilter != NULL); // It seems to need a filter badly!! - ::ZeroMemory(&m_dlc, sizeof(DOCLISTCREATE)); - ::ZeroMemory(m_szPath, sizeof(m_szPath)); - if(pszFolder != NULL) - SecureHelper::strncpy_x(m_szPath, MAX_PATH, pszFolder, MAX_PATH - 1); - m_dlc.dwStructSize = sizeof(DOCLISTCREATE); - m_dlc.hwndParent = hWndParent; - m_dlc.pszFolder = m_szPath; - m_dlc.pstrFilter = pstrFilter; - m_dlc.wFilterIndex = wFilterIndex; - m_dlc.wId = wId; - m_dlc.dwFlags = dwFlags; - m_hWnd = DocList_Create(&m_dlc); - return m_hWnd; - } - - HWND Create(DOCLISTCREATE* pDlc) - { - m_dlc = *pDlc; - m_hWnd = DocList_Create(&m_dlc); - return m_hWnd; - } - -// Attributes - void DeleteSel() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DLM_DELETESEL, 0, 0L); - } - - void DisableUpdates() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DLM_DISABLEUPDATES, 0, 0L); - } - - void EnableUpdates() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DLM_ENABLEUPDATES, 0, 0L); - } - - int GetFilterIndex() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, DLM_GETFILTERINDEX, 0, 0L); - } - - int GetItemCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, DLM_GETITEMCOUNT, 0, 0L); - } - - int GetNextItem(int iIndex, DWORD dwRelation = LVNI_ALL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, DLM_GETNEXTITEM, (WPARAM)iIndex, (LPARAM)dwRelation); - } - - int GetFirstItem(DWORD dwRelation = LVNI_ALL) const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, DLM_GETNEXTITEM, (WPARAM)-1, (LPARAM)dwRelation); - } - - BOOL GetNextWave(int* pIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pIndex); - return (BOOL)::SendMessage(m_hWnd, DLM_GETNEXTWAVE, 0, (LPARAM)pIndex); - } - - BOOL GetPrevWave(int* pIndex) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pIndex); - return (BOOL)::SendMessage(m_hWnd, DLM_GETPREVWAVE, 0, (LPARAM)pIndex); - } - - int GetSelCount() const - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, DLM_GETSELCOUNT, 0, 0L); - } - - BOOL GetSelPathName(LPTSTR pstrPath, int cchMax) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pstrPath); - return (BOOL)::SendMessage(m_hWnd, DLM_GETSELPATHNAME, (WPARAM)cchMax, (LPARAM)pstrPath); - } - - void ReceiveIR(LPCTSTR pstrPath) const - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pstrPath); - ::SendMessage(m_hWnd, DLM_RECEIVEIR, 0, (LPARAM)pstrPath); - } - - void Refresh() - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DLM_REFRESH, 0, 0L); - } - - BOOL RenameMoveSelectedItems() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, DLM_RENAMEMOVE, 0, 0L); - } - - int SelectAll() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (int)::SendMessage(m_hWnd, DLM_SELECTALL, 0, 0L); - } - - HRESULT SelectItem(LPCTSTR pstrPath, BOOL bVisible = TRUE) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pstrPath); - return (HRESULT)::SendMessage(m_hWnd, DLM_SELECTITEM, (WPARAM)bVisible, (LPARAM)pstrPath); - } - - void SendEMail(LPCTSTR pstrAttachment) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DLM_SENDEMAIL, 0, (LPARAM)pstrAttachment); - } - - void SendIR(LPCTSTR pstrPath) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DLM_SENDIR, 0, (LPARAM)pstrPath); - } - - HRESULT SetFilterIndex(int iIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HRESULT)::SendMessage(m_hWnd, DLM_SETFILTERINDEX, (WPARAM)iIndex, 0L); - } - - void SetFolder(LPCTSTR pstrPath) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pstrPath); - ::SendMessage(m_hWnd, DLM_SETFOLDER, 0, (LPARAM)pstrPath); - } - - BOOL SetItemState(int iIndex, const LVITEM* pItem) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pItem); - return (BOOL)::SendMessage(m_hWnd, DLM_SETITEMSTATE, (WPARAM)iIndex, (LPARAM)pItem); - } - - BOOL SetItemState(int iIndex, UINT uState, UINT uMask) - { - ATLASSERT(::IsWindow(m_hWnd)); - LV_ITEM lvi = { 0 }; - lvi.stateMask = uMask; - lvi.state = uState; - return (BOOL)::SendMessage(m_hWnd, DLM_SETITEMSTATE, (WPARAM)iIndex, (LPARAM)&lvi); - } - - void SetOneItem(int iIndex, LPCVOID pPA) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DLM_SETONEITEM, (WPARAM)iIndex, (LPARAM)pPA); - } - - void SetSelect(int iIndex) - { - ATLASSERT(::IsWindow(m_hWnd)); - ::SendMessage(m_hWnd, DLM_SETSELECT, (WPARAM)iIndex, 0L); - } - - void SetSelPathName(LPCTSTR pstrPath) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pstrPath); - ::SendMessage(m_hWnd, DLM_SETSELPATHNAME, 0, (LPARAM)pstrPath); - } - - BOOL SetSortOrder() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, DLM_SETSORTORDER, 0, 0L); - } - - HRESULT Update() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (HRESULT)::SendMessage(m_hWnd, DLM_UPDATE, 0, 0L); - } - - BOOL ValidateFolder() - { - ATLASSERT(::IsWindow(m_hWnd)); - return (BOOL)::SendMessage(m_hWnd, DLM_VALIDATEFOLDER, 0, 0L); - } - -// Functions - BOOL GetFirstSelectedWaveFile(int* pIndex, LPTSTR szPath, const size_t cchPath) - { - ATLASSERT(::IsWindow(m_hWnd)); - return DocList_GetFirstSelectedWaveFile(m_hWnd, pIndex, szPath, cchPath); - } - - BOOL GetNextSelectedWaveFile(int* pIndex, LPTSTR szPath, const size_t cchPath) - { - ATLASSERT(::IsWindow(m_hWnd)); - return DocList_GetNextSelectedWaveFile(m_hWnd, pIndex, szPath, cchPath); - } -}; - -typedef CDocListCtrlT CDocListCtrl; - -#endif // WIN32_PLATFORM_PSPC - - -/////////////////////////////////////////////////////////////////////////////// -// CCapEdit - -template -class CCapEditT : public TBase -{ -public: -// Constructors - CCapEditT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CCapEditT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - HWND hWnd = /*TBase*/CWindow::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - ATLASSERT(hWnd != NULL); // Did you remember to call SHInitExtraControls() ?? - return hWnd; - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_CAPEDIT; - } -}; - -typedef CCapEditT CCapEdit; - -/////////////////////////////////////////////////////////////////////////////// -// CTTStatic - -#ifndef WIN32_PLATFORM_WFSP // Tooltips not supported on SmartPhone - -template -class CTTStaticT : public TBase -{ -public: -// Constructors - CTTStaticT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CTTStaticT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - HWND hWnd = TBase::Create(hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - ATLASSERT(hWnd != NULL); // Did you remember to call SHInitExtraControls() ?? - return hWnd; - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_TSTATIC; - } - -// Operations - BOOL SetToolTipText(LPCTSTR pstrTipText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pstrTipText); - ATLASSERT(lstrlen(pstrTipText) <= 253); - CTempBuffer buff; - int cchLen = lstrlen(pstrTipText) + 3; - LPTSTR pstr = buff.Allocate(cchLen); - if(pstr == NULL) - return FALSE; - SecureHelper::strcpy_x(pstr, cchLen, _T("~~")); - SecureHelper::strcat_x(pstr, cchLen, pstrTipText); - return SetWindowText(pstr); - } -}; - -typedef CTTStaticT CTTStatic; - - -/////////////////////////////////////////////////////////////////////////////// -// CTTButton - -template -class CTTButtonT : public TBase -{ -public: -// Constructors - CTTButtonT(HWND hWnd = NULL) : TBase(hWnd) - { } - - CTTButtonT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - HWND hWnd = TBase::Create(hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); - ATLASSERT(hWnd != NULL); // Did you remember to call SHInitExtraControls() ?? - return hWnd; - } - -// Attributes - static LPCTSTR GetWndClassName() - { - return WC_TBUTTON; - } - -// Operations - BOOL SetToolTipText(LPCTSTR pstrTipText) - { - ATLASSERT(::IsWindow(m_hWnd)); - ATLASSERT(pstrTipText); - ATLASSERT(lstrlen(pstrTipText) <= 253); - CTempBuffer buff; - int cchLen = lstrlen(pstrTipText) + 3; - LPTSTR pstr = buff.Allocate(cchLen); - if(pstr == NULL) - return FALSE; - SecureHelper::strcpy_x(pstr, cchLen, _T("~~")); - SecureHelper::strcat_x(pstr, cchLen, pstrTipText); - return SetWindowText(pstr); - } -}; - -typedef CTTButtonT CTTButton; - -#endif // !WIN32_PLATFORM_WFSP - - -// --- SmartPhone specific controls --- - -#ifdef WIN32_PLATFORM_WFSP - -/////////////////////////////////////////////////////////////////////////////// -// CSpinCtrlT - CSpinCtrl : SmartPhone adapted UpDown control - -template -class CSpinCtrlT : public CUpDownCtrlT< TBase > -{ -public: -// Constructors - CSpinCtrlT(HWND hWnd = NULL) : CUpDownCtrlT< TBase >(hWnd) - { } - - CSpinCtrlT< TBase >& operator =(HWND hWnd) - { - m_hWnd = hWnd; - return *this; - } - - HWND Create(HWND hWndParent, HWND hBuddy, DWORD dwStyle, int nID, LPCTSTR szExpandedName = NULL) - { - ATLASSERT(::IsWindow(hWndParent)); - CUpDownCtrlT< TBase >::Create(hWndParent, NULL, szExpandedName, dwStyle, 0, nID, NULL); - ATLASSERT(m_hWnd != NULL); // Did you remember to call AtlInitCommonControls(ICC_UPDOWN_CLASS)? - if (hBuddy != NULL) - { - ATLASSERT(::IsWindow(hBuddy)); - SetBuddy(hBuddy); - } - return m_hWnd; - } -}; - -typedef CSpinCtrlT CSpinCtrl; - - -/////////////////////////////////////////////////////////////////////////////// -// CSpinned - SmartPhone association of control and Spin - -template -class CSpinned : public TBase -{ -public: - CSpinCtrl m_SpinCtrl; - DWORD m_dwSpinnedStyle; - -// Constructors - CSpinned(HWND hWnd = NULL) : TBase(hWnd) - { - m_dwSpinnedStyle = WS_VISIBLE | UDS_ALIGNRIGHT | UDS_EXPANDABLE; - - if (t_bExpandOnly == true) - m_dwSpinnedStyle |= UDS_NOSCROLL; - else - m_dwSpinnedStyle |= UDS_HORZ | UDS_ARROWKEYS | UDS_SETBUDDYINT | UDS_WRAP; - - if (hWnd != NULL) - AttachOrCreateSpinCtrl(); - } - - CSpinned& operator =(HWND hWnd) - { - Attach(hWnd); - return *this; - } - - void Attach(HWND hWnd) - { - ATLASSERT(!IsWindow()); - TBase* pT = static_cast(this); - pT->m_hWnd = hWnd; - if (hWnd != NULL) - AttachOrCreateSpinCtrl(); - } - - HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szExpandedName = NULL, - DWORD dwStyle = 0, DWORD dwExStyle = 0, - ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) - { - - TBase* pT = static_cast(this); - TBase::Create(hWndParent, rect, NULL, dwStyle, dwExStyle, MenuOrID, lpCreateParam); - ATLASSERT(pT->m_hWnd != NULL); - - m_SpinCtrl.Create(hWndParent, pT->m_hWnd, m_dwSpinnedStyle, ATL_IDW_SPIN_ID + (int)MenuOrID.m_hMenu, szExpandedName); - - ATLASSERT(m_SpinCtrl.m_hWnd != NULL); // Did you remember to call AtlInitCommonControls(ICC_UPDOWN_CLASS)? - - return pT->m_hWnd; - } - -// Attributes - CSpinCtrl& GetSpinCtrl() - { - return m_SpinCtrl; - } - -// Implementation - // Attach our existing SpinCtrl or create one - bool AttachOrCreateSpinCtrl() - { - TBase* pT = static_cast(this); - - HWND hSpin = ::GetDlgItem(pT->GetParent(), ATL_IDW_SPIN_ID + pT->GetDlgCtrlID()); - - if (hSpin != NULL) - { - m_SpinCtrl.Attach(hSpin); -#ifdef DEBUG - TCHAR sClassName[16] = { 0 }; - ::GetClassName(hSpin, sClassName, 16); - ATLASSERT(!_tcscmp(sClassName, UPDOWN_CLASS)); - ATLASSERT(m_SpinCtrl.GetBuddy().m_hWnd == pT->m_hWnd); -#endif // DEBUG - } - else - { - m_SpinCtrl.Create(pT->GetParent(), pT->m_hWnd, m_dwSpinnedStyle, ATL_IDW_SPIN_ID + pT->GetDlgCtrlID()); - } - - return m_SpinCtrl.m_hWnd != NULL; - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// CSpinListBox - SmartPhone spinned ListBox control -// CExpandListBox - SmartPhone expandable ListBox control -// CExpandEdit - SmartPhone expandable Edit control -// CExpandCapEdit - SmartPhone expandable CapEdit control - -typedef CSpinned CSpinListBox; -typedef CSpinned CExpandListBox; -typedef CSpinned CExpandEdit; -typedef CSpinned CExpandCapEdit; - -#endif // WIN32_PLATFORM_WFSP - -#endif // _WTL_CE_NO_CONTROLS - -}; // namespace WTL - -#endif // __ATLWINCE_H__ diff --git a/thirdparty/wtl/atlwinx.h b/thirdparty/wtl/atlwinx.h index 4075c9b..99518bc 100644 --- a/thirdparty/wtl/atlwinx.h +++ b/thirdparty/wtl/atlwinx.h @@ -1,13 +1,10 @@ -// Windows Template Library - WTL version 8.1 -// Copyright (C) Microsoft Corporation. All rights reserved. +// Windows Template Library - WTL version 10.0 +// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. +// Microsoft Public License (http://opensource.org/licenses/MS-PL) +// which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLWINX_H__ #define __ATLWINX_H__ @@ -18,17 +15,13 @@ #error atlwinx.h requires atlapp.h to be included first #endif -#if (_ATL_VER >= 0x0700) - #include -#endif // (_ATL_VER >= 0x0700) +#include /////////////////////////////////////////////////////////////////////////////// // Classes in this file: // -// _U_RECT -// _U_MENUorID -// _U_STRINGorID +// CWindowEx /////////////////////////////////////////////////////////////////////////////// @@ -88,7 +81,6 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA hWndChild = ((LPNMHDR)lParam)->hwndFrom; idFrom = ((LPNMHDR)lParam)->idFrom; break; -#ifndef _WIN32_WCE case WM_PARENTNOTIFY: switch(LOWORD(wParam)) { @@ -103,7 +95,6 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA break; } break; -#endif // !_WIN32_WCE case WM_DRAWITEM: if(wParam) // not from a menu { @@ -236,7 +227,7 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA } #define REFLECT_COMMAND(id, code) \ - if(uMsg == WM_COMMAND && id == LOWORD(wParam) && code == HIWORD(wParam)) \ + if((uMsg == WM_COMMAND) && (id == LOWORD(wParam)) && (code == HIWORD(wParam))) \ { \ bHandled = TRUE; \ lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ @@ -245,7 +236,7 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA } #define REFLECT_COMMAND_ID(id) \ - if(uMsg == WM_COMMAND && id == LOWORD(wParam)) \ + if((uMsg == WM_COMMAND) && (id == LOWORD(wParam))) \ { \ bHandled = TRUE; \ lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ @@ -254,7 +245,7 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA } #define REFLECT_COMMAND_CODE(code) \ - if(uMsg == WM_COMMAND && code == HIWORD(wParam)) \ + if((uMsg == WM_COMMAND) && (code == HIWORD(wParam))) \ { \ bHandled = TRUE; \ lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ @@ -263,7 +254,7 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA } #define REFLECT_COMMAND_RANGE(idFirst, idLast) \ - if(uMsg == WM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ + if((uMsg == WM_COMMAND) && (LOWORD(wParam) >= idFirst) && (LOWORD(wParam) <= idLast)) \ { \ bHandled = TRUE; \ lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ @@ -272,7 +263,7 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA } #define REFLECT_COMMAND_RANGE_CODE(idFirst, idLast, code) \ - if(uMsg == WM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ + if((uMsg == WM_COMMAND) && (code == HIWORD(wParam)) && (LOWORD(wParam) >= idFirst) && (LOWORD(wParam) <= idLast)) \ { \ bHandled = TRUE; \ lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ @@ -281,7 +272,7 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA } #define REFLECT_NOTIFY(id, cd) \ - if(uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom && cd == ((LPNMHDR)lParam)->code) \ + if((uMsg == WM_NOTIFY) && (id == ((LPNMHDR)lParam)->idFrom) && (cd == ((LPNMHDR)lParam)->code)) \ { \ bHandled = TRUE; \ lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ @@ -290,7 +281,7 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA } #define REFLECT_NOTIFY_ID(id) \ - if(uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \ + if((uMsg == WM_NOTIFY) && (id == ((LPNMHDR)lParam)->idFrom)) \ { \ bHandled = TRUE; \ lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ @@ -299,7 +290,7 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA } #define REFLECT_NOTIFY_CODE(cd) \ - if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \ + if((uMsg == WM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code)) \ { \ bHandled = TRUE; \ lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ @@ -308,7 +299,7 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA } #define REFLECT_NOTIFY_RANGE(idFirst, idLast) \ - if(uMsg == WM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ + if((uMsg == WM_NOTIFY) && (((LPNMHDR)lParam)->idFrom >= idFirst) && (((LPNMHDR)lParam)->idFrom <= idLast)) \ { \ bHandled = TRUE; \ lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ @@ -317,7 +308,7 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA } #define REFLECT_NOTIFY_RANGE_CODE(idFirst, idLast, cd) \ - if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ + if((uMsg == WM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code) && (((LPNMHDR)lParam)->idFrom >= idFirst) && (((LPNMHDR)lParam)->idFrom <= idLast)) \ { \ bHandled = TRUE; \ lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ @@ -327,198 +318,249 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA /////////////////////////////////////////////////////////////////////////////// -// Reflected message handler macros for message maps (for ATL 3.0) +// GetClassLong/SetClassLong redefinition to avoid problems with class members + +#ifdef SetClassLongPtrA + #undef SetClassLongPtrA + inline LONG_PTR SetClassLongPtrA(HWND hWnd, int nIndex, LONG_PTR dwNewLong) + { + return ::SetClassLongA(hWnd, nIndex, LONG(dwNewLong)); + } +#endif -#if (_ATL_VER < 0x0700) +#ifdef SetClassLongPtrW + #undef SetClassLongPtrW + inline LONG_PTR SetClassLongPtrW(HWND hWnd, int nIndex, LONG_PTR dwNewLong) + { + return ::SetClassLongW(hWnd, nIndex, LONG(dwNewLong)); + } +#endif -#define REFLECTED_COMMAND_HANDLER(id, code, func) \ - if(uMsg == OCM_COMMAND && id == LOWORD(wParam) && code == HIWORD(wParam)) \ - { \ - bHandled = TRUE; \ - lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ +#ifdef GetClassLongPtrA + #undef GetClassLongPtrA + inline LONG_PTR GetClassLongPtrA(HWND hWnd, int nIndex) + { + return ::GetClassLongA(hWnd, nIndex); + } +#endif + +#ifdef GetClassLongPtrW + #undef GetClassLongPtrW + inline LONG_PTR GetClassLongPtrW(HWND hWnd, int nIndex) + { + return ::GetClassLongW(hWnd, nIndex); + } +#endif + + +/////////////////////////////////////////////////////////////////////////////// +// CWindowEx - extension of ATL::CWindow + +namespace WTL +{ + +class CWindowEx : public ATL::CWindow +{ +public: + CWindowEx(HWND hWnd = NULL) : ATL::CWindow(hWnd) + { } + + CWindowEx& operator =(HWND hWnd) + { + m_hWnd = hWnd; + return *this; } -#define REFLECTED_COMMAND_ID_HANDLER(id, func) \ - if(uMsg == OCM_COMMAND && id == LOWORD(wParam)) \ - { \ - bHandled = TRUE; \ - lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ + operator HWND() const + { + return m_hWnd; } -#define REFLECTED_COMMAND_CODE_HANDLER(code, func) \ - if(uMsg == OCM_COMMAND && code == HIWORD(wParam)) \ - { \ - bHandled = TRUE; \ - lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ +// Methods + BOOL PrintWindow(HDC hDC, UINT uFlags = 0) + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::PrintWindow(m_hWnd, hDC, uFlags); } -#define REFLECTED_COMMAND_RANGE_HANDLER(idFirst, idLast, func) \ - if(uMsg == OCM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ - { \ - bHandled = TRUE; \ - lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ + BOOL DragDetect(POINT pt) + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::DragDetect(m_hWnd, pt); } -#define REFLECTED_COMMAND_RANGE_CODE_HANDLER(idFirst, idLast, code, func) \ - if(uMsg == OCM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ - { \ - bHandled = TRUE; \ - lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ + BOOL DragDetect() + { + ATLASSERT(::IsWindow(m_hWnd)); + + POINT pt = { 0, 0 }; + ::GetCursorPos(&pt); + return ::DragDetect(m_hWnd, pt); } -#define REFLECTED_NOTIFY_HANDLER(id, cd, func) \ - if(uMsg == OCM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom && cd == ((LPNMHDR)lParam)->code) \ - { \ - bHandled = TRUE; \ - lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ + CWindowEx GetAncestor(UINT uFlags) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return CWindowEx(::GetAncestor(m_hWnd, uFlags)); } -#define REFLECTED_NOTIFY_ID_HANDLER(id, func) \ - if(uMsg == OCM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \ - { \ - bHandled = TRUE; \ - lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ + // Note: Does not work properly on Vista Aero and above + BOOL AnimateWindow(DWORD dwFlags, DWORD dwTime = 200) + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::AnimateWindow(m_hWnd, dwTime, dwFlags); } -#define REFLECTED_NOTIFY_CODE_HANDLER(cd, func) \ - if(uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \ - { \ - bHandled = TRUE; \ - lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ + BOOL FlashWindowEx(DWORD dwFlags, UINT uCount, DWORD dwTimeout = 0) + { + ATLASSERT(::IsWindow(m_hWnd)); + + FLASHWINFO fi = { sizeof(FLASHWINFO) }; + fi.hwnd = m_hWnd; + fi.dwFlags = dwFlags; + fi.uCount = uCount; + fi.dwTimeout = dwTimeout; + return ::FlashWindowEx(&fi); } -#define REFLECTED_NOTIFY_RANGE_HANDLER(idFirst, idLast, func) \ - if(uMsg == OCM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ - { \ - bHandled = TRUE; \ - lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ + BOOL StopFlashWindowEx() + { + ATLASSERT(::IsWindow(m_hWnd)); + + FLASHWINFO fi = { sizeof(FLASHWINFO) }; + fi.hwnd = m_hWnd; + fi.dwFlags = FLASHW_STOP; + return ::FlashWindowEx(&fi); } -#define REFLECTED_NOTIFY_RANGE_CODE_HANDLER(idFirst, idLast, cd, func) \ - if(uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ - { \ - bHandled = TRUE; \ - lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ +// Class long properties + DWORD GetClassLong(int nIndex) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::GetClassLong(m_hWnd, nIndex); } -#endif // (_ATL_VER < 0x0700) + DWORD SetClassLong(int nIndex, LONG dwNewLong) + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::SetClassLong(m_hWnd, nIndex, dwNewLong); + } + ULONG_PTR GetClassLongPtr(int nIndex) const + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::GetClassLongPtr(m_hWnd, nIndex); + } -/////////////////////////////////////////////////////////////////////////////// -// Dual argument helper classes (for ATL 3.0) + ULONG_PTR SetClassLongPtr(int nIndex, LONG_PTR dwNewLong) + { + ATLASSERT(::IsWindow(m_hWnd)); + return ::SetClassLongPtr(m_hWnd, nIndex, dwNewLong); + } -#if (_ATL_VER < 0x0700) +// Layered windows + BOOL SetLayeredWindowAttributes(COLORREF crlKey, BYTE byteAlpha, DWORD dwFlags) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetExStyle() & WS_EX_LAYERED) != 0); -namespace ATL -{ + return ::SetLayeredWindowAttributes(m_hWnd, crlKey, byteAlpha, dwFlags); + } -class _U_RECT -{ -public: - _U_RECT(LPRECT lpRect) : m_lpRect(lpRect) - { } - _U_RECT(RECT& rc) : m_lpRect(&rc) - { } - LPRECT m_lpRect; -}; + BOOL UpdateLayeredWindow(HDC hdcDst, LPPOINT pptDst, LPSIZE psize, HDC hdcSrc, LPPOINT pptSrc, COLORREF crlKey, BLENDFUNCTION* pblend, DWORD dwFlags) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetExStyle() & WS_EX_LAYERED) != 0); -class _U_MENUorID -{ -public: - _U_MENUorID(HMENU hMenu) : m_hMenu(hMenu) - { } - _U_MENUorID(UINT nID) : m_hMenu((HMENU)LongToHandle(nID)) - { } - HMENU m_hMenu; -}; + return ::UpdateLayeredWindow(m_hWnd, hdcDst, pptDst, psize, hdcSrc, pptSrc, crlKey, pblend, dwFlags); + } -class _U_STRINGorID -{ -public: - _U_STRINGorID(LPCTSTR lpString) : m_lpstr(lpString) - { } - _U_STRINGorID(UINT nID) : m_lpstr(MAKEINTRESOURCE(nID)) - { } - LPCTSTR m_lpstr; -}; + BOOL UpdateLayeredWindow(LPPOINT pptDst = NULL) + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetExStyle() & WS_EX_LAYERED) != 0); -}; // namespace ATL + return ::UpdateLayeredWindow(m_hWnd, NULL, pptDst, NULL, NULL, NULL, CLR_NONE, NULL, 0); + } -#endif // (_ATL_VER < 0x0700) + BOOL GetLayeredWindowAttributes(COLORREF* pcrlKey, BYTE* pbyteAlpha, DWORD* pdwFlags) const + { + ATLASSERT(::IsWindow(m_hWnd)); + ATLASSERT((GetExStyle() & WS_EX_LAYERED) != 0); + return ::GetLayeredWindowAttributes(m_hWnd, pcrlKey, pbyteAlpha, pdwFlags); + } -namespace WTL -{ +// Mouse tracking + BOOL StartTrackMouseLeave() + { + ATLASSERT(::IsWindow(m_hWnd)); -/////////////////////////////////////////////////////////////////////////////// -// Forward notifications support for message maps (for ATL 3.0) + TRACKMOUSEEVENT tme = { 0 }; + tme.cbSize = sizeof(TRACKMOUSEEVENT); + tme.dwFlags = TME_LEAVE; + tme.hwndTrack = m_hWnd; + return ::TrackMouseEvent(&tme); + } -#if (_ATL_VER < 0x0700) + BOOL StartTrackMouse(DWORD dwFlags, DWORD dwHoverTime = HOVER_DEFAULT) + { + ATLASSERT(::IsWindow(m_hWnd)); -// forward notifications support -#define FORWARD_NOTIFICATIONS() \ - { \ - bHandled = TRUE; \ - lResult = WTL::Atl3ForwardNotifications(m_hWnd, uMsg, wParam, lParam, bHandled); \ - if(bHandled) \ - return TRUE; \ + TRACKMOUSEEVENT tme = { 0 }; + tme.cbSize = sizeof(TRACKMOUSEEVENT); + tme.dwFlags = dwFlags; + tme.hwndTrack = m_hWnd; + tme.dwHoverTime = dwHoverTime; + return ::TrackMouseEvent(&tme); } -static LRESULT Atl3ForwardNotifications(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) -{ - LRESULT lResult = 0; - switch(uMsg) + BOOL CancelTrackMouse(DWORD dwType) { - case WM_COMMAND: - case WM_NOTIFY: -#ifndef _WIN32_WCE - case WM_PARENTNOTIFY: -#endif // !_WIN32_WCE - case WM_DRAWITEM: - case WM_MEASUREITEM: - case WM_COMPAREITEM: - case WM_DELETEITEM: - case WM_VKEYTOITEM: - case WM_CHARTOITEM: - case WM_HSCROLL: - case WM_VSCROLL: - case WM_CTLCOLORBTN: - case WM_CTLCOLORDLG: - case WM_CTLCOLOREDIT: - case WM_CTLCOLORLISTBOX: - case WM_CTLCOLORMSGBOX: - case WM_CTLCOLORSCROLLBAR: - case WM_CTLCOLORSTATIC: - lResult = ::SendMessage(::GetParent(hWnd), uMsg, wParam, lParam); - break; - default: - bHandled = FALSE; - break; + ATLASSERT(::IsWindow(m_hWnd)); + + TRACKMOUSEEVENT tme = { 0 }; + tme.cbSize = sizeof(TRACKMOUSEEVENT); + tme.dwFlags = TME_CANCEL | dwType; + tme.hwndTrack = m_hWnd; + return ::TrackMouseEvent(&tme); } - return lResult; -} -#endif // (_ATL_VER < 0x0700) +// CString support +#ifdef __ATLSTR_H__ + int GetWindowText(ATL::CString& strText) const + { + int nLength = GetWindowTextLength(); + LPTSTR pszText = strText.GetBuffer(nLength + 1); + nLength = ::GetWindowText(m_hWnd, pszText, nLength + 1); + strText.ReleaseBuffer(nLength); + + return nLength; + } + + UINT GetDlgItemText(int nID, ATL::CString& strText) const + { + ATLASSERT(::IsWindow(m_hWnd)); + + HWND hItem = GetDlgItem(nID); + if(hItem != NULL) + { + int nLength = ::GetWindowTextLength(hItem); + LPTSTR pszText = strText.GetBuffer(nLength + 1); + nLength = ::GetWindowText(hItem, pszText, nLength + 1); + strText.ReleaseBuffer(nLength); + + return nLength; + } + else + { + strText.Empty(); + + return 0; + } + } +#endif // __ATLSTR_H__ +}; }; // namespace WTL diff --git a/thirdparty/wtl/readme.htm b/thirdparty/wtl/readme.htm deleted file mode 100644 index 70d9130..0000000 --- a/thirdparty/wtl/readme.htm +++ /dev/null @@ -1,3347 +0,0 @@ - - - - - -Windows Template Library - - - - - - - - - - - - - - - - - - - - - - - - -
-

Windows Template Library - WTL Version 8.1         - (build 9127) 5/7/09


Copyright © 2009 Microsoft Corporation. -All rights reserved.
 
This file is a part of the Windows Template - Library.
- The use and distribution terms for this software are covered by the
- Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
- which can be found in the file CPL.TXT at the root of this distribution.
- By using this software in any fashion, you are agreeing to be bound by
- the terms of this license. You must not remove this notice, or
- any other, from this software.

- -

 

- -

 

- -

Welcome to the Windows Template Library, version -8.1. This document contains the following topics:

-

 

- -

 

-

 

-

-Introduction

-

 

-

Windows Template Library, or WTL, is a set of -classes that extend ATL to support more complex user interfaces for either -applications or various UI components, while maintaining the big advantage of -ATL - small and fast code. WTL classes were designed to be the best and the -easiest way to implement rich Win32 based UI for ATL based applications, -servers, components, and controls.

-

 

-

WTL provides support for implementing -many -user interface elements, from frame and popup windows, to MDI, standard and -common controls, common dialogs, property sheets and pages, GDI objects, UI -updating, scrollable windows, splitter windows, command bars, etc. The WTL -classes are mostly templated and use minimal instance data and inline functions. -They were not designed as a framework, so they do not force a particular -application model, and can accommodate any. The classes do not use hooks or -thread local storage, so they have no restrictions that those techniques impose. -They also have no inter-dependencies and can be freely mixed with straight SDK -code. In summary, WTL delivers very small and efficient code, very close in size -and speed to SDK programs, while presenting a more logical, object oriented -model to a programmer.

-

 

-

 

-

-Features And Installation

-

 

-

This is the sixth public release -of WTL, after WTL 3.0, 3.1, 7.0, 7.1, and 7.5. It is also the second release of WTL -under the Common Public License, enabling developers from the WTL community to -contribute to the library.

-

 

-

WTL classes can be used with either VC++ 6.0 and ATL 3.0, VC++ .NET -2002 and ATL 7.0, VC++ .NET 2003 and ATL 7.1, VC++ 2005 with ATL 8.0, or EVC++ 4.0 or 3.0 with ATL for -Windows CE. AppWizard for VC++ .NET 2002 and 2003, and Visual C++ 2005 is -included.

-

 

-

The WTL classes are provided in -header files located in the include directory. The only header files that must -be included is atlapp.h, while others can be used when needed. The name of the -file doesn't mean that you have to create an application, just that -atlapp.h contains base definitions required for WTL projects.

-

 

-

To install WTL, just copy the whole directory -structure, or unpack the archive file, to the location of your choice. Please be sure to -add the WTL\include -directory to the list of include directories in VC++, so that the compiler -can find them when you include them in your projects..

-

 

-

Setup programs for the AppWizard are provided. After executing the setup scripts, ATL/WTL AppWizard will appear in the list of AppWizards when you select File.New.Project -in VC++ IDE. The file AppWiz\setup70.js is the setup script for VC++ .NET 2002, AppWiz\setup71.js is for VC++ -.NET 2003, and AppWiz\setup80.js is for VC++ 2005. AppWizCE\setup80.js is setup -script for VC++ 2005 SmartDevice projects.

-

 

-

To manually install AppWizard -for VC++ .NET 2002/2003, copy all WTLAppWiz.* files from AppWiz\Files to VC++ .NET -projects directory, %VC7DIR%\Vc7\vcprojects, where %VC7DIR% is the directory -where VC++ .NET 2002/2003 is installed. After that, open WTLAppWiz.vsz and modify the -like that contains ABSOLUTE_PATH to contain %WTLDIR%\AppWiz\Files, where -%WTLDIR% is the directory where WTL files are.

-

 

-

Platform support and -requirements:

-

 

-

    Compiler/IDE/ATL:

-

            -Visual C++ 6.0   (ATL 3.0)

-

            -Visual C++.NET 2002   (ATL 7.0)

-

            -Visual C++.NET 2003   (ATL 7.1)

-

            -Visual C++ 2005   (ATL 8.0)

-

 

-

    SDK -(optional):

-

            -Any Platform SDK from January 2000 release up to the latest Windows SDK

-

 

-

    Windows CE -development:

-

            -eMbedded Visual C++ 3.0 - Pocket PC, Pocket PC 2002

-

            -eMbedded Visual C++ 4.0 - STANDARDSDK_410, Pocket PC 2003, Smartphone 2003, -

-

                                                     -STANDARDSDK_500, Pocket PC 2003 SE, Smartphone 2003 SE

-

            -Visual C++ 2005 - Pocket PC 2003 SE, Smartphone 2003 SE, STANDARDSDK_500,

-

                                       -Windows Mobile 5.0 (Pocket PC and Smartphone),
-                                       -Windows Mobile 6.0 (Standard and Professional)

-

 

-

 

-

-Packing List

-

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
File Name:Description:

readme.htmthis file
CPL.TXTCommon Public License
 
include\
    atlapp.hmessage loop, interfaces, - general app stuff
    atlcrack.hmessage cracker macros
    atlctrls.hstandard and common control - classes
    atlctrlw.hcommand bar class
    atlctrlx.hbitmap button, check list view, - and other controls
    atlddx.hdata exchange for dialogs and - windows
    atldlgs.hcommon dialog classes, property - sheet and page classes
    atlfind.hFind/Replace support for Edit - and RichEdit
    atlframe.hframe window classes, MDI, - update UI classes
    atlgdi.hDC classes, GDI object classes
    atlmisc.hWTL ports of CPoint, CRect, - CSize, CString, etc.
    atlprint.hprinting and print preview
    atlres.hstandard resource IDs
    atlresce.hstandard resource IDs for - Windows CE
    atlscrl.hscrollable windows
    atlsplit.hsplitter windows
    atltheme.hWindows XP theme classes
    atluser.hmenu class, USER object classes
    atlwince.hspecific support for Windows CE - Mobile platforms
    atlwinx.hextensions of ATL windowing - support
 
Samples\
    Aero\...Vista Aero glass showcase
    Alpha\...Windows XP 32-bit (alpha) - toolbar images
    BmpView\...bitmap file view sample
    GuidGen\...WTL version of the GuidGen - sample
    ImageView\...Full-featured PPC frame-view - application
    MDIDocVw\...WTL version of the MDI sample
    MiniPie\...port of the SDK sample for - Mobile devices
    MTPad\...multithreaded notepad sample
    SPControls\...Barebone SmartPhone dialog - application
    TabBrowser\...Web browser using TabView
    Wizard97Test\...Wizard97 showcase - sample
    WTLExplorer\...Explorer-like application - sample
 
AppWiz\
    setup70.jsAppWizard setup program for VC++ - .NET 2002
    setup71.jsAppWizard setup program for VC++ - .NET 2003
    setup80.jsAppWizard setup program for VC++ - 2005
    setup80x.jsAppWizard setup program for VC++ - 2005 Express
    Files\...WTL AppWizard for VC++ .NET 2002 and - 2003 files
 
AppWizCE\
    setup80.jsAppWizard setup program for VC++ - 2005
    Files\...WTL AppWizard for VC++ 2005 files
 
AppWizMobile\
    setup80.jsAppWizard Mobile setup program for VC++ - 2005
    Files\...WTL AppWizard Mobile for VC++ 2005 files
-

 

-

 

-

-Class Overview

-

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
usage:        - mi base   -   a base class (multiple - inheritance)
 client   -   wrapper class for a handle
 as-is   -   to be used directly
 impl   -   implements a window (has - WindowProc) or other support
 helper   -   a helper class
 base   -   implementation base class
-

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
class name:usage:description:

App/module support
CAppModuleas-isapp support, CComModule derived
CServerAppModuleas-ismodule for COM servers
CMessageLoopas-ismessage loop
CMessageFiltermi basemessage filter interface
CIdleHandlermi baseidle time handler interface

Frame windows
CFrameWindowImplBasebase 
CFrameWindowImplimplframe window support
COwnerDrawimpl mi baseowner-draw msg map and handlers
CDialogResize - impl mi basesupport for resizing dialogs
CDoubleBufferImpl - impl midouble-buffer painting support
CDoubleBufferWindowImpl - impldouble-buffer painting window

MDI windows
CMDIWindowclientMDI methods
CMDIFrameWindowImplimplMDI frame window
CMDIChildWindowImplimplMDI child window

Update UI
CUpdateUIBasebase 
CUpdateUImi base classprovides support for UI update
CDynamicUpdateUImi base classprovides dynamic support for UI update

Standard controls
CStaticclientstatic ctrl
CButtonclientbutton ctrl
CListBoxclientlist box ctrl
CComboBoxclientcombo box ctrl
CEditclientedit ctrl
CEditCommandsmistandard edit command support
CScrollBarclientscroll bar ctrl

Common controls
CImageListclientimage list
CListViewCtrlclientlist view ctrl
CTreeViewCtrlclienttree view ctrl
CTreeItemhelper 
CTreeViewCtrlExclientuses CTreeItem
CHeaderCtrlclientheader bar ctrl
CToolBarCtrlclienttoolbar ctrl
CStatusBarCtrlclientstatus bar ctrl
CTabCtrlclienttab ctrl
CToolTipCtrlclienttool tip ctrl
CToolInfohelper 
CTrackBarCtrlclienttrackbar ctrl
CUpDownCtrlclientup-down ctrl
CProgressBarCtrlclientprogress bar ctrl
CHotKeyCtrlclienthot key ctrl
CAnimateCtrlclientanimation ctrl
CRichEditCtrlclientrich edit ctrl
CRichEditCommandsmistd rich edit commands support
CDragListBoxclientdrag list box
CDragListNotifyImplimpl mi classsupport for notifications
CReBarCtrlclientrebar ctrl
CComboBoxExclientextended combo box
CDateTimePickerCtrlclientdate-time ctrl
CFlatScrollBarImplmi implflat scroll bars support
CFlatScrollBaras-isflat scroll bars support
CIPAddressCtrlclientIP address ctrl
CMonthCalendarCtrlclientmonth calendar ctrl
CCustomDrawimpl mi classcustom draw handling support

Windows CE controls
CCECommandBarCtrlclientcommand bar ctrl
CCECommandBandsCtrlclientcommand bands ctrl

Property sheet & page
CPropertySheetWindowclient 
CPropertySheetImplimplproperty sheet
CPropertySheetas-is 
CPropertyPageWindowclient 
CPropertyPageImplimplproperty page
CPropertyPageas-is 
CAxPropertyPageImplimplproperty page with ActiveX
CAxPropertyPageas-is 
CWizard97SheetWindowclient 
CWizard97SheetImplimplWizard97 property sheet
CWizard97Sheetas-is 
CWizard97PageWindowclient 
CWizard97PageImplimplWizard97 property page
CWizard97ExteriorPageImplimplWizard97 exterior page
CWizard97InteriorPageImplimplWizard97 interior page
CAeroWizardFrameWindowclient 
CAeroWizardFrameImplimplAero Wizard frame
CAeroWizardFrameas-is 
CAeroWizardPageWindowclient 
CAeroWizardPageImplimplAero Wizard page
CAeroWizardPageas-is 
CAeroWizardAxPageImplimplAero Wizard page with ActiveX
CAeroWizardAxPageas-is 

Common dialogs
CFileDialogImplimplGetOpenFileName/GetSaveFileName
CFileDialogas-is 
CMultiFileDialogImplimplMulti-select GetOpenFileName
CMultiFileDialogas-is 
CShellFileDialogImplbase 
CShellFileOpenDialogImplimplShell File Open dialog
CShellFileOpenDialogas-is 
CShellFileSaveDialogImplimplShell File Save dialog
CShellFileSaveDialogas-is 
CFolderDialogImplimpldirectory picker
CFolderDialogas-is 
CFontDialogImplimplChooseFont common dialog
CFontDialogas-is 
CRichEditFontDialogImplimplChooseFont for rich edit
CRichEditFontDialogas-is 
CColorDialogImplimplChooseColor common dialog
CColorDialogas-is 
CPrintDialogImplimplPrintDlg common dialog
CPrintDialogas-is 
CPrintDialogExImplimplnew Win2000 print dialog
CPrintDialogExas-is 
CPageSetupDialogImplimplPageSetupDlg common dialog
CPageSetupDialogas-is 
CFindReplaceDialogImplimplFindText/ReplaceText
CFindReplaceDialogas-is 

User support
CMenuclientmenu support
CMenuItemInfoas-isMENUITEMINFO wrapper
CAcceleratorclientaccelerator table
CIconclienticon object
CCursorclientcursor object
CResourceclientgeneric resource object

GDI support
CDCclientDC support
CPaintDCclientfor handling WM_PAINT
CClientDCclientfor GetDC
CWindowDCclientfor GetWindowDC
CMemoryDCclientin-memory DC
CPenclientGDI pen object
CBrushclientGDI brush object
CLogFontas-isLOGFONT wrapper
CFontclientGDI font object
CBitmapclientGDI bitmap object
CPaletteclientGDI palette object
CRgnclientGDI region object

Enhanced controls
CCommandBarCtrlImplimplcommand bar
CCommandBarCtrlas-is 
CBitmapButtonImplimplbitmap button
CBitmapButtonas-is 
CCheckListViewCtrlImplimplcheck list box
CCheckListViewCtrlas-is 
CHyperLinkImplimplhyper link control
CHyperLinkas-is 
CWaitCursoras-iswait cursor
CCustomWaitCursoras-iscustom and animated wait cursor
CMultiPaneStatusBarCtrlImplimplstatus bar with multiple panes
CMultiPaneStatusBarCtrlas-is 
CPaneContainerImplimplpane window container
CPaneContaineras-is 
CSortListViewImplimplsorting list view control
CSortListViewCtrlImplimpl 
CSortListViewCtrlas-is 
CTabViewImpl;impltab view window
CTabViewas-is 

Scrolling window support
CScrollImplimpl miscrolling support
CScrollWindowImplimplscrollable window
CMapScrollImplimpl miscrolling support with map modes
CMapScrollWindowImplimplscrollable window with map modes
CZoomScrollImplimpl mizooming support
CZoomScrollWindowImplimplzooming window
CScrollContainerImplimplscroll container window
CScrollContaineras-is 

Splitter window support
CSplitterImplimpl misplitter support
CSplitterWindowImplimplsplitter window
CSplitterWindowas-is 

Theming support
CThemeclientWindows XP theme
CThemeImplimpltheming support for a window

Buffered paint and animation support
CBufferedPaintas-isbuffered paint
CBufferedPaintImplimpl mibuffered paint support
CBufferedPaintWindowImplimplwindow with buffered paint
CBufferedAnimationas-isbuffered animation
CBufferedAnimationImplimpl mibuffered animation support
CBufferedAnimationWindowImplimplwindow with buffered animation

Edit and RichEdit Find/Replace support
CEditFindReplaceImplBasebase 
CEditFindReplaceImplmiEdit Find/Replace support
CRichEditFindReplaceImplmiRichEdit Find/Replace support

Printing support
CPrinterInfoas-isprint info support
CPrinterclientprinter handle wrapper
CDevModeclientDEVMODE wrapper
CPrinterDCclientprinting DC support
CPrintJobInfoclientprint job info
CPrintJobclientprint job support
CPrintPreviewmiprint preview support
CPrintPreviewWindowImplimplprint preview window
CPrintPreviewWindowas-is 
CZoomPrintPreviewWindowImplimplzooming print preview window
CZoomPrintPreviewWindowas-is 

Miscellaneous
CSizeas-isWTL port of MFC's CSize
CPointas-isWTL port of MFC's CPoint
CRectas-isWTL port of MFC's CRect
CStringas-isWTL port of MFC's CString
CWinDataExchangemidata exchange for controls
CRecentDocumentListmi or as-issupport for MRU list
CFindFileas-isfile search support

In-memory dialog
CMemDlgTemplateas-isIn-memory dialog template
CIndirectDialogImplimplIn-memory dialog class

Task dialog
CTaskDialogImplimplTask Dialog in Vista
CTaskDialogas-is 

Windows CE support
CStdDialogBasebasestandard dialog base class
CStdDialogImplimplstandard dialog implementation
CStdSimpleDialogas-isstandard simple dialog
CStdDialogResizeBasebaseorientation aware standard dialog base class
CStdDialogResizeImplimplorientation aware standard dialog implementation
CStdSimpleDialogResizeImplimplstandard resizing simple dialog implementation
CStdOrientedDialogBasebaseoriented dialog base class
CStdOrientedDialogImplimploriented dialog implementation
CStdSimpleOrientedDialogas-isstandard simple oriented dialog
CAppInfoBasebaseapplication state save/restore to registry
CAppInfoTimplCAppInfoBase constructed from a CAppWindow<T>
CAppWindow<>miPPC/SmartPhone well-behaved application window class
CAppDialogmiPPC/SmartPhone well-behaved application non-modal dialog class
CAppStdDialogImplimplPPC/SmartPhone implementation of non-modal standard dialog application
CFullScreenFrameimplFull screen frame class
CZoomScrollImplmiWinCE zooming implementation
CHtmlCtrlclientHTML control
CRichInkCtrlclientRichInk control
CInkXCtrlclientInkX control
CVoiceRecorderCtrlclientVoiceRecorder control
CDocListCtrlclientDocList control
CCapEditclientCapEdit control
CTTStaticclientTT Static control
CTTButtonclientTT Button control
CSpinCtrlclientSpin control
CSpinListBoxclientSpin List Box control
CExpandListBoxclientExpand List Box control
CExpandEditclientExpand Edit control
CExpandCapEditclientExpand CapEdit control
-

 

-

 

-

-ATL/WTL AppWizard

-

 

-

ATL/WTL AppWizard generates starting code for a -WTL application. It has options to create code for different application types and features.

-

 

-

You can choose the following options:

-
    -
  • Application type (SDI, multi thread SDI, MDI, - TabView, Explorer, dialog based)
  • -
  • Support for hosting ActiveX controls
  • -
  • COM server support
  • -
  • Class implementation in .CPP files
  • -
  • Common Control manifest
  • -
  • Unicode character set
  • -
  • Toolbar, rebar, command bar, status bar
  • -
  • View window, and it's type (generic, dialog - based form, or a list box, edit, list view, tree view, rich edit based, HTML - page, scroll window)
  • -
  • For dialog based apps or a form based view - window - support for hosting ActiveX controls in the dialog
  • -
-

 

-

ATL/WTL AppWizard supports VC++ -.NET 2002 and 2003,and VC++ 2005.

-

 

-

 

-

-Support for -Windows CE

-

 

-

WTL now fully supports building -projects for the Windows CE platforms. This initial support for Windows CE was implemented primarily for -eMbedded Visual C++ 4.0 with Pocket PC 2003 and -SmartPhone 2003 SDKs. However, it can be used with other versions and -configurations. For instance, Standard SDK 4.1 or 5.0 is supported as well. Considerable effort was made to provide the best Windows CE support, -however, there might be some limitations because different platforms provide different -programming support. SmartDevice projects with Visual Studio 2005 are also -supported, and it also includes an AppWizard for VS2005.

-

 

-

The support for Windows CE was -not designed to port projects for the desktop version of Windows as-is to the -Windows CE platforms, but to allow use of the same library, WTL, for both -desktop Windows and Windows CE. Applications for Windows CE are often designed -in a different way, and they use different platform services. WTL depends on the -version of ATL provided with each Windows CE platform, and supports controls and -services that are appropriate and supported for each Windows CE platform.

-

 

-

 

-

-Support for -Visual C++ 2005 Express

-

 

-

WTL 8.0 supports using Visual -C++ Express Edition to build projects. Since Visual C++ 2005 Express ships without ATL, you have -to use a version of ATL that ships with the Platform SDK.

-

 

-

The WTL App Wizard can be -installed by running AppWiz\setup80x.js program. The App Wizard generates code -in the stdafx.h file that allows use of ATL3 from the Platform SDK. That code is -used if WTL_USE_SDK_ATL3 is defined, so you can comment the line in stdafx.h -that defines WTL_USE_SDK_ATL3 to use the project with different versions of -Visual C++ or ATL.

-

 

-

Note that Release builds will -generate some warnings, since ATL3 from Platform SDK is an old version of ATL -which doesn't quite match the newer compiler and CRT files. You can ignore those -warnings, as they do not indicate any real problems with the code.

-

 

-

 

-

-Notes

-

 

-

~    WTL provides -several classes that are also present in ATL 7.0 and 7.1. The classes are: -CSize, CPoint, CRect, and CString in atlmisc.h. -While their existence will not cause any problems, their usage might. You should -qualify the class you want to use with a namespace to resolve ambiguity, either -ATL or WTL namespace, depending on which implementation you want to use. -Alternatively, you can conditionally exclude WTL implementations, by defining -preprocessor symbol _WTL_NO_WTYPES for CSize, CPoint, and CRect; and _WTL_NO_CSTRING -for CString.

-

 

-

~    If -you use WTL 8.0 with VC++ 6.0/ATL 3.0 and define _ATL_STATIC_REGISTRY, you'll -get errors referring to the ambiguous symbol ATL. This is caused by a bug in ATL -3.0 - in atlbase.h, the file statreg.h is included inside of the ATL namespace, -and it contains another namespace ATL declaration. Because of that, the compiler -cannot decide between ATL:: and ATL::ATL:: namespaces. The solution is either to -fix the atlbase.h, or to surround atlbase.h include declaration with following -statements:

-

 

-

    #define -ATL   ATLFIX

-

    #include <atlapp.h>

-

-    #undef ATL

-

-    namespace ATL = ::ATLFIX;

-

 

-

~    -Windows XP allows applications to use Common Controls version 6, which supports -only Unicode applications. While WTL allows creation of Ansi applications that -use Common Controls 6, that should be used only for test programs and is not -recommended or supported for released projects. If you want to use Common -Controls 6, build your application as Unicode.

-

 

-

~    -If you build your app that hosts ActiveX controls -with VC++ 7.x, you can see this assert failing:
-
-    !InlineIsEqualGUID(*m_plibid, GUID_NULL) && "Did you forget -to pass the LIBID to CComModule::Init?"
-
-
There are two ways to fix this:

-
    -
  • -

    In the main .CPP file of your - project, replace the line
    -     hRes = _Module.Init(NULL, hInstance);
    -
    with this one
    -     hRes = _Module.Init(NULL, hInstance, &LIBID_ATLLib);

    -
  • -
  • -

    Compile you project with _ATL_DLL - defined (dynamic link to ATL)

    -
  • -
-

~    -Several of the sample programs included with WTL were extended to support -building for Windows CE. These samples are not specially redesigned for Windows -CE, but just modified to allow you to compile and run them on the Windows CE -platforms. The samples are: BmpView, GuidGen, and MTPad.

-

 

-

~    WTL -supports building projects with EVC++ 3.0 only for Pocket PC and Pocket PC 2002 -platforms, as other platforms don't provide minimum support for ATL or other -required libraries.

-

 

-

~    The -old AppWizards for VC++ 6.0 and eVC++ 4.0/3.0 are not included in this version -of WTL because they cannot be a part of an Open Source project. They are still -available in the previous release, WTL 7.1.

-

 

-

 

-

-Changes Between WTL 8.1 And 8.0

-

 

-

@@ TODO

-

 

-

 

-

-Changes Between WTL 8.0 And 7.5

-

 

-

New and improved:

-
-

RunTimeHelper functions for - correct struct sizes on different versions of Windows
ModuleHelper functions for uniform support of ATL3 and ATL7 module classes
SecureHelper functions for support of secure and non-secure run-time - functions
Support for new Vista features:

-
    -
  • -

    Support for new messages for common controls, dialogs, etc.

    -
  • -
  • -

    Support for TaskDialog

    -
  • -
  • -

    New Shell file dialogs (IFileOpenDialog and IFileSaveDialog)

    -
  • -
  • -

    New Aero Wizard support classes

    -
  • -
  • -

    New classes for Buffered Paint and Buffered Animation

    -
  • -
-

New TabView classes
New dialog class that uses in-memory dialog templates
New CMultiFileDialogImpl and CMultiFileDialog classes that support - multi-select file dialogs
Added message cracker handler prototypes for all handlers
Replaced use of _alloca with CTempBuffer everywhere (and added CTempBuffer - version for ATL3)
New classes for find/replace support for Edit or RichEdit
New class CFileDialogEx that supports GetOpenFileNameEx for Windows Mobile 5
- New features for the App Wizard:

-
    -
  • -

    New default version values

    -
  • -
  • -

    Unicode build option

    -
  • -
  • -

    Support for TabView applications

    -
  • -
  • -

    Support for Explorer applications

    -
  • -
-

Updates for the desktop App Wizard:

-
    -
  • -

    Added calls to set font for views based on controls that use font

    -
  • -
  • -

    Added scroll window as another view type

    -
  • -
-

Support for VC2005 Express:

-
    -
  • -

    Setup for VS2005x

    -
  • -
  • -

    Changes in default.js to take into account that VC2005x does not have a - resource editor

  • -
  • -

    Generated code allows use of ATL3 from the Platform SDK

    -
  • -
-

New AppWizard for Mobile 2003 and 2005 platforms
- New samples:

-
    -
  • -

    Aero - demonstrates the - Vista Glass UI

  • -
  • -

    MiniPie - Windows Mobile 2005 PPC and Smartphone sample

    -
  • -
  • -

    TabBrowser - a web browser using TabView class

    -
  • -
-

MTPad sample updated to show usage of CRichEditFindReplaceImpl and - CEditCommands/CRichEditComma

-
-

 

-

Fixes and enhancements:

-
-

Command Bar:

-
    -
  • -

    Added support for menu items - with bitmaps on Vista

  • -
  • -

    Fix: Keyboard cues shown - even if the window is disabled

  • -
-

 

-

CFolderDialog:

-
    -
  • -

    Added support for PIDLs in - addition to the file path

  • -
  • -

    Replaced use of SHGetMalloc - with CoTaskMemFree

  • -
-

 

-

Scroll Windows:

-
    -
  • -

    Fix: CZoomScrollImpl - some - methods should be overridable

  • -
  • -

    Added support for - WM_MOUSEHWHEEL in CScrollImpl

  • -
-

 

-

App Wizard:

-
    -
  • -

    Fix: AppWizard fails to add - files if C:\Temp does not exist

  • -
  • -

    Fix: App Wizard generates - security warning when loaded

  • -
  • -

    Fix: App Wizard generates - level 4 warning for modal dlg project

  • -
  • -

    Fix: App Wizard setupXX.js - scripts silently fail on Vista

  • -
  • -

    Fix: Added code to - unregister message filer and idle processing

  • -
  • -

    Fix: Added WS_CLIPSIBLINGS - to dialog forms to avoid rebar drawing problems

  • -
-

 

-

App Wizard CE:

-
    -
  • -

    Fix: App Wizard CE should - not have rich edit as a view option

  • -
  • -

    Fix: App Wizard CE generates - level 4 warnings for single instance apps

  • -
  • -

    Added support for Windows - Mobile 6 SDKs

  • -
-

 

-

Cracked Handlers:

-
    -
  • -

    Fix: Corrected MSG_WM_TIMER - and handler prototype, removed unused argument (breaking change)

    -
  • -
  • -

    Fix: atlcrack.h does not - support WTL namespace

  • -
-

 

-

CDialogResize:

-
    -
  • -

    Added SetIcon(NULL, FALSE) - for CDialogResize to remove the generic icon for resizable dialogs

    -
  • -
  • -

    Fix: Enabled size/move for - both X and Y

  • -
  • -

    Added center flags for - controls

  • -
-

 

-

CFrameWindowImpl:

-
    -
  • -

    Fix: Const issue with title - argument of AddSimpleReBarBand

  • -
  • -

    Fix: DECLARE_FRAME_WND_CLASS - definition missing WTL namespace

  • -
-

 

-

Windows CE:

-
    -
  • -

    Fix: Some symbols not - defined for CE 4.0

  • -
  • -

    Fix: Incorrect WinCE - exclusions

  • -
  • -

    Fix: Pocket PC - assert - after navigating a CHyperLink

  • -
  • -

    Fix: Property sheet with - listview on WM5.0 causes stack overflow

  • -
  • -

    Fix: CFindFile::GetFilePath() - fails on diskless root requests

  • -
  • -

    Fix: VS 2005 dialog editor - bug - DS_FIXEDSYS used but not defined

  • -
  • -

    Fix: Windows Mobile 2005 - compatibility issues

  • -
  • -

    Fix: CFullScreenFrame on - Smartphone 20003

  • -
  • -

    Fix: SmartPhone back key - handling in CAppWindow

  • -
  • -

    Added orientation aware - support to CAppStdDialogImpl

  • -
  • -

    Added CAxDialogImpl base for - CStdDialogImpl, CStdDialogResizeImpl and CStdOrientedDialogImpl

    -
  • -
  • -

    Added various CStdDialogxxx - enhancements

  • -
  • -

    Fix: CStdDialogBase does not - scale dialog title on VGA

  • -
  • -

    Fix: DIBINFO16 triggers code - analysis warning

  • -
  • -

    Added LPCTSTR - AtlLoadString(UINT uID) - CE only overload

  • -
  • -

    Added imaging draw support - to CZoomScrollImpl

  • -
  • -

    Added CBottomTabViewImpl and - CBottomTabView classes for PPC

  • -
-

 

-

CFindFile:

-
    -
  • -

    Fix: CFindFile class uses - CRT functions

  • -
  • -

    Fix: FindFile() uses lstrcpy - without checking length

  • -
-

 

-

General:

-
    -
  • -

    Fix: Adding ReBar bands - fails with new Windows SDK

  • -
  • -

    Added support for relative - include paths

  • -
  • -

    Fix: Using std::min and - std::max

  • -
  • -

    Fix: Problems using WTL with - MFC

  • -
  • -

    Improved support for Secure - CRT

  • -
  • -

    Changed implementation of - CSize, CPoint, CRect, and CString to be inside class definitions

    -
  • -
  • -

    atltheme.h: Corrected method - signatures for differences in uxtheme.h versions

  • -
  • -

    Replaced malloc/free with - new/delete where appropriate

  • -
-

 

-

Misc:

-
    -
  • -

    Fix: CString::FormatV can - cause GPF with Unicode strings

  • -
  • -

    CHyperLink: Added handler - for WM_SIZE

  • -
  • -

    Fix: CTheme needs - constructor from HTHEME handle

  • -
  • -

    Added Add* methods to - several control classes in atlctrls.h to augment Insert* methods

    -
  • -
  • -

    Fix: Incorrect casting in - CRichEditCtrl::GetLine()

  • -
  • -

    Fix: - CTreeViewCtrl::GetItemState changed to return only state-bits as specified - by mask

  • -
  • -

    Fix: CBitmapButton::DoPaint - - wrong button image

  • -
  • -

    Added another variant of - CDCT::Drawtext with LPTSTR argument that allows text change

  • -
  • -

    Fix: - CRecentDocumentListBase::AddToList() uses lstrcpy

  • -
  • -

    Fix: AtlLoadString(uID, - lpBuffer, nBufferMax) has unnecessary code

  • -
  • -

    Fix: CCursor::LoadOEMCursor - asserts on IDC_HAND

  • -
  • -

    Fix: Memory leak when using - CRT functions while printing

  • -
  • -

    Fix: Undefined CString - namespace

  • -
  • -

    CPaneContainer: Added border - styles

  • -
  • -

    CSplitterImpl: Added - SetSplitterPosPct, and changed App Wizard code to use it

  • -
-
-

 

-

 

-

-Changes Between WTL 7.5 And 7.1

-

 

-

New and improved:

-
-

VS2005 Compatibility: - Added support for Visual Studio 2005 - both desktop and Windows CE
- Classes for icons, cursors, accelerator tables
- CSortListViewImpl, CSortListViewCtrlImpl, and CSortListViewCtrl classes
- Impl classes for Wizard 97 style wizards: CWizard97Sheet, - CWizard97Page, CWizard97ExteriorPage, CWizard97InteriorPage
- CMemoryDC and CDoubleBufferWindowImpl classes
- Windows CE specific classes in new header, atlwince.h
- CScrollContainer class
- CZoomScrollImpl and CZoomScrollWindowImpl classes
- CZoomPrintPreviewWindowImpl and CZoomPrintPreviewWindow classes
- Global functions: AtlGetBitmapResourceInfo, - AtlGetBitmapResourceBitsPerPixel
- New REFLECT_* macros to enable selective reflection of messages
- App Wizard: Added App Wizard for VS2005
- App Wizard: Added App Wizard for Windows CE for VS2005
- New samples: WTLExplorer, ImageView, SPControls

-
-

Fixes and enhancements:

-
-

Command Bar:

-
    -
  • -

    DrawBitmapDisabled() - doesn't work correctly on Longhorn

  • -
  • -

    Submenu size not correct if - command bar is off-screen

  • -
  • -

    Added handler for - WM_SETTINGCHANGE to improve theme color changes

  • -
  • -

    Better support for - 8/16/24-bit images

  • -
  • -

    Command Bar with 2 Levels of - submenus remains active

  • -
  • -

    Hook procedure fails to call - next hook

  • -
  • -

    OnDestroy() should not - decrement hook use if AttachToWindow() is used

  • -
-

 

-

MDI Command Bar:

-
    -
  • -

    Grows bigger if you - switch between two maximized MDI child window types

  • -
  • -

    Move all hook messages - processing to a separate function and use pT

  • -
  • -

    MDI icon & buttons should - have themed background

  • -
  • -

    Should make MDI buttons gray - when inactive
     

  • -
-

CString:

-
    -
  • -

    Helper functions not - overloaded properly

  • -
  • -

    Some return types are - 'const CString&' and could be just 'CString&'

  • -
  • -

    FormatV() passes size in - characters to _alloca, should be in bytes

  • -
  • -

    Fixed stack corruption in - FormatV()

  • -
  • -

    Improved boundaries checking - for integer overflows/underflows
     

  • -
-

CScrollImpl:

-
    -
  • -

    Scroll bars problem when - changing range

  • -
  • -

    SetScrollOffset() doesn't - move child windows

  • -
  • -

    Range and thumb drawing - problems

  • -
  • -

    Possible overflow in - OnMouseWheel()

  • -
  • -

    Support for - SIF_DISABLENOSCROLL

  • -
  • -

    Added ScrollToView methods

    -
  • -
-

 

-

CMapScrollImpl:

-
    -
  • -

    SetScrollSize() incorrectly - inverts xMin and xMax

  • -
  • -

    SetScrollSize() uses bRedraw - = NULL

  • -
-

 

-

CTheme:

-
    -
  • -

    GetThemeFont() bad parameter - ordering

  • -
  • -

    Uses LOGFONT and TEXTMETRIC - incorrectly (SDK header problem)

  • -
-

 

-

CFrameWindowImpl:

-
    -
  • -

    Improved sizing for Windows - CE

  • -
  • -

    CreateSimpleToolBarCtrl() - should handle 24-bit bitmaps

  • -
  • -

    Changed WinCE - CCECommandBarCtrl typedef and added a PPC CMenuBarCtrl

  • -
  • -

    UpdatesBarPosition() doesn't - take Windows CE command bar into account

  • -
-

 

-

CDialogResize:

-
    -
  • -

    Enabled use for Windows CE

    -
  • -
  • -

    Add WS_EX_DLGMODALFRAME to - prevent empty icon

  • -
-

 

-

CReBarCtrl:

-
    -
  • -

    Background not painted when - resized

  • -
  • -

    Fixed typo in LockBands()

    -
  • -
  • -

    MaximizeBand needs BOOL - fIdeal argument

  • -
-

 

-

CRichEdit:

-
    -
  • -

    GetSelText() should - support UNICODE strings

    -
  • -
  • -

    GetSelText() uses lpstr instead of lpstrText

  • -
-

 

-

CHyperLink:

-
    -
  • -

    Added _xttoi() helper to - avoid CRT in _ATL_MIN_CRT

  • -
  • -

    Fixed resource leak by - destroying tooltip window
     

  • -
-

CPropertySheetImpl:

-
    -
  • -

    Improved support for Windows - CE

  • -
  • -

    Sheet without title - generates a memory fault on Windows CE

  • -
-

 

-

CFolderDialog:

-
    -
  • -

    Add a way to set an initial - folder

  • -
  • -

    Uses BFFM_IUNKNOWN which is - not always defined

  • -
-

 

-

Update UI:

-
    -
  • -

    Add support to - dynamically add UpdateUI elements

  • -
  • -

    UIUpdateMenuBarElement() - should use EnableMenu() instead of SetMenuItemInfo() for Windows CE

    -
  • -
-

 

-

CDC:

-
    -
  • -

    FillSolidRect() should - restore background color

  • -
  • -

    GetClipRgn() method - missing

  • -
-

 

-

Printing:

-
    -
  • -

    - CPrinter::CreatePrinterDC() and CreatePrinterIC() members should be - const

  • -
  • -

    CDevMode::CopyToHDEVMODE() is missing a call to GlobalUnlock()

    -
  • -
-

 

-

AppWizard:

-
    -
  • -

    Use WTL subfolder to - create WTL category for VC7.x and VC8

  • -
  • -

    Rename files from - WTLApp7x to WTLAppWiz, and add VS2005 setup file

  • -
  • -

    Fixed setup - for x64

  • -
-

 

-

General:

-
    -
  • -

    Redefinition of _MAX_FNAME - with Dinkumware Standard C++ Library on Windows CE

  • -
  • -

    Added ATLVERIFY macro - for ATL3

  • -
  • -

    Support warning level 4

    -
  • -
  • -

    Missing methods - CToolBarCtrl::SetButtonInfo, InsertButton, CTabCtrl::SetItem, - CComboBoxEx::InsertItem, SetItem

  • -
  • -

    Missing support for - WM_PRINTCLIENT

  • -
  • -

    Removed usage of IsBad* - functions

  • -
  • -

    Fixed various compiler - warnings

  • -
  • -

    TCHAR bugs in various - files

  • -
  • -

    Improved Windows CE support and changes for Visual Studio 2005

  • -
-

 

-

Misc:

-
    -
  • -

    CMDIChildWindowImpl: - HMENU should be destroyed in OnDestroy()

    -
  • -
  • -

    CStatic: Should use - STM_SETIMAGE instead of STM_SETICON for SetIcon() on Windows CE

    -
  • -
  • -

    CButton: GetButtonStyle() - uses wrong mask

  • -
  • -

    CImageList: Made - Duplicate() method const

  • -
  • -

    CListViewCtrl: Made - SubItemHitTest() method const

  • -
  • -

    CTreeViewCtrl: GetItem() - and SetItem() incorrectly restricted to _WIN32_IE >= 0x0500

    -
  • -
  • -

    CMonthCalendarCtrl: - GetMonthRange() should be GetMaxTodayWidth()

  • -
  • -

    CDateTimePickerCtrl: - SetFormat() should have const argument

  • -
  • -

    CBitmapButtonImpl: Fixed - resource leak by destroying tooltip window

  • -
  • -

    - CMultiPaneStatusBarCtrlImpl: Cannot handle wide panes without resource - strings

  • -
  • -

    CCheckListViewCtrlImpl: - Call CheckSelectedItems() through pT

  • -
  • -

    CPaneContainerImpl: - SetPaneContainerExtendedStyle() should use pT to call CalcSize()

  • -
  • -

    CFindFile: Enabled for - Windows CE

  • -
  • -

    CPropertyPageImpl: Added - handlers for callback messages

  • -
  • -

    atlcrack.h: Added return - value for MSG_WM_APPCOMMAND

  • -
  • -

    CMenu: New method variants: AppendMenu, InsterMenu, ModifyMenu

  • -
  • -

    CFont: Added arguments - for bold and italic to CreatePointFont()

  • -
  • -

    CSize: Added scalar - operators for WTL::CSize and ATL::CSize

  • -
  • -

    CRecentDocumentList: - Allow changing the "DocumentCount" and "Document%i" registry values - strings

  • -
  • -

    CSplitterWindowImpl: - Enabled use for Windows CE

  • -
-
-


-

-Changes Between WTL 7.1 And 7.0

-

 

-

New and improved:

-
-

VC7 Compatibility: Support for - ATL7 Module classes and critical sections and AppWizard setup for VC++ 7.1

-

Windows CE Support: Full - compatibility with Windows CE platforms and AppWizard for eMbedded Visual C++

-

Namespace Support: Automatic - "using ATL" (ATL7 only) or "using WTL" can now be turned off

-

CHyperLink New Features: not - underlined, underlined when hover, command button, link tags

-

CCustomWaitCursor class - supports custom and animated wait cursors

-

AtlCreateBoldFont() for - creating bold version of an existing font

-
-

 

-

Fixes and enhancements:

-
-

CFrameWindowImpl:

-
    -
  • -

    CreateSimpleToolBarCtrl() - - remove dead code, improve error checking, add a global function that uses it

    -
  • -
  • -

    Fix - PrepareChevronMenu() fails to - get toolbar strings for Unicode

    -
  • -
  • -

    CFrameWindowImplBase::Create() - - improve ASSERT not to use m_hWnd if creation fails

    -
  • -
  • -

    Fix - CFrameWndClassInfo::Register - - should use %p formatting only for _WIN32_WINNT >= 0x0500 or for _WIN64

    -
  • -
  • -

    Fix - Chevron menus not positioned - correctly with RTL

    -
  • -
  • -

    Fix - CMDIChildWindowImpl: Problems - creating maximized child windows and handling focus

    -
  • -
  • -

    Fix - CMDIChildWindowImpl: Should - activate on WM_MOUSEACTIVATE

    -
  • -
-

 

-

UpdateUI:

-
    -
  • -

    Fix - Incorrectly clears default - item from the system menu in MDI apps

    -
  • -
  • -

    Added UISetCheck with bool - instead of int for the check state

    -
  • -
-

 

-

DDX:

-
    -
  • -

    Fix - Doesn't provide a way to - change floating point precision

    -
  • -
  • -

    Added DDX_CONTROL_HANDLE for - non-CWindowImpl objects

    -
  • -
  • -

    Added DDX_Check variant with - bool instead of int for the check state

    -
  • -
-

 

-

Command Bar:

-
    -
  • -

    Fix - OnDrawItem() and OnMeasureItem() - don't do a good check for owner-draw menu items

    -
  • -
  • -

    Fix - Disabled 32-bit images not - painted correctly in 3D menu mode

    -
  • -
  • -

    Fix - Popup menus not positioned - correctly with RTL

    -
  • -
  • -

    Fix - Uses GCL_HICONSM instead of - GCLP_HICONSM with GetClassLongPtr()

    -
  • -
-

 

-

MDI Command Bar:

-
    -
  • -

    Fix - Doesn't refresh icon if MDI - children are different

    -
  • -
  • -

    OnAllHookMessages() - improve - code to handle MDI child window class icon

    -
  • -
  • -

    Fix - OnNcLButtonDown() uses - TPM_VERPOSANIMATION without checking Windows version

    -
  • -
  • -

    Fix - Maximized MDI buttons in wrong - place for RTL

    -
  • -
  • -

    Should adjust cxIdeal for - rebar bands for IE4

    -
  • -
  • -

    Add support for different - top-level menu widths by handling ideal size for rebar bands

    -
  • -
-

 

-

AppWizard:

-
    -
  • -

    Fix - Doesn't support MSDI - application as a COM Server

    -
  • -
  • -

    Fix - MDI with Form View - stack - overflow closing maximized MDI child windows

    -
  • -
  • -

    Fix - Generates VERSION resource - name 'test1' regardless of the project name

    -
  • -
  • -

    Fix - Dialog project with control - hosting doesn't derive a dialog from CAxDialogImpl

    -
  • -
  • -

    Fix - COM Server doesn't register - type library

    -
  • -
  • -

    Fix - COM Server doesn't register - AppID properly

    -
  • -
-

 

-

CTreeViewCtrl:

-
    -
  • -

    Fix - GetItemData() needs better - return value

    -
  • -
  • -

    Fix - GetItemState() should use - TVM_GETITEMSTATE instead of TVM_GETITEM for IE5

    -
  • -
  • -

    GetItem() and SetItem() - - added - new variants that use TVITEMEX

    -
  • -
  • -

    Fix - SortChildren() should add - recurse flag argument

    -
  • -
  • -

    Fix - CTreeItem doesn't support - CTreeViewCtrlExT that has different TBase than CWindow

    -
  • -
-

 

-

CThemeImpl:

-
    -
  • -

    Fix - Uses scalar delete instead of - the vector one

    -
  • -
  • -

    Fix - EnableThemeDialogTexture() - argument is BOOL instead of DWORD

    -
  • -
-

 

-

CFolderDialog:

-
    -
  • -

    Fix - EnableOK() passes wrong - arguments to BFFM_ENABLEOK

    -
  • -
  • -

    Fix - Always clears m_hWnd, which - causes problem for nested messages

    -
  • -
-

 

-

CDialogResize:

-
    -
  • -

    Fix - DlgResize_Init() forces dialog - to be visible by using SetRedraw()

    -
  • -
  • -

    Forcing WS_THICKFRAME is not - enough to make dialog resizable

    -
  • -
  • -

    Min track size should be used - for child dialogs as well

    -
  • -
  • -

    Fix - DlgResize_PositionControl() - incorrectly checks return value from MapWindowPoints()

    -
  • -
-

 

-

CAppModule:

-
    -
  • -

    Fix - CAppModule methods not - thread-safe

    -
  • -
  • -

    Fix - AddSettingChangeNotify() - unusable in multithreaded apps because of delayed initialization

    -
  • -
-

 

-

CString:

-
    -
  • -

    Fix - Delete() doesn't allow - deleting more than the length of the string

    -
  • -
  • -

    Fix - Append() can cause buffer - overrun

    -
  • -
  • -

    Fix - MakeReverse() can cause an - infinite loop

    -
  • -
  • -

    Fix - _cstrstr() unnecessarily - inefficient

    -
  • -
  • -

    Fix - FindOneOf() is not DBCS-aware

    -
  • -
  • -

    Fix - Format() does not recognize %E

    -
  • -
  • -

    Fix - TrimLeft() and TrimRight() are - only half-way DBCS-aware

    -
  • -
  • -

    Fix - May cause assertions or - undefined behavior with SBCS

    -
  • -
-

 

-

CRecentDocumentList:

-
    -
  • -

    Fix - SetMaxEntries() has an - incorrect ASSERT

    -
  • -
  • -

    Add CString variant of the - GetFromList() method

    -
  • -
  • -

    Add a way to replace command - IDs used for the MRU list

    -
  • -
  • -

    Add a way to replace registry - key name

    -
  • -
-

 

-

Misc:

-
    -
  • -

    CMessageLoop::Run() - improve - the loop by checking bDoIdle before calling PeekMessage()

    -
  • -
  • -

    CServerAppModule: Clean-up - unused code

    -
  • -
  • -

    Fix - CServerAppModule::MonitorProc() - - no need to call _endthreadex()

    -
  • -
  • -

    Fix - CListBox::GetText() and - CComboBox::GetLBText() (CString variants) don't check for LBERR/CB_ERR

    -
  • -
  • -

    Fix - CAxPropertyPageImpl doesn't - create ActiveX controls with ATL7

    -
  • -
  • -

    Fix - CDC::GetTextExtentExPoint() - missing

    -
  • -
  • -

    CDC::SetWindowExt() should - have default value NULL for the lpSizeRet argument

    -
  • -
  • -

    Fix - CPropertySheetWindow missing - methods for PSM_INSERTPAGE, PSM_SETHEADERTITLE, and PSM_SETHEADERSUBTITLE; - AddPage should return BOOL

    -
  • -
  • -

    Fix - CMapScrollImpl::SetScrollSize() - uses wrong variable

    -
  • -
  • -

    Fix - CHyperLink: WM_UPDATEUISTATE - causes repaint without WM_PAINT

    -
  • -
  • -

    Fix - CUpDownCtrl::GetPos() returns - incorrect value

    -
  • -
  • -

    Fix - CUpDownCtrl::GetPos32() - doesn't have default arg value

    -
  • -
  • -

    Fix - CMultiPaneStatusBarCtrl: - Always uses size grip for positioning panes

    -
  • -
  • -

    Fix - CTabCtrl::InsertItem() should - return int, not BOOL

    -
  • -
  • -

    CReBarCtrl: Added LockBands() - method

    -
  • -
  • -

    Fix - CFont: uninitialized variable - passed to DPtoLP

    -
  • -
  • -

    Fix - CPrintDialogImpl: Crash when - displaying Print Setup dialog

    -
  • -
  • -

    Fix - - CPageSetupDialogImpl::PaintHookProc() - should use T* and return UINT_PTR - instead of UINT

    -
  • -
  • -

    Fix - CPrintJob doesn't support - printing to a file

    -
  • -
  • -

    Fix - CSplitterImpl: Doesn't handle - WM_CAPTURECHANGED - can get in an invalid state

    -
  • -
  • -

    CRichEditCtrl: Add method for - EM_SETTABSTOPS

    -
  • -
  • -

    Fix - CFindFile::GetFilePath() - checks for a trailing slash, but doesn't use that info

    -
  • -
-

 

-

General:

-
    -
  • -

    Fix - Problems compiling with /Zc:forScope - ('for' loop scope conformance)

    -
  • -
  • -

    Use named constants instead of - values for pixel sizes, buffer lengths, etc.

    -
  • -
  • -

    Support building with Managed - C++ (/CLR)

    -
  • -
  • -

    CMenuItemInfo - add run-time - support for different versions of Windows

    -
  • -
  • -

    CommCtrl.h change - additional - fields in IMAGELISTDRAWPARAMS now depend on _WIN32_IE instead of _WIN32_WINNT

    -
  • -
  • -

    Fix - Incorrect usage of CRegKey::QueryStringValue()

    -
  • -
  • -

    Fix - Operator = for GDI and USER - wrappers leaks handle if it's managed variant

    -
  • -
  • -

    Fix - GDI and USER wrappers break - under self-assignments

    -
  • -
  • -

    Fix - Chaining messages with cracked - handlers broken with ATL7

    -
  • -
  • -

    Initialize all variables and - structures prior to use

    -
  • -
  • -

    Use new common control struct - names

    -
  • -
-
-

 

-

 

-

-Changes Between WTL 7.0 And 3.1

-

 

-

New classes and features:

-
-

Support for new Common Controls v6 messages

-

Support for Visual Studio .NET and ATL 7.0

-

WTLApp70 - new AppWizard for Visual Studio - .NET

-

CThemeImpl - implements support for Windows XP - themes

-

CMDICommandBarCtrl - implements Command Bar for - MDI applications

-
-

 

-

Fixes and enhancements:

-
-

Command Bar:

-
    -
  • Bogus assert in OnDestroy
  • -
  • Check marks can be truncated in large font - settings
  • -
  • Use pT to access GetSystemSettings, - DrawMenuText, DrawBitmapDisabled, Draw3DCheckmark, DoPopupMenu, - DoTrackPopupMenu, TakeFocus, GiveFocusBack, so they can be overridden
  • -
  • No hot-tracking if main window is not active
  • -
  • Top level items not painted inactive if app - looses activation while drop down menu is displayed
  • -
  • Added Windows XP flat menus support
  • -
  • Drop-down menu doesn't close if clicked - again (Windows XP only)
  • -
  • Menu item text and accelerator text too - close with some settings
  • -
  • Keyboard can still access clipped menu items
  • -
  • Added support for hiding keyboard navigation - indicators until Alt key is pressed (system setting)
  • -
  • Added AddIcon and ReplaceIcon variants for - icon resources
  • -
  • Image size calculated differently in - different places
  • -
  • Add support for 32-bit (alpha channel) - bitmaps for Windows XP
  • -
  • Fixed width calculation for default menu - items
  • -
-

 

-

CFrameWindowImpl:

-
    -
  • AddSimpleReBarBandCtrl sets toolbar extended - styles without preserving old ones
  • -
  • PrepareChevronMenu should not create menu - items for buttons with TBSTATE_HIDDEN
  • -
  • TPM_VERPOSANIMATION will not be defined in - atlframe.h if atlctrlw.h is included first
  • -
  • CreateSimpleToolBarCtrl - height might be - too small if large font is used
  • -
  • PrepareChevronMenu uses TB_GETBUTTONTEXT, - better use TB_GETBUTTONINFO
  • -
  • Chevron menu doesn't close if clicked again - (Windows XP only)
  • -
  • Should check local classes for superclassing
  • -
  • Add support for 32-bit (alpha channel) - bitmaps for Windows XP
  • -
-

 

-

Update UI:

-
    -
  • UISetText can clear other menu item flags
  • -
  • CUpdateUI::UIUpdateState assigns value with - |= instead of =
  • -
  • Added UISetDefault() and fix default state - to work with menus
  • -
-

 

-

CString:

-
    -
  • GetBuffer() and GetBufferSetLength() should - return NULL in out-of-memory condition
  • -
  • Added missing methods: separate c-tors for - LPCSTR and LPCWSTR, CollateNoCase, TrimRight and TrimLeft variants, Find - variants, moved FormatV to public
  • -
  • Fix _IsValidString usage
  • -
  • FormatV incorrectly calculates buffer size - (too big)
  • -
  • Usage of _ttoi causes problems with _ATL_MIN_CRT - in VC7
  • -
-

 

-

CDC:

-
    -
  • GetTabbedTextExtent() should return DWORD - instead of BOOL
  • -
  • Add FillRect() that accept color index - instead of a brush handle
  • -
  • DrawDragRect() leaks regions and a brush
  • -
  • Improved DitherBlt() - added brushes as - arguments for used colors
  • -
  • Added DrawShadowText() (uses LoadLibrary/GetProcAddress - to run on older Windows)
  • -
-

 

-

CListViewCtrl:

-
    -
  • SetItemState should use LVM_SETITEMSTATE
  • -
  • SetItemCount should return a BOOL
  • -
-

 

-

CRichEditCtrl:

-
    -
  • Added SetCharFormat() variant that accepts - flags (for SCF_ALL)
  • -
  • CharFromPos() should pass a pointer to - POINTL in lParam
  • -
  • GetTextRange() - should add Unicode variant - for rich edit version >= 2
  • -
  • Added another FormatRange() that can accept - a pointer to FORMATRANGE (needed for passing NULL to clear cache)
  • -
-

 

-

CHyperLink:

-
    -
  • Allow overriding of Navigate and - CalcLabelRect
  • -
  • Doesn't handle right or center alignment
  • -
-

 

-

CColorDialog:

-
    -
  • Has static variables that were not - initialized with _ATL_MIN_CRT
  • -
  • Fixed HookProc for ColorOK message - the - message is not sent, but the hook proc is called directly
  • -
-

 

-

atlcrack.h:

-
    -
  • MSG_WM_TIMER crack macro should cast to - TIMERPROC instead of TIMERPROC*
  • -
  • Add cracked handlers for all new messages in - Common Controls 6
  • -
-

 

-

atlapp.h:

-
    -
  • Fixed problems with atlTraceUI with ATL7
  • -
  • #ifdefs for ATL7 were in the wrong place
  • -
-

 

-

atlctrls.h:

-
    -
  • Add support in control classes for all new - messages in Common Controls 6
  • -
-

 

-

CRecentDocumentList:

-
    -
  • AtlCompactPath corrupts memory if filename - is longer than requested compact size
  • -
  • ReadFromRegistry incorrectly checks for - error when reading from registry
  • -
-

 

-

CSplitterWindow:

-
    -
  • Incorrect calculation of middle position
  • -
  • 3D border now drawn only if WS_EX_CLIENTEDGE - is set
  • -
-

 

-

Printing:

-
    -
  • Uses DWORD instead of an int for a job ID
  • -
  • CPrintJob::CancelPrintJob shouldn't have a - return value
  • -
-

 

-

Misc:

-
    -
  • CRegKey::QueryValue and SetValue are - deprecated in ATL7
  • -
  • Added direct support for ATL7
  • -
  • Replace ScreenToClient and ClientToScreen - with MapWindowPoints to support RTL layout
  • -
  • CFindFile::GetFilePath(LPTSTR...) returns - path without the file name
  • -
  • MDI: Updating client edge in - WM_WINDOWPOSCHANGING causes minimize/maximize/restore animation problems, - use WM_WINDOWPOSCHANGED
  • -
  • Custom Draw: Added - CCustomDraw::OnSubItemPrePaint() overrideable method
  • -
  • CFolderDialogImpl uses 'this' for - BROWSEINFO.lParam instead of T*
  • -
  • CImageList::Destroy shouldn't use Detach()
  • -
  • ATL7 has its own AtlLoadString
  • -
  • CPropertySheet doesn't close when you press - X button
  • -
  • Fixed problems for _U_STRINGorID and others - that moved from atlbase.h to atlwin.h in ATL7
  • -
  • Add AtlMessageBox() that accepts either - in-memory or resource strings
  • -
  • CScrollImpl: fixed bug with scrolling child - windows
  • -
  • CPropertyPageImpl: Add new notification - handlers to enable direct return values (use #ifdef _WTL_NEW_PAGE_NOTIFY_HANDLERS - to use them)
  • -
  • Add AtlInitCommonControls() to simplify use
  • -
  • DDX: Fixed usage of the size of char arrays - for DDX
  • -
  • CPageSetupDialog: changed usage of - CWndProcThunk because of changes in ATL7
  • -
  • Fix confusing precedence in expressions
  • -
  • Removed forward declarations because default - values for template arguments shouldn't be specified in two places (we don't - need them anyway)
  • -
  • Win64: Fix /Wp64 warnings from 32-bit VC7 - compiler caused by SDK headers
  • -
  • Fix direct usage of English strings (they - can be #defined to something else now)
  • -
  • AtlGetCommCtrlVersion not defined if _ATL_DLL - is in ATL 3.0 (and CmdBar is using it)
  • -
-

 

-

AppWizard:

-
    -
  • Added manifest for Common Controls 6
  • -
  • Loading Rich Edit DLL should use HMODULE
  • -
  • Should not use atlimpl.cpp for ATL7
  • -
  • Added message handler prototypes to - generated files
  • -
  • VERSION resource always has VALUE "OLESelfRegister" - (now only for COM servers)
  • -
  • Added option for putting implementation in - CPP files
  • -
  • d-tor for the thread manager class in MSDI - project executed after the heap is destroyed
  • -
  • Wrong settings when changing to a dialog - project and back (AppWizard 6.0 only)
  • -
  • Remove cut/copy/paste accelerators for form - view and dialogs projects
  • -
  • Fix toolbar bitmaps so they are not - transparent (problem with Windows XP flat menus only)
  • -
  • Used CMDICommandBarCtrl for MDI apps
  • -
  • Add symbols required for VC7 Class Wizard to - recognize an ATL project
  • -
  • Changed default styles for the rebar, so it - does look OK without CmdBar and with manifest
  • -
  • Added setup programs for both AppWizards
  • -
  • Remove ignored resource attributes: - MOVEABLE, PURE, etc. (AppWizard 7.0 only)
  • -
  • Add call to DefWindowProc to WinMain to - resolve possible problems if MSLU is used
  • -
-

 

-

Samples:

-
    -
  • Updated toolbar bitmaps, added #ifdefs for - ATL7, added manifest file for CommCtrl6, qualified _U_RECT with WTL - namespace, updated use of deprecated CRegKey functions, added VC7 projects
  • -
  • Added Alpha sample
  • -
-
-

 

-

 

-

-Changes Between WTL 3.1 And -3.0

-

 

-

New classes:

-
-

CPaneContainer - implements a window that - provides a title bar and a close button (like Explorer)

-

CDialogResize - an MI class that allows - resizing of dialogs (or any windows with child windows/controls)

-

CAxPropertyPageImpl - implements a property - page that can host ActiveX controls

-
-

 

-

Fixes and enhancements:

-
-

CServerAppModule now clears m_hEventShutdown to - avoid calling CloseHandle twice

-

 

-

CString:

-
    -
  • operator += now leaves original string - intact if it's out of memory
  • -
  • Fixed bad DWORD_PTR usage in TrimRight, - TrimLeft, Replace, Remove
  • -
  • Removed dependencies on CRT for projects - that don't use it
  • -
  • Insert - fixed string corruption in release - builds
  • -
  • Added optional floating point formatting - (for projects that use CRT)
  • -
-

 

-

CEdit and CRichEditCtrl: SetSelAll and - SetSelNone had reversed implementation

-

 

-

atlres.h: Changed IDs so that they are - compatible with MFC's afxres.h

-

 

-

Command Bar:

-
    -
  • Added LoadMappedImages()
  • -
  • Changed handling of left and right arrow - keys so that they don't close context menus
  • -
  • Add code to handle left/right arrow keys - correctly on mirrored (RTL) systems
  • -
  • Removed handler that eats parent window's - WM_SETTINGCHANGE
  • -
  • Fixed bitmap resource leak in - Draw3DCheckmark
  • -
  • Fixed incorrect usage of CharLower in - OnMenuChar
  • -
  • Fixed wrong color for the disabled items in - hi-contrast mode
  • -
  • Added code to gray menu items if main window - is inactive
  • -
  • Fixed keyboard mnemonic handling for IE 4
  • -
  • Fixed hook problems with multiple cmdbars in - the same thread
  • -
  • Added support for radio menu items
  • -
  • Added support for disabled top-level menu - items (also added in CFrameWindowImpl::PrepareChevronMenu)
  • -
  • Added keyboard shortcut (Alt+/) to invoke - chevron menu
  • -
  • Added support to override menu item length - in a derived class
  • -
-

 

-

CBitmapButton:

-
    -
  • Bypassed BUTTON DefWindowProc for hover - style so that the button doesn't take focus
  • -
  • Added BMPBTN_AUTOFIRE extended style
  • -
-

 

-

CDC:

-
    -
  • Added _WTL_FORWARD_DECLARE_CSTRING define to - allow usage of methods that accept CString
  • -
  • Fixed errors in GetTextFace and - GetMenuItemString
  • -
  • Added GetCharWidth32
  • -
  • Added DrawIconEx method
  • -
-

 

-

CMenu:

-
    -
  • Implement following missing methods:
    -    GetMenuDefaultItem
    -    GetMenuInfo
    -    GetMenuItemRect
    -    HiliteMenuItem
    -    IsMenu
    -    MenuItemFromPoint
    -    SetMenuDefaultItem
    -    SetMenuInfo
  • -
  • GetMenuString - fixed to include space for - terminating NULL character in returning string
  • -
-

 

-

GDI and USER classes should destroy the - GDI/USER objects in Attach if GDI/USER resource is managed

-

 

-

CFrameWindowImpl:

-
    -
  • OnToolTipText shouldn't save tool tip text - if it's not for a menu
  • -
  • AddSimpleReBarBandCtrl now adds chevron - style only for toolbars with buttons
  • -
  • AddSimpleReBarBand(Ctrl) - calc band ID if - not specified
  • -
-

 

-

CRecentDocumentList:

-
    -
  • Fix - UpdateMenu deletes wrong menu item - when the list is empty
  • -
  • Added code to allow restricting the number - of characters displayed by MRU menu items
  • -
-

 

-

Update UI:

-
    -
  • Added support for blocking accelerators for - disabled items
  • -
  • Improved search code assuming there are no - duplicate entries (and added checks for duplicates)
  • -
-

 

-

CSplitterWindow:

-
    -
  • CSplitterWindowImpl should derive from - CSplitterImpl<T , t_bVertical> to allow overriding of methods
  • -
  • Added single pane mode and SetSinglePaneMode/GetSinglePaneMode
  • -
  • Added right/bottom aligned resize mode using - extended styles SPLIT_RIGHTALIGNED/SPLIT_BOTTOMALIGNED
  • -
-

 

-

atlcrack.h: Added handlers for following new - messages:
-    WM_APPCOMMAND
-    WM_NCXBUTTONDOWN
-    WM_NCXBUTTONUP
-    WM_NCXBUTTONDBLCLK
-    WM_XBUTTONDOWN
-    WM_XBUTTONUP
-    WM_XBUTTONDBLCLK

-

 

-

Win64:

-
    -
  • Dialog return value should use - DWLP_MSGRESULT and SetWindowLongPtr
  • -
  • CMenu::InsertMenu, AppendMenu, ModifyMenu - should have UINT_PTR for the menu ID
  • -
  • Added appropriate type casts
  • -
  • CFrameWindowImpl::m_szAutoName - changed the - size to fit the pointer value size
  • -
  • CListViewCtrl::SortItems should use LPARAM - for user data instead of DWORD
  • -
-

 

-

Misc:

-
    -
  • Added optional mask argument to all methods - for setting extended styles
  • -
  • CMDIWindow::MDIRestore - fixed to send - WM_MDIRESTORE instead of WM_MDIICONARRANGE
  • -
  • CListViewCtrl: Added SortItemsEx method
  • -
  • CToolBarCtrl::GetButtonInfo - fixed to - return int instead of BOOL
  • -
  • Added CToolBarCtrl::SetButtonSize and - SetBitmapSize that accept cx and cy instead of SIZE
  • -
  • Printing: Changed how GetNewDevModeForPage - works (comments in code)
  • -
  • CFileDialogImpl::_OnTypeChange incorrectly - calls pT->OnSelChange instead of pT->OnTypeChange
  • -
  • CMultiPaneStatusBarCtrl::GetPaneTipText - - fixed to use index instead of and ID internally
  • -
  • CWinDataExchange: Added references to - arguments of DoDataExchange, so there are no level 4 warning even if the map - is empty
  • -
  • CPropertySheetWindow: Added new, IE 5.0 - specific methods
  • -
  • CPropertyPageImpl: Added new, IE 5.0 - specific methods
  • -
-

 

-

AppWizard:

-
    -
  • added calls to RemoveMessageFilter and - RemoveIdleHandler in CMainFrame::OnDestroy for COM server projects
  • -
  • added scroll bars for HTML view
  • -
  • CAppServerModule now handles -embedding as - well as -automation
  • -
  • corrected code in CMainFrame::OnShowToolBar - to correctly identify the toolbar in a rebar
  • -
  • dialog based app code now derives from - CUpdateUI as public
  • -
-
-

 

- -

- end of readme.htm -

- - - - \ No newline at end of file From d2478ba3b53e5363148351fc63b1fb2ba1d8cdda Mon Sep 17 00:00:00 2001 From: aschoen Date: Wed, 24 Jan 2018 13:38:18 +0100 Subject: [PATCH 2/2] Move WINVER and WIN32_WINNT definition to CMakeLists.txt. Helping to compile with new WTL version --- CMakeLists.txt | 13 +++++++++++-- demos/MFCDemo/stdafx.h | 20 -------------------- demos/WTLDemo/stdafx.h | 6 ------ processing/crashrptprobe/stdafx.h | 18 ------------------ reporting/crashrpt/StdAfx.h | 6 ------ reporting/crashsender/stdafx.h | 6 ------ tests/stdafx.h | 6 ------ 7 files changed, 11 insertions(+), 64 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 51cef26..53541cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,9 +45,18 @@ else(CMAKE_CL_64) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/lib) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/lib) endif(CMAKE_CL_64) + +# Previously in source files: +# #define WINVER 0x0500 +# #define _WIN32_WINNT 0x0501 +# #define _WIN32_IE 0x0501 +# #define _RICHEDIT_VER 0x0200 -# Precompiled headers stuff (CMake doesn't have a standard command for enabling precompiled headers, -# so we have to use a macro) +if (WIN32) + add_definitions(-D_WIN32_WINNT=0x600) + add_definitions(-DWINVER=0x600) +endif() + MACRO(ADD_MSVC_PRECOMPILED_HEADER PrecompiledHeader PrecompiledSource SourcesVar) IF(MSVC) GET_FILENAME_COMPONENT(PrecompiledBasename ${PrecompiledHeader} NAME_WE) diff --git a/demos/MFCDemo/stdafx.h b/demos/MFCDemo/stdafx.h index 8bd1a99..4896fdc 100644 --- a/demos/MFCDemo/stdafx.h +++ b/demos/MFCDemo/stdafx.h @@ -22,24 +22,6 @@ be found in the Authors.txt file in the root of the source tree. #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #endif -// Modify the following defines if you have to target a platform prior to the ones specified below. -// Refer to MSDN for the latest info on corresponding values for different platforms. -#ifndef WINVER // Allow use of features specific to Windows XP or later. -#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. -#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. -#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. -#endif - -#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later. -#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. -#endif - #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit // turns off MFC's hiding of some common and often safely ignored warning messages @@ -51,8 +33,6 @@ be found in the Authors.txt file in the root of the source tree. #include // MFC Automation classes - - #ifndef _AFX_NO_OLE_SUPPORT #include // MFC support for Internet Explorer 4 Common Controls #endif diff --git a/demos/WTLDemo/stdafx.h b/demos/WTLDemo/stdafx.h index f800fb1..fae1a52 100644 --- a/demos/WTLDemo/stdafx.h +++ b/demos/WTLDemo/stdafx.h @@ -15,12 +15,6 @@ be found in the Authors.txt file in the root of the source tree. #pragma once -// Change these values to use different versions -#define WINVER 0x0500 -#define _WIN32_WINNT 0x0501 -#define _WIN32_IE 0x0501 -#define _RICHEDIT_VER 0x0200 - #include #if ( _ATL_VER < 0x0800 ) #define _WTL_SUPPORT_SDK_ATL3 // Support of VC++ Express 2005 and ATL 3.0 diff --git a/processing/crashrptprobe/stdafx.h b/processing/crashrptprobe/stdafx.h index 18d04d9..d06dfc1 100644 --- a/processing/crashrptprobe/stdafx.h +++ b/processing/crashrptprobe/stdafx.h @@ -15,24 +15,6 @@ be found in the Authors.txt file in the root of the source tree. #pragma once -// Modify the following defines if you have to target a platform prior to the ones specified below. -// Refer to MSDN for the latest info on corresponding values for different platforms. -#ifndef WINVER // Allow use of features specific to Windows XP or later. -#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. -#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. -#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. -#endif - -#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later. -#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. -#endif - #include #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers // Windows Header Files: diff --git a/reporting/crashrpt/StdAfx.h b/reporting/crashrpt/StdAfx.h index 681def3..0425399 100644 --- a/reporting/crashrpt/StdAfx.h +++ b/reporting/crashrpt/StdAfx.h @@ -15,12 +15,6 @@ be found in the Authors.txt file in the root of the source tree. #pragma once -// Change these values to use different versions -#define WINVER 0x0501 -#define _WIN32_WINNT 0x0501 -#define _WIN32_IE 0x0600 -#define _RICHEDIT_VER 0x0200 - #include #include #if ( _ATL_VER < 0x0710 ) diff --git a/reporting/crashsender/stdafx.h b/reporting/crashsender/stdafx.h index c2e3f6f..a952fea 100644 --- a/reporting/crashsender/stdafx.h +++ b/reporting/crashsender/stdafx.h @@ -15,12 +15,6 @@ be found in the Authors.txt file in the root of the source tree. #pragma once -// Change these values to use different versions -#define WINVER 0x0501 -#define _WIN32_WINNT 0x0501 -#define _WIN32_IE 0x0600 -#define _RICHEDIT_VER 0x0200 - typedef __int64 off_t, _off_t; #define _OFF_T_DEFINED diff --git a/tests/stdafx.h b/tests/stdafx.h index de027d9..bff418e 100644 --- a/tests/stdafx.h +++ b/tests/stdafx.h @@ -15,12 +15,6 @@ be found in the Authors.txt file in the root of the source tree. #pragma once -// Change these values to use different versions -#define WINVER 0x0501 -#define _WIN32_WINNT 0x0501 -#define _WIN32_IE 0x0600 -#define _RICHEDIT_VER 0x0200 - #include #include #include