diff --git a/packages/media/cpp/dist/pm-image.exe b/packages/media/cpp/dist/pm-image.exe deleted file mode 100644 index b1d8cade..00000000 Binary files a/packages/media/cpp/dist/pm-image.exe and /dev/null differ diff --git a/packages/media/cpp/dist/pm-image.pdb b/packages/media/cpp/dist/pm-image.pdb index 83f0f0c4..4ed69068 100644 Binary files a/packages/media/cpp/dist/pm-image.pdb and b/packages/media/cpp/dist/pm-image.pdb differ diff --git a/packages/media/cpp/packages/Win32xx/.gitignore b/packages/media/cpp/packages/Win32xx/.gitignore new file mode 100644 index 00000000..ecb6511a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/.gitignore @@ -0,0 +1,38 @@ +# Build output +/build/ +x64 +debug +# Compiled objects +*.o +*.obj +*.exe +*.out +*.app +# CMake generated +CMakeCache.txt +CMakeFiles/ +cmake_install.cmake +Makefile + +# IDE / Editor +.vscode/ +.idea/ +*.swp +*.swo +*~ +.env* + +# OS +.DS_Store +Thumbs.db + +# Logs +*.log +cache/ +config/postgres.toml +dist + +# Orchestrator reports (cwd/tests/*) +tests/*.json +tests/*.md +src/cmd_grid*.cpp diff --git a/packages/media/cpp/packages/Win32xx/About these folders.txt b/packages/media/cpp/packages/Win32xx/About these folders.txt new file mode 100644 index 00000000..654530d8 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/About these folders.txt @@ -0,0 +1,9 @@ +The contents of the folders within Win32++ +========================================== +help Contains the documentation of Win32++. +include Contains the set of files that make up the Win32++ library. +output A directory which contains the output of some tools. +samples A set of sample projects that demonstrate the various features of Win32++. +tools A set of useful batch files for Win32++. +tutorials The code for the tutorials described in the Win32++ documentation. + diff --git a/packages/media/cpp/packages/Win32xx/README.md b/packages/media/cpp/packages/Win32xx/README.md new file mode 100644 index 00000000..33811fe9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/README.md @@ -0,0 +1,70 @@ + + + + + + + +
+

Win32++: A Simple + Alternative to MFC

+
+

This is a mirror of the Win32++ framework hosted on SourceForge.

+
+

Official Sites

+
+

SourceForge: +Win32++

+

Code Project: + +Win32++ A Simple Alternativc to MFC

+
+

Introduction

+
+

Win32++ is an open-source C++ library designed to simplify + the development of Windows API-based applications. It provides a modern + C++ interface while staying lightweight and easy to use. Here are some key + features:

+ + +

Win32++ can be used to build applications based simple windows, +dialogs, forms, and frames. The frames produced using Win32++ can have the following features.

+ +
+

License

+
+ +The source code of Win32++ is licensed under the +MIT License. + + + + diff --git a/packages/media/cpp/packages/Win32xx/help/Readme.TXT b/packages/media/cpp/packages/Win32xx/help/Readme.TXT new file mode 100644 index 00000000..1bb63072 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/help/Readme.TXT @@ -0,0 +1,20 @@ +Some .CHM files may not render properly on Windows XP, Windows Vista, Windows 7, Windows 8.1, Windows 10 and Windows 11. + +When attempting to open a Compiled HTML Help (.CHM) file, the file may open but display one of the following messages instead of the expected content: + + * Navigation to the web page was cancelled. + * Action cancelled. + +To resolve this issue, carry out the following steps: + + 1. Right-click the .CHM file and choose Properties + 2. On the General tab, click the button labelled "Unblock" + 3. Click OK + +For further information in this issue, refer to the following Microsoft articles. + +For Windows XP +http://support.microsoft.com/kb/902225 + +For Windows Vista and Windows 7 +http://support.microsoft.com/kb/2021383 diff --git a/packages/media/cpp/packages/Win32xx/help/Win32++.chm b/packages/media/cpp/packages/Win32xx/help/Win32++.chm new file mode 100644 index 00000000..3aa6ac13 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/help/Win32++.chm differ diff --git a/packages/media/cpp/packages/Win32xx/include/changes.txt b/packages/media/cpp/packages/Win32xx/include/changes.txt new file mode 100644 index 00000000..33ddef57 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/changes.txt @@ -0,0 +1,1035 @@ +Version 10.2 +============ +This version adds the CFolderDialogEx class, the CPager class, the +ToolbarBuilder sample, and the IFileDialog sample. The ToolbarBuilder is sample +is a useful utility for building a bitmap for use with toolbars. + +New Features and Enhancements +----------------------------- +* Added the CFolderDialogEx class. + The CFolderDialogEx provides a modal dialog that allows users to select a + folder. It is based on the IFileDialog interface. CFolderDialogEx is a modern + replacement for the CFolderDialog class. It supports dark mode applications, + whereas CFolderDialog does not. CFolderDialogEx is not supported on + Windows XP. + +* Added the CPager class. + CPager manages a pager control. A pager control is a window container that + is used with a window that does not have enough display area to show all + of its content. For example, if our application has a toolbar that is not + wide enough to show all of its items, we can assign the toolbar to a pager + control and users will be able to scroll to the left or right to access all + of the items. We can also create pager controls that scroll vertically. + +* Added the IsAppRunning global function. + This function returns TRUE if the Win32++ framework is running. Declare + either a CWinApp object, or an object inherited from CWinApp to start + Win32++. + +* Added the TaskDialogBox global function. + This function creates a TaskDialog that simulates a simple MessageBox. + TaskDialogs support per monitor DPI aware version 2, but a MessageBox + currently does not. TaskDialogs are not supported on Windows XP. + +* Added the ToolbarBuilder sample. + This sample is a handy tool for creating and editing bitmaps for use in + toolbars. It can load, modify and save 4bit, 8bit 16bit, 24bit and 32bit + bitmaps. When an image loaded and then saved, it is saved with the same bits + per pixel as the loaded image. Images with a bits per pixel 24 or less can be + displayed with a transparency mask color. + +* Added the IFileDialog sample. + This sample demonstrates how to use and customise IFileOpenDialog and + IFileSaveDialog. These dialogs can used in place of GetOpenFileName, + GetSaveFileName and SHBrowseForFolder. + +* Updated CMenubar. + The menubar now supports single menu items as well as popup menus. + +* Extended CBitmapInfoPtr. + A CBitmapInfoPtr object can now be constructed from a BITMAP struct. + +* Updated the support for Embarcadero's C++ Builder. + Support for modern Windows 64-bit compiler has been added to the C++ Builder + project files. These project files now support the Win32, Win64 and Win64x + platforms. + +* Updated many of the samples. + +Changes in detail +----------------- +Added the CFolderDialogEx - class +Added the CPager - class +Added IsAppRunning - global function +Added TaskDialogBox - global function +Added CBitmapInfoPtr::CBitmapInfoPtr(const BITMAP& bitmap) additional overload +Added CEdit::GetRect - additional overload +Added CListBox::GetItemRect - additional overload +Added CListView::GetItemRect - additional overload +Added CRichEdit::GetRect - additional overload +Added CTab::GetItemRect - additional overload +Added CTreeView::GetItemRect - additional overload +Added CGDIObject::Destroy - member function +Added CImageList::Destroy - member function +Added CMenu::Destroy - member function +Removed CGDIObject::DeleteObject +Removed CImageList::DeleteImageList +Removed CMenu::DestroyMenu + + +Version 10.1 +============ +This version updates the library and samples to make better use of the new +features in C++14. Some deprecated classes and functions have been removed. +Dialogs with RichEdit controls might need to be updated to be compatible +with this version. + + +Incompatibilities with previous versions +---------------------------------------- +* Support for RichEdit controls in dialogs have changed. Dialogs which have a + RichEdit control now need to specify "RichEdit50W" as the control's class + name in the dialog's resource script (resource.rc) if they depend on the + RichEdit dll loaded by CRichEdit. + + The relevant entry for the richedit control might look something like this: + CONTROL "",IDC_RICHEDIT1,"RichEdit50W" ,ES_MULTILINE | ES_WANTRETURN | + ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP, 120, 142, 84, 35 + + The dialog won't be created if an incorrect class name is specified for + the richedit control. The "RichEdit50W" class name supports both ANSI + and UNICODE builds. + + +New Features and Enhancements +----------------------------- +* Updated CRichEdit. + The CRichEdit class has been updated and now only loads the latest version + of the rich edit control (Msftedit.dll). The class name of the RichEdit + control loaded by CRichEdit is "RichEdit50W". + +* Updated the DLL sample. + The DLL sample now demonstrates how to create modeless dialogs in + separate threads. The thread stops running when the dialog is closed. + +* The Win32xx::Shared_Ptr class has been removed. + The deprecated Win32xx::Shared_Ptr class has been removed from Win32++. + Use either std::unique_ptr or std::shared_ptr instead of + Win32xx::Shared_Ptr. + +* Updated CString and CStringT. + Added move constructors and move assignments to CString and CStringT. + +* Updated CPrintDialog. + CPrintDialog now displays the classic print dialog by default. To display + the modern print dialog available on Windows 10 and 11, remove the + PD_ENABLEPRINTHOOK flag. This can be done as follows: + CPrintDialog PrintDialog(0); + + +Changes in detail +----------------- + - Added CString::CString(CString&& str) CString move constructor + - Added CString::operator=(CString&& str) CString move assignment + - Added CStringT::CStringT(CStringT&& str) CStringT move constructor + - Added CStringT::operator=(CStringT&& str) CStringT move assignment + +Removed the following deprecated classes and functions: + - Shared_Ptr class - use unique_ptr or shared_ptr instead. + - CFrameT::IsRebarSupported function - not required, always TRUE. + - CSocket::StartAsync function - use CSocket::StartEvents instead. + - CToolBar::AddBitmap function - use CToolBar::SetImageList instead. + - CToolBar::AddReplaceBitmap function - use CToolBar::SetImageList instead. + - CToolBar::ReplaceBitmap function - use CToolBar::SetImageList instead. + - ::GetSizeofMenuItemInfo function - use sizeof(MENUITEMINFO) instead. + - ::GetComCtlVersion function - not required for Windows XP or later. + + +Version 10.0 +============ +This version updates the library to utilize features available in C++11 and +C++14. Win32++ now uses the unique_ptr smart pointer. This smart pointer is +used in place of Shared_Ptr when adding new instances of CTab, CMDIChild, +CPropertySheet and CDocker. + +There is now no requirement to use any raw pointers when allocating memory in +code that uses the Win32++ library. Users of Win32++ are now free to avoid +the use of both new and delete, and instead wrap all memory allocations in +smart pointers. This helps to avoid memory leaks and improve exception safety +in code that uses Win32++. + +The C++ compilers that Win32++ supports have changed. Older compilers that +don't support C++14 are no longer supported. + +Win32++ version 10.0 only supports the Windows XP and later operating systems. +Win32++ version 9.6.1 is the latest version to support the operating systems +older than Windows XP. Win32++ version 9.6.1 supports Win95 through to +Windows 11. + + +Incompatibilities with previous versions +---------------------------------------- +The following functions now return a unique_ptr instead of a raw pointer: +* CDocker::NewDockFromID +* CTabbedMDI::NewMDIChildFromID + +Code that overrides of these function need to return a unique_ptr as well. +For example: + + DockPtr CMainFrame::NewDockerFromID(int /*id*/) + { + DockPtr docker; + switch(id) + { + case ID_CLASSES: + docker = std::make_unique(); + break; + case ID_FILES: + docker = std::make_unique(); + break; + default: + TRACE("Unknown Dock ID\n"); + break; + } + return docker; + } + + +New Features and Enhancements +----------------------------- +Users can now add new instances of the following classes as smart pointers instead +of raw pointers for CDocker, CMDIChild, CPropertySheet and CTab. + +Other changes include: + * Updated CDocker. Each new CDocker object is stored as a unique_ptr. + * Updated CMDIFrame. Each new CMDIChild is stored as a unique_ptr. + * Updated CMDITab. Each new CMDITab object stored as a unique_ptr. + * Updated CPropertySheet. Each new CPropertyPage object is stored as a unique_ptr. + * Updated CTab. Each new CTab object is stored as a unique_ptr. + * Updated CDC. CDC now uses a shared_ptr for its reference counting. + * Updated CGDIObject. CGDIObject now uses a shared_ptr for its reference counting. + * Updated CMenu. CMenu now uses a shared_ptr for its reference counting. + * Updated CImageList. CImageList now uses a shared_ptr for its reference counting. + +* The values for WINVER and related macros are now set to values suitable for + Windows 10 and Windows 11 by Win32++. Specifying different values for these macros + before including wxx_wincore.h is no longer supported. Win32++ version 10 supports + all operating systems Windows XP and later irrespective of the values of these + version macros. + + +Changes in detail +----------------- +Added CFrameT::SetMenuFont +Added CFrameT::SetStatusBarFont + +Added CDocker::AddDockedChild - additional override for std::unique_ptr +Added CDocker::AddUndockedChild - additional override for std::unique_ptr +Added CMDIFrameT::AddMDIChild - additional override for std::unique_ptr +Added CPropertySheet::AddPage - additional override for std::unique_ptr +Added CTab::AddTabPage - additional override for std::unique_ptr +Added CTabbedMDI::AddMDIChild - additional override for std::unique_ptr + +Modified CDocker::NewDockFromID - returns a std::unique_ptr +Modified CTabbedMDI::NewMDIChildFromID - returns a std::unique_ptr + +The type definitions for the smart pointers is in Win32++ have been updated +as follows: + using DockPtr = std::unique_ptr; + using EnhMetaDataPtr = std::shared_ptr; + using MDIChildPtr = std::unique_ptr; + using MenuItemDataPtr = std::unique_ptr; + using MetaDataPtr = std::shared_ptr; + using PropertyPagePtr = std::unique_ptr; + using TLSDataPtr = std::unique_ptr; + using WinThreadPtr = std::unique_ptr; + using WorkThreadPtr = std::unique_ptr; + using WndPtr = std::unique_ptr; + + +Deprecated features +------------------- +The following parts of Win32++ are deprecated and might be removed in future +versions of Win32++. Code that uses deprecated features should be updated. + + * Shared_Ptr class - use unique_ptr or shared_ptr instead. + * CFrameT::IsRebarSupported function - not required, always TRUE. + * CSocket::StartAsync function - use CSocket::StartEvents instead. + * CToolBar::AddBitmap function - use CToolBar::SetImageList instead. + * CToolBar::AddReplaceBitmap function - use CToolBar::SetImageList instead. + * ::GetSizeofMenuItemInfo function - use sizeof(MENUITEMINFO) instead. + * ::GetComCtlVersion function - not required for Windows XP and later. + * MIN and MAX macros function - use std::min and std::max instead. + +Supported Compilers +------------------- +The following compilers are supported by this version of Win32++: + * The modern GNU C++ compilers from the following projects: + - MinGW + - TDM-GCC (ships with Code::Blocks and Embarcadero Dev-C++) + - MinGW-w64 (the most modern GNU C++ compilers available) + * Visual Studio Community 2015 + * Visual Studio Community 2017 + * Visual Studio Community 2019 + * Visual Studio Community 2022 + * Embarcadero C++ Community Edition (Rad Studio 11) + +Code for Windows XP can be compiled with Visual Studio Community 2015 and the GNU compilers. + + +Version 9.6.1 +============= +This version contains minor updates to CDocker and the docking samples. + + +Version 9.6 +=========== +This version adds support for std::min and std::max. The MIN and MAX macros +are now deprecated. Users should use std::min and std::max in place of the +MIN and MAX macros. + +Support has been added for the C++ compiler from Embarcadero. + +This version also adds the ScintillaDemo sample. Scintilla is a free source code +and text editing component. On Windows, Scintilla is a Windows control that can be +as a direct replacement for a RichEdit control. Scintilla has a number of features +missing from RichEdit controls and has better support for printing. + +Scintilla can be downloaded from: +https://www.scintilla.org/ScintillaDownload.html + +New Features and Enhancements +----------------------------- + * Added support for the C++ compilers from Embarcadero. + The samples include the project files for C++Builder 11 Community Edition + from Embarcadero. + + * Added support for std::min and std::max. + + * The MIN and MAX macros are are now deprecated and will be removed in future + versions. Users should use std::min and std::max in place of the MIN and + MAX macros. + + * Added the ScintillaDemo sample. + This sample demonstrates how to use the Scintilla control with Win32++ + to develop a simple text editor. + +* The samples now use larger icons. + Larger icons are suitable for applications that are placed on the desktop + on higher resolution monitors. + + +Version 9.5.2 +============= +This version updates CString, CTime and the dock samples. + +New Features and Enhancements +----------------------------- + * Updated CString. + The CString constructor, operator+, operator+=, and operator<< overloads + now support CStringA and CStringW arguments in addition to the arguments + supported previously. + * Updated ToCString. + ToCString now supports CStringA and CStringW arguments in addition to the + arguments supported previously. + * Updated CTime. + Some CTime constructors have been updated, and others removed. + * Updated the docker samples to eliminate jitter when the dockers are resized. + + +Version 9.5.1 +============= +This version has minor improvements to CDocker, CDockContainer and +CResizer, and adds support for MinGW-w64 version 13.2.0. + +New Features and Enhancements +----------------------------- +* Updated CDocker and CDockContainer. + The dock hinting displayed when a docker is over a dock target has been + updated. +* Updated CResizer. + The scroll positions are retained when the window's DPI changes. +* Updated the Docker, DockContainer and DockTabbedMDI samples. + The DockContainer sample demonstrates how to prevent the frame's last + container from being undocked or closed. +* Adds support for MinGW-w64 version 13.2.0. + + +Version 9.5 +=========== +This version adds a CustomPrintDlg sample. This sample provides an +alternative to the PrintDlg and PrintDlgEx common dialogs which have had +their functionality downgraded in Windows 11. + +New Features and Enhancements +----------------------------- +* Added the CustomPrintDlg sample to provide an alternative to PrintDlg + and PrintDlgEx. +* Added a new feature to the Themes sample. This sample now demonstrates + how to specify the window's caption color on Windows 11. +* CComboBoxEx, CHeader, CListView, CToolbar, and CTreeView now manage their + own image lists. There is no longer any need to keep a local copy of the + image list assigned to these controls to keep the image list in scope. +* Updated CImageList. +* Updated CTab and the TabDemo sample. +* Optimized the redrawing of frames and dockers when moving windows between + monitors with different display settings. +* Simplified support for additional toolbars in frames. + + +Version 9.4 +=========== +This version adds support for the Microsoft Edge browser. +The EdgeBrower and EdgeBrowserEx samples have been added. These samples +demonstrate how to use the Microsoft Edge WebView2 control in a Win32++ +application. + +New Features and Enhancements +----------------------------- +* Added the EdgeBrowser sample. This sample uses the Microsoft Edge + WebView2 control to render the Microsoft Edge browser in a window. It + demonstrates a simple way to render a Microsoft Edge browser in a view + window. + +* Added the EdgeBrowserEx sample. This sample uses the Microsoft Edge WebView2 + control to display tabs and render the Microsoft Edge browser within those + tabs. This sample also demonstrates features such as managing favourites + and browser history. + +* Updated CDC. CDC::SelectObject now keeps the selected object in scope. There + is no longer any need to select the old object back into the device context + when SelectObject is used. + + +Version 9.3 +=========== +This version improves the support for high resolution monitors by automatically +adjusting the size of the frame's toolbar bitmaps and menu icons appropriately. +A number of functions have been added to make supporting high resolution +monitors easier (see below). + +This version also provides support for per-monitor(v2) DPI awareness. +Per-monitor DPI awareness allows applications to maintain their visual quality +when they are moved between monitors with different Dots Per Inch (DPI) +settings. + +The new FrameEx sample demonstrates the use of PNG resources instead of bitmap +resources for the toolbar and menu images. + +New Features and Enhancements +----------------------------- +* The toolbar bitmaps are automatically scaled up to a size appropriate for + the frame window's DPI. Bitmaps that are appropriate for lower resolution + monitors are be scaled up for use on higher resolution monitors without + a noticeable loss of visual quality. + +* The menu icon bitmaps are automatically scaled up to fit the menu item. + Note that menu icon bitmaps are not scaled down to fit the menu item, as + that would result in poor image quality. If the menu item images specified + in the frame's SetupMenuItemIcons are too big to fit in the menu item, + the menu icons are not displayed. + +* Frames support per monitor DPI awareness by resizing themselves to the + size recommended by the WM_DPICHANGED message in the OnDpiChanged function. + They also automatically adjust the toolbar images, menu icons, and statusbar + fonts when the frame window is moved between monitors with different DPI + settings. + +* Dockers and docking frames call OnDpiChanged and OnDpiChangedBeforeParent + in response to WM_DPICHANGED and WM_DPICHANGED_BEFOREARENT to rearrange + dockers after a DPI change occurs. View windows should handle the + WM_DPICHANGEDBEFOREPARENT message if they need to account for DPI + changes. + +* CResizer supports per monitor DPI awareness by repositioning the child + windows when the WM_DPICHANGED or WM_DPICHANGED_BEFOREPARENT message is + handled. + +* Added the FrameEx sample. + The FrameEx sample uses PNG images instead of bitmaps for the toolbar + and menu item images. As PNG images scale better than bitmaps, this approach + is better for applications supporting Per Monitor DPI and high resolution + monitors. + +About high resolution monitor support +------------------------------------- +Modern monitors can now use scaling factors of 400% or more. Applications that +look good with scaling factors of 100% or 150% may not look good at higher +scaling factors. It will often be necessary to adjust the image-list for +list-view and tree-view controls and adjust the fonts used by other windows +to cater for larger scaling factors. + +Win32++ provides the following functions for high resolution monitor support. +::GetWindowDpi +CWnd::DpiScaleFont +CWnd::DpiScaleInt +CWnd::DpiScaleLogFont +CWnd::DpiScaleRect +CWnd::DpiScaleUpBitmap + +The GetWindowDpi function retrieves the window's current DPI. We can also +call GetWindowDpi(HWND_DESKTOP) to retrieve the system DPI, and the desktop's +DPI when per monitor dpi awareness is enabled. + +The various DpiScaleXXX functions take values that are appropriate for a +a scaling factor of 100% and scale them up to the appropriate values for +the current window's Dots Per Inch (DPI). + +About per monitor dpi aware v2 +------------------------------ +Per monitor dpi aware v2 is a feature that allows applications to maintain +their visual quality when moved between monitors with different DPI settings. +Applications may appear blurry when moved between monitors with different DPI +settings unless per monitor dpi aware v2 is enabled. Per monitor dpi aware v2 +is supported on later versions of Windows 10 and Windows 11. + +To add per-monitor dpi aware v2 to your application, use a manifest that +includes the per monitor dpi aware v2 entry, such as "PerMonitorV2.manifest" +provided in many of the samples. The manifest should be specified in the +application's resource script, often called "resource.rc". You may also need +to handle the WM_DPICHANGED_BEFOREPARENT message in view windows if they +require special DPI handling. + +If per monitor dpi aware v2 is enabled, a WM_DPICHANGED message is sent to the +top level windows after the DPI change occurs. That usually occurs when the +window is moved between monitors, but can also occur as a result of a settings +change. A WM_DPICHANGED_BEFOREPARENT to all of the top level window's child and +descendant windows before the WM_DPICHANGED message is sent. A +WM_DPICHANGED_AFTERPARENT message is is sent to all of the top level window's +child and descendant windows After the WM_DPICHANGED is sent. + +The following messages are sent when the application's manifest specifies per +monitor dpi aware V2: + +WM_GETDPISCALEDSIZE +Sent to the top level window before the DPI change occurs. The WPARAM +contains the new DPI. + +WM_DPICHANGED +Sent to top level windows after a DPI change occurs. The LPARAM contains a +pointer to rect that provides the suggested new size of the window. + +WM_DPICHANGED_BEFOREPARENT +Sent before the DPI change to all child windows and descendants of the top +level window that is undergoing a DPI change. + +WM_DPICHANGED_AFTERPARENT +Sent after the DPI change to all child windows and descendants of the top +level window that is undergoing a DPI change. + +WM_SETTINGCHANGE +Sent when the user manually changes the display settings. + + +Version 9.2 +=========== +This version provides support for dark mode and provides a sample +that demonstrates how to implement dark mode for a frame application. + +New Features and Enhancements +----------------------------- +* Added support for colored text in the status bar. + CFrame now uses owner draw to render the status bar, allowing different + colored text to be displayed. The StatusBarTheme struct has been extended + to allow the status bar text color to be specified. The Themes sample + demonstrates the use of different colored text in the status bar. + +* Added support for dark mode. + CFrame now provides support for dark mode by providing the option to use a + dark menu. This can be used to develop an application with an appropriate + visual style for dark mode when combined with a black Win32++ theme. Refer + to the black theme in the Themes sample, and also the DarkMode sample. + +* Added the DarkModeFrame sample. + This samples demonstrates how to make a Win32++ application dark mode aware. + It uses the Windows App API which is an optional feature that can be + installed with Visual Studio Community 2022. This sample detects when the + Windows theme is using dark mode, and adjusts the frame's theme accordingly. + The sample also uses a dialog that supports dark mode to display the + information about the application. + This samples requires Windows 10 or later. + + +Version 9.1 +=========== +This version improves support for high resolution monitors by accepting a +range of icon sizes used for menus, tab controls and dock containers. + +New Features and Enhancements +----------------------------- +* Updated the images for menus used by CFrame and CDockFrame. + - Win32++ now supports a range of image sizes displayed in the popup menu for + CFrame and CDockFrame. The GetMenuIconHeight function returns the + appropriate height of these images in pixels (16, 24, 32 etc.). The + framework will automatically scale the toolbar images down to a size + suitable for the popup menu for the toolbar bitmap with a resource ID of + IDW_MAIN. Alternatively you can provide icons with multiple image sizes as + demonstrated in the samples. + +* Updated the ListView sample. + - An edit control has been added to provide support the in-place editing of + the List-View's and subitems. A List-View control doesn't have built-in + support for the editing of subitems. + - Support for sorting by column has been added. To sort a column in ascending + or descending order, click on the column in the list-view's header. + + +Version 9.0 +=========== +This version provides a major update to the framework. Changes include updates to CString and thread support. +The following samples have been added: + * DialogTemplate sample + * PrintDialogEx sample + * Titlebar sample + * TitlebarFrame sample + +New Features and Enhancements +----------------------------- +* Updated thread support. Thread classes now use the CThreadT class template. + Threads that support windows continue to use CWinThread. Worker threads now + use CWorkThread. + CWinThread inherits from CThreadT. + CWorkThread inherits from CThreadT. + +* The values for WINVER and related macros now default to values suitable for + Windows 10 and Windows 11. Different values can be specified before including + wincore.h if required. These values can be specified in stdafx.h by including + targetver.h as shown in the samples. Visual Studio 6 will require WINVER to + be set to values appropriate for Win95 or Win98. + +* Updated CDialog + Added a default constructor. Use either the SetDialogTemplate, + SetDialogResource or SetDialogFromID functions to specify the dialog if the + default constructor is used. + +* Updated the MenuTheme struct. + A clrText member has been added to the MenuTheme struct to define the color of + menubar text. This is now used to set the menubar text color to white for the + BLACK theme in the themes sample. + +* Added the DialogTemplate sample. + This sample demonstrates how to search for the resources embedded in a + windows executable or dll file. The user can select a dialog from the list + of dialogs found in the file. The dialog template of the selected dialog is + displayed in a rich edit view as an unsigned char array in a manner that can + be saved to a header file. The program then creates the dialog from the + displayed dialog template and displays it. + +* Added the PrintDialogEx sample. + This sample upgrades the Notepad sample. Where the Notepad sample used + CPrintDialog to display the print dialog, this sample uses CPrintDialogEx + to display the print dialog. This sample supports printing individual + pages, as well as multiple page ranges. It also supports printing multiple + copies, with or without collating. A footer displaying the page number is + added to the bottom of the printed page. + +* Added the Titlebar sample. + This sample demonstrates how to customize the title bar of a window. It sets + the title bar's color and draws the minimize, maximize and close buttons. + The sample uses CMenuBar to display a menu in the title bar. + +* Added the TitlebarFrame sample. + This sample demonstrates how to use a customized title bar with a frame. + It demonstrates the frame in two modes: mini-frame and full-frame. + + +Version 8.9.1 +============= +This version provides a minor update to the framework, and adds CPrintDialogEx. + + +Version 8.9 +=========== +This version adds support for the Clang compiler, and improves the handling +of error messages. + + +Version 8.8 +=========== +This version adds the BrowserATL, MovieShow and WinPlot samples. It also adds +support for Code::Blocks version 20.03. + + +Version 8.7 +=========== +This version adds print preview support to the framework, and support for +Microsoft Visual Studio Community 2019. + +The following classes have been added: +* CPrintPage +* CHGlobal +* CGlobalLock + + +Version 8.6 +=========== +This version updates networking and adds the following classes: + * CEvent + * CMutex + * CCSemaphore + + +Version 8.5 +=========== +This version updates the frames and adds the following classes: + * CFileFind + * CFolderDialog + * CMetaFile + * CThreadLock + +The following samples have also been added: + * Direct2D + * FilePrintPreview + * StatusBarEx + + +Version 8.4 +=========== +This version of Win32++ introduces class templates to provide the different +types of frames. Frames can support a Single Document Interface (SDI) or a +Multiple Document Interface (MDI) with or without docking and with or without +a ribbon. Each of these optional features are provided using class templates. + +The following classes have been added to the framework: + * CFrameT + * CMDIFrameT + * CRibbonFrameT + * CScrollView + * CMetaFile + * CEnhMetaFile + * CMetaFileDC + * CEnhMetaFileDC + + +Version 8.3 +=========== +This version adds a Print Preview sample and updates to the following classes: + * CString + * CFrame + * CMDIFrame + * CDocker + * CDC + * CPropertyPage + + +Version 8.2 +=========== +This version adds support for common dialogs. The following classes have been added: + * CColorDialog + * CFindReplacDialog + * CFileDialog + * CFontDialog + * CPrintDialog + * CPageSetupDialog + + +Version 8.1 +=========== +This version adds Dialog Data Exchange (DDX), extends CString, and adds a set +of new exceptions inherited from CException. + + +Version 8.0.1 +============== +This version adds support for system DPI (Dots Per Inch) aware. + + +Version 8.0 +=========== +This version adds CArchive, CObject, CRegKey, CTime and CTimeSpan to the library. +The header files for Win32++ have been renamed, and are now proceeded with "wxx_". + + +Version 7.9 +=========== +This version of Win32++ moves away from the use of pointers. Where before we +would use pointers to objects in Win32++ function calls, we now use the objects +directly. + +The following classes are now referenced counted and release the resource +they manage when the last copy goes out of scope: + * CBitmap + * CBrush + * CDC + * CFont + * CPalette + * CPen + * CRgn + * CMenu + * CImageList + + +Version 7.8 +=========== +This version provides an update to the CDC class. + + +Version 7.7 +=========== +This version adds docking support to frames and MDI frames. +Frames now load the show state (maximized or normal) when the application +starts. + + +Version 7.6 +=========== +This version provides an update to Dockers and Frames. +Other changes include: + * Added StatusBar themes. + * Switching between views is now supported, using SetView + * Added support for vertical ToolBars and ReBars + + +Version 7.5 +=========== +This version adds the CRichEdit class. +The following classes have also been updated: + * CWinApp + * CFrame + * CDocker + * CTab + * CDialog + + +Version 7.4 +=========== +This version adds the CImageList class and the ToolBarDemo sample. +The following classes have also been updated: + * CDialog + * CFrame + * CFile + * CSocket + * CTab + * CToolBar + * CWnd + + +Version 7.3 +=========== +This version enhances the appearance of frame menus on Vista and Windows 7 +The following classes have also been added: + * CDateTime + * CHeader + * CHotKey + * CIPAddress + * CMonthCalendar + * CTooltip + + +Version 7.2 +=========== +This version adds support for idle processing, and adds the following classes: + * CString + * CMenu + * CFile + + +Version 7.1 +=========== +This version adds support for text conversions between ANSI and Unicode. +The following classes have also been added: + * CTaskDialog + * CBitmap + * CBrush + * CFont + * CPalette + * CPen + * CRgn + + +Version 7.0 +=========== +This version adds multi-thread support to the framework, and adds IPv6 support +to CSocket. The following classes gave also been added: + * CAnimation + * CComboBox + * CComboBoxEx + * CProgressBar + * CScrollBar + * CSlider + * CSpinButton + * CThread + * Shared_Ptr + + +Version 6.9 +=========== +This version adds a WebBrowser class called CWebBrowser. This class provides +a web browser in a window. This class can be used as a view window anywhere +view windows are used, such as in frames, dockers, MDI Children, Tabbed MDIs +etc. It is demonstrated by the Browser and DockTabbedMDI samples. + + +Version 6.8 +=========== +This version adds support for the Windows Ribbon Framework. +The following classes have been added: +* CButton +* CEdit +* CListBox +* CStatic +* CRibbon +* CRibbonFrame + + +Version 6.7 +=========== +This version adds support for Right to Left languages which include Hebrew and +Arabic. Support for precompiled headers has been added to the samples. + + +Version 6.6 +=========== +This version adds improvements to docking containers and TabbedMDIs and +extends the CDC class. + + +Version 6.5 +=========== +Version 6.5 adds a tab control and TabbedMDIs to the Win32++ framework. +The following classes have been added: + * CTab + * CTabbedMDI + + +Version 6.4 +=========== +Version 6.4 adds docking containers to the Win32++ framework. Containers behave +as a view window for dockers. They include a tab control to display various pages, +and can also optionally contain a toolbar. + + +Version 6.3 +=========== +This version adds support for docking windows. + + +Version 6.2 +=========== +This version adds a Most Recently Used (MRU) list to frames. +Frame applications now store the window size and position in the registry. + + +Version 6.1 +=========== +Win32++ is now implemented as a header only library, and now supports +building 64bit applications. + +The following classes have also been added: + * CListView. + * CTreeView. + * CPoint + * CRect + * CSize. + + +Version 6.0 +=========== +This version adds network support to the library. The following classes +have been added: + * CDC + * CSocket + +Version 5.6 +=========== +* Property sheets are now supported. Property sheets can be modal, modeless + or Wizards. + +Version 5.5 +=========== +* Added Menubar theme support + - Gradient background for hot buttons (any two colors) + - Gradient background for pressed buttons (any two colors) + - Gradient Sidebar for menu items based on pressed button colors. + - A border color for Menubar buttons and selected menu items + + +Version 5.4 +=========== +* Added Rebar themes, including: + - Gradient background for the rebar control (any two colors) + - Gradient background for the rebar bands (any two colors) + - The Menubar can be locked in place. + - The bands can be kept left. + - Short bands + - Bands can have rounded borders + - Bands with rounded borders can have a flat style +* Added Toolbar themes, including: + - Gradient background for hot buttons (any two colors) + - Gradient background for pressed buttons (any two colors) + - Colored outline for hot and pressed buttons (any color) +* CFrame provides built in support for multiple toolbars with AddToolbarBand + + +Version 5.3 +=========== +* Owner drawn drop down menu items with icons. By default, the + framework uses the ToolBar's bitmap and resource IDs for displaying + icons. Override CFrame::SetupToolBar to change this behaviour. +* CreateEx automatically subclasses windows controls such as List-View, + ToolBar, Richedit etc. + + +Version 5.2 +=========== +* Added a separate HINSTANCE for resources. This provides for multilingual + support, when resources are loaded via a DLL. + + +Version 5.1 +=========== +* Attach can be used to subclass existing windows and associate them with a CWnd. +* Dialog controls can be sublcassed and converted to CWnd objects, using + AttachDlgItem. +* Improved CToolbar. The ToolBar uses image lists which support using separate + bitmaps for normal, hot and disabled buttons. Text can be added to ToolBar + buttons, and the style can be set. +* Notifications from common controls are reflected back to the CWnd object that + generated them. +* Messages from old style common controls are reflected back to the CWnd object + that generated them. + + +Version 5.0 +=========== +* Added MDI frame support. +* Added the following samples: +* Explorer sample +* Notepad sample +* DirectX sample + + +Version 4.0 +=========== +* Changed the method of associating the Window's handle (HWND) and + the CWnd pointer. Previously SetWindowLong was used to store the + CWin pointer in the windows data area. Now std::map is used to + associate a CWnd pointer with the HWND (i.e. the window's handle). +* Added rebars to the frame window +* Added a menubar to the frame window + + +Version 3.0 +=========== +* Added Tracing. To use tracing, ensure that you are in Debug mode, + i.e. the variable _DEBUG is defined, and use the TRACE("xxxxx") + function to send trace messages. +* Enhanced the error reporting in the event of an exception. The + GetLastError information is now decoded and displayed if it + provides any additional information. +* Added support for multi-threaded applications. + + +Version 2.0 +=========== +* The code is now Unicode compliant. +* Added CWinApp class to start Win32++. +* Added CDialog class to support modal and modeless dialogs as well + as indirect dialogs (dialogs created from a dialog template in + memory). +* Added the Create function to simplify window creation. + + +Version 1.0 +=========== +Initial Release \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/include/copyright.txt b/packages/media/cpp/packages/Win32xx/include/copyright.txt new file mode 100644 index 00000000..d0540544 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/copyright.txt @@ -0,0 +1,34 @@ +Win32++ Version 10.2.1 +Release Date: TBA + + David Nash + email: dnash@bigpond.net.au + url: https://sourceforge.net/projects/win32-framework + https://github.com/DavidNash2024/Win32xx + + +Copyright (c) 2005-2026 David Nash + +Permission is hereby granted, free of charge, to +any person obtaining a copy of this software and +associated documentation files (the "Software"), +to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, +merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom +the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/packages/media/cpp/packages/Win32xx/include/default_resource.h b/packages/media/cpp/packages/Win32xx/include/default_resource.h new file mode 100644 index 00000000..49766331 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/default_resource.h @@ -0,0 +1,104 @@ +// This file contains the resource ID definitions for Win32++. + + +// The resource ID for MENU, ICON, ToolBar Bitmap, Accelerator, +// and Window Caption +#define IDW_MAIN 41 + +// Resource ID for the About dialog +#define IDW_ABOUT 42 + +// Resource IDs for menu items +#define IDW_VIEW_TOOLBAR 43 +#define IDW_VIEW_STATUSBAR 44 + +// Resource ID for frame status +#define IDW_READY 45 +#define IDW_INDICATOR_CAPS 46 +#define IDW_INDICATOR_NUM 47 +#define IDW_INDICATOR_SCRL 48 + +// Resource IDs for the ReBar Bands +#define IDW_MENUBAR 49 +#define IDW_TOOLBAR 50 + +// Resource ID for the Accelerator key +#define IDW_QUIT 51 + +// Resource IDs for MDI menu items +#define IDW_MDI_CASCADE 52 +#define IDW_MDI_TILE 53 +#define IDW_MDI_ARRANGE 54 +#define IDW_MDI_CLOSEALL 55 +#define IDW_FIRSTCHILD 56 +#define IDW_CHILD2 57 +#define IDW_CHILD3 58 +#define IDW_CHILD4 59 +#define IDW_CHILD5 60 +#define IDW_CHILD6 61 +#define IDW_CHILD7 62 +#define IDW_CHILD8 63 +#define IDW_CHILD9 64 +#define IDW_CHILD10 65 + +#define IDW_FILE_MRU_FILE1 66 +#define IDW_FILE_MRU_FILE2 67 +#define IDW_FILE_MRU_FILE3 68 +#define IDW_FILE_MRU_FILE4 69 +#define IDW_FILE_MRU_FILE5 70 +#define IDW_FILE_MRU_FILE6 71 +#define IDW_FILE_MRU_FILE7 72 +#define IDW_FILE_MRU_FILE8 73 +#define IDW_FILE_MRU_FILE9 74 +#define IDW_FILE_MRU_FILE10 75 +#define IDW_FILE_MRU_FILE11 76 +#define IDW_FILE_MRU_FILE12 77 +#define IDW_FILE_MRU_FILE13 78 +#define IDW_FILE_MRU_FILE14 79 +#define IDW_FILE_MRU_FILE15 80 +#define IDW_FILE_MRU_FILE16 81 + +// Cursor Resources +#define IDW_SPLITH 82 +#define IDW_SPLITV 83 +#define IDW_TRACK4WAY 84 + +// Docking Bitmap Resources +#define IDW_SDBOTTOM 85 +#define IDW_SDCENTER 86 +#define IDW_SDLEFT 87 +#define IDW_SDMIDDLE 88 +#define IDW_SDRIGHT 89 +#define IDW_SDTOP 90 + +// Print Preview Resources +#define IDW_PRINTPREVIEW 91 +#define IDW_PREVIEWPRINT 92 +#define IDW_PREVIEWSETUP 93 +#define IDW_PREVIEWPREV 94 +#define IDW_PREVIEWNEXT 95 +#define IDW_PREVIEWCLOSE 96 +#define IDW_PREVIEWPANE 97 + +// A generic ID for any static control +#ifndef IDC_STATIC + #define IDC_STATIC -1 +#endif + + + +// Notes about Resource IDs +// * In general, resource IDs can have values from 1 to 65535. Programs with +// resource IDs higher than 65535 aren't supported on Windows 95 +// +// * Windows uses the icon with the lowest resource ID as the application's +// icon. The application's icon is IDW_MAIN, which is the first resource ID +// defined by Win32++. +// +// * When more than one static control is used in a dialog, the controls should +// have a unique ID, unless a resource ID of -1 is used. +// +// * Users of Win32++ are advised to begin their resource IDs from 120 to +// allow for possible expansion of Win32++. + + diff --git a/packages/media/cpp/packages/Win32xx/include/default_resource.rc b/packages/media/cpp/packages/Win32xx/include/default_resource.rc new file mode 100644 index 00000000..1798bd41 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/default_resource.rc @@ -0,0 +1,262 @@ +// An example of a resource file +// + +#include "resource.h" +#include "windows.h" + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 24 DISCARDABLE "res/Win32++.manifest" + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + + +IDW_MAIN MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "New\tCtrl+N", IDM_FILE_NEW + MENUITEM SEPARATOR + MENUITEM "Recent Files", IDW_FILE_MRU_FILE1, GRAYED + MENUITEM SEPARATOR + MENUITEM "E&xit", IDM_FILE_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "Undo\tCtrl+Z", IDM_EDIT_UNDO + MENUITEM "Redo\tCtrl+Y", IDM_EDIT_REDO + MENUITEM SEPARATOR + MENUITEM "Cut\tCtrl+X", IDM_EDIT_CUT + MENUITEM "Copy\tCtrl+C", IDM_EDIT_COPY + MENUITEM "Paste\tCtrl+V", IDM_EDIT_PASTE + MENUITEM "Delete\tDel", IDM_EDIT_DELETE + END + POPUP "&View" + BEGIN + MENUITEM "&Tool Bar", IDW_VIEW_TOOLBAR, CHECKED + MENUITEM "&Status Bar", IDW_VIEW_STATUSBAR, CHECKED + END + POPUP "&Help" + BEGIN + MENUITEM "&About", IDM_HELP_ABOUT + END +END + +MDIMENUVIEW MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "New &View", IDM_FILE_NEWVIEW + MENUITEM "&Close", IDM_FILE_CLOSE + MENUITEM SEPARATOR + MENUITEM "E&xit", IDM_FILE_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "Undo", IDM_EDIT_UNDO + MENUITEM "Redo", IDM_EDIT_REDO + MENUITEM SEPARATOR + MENUITEM "Cu&t", IDM_EDIT_CUT + MENUITEM "&Copy", IDM_EDIT_COPY + MENUITEM "&Paste", IDM_EDIT_PASTE + MENUITEM "De&lete", IDM_EDIT_DELETE + END + POPUP "&View" + BEGIN + MENUITEM "Tool Bar", IDW_VIEW_TOOLBAR, CHECKED + MENUITEM "Status Bar", IDW_VIEW_STATUSBAR, CHECKED + END + POPUP "&Window" + BEGIN + MENUITEM "&Cascade\tShift+F5", IDW_WINDOW_CASCADE + MENUITEM "&Tile\tShift+F4", IDW_WINDOW_TILE + MENUITEM "Arrange &Icons", IDW_WINDOW_ARRANGE + MENUITEM "Close &All", IDW_WINDOW_CLOSEALL + END + POPUP "&Help" + BEGIN + MENUITEM "About", IDM_HELP_ABOUT + END +END + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDW_MAIN ICON "res/mdi.ico" +IDI_VIEW ICON "res/view.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDW_MAIN BITMAP "res/toolbar.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +// Help About Dialog +IDW_ABOUT DIALOGEX 0, 0, 186, 90 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | + WS_SYSMENU +CAPTION "About" +FONT 8, "MS Shell Dlg", 400, 0 +BEGIN + DEFPUSHBUTTON "OK",IDOK,68,49,50,14 + CTEXT "MDI Frame",IDC_STATIC,60,22,64,11 + ICON IDW_MAIN,0,4,4,20,20 +END + +// Print Preview Dialog +103 DIALOGEX 0, 0, 309, 178 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_BORDER +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + PUSHBUTTON "",96,246,2,50,14 + PUSHBUTTON "",92,4,2,50,14 + PUSHBUTTON "",93,55,2,50,14 + PUSHBUTTON "",94,125,2,50,14 + PUSHBUTTON "",95,176,2,50,14 + CONTROL "",97,"PreviewPane",WS_TABSTOP,0,18,309,160 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDW_MAIN ACCELERATORS +BEGIN + "N", IDM_FILE_NEW, VIRTKEY, CONTROL, NOINVERT + "O", IDM_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT + "P", IDM_FILE_PRINT, VIRTKEY, CONTROL, NOINVERT + "S", IDM_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT + "C", IDM_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + "X", IDM_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT + "V", IDM_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT + "Z", IDM_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT + "Y", IDM_EDIT_REDO, VIRTKEY, CONTROL, NOINVERT +END + + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDW_MAIN "Scribble Application" + IDW_INDICATOR_CAPS "CAP" + IDW_INDICATOR_NUM "NUM" + IDW_INDICATOR_SCRL "SCRL" + IDW_READY "Ready" +END + +BEGIN + IDW_PREVIEWPRINT "Print Now" + IDW_PREVIEWSETUP "Print Setup" + IDW_PREVIEWPREV "Prev Page" + IDW_PREVIEWNEXT "Next Page" + IDW_PREVIEWCLOSE "Close" +END + +STRINGTABLE +BEGIN + IDM_FILE_NEW "Create a New Document" + IDM_FILE_OPEN "Open Existing Document" + IDM_FILE_SAVE "Save the Document" + IDM_FILE_SAVEAS "Save the Document with a new name" + IDM_FILE_PRINT "Print the Document" + IDM_FILE_EXIT "End the Program" +END + +STRINGTABLE +BEGIN + IDM_EDIT_UNDO "Undo the last action" + IDM_EDIT_REDO "Redo the previously undone action" + IDM_EDIT_CUT "Cut the Selected Contents to the Clipboard" + IDM_EDIT_COPY "Copy the Selected Contents to the Clipboard" + IDM_EDIT_PASTE "Paste the Clipboard Contents to the Document" + IDM_EDIT_DELETE "Erase the selected Contents" + IDW_VIEW_TOOLBAR "Show or hide the tool bar" + IDW_VIEW_STATUSBAR "Show or hide the status bar" +END + +STRINGTABLE +BEGIN + IDM_HELP_ABOUT "Display Information about this program" +END + +STRINGTABLE +BEGIN + IDW_FIRSTCHILD "Activate this window" + IDW_CHILD2 "Activate this window" + IDW_CHILD3 "Activate this window" + IDW_CHILD4 "Activate this window" + IDW_CHILD5 "Activate this window" + IDW_CHILD6 "Activate this window" + IDW_CHILD7 "Activate this window" + IDW_CHILD8 "Activate this window" + IDW_CHILD9 "Activate this window" + IDW_CHILD10 "Select a window" +END + +STRINGTABLE +BEGIN + IDM_FILE_NEWVIEW "Create View MDI Child" + IDM_FILE_CLOSE "Close MDI Window" + IDW_WINDOW_CASCADE "Cascade MDI Windows" + IDW_WINDOW_TILE "Tile MDI Windows" + IDW_WINDOW_ARRANGE "Arrange Icons" + IDW_WINDOW_CLOSEALL "Close All MDI Windows" +END + +STRINGTABLE +BEGIN + SC_CLOSE "Close the Window" + SC_MAXIMIZE "Maximize the Window" + SC_MINIMIZE "Minimize the WIndow" + SC_MOVE "Move the Window" + SC_NEXTWINDOW "Select Next Window" + SC_PREVWINDOW "Select Previous Window" + SC_RESTORE "Restore the Window" + SC_SIZE "Resize the Window" +END + +STRINGTABLE +BEGIN + IDW_FILE_MRU_FILE1 "Open this document" + IDW_FILE_MRU_FILE2 "Open this document" + IDW_FILE_MRU_FILE3 "Open this document" + IDW_FILE_MRU_FILE4 "Open this document" + IDW_FILE_MRU_FILE5 "Open this document" + IDW_FILE_MRU_FILE6 "Open this document" + IDW_FILE_MRU_FILE7 "Open this document" + IDW_FILE_MRU_FILE8 "Open this document" + IDW_FILE_MRU_FILE9 "Open this document" + IDW_FILE_MRU_FILE10 "Open this document" + IDW_FILE_MRU_FILE11 "Open this document" + IDW_FILE_MRU_FILE12 "Open this document" + IDW_FILE_MRU_FILE13 "Open this document" + IDW_FILE_MRU_FILE14 "Open this document" + IDW_FILE_MRU_FILE15 "Open this document" + IDW_FILE_MRU_FILE16 "Open this document" +END + + diff --git a/packages/media/cpp/packages/Win32xx/include/info.txt b/packages/media/cpp/packages/Win32xx/include/info.txt new file mode 100644 index 00000000..2d93f801 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/info.txt @@ -0,0 +1,95 @@ +Generic Information about Win32++ Projects +========================================== +The various directories may contain the following types of files: + +Extension | Description +----------+------------ +cbp | A project file used by CodeBlocks +cbproj | A project file used by Embarcadero RAD Studio 12 +sln | A project file used by Visual Studio 2003 and above +slnx | A project file used by Visual Studio 2026 and above +vcproj | A project file used by Visual Studio 2003, VS2005 or VS2008 +vcxproj | A project file used by Visual Studio 2010 and above +filters | An additional project file used by Visual Studio 2010 and above +dev | A project file used by Embarcadero Dev-C++ +cpp | A C++ source file +h | A C++ header file +rc | A C++ resource script file +jpg | A jpeg resource file +ico | An icon resource file +bmp | A bitmap resource file +cur | A cursor resource file +manifest | A manifest resource file +txt | A text file +xml | An Extensible Markup Language file (defines the ribbon UI) +hlsl | Holds High Level Shading Language (HLSL), for DirectX +fx | An effect file, for DirectX +nsi | A NSIS (Nullsoft Scriptable Install System) script. + +Supported Compilers and Integrated Development Environments (IDEs) +================================================================== +Win32++ supports the following: +* CodeBlocks +* Embarcadero Dev-C++ +* Embarcadero Rad Studio 12 Community Edition +* Mingw-64 32bit and 64bit Compiler +* Visual Studio 2015 +* Visual Studio 2015 Community +* Visual Studio 2017 +* Visual Studio 2017 Community +* Visual Studio 2019 +* Visual Studio 2019 Community +* Visual Studio 2022 +* Visual Studio 2022 Community + +Supported Operating Systems +=========================== +The programs compiled with Win32++ can run on the following operating systems: +* Windows XP x32 +* Windows XP x64 +* Windows Vista x32 +* Windows Vista x64 +* Windows 7 x32 +* Windows 7 x64 +* Windows 8 x32 +* Windows 8 x64 +* Windows 8.1 x32 +* Windows 8.1 x64 +* Windows 10 x32 +* Windows 10 x64 +* Windows 11 +* Windows Server 2003 x32 +* Windows Server 2003 x64 +* Windows Server 2008 x32 +* Windows Server 2008 x64 +* Windows Server 2012 +* Windows Server 2016 +* Windows Server 2019 +* Windows Server 2022 + +Win32++ is Unicode compliant. Unicode applications can run on all supported +operating systems. Unicode applications are not supported on older operating +systems such as Win95, Win98 and WinME. + +64bit code only runs on 64bit operating systems. 32bit code runs on both +32bit and 64bit operating systems. + +Directory Structure +=================== +When extracting the files from the zip archive, be sure to preserve the +directory structure. The directory structure will look like this: + +.\help +.\include +.\output +.\samples +.\tools +.\tutorials + +The files that form the Win32++ library are contained in the include +folder. + +Help +==== +Refer to the documentation that ships with Win32++ in the help folder +for more information on using Win32++. \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/include/release notes.txt b/packages/media/cpp/packages/Win32xx/include/release notes.txt new file mode 100644 index 00000000..8206bb38 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/release notes.txt @@ -0,0 +1,161 @@ +About Win32++ +------------- +Win32++ is simple and easy to understand framework for developing Win32 +applications using C++. It brings an object oriented approach to programming +directly with the Win32 API. Each window created is a C++ class object capable +of having its own window procedure for routing messages. + +Win32++ supports the following compilers and development environments: + +* Code::Blocks +* Embarcadero Dev-C++ +* Embarcadero Rad Studio 12 Community Edition +* Microsoft Visual Studio Community 2015 +* Microsoft Visual Studio Community 2019 +* Microsoft Visual Studio Community 2022 +* MinGW compiler +* MinGW x64 compiler +* Clang compiler provided with Visual Studio Community 2019 and above. + +Win32++ supports the following operating systems + +* Windows XP +* Windows 2003 Server +* Windows Vista +* Windows 2008 Server +* Windows 7 +* Windows 8 +* Windows 8.1 +* Windows 2012 Server +* Windows 10 +* Windows Server 2016 +* Windows Server 2019 +* Windows 11 +* Windows Server 2022 + + +Features +-------- +Win32++ code has the following features +* Open Source. +* Supports Microsoft, Clang, Embarcadero and GNU C++ compilers. +* Supports applications based on simple windows, dialogs, forms, property sheets, SDI frames and MDI frames. +* Supports docking, with tabbed containers and TabbedMDIs. +* Provides a CString for convenient character string handling. +* Multi-Thread support. +* 64 bit support. +* Print preview support. +* Support for Task Dialogs available on the Windows Vista and later operating systems. +* Support for the Ribbon Framework available on Windows 7. +* Network support. IPv4 and IPv6. +* Supports applications with per monitor DPI awareness, version 2. +* Supports dark mode applications. +* Supports high resolution monitors with automatic DPI scaling. + +Frames produced by Win32++ typically have the following: + * Rebar + * Menubar + * Toolbar with tooltips + * Status bar + +Frames also support the following optional features +* Themes +* Docking +* Ribbons +* MDI frames +* Dark mode + +About the file downloads +------------------------ +The file download from Sourceforge includes the following: + * The Win32++ library itself + * Help for the library + * A set of tutorials + * A collection of sample applications + +The sample applications include: + * Animation - An example of an animation control in a dialog. + * Browser - An internet browser application with an event sink. + * Browser - An internet browser application with an event sink using ATL. + * CommonDialogs - a Demo of windows common dialogs, such as File/Save. + * Console - A console application with CString support. + * ContextHelp - Shows how to incorporate context help into an application. + * CustomControl - Shows how to put a web browser in a custom control for use in a dialog. + * CustomPrintDlg - Shows how to create a customized print dialog. + * DarkModeFrame - Demonstrate a frame application with dark mode support. + * DateTime - A demo of a Date/time dialog for displaying and changing the time + * DDXDemo - Demonstrates Dialog Data Exchange and validation. + * Dialog - An example of a simple dialog application. + * DialogBars - Demonstrates yhr use of a slider, scrollbar and progressbar control in a dialog. + * DialogDemo - An interactive dialog application demonstrating slider controls and progress bars. + * DialogResizing - An example of a resizable dialog. + * DialogTab - A dialog application with a tab control. + * DialogTemplate - An application that extracts the dialog template array from a dialog. + * Direct2D - Demonstrates the use of Direct2D in an application. + * DirectX9 - A simple DirectX application. + * DirectX11 - A simple DirectX application using DirectX 11. + * Dock - An example of a simple docking application. + * DockContainer - An example of a docking application that incorporates containers. + * DockTabbedMDI - An example of a docking application with containers and a tabbed MDI. + * DoubleBuffer - Demonstrates how to implement double buffering for window drawing. + * EdgeBrowser - Demonstrate displaying a Microsoft Edge browser in a window. + * EdgeBrowserEx - Demonstrates displaying a tabbed Microsoft Edge browser. + * Explorer - A Windows Explorer-like application. + * FastGDI - An application that demonstrates direct manipulation of a bitmap's color. + * FilePrintPreview - An application that demonstrates a print preview with preview scaling. + * FormDocView - An example of a modeless dialog within a frame. Uses Doc/View architecture. + * Frame - A simple frame application that stores settings in the registry. + * FrameEx - A simple frame application that uses PNG image resources. + * GDIPlus - Demonstrates how to use GDI+ with Win32++. + * IFileDialog - Illustrates the use of the IFileOpenDialog and IFileSaveDialog. + * INIFrame - A simple frame application that stores settings in an INI file. + * ListView - Demonstrates a listview control with text editing and sorting. + * MDIDockFrame - A MDI frame that supports docking. + * MDIFrame - A simple MDI frame application. + * MDIFrameDemo - Demonstrates some additional features of MDI frames. + * MDIFrameSplitter - Demonstrates how to implement splitter windows in MDI Child windows. + * MetaFile - Demonstrates how to create and display an enhanced metafile. + * MovieShow - This program manages a video library. + * NetClient - Demonstrates a network chat client. + * NetServer - Demonstrates a network chat server. + * NetSimple - Simple client and server network programs. + * Notepad - A simple text editor with printing and print previewing. + * Performance - Measures Win32++'s message handling speed. + * Picture - A simple picture rendering application. + * PropertySheets - A demonstration of property sheets. + * RebarDemo - Demonstrates the how to add a second ReBar to a frame application. + * Ribbon - Demonstrates how to use the Windows 7 ribbon with a simple window. + * RibbonDockFrame - Demonstrates how to use a ribbon with a Docking Frame. + * RibbonFrame - Demonstrates how to use the Windows 7 ribbon with a frame. + * RibbonMDIFrame - Demonstrates how to use the Windows 7 ribbon with a MDI frame. + * RoundWindow - Demonstrates how to use Win32++ to create a round window. + * ScintillaDemo - Demonstrates how to use a Scintilla control with Win32++. + * Scribble - A simple drawing application. + * Simple - Creates a simple window. + * Splitter - Demonstrates how to use dockers to create splitter windows. + * StatusBar - Demonstrates various things that can be done with the status bar. + * TabDemo - Demonstrates the use of a CTab control in a frame. + * TaskDialog - Demonstrates the use of task dialogs (available on Vista and above). + * TextFileReader - displays a text file in a scrollable window. + * TestDLL - Shows how to run Win32++ from within a DLL + * Themes - Demonstrates how to customize the colours for rebar and toolbar controls. + * Threads - Demonstrates multi-threaded Windows. + * TimeDemo - Demonstrates various uses of the CTime class. + * TitleBar - Demonstrates how to customize the color of a caption for a window. + * TitleBarFrame - Demonstrates how to customize the color of a caption for a frame. + * ToolBarBuilder - A handy tool for creating bitmaps for use with toolbars. + * ToolBarDemo - Demonstrates how to customize a toolbar. + * Tray - Demonstrates how to "minimize" an application to the system tray. + * WinPlot - Plots a function specified by the user. + +Getting Started +--------------- +Each file download includes the project files for Dev-C++, CodeBlocks and the +various compilers from Microsoft. + +You can start with one of the sample programs, and add your code. Alternatively +you can start with the projects and sample code provided in the "new projects" +folder. + +For additional information on getting started, refer to the help included +in the documentation. \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_appcore.h b/packages/media/cpp/packages/Win32xx/include/wxx_appcore.h new file mode 100644 index 00000000..0a71c8fd --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_appcore.h @@ -0,0 +1,1013 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +#ifndef _WIN32XX_APPCORE_H_ +#define _WIN32XX_APPCORE_H_ + + +/////////////////////////////////////////////////////// +// wxx_appcore.h +// This file contains the definitions of the CWinApp class. +// This class is used start Win32++ and run the message loop. You +// should inherit from this class to start Win32++ in your own +// application. + + +#include "wxx_appcore0.h" +#include "wxx_textconv.h" +#include "wxx_wincore0.h" +#include "wxx_cstring.h" +#include "wxx_exception.h" +#include "wxx_messagepump.h" + +extern "C" IMAGE_DOS_HEADER __ImageBase; + +namespace Win32xx +{ + + ////////////////////////////////////////////////////////////////////// + // A set of typedefs to simplify the use of CGlobalLock. + // These provide self unlocking objects that can be used for pointers + // to global memory. Using these typedefs eliminate the need to manually + // lock or unlock the global memory handles. + // Note: In the examples below, hDevMode and hDevNames can be either a raw + // global memory handle, or a CHGlobal object. + // + // Example usage: + // CDevMode pDevMode(hDevMode); // and use pDevMode as if it were a LPDEVMODE + // CDevNames pDevNames(hDevNames); // and use pDevNames as if it were a LPDEVNAMES + // assert(pDevNames.Get()); // Get can be used to access the underlying pointer + // CDevNames(hDevNames).GetDeviceName // Returns a CString containing the device name. + // + ///////////////////////////////////////////////////////////////////// + +#ifndef WIN32_LEAN_AND_MEAN + using CDevMode = CGlobalLock; + using CDevNames = CGlobalLock; +#endif + + ///////////////////////////////////////// + // Definitions for the CGlobalLock class. + // + + // Constructor. + template + CGlobalLock::CGlobalLock(const CGlobalLock& rhs) + { + m_h = rhs.m_h; + m_p = rhs.m_p; + } + + // Assignment operator. + template + CGlobalLock& CGlobalLock::operator= (const CGlobalLock& rhs) + { + m_h = rhs.m_h; + m_p = rhs.m_p; + return *this; + } + + // Assignment operator. + template + CGlobalLock& CGlobalLock::operator=(HANDLE h) + { + if (h != m_h) + { + Unlock(); + m_h = h; + Lock(); + } + return *this; + } + + // Lock the handle to allow the global memory to be used. + template + inline void CGlobalLock::Lock() + { + if (m_h != nullptr) + { + m_p = reinterpret_cast(::GlobalLock(m_h)); + // Did the lock succeed? + if (m_p == nullptr) + { + // The handle is probably invalid + throw CWinException(GetApp()->MsgWndGlobalLock()); + } + } + else + m_p = nullptr; + } + + // Unlock the handle. + template + inline void CGlobalLock::Unlock() + { + if (m_h != nullptr) + { + ::GlobalUnlock(m_h); + m_h = nullptr; + } + } + +#ifndef WIN32_LEAN_AND_MEAN + + // Returns a const TCHAR* for the DEVNAMES in the global memory. + template <> + inline LPCTSTR CDevNames::c_str() const + { + assert(m_p != nullptr); + return reinterpret_cast(m_p); + } + + // Returns a TCHAR* for the DEVNAMES in global the memory. + template <> + inline LPTSTR CDevNames::GetString() const + { + assert(m_p != nullptr); + return reinterpret_cast(m_p); + } + + // Returns a CString containing the DeviceName from the DEVNAMES + // in global the memory. + template<> + inline CString CDevNames::GetDeviceName() const + { + return (m_p != nullptr) ? c_str() + (*this)->wDeviceOffset : _T(""); + } + + // Returns a CString containing the GetDriverName from the DEVNAMES + // in global the memory. + template<> + inline CString CDevNames::GetDriverName() const + { + return (m_p != nullptr) ? c_str() + (*this)->wDriverOffset : _T(""); + } + + // Returns a CString containing the GetPortName from the DEVNAMES + // in global the memory. + template<> + inline CString CDevNames::GetPortName() const + { + return (m_p != nullptr) ? c_str() + (*this)->wOutputOffset : _T(""); + } + + // Returns true if the DEVNAMES in the global memory is for the + // default printer. + template<> + inline bool CDevNames::IsDefaultPrinter() const + { + return (m_p != nullptr) ? ((*this)->wDefault & DN_DEFAULTPRN) : false; + } + + #endif // WIN32_LEAN_AND_MEAN + + //////////////////////////////////// + // Definitions for the CWinApp class + // + + // Constructor. + inline CWinApp::CWinApp() : m_callback(nullptr) + { + CThreadLock appLock(m_appLock); + + if (SetnGetThis() == nullptr) + { + m_tlsData = ::TlsAlloc(); + + // An exception is thrown if all TLS indexes are already allocated by this app. + // At least 64 TLS indexes per process are allowed. + // Win32++ requires only one TLS index. + if (m_tlsData != TLS_OUT_OF_INDEXES) + { + SetnGetThis(this); + + // Set the instance handle. + m_instance = reinterpret_cast(&__ImageBase); + + m_resource = m_instance; + SetTlsData(); + SetCallback(); + LoadCommonControls(); + + // Initialize the COM library. + // Note: The ribbon UI requires the COINIT_APARTMENTTHREADED + // concurrency model. OleInitialize calls CoInitializeEx + // with COINIT_APARTMENTTHREADED, and provides support + // for other OLE functionality. + VERIFY(SUCCEEDED(OleInitialize(nullptr))); + } + else + throw CNotSupportedException(MsgTlsIndexes()); + } + else + // Throw an exception if we run more than one instance of CWinApp. + throw CNotSupportedException(MsgCWinApp()); + } + + // Destructor + inline CWinApp::~CWinApp() + { + // Forcibly destroy any remaining windows now. Windows created from + // static CWnds or dangling pointers are destroyed here. + for (const auto& m : m_mapHWND) + { + HWND wnd = m.first; + if (::IsWindow(wnd)) + { + ::DestroyWindow(wnd); + } + } + + // Do remaining tidy up. + m_allTLSData.clear(); + if (m_tlsData != TLS_OUT_OF_INDEXES) + { + ::TlsSetValue(m_tlsData, nullptr); + ::TlsFree(m_tlsData); + } + + SetnGetThis(nullptr, true); + if (m_resource != m_instance) + ::FreeLibrary(m_resource); + + OleUninitialize(); + } + + // Adds a HDC and CDC_Data* pair to the map. + inline void CWinApp::AddCDCDataToMap(HDC dc, std::weak_ptr pData) + { + CThreadLock mapLock(m_gdiLock); + m_mapCDCData.emplace(std::make_pair(dc, pData)); + } + + // Adds a HGDIOBJ and CGDI_Data* pair to the map. + inline void CWinApp::AddCGDIDataToMap(HGDIOBJ gdi, std::weak_ptr pData) + { + CThreadLock mapLock(m_gdiLock); + m_mapCGDIData.emplace(std::make_pair(gdi, pData)); + } + + // Adds a HIMAGELIST and CIml_Data* pair to the map. + inline void CWinApp::AddCImlDataToMap(HIMAGELIST images, std::weak_ptr pData) + { + CThreadLock mapLock(m_gdiLock); + m_mapCImlData.emplace(std::make_pair(images, pData)); + } + + // Adds a HMENU and CMenu_Data* to the map. + inline void CWinApp::AddCMenuDataToMap(HMENU menu, std::weak_ptr pData) + { + CThreadLock mapLock(m_wndLock); + m_mapCMenuData.emplace(std::make_pair(menu, pData)); + } + + // Adds the window handle and CWnd pointer in the HWND map. + inline void CWinApp::AddCWndToMap(HWND wnd, CWnd* pWnd) + { + CThreadLock mapLock(m_wndLock); + + // This HWND is should not be in the map yet. + assert(GetCWndFromMap(wnd) == nullptr); + + // Remove any old map entry for this CWnd (required when the CWnd is reused). + RemoveCWndFromMap(pWnd); + + // Add the (HWND, CWnd*) pair to the map + m_mapHWND.emplace(std::make_pair(wnd, pWnd)); + } + + // Retrieves a pointer to CDC_Data from the map. + inline std::weak_ptr CWinApp::GetCDCData(HDC dc) + { + CThreadLock mapLock(m_gdiLock); + + // Find the CDC data mapped to this HDC. + std::weak_ptr pCDCData; + auto m = m_mapCDCData.find(dc); + if (m != m_mapCDCData.end()) + pCDCData = m->second; + + return pCDCData; + } + + // Retrieves a pointer to CGDI_Data from the map. + inline std::weak_ptr CWinApp::GetCGDIData(HGDIOBJ object) + { + CThreadLock mapLock(m_gdiLock); + + // Find the CGDIObject data mapped to this HGDIOBJ. + std::weak_ptr pCGDIData; + auto m = m_mapCGDIData.find(object); + if (m != m_mapCGDIData.end()) + pCGDIData = m->second; + + return pCGDIData; + } + + // Retrieves a pointer to CIml_Data from the map. + inline std::weak_ptr CWinApp::GetCImlData(HIMAGELIST images) + { + CThreadLock mapLock(m_gdiLock); + + // Find the CImageList data mapped to this HIMAGELIST. + std::weak_ptr pCImlData; + auto m = m_mapCImlData.find(images); + if (m != m_mapCImlData.end()) + pCImlData = m->second; + + return pCImlData; + } + + // Retrieves a pointer to CMenu_Data from the map. + inline std::weak_ptr CWinApp::GetCMenuData(HMENU menu) + { + CThreadLock mapLock(m_wndLock); + + // Find the CMenu data mapped to this HMENU. + std::weak_ptr pCMenuData; + auto m = m_mapCMenuData.find(menu); + if (m != m_mapCMenuData.end()) + pCMenuData = m->second; + + return pCMenuData; + } + + // Retrieves the CWnd pointer associated with the specified wnd. + inline CWnd* CWinApp::GetCWndFromMap(HWND wnd) + { + CThreadLock mapLock(m_wndLock); + + // Find the CWnd pointer mapped to this HWND. + CWnd* pWnd = nullptr; + auto m = m_mapHWND.find(wnd); + if (m != m_mapHWND.end()) + pWnd = m->second; + + return pWnd; + } + + // Retrieves a handle to the main window for this thread. + // Note: CFrame set's itself as the main window of its thread. + inline HWND CWinApp::GetMainWnd() const + { + TLSData* pTLSData = GetTlsData(); + + // Will assert if the thread doesn't have TLSData assigned. + // TLSData is assigned when the first window in the thread is created. + assert(pTLSData); + + return pTLSData ? pTLSData->mainWnd : 0; + } + + // Retrieves the pointer to the Thread Local Storage data for the current thread. + inline TLSData* CWinApp::GetTlsData() const + { + return static_cast(TlsGetValue(m_tlsData)); + } + + // Loads the cursor resource from the resource script (resource.rc) + // Refer to LoadCursor in the Windows API documentation for more information. + inline HCURSOR CWinApp::LoadCursor(LPCTSTR resourceName) const + { + return ::LoadCursor(GetResourceHandle(), resourceName); + } + + // Loads the cursor resource from the resource script (resource.rc) + // Refer to LoadCursor in the Windows API documentation for more information. + inline HCURSOR CWinApp::LoadCursor(UINT cursorID) const + { + return ::LoadCursor(GetResourceHandle(), MAKEINTRESOURCE (cursorID)); + } + + // Returns the handle of a standard cursor. Standard cursors include: + // IDC_APPSTARTING, IDC_ARROW, IDC_CROSS, IDC_HAND, IDC_HELP, IDC_IBEAM, IDC_NO, IDC_SIZEALL, + // IDC_SIZENESW, IDC_SIZENS, IDC_SIZENWSE, IDC_SIZEWE, IDC_UPARROW, IDC_WAIT + // Refer to LoadCursor in the Windows API documentation for more information. + inline HCURSOR CWinApp::LoadStandardCursor(LPCTSTR cursorName) const + { + return ::LoadCursor(nullptr, cursorName); + } + + // Loads the icon resource whose size conforms to the SM_CXICON and SM_CYICON system metric values. + // For other icon sizes, use the LoadImage windows API function. + // Refer to LoadIcon in the Windows API documentation for more information. + inline HICON CWinApp::LoadIcon(LPCTSTR resourceName) const + { + return ::LoadIcon(GetResourceHandle(), resourceName); + } + + // Loads the icon resource whose size conforms to the SM_CXICON and SM_CYICON system metric values. + // Refer to LoadIcon in the Windows API documentation for more information. + inline HICON CWinApp::LoadIcon(UINT iconID) const + { + return ::LoadIcon(GetResourceHandle(), MAKEINTRESOURCE (iconID)); + } + + // Returns the handle of a standard Icon. Standard Icons include: + // IDI_APPLICATION, IDI_ASTERISK, IDI_ERROR, IDI_EXCLAMATION, + // IDI_HAND, IDI_INFORMATION, IDI_QUESTION, IDI_WARNING + // Refer to LoadIcon in the Windows API documentation for more information. + inline HICON CWinApp::LoadStandardIcon(LPCTSTR iconName) const + { + return ::LoadIcon(nullptr, iconName); + } + + // Loads an icon, cursor, animated cursor, or bitmap image. + // uType is the image type. It can be IMAGE_BITMAP, IMAGE_CURSOR or IMAGE_ICON. + // cx and cy are the desired width and height in pixels. + // flags can be LR_DEFAULTCOLOR, LR_CREATEDIBSECTION, LR_DEFAULTSIZE, LR_LOADFROMFILE, + // LR_LOADMAP3DCOLORS, R_LOADTRANSPARENT, LR_MONOCHROME, LR_SHARED, LR_VGACOLOR. + // Ideally the image should be destroyed unless it is loaded with LR_SHARED. + // Refer to LoadImage in the Windows API documentation for more information. + inline HANDLE CWinApp::LoadImage(LPCTSTR resourceName, UINT type, int cx, int cy, UINT flags) const + { + return ::LoadImage(GetResourceHandle(), resourceName, type, cx, cy, flags); + } + + // Loads an icon, cursor, animated cursor, or bitmap. + // uType is the image type. It can be IMAGE_BITMAP, IMAGE_CURSOR or IMAGE_ICON. + // cx and cy are the desired width and height in pixels. + // flags can be LR_DEFAULTCOLOR, LR_CREATEDIBSECTION, LR_DEFAULTSIZE, LR_LOADFROMFILE, + // LR_LOADMAP3DCOLORS, R_LOADTRANSPARENT, LR_MONOCHROME, LR_SHARED, LR_VGACOLOR. + // Ideally the image should be destroyed unless it is loaded with LR_SHARED. + // Refer to LoadImage in the Windows API documentation for more information. + inline HANDLE CWinApp::LoadImage(UINT imageID, UINT type, int cx, int cy, UINT flags) const + { + return ::LoadImage(GetResourceHandle(), MAKEINTRESOURCE (imageID), type, cx, cy, flags); + } + + // Removes this CWnd's pointer from m_mapHWND. + inline void CWinApp::RemoveCWndFromMap(CWnd* pWnd) + { + CThreadLock mapLock(m_wndLock); + + // Erase the CWnd pointer entry from the map. + auto& map = GetApp()->m_mapHWND; + for (auto it = map.begin(); it != map.end(); ++it) + { + if (pWnd == it->second) + { + map.erase(it); + break; + } + } + } + + // Remove the device context from m_mapCDCData. + inline void CWinApp::RemoveDCFromMap(HDC dc) + { + CThreadLock mapLock(m_gdiLock); + + // Find the CDC data entry in the map. + auto it = m_mapCDCData.find(dc); + if (it != m_mapCDCData.end()) + { + // Erase the CDC data entry from the map + m_mapCDCData.erase(it); + } + } + + // Remove the GDI object from m_mapCGDIData. + inline void CWinApp::RemoveGDIObjectFromMap(HGDIOBJ gdiObject) + { + CThreadLock mapLock(m_gdiLock); + + // Find the CGdiObject data pointer in the map. + auto it = m_mapCGDIData.find(gdiObject); + if (it != m_mapCGDIData.end()) + { + // Erase the CGDIObject pointer entry from the map. + m_mapCGDIData.erase(it); + } + } + + // Remove the image list from m_mapCImlData. + inline void CWinApp::RemoveImageListFromMap(HIMAGELIST images) + { + CThreadLock mapLock(m_gdiLock); + + // Find the CImageList data pointer in the map. + auto it = m_mapCImlData.find(images); + if (it != m_mapCImlData.end()) + { + // Erase the CMenu data pointer in the map. + m_mapCImlData.erase(it); + } + } + + // Remove the menu from m_mapCMenuData. + inline void CWinApp::RemoveMenuFromMap(HMENU menu) + { + CThreadLock mapLock(m_wndLock); + + // Find the CMenu data pointer in the map. + auto m = m_mapCMenuData.find(menu); + if (m != m_mapCMenuData.end()) + { + // Erase the CMenu data pointer in the map. + m_mapCMenuData.erase(m); + } + } + + // Frees the global memory handles for the application's printer. + inline void CWinApp::ResetPrinterMemory() + { + m_devMode.Free(); + m_devNames.Free(); + } + + // Registers a temporary window class so we can get the callback + // address of CWnd::StaticWindowProc. + inline void CWinApp::SetCallback() + { + WNDCLASS defaultWC = {}; + LPCTSTR className = _T("Win32++ Temporary Window Class"); + defaultWC.hInstance = GetInstanceHandle(); + defaultWC.lpfnWndProc = CWnd::StaticWindowProc; + defaultWC.lpszClassName = className; + VERIFY(::RegisterClass(&defaultWC)); + + // Retrieve the class information. + defaultWC = {}; + VERIFY(::GetClassInfo(GetInstanceHandle(), className, &defaultWC)); + + // Save the callback address of CWnd::StaticWindowProc. + assert(defaultWC.lpfnWndProc); // Assert fails when running UNICODE build on ANSI OS. + m_callback = defaultWC.lpfnWndProc; + VERIFY(::UnregisterClass(className, GetInstanceHandle())); + } + + // Sets the current cursor and returns the previous one. + // Note:The cursor will be set to the window's class cursor (if one is set) each time the + // mouse is moved over the window. You can specify different cursors for different + // conditions while processing WM_SETCURSOR. + // Refer to SetCursor in the Windows API documentation for more information. + inline HCURSOR CWinApp::SetCursor(HCURSOR cursor) const + { + return ::SetCursor(cursor); + } + + // This function stores the 'this' pointer in a static variable. + // Once stored, it can be used later to return the 'this' pointer. + // CWinApp's constructor calls this function and sets the static variable. + // CWinApp's destructor resets pWinApp to nullptr. + inline CWinApp* CWinApp::SetnGetThis(CWinApp* pThis /*= nullptr*/, bool reset /*= false*/) + { + static CWinApp* pWinApp = nullptr; + + if (reset) + { + pWinApp = nullptr; + } + else + { + if (pWinApp == nullptr) + pWinApp = pThis; + else + assert(pThis == nullptr); + } + + return pWinApp; + } + + // Sets the main window for this thread. + inline void CWinApp::SetMainWnd(HWND wnd) const + { + TLSData* pTLSData = GetTlsData(); + pTLSData->mainWnd = wnd; + } + + // This function can be used to load a resource dll. + // A resource dll can be used to define resources in different languages. + // To use this function, place code like this in InitInstance + // HINSTANCE resource = LoadLibrary(_T("MyResourceDLL.dll")); + // SetResourceHandle(resource); + // A resource of 0 can be specified to revert the resource back to m_instance. + // The resource is automatically freed when it is no longer required. + inline void CWinApp::SetResourceHandle(HINSTANCE resource) + { + // Free the current resource if appropriate. + if ((m_resource != resource) && (m_resource != m_instance)) + ::FreeLibrary(m_resource); + + // Set the resources back to default. + if (resource == nullptr) + resource = m_instance; + + m_resource = resource; + } + + // Creates the Thread Local Storage data for the current thread if none already exists, + // and returns a pointer to the TLS data. + inline void CWinApp::SetTlsData() + { + CThreadLock TLSLock(m_appLock); + + TLSData* pTLSData = GetTlsData(); + if (pTLSData == nullptr) + { + m_allTLSData.push_back(std::make_unique()); + VERIFY(::TlsSetValue(m_tlsData, m_allTLSData.back().get())); + } + } + + // Updates the printer global memory if we were using the default printer, + // and the default printer has changed. + inline void CWinApp::UpdateDefaultPrinter() + { + #ifndef WIN32_LEAN_AND_MEAN + + CThreadLock lock(m_printLock); + + if (m_devNames.Get() == nullptr) + { + // Allocate global printer memory by specifying the default printer. + PRINTDLG pd = {}; + pd.Flags = PD_RETURNDEFAULT; + pd.lStructSize = sizeof(pd); + ::PrintDlg(&pd); + m_devMode.Reassign(pd.hDevMode); + m_devNames.Reassign(pd.hDevNames); + } + else + { + // Global memory has already been allocated. + if (CDevNames(m_devNames).IsDefaultPrinter()) + { + // Get current default printer + PRINTDLG pd = {}; + pd.lStructSize = sizeof(pd); + pd.Flags = PD_RETURNDEFAULT; + ::PrintDlg(&pd); + + if (pd.hDevNames == nullptr) + { + // Printer was default, but now there are no printers. + m_devMode.Free(); + m_devNames.Free(); + } + else + { + // Compare current default printer to the one in global memory + CDevNames mNames(m_devNames); + CDevNames hNames(pd.hDevNames); + if (mNames.GetDeviceName() != hNames.GetDeviceName() || + mNames.GetDriverName() != hNames.GetDriverName() || + mNames.GetPortName() != hNames.GetPortName()) + { + // Default printer has changed. Reset the global memory. + m_devMode.Free(); + m_devNames.Free(); + m_devMode.Reassign(pd.hDevMode); + m_devNames.Reassign(pd.hDevNames); + } + else + { + ::GlobalFree(pd.hDevMode); + ::GlobalFree(pd.hDevNames); + } + } + } + } + +#endif // WIN32_LEAN_AND_MEAN + } + + // Updates the current printer global memory with the specified memory + // handles. This function assumes the old global memory has already + // been freed. + inline void CWinApp::UpdatePrinterMemory(HGLOBAL hDevMode, HGLOBAL hDevNames) + { + m_devMode.Reassign(hDevMode); + m_devNames.Reassign(hDevNames); + } + + // Messages used for exceptions. + + // No error message. + inline CString CWinApp::MsgNoError() const + { return _T("There is no additional error information."); } + + // Archive Messages. + inline CString CWinApp::MsgArReadFail() const + { return _T("Failed to read from archive."); } + + inline CString CWinApp::MsgArNotCStringA() const + { return _T("ANSI characters stored. Not a CStringW."); } + + inline CString CWinApp::MsgArNotCStringW() const + { return _T("Unicode characters stored. Not a CStringA."); } + + // Thread and Semaphore Messages. + inline CString CWinApp::MsgAppThread() const + { return _T("Failed to create thread."); } + + inline CString CWinApp::MsgCriticalSection() const + { return _T("Failed to create critical section."); } + + inline CString CWinApp::MsgMtxEvent() const + { return _T("Unable to create event."); } + + inline CString CWinApp::MsgMtxMutex() const + { return _T("Unable to create mutex."); } + + inline CString CWinApp::MsgMtxSemaphore() const + { return _T("Unable to create semaphore."); } + + // Winsock Messages. + inline CString CWinApp::MsgSocWSAStartup() const + { return _T("WSAStartup failed."); } + + inline CString CWinApp::MsgSocWS2Dll() const + { return _T("Failed to load WS2_2.dll."); } + + // Window creation Messages. + inline CString CWinApp::MsgWndCreate() const + { return _T("Failed to create window."); } + + inline CString CWinApp::MsgWndDialog() const + { return _T("Failed to create dialog."); } + + inline CString CWinApp::MsgIPControl() const + { return _T("IP Address Control not supported!."); } + + inline CString CWinApp::MsgWndPropertSheet() const + { return _T("Failed to create PropertySheet."); } + + inline CString CWinApp::MsgRichEditDll() const + { return _T("Failed to load the RichEdit dll."); } + + inline CString CWinApp::MsgTaskDialog() const + { return _T("Failed to create Task Dialog."); } + + // CFile Messages + inline CString CWinApp::MsgFileClose() const + { return _T("Failed to close file."); } + + inline CString CWinApp::MsgFileFlush() const + { return _T("Failed to flush file."); } + + inline CString CWinApp::MsgFileLock() const + { return _T("Failed to lock the file."); } + + inline CString CWinApp::MsgFileOpen() const + { return _T("Failed to open file."); } + + inline CString CWinApp::MsgFileRead() const + { return _T("Failed to read from file."); } + + inline CString CWinApp::MsgFileRename() const + { return _T("Failed to rename file."); } + + inline CString CWinApp::MsgFileRemove() const + { return _T("Failed to delete file."); } + + inline CString CWinApp::MsgFileLength() const + { return _T("Failed to change the file length."); } + + inline CString CWinApp::MsgFileUnlock() const + { return _T("Failed to unlock the file."); } + + inline CString CWinApp::MsgFileWrite() const + { return _T("Failed to write to file."); } + + // GDI Messages + inline CString CWinApp::MsgGdiDC() const + { return _T("Failed to create device context."); } + + inline CString CWinApp::MsgGdiIC() const + { return _T("Failed to create information context."); } + + inline CString CWinApp::MsgGdiBitmap() const + { return _T("Failed to create bitmap."); } + + inline CString CWinApp::MsgGdiBrush() const + { return _T("Failed to create brush."); } + + inline CString CWinApp::MsgGdiFont() const + { return _T("Failed to create font."); } + + inline CString CWinApp::MsgGdiImageList() const + { return _T("Failed to create image list."); } + + inline CString CWinApp::MsgGdiPalette() const + { return _T("Failed to create palette."); } + + inline CString CWinApp::MsgGdiPen() const + { return _T("Failed to create pen."); } + + inline CString CWinApp::MsgGdiRegion() const + { return _T("Failed to create region."); } + + inline CString CWinApp::MsgGdiGetDC() const + { return _T("GetDC failed."); } + + inline CString CWinApp::MsgGdiGetDCEx() const + { return _T("GetDCEx failed."); } + + inline CString CWinApp::MsgGdiSelObject() const + { return _T("Failed to select object into device context."); } + + inline CString CWinApp::MsgGdiGetWinDC() const + { return _T("GetWindowDC failed."); } + + inline CString CWinApp::MsgGdiBeginPaint() const + { return _T("BeginPaint failed."); } + + // Image list, Menu and Printer messages + inline CString CWinApp::MsgImageList() const + { return _T("Failed to create image list."); } + + inline CString CWinApp::MsgMenu() const + { return _T("Failed to create menu."); } + + inline CString CWinApp::MsgPrintFound() const + { return _T("No printer available."); } + + inline CString CWinApp::MsgWndGlobalLock() const + { return _T("CGlobalLock failed to lock handle."); } + + // DDX anomaly prompting messages. + inline CString CWinApp::MsgDDX_Byte() const + { return _T("Please enter an integer between 0 and 255."); } + + inline CString CWinApp::MsgDDX_Int() const + { return _T("Please enter an integer."); } + + inline CString CWinApp::MsgDDX_Long() const + { return _T("Please enter a long integer."); } + + inline CString CWinApp::MsgDDX_Short() const + { return _T("Please enter a short integer."); } + + inline CString CWinApp::MsgDDX_Real() const + { return _T("Please enter a number."); } + + inline CString CWinApp::MsgDDX_UINT() const + { return _T("Please enter a positive integer."); } + + inline CString CWinApp::MsgDDX_ULONG() const + { return _T("Please enter a positive long integer."); } + + // DDV formats and prompts + inline CString CWinApp::MsgDDV_IntRange() const + { return _T("Please enter an integer in (%ld, %ld)."); } + + inline CString CWinApp::MsgDDV_UINTRange() const + { return _T("Please enter an positive integer in (%lu, %lu)."); } + + inline CString CWinApp::MsgDDV_RealRange() const + { return _T("Please enter a number in (%.*g, %.*g)."); } + + inline CString CWinApp::MsgDDV_StringSize() const + { return _T("%s\n is too long.\nPlease enter no more than %ld characters."); } + + // CTime messages + inline CString CWinApp::MsgTimeValid() const + { return _T("Invalid time."); } + + // CWinApp messages + inline CString CWinApp::MsgCWinApp() const + { return _T("Only one instance of CWinApp can run at a time"); } + + inline CString CWinApp::MsgTlsIndexes() const + { return _T("No available Thread Local Storage Indexes."); } + + + ///////////////////////////////////////////////////////// + // Definitions of CString functions that require CWinApp + // + + // Appends formatted data to the CStringT content. + template + inline void CStringT::AppendFormat(UINT formatID, ...) + { + CStringT str1; + CStringT str2; + + if (str1.LoadString(formatID)) + { + va_list args; + va_start(args, formatID); + str2.FormatV(str1.c_str(), args); + va_end(args); + + m_str.append(str2); + } + } + + // Formats the string as sprintf does. + template + inline void CStringT::Format(UINT id, ...) + { + CStringT str; + if (str.LoadString(id)) + { + va_list args; + va_start(args, id); + FormatV(str.c_str(), args); + va_end(args); + } + } + + // Loads the string from a Windows resource. + template <> + inline bool CStringA::LoadString(UINT id) + { + assert(GetApp()); + + int startSize = 64; + CHAR* pTCharArray = nullptr; + std::vector vString; + int chars = startSize; + + Empty(); + + // Increase the size of our array in a loop until we load the entire string + // The ANSI and UNICODE versions of LoadString behave differently. + // This less efficient technique works for both. + while (startSize - 1 <= chars) + { + startSize = startSize * 4; + vString.assign(size_t(startSize) + 1, 0); + pTCharArray = vString.data(); + chars = ::LoadStringA(GetApp()->GetResourceHandle(), id, pTCharArray, startSize); + } + + if (chars > 0) + m_str.assign(pTCharArray); + + return (chars != 0); + } + + // Loads the string from a Windows resource. + // Refer to LoadString in the Windows API documentation for more information. + template + inline bool CStringT::LoadString(UINT id) + { + assert(GetApp()); + + Empty(); + + // The ANSI and UNICODE versions of LoadString behave differently. + // This technique only works for LoadStringW. + LPCWSTR pString = nullptr; + int charCount = ::LoadStringW(GetApp()->GetResourceHandle(), id, + reinterpret_cast(&pString), 0); + + if (charCount > 0) + m_str.assign(pString, static_cast(charCount)); + + return (charCount != 0); + } + + // Returns a CString containing the specified string resource. + // Returns an empty string if the string resource is not defined. + // Refer to LoadString in the Windows API documentation for more information. + inline CString LoadString(UINT id) + { + CString str; + str.LoadString(id); + return str; + } + + +} // namespace Win32xx + +#endif // _WIN32XX_APPCORE_H_ + diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_appcore0.h b/packages/media/cpp/packages/Win32xx/include/wxx_appcore0.h new file mode 100644 index 00000000..686fcf24 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_appcore0.h @@ -0,0 +1,398 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + + +#ifndef _WIN32XX_APPCORE0_H_ +#define _WIN32XX_APPCORE0_H_ + + +/////////////////////////////////////////////////////////////////////////// +// wxx_appcore0.h +// This file contains the declarations of CGlobalLock and CWinApp. +// CWinApp is used start Win32++ and run the message loop. You should +// should inherit from this class to start Win32++ in your own application. + + +#include "wxx_setup.h" +#include "wxx_criticalsection.h" +#include "wxx_hglobal.h" +#include "wxx_messagepump0.h" + +namespace Win32xx +{ + + //////////////////////////////////////////////// + // Forward declarations. + // + class CArchive; + class CBitmap; + class CBrush; + class CClientDC; + class CClientDCEx; + class CDataExchange; + class CDialog; + class CDC; + class CDocker; + class CFont; + class CGDIObject; + class CImageList; + class CMDIChild; + class CMemDC; + class CMenu; + class CMenuBar; + class CPaintDC; + class CPalette; + class CPen; + class CPropertyPage; + class CRgn; + class CString; + class CWinApp; + class CWinThread; + class CWorkThread; + class CWindowDC; + class CWnd; + struct CDC_Data; + struct EnhMetaFileData; + struct MenuItemData; + struct MetaFileData; + struct TLSData; + + // Define the maximum size for strings. + constexpr int WXX_MAX_STRING_SIZE = 255; + + // Some useful smart pointer aliases + using DockPtr = std::unique_ptr; + using EnhMetaDataPtr = std::shared_ptr; + using MDIChildPtr = std::unique_ptr; + using MenuItemDataPtr = std::unique_ptr; + using MetaDataPtr = std::shared_ptr; + using PropertyPagePtr = std::unique_ptr; + using TLSDataPtr = std::unique_ptr; + using WinThreadPtr = std::unique_ptr; + using WorkThreadPtr = std::unique_ptr; + using WndPtr = std::unique_ptr; + + // A structure that contains the data members for CGDIObject. + struct CGDI_Data + { + // Constructor + CGDI_Data() : hGDIObject(nullptr), isManagedObject(false) {} + + HGDIOBJ hGDIObject; + bool isManagedObject; + }; + + // A structure that contains the data members for CImageList. + struct CIml_Data + { + // Constructor + CIml_Data() : images(nullptr), isManagedHiml(false) {} + + HIMAGELIST images; + bool isManagedHiml; + }; + + // A structure that contains the data members for CMenu. + struct CMenu_Data + { + // Constructor + CMenu_Data() : menu(nullptr), isManagedMenu(false) {} + + HMENU menu; + bool isManagedMenu; + }; + + // Used for Thread Local Storage (TLS) + struct TLSData + { + CWnd* pWnd; // Pointer to CWnd object for window creation + HWND mainWnd; // Handle to the main window for the thread (usually CFrame) + CMenuBar* pMenuBar; // Pointer to the CMenuBar object with the WH_MSGFILTER hook + + TLSData() : pWnd(nullptr), mainWnd(nullptr), pMenuBar(nullptr) {} // Constructor + }; + + + /////////////////////////////////////////////////////////////////// + // Acknowledgement: + // CGlobalLock is based on code by Rob Caldecott + // See: https://www.codeproject.com/Articles/16692/A-Template-Wrapper-for-GlobalLock + // + /////////////////////////////////////////////////////////////////// + + + /////////////////////////////////////////////////////////////////// + // CGlobaLock is a class template used to provide a self unlocking + // object to global memory. It is used to provide convenient access + // to the memory provided by hDevMode and hDevNames handles. + // The framework uses this class to eliminate the need to manually + // lock or unlock global memory. + // This class is typically used with a CHGlobal object but can also + // be used with a raw global memory handle. + // CDevMode and CDevNames are typedefs of this class. + template + class CGlobalLock + { + public: + // Constructors and Destructors + CGlobalLock() : m_h(nullptr), m_p(nullptr) {} + CGlobalLock(HANDLE h) : m_h(h) { Lock(); } + CGlobalLock(const CGlobalLock& rhs); + ~CGlobalLock() { Unlock(); } + + T* Get() const { return m_p; } // Returns the pointer + LPCTSTR c_str() const; // Returns the LPCTSTR (for DEVNAMES only) + LPTSTR GetString() const; // Returns the LPTSTR (for DEVNAMES only) + CString GetDeviceName() const; // Returns the printer name (for DEVNAMES only) + CString GetDriverName() const; // Returns the printer driver (for DEVNAMES only) + CString GetPortName() const; // Returns the printer port (for DEVNAMES only) + bool IsDefaultPrinter() const; // Returns true if this is the default printer (for DEVNAMES only) + + // operator overloads + operator T* () const { return m_p; } // Conversion operator to pointer + T* operator->() const { assert(m_p); return m_p; } // Pointer operator + T& operator*() const { assert(m_p); return *m_p; } // Dereference operator + CGlobalLock& operator= (const CGlobalLock& rhs); // Assignment operator + CGlobalLock& operator=(HANDLE h); // Assignment operator + + private: + void Lock(); + void Unlock(); + + HANDLE m_h; // The handle to lock/unlock + T* m_p; // Pointer returned by ::GlobalLock + }; + + + /////////////////////////////////////////////////////////////// + // CWinApp manages the application. Its constructor initializes + // the Win32++ framework. The Run function calls InitInstance, + // and starts the message loop on the main thread. + // There can only be one instance of CWinApp. + class CWinApp : public CMessagePump + { + // These provide access to CWinApp's private members: + friend class CDC; + friend class CDialog; + friend class CEnhMetaFile; + friend class CGDIObject; + friend class CImageList; + friend class CMenu; + friend class CMetaFile; + friend class CPropertyPage; + friend class CWinThread; + friend class CWnd; + friend CWinApp* GetApp(); + friend BOOL IsAppRunning(); + + public: + CWinApp(); + virtual ~CWinApp() override; + + // Operations + CWnd* GetCWndFromMap(HWND wnd); + const CHGlobal& GetHDevMode() const { return m_devMode; } + const CHGlobal& GetHDevNames() const { return m_devNames; } + HINSTANCE GetInstanceHandle() const { return m_instance; } + HWND GetMainWnd() const; + HINSTANCE GetResourceHandle() const { return (m_resource ? m_resource : m_instance); } + TLSData* GetTlsData() const; + HCURSOR LoadCursor(LPCTSTR resourceName) const; + HCURSOR LoadCursor(UINT cursorID) const; + HICON LoadIcon(LPCTSTR resourceName) const; + HICON LoadIcon(UINT iconID) const; + HANDLE LoadImage(LPCTSTR resourceName, UINT type, int cx, int cy, + UINT flags = LR_DEFAULTCOLOR) const; + HANDLE LoadImage(UINT imageID, UINT type, int cx, int cy, + UINT flags = LR_DEFAULTCOLOR) const; + HCURSOR LoadStandardCursor(LPCTSTR cursorName) const; + HICON LoadStandardIcon(LPCTSTR iconName) const; + void ResetPrinterMemory(); + HCURSOR SetCursor(HCURSOR cursor) const; + void SetMainWnd(HWND wnd) const; + void SetResourceHandle(HINSTANCE resource); + void UpdateDefaultPrinter(); + void UpdatePrinterMemory(HGLOBAL hDevMode, HGLOBAL hDevNames); + + private: + CWinApp(const CWinApp&) = delete; + CWinApp& operator=(const CWinApp&) = delete; + + void AddCDCDataToMap(HDC dc, std::weak_ptr pData); + void AddCGDIDataToMap(HGDIOBJ gdi, std::weak_ptr pData); + void AddCImlDataToMap(HIMAGELIST images, std::weak_ptr pData); + void AddCMenuDataToMap(HMENU menu, std::weak_ptr pData); + void AddCWndToMap(HWND wnd, CWnd* pWnd); + std::weak_ptr GetCDCData(HDC dc); + std::weak_ptr GetCGDIData(HGDIOBJ object); + std::weak_ptr GetCImlData(HIMAGELIST images); + std::weak_ptr GetCMenuData(HMENU menu); + void RemoveCWndFromMap(CWnd* pWnd); + void RemoveDCFromMap(HDC dc); + void RemoveGDIObjectFromMap(HGDIOBJ gdiObject); + void RemoveImageListFromMap(HIMAGELIST images); + void RemoveMenuFromMap(HMENU menu); + void SetCallback(); + void SetTlsData(); + + static CWinApp* SetnGetThis(CWinApp* pThis = nullptr, bool reset = false); + + std::unordered_map> m_mapCDCData; + std::unordered_map> m_mapCGDIData; + std::unordered_map> m_mapCImlData; + std::unordered_map> m_mapCMenuData; + std::unordered_map m_mapHWND; // maps window handles to CWnd objects + std::vector m_allTLSData; // vector of TLSData smart pointers, one for each thread + CCriticalSection m_appLock; // thread synchronization for CWinApp and TLS + CCriticalSection m_gdiLock; // thread synchronization for m_mapCDCData and m_mapCGDIData + CCriticalSection m_wndLock; // thread synchronization for m_mapHWND etc. + CCriticalSection m_printLock; // thread synchronization for printing + HINSTANCE m_instance; // handle to the application's instance + HINSTANCE m_resource; // handle to the application's resources + DWORD m_tlsData; // Thread Local Storage data + WNDPROC m_callback; // callback address of CWnd::StaticWndowProc + CHGlobal m_devMode; // Used by CPrintDialog and CPageSetupDialog + CHGlobal m_devNames; // Used by CPrintDialog and CPageSetupDialog + + public: + // Message strings used for exceptions. + + // No error message. + virtual CString MsgNoError() const; + + // Archive Messages. + virtual CString MsgArReadFail() const; + virtual CString MsgArNotCStringA() const; + virtual CString MsgArNotCStringW() const; + + // Thread and Semaphore Messages. + virtual CString MsgAppThread() const; + virtual CString MsgCriticalSection() const; + virtual CString MsgMtxEvent() const; + virtual CString MsgMtxMutex() const; + virtual CString MsgMtxSemaphore() const; + virtual CString MsgWndGlobalLock() const; + + // Winsock Messages. + virtual CString MsgSocWSAStartup() const; + virtual CString MsgSocWS2Dll() const; + + // Window Creation Messages. + virtual CString MsgWndCreate() const; + virtual CString MsgWndDialog() const; + virtual CString MsgIPControl() const; + virtual CString MsgWndPropertSheet() const; + virtual CString MsgRichEditDll() const; + virtual CString MsgTaskDialog() const; + + // Message strings used for files. + virtual CString MsgFileClose() const; + virtual CString MsgFileFlush() const; + virtual CString MsgFileLock() const; + virtual CString MsgFileOpen() const; + virtual CString MsgFileRead() const; + virtual CString MsgFileRename() const; + virtual CString MsgFileRemove() const; + virtual CString MsgFileLength() const; + virtual CString MsgFileUnlock() const; + virtual CString MsgFileWrite() const; + + // Message strings used for GDI. + virtual CString MsgGdiDC() const; + virtual CString MsgGdiIC() const; + virtual CString MsgGdiBitmap() const; + virtual CString MsgGdiBrush() const; + virtual CString MsgGdiFont() const; + virtual CString MsgGdiImageList() const; + virtual CString MsgGdiPalette() const; + virtual CString MsgGdiPen() const; + virtual CString MsgGdiRegion() const; + virtual CString MsgGdiGetDC() const; + virtual CString MsgGdiGetDCEx() const; + virtual CString MsgGdiSelObject() const; + virtual CString MsgGdiGetWinDC() const; + virtual CString MsgGdiBeginPaint() const; + + virtual CString MsgImageList() const; + virtual CString MsgMenu() const; + virtual CString MsgPrintFound() const; + + // DDX anomaly prompting message strings. + virtual CString MsgDDX_Byte() const; + virtual CString MsgDDX_Int() const; + virtual CString MsgDDX_Long() const; + virtual CString MsgDDX_Short() const; + virtual CString MsgDDX_Real() const; + virtual CString MsgDDX_UINT() const; + virtual CString MsgDDX_ULONG() const; + + // DDV formats and prompts. + virtual CString MsgDDV_IntRange() const; + virtual CString MsgDDV_UINTRange() const; + virtual CString MsgDDV_RealRange() const; + virtual CString MsgDDV_StringSize() const; + + // Message string used for time. + virtual CString MsgTimeValid() const; + + // Message used for CWinApp. + virtual CString MsgCWinApp() const; + virtual CString MsgTlsIndexes() const; + }; + + // Returns a pointer to the CWinApp object. + // Asserts if Win32++ hasn't been started. Declare a CWinApp object, + // or an object inherited from CWinApp to start Win32++. + inline CWinApp* GetApp() + { + CWinApp* pApp = CWinApp::SetnGetThis(); + assert(pApp); // This assert fails if Win32++ isn't started. + return pApp; + } + + // Returns true if TRUE if Win32++ has been started. Declare a CWinApp + // object, or an object inherited from CWinApp to start Win32++. + inline BOOL IsAppRunning() + { + return (CWinApp::SetnGetThis() != nullptr); + } + +} // namespace Win32xx + + +#endif // _WIN32XX_APPCORE0_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_archive.h b/packages/media/cpp/packages/Win32xx/include/wxx_archive.h new file mode 100644 index 00000000..9f150a46 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_archive.h @@ -0,0 +1,902 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////// +// Acknowledgement: +// +// Developed from code originally provided by: +// +// Robert C. Tausworthe +// email: robert.c.tausworthe@ieee.org +// +//////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////// +// Contents Description: +// The CArchive class is used to serialize and +// deserialize data. Data is streamed to and from the +// file specified by the user, using the >> and << +// operators. + +// Note: This CArchive doesn't read archive written by MFC's CArchive. + +// Differences between this CArchive and MFC's CArchive +// In this CArchive: +// - LPCTSTR strings retrieved from the archive exactly match the string +// saved to the archive. Strings can contain carriage return and line +// feed characters. These characters are not stripped. +// - CStrings retrieved from the archive exactly match the CString +// saved in the archive. CStrings can contain any character, including +// embedded null characters, line feeds and carriage returns. +// +// In MFC's CArchive: +// - LPCTSTR strings have carriage return characters stripped +// - LPCTSTR strings are terminated by a \r\n characters. + + +#ifndef _WIN32XX_ARCHIVE_H_ +#define _WIN32XX_ARCHIVE_H_ + +#include "wxx_wincore.h" +#include "wxx_file.h" + + +namespace Win32xx +{ + // An object used for serialization that can hold any type of data. + // Specify a pointer to the data, and the size of the data in bytes. + struct ArchiveObject + { + // member variables + UINT m_size; // not size_t as that is different in x86 and x64 + LPVOID m_pData; + + // Constructor + ArchiveObject(LPVOID pData, UINT size) : m_size(size), m_pData(pData) {} + }; + // A typical usage of ArchiveObject would be of the form: + // + // ArchiveObject ao(&Data, sizeof(Data)); + // ar << ao; or ar >> ao; + + + ////////////////////////////////////////////////////////////// + // CArchive serializes data to and from a file archive. + // CArchive uses the >> and << operator overloads to serialize + // the various data types to the archive. + class CArchive + { + using FilePtr = std::unique_ptr; + + public: + // Archive modes + enum Mode {store = 0, load = 1}; + + // Construction and destruction + CArchive(CFile& file, Mode mode); + CArchive(LPCTSTR fileName, Mode mode); + virtual ~CArchive(); + + // Method members + const CFile& GetFile(); + UINT GetObjectSchema() const; + bool IsLoading() const; + bool IsStoring() const; + void Read(void* buffer, UINT size); + LPTSTR ReadString(LPTSTR string, UINT max); + LPSTR ReadStringA(LPSTR string, UINT max); + LPWSTR ReadStringW(LPWSTR string, UINT max); + void SetObjectSchema(UINT schema); + void Write(const void* buffer, UINT size); + void WriteString(LPCTSTR string); + void WriteStringA(LPCSTR string); + void WriteStringW(LPCWSTR string); + + // Load operations + CArchive& operator<<(BYTE by); + CArchive& operator<<(WORD w); + CArchive& operator<<(LONG l); + CArchive& operator<<(LONGLONG ll); + CArchive& operator<<(ULONGLONG ull); + CArchive& operator<<(DWORD dw); + CArchive& operator<<(float f); + CArchive& operator<<(double d); + CArchive& operator<<(int i); + CArchive& operator<<(short w); + CArchive& operator<<(char ch); + CArchive& operator<<(unsigned u); + CArchive& operator<<(bool b); + CArchive& operator<<(const CStringA& string); + CArchive& operator<<(const CStringW& string); + CArchive& operator<<(const CString& string); + CArchive& operator<<(POINT pt); + CArchive& operator<<(RECT rc); + CArchive& operator<<(SIZE sz); + CArchive& operator<<(const ArchiveObject& ao); + CArchive& operator<<(const CObject& object); + CArchive& operator<<(wchar_t ch); + + // Store operations + CArchive& operator>>(BYTE& by); + CArchive& operator>>(WORD& w); + CArchive& operator>>(DWORD& dw); + CArchive& operator>>(LONG& l); + CArchive& operator>>(LONGLONG& ll); + CArchive& operator>>(ULONGLONG& ull); + CArchive& operator>>(float& f); + CArchive& operator>>(double& d); + CArchive& operator>>(int& i); + CArchive& operator>>(short& w); + CArchive& operator>>(char& ch); + CArchive& operator>>(unsigned& u); + CArchive& operator>>(bool& b); + CArchive& operator>>(CStringA& string); + CArchive& operator>>(CStringW& string); + CArchive& operator>>(CString& string); + CArchive& operator>>(POINT& pt); + CArchive& operator>>(RECT& rc); + CArchive& operator>>(SIZE& sz); + CArchive& operator>>(ArchiveObject& ao); + CArchive& operator>>(CObject& object); + CArchive& operator>>(wchar_t& ch); + + private: + CArchive(const CArchive&) = delete; + CArchive& operator=(const CArchive&) = delete; + + // private data members + CFile* m_pFile; // pointer to the archive CFile + FilePtr m_file; // unique_ptr to locally created CFile + UINT m_schema; // archive version schema + bool m_isStoring; // archive direction switch + }; + +} // namespace Win32xx + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + ////////////////////////////////////// + // Definitions for the CArchive class. + // + + // Constructs a CArchive object. + // The specified file must already be open for loading or storing. + inline CArchive::CArchive(CFile& file, Mode mode) : m_schema(UINT(-1)) + { + m_pFile = &file; + + if (mode == load) + { + m_isStoring = false; + } + else + { + m_isStoring = true; + } + } + + // Constructs a CArchive object. + // A file with the specified name is created for storing (if required), and + // also opened. A failure to open the file will throw an exception. + inline CArchive::CArchive(LPCTSTR fileName, Mode mode) : m_pFile(0), + m_schema(UINT(-1)) + { + + if (mode == load) + { + // Open the archive for loading. + m_file = std::make_unique(fileName, CFile::modeRead); + m_isStoring = false; + } + else + { + // Open the archive for storing. Creates file if required. + m_file = std::make_unique(fileName, CFile::modeCreate); + m_isStoring = true; + } + + m_pFile = m_file.get(); + } + + inline CArchive::~CArchive() + { + if (m_pFile) + { + // Test if the file is open. + if (m_pFile->GetHandle()) + { + // Flush if in write mode. + if (IsStoring()) + m_pFile->Flush(); + + m_pFile->Close(); + } + } + } + + // Returns the file associated with the archive. + inline const CFile& CArchive::GetFile() + { + assert(m_pFile); + return *m_pFile; + } + + // Returns the archived data schema. This acts as a version number on + // the format of the archived data for special handling when there + // are several versions of the serialized data to be accommodated + // by the application. + inline UINT CArchive::GetObjectSchema() const + { + return m_schema; + } + + // Returns the current sense of serialization, true if the archive is + // being loaded. + inline bool CArchive::IsLoading() const + { + return !m_isStoring; + } + + // Returns the current sense of serialization, true if the archive is + // being stored. + inline bool CArchive::IsStoring() const + { + return m_isStoring; + } + + // Reads size bytes from the open archive file into the given buffer. + // Throws an exception if not successful. + inline void CArchive::Read(void* buffer, UINT size) + { + // read, simply and in binary mode, the size into the buffer + assert(m_pFile); + + if (m_pFile) + { + UINT nBytes = m_pFile->Read(buffer, size); + if (nBytes != size) + throw CFileException(m_pFile->GetFilePath(), GetApp()->MsgArReadFail()); + } + } + + // Records the archived data schema number. This acts as a version number + // on the format of the archived data for special handling when there + // are several versions of the serialized data to be accommodated + // by the application. + inline void CArchive::SetObjectSchema(UINT schema) + { + m_schema = schema; + } + + // Writes size characters of from the buffer into the open archive file. + // Throws an exception if unsuccessful. + inline void CArchive::Write(const void* buffer, UINT size) + { + // write size characters in buffer to the file + assert(m_pFile); + m_pFile->Write(buffer, size); + } + + // Writes the BYTE variable into the archive file. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator<<(BYTE b) + { + ArchiveObject ob(&b, sizeof(b)); + *this << ob; + return *this; + } + + // Writes the WORD variable into the archive file. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator<<(WORD w) + { + ArchiveObject ob(&w, sizeof(w)); + *this << ob; + return *this; + } + + // Writes the LONG variable into the archive file. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator<<(LONG l) + { + ArchiveObject ob(&l, sizeof(l)); + *this << ob; + return *this; + } + + // Writes the LONGLONG variable into the archive file. + // Throw an exception if an error occurs. + inline CArchive& CArchive::operator<<(LONGLONG ll) + + { + ArchiveObject ob(&ll, sizeof(ll)); + *this << ob; + return *this; + } + + // Writes the ULONGLONG variable into the archive file. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator<<(ULONGLONG ull) + { + ArchiveObject ob(&ull, sizeof(ull)); + *this << ob; + return *this; + } + + // Writes the DWORD variable into the archive file. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator<<(DWORD dw) + { + ArchiveObject ob(&dw, sizeof(dw)); + *this << ob; + return *this; + } + + // Writes the float variable into the archive file. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator<<(float f) + { + ArchiveObject ob(&f, sizeof(f)); + *this << ob; + return *this; + } + + // Writes the double variable into the archive file. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator<<(double d) + { + ArchiveObject ob(&d, sizeof(d)); + *this << ob; + return *this; + } + + // Writes the int variable into the archive file. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator<<(int i) + { + ArchiveObject ob(&i, sizeof(i)); + *this << ob; + return *this; + } + + // Writes the short variable into the archive file. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator<<(short s) + { + ArchiveObject ob(&s, sizeof(s)); + *this << ob; + return *this; + } + + // Writes the char variable into the archive file. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator<<(char c) + { + ArchiveObject ob(&c, sizeof(c)); + *this << ob; + return *this; + } + + // Writes the wchar_t variable into the archive file. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator<<(wchar_t ch) + { + ArchiveObject ob(&ch, sizeof(ch)); + *this << ob; + return *this; + } + + // Writes the unsigned variable into the archive file. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator<<(unsigned u) + { + ArchiveObject ob(&u, sizeof(u)); + *this << ob; + return *this; + } + + // Writes the bool variable into the archive file. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator<<(bool b) + { + ArchiveObject ob(&b, sizeof(b)); + *this << ob; + return *this; + } + + // Writes the CStringA variable into the archive file. + // The CStringA can contain any characters including embedded nulls. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator<<(const CStringA& string) + { + int chars = string.GetLength(); + bool isUnicode = false; + + // Store the Unicode state and number of characters in the archive. + *this << isUnicode; + *this << chars; + + Write(string.c_str(), chars*sizeof(CHAR)); + return *this; + } + + // Writes the CStringW variable into the archive file. + // The CStringW can contain any characters including embedded nulls. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator<<(const CStringW& string) + { + int chars = string.GetLength(); + bool isUnicode = true; + + // Store the Unicode state and number of characters in the archive. + *this << isUnicode; + *this << chars; + + Write(string.c_str(), chars*sizeof(WCHAR)); + return *this; + } + + // Writes the CString variable into the archive file. + // The CString can contain any characters including embedded nulls. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator<<(const CString& string) + { + int chars = string.GetLength(); + bool isUnicode = (sizeof(TCHAR) == sizeof(WCHAR)); + + // Store the Unicode state and number of characters in the archive. + *this << isUnicode; + *this << chars; + + Write(string.c_str(), chars*sizeof(TCHAR)); + return *this; + } + + // Writes the POINT variable into the archive file. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator<<(POINT pt) + { + UINT size = sizeof(pt); + Write(&size, sizeof(size)); + Write(&pt, size); + return *this; + } + + // Writes the RECT variable into the archive file. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator<<(RECT rc) + { + UINT size = sizeof(rc); + Write(&size, sizeof(size)); + Write(&rc, size); + return *this; + } + + // Writes the SIZE variable into the archive file. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator<<(SIZE sz) + { + UINT size = sizeof(sz); + Write(&size, sizeof(size)); + Write(&sz, size); + return *this; + } + + // Writes arbitrary CArchive object into this CArchive as bytes. + // Throws an exception if an error occurs.. + inline CArchive& CArchive::operator<<(const ArchiveObject& ao) + { + Write(&ao.m_size, sizeof(ao.m_size)); + Write(ao.m_pData, ao.m_size); + return *this; + } + + // Reads a BYTE from the archive. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator>>(BYTE& b) + { + ArchiveObject ob(&b, sizeof(b)); + *this >> ob; + return *this; + } + + // Reads a WORD from the archive. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator>>(WORD& w) + { + ArchiveObject ob(&w, sizeof(w)); + *this >> ob; + return *this; + } + + // Reads a LONG from the archive. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator>>(LONG& l) + { + ArchiveObject ob(&l, sizeof(l)); + *this >> ob; + return *this; + } + + // Reads a LONGLONG from the archive. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator>>(LONGLONG& ll) + { + ArchiveObject ob(&ll, sizeof(ll)); + *this >> ob; + return *this; + } + + // Reads a ULONGLONG from the archive. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator>>(ULONGLONG& ull) + { + ArchiveObject ob(&ull, sizeof(ull)); + *this >> ob; + return *this; + } + + // Reads a DWORD from the archive. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator>>(DWORD& dw) + { + ArchiveObject ob(&dw, sizeof(dw)); + *this >> ob; + return *this; + } + + // Reads a float from the archive. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator>>(float& f) + { + ArchiveObject ob(&f, sizeof(f)); + *this >> ob; + return *this; + } + + // Reads a double from the archive. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator>>(double& d) + { + ArchiveObject ob(&d, sizeof(d)); + *this >> ob; + return *this; + } + + // Reads an int from the archive. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator>>(int& i) + { + ArchiveObject ob(&i, sizeof(i)); + *this >> ob; + return *this; + } + + // Reads a short from the archive. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator>>(short& i) + { + ArchiveObject ob(&i, sizeof(i)); + *this >> ob; + return *this; + } + + // Reads a char from the archive. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator>>(char& c) + { + ArchiveObject ob(&c, sizeof(c)); + *this >> ob; + return *this; + } + + // Reads a wchar_t from the archive. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator>>(wchar_t& ch) + { + ArchiveObject ob(&ch, sizeof(ch)); + *this >> ob; + return *this; + } + + // Reads an unsigned int from the archive. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator>>(unsigned& u) + { + ArchiveObject ob(&u, sizeof(u)); + *this >> ob; + return *this; + } + + // Reads an bool from the archive. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator>>(bool& b) + { + ArchiveObject ob(&b, sizeof(b)); + *this >> ob; + return *this; + } + + // Reads a CString from the archive. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator>>(CStringA& string) + { + bool isUnicode; + int chars; + + // Retrieve the Unicode state and number of characters from the archive. + *this >> isUnicode; + *this >> chars; + assert(chars >= 0); + + if (isUnicode) + throw CFileException(m_pFile->GetFilePath(), GetApp()->MsgArNotCStringA()); + + Read(string.GetBuffer(chars), static_cast(chars)); + string.ReleaseBuffer(chars); + + return *this; + } + + // Reads a CStringW from the archive. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator>>(CStringW& string) + { + bool isUnicode; + int chars; + + // Retrieve the Unicode state and number of characters from the archive. + *this >> isUnicode; + *this >> chars; + assert(chars >= 0); + + if (!isUnicode) + throw CFileException(m_pFile->GetFilePath(), GetApp()->MsgArNotCStringW()); + + Read(string.GetBuffer(chars), static_cast(chars) * 2); + string.ReleaseBuffer(chars); + + return *this; + } + + // Reads a CString from the archive. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator>>(CString& string) + { + bool isUnicode; + int chars; + + // Retrieve the Unicode state and number of characters from the archive. + *this >> isUnicode; + *this >> chars; + assert(chars >= 0); + + if (isUnicode) + { + // Use a vector to create our WCHAR array. + std::vector vWChar(size_t(chars) + 1, L'\0'); + WCHAR* buf = vWChar.data(); + + Read(buf, static_cast(chars)*2); + +#ifdef UNICODE + memcpy(string.GetBuffer(chars), buf, size_t(chars)*2); +#else + // Convert the archive string from Wide to Ansi. + WideCharToMultiByte(CP_ACP, 0, buf, chars, string.GetBuffer(chars), chars, nullptr, nullptr); +#endif + + string.ReleaseBuffer(chars); + } + else + { + // Use a vector to create our char array. + std::vector vChar(size_t(chars) + 1, '\0'); + char* buf = vChar.data(); + + Read(buf, static_cast(chars)); + +#ifdef UNICODE + // Convert the archive string from Ansi to Wide. + MultiByteToWideChar(CP_ACP, 0, buf, chars, string.GetBuffer(chars), int(chars)); +#else + memcpy(string.GetBuffer(chars), buf, chars); +#endif + + string.ReleaseBuffer(chars); + } + + return *this; + } + + // Reads a POINT from the archive. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator>>(POINT& pt) + { + ArchiveObject ob(&pt, sizeof(pt)); + *this >> ob; + return *this; + } + + // Reads a RECT from the archive. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator>>(RECT& rc) + { + ArchiveObject ob(&rc, sizeof(rc)); + *this >> ob; + return *this; + } + + // Reads a SIZE from the archive. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator>>(SIZE& sz) + { + ArchiveObject ob(&sz, sizeof(sz)); + *this >> ob; + return *this; + } + + // Reads an arbitrary CArchive object into this CArchive as bytes. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator>>(ArchiveObject& ao) + { + assert(m_pFile); + UINT size; + Read(&size, sizeof(size)); + if (size != ao.m_size) + { + throw CFileException(m_pFile->GetFilePath(), GetApp()->MsgArReadFail()); + } + + Read(ao.m_pData, ao.m_size); + return *this; + } + + // Writes a CObject to the archive. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator<<(const CObject& object) + { + ((CObject&)object).Serialize(*this); + return *this; + } + + // Reads a CObject from the archive. + // Throws an exception if an error occurs. + inline CArchive& CArchive::operator>>(CObject& object) + { + object.Serialize(*this); + return *this; + } + + // Reads at most max-1 TCHAR characters from the archive and stores it + // in a string. Strings read from the archive are converted from ANSI + // or Unicode to TCHAR if required, and are null terminated. + // The size (in characters) of the string array must be max or greater. + // Throws an exception if an error occurs. + inline LPTSTR CArchive::ReadString(LPTSTR string, UINT max) + { + assert (max > 0); + + CString str; + *this >> str; + StrCopy(string, str.c_str(), max); + return string; + } + + // Reads at most max-1 TCHAR characters from the archive and store it + // in a string. Strings read from the archive are converted from ANSI + // or Unicode to TCHAR if required, and are null terminated. + // The size (in characters) of the string array must be max or greater. + // Throws an exception if an error occurs. + inline LPSTR CArchive::ReadStringA(LPSTR string, UINT max) + { + assert (max > 0); + + CStringA str; + *this >> str; + StrCopyA(string, str.c_str(), max); + return string; + } + + // Reads at most max-1 TCHAR characters from the archive and store it + // in a string. Strings read from the archive are converted from ANSI + // or Unicode to TCHAR if required, and are null terminated. + // The size (in characters) of the string array must be max or greater. + // Throws an exception if an error occurs. + inline LPWSTR CArchive::ReadStringW(LPWSTR string, UINT max) + { + assert (max > 0); + + CStringW str; + *this >> str; + StrCopyW(string, str.c_str(), max); + return string; + } + + // Writes the LPCTSTR string into the archive file. + // The string must be null terminated. + // Throws an exception if an error occurs. + inline void CArchive::WriteString(LPCTSTR string) + { + int chars = lstrlen(string); + bool isUnicode = (sizeof(TCHAR) == sizeof(WCHAR)); + + // Store the Unicode state and number of characters in the archive + *this << isUnicode; + *this << chars; + + Write(string, chars*sizeof(TCHAR)); + } + + // Writes the LPCSTR string into the archive file. + // The string must be null terminated. + // Throws an exception if an error occurs. + inline void CArchive::WriteStringA(LPCSTR string) + { + int chars = lstrlenA(string); + bool isUnicode = false; + + // Store the Unicode state and number of characters in the archive + *this << isUnicode; + *this << chars; + + Write(string, chars*sizeof(CHAR)); + } + + // Writes the LPCWSTR string into the archive file. + // The string must be null terminated. + // Throws an exception if an error occurs. + inline void CArchive::WriteStringW(LPCWSTR string) + { + int chars = lstrlenW(string); + bool isUnicode = true; + + // Store the Unicode state and number of characters in the archive + *this << isUnicode; + *this << chars; + + Write(string, chars*sizeof(WCHAR)); + } + +} // namespace Win32xx + + +#endif // _WIN32XX_ARCHIVE_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_commondlg.h b/packages/media/cpp/packages/Win32xx/include/wxx_commondlg.h new file mode 100644 index 00000000..a365102f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_commondlg.h @@ -0,0 +1,1632 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////// +// Acknowledgement: +// +// Developed from code originally provided by: +// +// Robert C. Tausworthe +// email: robert.c.tausworthe@ieee.org +// +//////////////////////////////////////////////////////// + +#ifndef _WIN32XX_COMMONDLG_H_ +#define _WIN32XX_COMMONDLG_H_ + +#include "wxx_dialog.h" +#include "wxx_richedit.h" + + +/////////////////////////////////////////////////////////////////// +// Definitions of the CCommonDialog, CColorDialog, CFileDialog, +// CFindReplaceDialog, and CFontDialog classes. +// +// CCommonDialog is the base class for all common dialogs. +// CColorDialog supports the color common dialog. +// CFileDialog supports the FileOpen and FileSave common dialogs. +// CFindReplaceDialog supports the Find and Replace common dialogs. +// CFontDialog supports the Font common dialog. +// +// Note: A CWinException is thrown if the dialog can't be displayed. +// Use CWinException's GetMessageID to retrieve CommDlgExtendedError. + + + +namespace Win32xx +{ + // Registered message used by common dialogs + // Used by common dialogs. Sent when the user clicks the Help button. + const UINT UWM_HELPMSGSTRING = ::RegisterWindowMessage(HELPMSGSTRING); + + // Used by common dialogs. Sent when the user specifies a file name and + // clicks the OK button. + const UINT UWM_FILEOKSTRING = ::RegisterWindowMessage(FILEOKSTRING); + + // Used by the File common dialog. Sent when the selection changes in + // any of the list boxes or combo boxes. + const UINT UWM_LBSELCHSTRING = ::RegisterWindowMessage(LBSELCHSTRING); + + // Used by the File common dialog. Sent if a sharing violation occurs for + // the selected file when the user clicks the OK button. + const UINT UWM_SHAREVISTRING = ::RegisterWindowMessage(SHAREVISTRING); + + // Used by the Find/Replace common dialog. Sent when the user clicks the + // Find Next, Replace, or Replace All button, or closes the dialog box. + const UINT UWM_FINDMSGSTRING = ::RegisterWindowMessage(FINDMSGSTRING); + + + ////////////////////////////////////////////////////////// + // CCommonDialog is the base class for all common dialogs. + class CCommonDialog : public CDialog + { + public: + CCommonDialog() = default; + virtual ~CCommonDialog() override = default; + + protected: + virtual void OnCancel() override {} // A required override. + virtual void OnClose() override {} // A required override. + virtual void OnHelpButton(); + virtual BOOL OnInitDialog() override; + virtual void OnOK() override {} // A required override. + + // static callback + static INT_PTR CALLBACK CDHookProc(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam); + + private: + CCommonDialog(const CCommonDialog&) = delete; + CCommonDialog& operator=(const CCommonDialog&) = delete; + }; + + + ////////////////////////////////////////////////////////////////// + // CColorDialog manages the Color dialog box that enables the user + // to select a color. + class CColorDialog : public CCommonDialog + { + public: + CColorDialog(COLORREF initColor = 0, DWORD flags = 0); + virtual ~CColorDialog() override = default; + + virtual INT_PTR DoModal(HWND owner = nullptr) override; + COLORREF GetColor() const { return m_cc.rgbResult; } + COLORREF* GetCustomColors() { return m_customColors; } + const CHOOSECOLOR& GetParameters() const { return m_cc; } + void SetColor(COLORREF clr) { m_cc.rgbResult = clr; } + void SetCustomColors(const COLORREF* pColors = nullptr); + void SetParameters(const CHOOSECOLOR& cc); + + protected: + virtual INT_PTR DialogProc(UINT, WPARAM, LPARAM) override; + + // Not intended to be overridden. + INT_PTR DialogProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) override; + + private: + CColorDialog(const CColorDialog&) = delete; + CColorDialog& operator=(const CColorDialog&) = delete; + + CHOOSECOLOR m_cc; // ChooseColor parameters + COLORREF m_customColors[16]; // Custom colors array + }; + + + /////////////////////////////////////////////////////// + // CFileDialog manages the file open and save-as common + // dialog boxes. + class CFileDialog : public CCommonDialog + { + public: + + // Constructor/destructor + CFileDialog (BOOL isOpenFileDialog = TRUE, + LPCTSTR defExt = nullptr, + LPCTSTR fileName = nullptr, + DWORD flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + LPCTSTR filter = nullptr ); + + virtual ~CFileDialog() override = default; + + // Operations + virtual INT_PTR DoModal(HWND owner = nullptr) override; + + // methods valid after successful DoModal() + CString GetFileName() const; + CString GetFileExt() const; + CString GetFileTitle() const; + CString GetFolderPath() const; + CString GetPathName() const; + const OPENFILENAME& GetParameters() const { return m_ofn; } + + // Methods used to set setting parameters before calling DoModal. + BOOL IsOpenFileDialog() const { return m_isOpenFileDialog; } + void SetDefExt(LPCTSTR ext); + void SetFileName(LPCTSTR fileName); + void SetFilter(LPCTSTR filter); + void SetParameters(const OPENFILENAME& ofn); + void SetTitle(LPCTSTR title); + + // Enumerates multiple file selections. + CString GetNextPathName(int& pos) const; + + protected: + virtual INT_PTR DialogProc(UINT, WPARAM, LPARAM) override; + virtual void OnFileNameChange(); + virtual LRESULT OnFileNameOK(); + virtual void OnFolderChange(); + virtual void OnInitDone(); + virtual void OnLBSelChangedNotify(int boxID, int curSel, UINT code); + virtual LRESULT OnNotify(WPARAM, LPARAM) override; + virtual LRESULT OnShareViolation(LPCTSTR pathName); + virtual void OnTypeChange(); + + // Not intended to be overridden. + INT_PTR DialogProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) override; + + private: + CFileDialog(const CFileDialog&) = delete; + CFileDialog& operator=(const CFileDialog&) = delete; + + BOOL m_isOpenFileDialog; // TRUE = open, FALSE = save + CString m_filter; // File filter string + CString m_fileName; // File name string + CString m_title; // Dialog title + CString m_defExt; // Default extension string + OPENFILENAME m_ofn; // OpenFileName parameters + }; + + + //////////////////////////////////////////////////////////////// + // CFileDialog manages the Find/FindReplace modeless dialog box. + class CFindReplaceDialog : public CCommonDialog + { + public: + // constructor and destructor + CFindReplaceDialog(BOOL isFindDialogOnly = TRUE); + virtual ~CFindReplaceDialog() override = default; + + virtual HWND Create(HWND parent = nullptr) override; + virtual BOOL Create(BOOL isFindDialogOnly, + LPCTSTR findWhat, + LPCTSTR replaceWith = nullptr, + DWORD flags = FR_DOWN, + HWND parent = nullptr); + + // Operations: + BOOL FindNext() const; // TRUE = find next + CString GetFindString() const; // get find string + CString GetReplaceString() const; // get replacement string + const FINDREPLACE& GetParameters() const { return m_fr; } + BOOL IsFindDialogOnly() const { return m_isFindDialogOnly; } + BOOL IsTerminating() const; // TRUE = terminate dialog + BOOL MatchCase() const; // TRUE = matching case + BOOL MatchWholeWord() const; // TRUE = whole words only + BOOL ReplaceAll() const; // TRUE = all occurrences + BOOL ReplaceCurrent() const; // TRUE = current string + BOOL SearchDown() const; // TRUE = down, FALSE = up + void SetParameters(const FINDREPLACE& fr); + + static CFindReplaceDialog* GetNotifier(LPARAM lparam); + + protected: + virtual INT_PTR DialogProc(UINT, WPARAM, LPARAM) override; + virtual void OnDestroy() override { Destroy(); } + + // Not intended to be overridden + INT_PTR DialogProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) override; + + private: + CFindReplaceDialog(const CFindReplaceDialog&) = delete; + CFindReplaceDialog& operator=(const CFindReplaceDialog&) = delete; + + FINDREPLACE m_fr; // FindReplace parameters + BOOL m_isFindDialogOnly; // TRUE for a find only dialog + CString m_findWhat; // The Find string + CString m_replaceWith; // The Replace string + }; + + + //////////////////////////////////////////////// + // CFontDialog manages a dialog box that allows + // users to select a font. + class CFontDialog : public CCommonDialog + { + public: + CFontDialog(const LOGFONT& initial, DWORD flags = 0, HDC printer = nullptr); + CFontDialog(const CHARFORMAT& charformat, DWORD flags = 0, HDC printer = nullptr); + CFontDialog(DWORD flags = 0, HDC printer = nullptr); + + virtual ~CFontDialog() override = default; + + virtual INT_PTR DoModal(HWND owner = nullptr) override; + CHARFORMAT GetCharFormat() const; + COLORREF GetColor() const { return m_cf.rgbColors;} + CString GetFaceName() const { return m_logFont.lfFaceName;} + LOGFONT GetLogFont() const { return m_logFont;} + const CHOOSEFONT& GetParameters() const { return m_cf; } + int GetSize() const; + CString GetStyleName() const { return m_styleName;} + long GetWeight() const { return m_logFont.lfWeight;} + BOOL IsBold() const { return (m_logFont.lfWeight >= FW_SEMIBOLD);} + BOOL IsItalic() const { return m_logFont.lfItalic;} + BOOL IsStrikeOut() const { return m_logFont.lfStrikeOut;} + BOOL IsUnderline() const { return m_logFont.lfUnderline;} + void SetColor(COLORREF color) { m_cf.rgbColors = color;} + void SetParameters(const CHOOSEFONT& cf); + + protected: + virtual INT_PTR DialogProc(UINT, WPARAM, LPARAM) override; + virtual void OnOK() override; + + // Not intended to be overridden. + INT_PTR DialogProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) override; + + private: + CFontDialog(const CFontDialog&) = delete; + CFontDialog& operator=(const CFontDialog&) = delete; + DWORD FillInLogFont(const CHARFORMAT& cf); + + // private data + LOGFONT m_logFont; // Font characteristics + CHOOSEFONT m_cf; // ChooseFont parameters + CString m_styleName; // Style name on the dialog + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + /////////////////////////////////////////// + // Definitions for the CCommonDialog class. + // + + // Override this function to respond to the help button. The common dialog + // requires the appropriate flag to be specified before a help button + // is displayed. + inline void CCommonDialog::OnHelpButton() + { + } + + // Called when the dialog is initialized. Override it in your derived class + // to automatically perform tasks. The return value is used by WM_INITDIALOG + inline BOOL CCommonDialog::OnInitDialog() + { + return TRUE; + } + + // The callback function for the common dialog's hook procedure. Messages + // intercepted by the hook procedure are processed here, and forwarded + // on to the virtual DialogProc function. + inline INT_PTR CALLBACK CCommonDialog::CDHookProc(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam) + { + // Find the CWnd pointer mapped to this HWND + CCommonDialog* pCommonDlg = static_cast(GetCWndPtr(wnd)); + if (pCommonDlg == nullptr) + { + // The HWND wasn't in the map, so add it now. + TLSData* pTLSData = GetApp()->GetTlsData(); + assert(pTLSData); + if (!pTLSData) return 0; + + // Retrieve pointer to CWnd object from Thread Local Storage TLS. + pCommonDlg = static_cast(pTLSData->pWnd); + if (pCommonDlg != nullptr) + { + pTLSData->pWnd = nullptr; + + // Store the window pointer in the HWND map. + pCommonDlg->m_wnd = wnd; + pCommonDlg->AddToMap(); + } + } + + assert(pCommonDlg != nullptr); + if (pCommonDlg == nullptr) + { + // Got a message for a window that's not in the map. + return 0; + } + + return pCommonDlg->DialogProc(msg, wparam, lparam); + } + + + ////////////////////////////////////////// + // Definitions for the CColorDialog class. + // + + // Construct a CColorDialog object. The initial color, and flags for the + // CHOOSECOLOR struct can be specified. Refer to the description of the + // CHOOSECOLOR struct in the Windows API documentation. + inline CColorDialog::CColorDialog(COLORREF initColor /* = 0 */, DWORD flags /* = 0 */) + { + // Set the parameters in the CHOOSECOLOR struct. + m_cc = {}; + m_cc.rgbResult = initColor; + m_cc.Flags = flags; + + // Set all custom colors to white + for (int i = 0; i <= 15; ++i) + m_customColors[i] = RGB(255,255,255); + + // Enable the hook procedure for the help button + if (m_cc.Flags & CC_SHOWHELP) + m_cc.Flags |= CC_ENABLEHOOK; + + // Set the CHOOSECOLOR struct parameters to safe values + SetParameters(m_cc); + } + + // Dialog procedure for the Color dialog. Override this function to + // customize the message handling. + inline INT_PTR CColorDialog::DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) + { + // Message intercepted by the hook procedure are passed here. + // Note: OnCancel and OnOK are not called here. They are called by DoModal + // in response to value returned by called by ChooseColor. + + // A typical function might look like this: + + // switch (msg) + // { + // case MESSAGE1: // Some Windows API message + // OnMessage1(); // A user defined function + // break; // Also do default processing + // case MESSAGE2: + // OnMessage2(); + // return x; // Don't do default processing, but instead return + // // a value recommended by the Windows API documentation + // } + + // Always pass unhandled messages on to DialogProcDefault + return DialogProcDefault(msg, wparam, lparam); + } + + // The Default message handling for CColorDialog. Don't override this + // function, override DialogProc instead. + // Note: OnCancel and OnOK are called by DoModal. + inline INT_PTR CColorDialog::DialogProcDefault(UINT msg, WPARAM wparam, LPARAM) + { + switch (msg) + { + case WM_INITDIALOG: return OnInitDialog(); + case WM_COMMAND: if (LOWORD(wparam) == pshHelp) OnHelpButton(); + } + + // Return 0 to allow default processing of the message. + return 0; + } + + // Display the ChooseColor common dialog box and select the current color. + // An exception is thrown if the dialog box isn't created. + inline INT_PTR CColorDialog::DoModal(HWND owner /* = nullptr */) + { + assert(!IsWindow()); // Only one window per CWnd instance allowed + + // Retrieve this thread's TLS data + TLSData* pTLSData = GetApp()->GetTlsData(); + + // Create the modal dialog + pTLSData->pWnd = this; + + m_cc.hwndOwner = owner; + + // Invoke the control and save the result on success. + BOOL isValid = ::ChooseColor(&m_cc); + + m_wnd = nullptr; + + if (!isValid) + { + int error = static_cast(CommDlgExtendedError()); + if ((error != 0) && (error != CDERR_DIALOGFAILURE)) + // Ignore the exception caused by closing the dialog. + throw CWinException(GetApp()->MsgWndDialog(), error); + + OnCancel(); + return IDCANCEL; + } + + OnOK(); + + // Prepare the CWnd for reuse. + Cleanup(); + + return IDOK; + } + + // The pColors parameter is a pointer to an array of 16 COLORREF. + // If the pColors is nullptr, all custom colors are set to white, + // otherwise they are set to the colors specified in the pColors array. + inline void CColorDialog::SetCustomColors(const COLORREF* pColors /* = nullptr */) + { + for (UINT i = 0; i < 16; i++) + { + COLORREF clr = pColors ? pColors[i] : RGB(255,255,255); + m_customColors[i] = clr; + } + } + + // Sets the various parameters of the CHOOSECOLOR struct. + // The parameters are set to sensible values. + inline void CColorDialog::SetParameters(const CHOOSECOLOR& cc) + { + m_cc.lStructSize = sizeof(m_cc); + m_cc.hwndOwner = nullptr; // Set this in DoModal + m_cc.hInstance = cc.hInstance; + m_cc.rgbResult = cc.rgbResult; + m_cc.lpCustColors = m_customColors; + m_cc.Flags = cc.Flags; + m_cc.lCustData = cc.lCustData; + m_cc.lpfnHook = reinterpret_cast(CDHookProc); + m_cc.lpTemplateName = cc.lpTemplateName; + } + + + ///////////////////////////////////////// + // Definitions for the CFileDialog class. + // + + // Construct a CFileDialog object. isOpenFileDialog specifies the type of + // dialog box, OpenFile or SaveFile. The file's default extent and name can + // be specified, along with the flags for the OPENFILENAME struct. + // The pFilter contains a series of string pairs that specify file filters, + // separated by '\0' or '|' chars. Refer to the description of the OPENFILENAME + // struct in the Windows API documentation. + inline CFileDialog::CFileDialog(BOOL isOpenFileDialog /* = TRUE */, + LPCTSTR defExt /* = nullptr */, + LPCTSTR fileName /* = nullptr */, + DWORD flags /* = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT */, + LPCTSTR filter /* = nullptr */) + { + // Set the open/saveas toggle. + m_isOpenFileDialog = isOpenFileDialog; + + // Assign the OPENFILENAME struct. + m_ofn = {}; + m_ofn.lpstrFile = const_cast(fileName); + m_ofn.lpstrFilter = filter; + m_ofn.lpstrDefExt = defExt; + m_ofn.Flags = flags; + + // Enable the hook procedure for the help button. + if (m_ofn.Flags & OFN_SHOWHELP) + m_ofn.Flags |= OFN_ENABLEHOOK; + + // Safely set the remaining OPENFILENAME values. + SetParameters(m_ofn); + } + + // Dialog procedure for the FileOpen and FileSave dialogs. Override + // this function to customize the message handling. + inline INT_PTR CFileDialog::DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) + { + // Message intercepted by the hook procedure are passed here. + // Note: OnCancel and OnOK are not called here. They are called by DoModal + // in response to value returned by called by GetOpenFileName or GetSaveFileName. + + // A typical function might look like this: + + // switch (msg) + // { + // case MESSAGE1: // Some Windows API message + // OnMessage1(); // A user defined function + // break; // Also do default processing + // case MESSAGE2: + // OnMessage2(); + // return x; // Don't do default processing, but instead return + // // a value recommended by the Windows API documentation + // } + + // Always pass unhandled messages on to DialogProcDefault + return DialogProcDefault(msg, wparam, lparam); + } + + // The Default message handling for CFileDialog. Don't override this function, + // override DialogProc instead. + // Note: OnCancel and OnOK are called by DoModal. + inline INT_PTR CFileDialog::DialogProcDefault(UINT message, WPARAM wparam, LPARAM lparam) + { + switch (message) + { + case WM_INITDIALOG: + { + // handle the initialization message + return OnInitDialog(); + } + + case WM_COMMAND: + { + // Handle the HELP button for old-style file dialogs. + if (LOWORD(wparam) == pshHelp) + OnHelpButton(); + + return 0; + } + + case WM_NOTIFY: + { + // Handle messages for Explorer-style hook procedures. + if (m_ofn.Flags & OFN_EXPLORER) + { + LRESULT result = OnNotify(wparam, lparam); + SetWindowLongPtr(DWLP_MSGRESULT, result); + return result; + } + + return 0; + } + } + + // Dispatch special open/save file dialog messages. + if (message == UWM_HELPMSGSTRING) + { + // Handle the HELP button for old-style file dialogs. + // (This alternate handler may still be used in some systems.) + OnHelpButton(); + return 0; + } + + if (message == UWM_LBSELCHSTRING) + { + // Handle the registered list box selection change notifications. + OnLBSelChangedNotify(static_cast(wparam), LOWORD(lparam), HIWORD(lparam)); + return 0; + } + + if (message == UWM_SHAREVISTRING) + { + // Handle a sharing violation for the selected file that + // occurred when the user clicked the OK button. + return OnShareViolation(reinterpret_cast(lparam)); + } + + if (message == UWM_FILEOKSTRING) + { + return OnFileNameOK(); + } + + // Not processed here. + return 0; + } + + // Display either a FileOpen or FileSave dialog, and allow the user to + // select various options. An exception is thrown if the dialog isn't created. + // + // If the OFN_ALLOWMULTISELECT flag is used, the size of the buffer required + // to hold the file names can be quite large. An exception is thrown if the + // buffer size specified by m_OFN.nMaxFile turns out to be too small. + // Use SetParamaters to set a larger size if required. + inline INT_PTR CFileDialog::DoModal(HWND owner /* = nullptr */) + { + assert(!IsWindow()); // Only one window per CWnd instance allowed + + // Retrieve this thread's TLS data + TLSData* pTLSData = GetApp()->GetTlsData(); + + // Create the modal dialog + pTLSData->pWnd = this; + + m_ofn.hwndOwner = owner; + int maxFileSize = static_cast(m_ofn.nMaxFile); + m_ofn.lpstrFile = m_fileName.GetBuffer(maxFileSize); + int ok = (m_isOpenFileDialog ? ::GetOpenFileName(&m_ofn) : ::GetSaveFileName(&m_ofn)); + m_fileName.ReleaseBuffer(maxFileSize); + m_ofn.lpstrFile = const_cast(m_fileName.c_str()); + m_wnd = nullptr; + + // The result of the file choice box is processed here. + if (!ok) + { + int error = static_cast(CommDlgExtendedError()); + if (error != 0) + { + // Ignore the exception caused by closing the dialog. + if (error != CDERR_DIALOGFAILURE || (m_ofn.Flags & OFN_EXPLORER)) + throw CWinException(GetApp()->MsgWndDialog(), error); + } + + OnCancel(); + return IDCANCEL; + } + + OnOK(); + + // Prepare the CWnd for reuse. + Cleanup(); + + return IDOK; + } + + // Returns the name of the file that was entered in the DoModal() operation. + // This name consists of only the file title and extension. If the + // OFN_ALLOWMULTISELECT flag is specified, only the first file path selected + // will be returned. If so, GetNextPathName can be used to retrieve subsequent + // file names. + inline CString CFileDialog::GetFileName() const + { + CString fileName = GetPathName(); + int pos = fileName.ReverseFind(_T('\\')); + if (pos >= 0) + return fileName.Mid(pos + 1); + + fileName.Empty(); + return fileName; + } + + // Returns the file name's extension entered during the DoModal() operation. + // If the OFN_ALLOWMULTISELECT option set, only the extension on the first + // file path selected will be returned. + inline CString CFileDialog::GetFileExt() const + { + CString fileExt = GetFileName(); + int pos = fileExt.ReverseFind(_T(".")); + if (pos >= 0) + return fileExt.Mid(pos); + + fileExt.Empty(); + return fileExt; + } + + // Returns the title of the file entered in the DoModal() operation. The + // title consists of the full path name with directory path and extension + // removed. + inline CString CFileDialog::GetFileTitle() const + { + CString fileTitle = GetFileName(); + int pos = fileTitle.ReverseFind(_T(".")); + if (pos >= 0) + return fileTitle.Left(pos); + + return fileTitle; + } + + // Returns the next file path name from a group of files selected. The + // OFN_ALLOWMULTISELECT flag allows multiple files to be selected. Use + // pos = 0 to retrieve the first file. The pos parameter is updated to + // point to the next file name. The pos parameter is set to -1 when the + // last file is retrieved. + inline CString CFileDialog::GetNextPathName(int& pos) const + { + assert(pos >= 0); + + bool isExplorer = (m_ofn.Flags & OFN_EXPLORER) != 0; + TCHAR delimiter = (isExplorer ? _T('\0') : _T(' ')); + int maxFileSize = static_cast(m_ofn.nMaxFile); + int bufferSize = std::min(MAX_PATH, maxFileSize - pos); + CString fileNames(m_ofn.lpstrFile + pos, bufferSize); + int index = 0; + if (pos == 0) + { + index = fileNames.Find(delimiter); + + if ( (index < 0) || (fileNames.GetAt(++index) == _T('\0'))) + { + // Only one file selected. m_OFN.lpstrFile contains a single + // string consisting of the path and file name. + pos = -1; + return m_ofn.lpstrFile; + } + } + + // Multiple files selected. m_OFN.lpstrFile contains a set of + // substrings separated by delimiters. The first substring is the path, + // the following ones are file names. + CString pathName = m_ofn.lpstrFile; // strPath is terminated by first null + if (!isExplorer) + { + int pathIndex = pathName.Find(delimiter); + pathName = pathName.Left(pathIndex); + } + + CString fileName = m_ofn.lpstrFile + pos + index; + if (!isExplorer) + { + int fileIndex = fileName.Find(delimiter); + if (fileIndex > 0) + fileName = fileName.Left(fileIndex); + } + + // Update pos to point to the next file. + int fileLength = lstrlen(fileName); + if (fileNames.GetAt(index + fileLength + 1) == _T('\0')) + pos = -1; + else + pos = pos + index + fileLength +1; + + if (!pathName.IsEmpty()) + { + // Get the last character from the path. + int pathLength = pathName.GetLength(); + TCHAR termination = pathName.GetAt(pathLength -1); + + if (termination == _T('\\')) + { + // Path already ends with _T('\\'). + return pathName + fileName; + } + } + + // Add _T('\\') to the end of the path. + return pathName + _T('\\') + fileName; + } + + // Returns the path name of the folder or directory of files retrieved + // from the dialog. The final character of the name includes the + // directory separation character. + inline CString CFileDialog::GetFolderPath() const + { + CString folderName = GetPathName(); + int pos = folderName.ReverseFind(_T('\\')); + if (pos >= 0) + return folderName.Left(pos + 1); + + folderName.Empty(); + return folderName; + } + + // Returns the full path name of the file that was retrieved from the dialog. + // If the m_OFN.Flags member includes the OFN_ALLOWMULTISELECT option, + // this method returns only the first selected file. Use the GetNextPathName + // to retrieve the remaining file names. + inline CString CFileDialog::GetPathName() const + { + if ((m_ofn.Flags & OFN_ALLOWMULTISELECT) == 0) + { + // Just retrieve the path from the OPENFILENAME structure. + return m_ofn.lpstrFile; + } + else + { + int pos = 0; + return GetNextPathName(pos); + } + } + + // Normally, overriding this function is not warranted because the + // framework provides default validation of file names. + // Override this function and return TRUE to reject a file name for + // any application specific reasons. + inline LRESULT CFileDialog::OnFileNameOK() + { + return 0; + } + + // Override this method to handle the WM_NOTIFY CDN_INITDONE message. + // The notification message is sent when the system has finished arranging + // controls in the Open or SaveAs dialog to make room for the controls of + // the child dialog box, but before the dialog is visible. Notification is + // sent only if the dialog box was created with the OFN_EXPLORER style. + inline void CFileDialog::OnInitDone() + { + } + + // Override this method to handle the WM_NOTIFY CDN_SELCHANGE message. + // The notification message is sent when the user selects a new file or + // folder in the file list of the Open or SaveAs dialog box. Notification + // is sent only if the dialog box was created with the OFN_EXPLORER style. + inline void CFileDialog::OnFileNameChange() + { + } + + // Override this method to handle the WM_NOTIFY CDN_SELCHANGE message. + // The notification message is sent when the user selects a new file or + // folder in the file list of the Open or SaveAs dialog box. Notification + // is sent only if the dialog box was created with the OFN_EXPLORER style. + inline void CFileDialog::OnFolderChange() + { + } + + // This method is called whenever the current selection in a list box is + // about to change. Override this method to provide custom handling of + // selection changes in the list box. The ID of the list or combo box in + // which the selection occurred is boxID. The index of the current + // selection is curSel. The control notification code is code. + inline void CFileDialog::OnLBSelChangedNotify(int, int, UINT) + { + } + + // This method handles the WM_NOTIFY message loop functions of the hook + // procedure. + inline LRESULT CFileDialog::OnNotify(WPARAM, LPARAM lparam) + { + OFNOTIFY* pNotify = reinterpret_cast(lparam); + assert(pNotify); + if (!pNotify) return 0; + + switch(pNotify->hdr.code) + { + case CDN_INITDONE: + OnInitDone(); + return TRUE; + + case CDN_SELCHANGE: + OnFileNameChange(); + return TRUE; + + case CDN_FOLDERCHANGE: + OnFolderChange(); + return TRUE; + + case CDN_SHAREVIOLATION: + return OnShareViolation(pNotify->pszFile); + + case CDN_HELP: + OnHelpButton(); + return TRUE; + + case CDN_FILEOK: + return OnFileNameOK(); + + case CDN_TYPECHANGE: + OnTypeChange(); + return TRUE; + } + + // The framework will call SetWindowLongPtr(DWLP_MSGRESULT, result) + // for non-zero returns. + return FALSE; // not handled + } + + // Override this function to provide custom handling of share violations. + // Normally, this function is not needed because the framework provides + // default checking of share violations and displays a message box if a + // share violation occurs. To disable share violation checking, use the + // bitwise OR operator to combine the flag OFN_SHAREAWARE with m_OFN.Flags. + + // Return one of the following values to indicate how the dialog box + // should handle the sharing violation. + // OFN_SHAREFALLTHROUGH - Accept the file name + // OFN_SHARENOWARN - Reject the file name but do not warn the user. + // The application is responsible for displaying a warning message. + // OFN_SHAREWARN - Reject the file name and displays a warning message + // (the same result as if there were no hook procedure). + inline LRESULT CFileDialog::OnShareViolation(LPCTSTR) + { + return OFN_SHAREWARN; // default: + } + + // Override this method to handle the WM_NOTIFY CDN_TYPECHANGE message. + // The notification message is sent when the user selects a new file type + // from the list of file types in the Open or SaveAs dialog box. + // Notification is sent only if the dialog box was created with the + // OFN_EXPLORER style. + inline void CFileDialog::OnTypeChange() + { + } + + // Set the default extension of the dialog box to ext. + // Only the first three characters are sent to the dialog. + inline void CFileDialog::SetDefExt(LPCTSTR ext) + { + if (ext) + { + m_defExt = ext; + m_ofn.lpstrDefExt = m_defExt.c_str(); + } + else + { + m_defExt.Empty(); + m_ofn.lpstrDefExt = nullptr; + } + } + + // Set the initial file name in the dialog box to fileName. + inline void CFileDialog::SetFileName(LPCTSTR fileName) + { + // setup initial file name + if (fileName) + { + m_fileName = fileName; + m_ofn.lpstrFile = const_cast(m_fileName.c_str()); + } + else + { + m_fileName.Empty(); + m_ofn.lpstrFile = nullptr; + } + } + + // Set the file choice dialog file name filter string to pFilter. + // The string is a pair of strings delimited by null or '|' + // The string must be either double terminated, or use '|' instead of '\0' + // For Example: CString filter("Program Files (*.cpp; *.h)|*.cpp; *.h|All Files (*.*)|*.*|"); + // or: CString filter("Program Files (*.cpp; *.h)\0*.cpp; *.h\0All Files (*.*)\0*.*\0", 58); + // or: LPCTSTR filter = _T("Program Files (*.cpp; *.h)\0*.cpp; *.h\0All Files (*.*)\0*.*\0"); + inline void CFileDialog::SetFilter(LPCTSTR filter) + { + // Clear any existing filter. + m_ofn.lpstrFilter = nullptr; + + // Convert any '|' characters in filter to null characters. + if (filter) + { + CString str = filter; + if (str.Find(_T('|')) >= 0) + { + str.Replace(_T('|'), _T('\0')); + m_filter = str; + m_ofn.lpstrFilter = m_filter.c_str(); + } + else + { + // The filter doesn't contain '|', so it should be double terminated. + int i = 0; + while (i < MAX_PATH) + { + // Search for double termination. + if (filter[i] == _T('\0') && filter[i + 1] == _T('\0')) + { + m_filter.Assign(filter, i + 2); + m_ofn.lpstrFilter = m_filter.c_str(); + break; + } + ++i; + } + Trace(m_filter); + } + } + } + + // Sets the various parameters of the OPENFILENAME struct. + // The parameters are set to sensible values. + inline void CFileDialog::SetParameters(const OPENFILENAME& ofn) + { + SetFileName(ofn.lpstrFile); + SetFilter(ofn.lpstrFilter); + SetTitle(ofn.lpstrFileTitle); + + DWORD maxPath = MAX_PATH; + + m_ofn.lStructSize = sizeof(m_ofn); + m_ofn.FlagsEx = ofn.FlagsEx; + m_ofn.hwndOwner = nullptr; // Set this in DoModal. + m_ofn.hInstance = GetApp()->GetInstanceHandle(); + m_ofn.lpstrCustomFilter = ofn.lpstrCustomFilter; + m_ofn.nMaxCustFilter = std::max(maxPath, ofn.nMaxCustFilter); + m_ofn.nFilterIndex = ofn.nFilterIndex; + + // Allocate a bigger buffer for multiple files. + if (ofn.Flags & OFN_ALLOWMULTISELECT) + m_ofn.nMaxFile = std::max(maxPath * 256, ofn.nMaxFile); + else + m_ofn.nMaxFile = std::max(maxPath, ofn.nMaxFile); + + m_ofn.lpstrFileTitle = ofn.lpstrFileTitle; + m_ofn.nMaxFileTitle = std::max(maxPath, ofn.nMaxFileTitle); + m_ofn.lpstrInitialDir = ofn.lpstrInitialDir; + m_ofn.Flags = ofn.Flags; + m_ofn.nFileOffset = ofn.nFileOffset; + m_ofn.nFileExtension = ofn.nFileExtension; + m_ofn.lpstrDefExt = ofn.lpstrDefExt; + m_ofn.lCustData = ofn.lCustData; + m_ofn.lpfnHook = reinterpret_cast(CDHookProc); + } + + // Sets the title of the fileopen or filesave dialog. + inline void CFileDialog::SetTitle(LPCTSTR title) + { + if (title) + { + m_title = title; + m_ofn.lpstrTitle = m_title.c_str(); + } + else + { + m_title.Empty(); + m_ofn.lpstrTitle = nullptr; + } + } + + + //////////////////////////////////////////////// + // Definitions for the CFindReplaceDialog class. + // + + // Constructor for CCFindReplaceDialog. + // Refer to the Windows API documentation for information of the FINDREPLACE structure. + inline CFindReplaceDialog::CFindReplaceDialog(BOOL isFindDialogOnly /* = TRUE */) + { + m_fr = {}; + m_isFindDialogOnly = isFindDialogOnly; + SetParameters(m_fr); + } + + // Create and display either a Find or FindReplace dialog box. + inline HWND CFindReplaceDialog::Create(HWND parent /* = nullptr*/) + { + Create(m_isFindDialogOnly, m_fr.lpstrFindWhat, m_fr.lpstrReplaceWith, m_fr.Flags, parent); + return *this; + } + + // Create and display either a Find or FindReplace dialog box. findWhat + // is the search string, and replaceWith is the replace string. + // Set flags to a combination of one or more flags the dialog box. + // Set parent to the handle of the dialog box's parent or owner window. + // An exception is thrown if the window isn't created. + inline BOOL CFindReplaceDialog::Create(BOOL isFindDialogOnly, LPCTSTR findWhat, + LPCTSTR replaceWith, DWORD flags, HWND parent /* = nullptr*/) + { + assert(!IsWindow()); // Only one window per CWnd instance allowed + + m_isFindDialogOnly = isFindDialogOnly; + + // Retrieve this thread's TLS data. + TLSData* pTLSData = GetApp()->GetTlsData(); + pTLSData->pWnd = this; + + // Initialize the FINDREPLACE struct values. + m_fr.Flags = flags; + SetParameters(m_fr); + m_fr.hwndOwner = parent; + + m_fr.lpstrFindWhat = m_findWhat.GetBuffer(m_fr.wFindWhatLen); + if (findWhat) + StrCopy(m_fr.lpstrFindWhat, findWhat, m_fr.wFindWhatLen); + + m_fr.lpstrReplaceWith = m_replaceWith.GetBuffer(m_fr.wReplaceWithLen); + if (replaceWith) + StrCopy(m_fr.lpstrReplaceWith, replaceWith, m_fr.wReplaceWithLen); + + // Display the dialog box. + HWND wnd; + if (isFindDialogOnly) + wnd = ::FindText(&m_fr); + else + wnd = ::ReplaceText(&m_fr); + + if (wnd == nullptr) + { + // Throw an exception when window creation fails. + throw CWinException(GetApp()->MsgWndDialog()); + } + + m_findWhat.ReleaseBuffer(); + m_fr.lpstrFindWhat = const_cast(m_findWhat.c_str()); + m_replaceWith.ReleaseBuffer(); + m_fr.lpstrReplaceWith = const_cast(m_replaceWith.c_str()); + + return TRUE; + } + + // Dialog procedure for the Find and Replace dialogs. Override this function + // to customize the message handling. + inline INT_PTR CFindReplaceDialog::DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) + { + // Message intercepted by the hook procedure are passed here. + // A typical function might look like this: + + // switch (msg) + // { + // case MESSAGE1: // Some Windows API message + // OnMessage1(); // A user defined function + // break; // Also do default processing + // case MESSAGE2: + // OnMessage2(); + // return x; // Don't do default processing, but instead return + // // a value recommended by the Windows API documentation + // } + + // Always pass unhandled messages on to DialogProcDefault + return DialogProcDefault(msg, wparam, lparam); + } + + // The Default message handling for CFindReplaceDialog. Don't override this function, + // override DialogProc instead. + inline INT_PTR CFindReplaceDialog::DialogProcDefault(UINT message, WPARAM wparam, LPARAM) + { + switch (message) + { + case WM_INITDIALOG: + { + // Handle the initialization message. + return OnInitDialog(); + } + + case WM_COMMAND: + { + if (LOWORD(wparam) == pshHelp) + OnHelpButton(); + + return 0; + } + } + + return 0; + } + + // Call this function to determine whether the user wants to find the next + // occurrence of the search string. + inline BOOL CFindReplaceDialog::FindNext() const + { + return (m_fr.Flags & FR_FINDNEXT)? TRUE : FALSE; + } + + // Call this function to return the default string to find. + inline CString CFindReplaceDialog::GetFindString() const + { + return m_fr.lpstrFindWhat; + } + + // Return a pointer to the current Find/Replace dialog box. This may be + // used when owner window responds to the UWM_FINDMSGSTRING message. + // The lparam value is that passed in the UWM_FINDMSGSTRING message. + inline CFindReplaceDialog* CFindReplaceDialog::GetNotifier(LPARAM lparam) + { + assert(lparam != 0); + LPFINDREPLACE pFR = reinterpret_cast(lparam); + if (!pFR) return nullptr; + + CFindReplaceDialog* pDlg = reinterpret_cast(pFR->lCustData); + return pDlg; + } + + // Call this function to return the current replace string. + inline CString CFindReplaceDialog::GetReplaceString() const + { + return m_fr.lpstrReplaceWith == nullptr ? _T("") : m_fr.lpstrReplaceWith; + } + + // Returns TRUE if the user has decided to terminate the dialog box; + inline BOOL CFindReplaceDialog::IsTerminating() const + { + return (m_fr.Flags & FR_DIALOGTERM)? TRUE : FALSE; + } + + // Return TRUE if the user wants to find occurrences of the search string + // that exactly match the case of the search string; otherwise FALSE. + inline BOOL CFindReplaceDialog::MatchCase() const + { + return (m_fr.Flags & FR_MATCHCASE)? TRUE : FALSE; + } + + // Return TRUE if the user wants to match only the entire words of the + // search string. + inline BOOL CFindReplaceDialog::MatchWholeWord() const + { + return (m_fr.Flags & FR_WHOLEWORD)? TRUE : FALSE; + } + + // Return TRUE if the user has requested that all strings matching the + // replace string be replaced. + inline BOOL CFindReplaceDialog::ReplaceAll() const + { + return (m_fr.Flags & FR_REPLACEALL)? TRUE : FALSE; + } + + // Return TRUE if the user has requested that the currently selected string + // be replaced with the replace string. + inline BOOL CFindReplaceDialog::ReplaceCurrent() const + { + return (m_fr.Flags & FR_REPLACE)? TRUE : FALSE; + } + + // Return TRUE if the user wants the search to proceed in a downward + // direction; FALSE if the user wants the search to proceed in an upward + // direction. + inline BOOL CFindReplaceDialog::SearchDown() const + { + return (m_fr.Flags & FR_DOWN)? TRUE : FALSE; + } + + // Sets the various parameters of the FINDREPLACE struct. + // The parameters are set to sensible values. + inline void CFindReplaceDialog::SetParameters(const FINDREPLACE& fr) + { + int maxChars = 128; + + if (fr.lpstrFindWhat) + { + m_findWhat = fr.lpstrFindWhat; + maxChars = std::max(maxChars, lstrlen(fr.lpstrFindWhat)); + } + else + m_findWhat.Empty(); + + if (fr.lpstrReplaceWith) + { + m_replaceWith = fr.lpstrReplaceWith; + maxChars = std::max(maxChars, lstrlen(fr.lpstrReplaceWith)); + } + else + m_replaceWith.Empty(); + + WORD maxCharsWord = static_cast(maxChars); + + m_fr.lStructSize = sizeof(m_fr); + m_fr.hwndOwner = nullptr; // Set this in Create + m_fr.hInstance = GetApp()->GetInstanceHandle(); + m_fr.Flags = fr.Flags; + m_fr.lpstrFindWhat = const_cast(m_findWhat.c_str()); + m_fr.lpstrReplaceWith = const_cast(m_replaceWith.c_str()); + m_fr.wFindWhatLen = std::max(fr.wFindWhatLen, maxCharsWord); + m_fr.wReplaceWithLen = std::max(fr.wReplaceWithLen, maxCharsWord); + m_fr.lCustData = reinterpret_cast(this); + m_fr.lpfnHook = reinterpret_cast(CDHookProc); + m_fr.lpTemplateName = fr.lpTemplateName; + + // Enable the hook procedure for the help button. + if (m_fr.Flags & FR_SHOWHELP) + m_fr.Flags |= FR_ENABLEHOOK; + } + + + ///////////////////////////////////////// + // Definitions for the CFontDialog class. + // + + // Construct a CFontDialog object from values given. Note that these are + // stored into the members of the CHOOSEFONT structure. + // Refer to the description of the CHOOSEFONT structure in the Windows API + // documentation for more information on these parameters. + inline CFontDialog::CFontDialog(const LOGFONT& initial, DWORD flags /* = 0 */, + HDC printer /* = nullptr */) + { + m_logFont = {}; + + // Set the dialog parameters. + m_cf = {}; + m_cf.rgbColors = 0; // black + m_cf.lStructSize = sizeof(m_cf); + m_cf.Flags = flags; + m_cf.Flags |= CF_INITTOLOGFONTSTRUCT; + m_cf.lpLogFont = const_cast(&initial); + + if (printer) + { + m_cf.hDC = printer; + m_cf.Flags |= CF_PRINTERFONTS; + } + + // Enable the hook procedure for the help button. + if (m_cf.Flags & CF_SHOWHELP) + m_cf.Flags |= CF_ENABLEHOOK; + + SetParameters(m_cf); + } + + // Construct a CFontDialog dialog object that can be used to create a font + // for use in a rich edit control. The charformat points to a CHARFORMAT + // data structure that allows setting some of the font's characteristics + // for a rich edit control. + // Refer to the description of the CHOOSEFONT structure in the Windows API + // documentation for more information on these parameters. + inline CFontDialog::CFontDialog(const CHARFORMAT& charformat, DWORD flags /* = 0 */, + HDC printer /* = nullptr */) + { + m_logFont = {}; + + // Set dialog parameters. + m_cf = {}; + m_cf.lStructSize = sizeof(m_cf); + FillInLogFont(charformat); + m_cf.lpLogFont = &m_logFont; + m_cf.Flags = flags | CF_INITTOLOGFONTSTRUCT; + + if (charformat.dwMask & CFM_COLOR) + m_cf.rgbColors = charformat.crTextColor; + + if (printer) + { + m_cf.hDC = printer; + m_cf.Flags |= CF_PRINTERFONTS; + } + + // Enable the hook procedure for the help button. + if (m_cf.Flags & CF_SHOWHELP) + m_cf.Flags |= CF_ENABLEHOOK; + + SetParameters(m_cf); + } + + // Construct a default CFontDialog object. + inline CFontDialog::CFontDialog(DWORD flags /* = 0 */, HDC printer /* = nullptr */) + { + m_logFont = {}; + + // Set the dialog parameters. + m_cf = {}; + m_cf.rgbColors = 0; // black + m_cf.lStructSize = sizeof(m_cf); + m_cf.Flags = flags; + + if (printer) + { + m_cf.hDC = printer; + m_cf.Flags |= CF_PRINTERFONTS; + } + + // Enable the hook procedure for the help button. + if (m_cf.Flags & CF_SHOWHELP) + m_cf.Flags |= CF_ENABLEHOOK; + + SetParameters(m_cf); + } + + // Dialog procedure for the Font dialog. Override this function + // to customize the message handling. + inline INT_PTR CFontDialog::DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) + { + // Message intercepted by the hook procedure are passed here. + // Note: OnCancel and OnOK are not called here. They are called by DoModal + // in response to value returned by called by ChooseFont. + + // A typical function might look like this: + + // switch (msg) + // { + // case MESSAGE1: // Some Windows API message + // OnMessage1(); // A user defined function + // break; // Also do default processing + // case MESSAGE2: + // OnMessage2(); + // return x; // Don't do default processing, but instead return + // // a value recommended by the Windows API documentation + // } + + // Always pass unhandled messages on to DialogProcDefault + return DialogProcDefault(msg, wparam, lparam); + } + + // The Default message handling for CFontDialog. + // Don't override this function, override DialogProc instead. + // Note: OnCancel and OnOK are called by DoModal. + inline INT_PTR CFontDialog::DialogProcDefault(UINT message, WPARAM wparam, LPARAM) + { + if (message == WM_INITDIALOG) + { + OnInitDialog(); + } + + // Dispatch special commdlg messages. + if (message == WM_COMMAND && LOWORD(wparam) == pshHelp) + OnHelpButton(); + + // Perform default processing. + return 0; + } + + // Display the FontDialog. hOwner specifies dialog's owner window. + inline INT_PTR CFontDialog::DoModal(HWND owner /* = nullptr */) + { + assert(!IsWindow()); // Only one window per CWnd instance allowed + + // Retrieve this thread's TLS data. + TLSData* pTLSData = GetApp()->GetTlsData(); + + // Create the modal dialog. + pTLSData->pWnd = this; + + m_cf.hwndOwner = owner; + m_cf.lpszStyle = m_styleName.GetBuffer(80); + + // Open the font choice dialog. + BOOL ok = ::ChooseFont(&m_cf); + + m_styleName.ReleaseBuffer(); + m_cf.lpszStyle = const_cast(m_styleName.c_str()); + m_wnd = nullptr; + + // Process the result of the font choice box. + if (!ok) + { + int error = static_cast(CommDlgExtendedError()); + if ((error != 0) && (error != CDERR_DIALOGFAILURE)) + // Ignore the exception caused by closing the dialog. + throw CWinException(GetApp()->MsgWndDialog(), error); + + OnCancel(); + return IDCANCEL; + } + + OnOK(); + Cleanup(); + + return IDOK; + } + + // Returns the CHARFORMAT of this font object, as translated from the + // information in the m_FR CHOOSEFONT struct. + inline CHARFORMAT CFontDialog::GetCharFormat() const + { + CHARFORMAT chfmt = {}; + chfmt.cbSize = sizeof(chfmt); + + if ((m_cf.Flags & CF_NOSTYLESEL) == 0) + { + chfmt.dwMask |= CFM_BOLD | CFM_ITALIC; + chfmt.dwEffects |= (IsBold()) ? CFE_BOLD : 0; + chfmt.dwEffects |= (IsItalic()) ? CFE_ITALIC : 0; + } + + if ((m_cf.Flags & CF_NOSIZESEL) == 0) + { + chfmt.dwMask |= CFM_SIZE; + // GetSize() returns 1/10th points, convert to twips. + chfmt.yHeight = GetSize() * 2; + } + + if ((m_cf.Flags & CF_NOFACESEL) == 0) + { + chfmt.dwMask |= CFM_FACE; + chfmt.bPitchAndFamily = m_cf.lpLogFont->lfPitchAndFamily; + StrCopy(chfmt.szFaceName, GetFaceName().c_str(), LF_FACESIZE); + } + + if (m_cf.Flags & CF_EFFECTS) + { + chfmt.dwMask |= CFM_UNDERLINE | CFM_STRIKEOUT | CFM_COLOR; + chfmt.dwEffects |= (IsUnderline()) ? CFE_UNDERLINE : 0; + chfmt.dwEffects |= (IsStrikeOut()) ? CFE_STRIKEOUT : 0; + chfmt.crTextColor = GetColor(); + } + + if ((m_cf.Flags & CF_NOSCRIPTSEL) == 0) + { + chfmt.bCharSet = m_cf.lpLogFont->lfCharSet; + chfmt.dwMask |= CFM_CHARSET; + } + + chfmt.yOffset = 0; + return chfmt; + } + + // Return the current font size, in 1/10th points (1 pt = 1/72 inch). + inline int CFontDialog::GetSize() const + { + CClientDC dc = GetDesktopWindow().GetDC(); // the device context for the entire screen + + // The number of pixels per inch along the screen height. + int pxpi = dc.GetDeviceCaps(LOGPIXELSY); + + // 72 points/inch, 10 decipoints/point. + int charsize = -MulDiv(m_logFont.lfHeight, 720, pxpi); + return charsize; + } + + // Called when the OK button is pressed on the Font Dialog. + inline void CFontDialog::OnOK() + { + } + + // Translate the font character format cf properties of a CRichEdit control + // into elements of the m_logFont member and settings of the option flags. + inline DWORD CFontDialog::FillInLogFont(const CHARFORMAT& cf) + { + DWORD flags = 0; + if (cf.dwMask & CFM_SIZE) + { + CDC dc; + dc.CreateDC(_T("DISPLAY"), nullptr, nullptr, nullptr); + LONG yPerInch = dc.GetDeviceCaps(LOGPIXELSY); + m_logFont.lfHeight = - (cf.yHeight * yPerInch) / 1440; + } + else + m_logFont.lfHeight = 0; + + m_logFont.lfWidth = 0; + m_logFont.lfEscapement = 0; + m_logFont.lfOrientation = 0; + + if ((cf.dwMask & (CFM_ITALIC|CFM_BOLD)) == (CFM_ITALIC|CFM_BOLD)) + { + m_logFont.lfWeight = (cf.dwEffects & CFE_BOLD) ? FW_BOLD : FW_NORMAL; + m_logFont.lfItalic = (cf.dwEffects & CFE_ITALIC) ? 1U : 0U; + } + else + { + flags |= CF_NOSTYLESEL; + m_logFont.lfWeight = FW_DONTCARE; + m_logFont.lfItalic = FALSE; + } + + if ((cf.dwMask & (CFM_UNDERLINE|CFM_STRIKEOUT|CFM_COLOR)) == + (CFM_UNDERLINE|CFM_STRIKEOUT|CFM_COLOR)) + { + flags |= CF_EFFECTS; + m_logFont.lfUnderline = (cf.dwEffects & CFE_UNDERLINE) ? 1U : 0U; + m_logFont.lfStrikeOut = (cf.dwEffects & CFE_STRIKEOUT) ? 1U : 0U; + } + else + { + m_logFont.lfUnderline = 0U; + m_logFont.lfStrikeOut = 0U; + } + + if (cf.dwMask & CFM_CHARSET) + m_logFont.lfCharSet = cf.bCharSet; + else + flags |= CF_NOSCRIPTSEL; + + m_logFont.lfOutPrecision = OUT_DEFAULT_PRECIS; + m_logFont.lfClipPrecision = CLIP_DEFAULT_PRECIS; + m_logFont.lfQuality = DEFAULT_QUALITY; + + if (cf.dwMask & CFM_FACE) + { + m_logFont.lfPitchAndFamily = cf.bPitchAndFamily; + StrCopy(m_logFont.lfFaceName, cf.szFaceName, LF_FACESIZE); + } + else + { + m_logFont.lfPitchAndFamily = DEFAULT_PITCH|FF_DONTCARE; + m_logFont.lfFaceName[0] = _T('\0'); + } + + return flags; + } + + // Sets the various parameters of the CHOOSEFONT struct. + // The parameters are set to safe values. + inline void CFontDialog::SetParameters(const CHOOSEFONT& cf) + { + if (cf.lpLogFont) + m_logFont = *cf.lpLogFont; + else + m_logFont = {}; + + if (cf.lpszStyle) + m_styleName = cf.lpszStyle; + else + m_styleName.Empty(); + + m_cf.lStructSize = sizeof(m_cf); + m_cf.hwndOwner = nullptr; // Set this in DoModal + m_cf.hDC = cf.hDC; + m_cf.lpLogFont = &m_logFont; + m_cf.iPointSize = cf.iPointSize; + m_cf.Flags = cf.Flags; + m_cf.rgbColors = cf.rgbColors; + m_cf.lCustData = cf.lCustData; + m_cf.lpfnHook = reinterpret_cast(CDHookProc); + m_cf.lpTemplateName = cf.lpTemplateName; + m_cf.hInstance = GetApp()->GetInstanceHandle(); + m_cf.lpszStyle = const_cast(m_styleName.c_str()); + m_cf.nFontType = cf.nFontType; + m_cf.nSizeMin = cf.nSizeMin; + m_cf.nSizeMax = cf.nSizeMax; + } + +} + + +#endif // _WIN32XX_COMMONDLG_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_controls.h b/packages/media/cpp/packages/Win32xx/include/wxx_controls.h new file mode 100644 index 00000000..feabd550 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_controls.h @@ -0,0 +1,2996 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////// +// wxx_controls.h +// Declaration of the following classes: +// CAnimation, CComboBox, CComboBoxEx, CDateTime, CIPAddress, +// CHeader, CHotKey, CMonthCalendar, CProgressBar, CScrollBar, +// CSlider, CSpinButton, and CToolTip. + + +#ifndef _WIN32XX_CONTROLS_H_ +#define _WIN32XX_CONTROLS_H_ + + +#include "wxx_wincore0.h" + + +namespace Win32xx +{ + + class CMonthCalendar; + class CToolTip; + + /////////////////////////////////////////////////////////////////////////// + // The CAnimation class provides the functionality of an animation control. + // An animation control is a window that displays an Audio-Video + // Interleaved (AVI) clip. + class CAnimation : public CWnd + { + public: + CAnimation() = default; + virtual ~CAnimation() = default; + + BOOL Close() const; + BOOL Open(LPCTSTR pathName) const; + BOOL Play(int from, int to, int repeat) const; + BOOL Seek(int frame) const; + BOOL Stop() const; + + protected: + // Overridables + virtual void PreRegisterClass(WNDCLASS& wc) override; + + private: + CAnimation(const CAnimation&) = delete; + CAnimation& operator=(const CAnimation&) = delete; + }; + + + /////////////////////////////////////////////////////// + // CComboBox class manages a combo box control. + // A combo box consists of either a static text box or + // an edit box combined with a list box. + class CComboBox : public CWnd + { + public: + CComboBox() = default; + virtual ~CComboBox() override = default; + + virtual int CompareItem(LPCOMPAREITEMSTRUCT pCompareItemStruct); + + int AddString(LPCTSTR string) const; + void Clear() const; + void Copy() const; + void Cut() const; + int DeleteString(int index) const; + int Dir(UINT attr, LPCTSTR wildCard ) const; + int FindString(int indexStart, LPCTSTR string) const; + int FindStringExact(int indexStart, LPCTSTR string) const; + BOOL GetComboBoxInfo(PCOMBOBOXINFO pcbi) const; + int GetCount() const; + int GetCurSel() const; + CRect GetDroppedControlRect() const; + BOOL GetDroppedState() const; + int GetDroppedWidth() const; + HWND GetEditCtrl() const; + DWORD GetEditSel() const; + BOOL GetExtendedUI() const; + int GetHorizontalExtent() const; + DWORD GetItemData(int index) const; + int GetItemHeight(int index) const; + HWND GetLBCtrl() const; + int GetLBText(int index, LPTSTR text) const; + int GetLBTextLen(int index) const; + LCID GetLocale() const; + int GetTopIndex() const; + int InitStorage(int items, int byteCount) const; + int InsertString(int index, LPCTSTR string) const; + void LimitText(int maxChars) const; + void Paste() const; + void ResetContent() const; + int SelectString(int startAfter, LPCTSTR string) const; + int SetCurSel(int index) const; + int SetDroppedWidth(int width) const; + BOOL SetEditSel(int startChar, int endChar) const; + int SetExtendedUI(BOOL isExtended = TRUE) const; + void SetHorizontalExtent(UINT extent ) const; + int SetItemData(int index, DWORD itemData) const; + int SetItemHeight(int index, UINT cyItemHeight) const; + LCID SetLocale( LCID newLocale ) const; + int SetTopIndex(int index) const; + void ShowDropDown(BOOL show = TRUE) const; + + protected: + // Overridables + virtual LRESULT OnMessageReflect(UINT msg, WPARAM, LPARAM lparam) override; + virtual void PreRegisterClass(WNDCLASS& wc) override; + + private: + CComboBox(const CComboBox&) = delete; + CComboBox& operator=(const CComboBox&) = delete; + }; + + + ///////////////////////////////////////////////////////////////// + // CComboBoxEx manages a ComboBoxEx control. ComboBoxEx Controls + // are an extension of the combo box control that provides native + // support for item images. + class CComboBoxEx : public CComboBox + { + public: + CComboBoxEx() = default; + virtual ~CComboBoxEx() = default; + + int DeleteItem(int index ) const; + HWND GetComboBoxCtrl() const; + HWND GetEditCtrl() const; + DWORD GetExtendedStyle() const; + CImageList GetImageList() const; + BOOL GetItem(COMBOBOXEXITEM& item) const; + BOOL HasEditChanged () const; + int InsertItem(const COMBOBOXEXITEM& item) const; + CImageList SetImageList(HIMAGELIST images); + BOOL SetItem(const COMBOBOXEXITEM& item) const; + DWORD SetExtendedStyle(DWORD exMask, DWORD exStyles) const; + + protected: + // Overridables + virtual void PreRegisterClass(WNDCLASS& wc) override; + + private: + CComboBoxEx(const CComboBoxEx&) = delete; + CComboBoxEx& operator=(const CComboBoxEx&) = delete; + + CImageList m_images; + }; + + + /////////////////////////////////////////////////////////// + // CDateTime manages a Date and Time picker control. + // A date and time picker (DTP) control provides a + // simple and intuitive interface through which to exchange + // date and time information with a user. + class CDateTime : public CWnd + { + public: + CDateTime() = default; + virtual ~CDateTime() override = default; + + COLORREF GetMonthCalColor(int region) const; + HWND GetMonthCalCtrl() const; + CFont GetMonthCalFont() const; + DWORD GetRange(SYSTEMTIME& minRange, SYSTEMTIME& maxRange) const; + SYSTEMTIME GetTime(DWORD* pReturnCode = nullptr) const; + COLORREF SetMonthCalColor(int region, COLORREF color) const; + BOOL SetFormat(LPCTSTR format) const; + void SetMonthCalFont(HFONT font, BOOL redraw = TRUE) const; + BOOL SetRange(SYSTEMTIME minRange, SYSTEMTIME maxRange) const; + BOOL SetTime(SYSTEMTIME time) const; + BOOL SetTimeNone() const; + + protected: + // Overridables + virtual void PreRegisterClass(WNDCLASS& wc) override; + + private: + CDateTime(const CDateTime&) = delete; + CDateTime& operator=(const CDateTime&) = delete; + }; + + + //////////////////////////////////////////////////////////// + // CHeader manages a header control. A header control is + // a window that is usually positioned above columns of text + // or numbers. It contains a title for each column, and it + // can be divided into parts. + class CHeader : public CWnd + { + public: + CHeader() = default; + virtual ~CHeader() override = default; + + // Accessors and mutators + CImageList GetImageList() const; + BOOL GetItem(int pos, HDITEM& item) const; + int GetItemCount() const; + CRect GetItemRect(int index) const; + BOOL GetOrderArray(LPINT pArray, int count) const; + int OrderToIndex(int order) const; + CImageList SetImageList(HIMAGELIST images); + BOOL SetItem(int pos, const HDITEM& item) const; + BOOL SetOrderArray(int count, LPINT pArray) const; + int GetBitmapMargin() const; + int SetBitmapMargin(int width) const; + + // Operations + int ClearAllFilters() const; + int ClearFilter(int column) const; + CImageList CreateDragImage(int index) const; + BOOL DeleteItem(int pos) const; + int EditFilter(int column, BOOL discardChanges) const; + int InsertItem(int pos, const HDITEM& item) const; + BOOL Layout(HDLAYOUT* pHeaderLayout) const; + int SetFilterChangeTimeout(DWORD timeout) const; + int SetHotDivider(CPoint pt) const; + int SetHotDivider(int index) const; + + protected: + // Overridables + virtual void PreRegisterClass(WNDCLASS& wc) override; + + private: + CHeader(const CHeader&) = delete; + CHeader& operator=(const CHeader&) = delete; + + CImageList m_images; + }; + + + //////////////////////////////////////////////////////////// + // CHotKey manages a hot key control. A hot key control is a + // window that enables the user to enter a combination of + // keystrokes to be used as a hot key. + class CHotKey : public CWnd + { + public: + CHotKey() = default; + virtual ~CHotKey() override = default; + + DWORD GetHotKey() const; + CString GetKeyName(UINT keyCode, BOOL isExtended) const; + void SetHotKey(DWORD key) const; + void SetRules(WORD invalidComb, WORD modifiers) const; + + protected: + // Overridables + virtual void PreRegisterClass(WNDCLASS& wc) override; + + private: + CHotKey(const CHotKey&) = delete; + CHotKey& operator=(const CHotKey&) = delete; + }; + + + //////////////////////////////////////////////////////////////////// + // CIPAddress manages an IP Address control. An Internet Protocol + // (IP) address control allows the user to enter an IP address in an + // easily understood format. + class CIPAddress : public CWnd + { + public: + CIPAddress() = default; + virtual ~CIPAddress() override = default; + + void ClearAddress() const; + int GetAddress(BYTE& field0, BYTE& field1, BYTE& field2, BYTE& field3) const; + int GetAddress(DWORD& address) const; + CString GetAddress() const; + BOOL IsBlank() const; + void SetAddress(BYTE field0, BYTE field1, BYTE field2, BYTE field3) const; + void SetAddress(DWORD address) const; + void SetFieldFocus(WORD field) const; + void SetFieldRange(int field, BYTE lower, BYTE upper) const; + + protected: + // Overridables + virtual void PreRegisterClass(WNDCLASS& wc) override; + + private: + CIPAddress(const CIPAddress&) = delete; + CIPAddress& operator=(const CIPAddress&) = delete; + }; + + + ////////////////////////////////////////////////////// + // CMonthCalendar manages a Month Calendar control. + // A month calendar control implements a calendar-like + // user interface. + class CMonthCalendar : public CWnd + { + public: + CMonthCalendar() = default; + virtual ~CMonthCalendar() override = default; + + // Accessors and mutators + COLORREF GetColor(int region) const; + int GetFirstDayOfWeek(BOOL* pLocal = nullptr) const; + CRect GetMinReqRect() const; + int GetMonthDelta() const; + COLORREF SetColor(int region, COLORREF color) const; + BOOL SetFirstDayOfWeek(int day, int* pOldDay = nullptr) const; + int SetMonthDelta(int delta) const; + + // Operations + SYSTEMTIME GetCurSel() const; + int GetMaxSelCount() const; + int GetMonthRange(SYSTEMTIME& minRange, SYSTEMTIME& maxRange, DWORD flags) const; + LRESULT GetRange(SYSTEMTIME& minRange, SYSTEMTIME& maxRange) const; + LRESULT GetSelRange(SYSTEMTIME& minRange, SYSTEMTIME& maxRange) const; + SYSTEMTIME GetToday() const; + LRESULT HitTest(MCHITTESTINFO& mcHitTest) const; + BOOL SetCurSel(SYSTEMTIME dateTime) const; + BOOL SetDayState(int months, LPMONTHDAYSTATE pStateArray) const; + BOOL SetMaxSelCount(int max) const; + BOOL SetRange(SYSTEMTIME minRange, SYSTEMTIME maxRange) const; + BOOL SetSelRange(SYSTEMTIME MinRange, SYSTEMTIME maxRange) const; + void SetToday(SYSTEMTIME dateTime) const; + + protected: + // Overridables + virtual void PreRegisterClass(WNDCLASS& wc) override; + + private: + CMonthCalendar(const CMonthCalendar&) = delete; + CMonthCalendar& operator=(const CMonthCalendar&) = delete; + }; + + + ///////////////////////////////////////////////////////////////// + // CPager manages a pager control control. A pager control is a + // window container that is used with a window that does not have + // enough display area to show all of its content. + class CPager : public CWnd + { + public: + CPager() = default; + virtual ~CPager() override = default; + + // Accessors and mutators + COLORREF GetBkColor() const; + int GetBorder() const; + int GetButtonSize() const; + DWORD GetButtonState(int button) const; + int GetPos() const; + + void SetBkColor(COLORREF color) const; + int SetBorder(int border) const; + int SetButtonSize(int size) const; + void SetChild(HWND hchild) const; + int SetPos(int pos) const; + + // Operations + void ForwardMouse(BOOL isForward) const; + void RecalcSize() const; + + protected: + // Overridables + virtual void PreRegisterClass(WNDCLASS& wc) override; + + private: + CPager(const CPager&) = delete; + CPager& operator=(const CPager&) = delete; + }; + + + ///////////////////////////////////////////////////////////// + // CProgressBar manages a ProgressBar control. A progress bar + // is a window that an application can use to indicate the + // progress of a lengthy operation. + class CProgressBar : public CWnd + { + public: + CProgressBar() = default; + virtual ~CProgressBar() override = default; + + int GetPos() const; + int GetRange(BOOL whichLimit, PBRANGE& range) const; + int GetRange(BOOL whichLimit) const; + int OffsetPos(int increment) const; + int SetPos(int pos) const; + int SetRange(short minRange, short maxRange) const; + int SetStep(int stepInc) const; + int StepIt() const; + + protected: + // Overridables + virtual void PreRegisterClass(WNDCLASS& wc) override; + + private: + CProgressBar(const CProgressBar&) = delete; + CProgressBar& operator=(const CProgressBar&) = delete; + }; + + + ///////////////////////////////////////////////////////////////////////// + // CScrollBar manages a ScrollBar control. + // Windows usually implement scroll bars internally with the WS_HSCROLL + // and WS_VSCROLL styles without the use of a separate ScrollBar control. + // Use CScrollBar if the bar needs to be displayed outside the scrolling + // window. + class CScrollBar : public CWnd + { + public: + CScrollBar() = default; + virtual ~CScrollBar() override = default; + + BOOL EnableScrollBar( UINT arrowFlags = ESB_ENABLE_BOTH ) const; + BOOL GetScrollInfo(SCROLLINFO& si) const; + int GetScrollPos() const; + BOOL GetScrollRange(int& minPos, int& maxPos) const; + BOOL SetScrollInfo(const SCROLLINFO& si, BOOL redraw = TRUE ) const; + int SetScrollPos(int pos, BOOL redraw) const; + BOOL SetScrollRange( int minPos, int maxPos, BOOL redraw = TRUE ) const; + BOOL ShowScrollBar(BOOL show) const; + + protected: + // Overridables + virtual void PreRegisterClass(WNDCLASS& wc) override; + + private: + CScrollBar(const CScrollBar&) = delete; + CScrollBar& operator=(const CScrollBar&) = delete; + }; + + /////////////////////////////////////////////////////////////////// + // CSlider manages a TrackBar control, also known a Slider control. + // A trackbar is a window that contains a slider and optional tick + // marks. When the user moves the slider, using either the mouse or + // the direction keys, the trackbar sends notification messages to + // indicate the change. + class CSlider : public CWnd + { + public: + CSlider() = default; + virtual ~CSlider() override = default; + + void ClearSel() const; + void ClearTics(BOOL redraw = FALSE ) const; + HWND GetBuddy(BOOL location = TRUE ) const; + CRect GetChannelRect() const; + int GetLineSize() const; + int GetNumTics() const; + int GetPageSize() const; + int GetPos() const; + int GetRangeMax() const; + int GetRangeMin() const; + int GetSelEnd() const; + int GetSelStart() const; + int GetThumbLength() const; + CRect GetThumbRect() const; + int GetTic(int tic ) const; + int GetTicPos(int tic) const; + HWND GetToolTips() const; + HWND SetBuddy(HWND buddy, BOOL location = TRUE ) const; + int SetLineSize(int size) const; + int SetPageSize(int size) const; + void SetPos(int pos, BOOL redraw = FALSE) const; + void SetRangeMax(int max, BOOL redraw = FALSE) const; + void SetRangeMin(int min, BOOL redraw = FALSE) const; + void SetSelection(int min, int max, BOOL redraw = FALSE) const; + BOOL SetTic(int tic) const; + void SetTicFreq(int freq) const; + int SetTipSide(int location) const; + void SetToolTips(HWND toolTip) const; + + protected: + // Overridables + virtual void PreRegisterClass(WNDCLASS& wc) override; + + private: + CSlider(const CSlider&) = delete; + CSlider& operator=(const CSlider&) = delete; + }; + + //////////////////////////////////////////////////////////// + // CSpinButton manages an Up-Down control, also known as a + // SpinButton control. An up-down control is a pair of arrow + // buttons that the user can click to increment or decrement + // a value, such as a scroll position or a number displayed + // in a companion control. + class CSpinButton : public CWnd + { + public: + CSpinButton() = default; + virtual ~CSpinButton() override = default; + + int GetAccel(int accels, LPUDACCEL pAccels) const; + int GetBase() const; + HWND GetBuddy() const; + int GetPos() const; + DWORD GetRange() const; + BOOL SetAccel(int accels, LPUDACCEL pAccels) const; + int SetBase(int base) const; + HWND SetBuddy(HWND buddy) const; + int SetPos(int pos) const; + void SetRange(int lower, int upper) const; + + protected: + // Overridables + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual void PreRegisterClass(WNDCLASS& wc) override; + + private: + CSpinButton(const CSpinButton&) = delete; + CSpinButton& operator=(const CSpinButton&) = delete; + }; + + + /////////////////////////////////////////////////////////// + // CToolTip manages a ToolTip control. ToolTip controls are + // pop-up windows that display text. + class CToolTip : public CWnd + { + public: + CToolTip() = default; + virtual ~CToolTip() override = default; + + // Accessors and mutators + CSize GetBubbleSize(HWND control, UINT id = -1) const; + int GetDelayTime(DWORD duration) const; + CRect GetMargin() const; + int GetMaxTipWidth() const; + CString GetText(HWND control, UINT id = -1) const; + COLORREF GetTipBkColor() const; + COLORREF GetTipTextColor() const; + int GetToolCount() const; + TOOLINFO GetToolInfo(HWND control, UINT id = -1) const; + void SetDelayTime(UINT delay) const; + void SetDelayTime(DWORD duration, int time) const; + void SetMargin(RECT rc) const; + int SetMaxTipWidth(int width) const; + void SetTipBkColor(COLORREF color) const; + void SetTipTextColor(COLORREF color) const; + void SetToolInfo(const TOOLINFO& toolInfo) const; + + //Operations + void Activate(BOOL activate) const; + BOOL AddTool(HWND control, RECT toolRect, UINT id, UINT textID) const; + BOOL AddTool(HWND control, UINT textID) const; + BOOL AddTool(HWND control, RECT toolRect, UINT id, LPCTSTR text = LPSTR_TEXTCALLBACK) const; + BOOL AddTool(HWND control, LPCTSTR text = LPSTR_TEXTCALLBACK) const; + BOOL AdjustRect(RECT& rc, BOOL isLarger = TRUE) const; + void DelTool(HWND control, UINT id = -1) const; + BOOL HitTest(HWND wnd, CPoint pt, const TOOLINFO& toolInfo) const; + void Pop() const; + void RelayEvent(MSG& msg) const; + BOOL SetTitle(UINT icon, LPCTSTR title) const; + void SetToolRect(RECT rc, HWND control, UINT id = -1) const; + void SetTTWindowTheme(LPCWSTR theme) const; + void Update() const; + void UpdateTipText(LPCTSTR text, HWND control, UINT id = -1) const; + void UpdateTipText(UINT textID, HWND control, UINT id = -1) const; + + protected: + // Overridables + virtual void FillToolInfo(TOOLINFO& info, HWND control) const; + virtual void FillToolInfo(TOOLINFO& info, HWND control, RECT rc, UINT id) const; + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual void PreRegisterClass(WNDCLASS& wc) override; + + private: + CToolTip(const CToolTip&) = delete; + CToolTip& operator=(const CToolTip&) = delete; + }; + +} // namespace Win32xx + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + //////////////////////////////////////// + // Definitions for the CAnimation class. + // + + // Closes an AVI clip. + // Refer to Animate_Close in the Windows API documentation for more information. + inline BOOL CAnimation::Close() const + { + assert(IsWindow()); + return Animate_Close(*this); + } + + // Opens an AVI clip and displays its first frame in an animation control. + // Refer to Animate_Open in the Windows API documentation for more information. + inline BOOL CAnimation::Open(LPCTSTR pathName) const + { + assert(IsWindow()); + return Animate_Open(*this, const_cast(pathName)); + } + + // Plays an AVI clip in an animation control. The control plays the clip + // in the background while the thread continues executing. + // from : Zero - based index of the frame where playing begins. The value must be less than 65,536. + // to: Zero - based index of the frame where playing ends. The value must be less than 65,536. + // A value of - 1 means end with the last frame in the AVI clip. + // repeat: Number of times to replay the AVI clip.A value of - 1 means replay the clip indefinitely. + // Refer to Animate_Play in the Windows API documentation for more information. + inline BOOL CAnimation::Play(int from, int to, int repeat) const + { + assert(IsWindow()); + return Animate_Play(*this, from, to, repeat); + } + + // Called by Create to set some window class parameters. + inline void CAnimation::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = ANIMATE_CLASS; + } + + // Directs an animation control to display a particular frame of an AVI clip. + // The control displays the clip in the background while the thread continues executing. + // Refer to Animate_Seek in the Windows API documentation for more information. + inline BOOL CAnimation::Seek(int frame) const + { + assert(IsWindow()); + return Animate_Seek(*this, frame); + } + + // Stops playing an AVI clip in an animation control. + // Refer to Animate_Stop in the Windows API documentation for more information. + inline BOOL CAnimation::Stop() const + { + assert(IsWindow()); + return Animate_Stop(*this); + } + + + /////////////////////////////////////// + // Definitions for the CComboBox class. + // + + // Adds a string to the list box of a combo box. If the combo box does not + // have the CBS_SORT style, the string is added to the end of the list. + // Otherwise, the string is inserted into the list, and the list is sorted. + // Refer to CB_ADDSTRING in the Windows API documentation for more information. + inline int CComboBox::AddString(LPCTSTR string) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(string); + return static_cast(SendMessage(CB_ADDSTRING, 0, lparam)); + } + + // Called by in response to the WM_COMPAREITEM message to determine the relative position + // of a new item in a sorted owner-draw list box. Override this function in an owner-drawn + // Combo-Box to specify the sort order when items are added using AddString. + // Refer to WM_COMPAREITEM in the Windows API documentation for more information. + inline int CComboBox::CompareItem(LPCOMPAREITEMSTRUCT) + { + // The return value indicates the relative position of the two items. + // It may be any of the values shown in the following table. + // + // Value Meaning + // -1 Item 1 precedes item 2 in the sorted order. + // 0 Items 1 and 2 are equivalent in the sorted order. + // 1 Item 1 follows item 2 in the sorted order. + + return 0; + } + + // Deletes the current selection, if any, from the combo box's edit control. + // Refer to WM_CLEAR in the Windows API documentation for more information. + inline void CComboBox::Clear() const + { + assert(IsWindow()); + SendMessage(WM_CLEAR, 0, 0); + } + + // Copies the current selection to the clipboard in CF_TEXT format. + // Refer to WM_COPY in the Windows API documentation for more information. + inline void CComboBox::Copy() const + { + assert(IsWindow()); + SendMessage(WM_COPY, 0, 0); + } + + // Deletes the current selection, if any, in the edit control and copies + // the deleted text to the clipboard in CF_TEXT format. + // Refer to WM_CUT in the Windows API documentation for more information. + inline void CComboBox::Cut() const + { + assert(IsWindow()); + SendMessage(WM_CUT, 0, 0); + } + + // Deletes a string in the list box of a combo box. + // Refer to CB_DELETESTRING in the Windows API documentation for more information. + inline int CComboBox::DeleteString(int index) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + return static_cast(SendMessage(CB_DELETESTRING, wparam, 0)); + } + + // Adds the names of directories and files that match a specified string + // and set of file attributes. + // Refer to CB_DIR in the Windows API documentation for more information. + inline int CComboBox::Dir(UINT attr, LPCTSTR wildCard ) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(attr); + LPARAM lparam = reinterpret_cast(wildCard); + return static_cast(SendMessage(CB_DIR, wparam, lparam)); + } + + // Search the list box of a combo box for an item beginning with the + // characters in a specified string. + // Refer to CB_FINDSTRING in the Windows API documentation for more information. + inline int CComboBox::FindString(int indexStart, LPCTSTR string) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(indexStart); + LPARAM lparam = reinterpret_cast(string); + return static_cast(SendMessage(CB_FINDSTRING, wparam, lparam)); + } + + // Find the first list box string in a combo box that matches the string specified in string. + // Refer to CB_FINDSTRINGEXACT in the Windows API documentation for more information. + inline int CComboBox::FindStringExact(int indexStart, LPCTSTR string) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(indexStart); + LPARAM lparam = reinterpret_cast(string); + return static_cast(SendMessage(CB_FINDSTRINGEXACT, wparam, lparam)); + } + + // Retrieves the COMBOBOXINFO struct containing information about the combo box. + inline BOOL CComboBox::GetComboBoxInfo(PCOMBOBOXINFO pcbi) const + { + assert(IsWindow()); + assert(pcbi); + *pcbi = {}; + pcbi->cbSize = sizeof(COMBOBOXINFO); + return ::GetComboBoxInfo(*this, pcbi); + } + + // Retrieves the number of items in the list box of the combo box. + // Refer to CB_GETCOUNT in the Windows API documentation for more information. + inline int CComboBox::GetCount() const + { + assert(IsWindow()); + return static_cast(SendMessage(CB_GETCOUNT, 0, 0)); + } + + // Retrieves the index of the currently selected item, if any, in the list box of the combo box. + // Refer to CB_GETCURSEL in the Windows API documentation for more information. + inline int CComboBox::GetCurSel() const + { + assert(IsWindow()); + return static_cast(SendMessage(CB_GETCURSEL, 0, 0)); + } + + // Retrieves the screen coordinates of the combo box in its dropped-down state. + // Refer to CB_GETDROPPEDCONTROLRECT in the Windows API documentation for more information. + inline CRect CComboBox::GetDroppedControlRect() const + { + assert(IsWindow()); + CRect rc; + LPARAM lparam = reinterpret_cast(&rc); + SendMessage(CB_GETDROPPEDCONTROLRECT, 0, lparam); + return rc; + } + + // Determines whether the list box of the combo box is dropped down. + // Refer to CB_GETDROPPEDSTATE in the Windows API documentation for more information. + inline BOOL CComboBox::GetDroppedState() const + { + assert(IsWindow()); + return static_cast(SendMessage(CB_GETDROPPEDSTATE, 0, 0)); + } + + // Retrieves the minimum allowable width, in pixels, of the list box of the combo box + // with the CBS_DROPDOWN or CBS_DROPDOWNLIST style. + // Refer to CB_GETDROPPEDWIDTH in the Windows API documentation for more information. + inline int CComboBox::GetDroppedWidth() const + { + assert(IsWindow()); + return static_cast(SendMessage(CB_GETDROPPEDWIDTH, 0, 0)); + } + + // Returns the handle to the edit box. + // Refer to GetComboBoxInfo in the Windows API documentation for more information. + inline HWND CComboBox::GetEditCtrl() const + { + COMBOBOXINFO cbi = {}; + cbi.cbSize = sizeof(cbi); + VERIFY(::GetComboBoxInfo(*this, &cbi)); + + return cbi.hwndItem; + } + + // Gets the starting and ending character positions of the current selection + // in the edit control of the combo box. + // Refer to CB_GETEDITSEL in the Windows API documentation for more information. + inline DWORD CComboBox::GetEditSel() const + { + assert(IsWindow()); + return static_cast(SendMessage(CB_GETEDITSEL, 0, 0)); + } + + // Determines whether the combo box has the default user interface or the extended user interface. + // Refer to CB_GETEXTENDEDUI in the Windows API documentation for more information. + inline BOOL CComboBox::GetExtendedUI() const + { + assert(IsWindow()); + return static_cast(SendMessage(CB_GETEXTENDEDUI, 0, 0)); + } + + // Retrieve from the combo box the width, in pixels, by which the list box can + // be scrolled horizontally (the scrollable width). + // Refer to CB_GETHORIZONTALEXTENT in the Windows API documentation for more information. + inline int CComboBox::GetHorizontalExtent() const + { + assert(IsWindow()); + return static_cast(SendMessage(CB_GETHORIZONTALEXTENT, 0, 0)); + } + + // Retrieves the application-supplied value associated with the specified item in the combo box. + // Refer to CB_GETITEMDATA in the Windows API documentation for more information. + inline DWORD CComboBox::GetItemData(int index) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + return static_cast(SendMessage(CB_GETITEMDATA, wparam, 0)); + } + + // Determines the height of list items or the selection field in the combo box. + // Refer to CB_GETITEMHEIGHT in the Windows API documentation for more information. + inline int CComboBox::GetItemHeight(int index) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + return static_cast(SendMessage(CB_GETITEMHEIGHT, wparam, 0)); + } + + // Returns the handle to the drop-down list. + // Refer to GetComboBoxInfo in the Windows API documentation for more information. + inline HWND CComboBox::GetLBCtrl() const + { + COMBOBOXINFO cbi = {}; + cbi.cbSize = sizeof(cbi); + VERIFY(::GetComboBoxInfo(*this, &cbi)); + + return cbi.hwndList; + } + + // Retrieves a string from the list of the combo box. + // Refer to CB_GETLBTEXT in the Windows API documentation for more information. + inline int CComboBox::GetLBText(int index, LPTSTR text) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + LPARAM lparam = reinterpret_cast(text); + return static_cast(SendMessage(CB_GETLBTEXT, wparam, lparam)); + } + + // Retrieves the length, in characters, of a string in the list of the combo box. + // Refer to CB_GETLBTEXTLEN in the Windows API documentation for more information. + inline int CComboBox::GetLBTextLen(int index) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + return static_cast(SendMessage(CB_GETLBTEXTLEN, wparam, 0)); + } + + // Retrieves the current locale of the combo box. + // Refer to CB_GETLOCALE in the Windows API documentation for more information. + inline LCID CComboBox::GetLocale() const + { + assert(IsWindow()); + return static_cast(SendMessage(CB_GETLOCALE, 0, 0)); + } + + // Retrieves the zero-based index of the first visible item in the list box portion of the combo box. + // Refer to CB_GETTOPINDEX in the Windows API documentation for more information. + inline int CComboBox::GetTopIndex() const + { + assert(IsWindow()); + return static_cast(SendMessage(CB_GETTOPINDEX, 0, 0)); + } + + // Allocates memory for storing list box items. Use this before adding a + // large number of items to the list box portion of a combo box. + // Refer to CB_INITSTORAGE in the Windows API documentation for more information. + inline int CComboBox::InitStorage(int items, int byteCount) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(items); + LPARAM lparam = static_cast(byteCount); + return static_cast(SendMessage(CB_INITSTORAGE, wparam, lparam)); + } + + // Inserts a string into the list box of the combo box. Unlike the AddString, + // a list with the CBS_SORT style is not sorted. + // Refer to CB_INSERTSTRING in the Windows API documentation for more information. + inline int CComboBox::InsertString(int index, LPCTSTR string) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + LPARAM lparam = reinterpret_cast(string); + return static_cast(SendMessage(CB_INSERTSTRING, wparam, lparam)); + } + + // Limits the length of the text the user may type into the edit control of the combo box. + // Refer to CB_LIMITTEXT in the Windows API documentation for more information. + inline void CComboBox::LimitText(int maxChars) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(maxChars); + SendMessage(CB_LIMITTEXT, wparam, 0); + } + + // Handle messages reflected back from the parent window. + // Override this function in your derived class to handle these special messages: + // WM_COMMAND, WM_CTLCOLORBTN, WM_CTLCOLOREDIT, WM_CTLCOLORDLG, WM_CTLCOLORLISTBOX, + // WM_CTLCOLORSCROLLBAR, WM_CTLCOLORSTATIC, WM_CHARTOITEM, WM_VKEYTOITEM, + // WM_HSCROLL, WM_VSCROLL, WM_DRAWITEM, WM_MEASUREITEM, WM_DELETEITEM, + // WM_COMPAREITEM, WM_PARENTNOTIFY. + inline LRESULT CComboBox::OnMessageReflect(UINT msg, WPARAM, LPARAM lparam) + { + LPCOMPAREITEMSTRUCT compare = reinterpret_cast(lparam); + switch (msg) + { + case WM_COMPAREITEM: return CompareItem(compare); + } + + return 0; // Allow other messages to be handled elsewhere. + } + + // Copies the current content of the clipboard to the combo box's edit control at the current caret position. + // Refer to WM_PASTE in the Windows API documentation for more information. + inline void CComboBox::Paste() const + { + assert(IsWindow()); + SendMessage(WM_PASTE, 0, 0); + } + + // Called by Create to set some window class parameters. + inline void CComboBox::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = _T("ComboBox"); + } + + // Removes all items from the list box and edit control of the combo box. + // Refer to CB_RESETCONTENT in the Windows API documentation for more information. + inline void CComboBox::ResetContent() const + { + assert(IsWindow()); + SendMessage(CB_RESETCONTENT, 0, 0); + } + + // Searches the list of a combo box for an item that begins with the characters in a + // specified string. If a matching item is found, it is selected and copied to the edit control. + // Refer to CB_SELECTSTRING in the Windows API documentation for more information. + inline int CComboBox::SelectString(int startAfter, LPCTSTR string) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(startAfter); + LPARAM lparam = reinterpret_cast(string); + return static_cast(SendMessage(CB_SELECTSTRING, wparam, lparam)); + } + + // Selects a string in the list of the combo box. If necessary, the list scrolls the string into view. + // Refer to CB_SETCURSEL in the Windows API documentation for more information. + inline int CComboBox::SetCurSel(int index) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + return static_cast(SendMessage(CB_SETCURSEL, wparam, 0)); + } + + // Sets the maximum allowable width, in pixels, of the list box of the combo box with + // the CBS_DROPDOWN or CBS_DROPDOWNLIST style. + // Refer to CB_SETDROPPEDWIDTH in the Windows API documentation for more information. + inline int CComboBox::SetDroppedWidth(int width) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(width); + return static_cast(SendMessage(CB_SETDROPPEDWIDTH, wparam, 0)); + } + + // Selects characters in the edit control of the combo box. + // Refer to CB_SETEDITSEL in the Windows API documentation for more information. + inline BOOL CComboBox::SetEditSel(int startChar, int endChar) const + { + assert(IsWindow()); + LPARAM lparam = MAKELONG(startChar, endChar); + return static_cast(SendMessage(CB_SETEDITSEL, 0, lparam)); + } + + // Selects either the default user interface or the extended user interface for the combo box that + // has the CBS_DROPDOWN or CBS_DROPDOWNLIST style. + // Refer to CB_SETEXTENDEDUI in the Windows API documentation for more information. + inline int CComboBox::SetExtendedUI(BOOL isExtended) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(isExtended); + return static_cast(SendMessage(CB_SETEXTENDEDUI, wparam, 0)); + } + + // Sets the width, in pixels, by which the list box can be scrolled horizontally (the scrollable width). + // Refer to CB_SETHORIZONTALEXTENT in the Windows API documentation for more information. + inline void CComboBox::SetHorizontalExtent(UINT extent ) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(extent); + SendMessage(CB_SETHORIZONTALEXTENT, wparam, 0); + } + + // Sets the value associated with the specified item in the combo box. + // Refer to CB_SETITEMDATA in the Windows API documentation for more information. + inline int CComboBox::SetItemData(int index, DWORD itemData) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + LPARAM lparam = static_cast(itemData); + return static_cast(SendMessage(CB_SETITEMDATA, wparam, lparam)); + } + + // Sets the height of list items or the selection field in the combo box. + // Refer to CB_SETITEMHEIGHT in the Windows API documentation for more information. + inline int CComboBox::SetItemHeight(int index, UINT cyItemHeight) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + LPARAM lparam = static_cast(cyItemHeight); + return static_cast(SendMessage(CB_SETITEMHEIGHT, wparam, lparam)); + } + + // Sets the current locale of the combo box. + // Refer to CB_SETLOCALE in the Windows API documentation for more information. + inline LCID CComboBox::SetLocale( LCID newLocale ) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(newLocale); + return static_cast(SendMessage(CB_SETLOCALE, wparam, 0)); + } + + // Ensure that a particular item is visible in the list box of the combo box. + // Refer to CB_SETTOPINDEX in the Windows API documentation for more information. + inline int CComboBox::SetTopIndex(int index) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + return static_cast(SendMessage(CB_SETTOPINDEX, wparam, 0)); + } + + // Ensure that a particular item is visible in the list box of the combo box. + // Refer to CB_SHOWDROPDOWN in the Windows API documentation for more information. + inline void CComboBox::ShowDropDown(BOOL show) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(show); + SendMessage(CB_SHOWDROPDOWN, wparam, 0); + } + + + ///////////////////////////////////////// + // Definitions for the CComboBoxEx class. + // + + // Removes an item from the ComboBoxEx control. + // Refer to CBEM_DELETEITEM in the Windows API documentation for more information. + inline int CComboBoxEx::DeleteItem(int index ) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + return static_cast(SendMessage(CBEM_DELETEITEM, wparam, 0)); + } + + // Retrieves the handle to the child combo box control. + // Refer to CBEM_GETCOMBOCONTROL in the Windows API documentation for more information. + inline HWND CComboBoxEx::GetComboBoxCtrl() const + { + assert(IsWindow()); + return reinterpret_cast(SendMessage(CBEM_GETCOMBOCONTROL, 0, 0)); + } + + // Retrieves the handle to the edit control portion of the ComboBoxEx control. + // Refer to CBEM_GETEDITCONTROL in the Windows API documentation for more information. + inline HWND CComboBoxEx::GetEditCtrl() const + { + assert(IsWindow()); + return reinterpret_cast(SendMessage(CBEM_GETEDITCONTROL, 0, 0)); + } + + // Retrieves the extended styles that are in use for the ComboBoxEx control. + // Refer to CBEM_GETEXTENDEDSTYLE in the Windows API documentation for more information. + inline DWORD CComboBoxEx::GetExtendedStyle() const + { + assert(IsWindow()); + return static_cast(SendMessage(CBEM_GETEXTENDEDSTYLE, 0, 0)); + } + + // Retrieves the handle to an image list assigned to the ComboBoxEx control. + // Refer to CBEM_GETIMAGELIST in the Windows API documentation for more information. + inline CImageList CComboBoxEx::GetImageList() const + { + assert(IsWindow()); + HIMAGELIST images = reinterpret_cast(SendMessage(CBEM_GETIMAGELIST, 0, 0)); + return CImageList(images); + } + + // Retrieves item information for the given ComboBoxEx item. + // Refer to CBEM_GETITEM in the Windows API documentation for more information. + inline BOOL CComboBoxEx::GetItem(COMBOBOXEXITEM& item) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&item); + return static_cast(SendMessage(CBEM_GETITEM, 0, lparam)); + } + + // Determines whether or not the user has changed the text of the ComboBoxEx edit control. + // Refer to CBEM_HASEDITCHANGED in the Windows API documentation for more information. + inline BOOL CComboBoxEx::HasEditChanged () const + { + assert(IsWindow()); + return static_cast(SendMessage(CBEM_HASEDITCHANGED, 0, 0)); + } + + // Inserts a new item in the ComboBoxEx control. + // Refer to CBEM_INSERTITEM in the Windows API documentation for more information. + inline int CComboBoxEx::InsertItem(const COMBOBOXEXITEM& item) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&item); + return static_cast(SendMessage(CBEM_INSERTITEM, 0, lparam)); + } + + // Called by Create to set some window class parameters. + inline void CComboBoxEx::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = WC_COMBOBOXEX; + } + + // Sets extended styles within the ComboBoxEx control. + // Refer to CBEM_SETEXTENDEDSTYLE in the Windows API documentation for more information. + inline DWORD CComboBoxEx::SetExtendedStyle(DWORD exMask, DWORD exStyles ) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(exMask); + LPARAM lparam = static_cast(exStyles); + return static_cast(SendMessage(CBEM_SETEXTENDEDSTYLE, wparam, lparam)); + } + + // Sets an image list for the ComboBoxEx control. + // Refer to CBEM_SETIMAGELIST in the Windows API documentation for more information. + inline CImageList CComboBoxEx::SetImageList(HIMAGELIST images) + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(images); + HIMAGELIST oldImages = reinterpret_cast(SendMessage(CBEM_SETIMAGELIST, 0, lparam)); + m_images = images; + return oldImages; + } + + // Sets the attributes for an item in the ComboBoxEx control. + // Refer to CBEM_SETITEM in the Windows API documentation for more information. + inline BOOL CComboBoxEx::SetItem(const COMBOBOXEXITEM& item) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&item); + return static_cast(SendMessage(CBEM_SETITEM, 0, lparam)); + } + + //////////////////////////////////////// + // Definitions for the CDateTime class + // + + // Retrieves the color for a given portion of the month calendar within the + // date and time picker (DTP) control. + // Refer to DateTime_GetMonthCalColor in the Windows API documentation for more information. + inline COLORREF CDateTime::GetMonthCalColor(int region) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(region); + return static_cast(DateTime_GetMonthCalColor(*this, wparam)); + } + + // Retrieves the handle to the date and time picker's (DTP) child month calendar control. + // Refer to DateTime_GetMonthCal in the Windows API documentation for more information. + inline HWND CDateTime::GetMonthCalCtrl() const + { + assert(IsWindow()); + return reinterpret_cast(DateTime_GetMonthCal(*this)); + } + + // Retrieves the font that the date and time picker (DTP) control's child + // month calendar control is currently using. + // Refer to DateTime_GetMonthCalFont in the Windows API documentation for more information. + inline CFont CDateTime::GetMonthCalFont() const + { + assert(IsWindow()); + HFONT font = reinterpret_cast(DateTime_GetMonthCalFont(*this)); + return CFont(font); + } + + // Retrieves the current minimum and maximum allowable system times for the + // date and time picker (DTP) control. + // Refer to DateTime_GetRange in the Windows API documentation for more information. + inline DWORD CDateTime::GetRange(SYSTEMTIME& minRange, SYSTEMTIME& maxRange) const + { + assert(IsWindow()); + + SYSTEMTIME ranges[2] = {}; + DWORD result = DateTime_GetRange(*this, ranges); + minRange = ranges[0]; + maxRange = ranges[1]; + return result; + } + + // Returns the currently selected time from a date and time picker (DTP) control + // Possible return codes are: GDT_VALID, GDT_ERROR, and GDT_NONE. + // A return code of GDT_NONE occurs if the control was set to the DTS_SHOWNONE + // style and the control check box was not selected. + // Refer to DateTime_GetSystemtime in the Windows API documentation for more information. + inline SYSTEMTIME CDateTime::GetTime(DWORD* pReturnCode) const + { + assert(IsWindow()); + SYSTEMTIME time = {}; + DWORD Res = DateTime_GetSystemtime(*this, &time); + if (pReturnCode) + *pReturnCode = Res; + + return time; + } + + // Called by Create to set some window class parameters. + inline void CDateTime::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = DATETIMEPICK_CLASS; + } + + // Sets the display of the date and time picker (DTP) control based on a given format string. + // Refer to DateTime_SetFormat in the Windows API documentation for more information. + inline BOOL CDateTime::SetFormat(LPCTSTR format) const + { + assert(IsWindow()); + return DateTime_SetFormat(*this, format); + } + + // Sets the color for a given portion of the month calendar within the date + // and time picker (DTP) control. + // Refer to DateTime_SetMonthCalColor in the Windows API documentation for more information. + inline COLORREF CDateTime::SetMonthCalColor(int region, COLORREF color) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(region); + LPARAM lparam = static_cast(color); + return static_cast(DateTime_SetMonthCalColor(*this, wparam, lparam)); + } + + // Sets the font to be used by the date and time picker (DTP) control's + // child month calendar control. + // Refer to DateTime_SetMonthCalFont in the Windows API documentation for more information. + inline void CDateTime::SetMonthCalFont(HFONT font, BOOL redraw /*= TRUE*/) const + { + assert(IsWindow()); + DateTime_SetMonthCalFont(*this, font, MAKELONG(redraw, 0)); + } + + // Sets the minimum and maximum allowable system times for the date and + // time picker (DTP) control. + // Refer to DateTime_SetRange in the Windows API documentation for more information. + inline BOOL CDateTime::SetRange(SYSTEMTIME minRange, SYSTEMTIME maxRange) const + { + assert(IsWindow()); + SYSTEMTIME ranges[2] = {}; + ranges[0] = minRange; + ranges[1] = maxRange; + DWORD flags = GDTR_MIN | GDTR_MAX; + + return DateTime_SetRange(*this, flags, ranges); + } + + // Sets the date and time picker (DTP) control to a given date and time. + // Refer to DateTime_SetSystemtime in the Windows API documentation for more information. + inline BOOL CDateTime::SetTime(SYSTEMTIME time) const + { + assert(IsWindow()); + return DateTime_SetSystemtime(*this, GDT_VALID, &time); + } + + // Set the DTP control to "no date" and clear its check box. + // Only applies to DTP controls that are set to the DTS_SHOWNONE style. + // Refer to DateTime_SetSystemtime in the Windows API documentation for more information. + inline BOOL CDateTime::SetTimeNone() const + { + assert(IsWindow()); + return DateTime_SetSystemtime(*this, GDT_NONE, nullptr); + } + + + ///////////////////////////////////// + // Definitions for the CHeader class. + // + + // Clears all of the filters for the header control. + // Refer to Header_ClearAllFilters in the Windows API documentation for more information. + inline int CHeader::ClearAllFilters() const + { + assert(IsWindow()); + return Header_ClearAllFilters(*this); + } + + // Clears the filter for the header control. + // Refer to Header_ClearFilter in the Windows API documentation for more information. + inline int CHeader::ClearFilter(int column) const + { + assert(IsWindow()); + return Header_ClearFilter(*this, column); + } + + // Creates a transparent version of an item image within the header control. + // Refer to Header_CreateDragImage in the Windows API documentation for more information. + inline CImageList CHeader::CreateDragImage(int index) const + { + assert(IsWindow()); + CImageList images; + images.CreateDragImage(*this, index); + return images; + } + + // Deletes an item from the header control. + // Refer to Header_DeleteItem in the Windows API documentation for more information. + inline BOOL CHeader::DeleteItem(int pos) const + { + assert(IsWindow()); + return Header_DeleteItem(*this, pos); + } + + // Moves the input focus to the edit box when a filter button has the focus. + // Refer to Header_EditFilter in the Windows API documentation for more information. + inline int CHeader::EditFilter(int column, BOOL discardChanges) const + { + assert(IsWindow()); + return Header_EditFilter(*this, column, MAKELPARAM(discardChanges, 0)); + } + + // Gets the width of the bitmap margin for a header control. + // Refer to Header_GetBitmapMargin in the Windows API documentation for more information. + inline int CHeader::GetBitmapMargin() const + { + assert(IsWindow()); + return Header_GetBitmapMargin(*this); + } + + // Retrieves the image list that has been set for the header control. + // Refer to Header_GetImageList in the Windows API documentation for more information. + inline CImageList CHeader::GetImageList() const + { + assert(IsWindow()); + HIMAGELIST images = Header_GetImageList(*this); + return CImageList(images); + } + + // Retrieves information about an item in a header control. + // Refer to Header_GetItem in the Windows API documentation for more information. + inline BOOL CHeader::GetItem(int pos, HDITEM& item) const + { + assert(IsWindow()); + return Header_GetItem(*this, pos, &item); + } + + // Retrieves the count of the items in a header control. + // Refer to Header_GetItemCount in the Windows API documentation for more information. + inline int CHeader::GetItemCount() const + { + assert(IsWindow()); + return Header_GetItemCount(*this); + } + + // Retrieves the bounding rectangle for a given item in a header control. + // Refer to HDM_GETITEMRECT in the Windows API documentation for more information. + inline CRect CHeader::GetItemRect(int index) const + { + assert(IsWindow()); + CRect rc; + WPARAM wparam = static_cast(index); + LPARAM lparam = reinterpret_cast(&rc); + SendMessage(HDM_GETITEMRECT, wparam, lparam); + return rc; + } + + // Retrieves the current left-to-right order of items in a header control. + // Refer to Header_GetOrderArray in the Windows API documentation for more information. + inline BOOL CHeader::GetOrderArray(LPINT pArray, int count) const + { + assert(IsWindow()); + return Header_GetOrderArray(*this, pArray, count); + } + + // Inserts a new item into the header control. + // Refer to Header_InsertItem in the Windows API documentation for more information. + inline int CHeader::InsertItem(int pos, const HDITEM& item) const + { + assert(IsWindow()); + return Header_InsertItem(*this, pos, &item); + } + + // Retrieves the correct size and position of the header control within + // the parent window. + // Refer to Header_Layout in the Windows API documentation for more information. + inline BOOL CHeader::Layout(HDLAYOUT* pHeaderLayout) const + { + assert(IsWindow()); + return Header_Layout(*this, pHeaderLayout); + } + + // Retrieves an index value for an item based on its order in the header control. + // Refer to Header_OrderToIndex in the Windows API documentation for more information. + inline int CHeader::OrderToIndex(int order) const + { + assert(IsWindow()); + return Header_OrderToIndex( *this, order); + } + + // Called by Create to set some window class parameters. + inline void CHeader::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = WC_HEADER; + } + + // Sets the width of the margin, specified in pixels, of a bitmap in the + // header control. + // Refer to Header_SetBitmapMargin in the Windows API documentation for more information. + inline int CHeader::SetBitmapMargin(int width) const + { + assert(IsWindow()); + return Header_SetBitmapMargin(*this, width); + } + + // Sets the timeout interval between the time a change takes place in the + // filter attributes + // and the posting of an HDN_FILTERCHANGE notification. + // Refer to Header_SetFilterChangeTimeout in the Windows API documentation for more information. + inline int CHeader::SetFilterChangeTimeout(DWORD timeout) const + { + assert(IsWindow()); + return Header_SetFilterChangeTimeout(*this, timeout); + } + + // Changes the color of a divider between header items to indicate the destination of + // an external drag-and-drop operation. + // Refer to Header_SetHotDivider in the Windows API documentation for more information. + inline int CHeader::SetHotDivider(CPoint pt) const + { + assert(IsWindow()); + return Header_SetHotDivider(*this, TRUE, MAKELPARAM(pt.x, pt.y)); + } + + // Changes the color of a divider between header items to indicate the + // destination of an external drag-and-drop operation. + // Refer to Header_SetHotDivider in the Windows API documentation for more information. + inline int CHeader::SetHotDivider(int index) const + { + assert(IsWindow()); + return Header_SetHotDivider(*this, FALSE, index); + } + + // Assigns an image list to the header control. + // Refer to Header_SetImageList in the Windows API documentation for more information. + inline CImageList CHeader::SetImageList(HIMAGELIST images) + { + assert(IsWindow()); + HIMAGELIST oldImages = Header_SetImageList(*this, images); + m_images = images; + return oldImages; + } + + // Sets the attributes of the specified item in a header control. + // Refer to Header_SetItem in the Windows API documentation for more information. + inline BOOL CHeader::SetItem(int pos, const HDITEM& item) const + { + assert(IsWindow()); + return Header_SetItem(*this, pos, &item); + } + + // Sets the left-to-right order of header items. + // Refer to Header_SetOrderArray in the Windows API documentation for more information. + inline BOOL CHeader::SetOrderArray(int count, LPINT pArray) const + { + assert(IsWindow()); + return Header_SetOrderArray(*this, count, pArray); + } + + + ///////////////////////////////////// + // Definitions for the CHotKey class. + // + + // Gets the virtual key code and modifier flags of a hot key + // Refer to HKM_GETHOTKEY in the Windows API documentation for more information. + inline DWORD CHotKey::GetHotKey() const + { + assert(IsWindow()); + return static_cast(SendMessage(HKM_GETHOTKEY, 0, 0)); + } + + // Retrieves a string that represents the name of a key. + // Refer to GetKeyNameText in the Windows API documentation for more information. + inline CString CHotKey::GetKeyName(UINT keyCode, BOOL isExtended) const + { + // Translate the virtual-key code to a scan code. + UINT scan = MapVirtualKey(keyCode, 0); + + // Construct an LPARAM with the scan code in Bits 16-23, and an extended flag in bit 24. + LPARAM lparam = LPARAM(scan) << 16; + if (isExtended) + lparam |= 0x01000000L; + + CString string; + int incompleteLength = 64; + int length = incompleteLength; + + // Loop until we have retrieved the entire string. + while (length == incompleteLength) + { + incompleteLength *= 4; + LPTSTR str = string.GetBuffer(incompleteLength); + length = ::GetKeyNameText(static_cast(lparam), str, incompleteLength + 1); + string.ReleaseBuffer(); + } + + return string; + } + + // Called by Create to set some window class parameters. + inline void CHotKey::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = HOTKEY_CLASS; + } + + // Sets the hot key combination for the control. + // Refer to HKM_SETHOTKEY in the Windows API documentation for more information. + inline void CHotKey::SetHotKey(DWORD key) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(key); + SendMessage(HKM_SETHOTKEY, wparam, 0); + } + + // Defines the invalid combinations and the default modifier combination + // for the control. + // Refer to HKM_SETRULES in the Windows API documentation for more information. + inline void CHotKey::SetRules(WORD invalidComb, WORD modifiers) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(invalidComb); + LPARAM lparam = static_cast(modifiers); + SendMessage(HKM_SETRULES, wparam, lparam); + } + + + //////////////////////////////////////// + // Definitions for the CIPAddress class. + // + + // Clears the contents of the IP address control. + // Refer to IPM_CLEARADDRESS in the Windows API documentation for more information. + inline void CIPAddress::ClearAddress() const + { + assert(IsWindow()); + SendMessage(IPM_CLEARADDRESS, 0, 0); + } + + // Gets the address values for all four fields in the IP address control. + // Refer to GetAddress in the Windows API documentation for more information. + inline int CIPAddress::GetAddress(BYTE& field0, BYTE& field1, BYTE& field2, BYTE& field3) const + { + DWORD addr; + int result = GetAddress(addr); + field0 = static_cast(FIRST_IPADDRESS(addr)); + field1 = static_cast(SECOND_IPADDRESS(addr)); + field2 = static_cast(THIRD_IPADDRESS(addr)); + field3 = static_cast(FOURTH_IPADDRESS(addr)); + return result; + } + + inline CString CIPAddress::GetAddress() const + { + DWORD addr = 0; + GetAddress(addr); + BYTE field0 = static_cast(FIRST_IPADDRESS(addr)); + BYTE field1 = static_cast(SECOND_IPADDRESS(addr)); + BYTE field2 = static_cast(THIRD_IPADDRESS(addr)); + BYTE field3 = static_cast(FOURTH_IPADDRESS(addr)); + CString str; + str.Format(_T("%d.%d.%d.%d"), field0, field1, field2, field3); + return str; + } + + // Gets the address values for all four fields in the IP address control. + // Refer to GetAddress in the Windows API documentation for more information. + inline int CIPAddress::GetAddress(DWORD& address) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&address); + return static_cast(SendMessage(IPM_GETADDRESS, 0, lparam)); + } + + // Determines if all fields in the IP address control are blank. + // Refer to IPM_ISBLANK in the Windows API documentation for more information. + inline BOOL CIPAddress::IsBlank() const + { + assert(IsWindow()); + return static_cast(SendMessage(IPM_ISBLANK, 0, 0)); + } + + // Called by Create to set some window class parameters. + inline void CIPAddress::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = WC_IPADDRESS; + } + + // Sets the address values for all four fields in the IP address control. + // Refer to IPM_SETADDRESS in the Windows API documentation for more information. + inline void CIPAddress::SetAddress(BYTE field0, BYTE field1, BYTE field2, BYTE field3) const + { + assert(IsWindow()); + SendMessage(IPM_SETADDRESS, 0, MAKEIPADDRESS(field0, field1, field2, field3)); + } + + // Sets the address values for all four fields in the IP address control. + // Refer to IPM_SETADDRESS in the Windows API documentation for more information. + inline void CIPAddress::SetAddress(DWORD address) const + { + assert(IsWindow()); + LPARAM lparam = static_cast(address); + SendMessage(IPM_SETADDRESS, 0, lparam); + } + + // Sets the keyboard focus to the specified field in the IP address control. + // All of the text in that field will be selected. + // Refer to IPM_SETFOCUS in the Windows API documentation for more information. + inline void CIPAddress::SetFieldFocus(WORD field) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(field); + SendMessage(IPM_SETFOCUS, wparam, 0); + } + + // Sets the valid range for the specified field in the IP address control. + // Refer to IPM_SETRANGE in the Windows API documentation for more information. + inline void CIPAddress::SetFieldRange(int field, BYTE lower, BYTE upper) const + { + assert(IsWindow()); + + WPARAM wparam = static_cast(field); + LPARAM lparam = MAKEIPRANGE(static_cast(lower), static_cast(upper)); + SendMessage(IPM_SETRANGE, wparam, lparam); + } + + + //////////////////////////////////////////// + // Definitions for the CMonthCalendar class. + // + + // Retrieves the color for a given portion of the month calendar control. + // Refer to MonthCal_GetColor in the Windows API documentation for more information. + inline COLORREF CMonthCalendar::GetColor(int region) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(region); + return static_cast(MonthCal_GetColor(*this, wparam)); + } + + // Retrieves the currently selected date. + // Refer to MCM_GETCURSEL in the Windows API documentation for more information. + inline SYSTEMTIME CMonthCalendar::GetCurSel() const + { + assert(IsWindow()); + SYSTEMTIME st = {}; + LPARAM lparam = reinterpret_cast(&st); + SendMessage(MCM_GETCURSEL, 0, lparam); + return st; + } + + // Retrieves the first day of the week. + // Refer to MonthCal_GetFirstDayOfWeek in the Windows API documentation for more information. + inline int CMonthCalendar::GetFirstDayOfWeek(BOOL* pLocal /*= nullptr*/) const + { + assert(IsWindow()); + DWORD result = MonthCal_GetFirstDayOfWeek(*this); + + if (pLocal) + *pLocal = HIWORD(result); + + return LOWORD(result); + } + + // Retrieves the maximum date range that can be selected. + // Refer to MonthCal_GetMaxSelCount in the Windows API documentation for more information. + inline int CMonthCalendar::GetMaxSelCount() const + { + assert(IsWindow()); + return static_cast(MonthCal_GetMaxSelCount(*this)); + } + + // Retrieves the minimum size required to display a full month + // Refer to MonthCal_GetMinReqRect in the Windows API documentation for more information. + inline CRect CMonthCalendar::GetMinReqRect() const + { + assert(IsWindow()); + CRect rc; + MonthCal_GetMinReqRect(*this, &rc); + return rc; + } + + // Retrieves the scroll rate for the month calendar control. + // Refer to MonthCal_GetMonthDelta in the Windows API documentation for more information. + inline int CMonthCalendar::GetMonthDelta() const + { + assert(IsWindow()); + return MonthCal_GetMonthDelta(*this); + } + + // Retrieves date information that represents the high and low limits of + // the month calendar control's display. + // Refer to MonthCal_GetMonthRange in the Windows API documentation for more information. + inline int CMonthCalendar::GetMonthRange(SYSTEMTIME& minRange, SYSTEMTIME& maxRange, DWORD flags) const + { + assert(IsWindow()); + SYSTEMTIME minMax[2] = {}; + int count = static_cast(MonthCal_GetMonthRange(*this, flags, minMax)); + minRange = minMax[0]; + maxRange = minMax[1]; + return count; + } + + // Retrieves the minimum and maximum allowable dates set for the month calendar control. + // Refer to MCM_GETRANGE in the Windows API documentation for more information. + inline LRESULT CMonthCalendar::GetRange(SYSTEMTIME& minRange, SYSTEMTIME& maxRange) const + { + assert(IsWindow()); + SYSTEMTIME minMax[2] = {}; + LPARAM lparam = reinterpret_cast(&minMax); + LRESULT value = SendMessage(MCM_GETRANGE, 0, lparam); + minRange = minMax[0]; + maxRange = minMax[1]; + return value; + } + + // Retrieves date information that represents the upper and lower limits of + // the date range currently selected by the user. + // Refer to MonthCal_GetSelRange in the Windows API documentation for more information. + inline LRESULT CMonthCalendar::GetSelRange(SYSTEMTIME& minRange, SYSTEMTIME& maxRange) const + { + assert(IsWindow()); + SYSTEMTIME minMax[2] = {}; + LRESULT value = MonthCal_GetSelRange(*this, &minMax); + minRange = minMax[0]; + maxRange = minMax[1]; + return value; + } + + // Retrieves the date information for the date specified as "today" for the + // month calendar control. + // Refer to MCM_GETTODAY in the Windows API documentation for more information. + inline SYSTEMTIME CMonthCalendar::GetToday() const + { + assert(IsWindow()); + SYSTEMTIME dateTime = {}; + LPARAM lparam = reinterpret_cast(&dateTime); + VERIFY (SendMessage(MCM_GETTODAY, 0, lparam)); + return dateTime; + } + + // Determines which portion of the month calendar control is at a given point on the screen. + // Refer to MonthCal_HitTest in the Windows API documentation for more information. + inline LRESULT CMonthCalendar::HitTest(MCHITTESTINFO& mcHitTest) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&mcHitTest); + return MonthCal_HitTest(*this, lparam); + } + + inline void CMonthCalendar::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = MONTHCAL_CLASS; + } + + // Sets the color for a given portion of the month calendar control. + // Refer to MonthCal_SetColor in the Windows API documentation for more information. + inline COLORREF CMonthCalendar::SetColor(int region, COLORREF clr) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(region); + LPARAM lparam = static_cast(clr); + return static_cast(MonthCal_SetColor(*this, wparam, lparam)); + } + + // Sets the currently selected date for the month calendar control. + // Refer to MonthCal_SetCurSel in the Windows API documentation for more information. + inline BOOL CMonthCalendar::SetCurSel(SYSTEMTIME dateTime) const + { + assert(IsWindow()); + return MonthCal_SetCurSel(*this, &dateTime); + } + + // Sets the day states for all months that are currently visible within the + // month calendar control. + // Refer to MonthCal_SetDayState in the Windows API documentation for more information. + inline BOOL CMonthCalendar::SetDayState(int months, LPMONTHDAYSTATE pStateArray) const + { + assert(IsWindow()); + return static_cast(MonthCal_SetDayState(*this, months, pStateArray)); + } + + // Sets the first day of the week for the month calendar control. + // Refer to MonthCal_SetFirstDayOfWeek in the Windows API documentation for more information. + inline BOOL CMonthCalendar::SetFirstDayOfWeek(int day, int* pOldDay/* = nullptr*/) const + { + assert(IsWindow()); + DWORD result = static_cast(MonthCal_SetFirstDayOfWeek(*this, day)); + + if (pOldDay) + *pOldDay = LOWORD(result); + + return (HIWORD(result))? TRUE : FALSE; + } + + // Sets the maximum number of days that can be selected in the month calendar control. + // Refer to MonthCal_SetMaxSelCount in the Windows API documentation for more information. + inline BOOL CMonthCalendar::SetMaxSelCount(int max) const + { + assert(IsWindow()); + return MonthCal_SetMaxSelCount(*this, max); + } + + // Sets the scroll rate for the month calendar control. + // Refer to MonthCal_SetMonthDelta in the Windows API documentation for more information. + inline int CMonthCalendar::SetMonthDelta(int delta) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(delta); + return MonthCal_SetMonthDelta(*this, wparam); + } + + // Sets the minimum and maximum allowable dates for the month calendar control. + // Refer to MonthCal_SetRange in the Windows API documentation for more information. + inline BOOL CMonthCalendar::SetRange(SYSTEMTIME minRange, SYSTEMTIME maxRange) const + { + SYSTEMTIME minMax[2] = {}; + DWORD limit = GDTR_MIN | GDTR_MAX; + + minMax[0] = minRange; + minMax[1] = maxRange; + + return MonthCal_SetRange(*this, limit, &minMax); + } + + // Sets the selection for the month calendar control to a given date range. + // Refer to MonthCal_SetSelRange in the Windows API documentation for more information. + inline BOOL CMonthCalendar::SetSelRange(SYSTEMTIME minRange, SYSTEMTIME maxRange) const + { + SYSTEMTIME minMax[2] = {}; + minMax[0] = minRange; + minMax[1] = maxRange; + + return static_cast(MonthCal_SetSelRange(*this, &minMax)); + } + + // Sets the "today" selection for the month calendar control. + // Refer to MonthCal_SetToday in the Windows API documentation for more information. + inline void CMonthCalendar::SetToday(SYSTEMTIME dateTime) const + { + assert(IsWindow()); + MonthCal_SetToday(*this, &dateTime); + } + + //////////////////////////////////////// + // Definitions for the CPager class + // + + // Enables or disables mouse forwarding for the pager control. When mouse + // forwarding is enabled, the pager control forwards WM_MOUSEMOVE messages + // to the contained window. + // Refer to Pager_ForwardMouse in the Windows API documentation for more + // information. + inline void CPager::ForwardMouse(BOOL isForward) const + { + assert(IsWindow()); + Pager_ForwardMouse(*this, isForward); + } + + // Retrieves the current background color for the pager control. + // Refer to Pager_GetBkColor in the Windows API documentation for more + // information. + inline COLORREF CPager::GetBkColor() const + { + assert(IsWindow()); + return Pager_GetBkColor(*this); + } + + // Retrieves the current border size for the pager control. + // Refer to Pager_GetBorder in the Windows API documentation for more + // information. + inline int CPager::GetBorder() const + { + assert(IsWindow()); + return Pager_GetBorder(*this); + } + + // Retrieves the current button size for the pager control. + // Refer to Pager_GetButtonSize in the Windows API documentation for + // more information. + inline int CPager::GetButtonSize() const + { + assert(IsWindow()); + return Pager_GetButtonSize(*this); + } + + // Retrieves the state of the specified button in a pager control. + // Refer to Pager_GetButtonState in the Windows API documentation for + // more information. + inline DWORD CPager::GetButtonState(int button) const + { + assert(IsWindow()); + return Pager_GetButtonState(*this, button); + } + + // Retrieves the current scroll position of the pager control. + // Refer to Pager_GetPos in the Windows API documentation for more + // information. + inline int CPager::GetPos() const + { + assert(IsWindow()); + return Pager_GetPos(*this); + } + + // Called by Create to set some window class parameters. + inline void CPager::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = WC_PAGESCROLLER; + } + + // Forces the pager control to recalculate the size of the contained + // window. This will result in a PGN_CALCSIZE notification being sent. + // Refer to Pager_RecalcSize in the Windows API documentation for more + // information. + inline void CPager::RecalcSize() const + { + assert(IsWindow()); + Pager_RecalcSize(*this); + } + + // Sets the current background color for the pager control. + // Refer to Pager_SetBkColor in the Windows API documentation for more + // information. + inline void CPager::SetBkColor(COLORREF color) const + { + assert(IsWindow()); + Pager_SetBkColor(*this, color); + } + + // Sets the current border size for the pager control. + // Refer to Pager_SetBorder in the Windows API documentation for more + // information. + inline int CPager::SetBorder(int border) const + { + assert(IsWindow()); + return Pager_SetBorder(*this, border); + } + + // Sets the current button size for the pager control. + // Refer to Pager_SetButtonSize in the Windows API documentation for + // more information. + inline int CPager::SetButtonSize(int size) const + { + assert(IsWindow()); + return Pager_SetButtonSize(*this, size); + } + + // Sets the contained window for the pager control. This will not change + // the parent of the contained window; it only assigns a window handle + // to the pager control for scrolling. + // Refer to Pager_SetChild in the Windows API documentation for more + // information. + inline void CPager::SetChild(HWND hchild) const + { + assert(IsWindow()); + Pager_SetChild(*this, hchild); + } + + // Sets the scroll position for the pager control. + // Refer to Pager_SetPos in the Windows API documentation for more + // information. + inline int CPager::SetPos(int pos) const + { + assert(IsWindow()); + return Pager_SetPos(*this, pos); + } + + ////////////////////////////////////////// + // Definitions for the CProgressBar class. + // + + // Retrieves the current position of the progress bar. + // Refer to PBM_GETPOS in the Windows API documentation for more information. + inline int CProgressBar::GetPos() const + { + assert(IsWindow()); + return static_cast(SendMessage(PBM_GETPOS, 0, 0)); + } + + // Retrieves information about the current high and low limits of the + // progress bar control. + // The PBRANGE struct is filled with the retrieved ranges. + // Refer to PBM_GETRANGE in the Windows API documentation for more information. + inline int CProgressBar::GetRange(BOOL whichLimit, PBRANGE& range) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(whichLimit); + LPARAM lparam = reinterpret_cast(&range); + return static_cast(SendMessage(PBM_GETRANGE, wparam, lparam)); + } + + // Retrieves information about the current high and low limits of the + // progress bar control. + // Refer to PBM_GETRANGE in the Windows API documentation for more information. + inline int CProgressBar::GetRange(BOOL whichLimit) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(whichLimit); + return static_cast(SendMessage(PBM_GETRANGE, wparam, 0)); + } + + // Advances the current position of the progress bar by a specified + // increment and redraws the bar to reflect the new position. + // Refer to PBM_DELTAPOS in the Windows API documentation for more information. + inline int CProgressBar::OffsetPos(int increment) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(increment); + return static_cast(SendMessage(PBM_DELTAPOS, wparam, 0)); + } + + inline void CProgressBar::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = PROGRESS_CLASS; + } + + // Sets the current position for the progress bar and redraws the bar to + // reflect the new position. + // Refer to PBM_SETPOS in the Windows API documentation for more information. + inline int CProgressBar::SetPos(int pos) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(pos); + return static_cast(SendMessage(PBM_SETPOS, wparam, 0)); + } + + // Sets the minimum and maximum values for the progress bar and redraws the + // bar to reflect the new range. + // Refer to PBM_SETRANGE in the Windows API documentation for more information. + inline int CProgressBar::SetRange(short minRange, short maxRange) const + { + assert(IsWindow()); + return static_cast(SendMessage(PBM_SETRANGE, 0, MAKELPARAM(minRange, maxRange))); + } + + // Specifies the step increment for the progress bar. + // Refer to PBM_SETSTEP in the Windows API documentation for more information. + inline int CProgressBar::SetStep(int stepInc) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(stepInc); + return static_cast(SendMessage(PBM_SETSTEP, wparam, 0)); + } + + // Advances the current position for a progress bar by the step increment and + // redraws the bar to reflect the new position. + // Refer to PBM_STEPIT in the Windows API documentation for more information. + inline int CProgressBar::StepIt() const + { + assert(IsWindow()); + return static_cast(SendMessage(PBM_STEPIT, 0, 0)); + } + + + //////////////////////////////////////// + // Definitions for the CScrollBar class. + // + + // Enables or disables the scroll bar arrows. + // Refer to EnableScrollBar in the Windows API documentation for more information. + inline BOOL CScrollBar::EnableScrollBar( UINT arrowFlags ) const + { + assert(IsWindow()); + return ::EnableScrollBar(*this, SB_CTL, arrowFlags); + } + + // Retrieves the parameters of a scroll bar, including the minimum and + // maximum scrolling positions, the page size, and the position of the + // scroll box (thumb). + // Refer to GetScrollInfo in the Windows API documentation for more information. + inline BOOL CScrollBar::GetScrollInfo(SCROLLINFO& si) const + { + assert(IsWindow()); + return ::GetScrollInfo(*this, SB_CTL, &si); + } + + // Retrieves the current position of the scroll box (thumb) in the scroll bar. + // Refer to GetScrollPos in the Windows API documentation for more information. + inline int CScrollBar::GetScrollPos() const + { + assert(IsWindow()); + return ::GetScrollPos(*this, SB_CTL); + } + + // Retrieves the current minimum and maximum scroll box (thumb) positions + // for the scroll bar. + // Refer to GetScrollRange in the Windows API documentation for more information. + inline BOOL CScrollBar::GetScrollRange(int& minPos, int& maxPos ) const + { + assert(IsWindow()); + return ::GetScrollRange(*this, SB_CTL, &minPos, &maxPos); + } + + // Called by Create to set some window class parameters. + inline void CScrollBar::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = _T("SCROLLBAR"); + } + + // Sets the parameters of the scroll bar, including the minimum and maximum + // scrolling positions, the page size, and the position of the scroll box. + // Refer to SetScrollInfo in the Windows API documentation for more information. + inline BOOL CScrollBar::SetScrollInfo(const SCROLLINFO& si, BOOL redraw ) const + { + assert(IsWindow()); + return ::SetScrollInfo(*this, SB_CTL, &si, redraw); + } + + // Sets the position of the scroll box (thumb) in the scroll bar and + // redraws the scroll bar to reflect the new position of the scroll box + // if requested. + // Refer to SetScrollPos in the Windows API documentation for more information. + inline int CScrollBar::SetScrollPos(int pos, BOOL redraw) const + { + assert(IsWindow()); + return ::SetScrollPos(*this, SB_CTL, pos, redraw); + } + + // Sets the minimum and maximum scroll box positions for the scroll bar. + // Refer to SetScrollRange in the Windows API documentation for more information. + inline BOOL CScrollBar::SetScrollRange( int minPos, int maxPos, BOOL redraw ) const + { + assert(IsWindow()); + return ::SetScrollRange(*this, SB_CTL, minPos, maxPos, redraw); + } + + // Shows or hides the scroll bar. + // Refer to ShowScrollBar in the Windows API documentation for more information. + inline BOOL CScrollBar::ShowScrollBar(BOOL show) const + { + assert(IsWindow()); + return ::ShowScrollBar(*this, SB_CTL, show); + } + + ///////////////////////////////////// + // Definitions for the CSlider class. + // + + // Clears the current selection range in the trackbar. + // Refer to TBM_CLEARSEL in the Windows API documentation for more information. + inline void CSlider::ClearSel() const + { + assert(IsWindow()); + SendMessage(TBM_CLEARSEL, 0, 0); + } + + // Removes the current tick marks from the trackbar. + // Refer to TBM_CLEARTICS in the Windows API documentation for more information. + inline void CSlider::ClearTics(BOOL redraw) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(redraw); + SendMessage(TBM_CLEARTICS, wparam, 0); + } + + // Retrieves the handle to the trackbar control buddy window at a given location. + // Refer to TBM_GETBUDDY in the Windows API documentation for more information. + inline HWND CSlider::GetBuddy(BOOL location) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(location); + return reinterpret_cast(SendMessage(TBM_GETBUDDY, wparam, 0)); + } + + // Retrieves the size and position of the bounding rectangle for the + // trackbar's channel. + // Refer to TBM_GETCHANNELRECT in the Windows API documentation for more information. + inline CRect CSlider::GetChannelRect() const + { + assert(IsWindow()); + CRect rc; + LPARAM lparam = reinterpret_cast(&rc); + SendMessage(TBM_GETCHANNELRECT, 0, lparam); + return rc; + } + + // Retrieves the number of logical positions the trackbar's slider moves in + // response to keyboard input from the arrow keys. + // Refer to TBM_GETLINESIZE in the Windows API documentation for more information. + inline int CSlider::GetLineSize() const + { + assert(IsWindow()); + return static_cast(SendMessage(TBM_GETLINESIZE, 0, 0)); + } + + // Retrieves the number of tick marks in the trackbar. + // Refer to TBM_GETNUMTICS in the Windows API documentation for more information. + inline int CSlider::GetNumTics() const + { + assert(IsWindow()); + return static_cast(SendMessage(TBM_GETNUMTICS, 0, 0)); + } + + // Retrieves the number of logical positions the trackbar's slider moves in + // response to keyboard input, or mouse input, such as clicks in the + // trackbar's channel. + // Refer to TBM_GETPAGESIZE in the Windows API documentation for more information. + inline int CSlider::GetPageSize() const + { + assert(IsWindow()); + return static_cast(SendMessage(TBM_GETPAGESIZE, 0, 0)); + } + + // Retrieves the current logical position of the slider in the trackbar. + // Refer to TBM_GETPOS in the Windows API documentation for more information. + inline int CSlider::GetPos() const + { + assert(IsWindow()); + return static_cast(SendMessage(TBM_GETPOS, 0, 0)); + } + + // Retrieves the maximum position for the slider in the trackbar. + // Refer to TBM_GETRANGEMAX in the Windows API documentation for more information. + inline int CSlider::GetRangeMax() const + { + assert(IsWindow()); + return static_cast(SendMessage(TBM_GETRANGEMAX, 0, 0)); + } + + // Retrieves the minimum position for the slider in the trackbar. + // Refer to TBM_GETRANGEMIN in the Windows API documentation for more information. + inline int CSlider::GetRangeMin() const + { + assert(IsWindow()); + return static_cast(SendMessage(TBM_GETRANGEMIN, 0, 0)); + } + + // Retrieves the ending position of the current selection range in the trackbar. + // Refer to TBM_GETSELEND in the Windows API documentation for more information. + inline int CSlider::GetSelEnd() const + { + assert(IsWindow()); + return static_cast(SendMessage(TBM_GETSELEND, 0, 0)); + } + + // Retrieves the starting position of the current selection range in the trackbar. + // Refer to TBM_GETSELSTART in the Windows API documentation for more information. + inline int CSlider::GetSelStart() const + { + assert(IsWindow()); + return static_cast(SendMessage(TBM_GETSELSTART, 0, 0)); + } + + // Retrieves the length of the slider in the trackbar. + // Refer to TBM_GETTHUMBLENGTH in the Windows API documentation for more information. + inline int CSlider::GetThumbLength() const + { + assert(IsWindow()); + return static_cast(SendMessage(TBM_GETTHUMBLENGTH, 0, 0)); + } + + // Retrieves the size and position of the bounding rectangle for the slider + // in the trackbar. + // Refer to TBM_GETTHUMBRECT in the Windows API documentation for more information. + inline CRect CSlider::GetThumbRect() const + { + CRect rc; + LPARAM lparam = reinterpret_cast(&rc); + SendMessage(TBM_GETTHUMBRECT, 0, lparam); + return rc; + } + + // Retrieves the logical position of a tick mark in the trackbar. + // Refer to TBM_GETTIC in the Windows API documentation for more information. + inline int CSlider::GetTic(int tic) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(tic); + return static_cast(SendMessage(TBM_GETTIC, wparam, 0)); + } + + // Retrieves the current physical position of a tick mark in the trackbar. + // Refer to TBM_GETTICPOS in the Windows API documentation for more information. + inline int CSlider::GetTicPos(int tic) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(tic); + return static_cast(SendMessage(TBM_GETTICPOS, wparam, 0)); + } + + // Retrieves the handle to the ToolTip control assigned to the trackbar. + // Refer to TBM_GETTOOLTIPS in the Windows API documentation for more information. + inline HWND CSlider::GetToolTips() const + { + assert(IsWindow()); + return reinterpret_cast(SendMessage(TBM_GETTOOLTIPS, 0, 0)); + } + + // Called by Create to set some window class parameters. + inline void CSlider::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = TRACKBAR_CLASS; + } + + // Assigns a window as the buddy window for the trackbar control. + // Refer to TBM_SETBUDDY in the Windows API documentation for more information. + inline HWND CSlider::SetBuddy(HWND buddy, BOOL location /*= TRUE*/ ) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(location); + LPARAM lparam = reinterpret_cast(buddy); + return reinterpret_cast(SendMessage(TBM_SETBUDDY, wparam, lparam)); + } + + // Sets the number of logical positions the trackbar's slider moves in + // response to keyboard input from the arrow keys. + // Refer to TBM_SETLINESIZE in the Windows API documentation for more information. + inline int CSlider::SetLineSize(int size) const + { + assert(IsWindow()); + LPARAM lparam = static_cast(size); + return static_cast(SendMessage(TBM_SETLINESIZE, 0, lparam)); + } + + // Sets the number of logical positions the trackbar's slider moves in + // response to keyboard input, or mouse input such as clicks in the + // trackbar's channel. + // Refer to TBM_SETPAGESIZE in the Windows API documentation for more information. + inline int CSlider::SetPageSize(int size) const + { + assert(IsWindow()); + LPARAM lparam = static_cast(size); + return static_cast(SendMessage(TBM_SETPAGESIZE, 0, lparam)); + } + + // Sets the current logical position of the slider in the trackbar. + // Refer to TBM_SETPOS in the Windows API documentation for more information. + inline void CSlider::SetPos(int pos, BOOL redraw) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(redraw); + LPARAM lparam = static_cast(pos); + SendMessage(TBM_SETPOS, wparam, lparam); + } + + // Sets the maximum logical position for the slider in the trackbar. + // Refer to TBM_SETRANGEMAX in the Windows API documentation for more information. + inline void CSlider::SetRangeMax(int max, BOOL redraw) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(redraw); + LPARAM lparam = static_cast(max); + SendMessage(TBM_SETRANGEMAX, wparam, lparam); + } + + // Sets the minimum logical position for the slider in the trackbar. + // Refer to TBM_SETRANGEMIN in the Windows API documentation for more information. + inline void CSlider::SetRangeMin(int min, BOOL redraw) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(redraw); + LPARAM lparam = static_cast(min); + SendMessage(TBM_SETRANGEMIN, wparam, lparam); + } + + // Sets the starting and ending positions for the available selection range + // in the trackbar. + // Refer to TBM_SETSEL in the Windows API documentation for more information. + inline void CSlider::SetSelection(int min, int max, BOOL redraw) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(redraw); + SendMessage(TBM_SETSEL, wparam, MAKELONG(max, min)); + } + + // Sets a tick mark in the trackbar at the specified logical position. + // Refer to TBM_SETTIC in the Windows API documentation for more information. + inline BOOL CSlider::SetTic(int tic) const + { + assert(IsWindow()); + LPARAM lparam = static_cast(tic); + return static_cast(SendMessage(TBM_SETTIC, 0, lparam)); + } + + // Sets the interval frequency for tick marks in the trackbar. + // Refer to TBM_SETTICFREQ in the Windows API documentation for more information. + inline void CSlider::SetTicFreq(int freq) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(freq); + SendMessage(TBM_SETTICFREQ, wparam, 0); + } + + // Positions a ToolTip control used by the trackbar control. + // Refer to TBM_SETTIPSIDE in the Windows API documentation for more information. + inline int CSlider::SetTipSide(int location) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(location); + return static_cast(SendMessage(TBM_SETTIPSIDE, wparam, 0)); + } + + // Assigns a ToolTip control to the trackbar control. + // Refer to TBM_SETTOOLTIPS in the Windows API documentation for more information. + inline void CSlider::SetToolTips(HWND toolTip) const + { + assert(IsWindow()); + WPARAM wparam = reinterpret_cast(toolTip); + SendMessage(TBM_SETTOOLTIPS, wparam, 0); + } + + ///////////////////////////////////////// + // Definitions for the CSpinButton class. + // + + // Retrieves acceleration information for the up-down control. + // Refer to UDM_GETACCEL in the Windows API documentation for more information. + inline int CSpinButton::GetAccel(int accels, LPUDACCEL pAccels) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(accels); + LPARAM lparam = reinterpret_cast(pAccels); + return static_cast(SendMessage(UDM_GETACCEL, wparam, lparam)); + } + + // Retrieves the current radix base (that is, either base 10 or 16) for the + // up-down control. + // Refer to UDM_GETBASE in the Windows API documentation for more information. + inline int CSpinButton::GetBase() const + { + assert(IsWindow()); + return static_cast(SendMessage(UDM_GETBASE, 0, 0)); + } + + // Retrieves the handle to the current buddy window. + // Refer to UDM_GETBUDDY in the Windows API documentation for more information. + inline HWND CSpinButton::GetBuddy() const + { + assert(IsWindow()); + return reinterpret_cast(SendMessage(UDM_GETBUDDY, 0, 0)); + } + + // Retrieves the current position of the up-down control with 16-bit precision. + // Refer to UDM_GETPOS in the Windows API documentation for more information. + inline int CSpinButton::GetPos() const + { + assert(IsWindow()); + return static_cast(SendMessage(UDM_GETPOS, 0, 0)); + } + + // Retrieves the minimum and maximum positions (range) for the up-down control. + // Refer to UDM_GETRANGE in the Windows API documentation for more information. + inline DWORD CSpinButton::GetRange() const + { + assert(IsWindow()); + return static_cast(SendMessage(UDM_GETRANGE, 0, 0)); + } + + // Sets the CREATESTRUCT parameters before the control is created. + inline void CSpinButton::PreCreate(CREATESTRUCT& cs) + { + cs.style = WS_CHILD | WS_VISIBLE | WS_BORDER | UDS_SETBUDDYINT; + } + + // Sets the WNDCLASS parameters before the control is created. + inline void CSpinButton::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = UPDOWN_CLASS; + } + + // Sets the acceleration for the up-down control. + // Refer to UDM_SETACCEL in the Windows API documentation for more information. + inline BOOL CSpinButton::SetAccel(int accels, LPUDACCEL pAccels) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(accels); + LPARAM lparam = reinterpret_cast(pAccels); + return static_cast(SendMessage(UDM_SETACCEL, wparam, lparam)); + } + + // Sets the radix base for the up-down control. + // Refer to UDM_SETBASE in the Windows API documentation for more information. + inline int CSpinButton::SetBase(int base) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(base); + return static_cast(SendMessage(UDM_SETBASE, wparam, 0)); + } + + // Sets the buddy window for the up-down control. + // Refer to UDM_SETBUDDY in the Windows API documentation for more information. + inline HWND CSpinButton::SetBuddy(HWND buddy) const + { + assert(IsWindow()); + WPARAM wparam = reinterpret_cast(buddy); + return reinterpret_cast(SendMessage(UDM_SETBUDDY, wparam, 0)); + } + + // Sets the current position for the up-down control with 16-bit precision. + // Refer to UDM_SETPOS in the Windows API documentation for more information. + inline int CSpinButton::SetPos(int pos) const + { + assert(IsWindow()); + LPARAM lparam = MAKELONG(static_cast(pos), 0); + return static_cast(SendMessage(UDM_SETPOS, 0, lparam)); + } + + // Sets the minimum and maximum positions (range) for the up-down control. + // Refer to UDM_SETRANGE in the Windows API documentation for more information. + inline void CSpinButton::SetRange(int lower, int upper) const + { + assert(IsWindow()); + SendMessage(UDM_SETRANGE, 0, MAKELONG(upper, lower)); + } + + ////////////////////////////////////// + // Definitions for the CToolTip class. + // + + // Activates or deactivates a ToolTip control. + // Refer to TTM_ACTIVATE in the Windows API documentation for more information. + inline void CToolTip::Activate(BOOL activate) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(activate); + SendMessage(TTM_ACTIVATE, wparam, 0); + } + + // Registers a tool with a ToolTip control. + // control specifies the window that triggers the tooltip. + // toolRect specifies the part of the window that triggers the tooltip. + // textID specifies the ID of the text resource. + // id is a user defined ID. It is required if the control has multiple tooltips. + // Refer to TTM_ADDTOOL in the Windows API documentation for more information. + inline BOOL CToolTip::AddTool(HWND control, RECT toolRect, UINT id, UINT textID) const + { + assert(IsWindow()); + TOOLINFO info; + FillToolInfo(info, control, toolRect, id); + info.hinst = GetApp()->GetResourceHandle(); + info.lpszText = MAKEINTRESOURCE(textID); + LPARAM lparam = reinterpret_cast(&info); + return static_cast(SendMessage(TTM_ADDTOOL, 0, lparam)); + } + + // Registers a tool with a ToolTip control. + // control specifies the window that triggers the tooltip. + // textID specifies the ID of the text resource + // Refer to TTM_ADDTOOL in the Windows API documentation for more information. + inline BOOL CToolTip::AddTool(HWND control, UINT textID) const + { + assert(IsWindow()); + TOOLINFO info; + FillToolInfo(info, control); + info.hinst = GetApp()->GetResourceHandle(); + info.lpszText = MAKEINTRESOURCE(textID); + LPARAM lparam = reinterpret_cast(&info); + return static_cast(SendMessage(TTM_ADDTOOL, 0, lparam)); + } + + // Registers a tool with a ToolTip control. + // control specifies the window that triggers the tooltip. + // toolRect specifies the part of the window that triggers the tooltip. + // If text contains the value LPSTR_TEXTCALLBACK, TTN_NEEDTEXT notification + // messages are sent to the parent window. + // id is a user defined ID. It is required if the control has multiple tooltips. + // Refer to TTM_ADDTOOL in the Windows API documentation for more information. + inline BOOL CToolTip::AddTool(HWND control, RECT toolRect, UINT id, LPCTSTR text /*= LPSTR_TEXTCALLBACK*/) const + { + assert(IsWindow()); + TOOLINFO info; + FillToolInfo(info, control, toolRect, id); + info.lpszText = const_cast(text); + LPARAM lparam = reinterpret_cast(&info); + return static_cast(SendMessage(TTM_ADDTOOL, 0, lparam)); + } + + // Registers a tool with a ToolTip control. + // control specifies the window that triggers the tooltip. + // If text contains the value LPSTR_TEXTCALLBACK, TTN_NEEDTEXT notification + // messages are sent to the parent window. + // Refer to TTM_ADDTOOL in the Windows API documentation for more information. + inline BOOL CToolTip::AddTool(HWND control, LPCTSTR text /*= LPSTR_TEXTCALLBACK*/) const + { + assert(IsWindow()); + TOOLINFO info; + FillToolInfo(info, control); + info.lpszText = const_cast(text); + LPARAM lparam = reinterpret_cast(&info); + return static_cast(SendMessage(TTM_ADDTOOL, 0, lparam)); + } + + // Calculates a ToolTip control's text display rectangle from its window + // rectangle, or the ToolTip window rectangle needed to display a specified + // text display rectangle. + // Refer to TTM_ADJUSTRECT in the Windows API documentation for more information. + inline BOOL CToolTip::AdjustRect(RECT& rc, BOOL isLarger /*= TRUE*/) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(isLarger); + LPARAM lparam = reinterpret_cast(&rc); + return static_cast(SendMessage(TTM_ADJUSTRECT, wparam, lparam)); + } + + // Removes a tool from a ToolTip control. + // Refer to TTM_DELTOOL in the Windows API documentation for more information. + inline void CToolTip::DelTool(HWND control, UINT id) const + { + assert(IsWindow()); + TOOLINFO info = GetToolInfo(control, id); + LPARAM lparam = reinterpret_cast(&info); + SendMessage(TTM_DELTOOL, 0, lparam); + } + + // Retrieves the initial, pop-up, and re-show duration currently set for a + // ToolTip control. + // Returns an int value with the specified duration in milliseconds. + // + // duration is one of: + // TTDT_AUTOPOP - time the ToolTip remains visible if the pointer is stationary. + // TTDT_INITIAL - time the pointer must remain stationary before the ToolTip appears. + // TTDT_RESHOW - time it takes for subsequent ToolTip to appear as the pointer moves + // from one tool to another. + // Refer to TTM_GETDELAYTIME in the Windows API documentation for more information. + inline int CToolTip::GetDelayTime(DWORD duration) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(duration); + return static_cast(SendMessage(TTM_GETDELAYTIME, wparam, 0)); + } + + // Retrieves the top, left, bottom, and right margins set for a ToolTip window. + // Refer to TTM_GETMARGIN in the Windows API documentation for more information. + inline CRect CToolTip::GetMargin() const + { + assert(IsWindow()); + CRect rc; + LPARAM lparam = reinterpret_cast(&rc); + SendMessage(TTM_GETMARGIN, 0, lparam); + return rc; + } + + // Retrieves the maximum width for a ToolTip window. + // Refer to TTM_GETMAXTIPWIDTH in the Windows API documentation for more information. + inline int CToolTip::GetMaxTipWidth() const + { + assert(IsWindow()); + return static_cast(SendMessage(TTM_GETMAXTIPWIDTH, 0, 0)); + } + + // Retrieves the text information a ToolTip control maintains about a tool. + // Refer to TTM_GETTEXT in the Windows API documentation for more information. + inline CString CToolTip::GetText(HWND control, UINT id) const + { + assert(IsWindow()); + CString str; + TOOLINFO info = GetToolInfo(control, id); + + LPTSTR text = str.GetBuffer(80); // Maximum allowed ToolTip is 80 characters for Windows XP and below. + info.lpszText = text; + LPARAM lparam = reinterpret_cast(&info); + SendMessage(TTM_GETTEXT, 0, lparam); + str.ReleaseBuffer(); + + return str; + } + + // Retrieves the background color in a ToolTip window. + // Refer to TTM_GETTIPBKCOLOR in the Windows API documentation for more information. + inline COLORREF CToolTip::GetTipBkColor() const + { + assert(IsWindow()); + return (COLORREF)SendMessage(TTM_GETTIPBKCOLOR, 0, 0); + } + + // Retrieves the text color in a ToolTip window. + // Refer to TTM_GETTIPTEXTCOLOR in the Windows API documentation for more information. + inline COLORREF CToolTip::GetTipTextColor() const + { + assert(IsWindow()); + return (COLORREF)SendMessage(TTM_GETTIPTEXTCOLOR, 0, 0); + } + + // Retrieves a count of the tools maintained by a ToolTip control. + // Refer to TTM_GETTOOLCOUNT in the Windows API documentation for more information. + inline int CToolTip::GetToolCount() const + { + assert(IsWindow()); + return static_cast(SendMessage(TTM_GETTOOLCOUNT, 0, 0)); + } + + // Retrieves the information that a ToolTip control maintains about a tool. + // control is the control specified when the tooltip was added with AddTool. + // id is the user ID (if any) specified when the tooltip was added with AddTool. + // Note: + // The TOOLINFO struct returned does not contain the ToolTip's text. + // Use GetText to retrieve a tool's text. + // Refer to TTM_GETTOOLINFO in the Windows API documentation for more information. + inline TOOLINFO CToolTip::GetToolInfo(HWND control, UINT id) const + { + assert(IsWindow()); + TOOLINFO info = {}; + info.cbSize = sizeof(info); + if (id == UINT(-1)) + { + info.hwnd = GetParent(); + info.uId = reinterpret_cast(control); + } + else + { + info.hwnd = control; + info.uId = id; + } + + LPARAM lparam = reinterpret_cast(&info); + VERIFY(SendMessage(TTM_GETTOOLINFO, 0, lparam)); + + return info; + } + + // Fills the TOOLINFO structure. Used by AddTool. + // Notes: + // 1) Notifications are passed to the parent window. + // 2) The control is always identified by its hwnd. + // 3) The tooltip always manages its messages (uses TTF_SUBCLASS). + // Override this function to specify different flags. + inline void CToolTip::FillToolInfo(TOOLINFO& info, HWND control) const + { + info = {}; + info.cbSize = sizeof(info); + + info.hwnd = ::GetParent(*this); // pass notifications to the parent window + info.uFlags = TTF_IDISHWND | TTF_SUBCLASS; + info.uId = reinterpret_cast(control); + } + + // Fills the TOOLINFO structure. Used by AddTool. + // Notes: + // 1) Notifications are passed to the control window, not the parent window. + // 2) The control is always identified by its hwnd. + // 3) rc specifies which part of the control triggers the tooltip. + // 4) A unique uID is required if the control has multiple tooltips. + // 5) The tooltip always manages its messages (uses TTF_SUBCLASS). + // 6) The TTF_IDISHWND style is incompatible with using a RECT. + // Override this function to specify different flags. + inline void CToolTip::FillToolInfo(TOOLINFO& info, HWND control, RECT rc, UINT id) const + { + info = {}; + info.cbSize = sizeof(info); + + info.hwnd = control; + info.uFlags = TTF_SUBCLASS; + info.rect = rc; + info.uId = id; + } + + // Returns the width and height of a ToolTip control. + // Refer to TTM_GETBUBBLESIZE in the Windows API documentation for more information. + inline CSize CToolTip::GetBubbleSize(HWND control, UINT id) const + { + assert(IsWindow()); + TOOLINFO info = GetToolInfo(control, id); + LPARAM lparam = reinterpret_cast(&info); + LRESULT result = SendMessage(TTM_GETBUBBLESIZE, 0, lparam); + CSize sz(LOWORD(result), HIWORD(result)); + return sz; + } + + // Tests a point to determine whether it is within the bounding rectangle + // of the specified tool and, if it is, retrieves information about the tool. + // Refer to TTM_HITTEST in the Windows API documentation for more information. + inline BOOL CToolTip::HitTest(HWND wnd, CPoint pt, const TOOLINFO& toolInfo) const + { + assert(IsWindow()); + TTHITTESTINFO hti = {}; + hti.hwnd = wnd; + hti.pt = pt; + hti.ti = toolInfo; + LPARAM lparam = reinterpret_cast(&hti); + return static_cast(SendMessage(TTM_HITTEST, 0, lparam)); + } + + // Removes a displayed ToolTip window from view. + // Refer to TTM_POP in the Windows API documentation for more information. + inline void CToolTip::Pop() const + { + assert(IsWindow()); + SendMessage(TTM_POP, 0, 0); + } + + // Sets the CREATESTRUCT parameters before the tooltip is created. + inline void CToolTip::PreCreate(CREATESTRUCT& cs) + { + cs.dwExStyle = WS_EX_TOOLWINDOW; + cs.style = WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP; + } + + // Sets the WNDCLASS parameters before the tooltip is created. + inline void CToolTip::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = TOOLTIPS_CLASS; + } + + // Passes a mouse message to a ToolTip control for processing. + // Refer to TTM_RELAYEVENT in the Windows API documentation for more information. + inline void CToolTip::RelayEvent(MSG& msg) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&msg); + SendMessage(TTM_RELAYEVENT, 0, lparam); + } + + // Sets the initial delay for a ToolTip control. + // Refer to TTM_SETDELAYTIME in the Windows API documentation for more information. + inline void CToolTip::SetDelayTime(UINT delay) const + { + assert(IsWindow()); + LPARAM lparam = static_cast(delay); + SendMessage(TTM_SETDELAYTIME, TTDT_INITIAL, lparam); + } + + // Sets the initial, pop-up, and reshow durations for a ToolTip control. + // Refer to TTM_SETDELAYTIME in the Windows API documentation for more information. + inline void CToolTip::SetDelayTime(DWORD duration, int time) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(duration); + LPARAM lparam = static_cast(time); + SendMessage(TTM_SETDELAYTIME, wparam, lparam); + } + + // Sets the top, left, bottom, and right margins for a ToolTip window. + // Refer to TTM_SETMARGIN in the Windows API documentation for more information. + inline void CToolTip::SetMargin(RECT rc) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&rc); + SendMessage(TTM_SETMARGIN, 0, lparam); + } + + // Sets the maximum width for a ToolTip window in pixels. + // Refer to TTM_SETMAXTIPWIDTH in the Windows API documentation for more information. + inline int CToolTip::SetMaxTipWidth(int width) const + { + assert(IsWindow()); + LPARAM lparam = static_cast(width); + return static_cast(SendMessage(TTM_SETMAXTIPWIDTH, 0, lparam)); + } + + // Sets the background color in a ToolTip window. + // Ignored when XP themes are active. + // Refer to TTM_SETTIPBKCOLOR in the Windows API documentation for more information. + inline void CToolTip::SetTipBkColor(COLORREF color) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(color); + SendMessage(TTM_SETTIPBKCOLOR, wparam, 0); + } + + // Sets the text color in a ToolTip window. + // Ignored when XP themes are active. + // Refer to TTM_SETTIPTEXTCOLOR in the Windows API documentation for more information. + inline void CToolTip::SetTipTextColor(COLORREF color) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(color); + SendMessage(TTM_SETTIPTEXTCOLOR, wparam, 0); + } + + // Adds a standard icon and title string to a ToolTip. + // Refer to TTM_SETTITLE in the Windows API documentation for more information. + inline BOOL CToolTip::SetTitle(UINT icon, LPCTSTR title) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(icon); + LPARAM lparam = reinterpret_cast(title); + return static_cast(SendMessage(TTM_SETTITLE, wparam, lparam)); + } + + // Sets the information that a ToolTip control maintains for a tool. + // Refer to TTM_SETTOOLINFO in the Windows API documentation for more information. + inline void CToolTip::SetToolInfo(const TOOLINFO& toolInfo) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&toolInfo); + SendMessage(TTM_SETTOOLINFO, 0, lparam); + } + + // Sets a new bounding rectangle for a tool. + // Refer to TTM_NEWTOOLRECT in the Windows API documentation for more information. + inline void CToolTip::SetToolRect(RECT rc, HWND control, UINT id) const + { + assert(IsWindow()); + TOOLINFO ti = GetToolInfo(control, id); + ti.rect = rc; + LPARAM lparam = reinterpret_cast(&ti); + SendMessage(TTM_NEWTOOLRECT, 0, lparam); + } + + // Sets the visual style of a ToolTip control. + // Refer to TTM_SETWINDOWTHEME in the Windows API documentation for more information. + inline void CToolTip::SetTTWindowTheme(LPCWSTR theme) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(theme); + SendMessage(TTM_SETWINDOWTHEME, 0, lparam); + } + + // Forces the current tool to be redrawn. + // Refer to TTM_UPDATE in the Windows API documentation for more information. + inline void CToolTip::Update() const + { + assert(IsWindow()); + SendMessage(TTM_UPDATE, 0, 0); + } + + // Sets the ToolTip text for a tool. + // Refer to TTM_UPDATETIPTEXT in the Windows API documentation for more information. + inline void CToolTip::UpdateTipText(LPCTSTR text, HWND control, UINT id) const + { + assert(IsWindow()); + TOOLINFO info = GetToolInfo(control, id); + info.lpszText = const_cast(text); + LPARAM lparam = reinterpret_cast(&info); + SendMessage(TTM_UPDATETIPTEXT, 0, lparam); + } + + // Sets the ToolTip text for a tool. + // Refer to TTM_UPDATETIPTEXT in the Windows API documentation for more information. + inline void CToolTip::UpdateTipText(UINT textID, HWND control, UINT id) const + { + assert(IsWindow()); + TOOLINFO info = GetToolInfo(control, id); + info.lpszText = MAKEINTRESOURCE(textID); + LPARAM lparam = reinterpret_cast(&info); + SendMessage(TTM_UPDATETIPTEXT, 0, lparam); + } + +} // namespace Win32xx + +#endif // define _WIN32XX_CONTROLS_H_ + diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_criticalsection.h b/packages/media/cpp/packages/Win32xx/include/wxx_criticalsection.h new file mode 100644 index 00000000..cb7b7587 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_criticalsection.h @@ -0,0 +1,134 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + + +#ifndef _WIN32XX_CRITICALSECTION_H_ +#define _WIN32XX_CRITICALSECTION_H_ + +namespace Win32xx +{ + + ///////////////////////////////////////// + // This class is used for thread synchronisation. A critical section object + // provides synchronization similar to that provided by a mutex object, + // except that a critical section can be used only by the threads of a + // single process. Critical sections are faster and more efficient than + // mutexes. The CCriticalSection object should be created in the primary + // thread. Create them as member variables in your CWinApp derived class. + class CCriticalSection + { + public: + CCriticalSection(); + ~CCriticalSection(); + + void Lock(); + void Release(); + + private: + CCriticalSection (const CCriticalSection&) = delete; + CCriticalSection& operator=(const CCriticalSection&) = delete; + + CRITICAL_SECTION m_cs; + long m_count; + }; + + + ///////////////////////////////////////////////////////////////// + // CThreadLock provides a convenient RAII-style mechanism for + // owning a CCriticalSection for the duration of a scoped block. + // Automatically locks the specified CCriticalSection when + // constructed, and releases the critical section when destroyed. + class CThreadLock + { + public: + CThreadLock(CCriticalSection& cs) : m_cs(cs) { m_cs.Lock(); } + ~CThreadLock() { m_cs.Release(); } + + private: + CThreadLock(const CThreadLock&) = delete; + CThreadLock& operator= (const CThreadLock&) = delete; + CCriticalSection& m_cs; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + ////////////////////////////////////////////// + // Definitions for the CCriticalSection class. + // + inline CCriticalSection::CCriticalSection() : m_count(0) + { + ::InitializeCriticalSection(&m_cs); + } + + inline CCriticalSection::~CCriticalSection() + { + while (m_count > 0) + { + Release(); + } + + ::DeleteCriticalSection(&m_cs); + } + + // Enter the critical section and increment the lock count. + inline void CCriticalSection::Lock() + { + ::EnterCriticalSection(&m_cs); + InterlockedIncrement(&m_count); + } + + // Leave the critical section and decrement the lock count. + inline void CCriticalSection::Release() + { + assert(m_count > 0); + if (m_count > 0) + { + ::LeaveCriticalSection(&m_cs); + ::InterlockedDecrement(&m_count); + } + } + +} + + +#endif // _WIN32XX_CRITICALSECTION_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_cstring.h b/packages/media/cpp/packages/Win32xx/include/wxx_cstring.h new file mode 100644 index 00000000..3c059ffe --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_cstring.h @@ -0,0 +1,1961 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +// Acknowledgements: +// Thanks to Adam Szulc for his initial CString code. + +//////////////////////////////////////////////////////// +// wxx_cstring.h +// Declaration of the CString class + +// This class is intended to provide a simple alternative to the MFC/ATL +// CString class that ships with Microsoft compilers. The CString class +// specified here is compatible with other compilers such as Embarcadero +// and MinGW. + +// Differences between this class and the MFC/ATL CString class +// ------------------------------------------------------------ +// 1) The constructors for this class accepts both ANSI and Unicode characters +// and automatically converts these to TCHAR as required. +// +// 2) This class is not reference counted, so these CStrings should be passed +// as references or const references when used as function arguments. As a +// result there is no need for functions like LockBuffer and UnLockBuffer. +// +// 3) The Format functions only accepts POD (Plain Old Data) arguments. It does +// not accept arguments that are class or struct objects. In particular it +// does not accept CString objects, unless these are cast to LPCTSTR. +// This is demonstrates valid and invalid usage: +// CString string1(_T("Hello World")); +// CString string2; +// +// // This is invalid, and produces undefined behavior. +// string2.Format(_T("String1 is: %s"), string1); // No! you can't do this +// +// // This is ok +// string2.Format(_T("String1 is: %s"), (LPCTSTR)string1); // Yes, this is correct +// +// // This is better. It doesn't use casting +// string2.Format(_T("String1 is: %s"), string1.c_str()); // This is correct too +// +// Note: The MFC/ATL CString class uses a non portable hack to make its +// CString class behave like a POD. Other compilers (such as the +// MinGW compiler) specifically prohibit the use of non POD types for +// functions with variable argument lists. +// +// 4) This class provides a few additional functions: +// c_str Returns a const TCHAR string. This is an alternative +// for casting to LPCTSTR. +// GetErrorString Assigns CString to the error string for the specified +// System Error Code (from ::GetLastError() for example). +// GetString Returns a reference to the underlying +// std::basic_string. This reference can be used to +// modify the string directly. + + +#ifndef _WIN32XX_CSTRING_H_ +#define _WIN32XX_CSTRING_H_ + + +// The wxx_setup.h file defines the set of macros and includes the C, C++, +// and windows header files required by Win32++. +#include "wxx_setup.h" +#include "wxx_textconv.h" + + +namespace Win32xx +{ + // Declaration of the CStringT class. + template + class CStringT; + + // CStringA is a CHAR only version of CString. + using CStringA = CStringT; + + // CStringW is a WCHAR only version of CString. + using CStringW = CStringT; + + // Declaration of the CString class. + class CString; + + ///////////////////////////////////////////////// + // CStringT is a class template used to implement + // CStringA and CStringW. CString inherits from + // CStringT. + template + class CStringT + { + // Allow CString to access private members of CStringT. + friend class CString; + + // Friend functions for CString global functions. + friend CString operator+(const CString& string1, const CString& string2); + friend CString operator+(const CString& string1, const CStringA& string2); + friend CString operator+(const CString& string1, const CStringW& string2); + friend CString operator+(const CString& string1, const CHAR* text); + friend CString operator+(const CString& string1, const WCHAR* text); + friend CString operator+(const CString& string1, CHAR ch); + friend CString operator+(const CString& string1, WCHAR ch); + friend CString operator+(const CStringA& string1, const CString& string2); + friend CString operator+(const CStringW& string1, const CString& string2); + friend CString operator+(const CHAR* text, const CString& string1); + friend CString operator+(const WCHAR* text, const CString& string1); + friend CString operator+(CHAR ch, const CString& string1); + friend CString operator+(WCHAR ch, const CString& string1); + friend CString operator+(const CStringA& string1, const CStringW& string2); + friend CString operator+(const CStringW& string1, const CStringA& string2); + + // Friend functions for CStringA global functions. + friend CStringA operator+(const CStringA& string1, const CStringA& string2); + friend CStringA operator+(const CStringA& string1, const CHAR* text); + friend CStringA operator+(const CStringA& string1, CHAR ch); + friend CStringA operator+(const CHAR* text, const CStringA& string1); + friend CStringA operator+(CHAR ch, const CStringA& string1); + + // Friend functions for CStringW global functions. + friend CStringW operator+(const CStringW& string1, const CStringW& string2); + friend CStringW operator+(const CStringW& string1, const WCHAR* text); + friend CStringW operator+(const CStringW& string1, WCHAR ch); + friend CStringW operator+(const WCHAR* text, const CStringW& string1); + friend CStringW operator+(WCHAR ch, const CStringW& string1); + + // These global functions don't need to be friends. + // CStringW operator+(const CStringW& string1, const CStringW& string2); + // bool operator<(const CStringT& string1, const CStringT& string2); + // bool operator<(const CStringT& string1, const T* text); + // bool operator>(const CStringT& string1, const CStringT& string2); + // bool operator>(const CStringT& string1, const T* text); + // bool operator<=(const CStringT& string1, const CStringT& string2); + // bool operator<=(const CStringT& string1, const T* text); + // bool operator>=(const CStringT& string1, const CStringT& string2); + // bool operator>=(const CStringT& string1, const T* text); + + // CStringA& operator<<(CStringA& str, V value); + // CStringA& operator<<(CStringA& str, CHAR ch); + // CStringW& operator<<(CStringW& str, V value); + // CStringW& operator<<(CStringW& str, CStringW value); + // CStringW& operator<<(CStringW& str, WCHAR ch); + + public: + CStringT() = default; + CStringT(const T * text); + CStringT(const T * text, int length); + CStringT(T ch, int repeat = 1); + CStringT(const CStringT& str); + CStringT(CStringT&& str) noexcept; + virtual ~CStringT() = default; + + CStringT& operator=(T ch); + CStringT& operator=(const T* text); + CStringT& operator=(const CStringT& str); + CStringT& operator=(CStringT&& str) noexcept; + + bool operator==(const T* text) const; + bool operator==(const CStringT& str) const; + bool operator!=(const T* text) const; + bool operator!=(const CStringT& str) const; + operator const T*() const; + T& operator[](int index); + const T& operator[](int index) const; + CStringT& operator+=(const CStringT& str); + CStringT& operator+=(const T* text); + CStringT& operator+=(T ch); + + // Accessors + const T* c_str() const { return m_str.c_str(); } // alternative for casting to LPCTSTR + const std::basic_string& GetString() const { return m_str; } // returns const reference to CString's internal std::basic_string + int GetLength() const { return static_cast(m_str.length()); } // returns the length in characters + + // Operations + BSTR AllocSysString() const; + void Append(const std::basic_string& str); + void AppendFormat(const T* format,...); + void AppendFormat(UINT formatID, ...); + void Assign(const T* text, int count); + int Collate(const T* text) const; + int CollateNoCase(const T* text) const; + int Compare(const T* text) const; + int CompareNoCase(const T* text) const; + int Delete(int index, int count = 1); + int Find(T ch, int index = 0 ) const; + int Find(const T* text, int index = 0) const; + int FindOneOf(const T* text) const; + void Format(UINT id, ...); + void Format(const T* format,...); + void FormatV(const T* format, va_list args); + void FormatMessage(const T* format,...); + void FormatMessageV(const T* format, va_list args); + T GetAt(int index) const; + T* GetBuffer(int minBufLength); + bool GetEnvironmentVariable(const T* var); + void GetErrorString(DWORD error); + void GetWindowText(HWND wnd); + void Empty(); + int Insert(int index, T ch); + int Insert(int index, const CStringT& str); + bool IsEmpty() const; + CStringT Left(int count) const; + bool LoadString(UINT id); // defined in wincore.h + void MakeLower(); + void MakeReverse(); + void MakeUpper(); + CStringT Mid(int first) const; + CStringT Mid(int first, int count) const; + void ReleaseBuffer( int newLength = -1 ); + int Remove(const T* text); + int Remove(T ch); + int Replace(T oldChar, T newChar); + int Replace(const T* oldText, const T* newText); + int ReverseFind(T ch, int end = -1) const; + int ReverseFind(const T* text, int end = -1) const; + CStringT Right(int count) const; + void SetAt(int index, T ch); + BSTR SetSysString(BSTR* pBstr) const; + CStringT SpanExcluding(const T* text) const; + CStringT SpanIncluding(const T* text) const; + CStringT Tokenize(const T* tokens, int& start) const; + void Trim(); + void TrimLeft(); + void TrimLeft(T target); + void TrimLeft(const T* targets); + void TrimRight(); + void TrimRight(T target); + void TrimRight(const T* targets); + void Truncate(int newLength); + + private: + size_t strlenT(const CHAR* text) const { return strlen(text); } + size_t strlenT(const WCHAR* text) const { return wcslen(text); } + + // These functions return CHAR instead of int. + static CHAR ToLower(CHAR c) { return static_cast(::tolower( + static_cast(c)) & 0xFF); } + static CHAR ToUpper(CHAR c) { return static_cast(::toupper( + static_cast(c)) & 0xFF); } + + std::basic_string m_str; + std::vector m_buf; + }; + + + /////////////////////////////////////////////// + // A CString object provides a safer and a more + // convenient alternative to an array of CHAR + // or WCHAR when working with text strings. + class CString : public CStringT + { + friend CString operator+(const CString& string1, const CString& string2); + friend CString operator+(const CString& string1, const CStringA& string2); + friend CString operator+(const CString& string1, const CStringW& string2); + friend CString operator+(const CString& string1, const CHAR* text); + friend CString operator+(const CString& string1, const WCHAR* text); + friend CString operator+(const CString& string1, CHAR ch); + friend CString operator+(const CString& string1, WCHAR ch); + friend CString operator+(const CStringA& string1, const CString& string2); + friend CString operator+(const CStringW& string1, const CString& string2); + friend CString operator+(const CHAR* text, const CString& string1); + friend CString operator+(const WCHAR* text, const CString& string1); + friend CString operator+(CHAR ch, const CString& string1); + friend CString operator+(WCHAR ch, const CString& string1); + friend CString operator+(const CStringA& string1, const CStringW& string2); + friend CString operator+(const CStringW& string1, const CStringA& string2); + + // These global functions don't need to be friends. + // CString& operator<<(CString& string1, const CString& string2); + // CString& operator<<(CString& str, V value); + // CString& operator<<(CString& str, LPCSTR text); + // CString& operator<<(CString& str, LPCWSTR text); + // CString& operator<<(CString& str, CHAR ch); + // CString& operator<<(CString& str, WCHAR ch); + + public: + CString() {} + CString(const CString& str) : CStringT(str) {} + CString(CString&& str) noexcept : CStringT(std::move(str)) {} + CString(const CStringA& str); + CString(const CStringW& str); + CString(LPCSTR text) : CStringT(AtoT(text)) {} + CString(LPCWSTR text) : CStringT(WtoT(text)) {} + CString(LPCSTR text, int length) : CStringT(AtoT(text, CP_ACP, length), length) {} + CString(LPCWSTR text, int length) : CStringT(WtoT(text, CP_ACP, length), length) {} + CString(CHAR ch, int repeat = 1); + CString(WCHAR ch, int repeat = 1); + virtual ~CString() = default; + + CString& operator=(const CString& str); + CString& operator=(CString&& str) noexcept; + CString& operator=(const CStringA& str); + CString& operator=(const CStringW& str); + CString& operator=(CHAR ch); + CString& operator=(WCHAR ch); + CString& operator=(LPCSTR text); + CString& operator=(LPCWSTR text); + CString& operator+=(const CString& str); + CString& operator+=(const CStringA& str); + CString& operator+=(const CStringW& str); + CString& operator+=(LPCSTR text); + CString& operator+=(LPCWSTR text); + CString& operator+=(CHAR ch); + CString& operator+=(WCHAR ch); + }; + +} // namespace Win32xx + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + ///////////////////////////////////////////// + // Definition of the CStringT class template. + // + + // Constructor. Assigns from from a const T* character array. + template + inline CStringT::CStringT(const T* text) + { + assert(text != nullptr); + m_str.assign(text); + } + + // Constructor. Assigns from a const T* possibly containing null characters. + template + inline CStringT::CStringT(const T* text, int length) + { + m_str.assign(text, static_cast(length)); + } + + // Constructor. Assigns from 1 or more T characters. + template + inline CStringT::CStringT(T ch, int repeat) + { + m_str.assign(static_cast(repeat), ch); + } + + // Copy constructor. + template + inline CStringT::CStringT(const CStringT& str) + { + m_str.assign(str.m_str); + } + + // Move constructor. + template + inline CStringT::CStringT(CStringT&& str) noexcept + : m_str(std::move(str.m_str)), m_buf(std::move(str.m_buf)) + { + } + + // Assign from a const CStringT. + template + inline CStringT& CStringT::operator=(const CStringT& str) + { + if (this != &str) + m_str.assign(str.m_str); + + return *this; + } + + // Move assignment. + template + inline CStringT& CStringT::operator=(CStringT&& str) noexcept + { + if (this != &str) + { + m_buf = std::move(str.m_buf); + m_str = std::move(str.m_str); + } + return *this; + } + + // Assign from a T character. + template + inline CStringT& CStringT::operator=(T ch) + { + m_str.assign(1, ch); + return *this; + } + + // Assign from a const T* character array. + template + inline CStringT& CStringT::operator=(const T* text) + { + m_str.assign(text); + return *this; + } + + // Returns TRUE if the strings have the same content. + template + inline bool CStringT::operator==(const T* text) const + { + assert(text != nullptr); + return (Compare(text) == 0); + } + + // Returns TRUE if the strings have the same content. + // Can compare CStringTs containing null characters. + template + inline bool CStringT::operator==(const CStringT& str) const + { + return m_str == str.m_str; + } + + // Returns TRUE if the strings have a different content. + template + inline bool CStringT::operator!=(const T* text) const + { + assert(text != nullptr); + return Compare(text) != 0; + } + + // Returns TRUE if the strings have a different content. + // Can compares CStringTs containing null characters. + template + inline bool CStringT::operator!=(const CStringT& str) const + { + return m_str != str.m_str; + } + + // Function call operator. Returns a const T* character array. + template + inline CStringT::operator const T*() const + { + return m_str.c_str(); + } + + // Subscript operator. Returns the T character at the specified index. + template + inline T& CStringT::operator[](int index) + { + assert(index >= 0); + assert(index < GetLength()); + return m_str[static_cast(index)]; + } + + // Subscript operator. Returns the T character at the specified index. + template + inline const T& CStringT::operator[](int index) const + { + assert(index >= 0); + assert(index < GetLength()); + return m_str[index]; + } + + // Addition assignment. Appends CStringT. + template + inline CStringT& CStringT::operator+=(const CStringT& str) + { + m_str.append(str.m_str); + return *this; + } + + // Addition assignment. Appends const T* character array. + template + inline CStringT& CStringT::operator+=(const T* text) + { + m_str.append(text); + return *this; + } + + // Addition assignment. Appends a T character. + template + inline CStringT& CStringT::operator+=(T ch) + { + m_str.append(1, ch); + return *this; + } + + // Allocates a BSTR from the CStringT content. + // Note: Ensure the returned BSTR is freed later with SysFreeString to + // avoid a memory leak. + template <> + inline BSTR CStringA::AllocSysString() const + { + CStringW wide(AtoW(m_str.c_str())); + BSTR bstr = ::SysAllocStringLen(wide, wide.GetLength()); + if (bstr == 0) + throw std::bad_alloc(); + + return bstr; + } + + // Allocates a BSTR from the CStringT content. + // Note: Free the returned string later with SysFreeString to avoid a + // memory leak. + template + inline BSTR CStringT::AllocSysString() const + { + BSTR bstr = ::SysAllocStringLen(m_str.c_str(), static_cast(m_str.size())); + if (bstr == 0) + throw std::bad_alloc(); + + return bstr; + } + + // Appends a std::basic_string to this CStringT. + template + inline void CStringT::Append(const std::basic_string& str) + { + m_str.append(str); + } + + // Appends formatted data to this CStringT. + template + inline void CStringT::AppendFormat(const T* format,...) + { + CStringT str; + + va_list args; + va_start(args, format); + str.FormatV(format, args); + va_end(args); + + m_str.append(str); + } + + // Assigns the specified number of characters from the text array to this string. + // The text array can contain null characters. + template + inline void CStringT::Assign(const T* text, int count) + { + m_str.assign(text, static_cast(count)); + } + + // Performs a case sensitive comparison of the two strings using + // locale-specific information. + template <> + inline int CStringA::Collate(const CHAR* text) const + { + assert(text != nullptr); + int res = ::CompareStringA(LOCALE_USER_DEFAULT, 0, m_str.c_str(), -1, text, -1); + + assert(res); + if (res == CSTR_LESS_THAN) return -1; + else if (res == CSTR_GREATER_THAN) return 1; + + return 0; + } + + // Performs a case sensitive comparison of the two strings using + // locale-specific information. + template + inline int CStringT::Collate(const T* text) const + { + assert(text != nullptr); + int res = ::CompareStringW(LOCALE_USER_DEFAULT, 0, m_str.c_str(), -1, text, -1); + + assert(res); + if (res == CSTR_LESS_THAN) return -1; + else if (res == CSTR_GREATER_THAN) return 1; + + return 0; + } + + // Performs a case insensitive comparison of the two strings using + // locale-specific information. + template <> + inline int CStringA::CollateNoCase(const CHAR* text) const + { + assert(text != nullptr); + int res = ::CompareStringA(LOCALE_USER_DEFAULT, NORM_IGNORECASE, m_str.c_str(), -1, text, -1); + + assert(res); + if (res == CSTR_LESS_THAN) return -1; + else if (res == CSTR_GREATER_THAN) return 1; + + return 0; + } + + // Performs a case insensitive comparison of the two strings using + // locale-specific information. + template + inline int CStringT::CollateNoCase(const T* text) const + { + assert(text != nullptr); + int res = ::CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE, m_str.c_str(), -1, text, -1); + + assert(res); + if (res == CSTR_LESS_THAN) return -1; + else if (res == CSTR_GREATER_THAN) return 1; + + return 0; + } + + // Performs a case sensitive comparison of the two strings. + template <> + inline int CStringA::Compare(const CHAR* text) const + { + assert(text != nullptr); + return ::lstrcmpA(m_str.c_str(), text); + } + + // Performs a case sensitive comparison of the two strings. + template + inline int CStringT::Compare(const T* text) const + { + assert(text != nullptr); + return ::lstrcmpW(m_str.c_str(), text); + } + + // Performs a case insensitive comparison of the two strings. + template <> + inline int CStringA::CompareNoCase(const CHAR* text) const + { + assert(text != nullptr); + return ::lstrcmpiA(m_str.c_str(), text); + } + + // Performs a case insensitive comparison of the two strings. + template + inline int CStringT::CompareNoCase(const T* text) const + { + assert(text != nullptr); + return ::lstrcmpiW(m_str.c_str(), text); + } + + // Deletes a character or characters from the string. + template + inline int CStringT::Delete(int index, int count /* = 1 */) + { + assert(index >= 0); + assert(count >= 0); + + if (index < GetLength()) + m_str.erase(static_cast(index), static_cast(count)); + + return static_cast(m_str.size()); + } + + // Erases the contents of the string. + template + inline void CStringT::Empty() + { + m_str.erase(); + } + + // Finds a character in the string, starting from the specified index. + template + inline int CStringT::Find(T ch, int index /* = 0 */) const + { + assert(index >= 0); + + size_t s = m_str.find(ch, static_cast(index)); + return static_cast(s); + } + + // Finds a substring within the string, starting from the specified index. + template + inline int CStringT::Find(const T* text, int index /* = 0 */) const + { + assert(text != nullptr); + assert(index >= 0); + + size_t s = m_str.find(text, static_cast(index)); + return static_cast(s); + } + + // Finds the first matching character from a set. + template + inline int CStringT::FindOneOf(const T* text) const + { + assert(text != nullptr); + + size_t s = m_str.find_first_of(text); + return static_cast(s); + } + + // Formats the string as sprintf does. + template + inline void CStringT::Format(const T* format,...) + { + va_list args; + va_start(args, format); + FormatV(format, args); + va_end(args); + } + + // Formats the string using a variable list of arguments. + template <> + inline void CStringA::FormatV(const CHAR* format, va_list args) + { + + if (format) + { + int result = -1; + size_t length = 256; + + // A vector is used to store the CHAR array. + std::vector buffer; + + while (result == -1) + { + buffer.assign( size_t(length)+1, 0 ); + +#if defined(_MSC_VER) // For Microsoft compilers. + result = _vsnprintf_s(buffer.data(), length, length - 1, format, args); +#else + result = _vsnprintf(buffer.data(), length, format, args); +#endif + length *= 2; + } + m_str.assign(buffer.data()); + } + } + + // Formats the string using a variable list of arguments. + template + inline void CStringT::FormatV(const T* format, va_list args) + { + if (format) + { + int result = -1; + size_t length = 256; + + // A vector is used to store the WCHAR array. + std::vector buffer; + + while (result == -1) + { + buffer.assign( size_t(length)+1, 0 ); + +#if defined(_MSC_VER) // For Microsoft compilers. + result = _vsnwprintf_s(buffer.data(), length, length - 1, format, args); +#else + result = _vsnwprintf(buffer.data(), length, format, args); +#endif + length *= 2; + } + m_str.assign(buffer.data()); + } + } + + // Formats a message string. + template + inline void CStringT::FormatMessage(const T* format,...) + { + va_list args; + va_start(args, format); + FormatMessageV(format, args); + va_end(args); + } + + // Formats a message string using a variable argument list. + template <> + inline void CStringA::FormatMessageV(const CHAR* format, va_list args) + { + LPSTR temp = 0; + if (format) + { + DWORD result = ::FormatMessageA(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ALLOCATE_BUFFER, + format, 0, 0, reinterpret_cast(&temp), 0, &args); + + if ( result == 0 || temp == 0 ) + throw std::bad_alloc(); + + m_str = temp; + ::LocalFree(temp); + } + } + + // Formats a message string using a variable argument list. + template + inline void CStringT::FormatMessageV(const T* format, va_list args) + { + LPWSTR temp = 0; + if (format) + { + DWORD result = ::FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ALLOCATE_BUFFER, + format, 0, 0, reinterpret_cast(&temp), 0, &args); + + if ( result == 0 || temp == 0 ) + throw std::bad_alloc(); + + m_str = temp; + ::LocalFree(temp); + } + } + + // Returns the character at the specified location within the string. + template + inline T CStringT::GetAt(int index) const + { + assert(index >= 0); + assert(index < GetLength()); + T ch = 0; + + if ((index >= 0) && (index < GetLength())) + ch = m_str[static_cast(index)]; + + return ch; + } + + // Creates a buffer of minBufLength characters (+1 extra for null + // termination) and returns a pointer to this buffer. This buffer can be + // used by any function that accepts a LPTSTR. + // Care must be taken not to exceed the length of the buffer. Use + // ReleaseBuffer to safely copy this buffer back to the CStringT object. + template + inline T* CStringT::GetBuffer(int minBufLength) + { + assert (minBufLength >= 0); + + T ch = 0; + m_buf.assign(size_t(minBufLength) + 1, ch); + auto it = m_str.begin(); + if (m_str.length() >= static_cast(minBufLength)) + { + std::advance(it, minBufLength); + } + else + it = m_str.end(); + + std::copy(m_str.begin(), it, m_buf.begin()); + + return m_buf.data(); + } + + // Sets the string to the value of the specified environment variable. + template <> + inline bool CStringA::GetEnvironmentVariable(const CHAR* var) + { + assert(var); + Empty(); + + // Returns text length including the null character. + DWORD length = ::GetEnvironmentVariableA(var, nullptr, 0); + if (length > 0) + { + int size = static_cast(length); + ::GetEnvironmentVariableA(var, GetBuffer(size), length); + ReleaseBuffer(); + } + + return (length != 0); + } + + // Sets the string to the value of the specified environment variable. + template + inline bool CStringT::GetEnvironmentVariable(const T* var) + { + assert(var); + Empty(); + + // Returns text length including the null character. + DWORD length = ::GetEnvironmentVariableW(var, nullptr, 0); + if (length > 0) + { + ::GetEnvironmentVariableW(var, GetBuffer(length), length); + ReleaseBuffer(); + } + + return (length != 0); + } + + // Retrieves the a window's text. + template <> + inline void CStringA::GetWindowText(HWND wnd) + { + Empty(); + + // Returns text length NOT including the null character. + int length = ::GetWindowTextLengthA(wnd); + if (length > 0) + { + ::GetWindowTextA(wnd, GetBuffer(length + 1), length + 1); + ReleaseBuffer(); + } + } + + // Retrieves a window's text. + template + inline void CStringT::GetWindowText(HWND wnd) + { + Empty(); + + // Returns text length NOT including the null character. + int length = ::GetWindowTextLengthW(wnd); + if (length > 0) + { + ::GetWindowTextW(wnd, GetBuffer(length +1), length + 1); + ReleaseBuffer(); + } + } + + // Returns the error string for the specified System Error Code from + // GetLastError. + template <> + inline void CStringA::GetErrorString(DWORD error) + { + Empty(); + CHAR* buffer = nullptr; + DWORD flags = FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS; + ::FormatMessageA(flags, nullptr, error, 0, reinterpret_cast(&buffer), 1, nullptr); + if (buffer != nullptr) + { + m_str.assign(buffer); + ::LocalFree(buffer); + } + } + + // Returns the error string for the specified System Error Code from + // GetLastError. + template + inline void CStringT::GetErrorString(DWORD error) + { + Empty(); + WCHAR* buffer = nullptr; + DWORD flags = FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS; + ::FormatMessageW(flags, nullptr, error, 0, reinterpret_cast(&buffer), 1, nullptr); + if (buffer != nullptr) + { + m_str.assign(buffer); + ::LocalFree(buffer); + } + } + + // Inserts a single character at the given index within the string. + template + inline int CStringT::Insert(int index, T ch) + { + assert(index >= 0); + assert(ch); + + index = std::min(index, GetLength()); + m_str.insert(index, &ch, 1); + + return static_cast(m_str.size()); + } + + // Inserts a substring at the given index within the string. + template + inline int CStringT::Insert(int index, const CStringT& str) + { + assert(index >= 0); + + index = std::min(index, GetLength()); + m_str.insert(index, str); + + return static_cast(m_str.size()); + } + + // Returns TRUE if the string is empty. + template + inline bool CStringT::IsEmpty() const + { + return m_str.empty(); + } + + // Retrieves the left part of a string. The count parameter specifies the + // number of characters. + template + inline CStringT CStringT::Left(int count) const + { + assert(count >= 0); + + CStringT str; + str.m_str.assign(m_str, 0, static_cast(count)); + return str; + } + + // Converts all the characters in this string to lowercase characters. + template <> + inline void CStringA::MakeLower() + { + std::transform(m_str.begin(), m_str.end(), m_str.begin(), ToLower); + } + + // Converts all the characters in this string to lowercase characters. + template + inline void CStringT::MakeLower() + { + std::transform(m_str.begin(), m_str.end(), m_str.begin(), ::towlower); + } + + // Reverses the string. + template + inline void CStringT::MakeReverse() + { + std::reverse(m_str.begin(), m_str.end()); + } + + // Converts all the characters in this string to uppercase characters. + template <> + inline void CStringA::MakeUpper() + { + std::transform(m_str.begin(), m_str.end(), m_str.begin(), ToUpper); + } + + // Converts all the characters in this string to uppercase characters. + template + inline void CStringT::MakeUpper() + { + std::transform(m_str.begin(), m_str.end(), m_str.begin(), ::towupper); + } + + // Retrieves the middle part of a string. + // The first parameter specifies the zero based index of the first character. + template + inline CStringT CStringT::Mid(int first) const + { + return Mid(first, GetLength()); + } + + // Retrieves the middle part of a string. + // The first parameter specifies the zero based index of the first character. + // The count parameter specifies the number of characters. + template + inline CStringT CStringT::Mid(int first, int count) const + { + assert(first >= 0); + assert(count >= 0); + + CStringT str; + if (first <= GetLength()) + str.m_str.assign(m_str, static_cast(first), static_cast(count)); + + return str; + } + + // This copies the contents of the buffer (acquired by GetBuffer) to this + // CStringT. The default length of -1 copies from the buffer until a null + // terminator is reached. If the buffer doesn't contain a null terminator, + // you must specify the buffer's length. + template + inline void CStringT::ReleaseBuffer(int newLength /*= -1*/ ) + { + if (newLength == -1) + { + newLength = static_cast(strlenT(m_buf.data())); + } + + assert(m_buf.size() > 0); + assert(newLength <= static_cast(m_buf.size() -1)); + newLength = std::min(newLength, static_cast(m_buf.size() -1)); + + T ch = 0; + m_str.assign(static_cast(newLength), ch); + + auto it_end = m_buf.begin(); + std::advance(it_end, newLength); + + std::move(m_buf.begin(), it_end, m_str.begin()); + m_buf.clear(); + } + + // Removes each occurrence of the specified substring from the string. + template + inline int CStringT::Remove(const T* text) + { + assert(text != nullptr); + + int count = 0; + size_t pos = 0; + size_t len = strlenT(text); + if (len > 0) + { + while ((pos = m_str.find(text, pos)) != std::string::npos) + { + m_str.erase(pos, len); + ++count; + } + } + + return count; + } + + // Removes each occurrence of the specified character from the string. + template + inline int CStringT::Remove(T ch) + { + int count = 0; + size_t pos = 0; + + while ((pos = m_str.find(ch, pos)) != std::string::npos) + { + m_str.erase(pos, 1); + ++count; + } + + return count; + } + + // Replaces each occurrence of the old character with the new character. + template + inline int CStringT::Replace(T oldChar, T newChar) + { + int count = 0; + auto it = m_str.begin(); + while (it != m_str.end()) + { + if (*it == oldChar) + { + *it = newChar; + ++count; + } + ++it; + } + return count; + } + + // Replaces each occurrence of the old substring with the new substring. + template + inline int CStringT::Replace(const T* oldText, const T* newText) + { + assert(oldText); + assert(newText); + + int count = 0; + size_t pos = 0; + size_t lenOld = strlenT(oldText); + size_t lenNew = strlenT(newText); + if (lenOld > 0 && lenNew > 0) + { + while ((pos = m_str.find(oldText, pos)) != std::string::npos) + { + m_str.replace(pos, lenOld, newText); + pos += lenNew; + ++count; + } + } + return count; + } + + // Search for a character within the string, starting from the end. + template + inline int CStringT::ReverseFind(T ch, int end /* -1 */) const + { + size_t found = m_str.rfind(ch, static_cast(end)); + return static_cast(found); + } + + // Search for a substring within the string, starting from the end. + template + inline int CStringT::ReverseFind(const T* text, int end /* = -1 */) const + { + assert(text != nullptr); + if (!text) return -1; + + if (strlenT(text) == 1) + return ReverseFind(text[0], end); + else + return static_cast(m_str.rfind(text, static_cast(end))); + } + + // Retrieves count characters from the right part of the string. + // The count parameter specifies the number of characters. + template + inline CStringT CStringT::Right(int count) const + { + assert(count >= 0); + + CStringT str; + count = std::min(count, GetLength()); + str.m_str.assign(m_str, m_str.size() - static_cast(count), static_cast(count)); + return str; + } + + // Sets the character at the specified position to the specified value. + template + inline void CStringT::SetAt(int index, T ch) + { + assert(index >= 0); + assert(index < GetLength()); + + if ((index >= 0) && (index < GetLength())) + m_str[index] = ch; + } + + // Sets an existing BSTR object to the string. + // Note: Ensure the returned BSTR is freed later with SysFreeString to + // avoid a memory leak. + template <> + inline BSTR CStringA::SetSysString(BSTR* pBstr) const + { + assert(pBstr); + CStringW wide(AtoW(m_str.c_str())); + if ( !::SysReAllocStringLen(pBstr, wide, wide.GetLength()) ) + throw std::bad_alloc(); + + return pBstr? *pBstr : nullptr; + } + + // Sets an existing BSTR object to the string. + template + inline BSTR CStringT::SetSysString(BSTR* pBstr) const + { + assert(pBstr); + + if ((pBstr) != nullptr) + { + if (!::SysReAllocStringLen(pBstr, m_str.c_str(), static_cast(m_str.length()))) + throw std::bad_alloc(); + } + + return pBstr ? *pBstr : nullptr; + } + + // Extracts characters from the string, starting with the first character, + // that are not in the set of characters identified by text. + template + inline CStringT CStringT::SpanExcluding(const T* text) const + { + assert (text); + + CStringT str; + size_t pos = 0; + + while ((pos = m_str.find_first_not_of(text, pos)) != std::string::npos) + { + str.m_str.append(1, m_str[pos++]); + } + + return str; + } + + // Extracts a substring that contains only the characters in a set. + template + inline CStringT CStringT::SpanIncluding(const T* text) const + { + assert (text); + + CStringT str; + size_t pos = 0; + + while ((pos = m_str.find_first_of(text, pos)) != std::string::npos) + { + str.m_str.append(1, m_str[pos++]); + } + + return str; + } + + // Extracts specified tokens in a target string. + template + inline CStringT CStringT::Tokenize(const T* tokens, int& start) const + { + assert(tokens); + + CStringT str; + if (start >= 0) + { + size_t pos1 = m_str.find_first_not_of(tokens, static_cast(start)); + size_t pos2 = m_str.find_first_of(tokens, pos1); + + start = static_cast(pos2) + 1; + if (pos2 == m_str.npos) + start = -1; + + if (pos1 != m_str.npos) + str.m_str = m_str.substr(pos1, pos2 - pos1); + } + + return str; + } + + // Trims all leading and trailing white-space characters from the string. + template + inline void CStringT::Trim() + { + TrimLeft(); + TrimRight(); + } + + // Trims leading white-space characters from the string. + template <> + inline void CStringA::TrimLeft() + { + auto it = m_str.begin(); + while (it != m_str.end()) + { + if (!::isspace(static_cast(*it))) + break; + + ++it; + } + + m_str.erase(m_str.begin(), it); + } + + // Trims leading white-space characters from the string. + template + inline void CStringT::TrimLeft() + { + auto it = m_str.begin(); + while (it != m_str.end()) + { + if (!iswspace(*it)) + break; + + ++it; + } + + m_str.erase(m_str.begin(), it); + } + + // Trims the specified character from the beginning of the string. + template + inline void CStringT::TrimLeft(T target) + { + m_str.erase(0, m_str.find_first_not_of(target)); + } + + // Trims the specified set of characters from the beginning of the string. + template + inline void CStringT::TrimLeft(const T* targets) + { + assert(targets); + m_str.erase(0, m_str.find_first_not_of(targets)); + } + + // Trims trailing white-space characters from the string. + template <> + inline void CStringA::TrimRight() + { + auto it = m_str.rbegin(); + while (it != m_str.rend()) + { + if (!::isspace(static_cast(*it))) + break; + + ++it; + } + + m_str.erase(it.base(), m_str.end()); + } + + // Trims trailing white-space characters from the string. + template + inline void CStringT::TrimRight() + { + auto it = m_str.rbegin(); + while (it != m_str.rend()) + { + if (!iswspace(*it)) + break; + + ++it; + } + + m_str.erase(it.base(), m_str.end()); + } + + // Trims the specified character from the end of the string. + template + inline void CStringT::TrimRight(T target) + { + size_t pos = m_str.find_last_not_of(target); + if (pos != std::string::npos) + m_str.erase(++pos); + } + + // Trims the specified set of characters from the end of the string. + template + inline void CStringT::TrimRight(const T* targets) + { + assert(targets); + + size_t pos = m_str.find_last_not_of(targets); + if (pos != std::string::npos) + m_str.erase(++pos); + } + + // Reduces the length of the string to the specified amount. + template + inline void CStringT::Truncate(int newLength) + { + if (newLength < GetLength()) + { + assert(newLength >= 0); + m_str.erase(newLength); + } + } + + ///////////////////////////// + // Global ToCString functions + // + + // Convert the specified value to CStringA. Used by operator<<. + template + inline CStringA ToCStringA(const V& value) + { + std::basic_stringstream streamA; + streamA << value; + return CStringA(streamA.str().c_str()); + } + + // Convert CStringA to CStringA. Used by operator<<. + inline CStringA ToCStringA(const CStringA& str) + { + return CStringA(str); + } + + // Convert the specified value to CStringW. Used by operator<<. + template + inline CStringW ToCStringW(const V& value) + { + std::basic_stringstream streamW; + streamW << value; + return CStringW(streamW.str().c_str()); + } + + // Convert CStringW to CStringW. Used by operator<<. + inline CStringW ToCStringW(const CStringW& str) + { + return CStringW(str); + } + + // Convert the specified value to CString. Used by operator<<. + template + inline CString ToCString(const V& value) + { + tStringStream streamT; + streamT << value; + return CString(streamT.str().c_str()); + } + + // Convert CStringA to CString. Used by operator<<. + inline CString ToCString(const CStringA& str) + { + return CString(str); + } + + // Convert CStringW to CString. Used by operator<<. + inline CString ToCString(const CStringW& str) + { + return CString(str); + } + + // Convert CString to CString. Used by operator<<. + inline CString ToCString(const CString& str) + { + return str; + } + + + ////////////////////////////////////// + // CStringT global operator functions + // + + // Addition operator. + inline CStringA operator+(const CStringA& string1, const CStringA& string2) + { + CStringA str(string1); + str.Append(string2.GetString()); + return str; + } + + // Addition operator. + inline CStringW operator+(const CStringW& string1, const CStringW& string2) + { + CStringW str(string1); + str.Append(string2.GetString()); + return str; + } + + // Addition operator. + inline CStringA operator+(const CStringA& string1, const CHAR* text) + { + CStringA str(string1); + str.Append(text); + return str; + } + + // Addition operator. + inline CStringW operator+(const CStringW& string1, const WCHAR* text) + { + CStringW str(string1); + str.Append(text); + return str; + } + + // Addition operator. + inline CStringA operator+(const CStringA& string1, CHAR ch) + { + CStringA str(string1); + CStringA string2(ch); + str.Append(string2.GetString()); + return str; + } + + // Addition operator. + inline CStringW operator+(const CStringW& string1, WCHAR ch) + { + CStringW str(string1); + CStringW string2(ch); + str.Append(string2.GetString()); + return str; + } + + // Addition operator. + inline CStringA operator+(const CHAR* text, const CStringA& string1) + { + CStringA str(text); + str.Append(string1.GetString()); + return str; + } + + // Addition operator. + inline CStringW operator+(const WCHAR* text, const CStringW& string1) + { + CStringW str(text); + str.Append(string1.GetString()); + return str; + } + + // Addition operator. + inline CStringA operator+(CHAR ch, const CStringA& string1) + { + CStringA str(ch); + str.Append(string1.GetString()); + return str; + } + + // Addition operator. + inline CStringW operator+(WCHAR ch, const CStringW& string1) + { + CStringW str(ch); + str.Append(string1.GetString()); + return str; + } + + // Performs a case sensitive comparison of the two strings. + template + inline bool operator<(const CStringT& string1, const CStringT& string2) + { + return (string1.Compare(string2) < 0); // boolean expression + } + + // Performs a case sensitive comparison of the two strings. + template + inline bool operator>(const CStringT& string1, const CStringT& string2) + { + return (string1.Compare(string2) > 0); // boolean expression + } + + // Performs a case sensitive comparison of the two strings. + template + inline bool operator<=(const CStringT& string1, const CStringT& string2) + { + return (string1.Compare(string2) <= 0); // boolean expression + } + + // Performs a case sensitive comparison of the two strings. + template + inline bool operator>=(const CStringT& string1, const CStringT& string2) + { + return (string1.Compare(string2) >= 0); // boolean expression + } + + // Performs a case sensitive comparison of the two strings. + template + inline bool operator<(const CStringT& string1, const T* text) + { + return (string1.Compare(text) < 0); // boolean expression + } + + // Performs a case sensitive comparison of the two strings. + template + inline bool operator>(const CStringT& string1, const T* text) + { + return (string1.Compare(text) > 0); // boolean expression + } + + // Performs a case sensitive comparison of the two strings. + template + inline bool operator<=(const CStringT& string1, const T* text) + { + return (string1.Compare(text) <= 0); // boolean expression + } + + // Performs a case sensitive comparison of the two strings. + template + inline bool operator>=(const CStringT& string1, const T* text) + { + return (string1.Compare(text) >= 0); // boolean expression + } + + // Appends the specified value to the string. + template + inline CStringA& operator<<(CStringA& str, V value) + { + str += ToCStringA(value); + return str; + } + + // Appends the specified character to the string. + inline CStringA& operator<<(CStringA& str, CHAR ch) + { + str += ch; + return str; + } + + // Appends the specified value to the string. + template + inline CStringW& operator<<(CStringW& str, V value) + { + str += ToCStringW(value); + return str; + } + + // Appends the specified character to the string. + inline CStringW& operator<<(CStringW& str, WCHAR ch) + { + str += ch; + return str; + } + + /////////////////////////////////// + // Definition of the CString class. + // + + // Construct CString from CHAR characters. + inline CString::CString(CHAR ch, int repeat) + { + m_str.append(static_cast(repeat), CString(&ch, 1).GetAt(0)); + } + + // Construct CString from WChar characters. + inline CString::CString(WCHAR ch, int repeat) + { + m_str.append(static_cast(repeat), CString(&ch, 1).GetAt(0)); + } + + // Construct CString from CStringA. + inline CString::CString(const CStringA& str) + { + size_t length = static_cast(str.GetLength()); + m_str.assign(AtoT(str.c_str(), CP_ACP, str.GetLength()), length); + } + + // Construct CString from CStringW. + inline CString::CString(const CStringW& str) + { + size_t length = static_cast(str.GetLength()); + m_str.assign(WtoT(str.c_str(), CP_ACP, str.GetLength()), length); + } + + // Assignment operator. + inline CString& CString::operator=(const CString& str) + { + if (this != &str) + m_str.assign(str.GetString()); + + return *this; + } + + // Move Assignment. + inline CString& CString::operator=(CString&& str) noexcept + { + if (this != &str) + { + m_buf = std::move(str.m_buf); + m_str = std::move(str.m_str); + } + return *this; + } + + // Assign CString from CStringA. + inline CString& CString::operator=(const CStringA& str) + { + size_t length = static_cast(str.GetLength()); + m_str.assign(AtoT(str.c_str(), CP_ACP, str.GetLength()), length); + return *this; + } + + // Assign CString from CStringW. + inline CString& CString::operator=(const CStringW& str) + { + size_t length = static_cast(str.GetLength()); + m_str.assign(WtoT(str.c_str(), CP_ACP, str.GetLength()), length); + return *this; + } + + // Assign CString from a CHAR character. + inline CString& CString::operator=(CHAR ch) + { + m_str.assign(1, CString(&ch, 1).GetAt(0)); + return *this; + } + + // Assign CString from a WCHAR character. + inline CString& CString::operator=(WCHAR ch) + { + m_str.assign(1, CString(&ch, 1).GetAt(0)); + return *this; + } + + // Assign CString from a CHAR array. + inline CString& CString::operator=(LPCSTR text) + { + m_str.assign(AtoT(text)); + return *this; + } + + // Assign CString from a WCHAR array. + inline CString& CString::operator=(LPCWSTR text) + { + m_str.assign(WtoT(text)); + return *this; + } + + // Append and assign from a CString. + inline CString& CString::operator+=(const CString& str) + { + m_str.append(str.m_str); + return *this; + } + + // Append and assign from CStringA. + inline CString& CString::operator+=(const CStringA& str) + { + size_t length = static_cast(str.GetLength()); + m_str.append(AtoT(str.c_str(), CP_ACP, str.GetLength()), length); + return *this; + } + + // Append and assign from CStringW. + inline CString& CString::operator+=(const CStringW& str) + { + size_t length = static_cast(str.GetLength()); + m_str.append(WtoT(str.c_str(), CP_ACP, str.GetLength()), length); + return *this; + } + + // Append and assign from a CHAR array. + inline CString& CString::operator+=(LPCSTR text) + { + m_str.append(AtoT(text)); + return *this; + } + + // Append and assign from a WCHAR array. + inline CString& CString::operator+=(LPCWSTR text) + { + m_str.append(WtoT(text)); + return *this; + } + + // Append and assign from a CHAR character. + inline CString& CString::operator+=(CHAR ch) + { + m_str.append(1, CString(&ch, 1).GetAt(0)); + return *this; + } + + // Append and assign from a WCHAR character. + inline CString& CString::operator+=(WCHAR ch) + { + m_str.append(1, CString(&ch, 1).GetAt(0)); + return *this; + } + + + ///////////////////////////////////// + // CString global operator functions. + // + + // Add a CString to a CString. + inline CString operator+(const CString& string1, const CString& string2) + { + CString str(string1); + str.m_str.append(string2.m_str); + return str; + } + + // Add a CStringA to a CString. + inline CString operator+(const CString& string1, const CStringA& string2) + { + CString str(string1); + size_t length = static_cast(string2.GetLength()); + str.m_str.append(AtoT(string2.c_str(), CP_ACP, string2.GetLength()), length); + return str; + } + + // Add a CStringW to a CString. + inline CString operator+(const CString& string1, const CStringW& string2) + { + CString str(string1); + size_t length = static_cast(string2.GetLength()); + str.m_str.append(WtoT(string2.c_str(), CP_ACP, string2.GetLength()), length); + return str; + } + + // Add a CHAR array to a CString. + inline CString operator+(const CString& string1, const CHAR* text) + { + CString str(string1); + str.m_str.append(AtoT(text)); + return str; + } + + // Add a WCHAR array to a CString. + inline CString operator+(const CString& string1, const WCHAR* text) + { + CString str(string1); + str.m_str.append(WtoT(text)); + return str; + } + + // Add a CHAR character to a CString. + inline CString operator+(const CString& string1, CHAR ch) + { + CString str(string1); + str.m_str.append(1, CString(&ch, 1).GetAt(0)); + return str; + } + + // Add a WCHAR character to a CString. + inline CString operator+(const CString& string1, WCHAR ch) + { + CString str(string1); + str.m_str.append(1, CString(&ch, 1).GetAt(0)); + return str; + } + + // Add a CString to a CStringA. + inline CString operator+(const CStringA& string1, const CString& string2) + { + CString str(string1); + str.m_str.append(string2); + return str; + } + + // Add a CString to a CStringW. + inline CString operator+(const CStringW& string1, const CString& string2) + { + CString str(string1); + str.m_str.append(string2); + return str; + } + + // Add a CString to a CHAR array. + inline CString operator+(const CHAR* text, const CString& string1) + { + CString str(text); + str.m_str.append(string1); + return str; + } + + // Add a CString to a WCHAR array. + inline CString operator+(const WCHAR* text, const CString& string1) + { + CString str(text); + str.m_str.append(string1); + return str; + } + + // Add a CString to a CHAR character. + inline CString operator+(CHAR ch, const CString& string1) + { + CString str(ch); + str.m_str.append(string1); + return str; + } + + // Add a CString to a WCHAR character. + inline CString operator+(WCHAR ch, const CString& string1) + { + CString str(ch); + str.m_str.append(string1); + return str; + } + + // Add a CStringW to a CStringA. + inline CString operator+(const CStringA& string1, const CStringW& string2) + { + CString str(string1); + size_t length = static_cast(string2.GetLength()); + str.m_str.append(WtoT(string2.c_str(), CP_ACP, string2.GetLength()), length); + return str; + } + + // Add a CStringA to a CStringW. + inline CString operator+(const CStringW& string1, const CStringA& string2) + { + CString str(string1); + size_t length = static_cast(string2.GetLength()); + str.m_str.append(AtoT(string2.c_str(), CP_ACP, string2.GetLength()), length); + return str; + } + + // Appends the specified string to the string. + inline CString& operator<<(CString& string1, const CString& string2) + { + string1 += string2; + return string1; + } + + // Appends the specified value to the string. + template + inline CString& operator<<(CString& str, V value) + { + str += ToCString(value); + return str; + } + + // Appends the specified text to the string. + inline CString& operator<<(CString& str, LPCSTR text) + { + str += text; + return str; + } + + // Appends the specified text to the string. + inline CString& operator<<(CString& str, LPCWSTR text) + { + str += text; + return str; + } + + // Appends the specified character to the string. + inline CString& operator<<(CString& str, CHAR ch) + { + str += ch; + return str; + } + + // Appends the specified character to the string. + inline CString& operator<<(CString& str, WCHAR ch) + { + str += ch; + return str; + } + +} // namespace Win32xx + +#endif//_WIN32XX_CSTRING_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_ddx.h b/packages/media/cpp/packages/Win32xx/include/wxx_ddx.h new file mode 100644 index 00000000..a9853462 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_ddx.h @@ -0,0 +1,1205 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////// +// Acknowledgement: +// +// Developed from code originally provided by: +// +// Robert C. Tausworthe +// email: robert.c.tausworthe@ieee.org +// +//////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////// +// wxx_ddx.h +// Definition of the CDataExchange class + +// This class provides support for Dialog Data eXchange(DDX) and Dialog Data +// Validation(DDV). This class has a set of DDX and DDV member functions which +// perform the data exchange and validation for different types of controls. +// Typically this is used for controls in a dialogs, but controls in any +// window support DDX and DDV. + +// To use CDataExchange, perform the following steps: +// * Override DoDataExchange and specify the appropriate DDX and DDV functions. +// * Call UpdateData(dataExchange, FALSE) to initialize the controls and assign +// their values. This is typically done in the dialog's OnInitDialog +// function. +// * Call UpdateData(dataExchange, TRUE) to validate and retrieve the control +// data. + + +#ifndef _WIN32XX_DDX_H_ +#define _WIN32XX_DDX_H_ + + +#include +#include +#include "wxx_wincore.h" + + +namespace Win32xx +{ + + /////////////////////////////////////////////////////////////////////////// + // + // Definitions + // + ////////////////////////////////////////////////////////////////////////// + + // DDX read/write direction (easier to remember) + const BOOL SENDTOCONTROL = FALSE; // set variable values into controls + const BOOL READFROMCONTROL = TRUE; // get values from controls into variables + + + //////////////////////////////////////////////////////////// + // CDataExchange is used to manage the data exchange between + // the user and a dialog control. It also validates the data + // passed between the user and the control. + class CDataExchange + { + + public: + CDataExchange(); + virtual ~CDataExchange() = default; + + // Dialog Data Validation (DDV) functions + virtual void DDV_MaxChars(const CString& value, int count) const; + virtual void DDV_MinMaxByte(BYTE value, BYTE min, BYTE max) const; + virtual void DDV_MinMaxDateTime(SYSTEMTIME, SYSTEMTIME, SYSTEMTIME) const; + virtual void DDV_MinMaxDouble(double value, double min, double max, int precision = DBL_DIG) const; + virtual void DDV_MinMaxFloat(float value, float min, float max, int precision = FLT_DIG) const; + virtual void DDV_MinMaxInt(int value, int min, int max) const; + virtual void DDV_MinMaxLong(long value, long min, long max) const; + virtual void DDV_MinMaxMonth(SYSTEMTIME, SYSTEMTIME, SYSTEMTIME) const; + virtual void DDV_MinMaxShort(short value, short min, short max) const; + virtual void DDV_MinMaxSlider(ULONG value, ULONG min, ULONG max) const; + virtual void DDV_MinMaxUInt(UINT value, UINT min, UINT max) const; + virtual void DDV_MinMaxULong(ULONG value, ULONG min, ULONG max) const; + + // DDX Initialization + virtual void DDX_Control(UINT id, CWnd& control); + + // Dialog Data eXchange (DDX) functions + virtual void DDX_CBIndex(UINT id, int& index); + virtual void DDX_CBString(UINT id, CString& value); + virtual void DDX_CBStringExact(UINT id, CString& value); + virtual void DDX_Check(UINT id, int& value); + virtual void DDX_DateTime(UINT id, SYSTEMTIME& value); + virtual void DDX_LBIndex(UINT id, int& index); + virtual void DDX_LBString(UINT id, CString& value); + virtual void DDX_LBStringExact(UINT id, CString& value); + virtual void DDX_MonthCal(UINT id, SYSTEMTIME& value); + virtual void DDX_Progress(UINT id, int& value); + virtual void DDX_Radio(UINT id, int& value); + virtual void DDX_Scroll(UINT id, int& value); + virtual void DDX_Slider(UINT id, int& value); + + // DDX text operations + virtual void DDX_Text(UINT id, BYTE& value); + virtual void DDX_Text(UINT id, short& value); + virtual void DDX_Text(UINT id, int& value); + virtual void DDX_Text(UINT id, UINT& value); + virtual void DDX_Text(UINT id, long& value); + virtual void DDX_Text(UINT id, ULONG& value); + virtual void DDX_Text(UINT id, CString& value); + virtual void DDX_Text(UINT id, LPTSTR value, int maxLen); + virtual void DDX_Text(UINT id, float& value, int precision = FLT_DIG); + virtual void DDX_Text(UINT id, double& value, int precision = DBL_DIG); + + // Helper operations + void virtual Fail(LPCTSTR message) const; + HWND GetLastControl() const { return m_lastControl; } + HWND GetLastEditControl() const { return m_lastEditControl; } + void Init(CWnd& dlgWnd, BOOL retrieveAndValidate); + HWND PrepareCtrl(UINT id); // return HWND of control + HWND PrepareEditCtrl(UINT id); // record this is an edit + + private: + // data members + int m_id; // ID of last-accessed control + HWND m_lastControl; // handle of last-accessed control + HWND m_lastEditControl; // handle of last edit control + BOOL m_isEditLastControl; // most recent control is an edit box + BOOL m_retrieveAndValidate; // TRUE means retrieve and validate data + HWND m_parent; // parent window + }; + + + // Global function + ULONGLONG SystemTimeToULL(SYSTEMTIME systime); + + +} // namespace Win32xx + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + // Provide operator overload for BYTE. + inline tStringStream& operator>>(tStringStream& ts, BYTE& value) + { + UINT u = 0; + ts >> u; + if (u < 256) + { + value = static_cast(u); + } + else + { + ts.setstate(std::ios_base::failbit); + } + return ts; + } + + //////////////////////////////////////////////////////////////// + // + // CDataExchange Class Methods + // + //////////////////////////////////////////////////////////////// + + + // Constructs a DDX-DDV object. + inline CDataExchange::CDataExchange() + { + m_id = 0; + m_lastControl = nullptr; + m_lastEditControl = nullptr; + m_isEditLastControl = FALSE; + m_retrieveAndValidate = FALSE; + m_parent = nullptr; + } + + + //////////////////////////////////////////////////////////////// + // + // DDV: Dialog Data Validation Functions + // + //////////////////////////////////////////////////////////////// + + + // Ensures that the length of value <= count when validating, otherwise + // throws a CUserException. If writing, send the box the message to set + // the limit to count, which must be at least one. + inline void CDataExchange::DDV_MaxChars(const CString& value, int count) const + { + assert(count >= 1); // must allow at least one char + if (m_retrieveAndValidate && value.GetLength() > count) + { + CString message; + message.Format(GetApp()->MsgDDV_StringSize(), value.c_str(), count); + + throw CUserException(message); + } + else if (m_lastControl != nullptr && m_isEditLastControl) + { + // limit the control max-chars automatically + WPARAM wparam = static_cast(count); + ::SendMessage(m_lastControl, EM_LIMITTEXT, wparam, 0); + } + } + + // Ensures that minVal <= value <= maxVal when validating, otherwise throws + // a CUserException. BYTE is unsigned char. + inline void CDataExchange::DDV_MinMaxByte(BYTE value, BYTE min, BYTE max) const + { + DDV_MinMaxULong(value, min, max); + } + + // When validating, this method sets the range of the DateTime control + // associated with the last visited window control to the pair + // (minRange, maxRange). When assigning, this method verifies + // that the refValue first falls between minRange and maxRange values + // before setting the range; if refValue is outside these limits, + // no setting of the range takes place and a trace message is written + // in debug mode. + inline void CDataExchange::DDV_MinMaxDateTime(SYSTEMTIME value, + SYSTEMTIME min, SYSTEMTIME max) const + { + ULONGLONG zero = 0; + ULONGLONG val = SystemTimeToULL(value); + ULONGLONG nMin = SystemTimeToULL(min); + ULONGLONG nMax = SystemTimeToULL(max); + assert(nMin == zero || nMax == zero || nMin <= nMax); + + if (m_retrieveAndValidate) + { + if ((nMin != zero && nMin > val) || + (nMax != zero && nMax < val)) + { + // Retrieve the control ID. + int id = static_cast(::GetWindowLongPtr(m_lastControl, GWLP_ID)); + CString str; + str << _T("*** WARNING: Date-Time data is out of range ") + << _T("in control ID ") << id << _T(". ***\n"); + TRACE(str); + + return; + } + } + + // Set the given DateTime range. + SYSTEMTIME sta[2] = {}; + sta[0] = min; + sta[1] = max; + + LPARAM lparam = reinterpret_cast(sta); + ::SendMessage(m_lastControl, DTM_SETRANGE, GDTR_MIN | GDTR_MAX, lparam); + } + + + // Ensures that minVal <= value <= maxVal when validating, otherwise + // throws a CUserException. + inline void CDataExchange::DDV_MinMaxDouble(double value, double min, + double max, int precision /* = DBL_DIG */) const + { + assert(min <= max); + if (min <= value && value <= max) + return; + + if (!m_retrieveAndValidate) + { + // Just leave a debugging trace if writing to a control. + TRACE(_T("*** WARNING: control data is out of range. ***\n")); + return; // don't throw + } + + // Throw includes an error message with the range tuple when + // reading a number outside the range. + CString message; + message.Format(GetApp()->MsgDDV_RealRange(), precision, min, precision, max); + + throw CUserException(message); + } + + // Ensures that minVal <= value <= maxVal when validating, otherwise + // throws a CUserException. + inline void CDataExchange::DDV_MinMaxFloat(float value, float min, + float max, int precision /* = FLT_DIG */) const + { + DDV_MinMaxDouble(static_cast(value), static_cast(min), + static_cast(max), precision); + } + + // Ensures that minVal <= value <= maxVal when validating, otherwise + // throws a CUserException. + inline void CDataExchange::DDV_MinMaxInt(int value, int min, int max) const + { + DDV_MinMaxLong(value, min, max); + } + + // Ensures that minVal <= value <= maxVal when validating, otherwise + // throws a CUserException. + inline void CDataExchange::DDV_MinMaxLong(long value, long min, long max) const + { + assert(min <= max); + if (min <= value && value <= max) + return; + + // Just leave a debugging trace if writing to a control. + if (!m_retrieveAndValidate) + { + TRACE(_T("*** WARNING: current control data is out of range. ***\n")); + return; // don't stop + } + + // Throw includes an error message with the range tuple when + // reading a number outside the range. + CString message; + message.Format(GetApp()->MsgDDV_IntRange(), min, max); + + throw CUserException(message); + } + + // When validating, this method sets the range of the month + // calendar control associated with the last visited window control to + // (minRange, maxRange). When assigning, this method verifies + // that the refValue first falls between minRange and maxRange values + // before setting the range; if refValue is outside these limits, + // no setting of the range takes place and a trace message is written + // in debug mode. + inline void CDataExchange::DDV_MinMaxMonth(SYSTEMTIME value, SYSTEMTIME min, + SYSTEMTIME max) const + { + ULONGLONG zero = 0; + ULONGLONG val = SystemTimeToULL(value); + ULONGLONG nMin = SystemTimeToULL(min); + ULONGLONG nMax = SystemTimeToULL(max); + assert(nMin == zero || nMax == zero || nMin <= nMax); + + if (!m_retrieveAndValidate) + { + if ((nMin != zero && nMin > val) || + (nMax != zero && nMax < val)) + { + int id = static_cast(::GetWindowLongPtr(m_lastControl, GWLP_ID)); + CString str; + str << _T("*** WARNING: Calendar data is out of range ") + << _T("in control ID ") << id << _T(". ***\n"); + TRACE(str); + return; // continue on + } + } + + SYSTEMTIME minMax[2] = {}; + DWORD limit = GDTR_MIN | GDTR_MAX; + minMax[0] = min; + minMax[1] = max; + WPARAM wparam = static_cast(limit); + LPARAM lparam = reinterpret_cast(&minMax); + + ::SendMessage(m_lastControl, MCM_SETRANGE, wparam, lparam); + } + + // Ensures that minVal <= value <= maxVal when validating, otherwise + // throws a CUserException. + inline void CDataExchange::DDV_MinMaxShort(short value, short min, short max) const + { + DDV_MinMaxLong(value, min, max); + } + + // When validating, this method sets the range of the slider + // control associated with the last visited window control to the pair + // (minRange, maxRange). When assigning, this method verifies + // that the refValue first falls between minRange and maxRange values + // before setting the range; if refValue is outside these limits, + // no setting of the range takes place and a trace message is written + // in debug mode. + inline void CDataExchange::DDV_MinMaxSlider(ULONG value, ULONG min, ULONG max) const + { + assert(min <= max); + if (m_retrieveAndValidate) + { + if (min > value || max < value) + { + TRACE("*** WARNING: slider position is outside given limits. ***\n"); + return; + } + } + + // Set the range tuple. + ::SendMessage(m_lastControl,TBM_SETRANGEMIN, static_cast(FALSE), + static_cast(min)); + ::SendMessage(m_lastControl, TBM_SETRANGEMAX, static_cast(TRUE), + static_cast(max)); + } + + // Ensures that minVal <= value <= maxVal when validating, otherwise + // throws a CUserException. + inline void CDataExchange::DDV_MinMaxUInt( UINT value, UINT min, UINT max) const + { + DDV_MinMaxULong(value, min, max); + } + + // Ensures that minVal <= value <= maxVal when validating, otherwise + // throws a CUserException. + inline void CDataExchange::DDV_MinMaxULong(ULONG value, ULONG min, ULONG max) const + { + assert(min <= max); + if (min <= value && value <= max) + return; + + if (!m_retrieveAndValidate) + { + // just leave a debugging trace if writing to a control + int id = static_cast(::GetWindowLongPtr(m_lastControl, GWLP_ID)); + CString str; + str << _T("*** WARNING: value is outside limits in control with ID ") + << id << _T(". ***\n"); + TRACE(str); + return; // don't stop + } + + // Throw includes an error message with the range tuple when + // reading a number outside the range. + CString message; + message.Format(GetApp()->MsgDDV_UINTRange(), min, max); + + throw CUserException(message); + } + + + //////////////////////////////////////////////////////////////// + // + // DDX: Control Initialization + // + //////////////////////////////////////////////////////////////// + + + // This function attaches the window with a control ID of id + // to the specified CWnd. Controls are only attached once. + inline void CDataExchange::DDX_Control(UINT id, CWnd& control) + { + if (!control.IsWindow()) // Not subclassed yet. + { + assert (!m_retrieveAndValidate); + HWND handle = PrepareCtrl(id); + assert(handle); + control.Attach(handle); + } + } + + //////////////////////////////////////////////////////////////// + // + // Data exchange for special controls + // + //////////////////////////////////////////////////////////////// + + + // This function manages the transfer of data between a combo box control + // in a dialog box or other window, and an integer + // index of that object. It performs a data exchange for the state of + // the combo box control appearing within the DDX/DDV object m_DX with + // the control numbered id. When this function is called, index is set + // to the index of the current combo box selection. If no item is + // selected, index is set to 0. When m_DX.m_retrieveAndValidate is false, + // the index item is selected. + inline void CDataExchange::DDX_CBIndex(UINT id, int& index) + { + HWND control = PrepareCtrl(id); + + if (m_retrieveAndValidate) + index = static_cast(::SendMessage(control, CB_GETCURSEL, 0, 0)); + else + ::SendMessage(control, CB_SETCURSEL, static_cast(index), 0); + } + + // This function manages the transfer of CString data between the edit + // control of a ComboBox control in a dialog box or other window, + // and a CString data member of that object. It performs a + // data exchange for the state of the combo box control appearing within + // the DDX/DDV object m_DX with the control numbered id. On reading the + // list box, the combo box edit window value is returned as the value. + // When m_DX.m_retrieveAndValidate is false, the list of the combo box + // is searched for an item that begins with the characters in the value + // string. If a matching item is found, it is selected and copied to the + // edit control. If the search is unsuccessful, the current edit control + // is not changed. + inline void CDataExchange::DDX_CBString(UINT id, CString& value) + { + HWND control = PrepareCtrl(id); + if (m_retrieveAndValidate) + { + // Get the current edit item text or drop list static where possible. + int length = ::GetWindowTextLength(control); + if (length > 0) + { + // Get the known length. + ::GetWindowText(control, value.GetBuffer(length), length + 1); + } + else + { + // GetWindowTextLength does not work for drop lists + // so here assume max of 255 characters. + const int maxLen = 255; + ::GetWindowText(control, value.GetBuffer(maxLen), maxLen + 1); + } + value.ReleaseBuffer(); + } + else + { + // Set the current selection based on value string. + if (::SendMessage(control, CB_SELECTSTRING, static_cast(-1), + reinterpret_cast(value.c_str()) == CB_ERR)) + { + // Value was not found, so just set the edit text. + // (This will be ignored if the control is a DROPDOWNLIST.) + ::SetWindowText(control, value); + } + } + } + + // This function manages the transfer of CString data between the edit + // control of a combo box control in a dialog box or other window, + // and a CString data member of that object. It performs a + // data exchange for the state of the combo box control appearing within + // the DDX/DDV object m_DX with the control numbered id. On reading the + // list box, the combo box edit window value is returned as the value. + // When m_DX.m_retrieveAndValidate is false, a case-insensitive search is + // made in the prevailing sort sense for the first list box string in + // the combo box that matches the string specified in the value parameter. + // If a matching item is found, it is selected and copied to the edit + // window. If the search is unsuccessful, the current edit control + // is not changed. + inline void CDataExchange::DDX_CBStringExact(UINT id, CString& value) + { + HWND control = PrepareCtrl(id); + if (m_retrieveAndValidate) + { + DDX_CBString(id, value); + } + else if (value != _T("")) // write to control + { + // Set current selection based on data string. + int i = static_cast(::SendMessage(control, CB_FINDSTRINGEXACT, + static_cast(-1), reinterpret_cast(value.c_str()))); + if (i < 0) + { + // Set the edit text (will be ignored if a DROPDOWNLIST). + ::SetWindowText(control, value); + } + else + { + // Select it. + ::SendMessage(control, CB_SETCURSEL, static_cast(i), 0); + } + } + } + + // Perform a check box control data exchange on the DDX/DDV object m_DX + // with the control numbered id to and from the given int value. + inline void CDataExchange::DDX_Check(UINT id, int& value) + { + HWND control = PrepareCtrl(id); + if (m_retrieveAndValidate) + { + value = static_cast(::SendMessage(control, BM_GETCHECK, 0, 0)); + assert(value == BST_CHECKED || value == BST_UNCHECKED || + value == BST_INDETERMINATE); + } + else + { + if (value < 0 || value > 2) + { + CString str; + str << _T("*** WARNING: dialog data checkbox value ") + << value << _T(" out of range. ***\n"); + TRACE(str); + value = 0; // set default to off + } + + ::SendMessage(control, BM_SETCHECK, static_cast(value), 0); + } + } + + // This function manages the transfer of date and/or time data between a + // date and time picker control (CDateTime) with control numbered id + // in a dialog box or other window, and a SYSTEMTIME data member of + // the object. When called in the read mode, the value is set to the + // current state of the control. When called in the write mode, the + // current state of the control is set to the given value. + inline void CDataExchange::DDX_DateTime(UINT id, SYSTEMTIME &value) + { + HWND control = PrepareCtrl(id); + LPARAM lparam = reinterpret_cast(&value); + if (m_retrieveAndValidate) + ::SendMessage(control, DTM_GETSYSTEMTIME, 0, lparam); + else + ::SendMessage(control, DTM_SETSYSTEMTIME, 0, lparam); + } + + // This function manages the transfer of data between a list box + // control in a dialog box or other window, and an + // integer index of that object. It performs a data exchange for the + // state of the list box control appearing within the DDX/DDV object m_DX + // with the control numbered id. When this function is called, index + // is set to the index of the current list box selection. If no item + // is selected, index is set to LB_ERR. When m_DX.m_retrieveAndValidate is + // false, the index item is selected. + inline void CDataExchange::DDX_LBIndex(UINT id, int& index) + { + HWND control = PrepareCtrl(id); + if (m_retrieveAndValidate) + index = static_cast(::SendMessage(control, LB_GETCURSEL, 0, 0)); + else + ::SendMessage(control, LB_SETCURSEL, static_cast(index), 0); + } + + // Perform a data exchange for the state of a list box control on the + // DDX/DDV object m_DX with the control numbered id using the given + // CString value. On reading the list box, the selected item is returned + // in value. If no item is selected, value is set to a string of zero + // length. When m_retrieveAndValidate is false, the item having the given + // case-insensitive value as a prefix, if it exists, is selected. + inline void CDataExchange::DDX_LBString(UINT id, CString& value) + { + HWND control = PrepareCtrl(id); + if (m_retrieveAndValidate) + { + // Find the index of the item selected in the list box. + int index = static_cast(::SendMessage(control, LB_GETCURSEL, 0, 0)); + if (index != -1) + { + // Read selected text into the CString. + int length = static_cast(::SendMessage(control, LB_GETTEXTLEN, + static_cast(index), 0)); + + ::SendMessage(control, LB_GETTEXT, static_cast(index), + reinterpret_cast(value.GetBuffer(length))); + + value.ReleaseBuffer(); + } + else + { + // No text selected. + value.Empty(); + } + } + else if (!value.IsEmpty()) + { + // search the the entire list box for the given value + // and select it if it is found + int index = static_cast(::SendMessage(control, LB_SELECTSTRING, + static_cast(-1), reinterpret_cast(value.c_str()))); + + if (index == LB_ERR) + { + // The value string was not found. + CString str = CString(_T("*** WARNING: listbox item was not found: ")) + value + _T(". ***\n"); + TRACE(str); + } + } + } + + // This function manages the transfer of CString data between the edit + // control of a list box control in a dialog box or other window, + // and a CString data member of that object. It performs a + // data exchange for the state of the list box control appearing within + // the DDX/DDV object m_DX with the control numbered id. On reading the + // list box, the current list box selection is returned as the value. + // If no item is selected, value is set to a string of zero length. When + // m_DX.m_retrieveAndValidate is false, the item having the entire given + // case-insensitive value as its prefix, if any exists, is selected. + inline void CDataExchange::DDX_LBStringExact(UINT id, CString& value) + { + HWND control = PrepareCtrl(id); + if (m_retrieveAndValidate) + { + // Read and return the CString value. + DDX_LBString(id, value); + } + else if (!value.IsEmpty()) + { + // Find the first entry that matches the entire value, + // in a case insensitive search, perhaps in sorted order, + // if the box has that style. + int index = static_cast(::SendMessage(control, LB_FINDSTRINGEXACT, + static_cast(-1), reinterpret_cast(value.c_str()))); + + if (index < 0) + { + // No match found. + CString str = (_T("Warning: listbox item was not found: ")) + value + _T( "\n"); + TRACE(str); + } + else + { + // Select it. + ::SendMessage(control, LB_SETCURSEL, static_cast(index), 0); + } + } + } + + // This function manages the transfer of date data between a month + // calendar control (CMonthCalendar) with control number id in a dialog + // box or other window, and a SYSTEMTIME data member + // of that object. In particular, the control manages a date value only. + // The time fields in the time object are set to reflect the creation + // time of the control window, or whatever time was set into the control + // with a call to the CMonthCalendar::SetCurSel() member method. In read + // mode, value is set to the current state of the month calendar control. + // In write mode, the current state is set to the given value. + inline void CDataExchange::DDX_MonthCal(UINT id, SYSTEMTIME& value) + { + HWND control = PrepareCtrl(id); + + if (m_retrieveAndValidate) + { + LPARAM lparam = reinterpret_cast(&value); + ::SendMessage(control, MCM_GETCURSEL, 0, lparam); + value.wHour = 0; + value.wMinute = 0; + value.wSecond = 0; + value.wMilliseconds = 0; + } + else + { + LPARAM lparam = reinterpret_cast(&value); + ::SendMessage(control, MCM_SETCURSEL, 0, lparam); + } + } + + // This function manages the transfer of data between a progress control + // in a dialog box or other window, and an integer + // progress value for that object. It performs a data exchange for the + // slider control appearing within the DDX/DDV object m_DX with + // the control numbered id. When this function is called, value is set + // to the current slider entry. When m_DX.m_retrieveAndValidate + // is false, the slider entry is set to value. + inline void CDataExchange::DDX_Progress(UINT id, int& value) + { + HWND control = PrepareCtrl(id); + + if (m_retrieveAndValidate) + value = static_cast(::SendMessage(control, PBM_GETPOS, 0, 0)); + else + ::SendMessage(control, PBM_SETPOS, static_cast(value), 0); + } + + // Perform a data exchange for the state of a group of auto radio buttons + // on the DDX/DDV object m_DX with the control numbered id to and from + // the given int value, where the identifier id is that of the first + // control in the group. + inline void CDataExchange::DDX_Radio(UINT id, int& value) + { + HWND control = PrepareCtrl(id); + + // Assure that the control is a radio button and part of a group. + bool firstInGroup = (::GetWindowLongPtr(control, GWL_STYLE) & WS_GROUP) != 0; + assert(firstInGroup); + + // Assure the button is a radio button. + bool isRadioButton = (::GetWindowLongPtr(control, GWL_STYLE) & (BS_RADIOBUTTON | BS_AUTORADIOBUTTON)) != 0; + assert(isRadioButton); + + // Preset the returned value to empty in case no button is set. + if (m_retrieveAndValidate) + value = -1; + + // Traverse all buttons in the group. + // There's a group, so set up for the radio buttons in the group. + firstInGroup = FALSE; + for (int button = 0; control != nullptr && !firstInGroup; ) + { + if (isRadioButton) + { + if (m_retrieveAndValidate) + { + if (::SendMessage(control, BM_GETCHECK, 0, 0) == BST_CHECKED) // Is this button set? + { + // Record the value the first time, but if it happens again, there + // is an error--only one button checked is allowed. + assert(value == -1); + value = button; + } + } + else + { + WPARAM wparam = static_cast(button == value); + ::SendMessage(control, BM_SETCHECK, wparam, 0); + } + button++; + } + else + { + TRACE(_T("*** Warning: there is a non-radio button in ")); + TRACE(_T("a radio button group. ***\n")); + } + + // Check the next window in the group, if any. + control = ::GetWindow(control, GW_HWNDNEXT); + if (control) + { + isRadioButton = (::GetWindowLongPtr(control, GWL_STYLE) & (BS_RADIOBUTTON | BS_AUTORADIOBUTTON)) != 0; + firstInGroup = (::GetWindowLongPtr(control, GWL_STYLE) & WS_GROUP) != 0; + } + } + } + + // This function manages the transfer of data between a scroll bar control + // in a dialog box or other window, and an integer + // value for that object. It performs a data exchange for the state of + // the scroll bar control appearing within the DDX/DDV object m_DX with + // the control numbered id. When this function is called, value is set + // to the current scroll bar position. When m_DX.m_retrieveAndValidate + // is false, the scroll bar position is set to value. + inline void CDataExchange::DDX_Scroll(UINT id, int& value) + { + HWND control = PrepareCtrl(id); + + if (m_retrieveAndValidate) + value = ::GetScrollPos(control, SB_CTL); + else + ::SetScrollPos(control, SB_CTL, value, TRUE); + } + + // This function manages the transfer of data between a slider control + // in a dialog box or other window, and an integer + // position value for that object. It performs a data exchange for the + // slider control appearing within the DDX/DDV object m_DX with + // the control numbered id. When this function is called, value is set + // to the current slider entry. When m_DX.m_retrieveAndValidate + // is false, the slider entry is set to value. + inline void CDataExchange::DDX_Slider(UINT id, int& value) + { + HWND control = PrepareCtrl(id); + + if (m_retrieveAndValidate) + value = static_cast(::SendMessage(control, TBM_GETPOS, 0, 0)); + else + ::SendMessage(control, TBM_SETPOS, static_cast(TRUE), + static_cast(value)); + } + + //////////////////////////////////////////////////////////////// + // + // DDX: Data Exchange Procedures + // + //////////////////////////////////////////////////////////////// + + // Perform a text box data exchange on the current DDX/DDV object m_DX with + // data value of type BYTE. + inline void CDataExchange::DDX_Text(UINT id, BYTE& value) + { + HWND control = PrepareEditCtrl(id); + if (m_retrieveAndValidate) + { + BYTE oldvalue = value; + CString str; + str.GetWindowText(control); + tStringStream ts(str.c_str()); + ts >> value; + if (ts.fail()) + { + value = oldvalue; + throw CUserException(GetApp()->MsgDDX_Byte()); + } + } + else + { + tStringStream tss; + tss << static_cast(value); + ::SetWindowText(control, tss.str().c_str()); + } + } + + // Perform a text box data exchange on the current DDX/DDV object m_DX with + // data value of type short. + inline void CDataExchange::DDX_Text(UINT id, short& value) + { + HWND control = PrepareEditCtrl(id); + if (m_retrieveAndValidate) + { + short oldvalue = value; + CString str; + str.GetWindowText(control); + tStringStream ts(str.c_str()); + ts >> value; + if (ts.fail()) + { + value = oldvalue; + throw CUserException(GetApp()->MsgDDX_Short()); + } + } + else + { + tStringStream tss; + tss << value; + ::SetWindowText(control, tss.str().c_str()); + } + } + + // Perform a text box data exchange on the current DDX/DDV object m_DX with + // data value of type int. + inline void CDataExchange::DDX_Text(UINT id, int& value) + { + HWND control = PrepareEditCtrl(id); + if (m_retrieveAndValidate) + { + int oldvalue = value; + CString str; + str.GetWindowText(control); + tStringStream ts(str.c_str()); + ts >> value; + if (ts.fail()) + { + value = oldvalue; + throw CUserException(GetApp()->MsgDDX_Int()); + } + } + else + { + tStringStream tss; + tss << value; + ::SetWindowText(control, tss.str().c_str()); + } + } + + // Perform a text box data exchange on the current DDX/DDV object m_DX with + // data value of type UINT. + inline void CDataExchange::DDX_Text(UINT id, UINT& value) + { + HWND control = PrepareEditCtrl(id); + if (m_retrieveAndValidate) + { + UINT oldvalue = value; + CString str; + str.GetWindowText(control); + tStringStream ts(str.c_str()); + ts >> value; + if (ts.fail()) + { + value = oldvalue; + throw CUserException(GetApp()->MsgDDX_UINT()); + } + } + else + { + tStringStream tss; + tss << value; + ::SetWindowText(control, tss.str().c_str()); + } + } + + // Perform a text box data exchange on the current DDX/DDV object m_DX with + // data value of type long. + inline void CDataExchange::DDX_Text(UINT id, long& value) + { + HWND control = PrepareEditCtrl(id); + if (m_retrieveAndValidate) + { + long oldvalue = value; + CString str; + str.GetWindowText(control); + tStringStream ts(str.c_str()); + ts >> value; + if (ts.fail()) + { + value = oldvalue; + throw CUserException(GetApp()->MsgDDX_Long()); + } + } + else + { + tStringStream tss; + tss << value; + ::SetWindowText(control, tss.str().c_str()); + } + } + + // Perform a text box data exchange on the current DDX/DDV object m_DX with + // data value of type ULONG. + inline void CDataExchange::DDX_Text(UINT id, ULONG& value) + { + HWND control = PrepareEditCtrl(id); + if (m_retrieveAndValidate) + { + ULONG oldvalue = value; + CString str; + str.GetWindowText(control); + tStringStream ts(str.c_str()); + ts >> value; + if (ts.fail()) + { + value = oldvalue; + throw CUserException(GetApp()->MsgDDX_ULONG()); + } + } + else + { + tStringStream tss; + tss << value; + ::SetWindowText(control, tss.str().c_str()); + } + } + + // Perform a text box data exchange on the current DDX/DDV object m_DX with + // data value of type float with the given precision. + inline void CDataExchange::DDX_Text(UINT id, float& value, int precision /* = FLT_DIG */) + { + HWND control = PrepareEditCtrl(id); + if (m_retrieveAndValidate) + { + float oldvalue = value; + CString str; + str.GetWindowText(control); + tStringStream ts(str.c_str()); + ts >> value; + if (ts.fail()) + { + value = oldvalue; + throw CUserException(GetApp()->MsgDDX_Real()); + } + } + else + { + tStringStream tss; + tss << std::setprecision(precision) << value; + ::SetWindowText(control, tss.str().c_str()); + } + } + + // Perform a text box data exchange on the current DDX/DDV object m_DX with + // data value of type double with the given precision. + inline void CDataExchange::DDX_Text(UINT id, double& value, int precision /* = DBL_DIG */) + { + HWND control = PrepareEditCtrl(id); + if (m_retrieveAndValidate) + { + double oldvalue = value; + CString str; + str.GetWindowText(control); + tStringStream ts(str.c_str()); + ts >> value; + if (ts.fail()) + { + value = oldvalue; + throw CUserException(GetApp()->MsgDDX_Real()); + } + } + else + { + tStringStream tss; + tss << std::setprecision(precision) << value; + ::SetWindowText(control, tss.str().c_str()); + } + } + + // Perform a text box data exchange on the current DDX/DDV object m_DX with + // data value of type CString. + inline void CDataExchange::DDX_Text(UINT id, CString& value) + { + HWND control = PrepareEditCtrl(id); + if (m_retrieveAndValidate) + { + value.GetWindowText(control); + } + else + { + ::SetWindowText(control, value.c_str()); + } + } + + // Perform a text box data exchange on the current DDX/DDV object m_DX with + // data value of type LPTSTR with the given maximum length. + inline void CDataExchange::DDX_Text(UINT id, LPTSTR value, int maxLen) + { + assert(value); + + HWND control = PrepareEditCtrl(id); + if (m_retrieveAndValidate) + { + CString str; + str.GetWindowText(control); + StrCopy(value, str, static_cast(maxLen)); + } + else + { + ::SetWindowText(control, value); + } + } + + // This function is called when a CUserException is caught while + // validating the value in a control. This is a virtual function that can + // be overridden as required. + inline void CDataExchange::Fail(LPCTSTR message) const + { + ::MessageBox(0, message, _T("Error"), MB_OK | MB_ICONEXCLAMATION | MB_TASKMODAL); + + if (!m_retrieveAndValidate) + { + TRACE(_T("*** WARNING: CDataExchange::Fail() called while ")); + TRACE(_T("writing to a control. ***\n")); + } + else if (m_lastControl != nullptr) + { + if (m_isEditLastControl) // if the offender is an edit control + { + // select all characters in the edit item + ::SetFocus(m_lastControl); + ::SendMessage(m_lastControl, EM_SETSEL, 0, -1); + } + } + else + { + TRACE(_T("*** WARNING: validation failed with no control to ")); + TRACE(_T("restore focus to. ***\n")); + } + } + + // Used by CWnd::UpdateData() to initialize the CDataExchange members. + inline void CDataExchange::Init(CWnd& dlgWnd, BOOL retrieveAndValidate) + { + // the window has to be valid + assert(dlgWnd.IsWindow()); + + // record the default action and parent window + m_retrieveAndValidate = retrieveAndValidate; + m_parent = dlgWnd; + m_lastControl = nullptr; + } + + // Find the handle to the control whose numeric identifier is id and + // record this as the last control handle encountered. Set the last-edit + // member to a FALSE default value. + inline HWND CDataExchange::PrepareCtrl(UINT id) + { + assert(id != 0); + assert(static_cast(id) != -1); // not allowed + + HWND control = ::GetDlgItem(m_parent, static_cast(id)); + assert(control); + + m_lastControl = control; + m_isEditLastControl = FALSE; // not an edit item by default + return control; + } + + // Get and record the handle corresponding to id and set the m_isEditLastControl + // variable to TRUE. This method is only used for edit controls. + inline HWND CDataExchange::PrepareEditCtrl(UINT id) + { + HWND control = PrepareCtrl(id); + assert(control); + + m_isEditLastControl = TRUE; + return control; + } + + + //////////////////////////////////////////////////////////////// + // + // Global function + // + //////////////////////////////////////////////////////////////// + + // Convert the SYSTEMTIME struct to an ULONGLONG integer and + // return this value. + inline ULONGLONG SystemTimeToULL(SYSTEMTIME systime) + { + FILETIME ft; + SystemTimeToFileTime(&systime, &ft); + return static_cast(ft.dwHighDateTime) << 32 | ft.dwLowDateTime; + } + +} // namespace Win32xx + +#endif // _WIN32XX_DDX_H_ + diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_dialog.h b/packages/media/cpp/packages/Win32xx/include/wxx_dialog.h new file mode 100644 index 00000000..520f37bf --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_dialog.h @@ -0,0 +1,1201 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////// +// wxx_dialog.h +// Declaration of CResizer and CDialog classes. + +// CDialog adds support for dialogs to Win32++. Dialogs are specialised +// windows which are a parent window for common controls. Common controls +// are special window types such as buttons, edit controls, tree views, +// list views, static text etc. + +// The layout of a dialog is typically defined in a resource script file +// (often Resource.rc). While this script file can be constructed manually, +// it is often created using a resource editor. A resource editor is included +// with Microsoft's Visual Studio Studio Community. + +// CDialog supports modal and modeless dialogs. It also supports the creation +// of dialogs defined in a resource script file, as well as those defined in +// a dialog template. + +// Use the Dialog generic program as the starting point for your own dialog +// applications. +// The DialogDemo sample demonstrates how to use subclassing to customize +// the behaviour of common controls in a dialog. + +// Note: The following functions often used with dialogs are provided by CWnd: +// GetDlgCtrlID, GetDlgItem, GetDlgItemInt, GetDlgItemText, +// GetNextDlgGroupItem, GetNextDlgTabItem, SendDlgItemMessage, SetDlgItemInt, +// SetDlgItemText. + + +#ifndef _WIN32XX_DIALOG_H_ +#define _WIN32XX_DIALOG_H_ + +#include "wxx_wincore.h" + + +namespace Win32xx +{ + /////////////////////////////////////////////////////////// + // CDialog manages a dialog box. Dialog boxes are typically + // used by an application to retrieve user input. + // A modal dialog box requires the user to supply information or + // cancel the dialog box before allowing the application to continue. + // A modeless dialog box allows the user to supply information and + // return to the previous task without closing the dialog box. + class CDialog : public CWnd + { + + public: + CDialog(); + CDialog(UINT resourceID); + CDialog(LPCTSTR resourceName); + CDialog(LPCDLGTEMPLATE pDlgTemplate); + virtual ~CDialog() override; + + // Virtual functions + virtual void AttachItem(UINT id, CWnd& wnd); + virtual HWND Create(HWND parent = nullptr) override { return DoModeless(parent); } + virtual INT_PTR DoModal(HWND parent = nullptr); + virtual HWND DoModeless(HWND parent = nullptr); + + // Mutators that assign the dialog resource + void SetDialogFromID(UINT resourceID); + void SetDialogResource(LPCTSTR resourceName); + void SetDialogTemplate(LPCDLGTEMPLATE pDlgTemplate); + + // Wrappers for Windows API functions + UINT GetDefID() const; + void GotoDlgCtrl(HWND control) const; + BOOL MapDialogRect(RECT& rc) const; + void NextDlgCtrl() const; + void PrevDlgCtrl() const; + void SetDefID(UINT id) const; + + protected: + // Virtual functions you might wish to override + virtual INT_PTR DialogProc(UINT msg, WPARAM wparam, LPARAM lparam); + virtual void EndDialog(INT_PTR result); + virtual void OnCancel(); + virtual void OnClose() override; + virtual BOOL OnInitDialog(); + virtual void OnOK(); + virtual BOOL PreTranslateMessage(MSG& msg) override; + + // Not intended to be overridden + virtual INT_PTR DialogProcDefault(UINT msg, WPARAM wparam, LPARAM lparam); + + private: + using CWnd::WndProc; // Make WndProc private + using CWnd::WndProcDefault; // Make WndProcDefault private + CDialog(const CDialog&) = delete; + CDialog& operator=(const CDialog&) = delete; + + static INT_PTR CALLBACK StaticDialogProc(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam); + static LRESULT CALLBACK StaticMsgHook(int code, WPARAM wparam, LPARAM lparam); + + // State functions + BOOL IsModal() const { return m_isModal; } + BOOL IsIndirect() const { return (m_pDlgTemplate != nullptr); } + + BOOL m_isModal; // a flag for modal dialogs + HHOOK m_msgHook; // the message hook handle + LPCTSTR m_resourceName; // the resource name for the dialog + LPCDLGTEMPLATE m_pDlgTemplate; // the dialog template for indirect dialogs + }; + + + ///////////////////////////////////// + // Declaration of the CResizer class. + // + // The CResizer class can be used to rearrange a dialog's child + // windows when the dialog is resized. + + // To use CResizer, follow the following steps: + // 1) Use Initialize to specify the dialog's CWnd, and min and max size. + // 3) Use AddChild for each child window + // 4) Call HandleMessage from within DialogProc. + // + + // Resize Dialog Styles + const int RD_STRETCH_HEIGHT = 0x0001; // The item has a variable height. + const int RD_STRETCH_WIDTH = 0x0002; // The item has a variable width. + + + //////////////////////////////////////////////////////////////// + // The CResizer class is used to automatically rearrange child + // windows when the parent window is resized. It displays scroll + // bars as required. CResizer is often used with dialogs. + class CResizer + { + public: + + // Alignment specifiers. + enum Alignment { topleft, topright, bottomleft, bottomright, center, + leftcenter, rightcenter, topcenter, bottomcenter }; + + CResizer() : m_parent(nullptr), m_xScrollPos(0), m_yScrollPos(0), + m_currentDpi(USER_DEFAULT_SCREEN_DPI), + m_initDpi(USER_DEFAULT_SCREEN_DPI), + m_isDpiChanging(false) + {} + virtual ~CResizer() = default; + + virtual void AddChild(HWND wnd, Alignment corner, DWORD style); + virtual void HandleMessage(UINT msg, WPARAM wparam, LPARAM lparam); + virtual void Initialize(HWND parent, RECT minRect, + RECT maxRect = CRect(0, 0, 0, 0)); + virtual void OnAfterDpiChange(); + virtual void OnBeforeDpiChange(); + virtual void OnHScroll(UINT msg, WPARAM wparam, LPARAM lparam); + virtual void OnVScroll(UINT msg, WPARAM wparam, LPARAM lparam); + virtual void RecalcLayout(); + CRect GetMinRect() const { return m_minRect; } + CRect GetMaxRect() const { return m_maxRect; } + void SetMinRect(RECT minRect) { m_minRect = minRect; } + void SetMaxRect(RECT rcMaxRect) { m_maxRect = rcMaxRect; } + + struct ResizeData + { + ResizeData() : corner(topleft), isFixedWidth(false), isFixedHeight(false), wnd(0) {} + CRect childRect; + Alignment corner; + bool isFixedWidth; + bool isFixedHeight; + HWND wnd; + }; + + private: + CResizer(const CResizer&) = delete; + CResizer& operator=(const CResizer&) = delete; + + static BOOL CALLBACK EnumWindowsProc(HWND wnd, LPARAM lparam); + void ScaleRect(CRect& rc, double scale); + + HWND m_parent; + std::vector m_resizeData; + + CRect m_initRect; + CRect m_minRect; + CRect m_maxRect; + + int m_xScrollPos; + int m_yScrollPos; + int m_currentDpi; + int m_initDpi; + + bool m_isDpiChanging; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + ///////////////////////////////////// + // Definitions for the CDialog class. + // + + // Default constructor. Use SetDialogTemplate, SetDialogResource or + // SetDialogResourceFromID to specify the dialog if this constructor + // is used. + inline CDialog::CDialog() : m_isModal(FALSE), m_msgHook(nullptr), + m_resourceName(nullptr), m_pDlgTemplate(nullptr) + { + } + + // Constructor that specifies the dialog's resource + inline CDialog::CDialog(LPCTSTR resourceName) : m_isModal(FALSE), + m_msgHook(nullptr), m_resourceName(resourceName), m_pDlgTemplate(nullptr) + { + } + + // Constructor that specifies the dialog's resource ID + inline CDialog::CDialog(UINT resourceID) : m_isModal(FALSE), m_msgHook(nullptr), + m_resourceName(MAKEINTRESOURCE (resourceID)), m_pDlgTemplate(nullptr) + { + } + + // Constructor for indirect dialogs, created from a dialog box template in memory. + inline CDialog::CDialog(LPCDLGTEMPLATE pDlgTemplate) : m_isModal(FALSE), + m_msgHook(nullptr), m_resourceName(nullptr), m_pDlgTemplate(pDlgTemplate) + { + } + + inline CDialog::~CDialog() + { + if (GetHwnd() != nullptr) + { + if (IsModal()) + ::EndDialog(GetHwnd(), 0); + else + { + if (IsAppRunning()) // Is the CWinApp object still valid? + { + if (GetCWndPtr(*this) == this) // Is window managed by Win32++? + { + if (IsWindow()) + ::DestroyWindow(*this); + } + + GetApp()->RemoveCWndFromMap(this); + } + } + } + } + + // Attaches a dialog item to a CWnd. + inline void CDialog::AttachItem(UINT id, CWnd& wnd) + { + wnd.AttachDlgItem(id, *this); + } + + // The dialog's message procedure. Override this function in your class derived + // from CDialog if you wish to handle messages. + inline INT_PTR CDialog::DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) + { + // A typical function might look like this: + + // switch (msg) + // { + // case MESSAGE1: // Some Windows API message + // OnMessage1(); // A user defined function + // break; // Also do default processing + // case MESSAGE2: + // OnMessage2(); + // return x; // Don't do default processing, but instead return + // // a value recommended by the Windows API documentation + // } + + // Always pass unhandled messages on to DialogProcDefault. + return DialogProcDefault(msg, wparam, lparam); + } + + // All DialogProc functions should pass unhandled messages to this function. + inline INT_PTR CDialog::DialogProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) + { + LRESULT result = 0; + + switch (msg) + { + case WM_INITDIALOG: + { + // Center the dialog. + CenterWindow(); + } + return OnInitDialog(); + case WM_CLOSE: + { + OnClose(); + return 0; + } + case WM_COMMAND: + { + if (HIWORD(wparam) == BN_CLICKED) + { + switch (LOWORD(wparam)) + { + case IDOK: + OnOK(); + return TRUE; + case IDCANCEL: + OnCancel(); + return TRUE; + } + } + + // Reflect this message if it's from a control. + CWnd* pWnd = GetCWndPtr(reinterpret_cast(lparam)); + if (pWnd != nullptr) + result = pWnd->OnCommand(wparam, lparam); + + // Handle user commands. + if (!result) + result = OnCommand(wparam, lparam); + + if (result) return 0; + } + break; // Some commands require default processing. + + + case WM_DESTROY: + OnDestroy(); + break; + case WM_NOTIFY: + { + // Do notification reflection if message came from a child window. + // Restricting OnNotifyReflect to child windows avoids double handling. + LPNMHDR pHeader = reinterpret_cast(lparam); + assert(pHeader); + if (pHeader != nullptr) + { + HWND from = pHeader->hwndFrom; + CWnd* pFrom = GetApp()->GetCWndFromMap(from); + + if (pFrom != nullptr) + if (::GetParent(from) == m_wnd) + result = pFrom->OnNotifyReflect(wparam, lparam); + + // Handle user notifications. + if (!result) result = OnNotify(wparam, lparam); + + // Set the return code for notifications. + if (IsWindow()) + SetWindowLongPtr(DWLP_MSGRESULT, static_cast(result)); + } + return result; + } + + case WM_PAINT: + { + if (::GetUpdateRect(*this, nullptr, FALSE)) + { + CPaintDC dc(*this); + OnDraw(dc); + } + else + // RedrawWindow can require repainting without an update rect. + { + CClientDC dc(*this); + OnDraw(dc); + } + + break; + } + + case WM_ERASEBKGND: + { + CDC dc(reinterpret_cast(wparam)); + return OnEraseBkgnd(dc); + } + + // A set of messages to be reflected back to the control that generated them. + case WM_CTLCOLORBTN: + case WM_CTLCOLOREDIT: + case WM_CTLCOLORDLG: + case WM_CTLCOLORLISTBOX: + case WM_CTLCOLORSCROLLBAR: + case WM_CTLCOLORSTATIC: + case WM_DRAWITEM: + case WM_MEASUREITEM: + case WM_DELETEITEM: + case WM_COMPAREITEM: + case WM_CHARTOITEM: + case WM_VKEYTOITEM: + case WM_HSCROLL: + case WM_VSCROLL: + case WM_PARENTNOTIFY: + return MessageReflect(msg, wparam, lparam); + + case UWM_GETCDIALOG: // Returns a pointer to this CDialog object. + case UWM_GETCWND: + { + assert(this == GetCWndPtr(m_wnd)); + + // Set the return code. + if (IsWindow()) + SetWindowLongPtr(DWLP_MSGRESULT, reinterpret_cast(this)); + + return TRUE; + } + + } // switch(msg) + + return 0; + + } // INT_PTR CALLBACK CDialog::DialogProc(...) + + // Creates a modal dialog. A modal dialog box must be closed by the user + // before the application continues. + // Refer to DialogBox and DialogBoxIndirect in the Windows API documentation + // for more information. + inline INT_PTR CDialog::DoModal(HWND parent /* = nullptr */) + { + assert(!IsWindow()); // Only one window per CWnd instance allowed + assert(m_pDlgTemplate || m_resourceName); // Dialog layout must be defined. + + INT_PTR result = 0; + m_isModal=TRUE; + Cleanup(); + + // Set the message hook used to support OnIdle and PreTranslateMessage. + // The hook is only used in modal dialogs. + m_msgHook = ::SetWindowsHookEx(WH_MSGFILTER, (HOOKPROC)StaticMsgHook, + 0, ::GetCurrentThreadId()); + + // Store this CDialog's pointer in thread local storage. + TLSData* pTLSData = GetApp()->GetTlsData(); + assert(pTLSData); + pTLSData->pWnd = this; + + // Create a modal dialog. + HINSTANCE instance = GetApp()->GetInstanceHandle(); + if (m_pDlgTemplate != nullptr) + result = ::DialogBoxIndirect(instance, m_pDlgTemplate, parent, CDialog::StaticDialogProc); + else + { + if (::FindResource(GetApp()->GetResourceHandle(), m_resourceName, RT_DIALOG)) + instance = GetApp()->GetResourceHandle(); + result = ::DialogBox(instance, m_resourceName, parent, CDialog::StaticDialogProc); + } + + // Tidy up. + pTLSData->pWnd = nullptr; + Cleanup(); + ::UnhookWindowsHookEx(m_msgHook); + m_msgHook = nullptr; + + // Throw an exception if the dialog creation fails. + if (result == -1) + { + throw CWinException(GetApp()->MsgWndDialog()); + } + + return result; + } + + // Creates a modeless dialog. + // Refer to CreateDialog and CreateDialogIndirect in the Windows API documentation for more information. + inline HWND CDialog::DoModeless(HWND parent /* = nullptr*/) + { + assert(m_pDlgTemplate || m_resourceName); // Dialog layout must be defined. + + m_isModal=FALSE; + Cleanup(); + + // Retrieve this thread's TLS data. + TLSData* pTLSData = GetApp()->GetTlsData(); + + // Store the CWnd pointer in Thread Local Storage. + pTLSData->pWnd = this; + + HINSTANCE instance = GetApp()->GetInstanceHandle(); + HWND wnd = nullptr; + + // Create the modeless dialog. + if (m_pDlgTemplate != nullptr) + wnd = ::CreateDialogIndirect(instance, m_pDlgTemplate, parent, CDialog::StaticDialogProc); + else + { + if (::FindResource(GetApp()->GetResourceHandle(), m_resourceName, RT_DIALOG)) + instance = GetApp()->GetResourceHandle(); + + wnd = ::CreateDialog(instance, m_resourceName, parent, CDialog::StaticDialogProc); + } + + // Tidy up. + pTLSData->pWnd = nullptr; + + // Display information on dialog creation failure. + if (wnd == nullptr) + { + throw CWinException(GetApp()->MsgWndDialog()); + } + + return wnd; + } + + // Ends a modal dialog. + // Refer to EndDialog in the Windows API documentation for more information. + inline void CDialog::EndDialog(INT_PTR result) + { + assert(IsWindow()); + assert(IsModal()); + + ::EndDialog(*this, result); + } + + // Called when the Cancel button is pressed. Automatically closes the dialog. + // Override to customize OnCancel behavior. + inline void CDialog::OnCancel() + { + if (IsModal()) + EndDialog(IDCANCEL); + else + Destroy(); + } + + // Called when the Close button is pressed. Automatically closes the dialog. + // Override to customize OnClose behavior. + inline void CDialog::OnClose() + { + if (IsModal()) + EndDialog(0); + else + Destroy(); + } + + // Called when the dialog is initialized. + // Override it in your derived class to automatically perform tasks. + // The return value is used by WM_INITDIALOG. + inline BOOL CDialog::OnInitDialog() + { + return TRUE; + } + + // Called when the OK button is pressed. Automatically closes the dialog. + // Override to customize OnOK behavior. + inline void CDialog::OnOK() + { + if (IsModal()) + EndDialog(IDOK); + else + Destroy(); + } + + // Override this function to filter mouse and keyboard messages prior to + // being passed to the DialogProc. + inline BOOL CDialog::PreTranslateMessage(MSG& msg) + { + // Allow the dialog to translate keyboard input. + if ((msg.message >= WM_KEYFIRST) && (msg.message <= WM_KEYLAST)) + { + // Process dialog keystrokes for modeless dialogs. + if (!IsModal()) + { + if (IsDialogMessage(msg)) + return TRUE; + } + } + + return FALSE; + } + + // Retrieves the identifier of the default push button control for the dialog. + // Refer to DM_GETDEFID in the Windows API documentation for more information. + inline UINT CDialog::GetDefID() const + { + assert(IsWindow()); + DWORD id = 0; + LRESULT result = SendMessage(DM_GETDEFID, 0, 0); + if (DC_HASDEFID == HIWORD(result)) + id = LOWORD(result); + + return static_cast(id); + } + + // Sets the keyboard focus to the specified control. + // Refer to WM_NEXTDLGCTL in the Windows API documentation for more information. + inline void CDialog::GotoDlgCtrl(HWND control) const + { + assert(IsWindow()); + assert(::IsWindow(control)); + WPARAM wparam = reinterpret_cast(control); + LPARAM lparam = static_cast(TRUE); + SendMessage(WM_NEXTDLGCTL, wparam, lparam); + } + + // Converts the dialog box units to screen units (pixels). + // Refer to MapDialogRect in the Windows API documentation for more information. + inline BOOL CDialog::MapDialogRect(RECT& rc) const + { + assert(IsWindow()); + return ::MapDialogRect(*this, &rc); + } + + // Sets the keyboard focus to the next dialog control. + // Refer to WM_NEXTDLGCTL in the Windows API documentation for more information. + inline void CDialog::NextDlgCtrl() const + { + assert(IsWindow()); + SendMessage(WM_NEXTDLGCTL, 0, 0); + } + + // Sets the keyboard focus to the previous dialog control. + // Refer to WM_NEXTDLGCTL in the Windows API documentation for more information. + inline void CDialog::PrevDlgCtrl() const + { + assert(IsWindow()); + SendMessage(WM_NEXTDLGCTL, static_cast(TRUE), 0); + } + + // Changes the identifier of the default push button for a dialog box. + // Refer to DM_SETDEFID in the Windows API documentation for more information. + inline void CDialog::SetDefID(UINT id) const + { + assert(IsWindow()); + SendMessage(DM_SETDEFID, static_cast(id), 0); + } + + // Sets the dialog from the specified dialog resource ID. + inline void CDialog::SetDialogFromID(UINT resourceID) + { + m_resourceName = MAKEINTRESOURCE(resourceID); + } + + // Sets the dialog from the specified dialog resource. + inline void CDialog::SetDialogResource(LPCTSTR resourceName) + { + m_resourceName = resourceName; + } + + // Sets the dialog from the specified dialog template. + inline void CDialog::SetDialogTemplate(LPCDLGTEMPLATE pDlgTemplate) + { + m_pDlgTemplate = pDlgTemplate; + } + + // This callback function passes messages to DialogProc + inline INT_PTR CALLBACK CDialog::StaticDialogProc(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam) + { + // Find the CWnd pointer mapped to this HWND. + CDialog* pDialog = static_cast(GetCWndPtr(wnd)); + if (pDialog == nullptr) + { + // The HWND wasn't in the map, so add it now. + TLSData* pTLSData = GetApp()->GetTlsData(); + if (pTLSData) + { + // Retrieve pointer to CWnd object from Thread Local Storage TLS. + pDialog = static_cast(pTLSData->pWnd); + if (pDialog) + { + pTLSData->pWnd = nullptr; + + // Store the window pointer in the HWND map. + pDialog->m_wnd = wnd; + pDialog->AddToMap(); + } + } + } + + assert(pDialog != nullptr); + if (pDialog == nullptr) + { + // Got a message for a window that's not in the map. + return 0; + } + + return pDialog->DialogProc(msg, wparam, lparam); + + } // INT_PTR CALLBACK CDialog::StaticDialogProc(...) + + // Used only by modal dialogs for idle processing and PreTranslateMessage. + inline LRESULT CALLBACK CDialog::StaticMsgHook(int code, WPARAM wparam, LPARAM lparam) + { + MSG msg = {}; + LONG count = 0; + + // While idle, perform idle processing until OnIdle returns FALSE. + // Exclude some messages to avoid calling OnIdle excessively. + while (!::PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE) && + (msg.message != WM_TIMER) && + (msg.message != WM_MOUSEMOVE) && + (msg.message != WM_SETCURSOR) && + GetApp()->OnIdle(count) != FALSE ) + { + ++count; + } + count = 0; + + if (code == MSGF_DIALOGBOX) + { + MSG* pMsg = reinterpret_cast(lparam); + + // Only pre-translate keyboard and mouse events. + if (pMsg && ((pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST) || + (pMsg->message >= WM_MOUSEFIRST && pMsg->message <= WM_MOUSELAST))) + { + for (HWND wnd = pMsg->hwnd; wnd != 0; wnd = ::GetParent(wnd)) + { + // The wnd will be a handle to the dialog or a child control. + CDialog* pDialog = dynamic_cast(GetCWndPtr(wnd)); + if (pDialog != nullptr) + { + if (pDialog->PreTranslateMessage(*pMsg)) + return 1; // Eat the message. + + return ::CallNextHookEx(0, code, wparam, lparam); + } + } + } + } + + return ::CallNextHookEx(0, code, wparam, lparam); + } + + + ////////////////////////////////////// + // Definitions for the CResizer class. + // + + // Adds or updates the information about a child window managed by CResizer. + // + // The alignment parameter determines the control's position. + // Allowed values are: + // topleft: Positions top left + // topright: Positions top right + // bottomleft: Positions bottom left + // bottomright: Positions bottom right + // center: Positions proportionally + // leftcenter: Positions proportionally along the left side + // rightcenter: Positions proportionally along the right side + // topcenter: Positions proportionally along the top side + // bottomcenter: Positions proportionally along the bottom side + // + // The style is a combination of the following flags. If the style is + // zero, the control's width and height is fixed: + // RD_STRETCH_WIDTH: The width is variable instead of fixed. + // RD_STRETCH_HEIGHT: The height is variable instead of fixed. + void inline CResizer::AddChild(HWND wnd, Alignment corner, DWORD style) + { + assert(::IsWindow(wnd)); + assert(::GetParent(wnd) == m_parent); + + ResizeData rd; + rd.corner = corner; + rd.isFixedWidth = !(style & RD_STRETCH_WIDTH); + rd.isFixedHeight = !(style & RD_STRETCH_HEIGHT); + CRect childRect; + VERIFY(::GetWindowRect(wnd, &childRect)); + ::MapWindowPoints(HWND_DESKTOP, m_parent, reinterpret_cast(&childRect), 2); + rd.childRect = childRect; + rd.wnd = wnd; + + auto it = m_resizeData.begin(); + while (it != m_resizeData.end()) + { + if ( it->wnd == wnd) + { + // Replace the value. + *it = rd; + break; + } + + ++it; + } + + // Add the value. + if (it == m_resizeData.end()) + m_resizeData.push_back(rd); + } + + // A callback function used by EnumChildWindows. + inline BOOL CALLBACK CResizer::EnumWindowsProc(HWND wnd, LPARAM lparam) + { + CResizer* pResizer = reinterpret_cast(lparam); + + // Only for a child, not other descendants. + if (::GetParent(wnd) == pResizer->m_parent) + { + // Add the child window to set of windows managed by CResizer. + pResizer->AddChild(wnd, topleft, 0); + } + + return TRUE; + } + + // Performs the resizing and scrolling. Call this function from within the window's DialogProc. + inline void CResizer::HandleMessage(UINT msg, WPARAM wparam, LPARAM lparam) + { + switch (msg) + { + case WM_DPICHANGED: + case WM_DPICHANGED_AFTERPARENT: + OnAfterDpiChange(); + break; + + case WM_DPICHANGED_BEFOREPARENT: + case WM_GETDPISCALEDSIZE: + OnBeforeDpiChange(); + break; + + case WM_SIZE: + RecalcLayout(); + break; + + case WM_SYSCOMMAND: + // A fix for an issue that's been reported but not verified. + if (wparam == SC_RESTORE) + m_isDpiChanging = false; + break; + + case WM_HSCROLL: + if (lparam == 0) + OnHScroll(msg, wparam, lparam); + break; + + case WM_VSCROLL: + if (lparam == 0) + OnVScroll(msg, wparam, lparam); + break; + } + } + + // Sets up CResizer by specifying the parent window (usually a dialog), + // and the minimum and maximum allowed rectangle sizes. + // Note: parent can either be a CWnd or a window handle (HWND) + inline void CResizer::Initialize(HWND parent, RECT minRect, RECT maxRect) + { + assert (::IsWindow(parent)); + + m_parent = parent; + VERIFY(::GetClientRect(parent, &m_initRect)); + + m_minRect = minRect; + m_maxRect = maxRect; + + m_resizeData.clear(); + + // Add scroll bar support to the parent window + LONG_PTR style = static_cast(::GetClassLongPtr(parent, GCL_STYLE)); + style |= WS_HSCROLL | WS_VSCROLL; + ::SetClassLongPtr(parent, GCL_STYLE, style); + + // Calls AddChild for each child window with default settings. + ::EnumChildWindows(parent, EnumWindowsProc, reinterpret_cast(this)); + + int dpi = GetWindowDpi(m_parent); + double scale = static_cast(dpi) / static_cast(m_currentDpi); + + ScaleRect(m_minRect, scale); + ScaleRect(m_maxRect, scale); + + m_currentDpi = dpi; + m_initDpi = dpi; + RecalcLayout(); + } + + inline void CResizer::OnBeforeDpiChange() + { + // Set the flag to disable recalculating the layout. + m_isDpiChanging = true; + } + + // Rescales the layout to changes in the parent window's dpi. + inline void CResizer::OnAfterDpiChange() + { + int dpi = GetWindowDpi(m_parent); + double scale = static_cast(dpi) / + static_cast(m_currentDpi); + + // Adjust the scrolling position. + m_xScrollPos = static_cast(m_xScrollPos * scale); + m_yScrollPos = static_cast(m_yScrollPos * scale); + + // Adjust the rectangles. + ScaleRect(m_initRect, scale); + ScaleRect(m_minRect, scale); + ScaleRect(m_maxRect, scale); + + // Reposition the child windows. + m_currentDpi = dpi; + m_isDpiChanging = false; + RecalcLayout(); + } + + // Called to perform horizontal scrolling. + inline void CResizer::OnHScroll(UINT, WPARAM wparam, LPARAM) + { + int xNewPos; + + switch (LOWORD(wparam)) + { + case SB_LEFT: // Scrolls to the upper left. + xNewPos = 0; + break; + + case SB_RIGHT: // Scrolls to the lower right. + xNewPos = m_minRect.Width(); + break; + + case SB_PAGELEFT: // User clicked the scroll bar shaft left of the scroll box. + xNewPos = m_xScrollPos - 50; + break; + + case SB_PAGERIGHT: // User clicked the scroll bar shaft right of the scroll box. + xNewPos = m_xScrollPos + 50; + break; + + case SB_LINELEFT: // User clicked the left arrow. + xNewPos = m_xScrollPos - 5; + break; + + case SB_LINERIGHT: // User clicked the right arrow. + xNewPos = m_xScrollPos + 5; + break; + + case SB_THUMBPOSITION: // User has dragged the scroll box. + case SB_THUMBTRACK: // User is dragging the scroll box. + xNewPos = HIWORD(wparam); + break; + + default: + xNewPos = m_xScrollPos; + } + + // Scroll the window. + xNewPos = std::max(0, xNewPos); + CRect rc; + VERIFY(::GetClientRect(m_parent, &rc)); + xNewPos = std::min( xNewPos, GetMinRect().Width() - rc.Width() ); + int xDelta = xNewPos - m_xScrollPos; + m_xScrollPos = xNewPos; + VERIFY(::ScrollWindow(m_parent, -xDelta, 0, nullptr, nullptr)); + + // Update the scroll bar. + SCROLLINFO si = {}; + si.cbSize = sizeof(si); + si.fMask = SIF_POS; + si.nPos = m_xScrollPos; + ::SetScrollInfo(m_parent, SB_HORZ, &si, TRUE); + } + + // Called to perform vertical scrolling. + void inline CResizer::OnVScroll(UINT, WPARAM wparam, LPARAM) + { + int yNewPos; + + switch (LOWORD(wparam)) + { + case SB_TOP: // Scrolls to the top. + yNewPos = 0; + break; + + case SB_BOTTOM: // Scrolls to the bottom. + yNewPos = m_minRect.Height(); + break; + + case SB_PAGEUP: // User clicked the scroll bar shaft above the scroll box. + yNewPos = m_yScrollPos - 50; + break; + + case SB_PAGEDOWN: // User clicked the scroll bar shaft below the scroll box. + yNewPos = m_yScrollPos + 50; + break; + + case SB_LINEUP: // User clicked the top arrow. + yNewPos = m_yScrollPos - 5; + break; + + case SB_LINEDOWN: // User clicked the bottom arrow. + yNewPos = m_yScrollPos + 5; + break; + + case SB_THUMBPOSITION: // User has dragged the scroll box. + case SB_THUMBTRACK: // User is dragging the scroll box. + yNewPos = HIWORD(wparam); + break; + + default: + yNewPos = m_yScrollPos; + } + + // Scroll the window. + yNewPos = std::max(0, yNewPos); + CRect rc; + VERIFY(::GetClientRect(m_parent, &rc)); + yNewPos = std::min( yNewPos, GetMinRect().Height() - rc.Height() ); + int yDelta = yNewPos - m_yScrollPos; + m_yScrollPos = yNewPos; + VERIFY(::ScrollWindow(m_parent, 0, -yDelta, nullptr, nullptr)); + + // Update the scroll bar. + SCROLLINFO si = {}; + si.cbSize = sizeof(si); + si.fMask = SIF_POS; + si.nPos = m_yScrollPos; + ::SetScrollInfo(m_parent, SB_VERT, &si, TRUE); + } + + // Repositions the child windows. Call this function when handling + // the WM_SIZE message in the parent window. + void inline CResizer::RecalcLayout() + { + assert (m_initRect.Width() > 0 && m_initRect.Height() > 0); + assert (::IsWindow(m_parent)); + + // Skip recalculating the layout if the DPI is changing. + if (m_isDpiChanging) + return; + + CRect currentRect; + VERIFY(::GetClientRect(m_parent, ¤tRect)); + + // Adjust the scrolling if required + m_xScrollPos = std::min(m_xScrollPos, std::max(0, m_minRect.Width() - currentRect.Width() ) ); + m_yScrollPos = std::min(m_yScrollPos, std::max(0, m_minRect.Height() - currentRect.Height()) ); + SCROLLINFO si = {}; + si.cbSize = sizeof(si); + si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS; + si.nMax = m_minRect.Width(); + si.nPage = static_cast(currentRect.Width()); + si.nPos = m_xScrollPos; + ::SetScrollInfo(m_parent, SB_HORZ, &si, TRUE); + si.nMax = m_minRect.Height(); + si.nPage = static_cast(currentRect.Height()); + si.nPos = m_yScrollPos; + ::SetScrollInfo(m_parent, SB_VERT, &si, TRUE); + + // Note: calls to SetScrollInfo may have changed the client rect, so + // we get it again. + VERIFY(::GetClientRect(m_parent, ¤tRect)); + + currentRect.right = std::max(currentRect.Width(), m_minRect.Width() ); + currentRect.bottom = std::max(currentRect.Height(), m_minRect.Height() ); + if (!m_maxRect.IsRectEmpty()) + { + currentRect.right = std::min(currentRect.Width(), m_maxRect.Width() ); + currentRect.bottom = std::min(currentRect.Height(), m_maxRect.Height() ); + } + + int dpi = GetWindowDpi(m_parent); + double scale = static_cast(dpi) / static_cast(m_initDpi); + + // Allocates memory for the multiple-window-position structure. + HDWP hdwp = ::BeginDeferWindowPos(static_cast(m_resizeData.size())); + + for (const ResizeData& rd : m_resizeData) + { + int left = 0; + int top = 0; + int width = 0; + int height = 0; + + CRect childRect = rd.childRect; + ScaleRect(childRect, scale); + + // Calculate the new size and position of the child window. + switch(rd.corner ) + { + case topleft: // Positions top left. + width = rd.isFixedWidth? childRect.Width() : childRect.Width() - + m_initRect.Width() + currentRect.Width(); + height = rd.isFixedHeight? childRect.Height() : childRect.Height() - + m_initRect.Height() + currentRect.Height(); + left = childRect.left; + top = childRect.top; + break; + case topright: // Positions top right. + width = rd.isFixedWidth? childRect.Width() : childRect.Width() - + m_initRect.Width() + currentRect.Width(); + height = rd.isFixedHeight? childRect.Height() : childRect.Height() - + m_initRect.Height() + currentRect.Height(); + left = childRect.right - width - m_initRect.Width() + currentRect.Width(); + top = childRect.top; + break; + case bottomleft: // Positions bottom left. + width = rd.isFixedWidth? childRect.Width() : childRect.Width() - + m_initRect.Width() + currentRect.Width(); + height = rd.isFixedHeight? childRect.Height() : childRect.Height() - + m_initRect.Height() + currentRect.Height(); + left = childRect.left; + top = childRect.bottom - height - m_initRect.Height() + currentRect.Height(); + break; + case bottomright: // Positions bottom right. + width = rd.isFixedWidth? childRect.Width() : childRect.Width() - + m_initRect.Width() + currentRect.Width(); + height = rd.isFixedHeight? childRect.Height() : childRect.Height() - + m_initRect.Height() + currentRect.Height(); + left = childRect.right - width - m_initRect.Width() + currentRect.Width(); + top = childRect.bottom - height - m_initRect.Height() + currentRect.Height(); + break; + case center: // Positions proportionally. + width = rd.isFixedWidth ? childRect.Width() : (childRect.Width() * + currentRect.Width()) / m_initRect.Width(); + height = rd.isFixedHeight ? childRect.Height() : (childRect.Height() * + currentRect.Height()) / m_initRect.Height(); + left = (childRect.left * currentRect.Width()) / m_initRect.Width(); + top = (childRect.top * currentRect.Height()) / m_initRect.Height(); + break; + case leftcenter: // Positions proportionally along the left side. + width = rd.isFixedWidth ? childRect.Width() : childRect.Width() - + m_initRect.Width() + currentRect.Width(); + height = rd.isFixedHeight ? childRect.Height() : (childRect.Height() * + currentRect.Height()) / m_initRect.Height(); + left = childRect.left; + top = (childRect.top * currentRect.Height()) / m_initRect.Height(); + break; + case rightcenter: // Positions proportionally along the right side. + width = rd.isFixedWidth ? childRect.Width() : childRect.Width() - + m_initRect.Width() + currentRect.Width(); + height = rd.isFixedHeight ? childRect.Height() : (childRect.Height() * + currentRect.Height()) / m_initRect.Height(); + left = childRect.right - width - m_initRect.Width() + currentRect.Width(); + top = (childRect.top * currentRect.Height()) / m_initRect.Height(); + break; + case topcenter: // Positions proportionally along the top side. + width = rd.isFixedWidth ? childRect.Width() : (childRect.Width() * + currentRect.Width()) / m_initRect.Width(); + height = rd.isFixedHeight ? childRect.Height() : childRect.Height() - + m_initRect.Height() + currentRect.Height(); + left = (childRect.left * currentRect.Width()) / m_initRect.Width(); + top = childRect.top; + break; + case bottomcenter: // Positions proportionally along the bottom side. + width = rd.isFixedWidth ? childRect.Width() : (childRect.Width() * + currentRect.Width()) / m_initRect.Width(); + height = rd.isFixedHeight ? childRect.Height() : childRect.Height() - + m_initRect.Height() + currentRect.Height(); + left = (childRect.left * currentRect.Width()) / m_initRect.Width(); + top = childRect.bottom - height - m_initRect.Height() + currentRect.Height(); + break; + } + + // Determine the position of the child window. + CRect rc(left - m_xScrollPos, top - m_yScrollPos, left + width - m_xScrollPos, + top + height - m_yScrollPos); + + // Note: The tab order of the dialog's controls is determined by the order + // they are specified in the resource script (resource.rc). + + // Store the window's new position. Repositioning happens later. + hdwp = ::DeferWindowPos(hdwp, rd.wnd, HWND_TOP, rc.left, rc.top, + rc.Width(), rc.Height(), SWP_NOZORDER|SWP_NOCOPYBITS); + } + + // Reposition all the child windows simultaneously. + VERIFY(::EndDeferWindowPos(hdwp)); + } + + inline void CResizer::ScaleRect(CRect& rc, double scale) + { + rc.left = static_cast(rc.left * scale); + rc.top = static_cast(rc.top * scale); + rc.right = static_cast(rc.right * scale); + rc.bottom = static_cast(rc.bottom * scale); + } + +} // namespace Win32xx + + +#endif // _WIN32XX_DIALOG_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_dockframe.h b/packages/media/cpp/packages/Win32xx/include/wxx_dockframe.h new file mode 100644 index 00000000..8d407f32 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_dockframe.h @@ -0,0 +1,265 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +//////////////////////////////////////////////// +// wxx_dockframe.h +// Declaration of CDockFrame and CMDIDockFrame. + + +#ifndef _WIN32XX_DOCKFRAME_H_ +#define _WIN32XX_DOCKFRAME_H_ + + +#include "wxx_docking.h" +#include "wxx_frame.h" +#include "wxx_mdi.h" + + +/////////////////////////////////////////////////////////////////////////////// +// The CDockFrame class adds support for docking to a Single Document Interface +// (SDI) frame. CDockFrame inherits from CFrameT. CDockFrame has access +// to the public and protected functions defined by CFrameT and CDocker, as well +// as those defined by CWnd. +// +// The CMDIDockFrame class adds support for docking to a Multiple Document +// Interface (MDI) frame. CMDIDockFrame inherits from CMDIFrameT. +// CMDIDockFrame has access to the public and protected functions defined by +// CMDIFrameT, CFrameT, CDocker and CWnd. +// +// Refer to the documentation for CMDIFrameT, CFrameT, CDocker, and CWnd for a +// description of the functions available. +/////////////////////////////////////////////////////////////////////////////// + + +namespace Win32xx +{ + + ///////////////////////////////////////////////////////////////// + // Provides a Single Document Interface (SDI) frame with docking. + class CDockFrame : public CFrameT + { + public: + CDockFrame() : m_isDpiChanging(false) {} + virtual ~CDockFrame() override = default; + + protected: + virtual LRESULT OnActivate(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual void OnDestroy() override; + virtual LRESULT OnDockActivated(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual LRESULT OnDockDestroyed(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual LRESULT OnDpiChanged(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual LRESULT OnGetDpiScaledSize(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual LRESULT OnMouseActivate(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual LRESULT OnNotify(WPARAM wparam, LPARAM lparam) override; + virtual LRESULT OnSysColorChange(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual void RecalcViewLayout() override; + virtual LRESULT WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) override; + + private: + CDockFrame(const CDockFrame&) = delete; + CDockFrame& operator=(const CDockFrame&) = delete; + bool m_isDpiChanging; + }; + + + ///////////////////////////////////////////////////////////////// + // Provides a frame that supports the Multiple Document Interface + // (MDI) and docking. It also manages the creation and position + // of child windows, such as the menubar, toolbar, and statusbar. + class CMDIDockFrame : public CMDIFrameT + { + public: + CMDIDockFrame(); + virtual ~CMDIDockFrame() override = default; + + protected: + virtual int OnCreate(CREATESTRUCT& cs) override; + + private: + CMDIDockFrame(const CMDIDockFrame&) = delete; + CMDIDockFrame& operator=(const CMDIDockFrame&) = delete; + + CMDIClient m_dockMDIClient; // Both a DockClient and MDIClient + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + //////////////////////////////////////// + // Definitions for the CDockFrame class. + // + + // Called when the frame window is activated. + inline LRESULT CDockFrame::OnActivate(UINT msg, WPARAM wparam, LPARAM lparam) + { + CDocker::OnActivate(msg, wparam, lparam); + return CFrameT::OnActivate(msg, wparam, lparam); + } + + // Called when the frame window is created. + inline int CDockFrame::OnCreate(CREATESTRUCT& cs) + { + GetDockClient().Create(GetHwnd()); + GetView().Create(GetDockClient()); + + // Set the caption height based on text height. + SetDefaultCaptionHeight(); + return CFrameT::OnCreate(cs); + } + + // Called when the frame window is destroyed. + inline void CDockFrame::OnDestroy() + { + CDocker::OnDestroy(); + CFrameT::OnDestroy(); + } + + // Called when a docker is activated. + inline LRESULT CDockFrame::OnDockActivated(UINT msg, WPARAM wparam, LPARAM lparam) + { + return CDocker::OnDockActivated(msg, wparam, lparam); + } + + // Called when a docker is destroyed. + inline LRESULT CDockFrame::OnDockDestroyed(UINT msg, WPARAM wparam, LPARAM lparam) + { + return CDocker::OnDockDestroyed(msg, wparam, lparam); + } + + // Called when the effective dots per inch (dpi) for a window has changed. + // This occurs when: + // - The window is moved to a new monitor that has a different DPI. + // - The DPI of the monitor displaying the window changes. + inline LRESULT CDockFrame::OnDpiChanged(UINT msg, WPARAM wparam, LPARAM lparam) + { + CFrameT::OnDpiChanged(msg, wparam, lparam); + SetDefaultCaptionHeight(); + DpiUpdateDockerSizes(); + m_isDpiChanging = false; + + return 0; + } + + // Called when the DPI is about to change. + inline LRESULT CDockFrame::OnGetDpiScaledSize(UINT, WPARAM, LPARAM) + { + m_isDpiChanging = true; + return 0; + } + + // Called when the cursor is in an inactive window and the user presses a mouse button. + inline LRESULT CDockFrame::OnMouseActivate(UINT msg, WPARAM wparam, LPARAM lparam) + { + return CDocker::OnMouseActivate(msg, wparam, lparam); + } + + // Called when a notification from a child window (WM_NOTIFY) is received. + inline LRESULT CDockFrame::OnNotify(WPARAM wparam, LPARAM lparam) + { + LRESULT result = CFrameT::OnNotify(wparam, lparam); + if (result == 0) + result = CDocker::OnNotify(wparam, lparam); + + return result; + } + + // Called when the system colors are changed. + inline LRESULT CDockFrame::OnSysColorChange(UINT msg, WPARAM wparam, LPARAM lparam) + { + CDocker::OnSysColorChange(msg, wparam, lparam); + return CFrameT::OnSysColorChange(msg, wparam, lparam); + } + + // Repositions the view window + inline void CDockFrame::RecalcViewLayout() + { + // Skip RecalcDockLayout during DPI changes. + if (!m_isDpiChanging) + RecalcDockLayout(); + } + + // Process the frame's window messages. + inline LRESULT CDockFrame::WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) + { + switch (msg) + { + case WM_ACTIVATE: return OnActivate(msg, wparam, lparam); + case WM_GETDPISCALEDSIZE: return OnGetDpiScaledSize(msg, wparam, lparam); + case WM_DPICHANGED: return OnDpiChanged(msg, wparam, lparam); + case WM_MOUSEACTIVATE: return OnMouseActivate(msg, wparam, lparam); + case WM_SIZE: return OnSize(msg, wparam, lparam); + case WM_SYSCOLORCHANGE: return OnSysColorChange(msg, wparam, lparam); + + // Messages defined by Win32++ + case UWM_DOCKACTIVATE: return OnDockActivated(msg, wparam, lparam); + case UWM_DOCKDESTROYED: return OnDockDestroyed(msg, wparam, lparam); + case UWM_GETCDOCKER: return reinterpret_cast(this); + } + + return CFrameT::WndProcDefault(msg, wparam, lparam); + } + + /////////////////////////////////////////// + // Definitions for the CMDIDockFrame class. + // + + // Constructor. + inline CMDIDockFrame::CMDIDockFrame() + { + // Assign m_dockMDIClient as this MDI frame's MDI client. + SetMDIClient(m_dockMDIClient); + + // Assign m_dockMDIClient as this docker's dock client. + SetDockClient(m_dockMDIClient); + } + + // Called when the frame window is created. + inline int CMDIDockFrame::OnCreate(CREATESTRUCT& cs) + { + return CFrameT::OnCreate(cs); + } + + +} // namespace Win32xx + +#endif // _WIN32XX_DOCKFRAME_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_docking.h b/packages/media/cpp/packages/Win32xx/include/wxx_docking.h new file mode 100644 index 00000000..1b78493f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_docking.h @@ -0,0 +1,5586 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +// Acknowledgements: +// ================ +// A special thanks to James Brown and Jeff Glatt for publishing tutorials +// on docking and making these freely available. This code uses some of the +// ideas presented in those tutorials. +// +// Catch22 Docking Tutorials by James Brown: +// http://www.catch22.net/tuts +// +// Docking Toolbars in Plain C by Jeff Glatt +// http://www.codeproject.com/Articles/10224/Docking-Toolbars-in-Plain-C + + +/////////////////////////////////////////////////////// +// wxx_docking.h +// Declaration of the CDocker class + +#ifndef _WIN32XX_DOCKING_H_ +#define _WIN32XX_DOCKING_H_ + + +#include "wxx_wincore.h" +#include "wxx_toolbar.h" +#include "wxx_tab.h" +#include "wxx_regkey.h" +#include "wxx_themes.h" +#include "default_resource.h" +#include +#include + + +namespace Win32xx +{ + // Docking Styles + const int DS_DOCKED_LEFT = 0x00001; // Dock the child left + const int DS_DOCKED_RIGHT = 0x00002; // Dock the child right + const int DS_DOCKED_TOP = 0x00004; // Dock the child top + const int DS_DOCKED_BOTTOM = 0x00008; // Dock the child bottom + const int DS_NO_DOCKCHILD_LEFT = 0x00010; // Prevent a child docking left + const int DS_NO_DOCKCHILD_RIGHT = 0x00020; // Prevent a child docking right + const int DS_NO_DOCKCHILD_TOP = 0x00040; // Prevent a child docking at the top + const int DS_NO_DOCKCHILD_BOTTOM = 0x00080; // Prevent a child docking at the bottom + const int DS_NO_RESIZE = 0x00100; // Prevent resizing + const int DS_NO_CAPTION = 0x00200; // Prevent display of caption when docked + const int DS_NO_CLOSE = 0x00400; // Prevent closing of a docker while docked + const int DS_NO_UNDOCK = 0x00800; // Prevent manual undocking of a docker + const int DS_CLIENTEDGE = 0x01000; // Has a 3D border when docked + const int DS_DOCKED_CONTAINER = 0x04000; // Dock a container within a container + const int DS_DOCKED_LEFTMOST = 0x10000; // Leftmost outer docking + const int DS_DOCKED_RIGHTMOST = 0x20000; // Rightmost outer docking + const int DS_DOCKED_TOPMOST = 0x40000; // Topmost outer docking + const int DS_DOCKED_BOTTOMMOST = 0x80000; // Bottommost outer docking + + // Class declarations + class CDockContainer; + class CDocker; + + struct ContainerInfo + { + CString tabText; + int tabImage; + CDockContainer* pContainer; + ContainerInfo() : tabImage(0), pContainer(0) {} + }; + + ////////////////////////////////////////////////////////////////////// + // A container (CDockContainer) is a specialized CTab window and + // also the view of a docker (CDocker). Each container tab displays + // a view window, and can display an optional toolbar. A container + // can contain other containers. + // + // Each container is the view window for a docker. Containers support + // container-in-container docking. When containers are docked within + // each other, one container becomes the container parent. The container + // parent provides a tab for the view window for each of the containers + // docked within it. The view for each container along with possibly + // its toolbar, is contained within the container parent's view page. + // + // When a container is docked within another container, it is hidden, + // along with its parent docker window. The container parent becomes + // the parent window for the view windows of these child containers. + // GetContainerParent returns a pointer to the container parent. + // + // When a container docked within another container is undocked, the + // undocked container window and its parent docker window become visible. + // The container also resumes being the parent window of its view + // window. + class CDockContainer : public CTab + { + public: + + // Nested class. This is the Wnd for the window displayed over the client area + // of the tab control. The toolbar and view window are child windows of the + // viewpage window. Only the ViewPage of the parent CDockContainer is displayed. + // Its contents are updated with the view window of the active container + // whenever a different tab is selected. + class CViewPage : public CWnd + { + public: + CViewPage(); + virtual ~CViewPage() override = default; + + CDockContainer* GetContainer() const; + CWnd* GetTabCtrl() const { return m_pTab; } + CToolBar& GetToolBar() const { return *m_pToolBar; } + CWnd* GetView() const { return m_pView; } + void SetContainer(CDockContainer* pContainer) { m_pContainer = pContainer; } + void SetToolBar(CToolBar& toolBar) { m_pToolBar = &toolBar; } + void SetView(CWnd& wndView); + void RecalcLayout() const; + + protected: + virtual BOOL OnCommand(WPARAM wparam, LPARAM lparam) override; + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual LRESULT OnNotify(WPARAM wparam, LPARAM lparam) override; + virtual void PreRegisterClass(WNDCLASS& wc) override; + LRESULT WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) override; + + private: + CViewPage(const CViewPage&) = delete; + CViewPage& operator=(const CViewPage&) = delete; + + CToolBar m_toolBar; + CToolBar* m_pToolBar; + CDockContainer* m_pContainer; + CString m_tooltip; + CWnd* m_pView; + CWnd* m_pTab; + }; + + public: + CDockContainer(); + virtual ~CDockContainer() override = default; + + virtual void AddContainer(CDockContainer* pContainer, + BOOL insert = FALSE, BOOL selectPage = TRUE); + virtual void AddToolBarButton(UINT id, BOOL isEnabled = TRUE); + virtual void CreateToolBar(); + virtual void DrawTabs(CDC& dc) override; + virtual void RecalcLayout() override; + virtual void RemoveContainer(CDockContainer* pWnd, BOOL updateParent = TRUE); + virtual void SelectPage(int page) override; + virtual void SwapTabs(int tab1, int tab2) override; + virtual void SetTabsFontSize(int fontSize = 9) override; + virtual void SetTabsIconSize(int iconSize = 16) override; + virtual void UpdateTabs() override; + + // Accessors and mutators + CDockContainer* GetActiveContainer() const; + CWnd* GetActiveView() const; + const std::vector& GetAllContainers() const; + CDockContainer* GetContainerParent() const { return m_pContainerParent; } + CDockContainer* GetContainerFromIndex(size_t index) const; + CDockContainer* GetContainerFromView(CWnd* pView) const; + int GetContainerIndex(CDockContainer* pContainer) const; + const CString& GetDockCaption() const { return m_caption; } + CDocker* GetDocker() const { return m_pDocker; } + SIZE GetMaxTabTextSize() const; + HICON GetTabIcon() const { return m_tabIcon; } + const CString& GetTabText() const { return m_tabText; } + CToolBar& GetToolBar() const { return GetViewPage().GetToolBar(); } + std::vector& GetToolBarData() { return m_toolBarData; } + CWnd* GetView() const { return GetViewPage().GetView(); } + CViewPage& GetViewPage() const { return *m_pViewPage; } + void SetActiveContainer(CDockContainer* pContainer); + void SetDocker(CDocker* pDocker) { m_pDocker = pDocker; } + void SetDockCaption(LPCTSTR caption); + void SetHideSingleTab(BOOL hideSingle); + void SetTabIcon(HICON tabIcon); + void SetTabIcon(UINT iconID); + void SetTabSize() override; + void SetTabText(LPCTSTR text); + void SetToolBar(CToolBar& toolBar) const { GetViewPage().SetToolBar(toolBar); } + void SetToolBarImages(COLORREF mask, UINT normalID, UINT hotID, UINT disabledID); + void SetView(CWnd& wnd) const; + + protected: + virtual void OnAttach() override; + virtual LRESULT OnLButtonDown(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual LRESULT OnLButtonUp(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual LRESULT OnMouseLeave(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual LRESULT OnMouseMove(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual LRESULT OnNotifyReflect(WPARAM wparam, LPARAM lparam) override; + virtual LRESULT OnSetFocus(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual LRESULT OnSize(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnTCNSelChange(LPNMHDR pNMHDR) override; + virtual LRESULT OnDpiChangedBeforeParent(UINT, WPARAM, LPARAM); + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual void SetTBImageList(CToolBar& toolBar, UINT id, COLORREF mask); + virtual void SetTBImageListDis(CToolBar& toolBar, UINT id, COLORREF mask); + virtual void SetTBImageListHot(CToolBar& toolBar, UINT id, COLORREF mask); + virtual void SetupToolBar(); + + LRESULT WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) override; + + private: + CDockContainer(const CDockContainer&) = delete; + CDockContainer& operator=(const CDockContainer&) = delete; + + int GetDockTabImageID(int tab) const; + CString GetDockTabText(int tab) const; + CSize GetTBImageSize(CBitmap* pBitmap) const; + + std::vector& GetAll() const {return m_pContainerParent->m_allInfo;} + std::vector m_allInfo; // vector of ContainerInfo structs + std::vector m_toolBarData; // vector of resource IDs for ToolBar buttons + CString m_tabText; + CString m_caption; + + CViewPage m_viewPage; + CViewPage* m_pViewPage; + int m_currentPage; + CDocker* m_pDocker; + CDockContainer* m_pContainerParent; + HICON m_tabIcon; + int m_pressedTab; + BOOL m_isHideSingleTab; + CPoint m_oldMousePos; + }; + + struct DragPos + { + NMHDR hdr; + POINT pos; + UINT dockZone; + CDocker* pDocker; + }; + + + /////////////////////////////////////////////////////////////////////////// + // A CDocker window allows other CDocker windows to be "docked" inside it. + // A CDocker can dock on the top, left, right or bottom side of a parent + // CDocker. + // There is no theoretical limit to the number of CDockers within CDockers. + // + // Each docker has a view window. This view window can be a dock container + // or any other child window. + // + // The docker class also provides the following windows + // * A dock client window with provides the caption for the docker. + // * A splitter bar that allows dockers to be resized. + // * Dock targets that are used to facilitate docking. + // * Dock hint windows that display a blue tint over area which will + // be covered if the docker is docked. + class CDocker : public CWnd + { + public: + + // A nested class for the splitter bar that separates the docked panes. + class CDockBar : public CWnd + { + public: + CDockBar(); + virtual ~CDockBar() override = default; + + CBrush GetBrushBkgnd() const {return m_brBackground;} + CDocker& GetDocker() const {assert (m_pDocker); return *m_pDocker;} + int GetWidth() const {return m_dockBarWidth;} + void SetColor(COLORREF color); + void SetDocker(CDocker* pDocker) {m_pDocker = pDocker;} + void SetWidth(int width) {m_dockBarWidth = width;} + + protected: + virtual void OnDraw(CDC& dc) override; + virtual LRESULT OnLButtonDown(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnLButtonUp(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnMouseMove(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnSetCursor(UINT msg, WPARAM wparam, LPARAM lparam); + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual void PreRegisterClass(WNDCLASS& wc) override; + virtual LRESULT WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) override; + + private: + CDockBar(const CDockBar&) = delete; + CDockBar& operator=(const CDockBar&) = delete; + + void SendNotify(UINT messageID); + + CDocker* m_pDocker; + DragPos m_dragPos; + CBrush m_brBackground; + int m_dockBarWidth; + }; + + // A nested class for the window inside a CDocker that includes all of + // this docked client. It's the remaining part of the CDocker that + // doesn't belong to the CDocker's children. The docker's view window + // is a child window of CDockClient. + class CDockClient : public CWnd + { + public: + CDockClient(); + virtual ~CDockClient() override = default; + + void Draw3DBorder(RECT rect); + void DrawCaption(); + void DrawCloseButton(CDC& drawDC); + CRect GetCloseRect() const; + const CString& GetCaption() const { return m_caption; } + CWnd& GetView() const { assert (m_pView); return *m_pView; } + void SetDocker(CDocker* pDocker) { m_pDocker = pDocker;} + void SetCaption(LPCTSTR caption) { m_caption = caption; } + void SetCaptionColors(COLORREF foregnd1, COLORREF backgnd1, + COLORREF foreGnd2, COLORREF backGnd2, COLORREF penColor); + void SetView(CWnd& view); + + protected: + virtual int OnCreate(CREATESTRUCT&) override; + virtual LRESULT OnLButtonDown(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnLButtonUp(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnMouseMove(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnNCCalcSize(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnNCHitTest(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnNCLButtonDown(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnNCMouseLeave(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnNCMouseMove(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnNCPaint(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnWindowPosChanged(UINT msg, WPARAM wparam, LPARAM lparam); + virtual void PreRegisterClass(WNDCLASS& wc) override; + virtual void PreCreate(CREATESTRUCT& cs) override; + LRESULT WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) override; + + private: + CDockClient(const CDockClient&) = delete; + CDockClient& operator=(const CDockClient&) = delete; + + LRESULT MouseMove(UINT msg, WPARAM wparam, LPARAM lparam); + void SendNotify(UINT messageID); + + CString m_caption; + CPoint m_oldPoint; + CDocker* m_pDocker; + CWnd* m_pView; + BOOL m_isClosePressed; + BOOL m_isCaptionPressed; + BOOL m_isTracking; + COLORREF m_foregnd1; + COLORREF m_backgnd1; + COLORREF m_foregnd2; + COLORREF m_backgnd2; + COLORREF m_penColor; + }; + + // This nested class is used to indicate where a window could dock by + // displaying a blue partially transparent window. + class CDockHint : public CWnd + { + public: + CDockHint(); + virtual ~CDockHint() override = default; + + RECT CalcHintRectContainer(CDocker* pDockTarget); + RECT CalcHintRectInner(CDocker* pDockTarget, CDocker* pDockDrag, UINT dockSide); + RECT CalcHintRectOuter(CDocker* pDockDrag, UINT dockSide); + void DisplayHint(CDocker* pDockTarget, CDocker* pDockDrag, UINT dockSide); + + protected: + virtual void PreCreate(CREATESTRUCT& cs) override; + void PreRegisterClass(WNDCLASS& wc) override; + + private: + CDockHint(const CDockHint&) = delete; + CDockHint& operator=(const CDockHint&) = delete; + + CBrush m_brush; + }; + + // This nested class is the base class for drawing dock targets. + class CTarget : public CWnd + { + public: + CTarget() = default; + virtual ~CTarget() override = default; + + protected: + virtual void OnDraw(CDC& dc) override; + virtual void PreCreate(CREATESTRUCT& cs) override; + + CBitmap m_image; + + private: + CTarget(const CTarget&) = delete; + CTarget& operator=(const CTarget&) = delete; + + }; + + // This nested class draws the a set of dock targets at the centre of + // the docker. The dock within docker target is only enabled for a + // dock container. + class CTargetCentre : public CTarget + { + public: + CTargetCentre(); + virtual ~CTargetCentre() override = default; + + BOOL CheckTarget(DragPos* pDragPos); + BOOL IsOverContainer() const { return m_isOverContainer; } + + protected: + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual void OnDraw(CDC& dc) override; + + private: + CTargetCentre(const CTargetCentre&) = delete; + CTargetCentre& operator=(const CTargetCentre&) = delete; + + BOOL m_isOverContainer; + CDocker* m_pOldDockTarget; + }; + + // This nested class is draws the left dock target. + class CTargetLeft : public CTarget + { + public: + CTargetLeft(); + virtual ~CTargetLeft() override = default; + BOOL CheckTarget(DragPos* pDragPos); + + private: + CTargetLeft(const CTargetLeft&) = delete; + CTargetLeft& operator=(const CTargetLeft&) = delete; + }; + + // This nested class is draws the top dock target. + class CTargetTop : public CTarget + { + public: + CTargetTop(); + virtual ~CTargetTop() override = default; + BOOL CheckTarget(DragPos* pDragPos); + + private: + CTargetTop(const CTargetTop&) = delete; + CTargetTop& operator=(const CTargetTop&) = delete; + }; + + // This nested class is draws the right dock target. + class CTargetRight : public CTarget + { + public: + CTargetRight(); + virtual ~CTargetRight() override = default; + BOOL CheckTarget(DragPos* pDragPos); + + private: + CTargetRight(const CTargetRight&) = delete; + CTargetRight& operator=(const CTargetRight&) = delete; + }; + + // This nested class is draws the bottom dock target. + class CTargetBottom : public CTarget + { + public: + CTargetBottom(); + virtual ~CTargetBottom() override = default; + BOOL CheckTarget(DragPos* pDragPos); + + private: + CTargetBottom(const CTargetBottom&) = delete; + CTargetBottom& operator=(const CTargetBottom&) = delete; + }; + + // These classes can access private members of CDocker. + friend class CTargetCentre; + friend class CTargetLeft; + friend class CTargetTop; + friend class CTargetRight; + friend class CTargetBottom; + friend class CDockClient; + friend class CDockContainer; + + public: + CDocker(); + virtual ~CDocker() = default; + + // Operations + virtual CDocker* AddDockedChild(CDocker* pDocker, DWORD dockStyle, + int dockSize, int dockID = 0); + virtual CDocker* AddDockedChild(DockPtr docker, DWORD dockStyle, + int dockSize, int dockID = 0); + virtual CDocker* AddUndockedChild(CDocker* pDocker, DWORD dockStyle, + int dockSize, RECT rc, int dockID = 0, bool isHidden = false); + virtual CDocker* AddUndockedChild(DockPtr docker, DWORD dockStyle, + int dockSize, RECT rc, int dockID = 0, bool isHidden = false); + virtual void CloseAllDockers(); + virtual void Dock(CDocker* pDocker, UINT dockSide); + virtual void DockInContainer(CDocker* pDocker, DWORD dockStyle, + BOOL selectPage = TRUE); + virtual void DpiUpdateDockerSizes(); + virtual CRect GetViewRect() const { return GetClientRect(); } + virtual void Hide(); + virtual BOOL LoadContainerRegistrySettings(LPCTSTR registryKeyName); + virtual BOOL LoadDockRegistrySettings(LPCTSTR registryKeyName); + virtual void RecalcDockChildLayout(CRect& rc); + virtual void RecalcDockLayout(); + virtual BOOL SaveDockRegistrySettings(LPCTSTR registryKeyName); + virtual void SaveContainerRegistrySettings(CRegKey& dockKey, + CDockContainer* pContainer, UINT& container); + virtual void Undock(CPoint pt, BOOL showUndocked = TRUE); + virtual void UndockContainer(CDockContainer* pContainer, CPoint pt, + BOOL showUndocked); + virtual void UndockContainerGroup(); + virtual BOOL VerifyDockers(); + + // Accessors and mutators + const std::deque& GetAllDockChildren() const {return GetDockAncestor()->m_allDockChildren;} + const std::deque& GetDockChildren() const {return m_dockChildren;} + const std::deque& GetAllDockers() const {return m_allDockers;} + + CDocker* GetActiveDocker() const; + CWnd* GetActiveView() const; + int GetBarWidth() const {return DpiScaleInt(GetDockBar().GetWidth());} + const CString& GetCaption() const {return GetDockClient().GetCaption();} + CDockContainer* GetContainer() const; + CDocker* GetDockAncestor() const; + CDockBar& GetDockBar() const { return *m_pDockBar; } + CDockClient& GetDockClient() const { return *m_pDockClient; } + CDockHint& GetDockHint() const { return *m_pDockAncestor->m_pDockHint; } + int GetDockID() const {return m_dockID;} + CDocker* GetDockParent() const {return m_pDockParent;} + CDocker* GetDockFromID(int dockID) const; + CDocker* GetDockFromView(CWnd* pView) const; + int GetDockSize() const; + DWORD GetDockStyle() const {return m_dockStyle;} + CTabbedMDI* GetTabbedMDI() const; + int GetTextHeight(); + CDocker* GetTopmostDocker() const; + CWnd& GetView() const { return GetDockClient().GetView(); } + BOOL IsChildOfDocker(HWND wnd) const; + BOOL IsDocked() const; + BOOL IsRelated(HWND wnd) const; + BOOL IsUndocked() const; + BOOL IsUndockable() const; + void SetBarColor(COLORREF color) const {GetDockBar().SetColor(color);} + void SetBarWidth(int width) const {GetDockBar().SetWidth(width);} + void SetCaption(LPCTSTR caption); + void SetCaptionColors(COLORREF foregnd1, COLORREF backgnd1, COLORREF foreGnd2, + COLORREF backGnd2, COLORREF penColor = RGB(160, 150, 140)) const; + void SetCaptionHeight(int height); + void SetDefaultCaptionHeight(); + void SetDockBar(CDockBar& dockBar) { m_pDockBar = &dockBar; } + void SetDockClient(CDockClient& dockClient); + void SetDockHint(CDockHint& dockHint) { m_pDockHint = &dockHint; } + void SetDockStyle(DWORD dockStyle); + void SetDockSize(int dockSize); + void SetView(CWnd& view); + + protected: + virtual DockPtr NewDockerFromID(int dockID); + virtual void OnClose() override; + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual void OnDestroy() override; + virtual LRESULT OnBarEnd(DragPos* pDragPos); + virtual LRESULT OnBarMove(DragPos* pDragPos); + virtual LRESULT OnBarStart(DragPos* pDragPos); + virtual LRESULT OnDockEnd(DragPos* pDragPos); + virtual LRESULT OnDockMove(DragPos* pDragPos); + virtual LRESULT OnDockStart(DragPos* pDragPos); + virtual LRESULT OnNotify(WPARAM wparam, LPARAM lparam) override; + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual void PreRegisterClass(WNDCLASS& wc) override; + + // Not intended to be overwritten + LRESULT WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) override; + + // Message handlers + virtual LRESULT OnActivate(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnDockActivated(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnDockDestroyed(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnDpiChanged(UINT, WPARAM, LPARAM); + virtual LRESULT OnDpiChangedBeforeParent(UINT, WPARAM, LPARAM); + virtual LRESULT OnExitSizeMove(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnGetDpiScaledSize(UINT, WPARAM, LPARAM); + virtual LRESULT OnMouseActivate(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnNCLButtonDblClk(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnSettingChange(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnSize(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnSysColorChange(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnSysCommand(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnWindowPosChanged(UINT msg, WPARAM wparam, LPARAM lparam); + + private: + CDocker(const CDocker&) = delete; + CDocker& operator=(const CDocker&) = delete; + std::deque & GetAllChildren() const {return GetDockAncestor()->m_allDockChildren;} + virtual CDocker* GetDockUnderDragPoint(POINT pt); + void CheckAllTargets(DragPos* pDragPos) const; + void CloseAllTargets() const; + void DockOuter(CDocker* pDocker, DWORD dockStyle); + void DrawAllCaptions() const; + void ConvertToChild(HWND parent) const; + void ConvertToPopup(RECT rc, BOOL showUndocked); + int GetMonitorDpi(HWND wnd); + void MoveDockChildren(CDocker* pDockTarget); + void PromoteFirstChild(); + void ResizeDockers(DragPos* pDragPos); + CDocker* SeparateFromDock(); + void SendNotify(UINT messageID); + void SetUndockPosition(CPoint pt, BOOL showUndocked); + std::vector SortDockers(); + static BOOL CALLBACK EnumWindowsProc(HWND top, LPARAM lparam); + + CDockBar m_dockBar; + CDockBar* m_pDockBar; + CDockClient m_dockClient; + CDockClient* m_pDockClient; + CDockHint m_dockHint; + CDockHint* m_pDockHint; + + CTargetCentre m_targetCentre; + CTargetLeft m_targetLeft; + CTargetTop m_targetTop; + CTargetRight m_targetRight; + CPoint m_oldPoint; + CTargetBottom m_targetBottom; + CDocker* m_pDockParent; + CDocker* m_pDockAncestor; + + std::deque m_dockChildren; // Docker's immediate children + std::deque m_allDockChildren; // All descendants of the DockAncestor (only used by the DockAncestor) + std::deque m_allDockers; // DockAncestor + all descendants (only used by the DockAncestor) + + CRect m_barRect; + CRect m_childRect; + BOOL m_isUndocking; + BOOL m_isClosing; + BOOL m_isDragging; + int m_dockStartSize; + int m_dockID; + int m_ncHeight; + int m_newDpi; + int m_oldDpi; + DWORD m_dockZone; + DWORD m_dockStyle; + HWND m_dockUnderPoint; + CPoint m_dockPoint; + + }; // class CDocker + + struct DockInfo + { + DWORD dockStyle; + int dockSize; + int dockID; + int dockParentID; + bool isInAncestor; + bool isHidden; + RECT rect; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + //////////////////////////////////////////////////////////// + // Definitions for the CDockBar class nested within CDocker. + // + inline CDocker::CDockBar::CDockBar() : m_pDocker(nullptr), m_dockBarWidth(4) + { + m_dragPos = {}; + } + + inline void CDocker::CDockBar::OnDraw(CDC& dc) + { + CRect rcClient = GetClientRect(); + dc.SelectObject(m_brBackground); + dc.PatBlt(0, 0, rcClient.Width(), rcClient.Height(), PATCOPY); + } + + inline LRESULT CDocker::CDockBar::OnLButtonDown(UINT msg, WPARAM wparam, LPARAM lparam) + { + if (!(m_pDocker->GetDockStyle() & DS_NO_RESIZE)) + { + SendNotify(UWN_BARSTART); + SetCapture(); + } + + return FinalWindowProc(msg, wparam, lparam); + } + + inline LRESULT CDocker::CDockBar::OnLButtonUp(UINT msg, WPARAM wparam, LPARAM lparam) + { + if (!(m_pDocker->GetDockStyle() & DS_NO_RESIZE) && (GetCapture() == *this)) + { + SendNotify(UWN_BAREND); + ReleaseCapture(); + } + + return FinalWindowProc(msg, wparam, lparam); + } + + inline LRESULT CDocker::CDockBar::OnMouseMove(UINT msg, WPARAM wparam, LPARAM lparam) + { + if (!(m_pDocker->GetDockStyle() & DS_NO_RESIZE) && (GetCapture() == *this)) + { + SendNotify(UWN_BARMOVE); + } + + return FinalWindowProc(msg, wparam, lparam); + } + + inline LRESULT CDocker::CDockBar::OnSetCursor(UINT msg, WPARAM wparam, LPARAM lparam) + { + if (!(m_pDocker->GetDockStyle() & DS_NO_RESIZE)) + { + HCURSOR cursor; + DWORD side = GetDocker().GetDockStyle() & 0xF; + if ((side == DS_DOCKED_LEFT) || (side == DS_DOCKED_RIGHT)) + cursor = GetApp()->LoadCursor(IDW_SPLITH); + else + cursor = GetApp()->LoadCursor(IDW_SPLITV); + + if (cursor) SetCursor(cursor); + else TRACE("\n*** WARNING Missing cursor resource for slider bar. ***\n"); + + return TRUE; + } + else + SetCursor(LoadCursor(nullptr, IDC_ARROW)); + + return FinalWindowProc(msg, wparam, lparam); + } + + inline void CDocker::CDockBar::PreCreate(CREATESTRUCT& cs) + { + // Create a child window, initially hidden. + cs.style = WS_CHILD; + } + + inline void CDocker::CDockBar::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = _T("Win32++ Bar"); + wc.hbrBackground = m_brBackground; + } + + inline void CDocker::CDockBar::SendNotify(UINT messageID) + { + // Send a splitter bar notification to the parent. + m_dragPos.hdr.code = messageID; + m_dragPos.hdr.hwndFrom = GetHwnd(); + m_dragPos.pos = GetCursorPos(); + if (GetDocker().GetDockStyle() & DS_CLIENTEDGE) + m_dragPos.pos.x += 1; + + m_dragPos.pDocker = m_pDocker; + LPARAM lparam = reinterpret_cast(&m_dragPos); + GetParent().SendMessage(WM_NOTIFY, 0, lparam); + } + + inline void CDocker::CDockBar::SetColor(COLORREF color) + { + // Useful colors: + // GetSysColor(COLOR_BTNFACE) // Default Gray + // RGB(196, 215, 250) // Default Blue + + m_brBackground.CreateSolidBrush(color); + } + + inline LRESULT CDocker::CDockBar::WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) + { + switch (msg) + { + case WM_SETCURSOR: return OnSetCursor(msg, wparam, lparam); + case WM_ERASEBKGND: return 0; + case WM_LBUTTONDOWN: return OnLButtonDown(msg, wparam, lparam); + case WM_LBUTTONUP: return OnLButtonUp(msg, wparam, lparam); + case WM_MOUSEMOVE: return OnMouseMove(msg, wparam, lparam); + } + + // Pass unhandled messages on for default processing. + return CWnd::WndProcDefault(msg, wparam, lparam); + } + + + /////////////////////////////////////////////////////////////// + // Definitions for the CDockClient class nested within CDocker. + // + inline CDocker::CDockClient::CDockClient() : m_pDocker(nullptr), m_pView(nullptr), + m_isClosePressed(FALSE), m_isCaptionPressed(FALSE), m_isTracking(FALSE) + { + m_foregnd1 = RGB(32,32,32); + m_backgnd1 = RGB(190,207,227); + m_foregnd2 = GetSysColor(COLOR_BTNTEXT); + m_backgnd2 = GetSysColor(COLOR_BTNFACE); + m_penColor = RGB(160, 150, 140); + } + + inline void CDocker::CDockClient::Draw3DBorder(RECT rect) + { + // Imitates the drawing of the WS_EX_CLIENTEDGE extended style. + // This draws a 2 pixel border around the specified RECT. + CWindowDC dc(*this); + CRect rcw = rect; + dc.CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW)); + dc.MoveTo(0, rcw.Height()); + dc.LineTo(0, 0); + dc.LineTo(rcw.Width(), 0); + dc.CreatePen(PS_SOLID,1, GetSysColor(COLOR_3DDKSHADOW)); + dc.MoveTo(1, rcw.Height()-2); + dc.LineTo(1, 1); + dc.LineTo(rcw.Width()-2, 1); + dc.CreatePen(PS_SOLID,1, GetSysColor(COLOR_3DHILIGHT)); + dc.MoveTo(rcw.Width()-1, 0); + dc.LineTo(rcw.Width()-1, rcw.Height()-1); + dc.LineTo(0, rcw.Height()-1); + dc.CreatePen(PS_SOLID,1, GetSysColor(COLOR_3DLIGHT)); + dc.MoveTo(rcw.Width()-2, 1); + dc.LineTo(rcw.Width()-2, rcw.Height()-2); + dc.LineTo(1, rcw.Height()-2); + } + + inline void CDocker::CDockClient::DrawCaption() + { + assert(m_pDocker); + if (!(m_pDocker->GetDockStyle() & DS_NO_CAPTION)) + { + if (m_pDocker->IsWindow() && m_pDocker->IsUndockable()) + { + // Acquire the DC for our NonClient painting. + CWindowDC dc(*this); + + // Create and set up our memory DC. + CRect rc = GetWindowRect(); + CMemDC memDC(dc); + int rcAdjust = (GetExStyle() & WS_EX_CLIENTEDGE) ? 2 : 0; + int width = std::max(rc.Width() - rcAdjust, 0); + + int height = m_pDocker->m_ncHeight + rcAdjust; + memDC.CreateCompatibleBitmap(dc, width, height); + + // Set the font for the title. + int dpi = GetWindowDpi(*this); + NONCLIENTMETRICS info = GetNonClientMetrics(); + LOGFONT lf = info.lfStatusFont; + lf.lfHeight = -MulDiv(9, dpi, POINTS_PER_INCH); + memDC.CreateFontIndirect(lf); + + // Set the Colors. + if (m_pDocker->GetActiveDocker() == m_pDocker) + { + memDC.SetTextColor(m_foregnd1); + memDC.CreateSolidBrush(m_backgnd1); + memDC.SetBkColor(m_backgnd1); + } + else + { + memDC.SetTextColor(m_foregnd2); + memDC.CreateSolidBrush(m_backgnd2); + memDC.SetBkColor(m_backgnd2); + } + + // Draw the rectangle. + memDC.CreatePen(PS_SOLID, 1, m_penColor); + memDC.Rectangle(rcAdjust, rcAdjust, rc.Width() - rcAdjust, m_pDocker->m_ncHeight + rcAdjust); + + // Display the caption. + int cxSmallIcon = ::GetSystemMetrics(SM_CXSMICON) * GetWindowDpi(*this) / GetWindowDpi(HWND_DESKTOP); + int cx = (m_pDocker->GetDockStyle() & DS_NO_CLOSE) ? 0 : cxSmallIcon; + CRect rcText(4 + rcAdjust, rcAdjust, rc.Width() - 4 - cx - rcAdjust, m_pDocker->m_ncHeight + rcAdjust); + memDC.DrawText(m_caption, m_caption.GetLength(), rcText, DT_LEFT | DT_VCENTER | + DT_SINGLELINE | DT_END_ELLIPSIS | DT_NOPREFIX); + + // Draw the close button. + if (!(m_pDocker->GetDockStyle() & DS_NO_CLOSE)) + DrawCloseButton(memDC); + + // Draw the 3D border. + if (GetExStyle() & WS_EX_CLIENTEDGE) + Draw3DBorder(rc); + + // Copy the Memory DC to the window's DC. + dc.BitBlt(rcAdjust, rcAdjust, width, height, memDC, rcAdjust, rcAdjust, SRCCOPY); + } + } + } + + inline void CDocker::CDockClient::DrawCloseButton(CDC& drawDC) + { + if (m_pDocker->IsUndockable() && !(m_pDocker->GetDockStyle() & DS_NO_CAPTION)) + { + CDockContainer* pContainer = m_pDocker->GetContainer(); + if ((m_pDocker->IsDocked()) || ((m_pDocker == m_pDocker->GetDockAncestor()) && pContainer && pContainer->GetItemCount() > 0)) + { + // Determine the close button's drawing position relative to the window. + CRect rcClose = GetCloseRect(); + UINT uState = GetCloseRect().PtInRect(GetCursorPos()) ? m_isClosePressed && IsLeftButtonDown() ? 2U : 1U : 0U; + VERIFY(ScreenToClient(rcClose)); + + if (GetExStyle() & WS_EX_CLIENTEDGE) + { + rcClose.OffsetRect(2, m_pDocker->m_ncHeight + 2); + if (GetWindowRect().Height() < (m_pDocker->m_ncHeight + 4)) + rcClose.OffsetRect(-2, -2); + } + else + rcClose.OffsetRect(0, m_pDocker->m_ncHeight - 2); + + // Draw the outer highlight for the close button. + if (!IsRectEmpty(&rcClose)) + { + // Use the Marlett font to draw special characters. + CFont marlett; + marlett.CreatePointFont(100, _T("Marlett")); + drawDC.SetBkMode(TRANSPARENT); + LOGFONT lf = DpiScaleLogfont(marlett.GetLogFont(), 10); + drawDC.CreateFontIndirect(lf); + + COLORREF grey(RGB(232, 228, 220)); + COLORREF black(RGB(0, 0, 0)); + COLORREF white(RGB(255, 255, 255)); + + switch (uState) + { + case 0: + { + // Draw a grey box for the normal button using two special characters. + drawDC.SetTextColor(grey); + drawDC.TextOut(rcClose.left, rcClose.top, _T("\x63"), 1); + drawDC.TextOut(rcClose.left, rcClose.top, _T("\x64"), 1); + break; + } + case 1: + { + // Draw popped up button, black on right and bottom. + drawDC.SetTextColor(white); + drawDC.TextOut(rcClose.left, rcClose.top, _T("\x63"), 1); + drawDC.SetTextColor(black); + drawDC.TextOut(rcClose.left, rcClose.top, _T("\x64"), 1); + break; + } + case 2: + { + // Draw pressed button, black on left and top. + drawDC.SetTextColor(black); + drawDC.TextOut(rcClose.left, rcClose.top, _T("\x63"), 1); + drawDC.SetTextColor(white); + drawDC.TextOut(rcClose.left, rcClose.top, _T("\x64"), 1); + break; + } + } + + // Draw the close button (a Marlett "r" looks like "X"). + drawDC.SetTextColor(black); + drawDC.TextOut(rcClose.left, rcClose.top, _T("\x72"), 1); + } + } + } + } + + // Calculate the close rect position in screen co-ordinates. + inline CRect CDocker::CDockClient::GetCloseRect() const + { + CRect rcClose; + int gap = DpiScaleInt(2); + CRect rc = GetWindowRect(); + int cx = GetSystemMetrics(SM_CXSMICON) * GetWindowDpi(*this) / GetWindowDpi(HWND_DESKTOP); + int cy = GetSystemMetrics(SM_CYSMICON) * GetWindowDpi(*this) / GetWindowDpi(HWND_DESKTOP); + + rcClose.top = gap + rc.top + (m_pDocker->m_ncHeight - cy) / 2; + rcClose.bottom = rc.top + cy; + rcClose.right = rc.right - gap; + rcClose.left = rcClose.right - cx; + + if (GetExStyle() & WS_EX_LAYOUTRTL) + { + rcClose.left = rc.left + gap; + rcClose.right = rcClose.left + cx; + } + + return rcClose; + } + + inline LRESULT CDocker::CDockClient::MouseMove(UINT msg, WPARAM wparam, LPARAM lparam) + { + if (!m_isTracking) + { + TRACKMOUSEEVENT TrackMouseEventStruct = {}; + TrackMouseEventStruct.cbSize = sizeof(TrackMouseEventStruct); + TrackMouseEventStruct.dwFlags = TME_LEAVE | TME_NONCLIENT; + TrackMouseEventStruct.hwndTrack = *this; + _TrackMouseEvent(&TrackMouseEventStruct); + m_isTracking = TRUE; + } + + if ((m_pDocker != nullptr) && !(m_pDocker->GetDockStyle() & DS_NO_CAPTION)) + { + if (m_pDocker->IsDocked()) + { + // Discard phantom mouse move messages. + if ((m_oldPoint.x == GET_X_LPARAM(lparam)) && (m_oldPoint.y == GET_Y_LPARAM(lparam))) + return 0; + + if (IsLeftButtonDown() && (wparam == HTCAPTION) && (m_isCaptionPressed)) + { + assert(m_pDocker); + if (!(m_pDocker->GetDockStyle() & DS_NO_UNDOCK)) + m_pDocker->Undock(GetCursorPos()); + } + + // Update the close button. + if ((m_pDocker != nullptr) && !(m_pDocker->GetDockStyle() & DS_NO_CLOSE)) + { + CWindowDC dc(*this); + DrawCloseButton(dc); + } + } + else if (m_pDocker->IsUndockable() && !(m_pDocker->GetDockStyle() & DS_NO_UNDOCK)) + { + // Discard phantom mouse move messages. + if ((m_oldPoint.x == GET_X_LPARAM(lparam)) && (m_oldPoint.y == GET_Y_LPARAM(lparam))) + return 0; + + if (IsLeftButtonDown() && (wparam == HTCAPTION) && (m_isCaptionPressed)) + m_pDocker->GetDockAncestor()->UndockContainerGroup(); + + // Update the close button. + if (!(m_pDocker->GetDockStyle() & DS_NO_CLOSE)) + { + CWindowDC dc(*this); + DrawCloseButton(dc); + } + } + + m_isCaptionPressed = FALSE; + } + + return FinalWindowProc(msg, wparam, lparam); + } + + inline int CDocker::CDockClient::OnCreate(CREATESTRUCT&) + { + assert(m_pDocker); + assert(m_pDocker->IsWindow()); + + // Save the initial DPI when the docker is created. + m_pDocker->m_oldDpi = GetWindowDpi(*m_pDocker); + return 0; + } + + inline LRESULT CDocker::CDockClient::OnLButtonDown(UINT msg, WPARAM wparam, LPARAM lparam) + { + m_isClosePressed = FALSE; + ReleaseCapture(); + CWindowDC dc(*this); + DrawCloseButton(dc); + + return FinalWindowProc(msg, wparam, lparam); + } + + inline LRESULT CDocker::CDockClient::OnLButtonUp(UINT msg, WPARAM wparam, LPARAM lparam) + { + ReleaseCapture(); + + if ((m_pDocker != nullptr) && !(m_pDocker->GetDockStyle() & DS_NO_CLOSE)) + { + CWindowDC dc(*this); + DrawCloseButton(dc); + dc.Destroy(); // Destroy the dc before destroying its window. + + if ((m_pDocker != nullptr) && !(m_pDocker->GetDockStyle() & (DS_NO_CAPTION|DS_NO_CLOSE))) + { + m_isCaptionPressed = FALSE; + if (m_isClosePressed && GetCloseRect().PtInRect(GetCursorPos())) + { + // Destroy the docker. + if (m_pDocker->GetContainer()) + { + CDockContainer* pContainer = m_pDocker->GetContainer()->GetActiveContainer(); + if (pContainer) + { + CDockContainer* pParentC = pContainer->GetContainerParent(); + CDocker* pDocker = m_pDocker->GetDockFromView(pContainer); + int tab = pParentC->GetContainerIndex(pContainer); + + assert(pDocker); + if (pDocker) + pDocker->SendMessage(WM_CLOSE); + + if (pContainer != pParentC) + { + if (pParentC->GetItemCount() == 0) + pParentC->GetDocker()->RecalcDockLayout(); + else + { + pParentC->SelectPage(std::max(tab - 1, 0)); + pParentC->RecalcLayout(); + } + } + + if (m_pDocker->IsWindow()) + m_pDocker->RecalcDockLayout(); + } + } + else + { + m_pDocker->SendMessage(WM_CLOSE); + } + } + } + } + + return CWnd::WndProcDefault(msg, wparam, lparam); + } + + inline LRESULT CDocker::CDockClient::OnMouseMove(UINT msg, WPARAM wparam, LPARAM lparam) + { + return MouseMove(msg, wparam, lparam); + } + + // Sets the non-client area (and hence sets the client area). + // This function modifies lparam. + inline LRESULT CDocker::CDockClient::OnNCCalcSize(UINT msg, WPARAM wparam, LPARAM lparam) + { + if ((m_pDocker != nullptr) && !(m_pDocker->GetDockStyle() & DS_NO_CAPTION)) + { + if (m_pDocker->IsUndockable()) + { + LPRECT rc = reinterpret_cast(lparam); + rc->top += m_pDocker->m_ncHeight; + } + } + + return CWnd::WndProcDefault(msg, wparam, lparam); + } + + // Identify which part of the non-client area the cursor is over. + inline LRESULT CDocker::CDockClient::OnNCHitTest(UINT msg, WPARAM wparam, LPARAM lparam) + { + if ((m_pDocker != nullptr) && !(m_pDocker->GetDockStyle() & DS_NO_CAPTION)) + { + if (m_pDocker->IsUndockable()) + { + CPoint pt(GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); + + // Indicate if the point is in the close button. + if (GetCloseRect().PtInRect(pt)) + return HTCLOSE; + + VERIFY(ScreenToClient(pt)); + + // Indicate if the point is in the caption. + if (pt.y < 0) + return HTCAPTION; + } + } + return CWnd::WndProcDefault(msg, wparam, lparam); + } + + inline LRESULT CDocker::CDockClient::OnNCLButtonDown(UINT msg, WPARAM wparam, LPARAM lparam) + { + if ((m_pDocker != nullptr) && !(m_pDocker->GetDockStyle() & DS_NO_CAPTION)) + { + if ((HTCLOSE == wparam) && !(m_pDocker->GetDockStyle() & DS_NO_CLOSE)) + { + m_isClosePressed = TRUE; + SetCapture(); + } + + m_isCaptionPressed = TRUE; + m_oldPoint.x = GET_X_LPARAM(lparam); + m_oldPoint.y = GET_Y_LPARAM(lparam); + if (m_pDocker->IsUndockable()) + { + // Give the view window focus unless its child already has it. + if (!GetView().IsChild(GetFocus())) + m_pDocker->GetView().SetFocus(); + + // Update the close button. + if (!(m_pDocker->GetDockStyle() & DS_NO_CLOSE)) + { + CWindowDC dc(*this); + DrawCloseButton(dc); + } + + return 0; + } + } + + return CWnd::WndProcDefault(msg, wparam, lparam); + } + + inline LRESULT CDocker::CDockClient::OnNCMouseLeave(UINT msg, WPARAM wparam, LPARAM lparam) + { + m_isTracking = FALSE; + if ((0 != m_pDocker) && !(m_pDocker->GetDockStyle() & (DS_NO_CAPTION | DS_NO_CLOSE)) && m_pDocker->IsUndockable()) + { + CWindowDC dc(*this); + DrawCloseButton(dc); + } + + m_isTracking = FALSE; + + return FinalWindowProc(msg, wparam, lparam); + } + + inline LRESULT CDocker::CDockClient::OnNCMouseMove(UINT msg, WPARAM wparam, LPARAM lparam) + { + return MouseMove(msg, wparam, lparam); + } + + inline LRESULT CDocker::CDockClient::OnNCPaint(UINT msg, WPARAM wparam, LPARAM lparam) + { + if ((m_pDocker != nullptr) && !(m_pDocker->GetDockStyle() & DS_NO_CAPTION)) + { + if (m_pDocker->IsUndockable()) + { + DefWindowProc(WM_NCPAINT, wparam, lparam); + DrawCaption(); + return 0; + } + } + return FinalWindowProc(msg, wparam, lparam); + } + + // Called after the window is resized. + inline LRESULT CDocker::CDockClient::OnWindowPosChanged(UINT msg, WPARAM wparam, LPARAM lparam) + { + // Reposition the View window to cover the DockClient's client area. + CRect rc = GetClientRect(); + VERIFY(GetView().SetWindowPos(HWND_TOP, rc, SWP_SHOWWINDOW)); + + return FinalWindowProc(msg, wparam, lparam); + } + + inline void CDocker::CDockClient::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = _T("Win32++ DockClient"); + wc.hCursor = ::LoadCursor(nullptr, IDC_ARROW); + } + + inline void CDocker::CDockClient::PreCreate(CREATESTRUCT& cs) + { + assert(m_pDocker); + if (!m_pDocker) return; + + DWORD style = m_pDocker->GetDockStyle(); + if (style & DS_CLIENTEDGE) + cs.dwExStyle = WS_EX_CLIENTEDGE; + + if (m_pDocker->GetExStyle() & WS_EX_LAYOUTRTL) + cs.dwExStyle |= WS_EX_LAYOUTRTL; + } + + // Sends custom notification messages to the parent window. + inline void CDocker::CDockClient::SendNotify(UINT messageID) + { + // Fill the DragPos structure with data. + DragPos dragPos = {}; + dragPos.hdr.code = messageID; + dragPos.hdr.hwndFrom = GetHwnd(); + dragPos.pos = GetCursorPos(); + dragPos.pDocker = m_pDocker; + + // Send a DragPos notification to the docker. + LPARAM lparam = reinterpret_cast(&dragPos); + GetParent().SendMessage(WM_NOTIFY, 0, lparam); + } + + // Sets the caption's foreground and background colors. + // foregnd1 specifies the foreground color(focused). + // backgnd1 specifies the background color(focused). + // foregnd2 specifies the foreground color(not focused). + // backgnd2 specifies the background color(not focused). + // penColor specifies the pen color used for drawing the outline. + inline void CDocker::CDockClient::SetCaptionColors(COLORREF foregnd1, + COLORREF backgnd1, COLORREF foregnd2, COLORREF backgnd2, COLORREF penColor) + { + m_foregnd1 = foregnd1; + m_backgnd1 = backgnd1; + m_foregnd2 = foregnd2; + m_backgnd2 = backgnd2; + m_penColor = penColor; + } + + inline void CDocker::CDockClient::SetView(CWnd& view) + { + if (m_pView != &view) + { + // Hide the existing view window (if any). + if (m_pView && m_pView->IsWindow()) + { + // We can't change docker view if it is a DockContainer. + // Use CDockContainer::SetView to change the DockContainer's view instead. + assert(m_pView->SendMessage(UWM_GETCDOCKCONTAINER) == 0); + + m_pView->ShowWindow(SW_HIDE); + } + + // Assign the view window. + m_pView = &view; + + if (IsWindow()) + { + // The docker is already created, so create and position the new view too. + + if (!GetView().IsWindow()) + GetView().Create(*this); + else + { + GetView().SetParent(*this); + } + + CRect rc = GetClientRect(); + VERIFY(GetView().SetWindowPos(HWND_TOP, rc, SWP_SHOWWINDOW)); + } + } + } + + inline LRESULT CDocker::CDockClient::WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) + { + switch (msg) + { + case WM_LBUTTONUP: return OnLButtonUp(msg, wparam, lparam); + case WM_MOUSEMOVE: return OnMouseMove(msg, wparam, lparam); + case WM_NCCALCSIZE: return OnNCCalcSize(msg, wparam, lparam); + case WM_NCHITTEST: return OnNCHitTest(msg, wparam, lparam); + case WM_NCLBUTTONDBLCLK: // Intentionally blank. + case WM_NCLBUTTONDOWN: return OnNCLButtonDown(msg, wparam, lparam); + case WM_NCMOUSEMOVE: return OnNCMouseMove(msg, wparam, lparam); + case WM_NCPAINT: return OnNCPaint(msg, wparam, lparam); + case WM_NCMOUSELEAVE: return OnNCMouseLeave(msg, wparam, lparam); + case WM_NOTIFY: + { + // Perform default handling for WM_NOTIFY. + LRESULT result = CWnd::WndProcDefault(msg, wparam, lparam); + + // Also forward WM_NOTIFY to the docker. + if (result == 0) + result = m_pDocker->SendMessage(msg, wparam, lparam); + + return result; + } + case WM_WINDOWPOSCHANGED: return OnWindowPosChanged(msg, wparam, lparam); + } + + return CWnd::WndProcDefault(msg, wparam, lparam); + } + + + ///////////////////////////////////////////////////////////// + // Definitions for the CDockHint class nested within CDocker. + // + inline CDocker::CDockHint::CDockHint() + { + m_brush.CreateSolidBrush(RGB(0, 150, 255)); + } + + inline RECT CDocker::CDockHint::CalcHintRectContainer(CDocker* pDockTarget) + { + // Calculate the hint window's position for container docking. + CRect rcHint = pDockTarget->GetDockClient().GetWindowRect(); + if (pDockTarget->GetDockClient().GetExStyle() & WS_EX_CLIENTEDGE) + rcHint.InflateRect(-2, -2); + VERIFY(pDockTarget->ScreenToClient(rcHint)); + + return rcHint; + } + + inline RECT CDocker::CDockHint::CalcHintRectInner(CDocker* pDockTarget, + CDocker* pDockDrag, UINT dockSide) + { + assert(pDockTarget); + assert(pDockDrag); + + if (!pDockTarget || !pDockDrag) return CRect(0, 0, 0, 0); + + bool isRTL = false; + isRTL = ((pDockTarget->GetExStyle() & WS_EX_LAYOUTRTL)) != 0; + + // Calculate the hint window's position for inner docking. + CDockClient* pDockClient = &pDockTarget->GetDockClient(); + CRect rcHint = pDockClient->GetWindowRect(); + + if (pDockClient->GetExStyle() & WS_EX_CLIENTEDGE) + rcHint.InflateRect(-2, -2); + VERIFY(pDockTarget->ScreenToClient(rcHint)); + + int Width; + CRect rcDockDrag = pDockDrag->GetWindowRect(); + CRect rcDockTarget = pDockClient->GetWindowRect(); + if ((dockSide == DS_DOCKED_LEFT) || (dockSide == DS_DOCKED_RIGHT)) + { + Width = rcDockDrag.Width(); + if (Width >= (rcDockTarget.Width() - pDockDrag->GetBarWidth())) + Width = std::max(rcDockTarget.Width()/2 - pDockDrag->GetBarWidth(), + pDockDrag->GetBarWidth()); + } + else + { + Width = rcDockDrag.Height(); + if (Width >= (rcDockTarget.Height() - pDockDrag->GetBarWidth())) + Width = std::max(rcDockTarget.Height()/2 - pDockDrag->GetBarWidth(), + pDockDrag->GetBarWidth()); + } + switch (dockSide) + { + case DS_DOCKED_LEFT: + if (isRTL) + rcHint.left = rcHint.right - Width; + else + rcHint.right = rcHint.left + Width; + + break; + case DS_DOCKED_RIGHT: + if (isRTL) + rcHint.right = rcHint.left + Width; + else + rcHint.left = rcHint.right - Width; + + break; + case DS_DOCKED_TOP: + rcHint.bottom = rcHint.top + Width; + break; + case DS_DOCKED_BOTTOM: + rcHint.top = rcHint.bottom - Width; + break; + } + + return rcHint; + } + + // Calculate the hint window's position for outer docking. + inline RECT CDocker::CDockHint::CalcHintRectOuter(CDocker* pDockDrag, UINT dockSide) + { + assert(pDockDrag); + if (!pDockDrag) return CRect(0, 0, 0, 0); + + CDocker* pDockTarget = pDockDrag->GetDockAncestor(); + CRect rcHint = pDockTarget->GetViewRect(); + if (pDockTarget->GetDockClient().GetExStyle() & WS_EX_CLIENTEDGE) + rcHint.InflateRect(-2, -2); + + CRect rcDockDrag = pDockDrag->GetWindowRect(); + int barWidth = pDockDrag->GetBarWidth(); + CRect rcDockClient = pDockTarget->GetDockClient().GetClientRect(); + + // Limit the docked size to half the parent's size if it won't fit inside parent. + int width; + if ((dockSide == DS_DOCKED_LEFTMOST) || (dockSide == DS_DOCKED_RIGHTMOST)) + { + width = rcDockDrag.Width(); + if (width >= rcDockClient.Width() - barWidth) + width = std::max(rcDockClient.Width()/2 - barWidth, barWidth); + } + else + { + width = rcDockDrag.Height(); + if (width >= rcDockClient.Height() - barWidth) + width = std::max(rcDockClient.Height()/2 - barWidth, barWidth); + } + + bool isRTL = false; + isRTL = ((pDockTarget->GetExStyle() & WS_EX_LAYOUTRTL)) != 0; + + // Adjust the hint rect for the dock side and right to left (RTL). + switch (dockSide) + { + case DS_DOCKED_LEFTMOST: + if (isRTL) + rcHint.left = rcHint.right - width; + else + rcHint.right = rcHint.left + width; + break; + case DS_DOCKED_RIGHTMOST: + if (isRTL) + rcHint.right = rcHint.left + width; + else + rcHint.left = rcHint.right - width; + break; + case DS_DOCKED_TOPMOST: + rcHint.bottom = rcHint.top + width; + break; + case DS_DOCKED_BOTTOMMOST: + rcHint.top = rcHint.bottom - width; + break; + } + + return rcHint; + } + + inline void CDocker::CDockHint::DisplayHint(CDocker* pDockTarget, + CDocker* pDockDrag, UINT dockSide) + { + assert(pDockTarget); + assert(pDockDrag); + + // Retrieve the hint rect. + CRect rcHint; + if (dockSide & 0xF) + rcHint = CalcHintRectInner(pDockTarget, pDockDrag, dockSide); + else if (dockSide & 0xF0000) + rcHint = CalcHintRectOuter(pDockDrag, dockSide); + else if (dockSide & DS_DOCKED_CONTAINER) + rcHint = CalcHintRectContainer(pDockTarget); + else + return; + + // Create the dock hint window if required. + if (!IsWindow()) + Create(); + + // Adjust hint shape for container in container docking using a region. + if ((dockSide & DS_DOCKED_CONTAINER) && rcHint.Height() > 50) + { + CDockContainer* pDragged = pDockDrag->GetContainer(); + CDockContainer* pTarget = pDockTarget->GetContainer(); + assert(pTarget); + + if (pDragged != nullptr) + { + // Create the region. + CRgn rgn; + int gap = DpiScaleInt(8); + int tabHeight = pDragged->GetTabHeight(); + CSize imageSize = pDragged->GetImages().GetIconSize(); + CSize textSize1 = pDragged->GetMaxTabTextSize(); + CSize textSize2 = pTarget->GetMaxTabTextSize(); + int tabWidth = imageSize.cx + std::max(textSize1.cx, textSize2.cx) + gap; + rgn.CreateRectRgn(0, 0, rcHint.Width(), rcHint.Height() - tabHeight); + assert(rgn.GetHandle()); + CRgn rgn2; + gap = DpiScaleInt(5); + rgn2.CreateRectRgn(gap, rcHint.Height() - tabHeight, tabWidth, rcHint.Height()); + rgn.CombineRgn(rgn2, RGN_OR); + + // Assign the region. + SetWindowRgn(rgn, TRUE); + } + } + else + // Remove any assigned region. + SetWindowRgn(nullptr, TRUE); + + // Position the hint window. + VERIFY(pDockTarget->ClientToScreen(rcHint)); + VERIFY(SetWindowPos(HWND_TOP, rcHint, SWP_SHOWWINDOW)); + + // Call SetLayeredWindowAttributes to specify the hint window's transparency. + VERIFY(SetLayeredWindowAttributes(*this, 0, 92, LWA_ALPHA)); + } + + inline void CDocker::CDockHint::PreCreate(CREATESTRUCT& cs) + { + // WS_POPUP creates a window without a caption. + cs.style = WS_POPUP; + + // WS_EX_TOOLWINDOW prevents the window from being displayed on the taskbar. + // WS_EX_LAYERED makes the window layered for transparency. + cs.dwExStyle = WS_EX_LAYERED | WS_EX_TOOLWINDOW; + } + + inline void CDocker::CDockHint::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = _T("Win32++ DockHint"); + + // Assign the hint window's color. + wc.hbrBackground = m_brush; + } + + + //////////////////////////////////////////////////////////////// + // Definitions for the CTarget class nested within CDocker. + // CTarget is the base class for a number of CTargetXXX classes. + + inline void CDocker::CTarget::OnDraw(CDC& dc) + { + if (m_image.GetHandle() != nullptr) + { + CBitmap image = DpiScaleUpBitmap(m_image); + CSize imageSize = image.GetSize(); + CRect rc = GetClientRect(); + + // Draw the dock target. + // Support dock targets split across different monitors. + CMemDC memDC(dc); + memDC.CreateCompatibleBitmap(dc, imageSize.cx, imageSize.cy); + memDC.DrawBitmap(0, 0, imageSize.cx, imageSize.cy, image, RGB(255, 0, 255)); + dc.StretchBlt(0, 0, rc.Width(), rc.Height(), memDC, 0, 0, imageSize.cx, + imageSize.cy, SRCCOPY); + } + else + TRACE("\n*** WARNING: Missing docking resource. ***\n"); + } + + inline void CDocker::CTarget::PreCreate(CREATESTRUCT& cs) + { + cs.style = WS_POPUP; + cs.dwExStyle = WS_EX_TOPMOST | WS_EX_TOOLWINDOW; + cs.lpszClass = _T("Win32++ DockTargeting"); + } + + + ///////////////////////////////////////////////////////////////// + // Definitions for the CTargetBottom class nested within CDocker. + // + + // Constructor. + inline CDocker::CTargetBottom::CTargetBottom() + { + m_image.LoadBitmap(IDW_SDBOTTOM); + } + + inline BOOL CDocker::CTargetBottom::CheckTarget(DragPos* pDragPos) + { + CDocker* pDockDrag = pDragPos->pDocker; + assert(pDockDrag); + if (!pDockDrag) return FALSE; + + CPoint pt = pDragPos->pos; + CDocker* pDockTarget = pDockDrag->GetDockUnderDragPoint(pt)->GetTopmostDocker(); + if (pDockTarget != pDockDrag->GetDockAncestor()) + { + Destroy(); + return FALSE; + } + + if (pDockTarget->GetDockStyle() & DS_NO_DOCKCHILD_BOTTOM) + return FALSE; + + CBitmap image = pDockTarget->DpiScaleUpBitmap(CBitmap(IDW_SDBOTTOM)); + int cxImage = image.GetSize().cx; + int cyImage = image.GetSize().cy; + + if (!IsWindow()) + { + Create(); + CRect rc = pDockTarget->GetViewRect(); + VERIFY(pDockTarget->ClientToScreen(rc)); + int xMid = rc.left + (rc.Width() - cxImage) / 2; + VERIFY(SetWindowPos(HWND_TOPMOST, xMid, rc.bottom - DpiScaleInt(8) - cyImage, + cxImage, cyImage, SWP_NOACTIVATE | SWP_SHOWWINDOW)); + } + + CRect rcBottom(0, 0, cxImage, cyImage); + VERIFY(ScreenToClient(pt)); + + // Test if our cursor is in one of the docking zones. + if (rcBottom.PtInRect(pt)) + { + pDockTarget->GetDockHint().DisplayHint(pDockTarget, pDockDrag, DS_DOCKED_BOTTOMMOST); + pDockDrag->m_dockZone = DS_DOCKED_BOTTOMMOST; + return TRUE; + } + + return FALSE; + } + + + ///////////////////////////////////////////////////////////////// + // Definitions for the CTargetCentre class nested within CDocker. + // + + // Constructor. + inline CDocker::CTargetCentre::CTargetCentre() : m_isOverContainer(FALSE), + m_pOldDockTarget(0) + { + m_image.LoadBitmap(IDW_SDCENTER); + } + + inline BOOL CDocker::CTargetCentre::CheckTarget(DragPos* pDragPos) + { + CDocker* pDockDrag = pDragPos->pDocker; + assert(::SendMessage(*pDockDrag, UWM_GETCDOCKER, 0, 0)); + + CDocker* pDockTarget = pDockDrag->GetDockUnderDragPoint(pDragPos->pos); + if (pDockTarget == nullptr) + return FALSE; + + m_image = pDockTarget->DpiScaleUpBitmap(CBitmap(IDW_SDCENTER)); + CSize imageSize = m_image.GetSize(); + + if (!IsWindow()) + Create(); + + m_isOverContainer = pDockTarget->GetView().SendMessage(UWM_GETCDOCKCONTAINER) ? TRUE : FALSE; + + // Redraw the target if the dock target changes. + if (m_pOldDockTarget != pDockTarget) Invalidate(); + m_pOldDockTarget = pDockTarget; + + int cxImage = imageSize.cx; + int cyImage = imageSize.cy; + + CRect rcTarget = pDockTarget->GetDockClient().GetWindowRect(); + int xMid = rcTarget.left + (rcTarget.Width() - cxImage) / 2; + int yMid = rcTarget.top + (rcTarget.Height() - cyImage) / 2; + VERIFY(SetWindowPos(HWND_TOPMOST, xMid, yMid, cxImage, cyImage, + SWP_NOACTIVATE | SWP_SHOWWINDOW)); + + // The IDW_SDCENTER bitmap should be square. + int p1 = cxImage / 3 - 1; + int p2 = (2 * cxImage) / 3 - 1; + int p3 = cxImage - 1; + + // Create the docking zone rectangles. + CPoint pt = pDragPos->pos; + VERIFY(ScreenToClient(pt)); + CRect rcLeft(0, p1, p1, p2); + CRect rcTop(p1, 0, p2, p1); + CRect rcRight(p2 + 1, p1, p3, p2 + 1); + CRect rcBottom(p1, p2 + 1, p2 + 1, p3); + CRect rcMiddle(p1 + 1, p1 + 1, p2, p2); + + // Test if our cursor is in one of the docking zones. + if ((rcLeft.PtInRect(pt)) && !(pDockTarget->GetDockStyle() & DS_NO_DOCKCHILD_LEFT)) + { + pDockTarget->GetDockHint().DisplayHint(pDockTarget, pDockDrag, DS_DOCKED_LEFT); + pDockDrag->m_dockZone = DS_DOCKED_LEFT; + return TRUE; + } + else if ((rcTop.PtInRect(pt)) && !(pDockTarget->GetDockStyle() & DS_NO_DOCKCHILD_TOP)) + { + pDockTarget->GetDockHint().DisplayHint(pDockTarget, pDockDrag, DS_DOCKED_TOP); + pDockDrag->m_dockZone = DS_DOCKED_TOP; + return TRUE; + } + else if ((rcRight.PtInRect(pt)) && !(pDockTarget->GetDockStyle() & DS_NO_DOCKCHILD_RIGHT)) + { + pDockTarget->GetDockHint().DisplayHint(pDockTarget, pDockDrag, DS_DOCKED_RIGHT); + pDockDrag->m_dockZone = DS_DOCKED_RIGHT; + return TRUE; + } + else if ((rcBottom.PtInRect(pt)) && !(pDockTarget->GetDockStyle() & DS_NO_DOCKCHILD_BOTTOM)) + { + pDockTarget->GetDockHint().DisplayHint(pDockTarget, pDockDrag, DS_DOCKED_BOTTOM); + pDockDrag->m_dockZone = DS_DOCKED_BOTTOM; + return TRUE; + } + else if ((rcMiddle.PtInRect(pt)) && (IsOverContainer())) + { + pDockTarget->GetDockHint().DisplayHint(pDockTarget, pDockDrag, DS_DOCKED_CONTAINER); + pDockDrag->m_dockZone = DS_DOCKED_CONTAINER; + return TRUE; + } + else + return FALSE; + } + + inline int CDocker::CTargetCentre::OnCreate(CREATESTRUCT&) + { + // Calculate the points for the region. + int side = m_image.GetSize().cx; + int p1 = side / 4; + int p2 = side / 3; + int p3 = 2 * p2 - 1; + int p4 = p1 * 3; + int p5 = side; + + // Use a region to create an irregularly shaped window. + POINT ptArray[16] = { {0, p2}, {p1, p2}, {p2, p1}, {p2, 0}, + {p3, 0}, {p3, p1}, {p4, p2}, {p5, p2}, + {p5, p3}, {p4, p3}, {p3, p4}, {p3, p5}, + {p2, p5}, {p2, p4}, {p1, p3}, {0, p3} }; + + CRgn rgnPoly; + rgnPoly.CreatePolygonRgn(ptArray, 16, WINDING); + SetWindowRgn(rgnPoly, FALSE); + return 0; + } + + inline void CDocker::CTargetCentre::OnDraw(CDC& dc) + { + if (m_image.GetHandle() != nullptr) + { + // Load the target bitmaps. + CBitmap bmLeft = DpiScaleUpBitmap(CBitmap(IDW_SDLEFT)); + CBitmap bmRight = DpiScaleUpBitmap(CBitmap(IDW_SDRIGHT)); + CBitmap bmTop = DpiScaleUpBitmap(CBitmap(IDW_SDTOP)); + CBitmap bmBottom = DpiScaleUpBitmap(CBitmap(IDW_SDBOTTOM)); + + // Gray out invalid dock targets. + DWORD style = m_pOldDockTarget->GetDockStyle(); + if (style & DS_NO_DOCKCHILD_LEFT) bmLeft.TintBitmap(150, 150, 150); + if (style & DS_NO_DOCKCHILD_TOP) bmTop.TintBitmap(150, 150, 150); + if (style & DS_NO_DOCKCHILD_RIGHT) bmRight.TintBitmap(150, 150, 150); + if (style & DS_NO_DOCKCHILD_BOTTOM) bmBottom.TintBitmap(150, 150, 150); + + // Get the dock target sizes. + CSize szBig = m_image.GetSize(); + CSize szLeft = bmLeft.GetSize(); + CSize szTop = bmTop.GetSize(); + CSize szRight = bmRight.GetSize(); + CSize szBottom = bmBottom.GetSize(); + + // Draw the dock targets. + // Support dock targets split across different monitors. + CRect rc = GetClientRect(); + CMemDC memDC(dc); + memDC.CreateCompatibleBitmap(dc, szBig.cx, szBig.cy); + + memDC.DrawBitmap(0, 0, szBig.cx, szBig.cy, m_image, RGB(255, 0, 255)); + int midleft = (szBig.cy - szLeft.cy) / 2; + int midright = szBig.cx - szRight.cx; + memDC.DrawBitmap(0, midleft, szLeft.cx, szLeft.cy, bmLeft, RGB(255, 0, 255)); + memDC.DrawBitmap(midleft, 0, szTop.cx, szTop.cy, bmTop, RGB(255, 0, 255)); + memDC.DrawBitmap(midright, midleft, szRight.cx, szRight.cy, bmRight, RGB(255, 0, 255)); + memDC.DrawBitmap(midleft, midright, szBottom.cx, szBottom.cy, bmBottom, RGB(255, 0, 255)); + + CBitmap bmMiddle = DpiScaleUpBitmap(CBitmap(IDW_SDMIDDLE)); + CSize szMiddle = bmMiddle.GetSize(); + int xMid = (szBig.cx - szMiddle.cx) / 2; + int yMid = (szBig.cy - szMiddle.cy) / 2; + CBrush grey(RGB(224, 224, 224)); + dc.FillRect(rc, grey); + int height3 = rc.Height() / 3; + int width3 = rc.Width() /3; + dc.StretchBlt(0, height3,width3, height3, memDC, 0, midleft, + szLeft.cx, szLeft.cy, SRCCOPY); + dc.StretchBlt(width3, 0, width3, height3, memDC, midleft, 0, + szTop.cx, szTop.cy, SRCCOPY); + dc.StretchBlt(2* width3, height3, width3, height3, memDC, midright, + midleft, szRight.cx, szRight.cy, SRCCOPY); + dc.StretchBlt(width3, 2* height3, width3, height3, memDC, midleft, + midright, szBottom.cx, szBottom.cy, SRCCOPY); + + if (IsOverContainer()) + { + memDC.DrawBitmap(xMid, yMid, szMiddle.cx, szMiddle.cy, bmMiddle, RGB(255, 0, 255)); + dc.StretchBlt(rc.Width()/3, rc.Height() / 3, (rc.Width() / 3), + (rc.Height() / 3), memDC, xMid, yMid, szMiddle.cx, szMiddle.cy, SRCCOPY); + } + } + } + + + /////////////////////////////////////////////////////////////// + // Definitions for the CTargetLeft class nested within CDocker. + // + + // Constructor. + inline CDocker::CTargetLeft::CTargetLeft() + { + m_image.LoadBitmap(IDW_SDLEFT); + } + + inline BOOL CDocker::CTargetLeft::CheckTarget(DragPos* pDragPos) + { + CDocker* pDockDrag = pDragPos->pDocker; + assert(pDockDrag); + if (!pDockDrag) return FALSE; + + CPoint pt = pDragPos->pos; + CDocker* pDockTarget = pDockDrag->GetDockUnderDragPoint(pt)->GetTopmostDocker(); + if (pDockTarget != pDockDrag->GetDockAncestor()) + { + Destroy(); + return FALSE; + } + + if (pDockTarget->GetDockStyle() & DS_NO_DOCKCHILD_LEFT) + return FALSE; + + CBitmap image = pDockTarget->DpiScaleUpBitmap(CBitmap(IDW_SDLEFT)); + int cxImage = image.GetSize().cx; + int cyImage = image.GetSize().cy; + + if (!IsWindow()) + { + Create(); + CRect rc = pDockTarget->GetViewRect(); + VERIFY(pDockTarget->ClientToScreen(rc)); + int yMid = rc.top + (rc.Height() - cyImage) / 2; + VERIFY(SetWindowPos(HWND_TOPMOST, rc.left + DpiScaleInt(8), yMid, + cxImage, cyImage, SWP_NOACTIVATE | SWP_SHOWWINDOW)); + } + + CRect rcLeft(0, 0, cxImage, cyImage); + VERIFY(ScreenToClient(pt)); + + // Test if our cursor is in one of the docking zones. + if (rcLeft.PtInRect(pt)) + { + pDockTarget->GetDockHint().DisplayHint(pDockTarget, pDockDrag, DS_DOCKED_LEFTMOST); + pDockDrag->m_dockZone = DS_DOCKED_LEFTMOST; + return TRUE; + } + + return FALSE; + } + + + //////////////////////////////////////////////////////////////// + // Definitions for the CTargetRight class nested within CDocker. + // + + // Constructor. + inline CDocker::CTargetRight::CTargetRight() + { + m_image.LoadBitmap(IDW_SDRIGHT); + } + + inline BOOL CDocker::CTargetRight::CheckTarget(DragPos* pDragPos) + { + CDocker* pDockDrag = pDragPos->pDocker; + assert(pDockDrag); + if (!pDockDrag) return FALSE; + + CPoint pt = pDragPos->pos; + CDocker* pDockTarget = pDockDrag->GetDockUnderDragPoint(pt)->GetTopmostDocker(); + if (pDockTarget != pDockDrag->GetDockAncestor()) + { + Destroy(); + return FALSE; + } + + if (pDockTarget->GetDockStyle() & DS_NO_DOCKCHILD_RIGHT) + return FALSE; + + CBitmap image = pDockTarget->DpiScaleUpBitmap(CBitmap(IDW_SDRIGHT)); + int cxImage = image.GetSize().cx; + int cyImage = image.GetSize().cy; + + if (!IsWindow()) + { + Create(); + CRect rc = pDockTarget->GetViewRect(); + VERIFY(pDockTarget->ClientToScreen(rc)); + int yMid = rc.top + (rc.Height() - cyImage) / 2; + VERIFY(SetWindowPos(HWND_TOPMOST, rc.right - DpiScaleInt(8) - cxImage, + yMid, cxImage, cyImage, SWP_NOACTIVATE | SWP_SHOWWINDOW)); + } + + CRect rcRight(0, 0, cxImage, cyImage); + VERIFY(ScreenToClient(pt)); + + // Test if our cursor is in one of the docking zones. + if (rcRight.PtInRect(pt)) + { + pDockTarget->GetDockHint().DisplayHint(pDockTarget, pDockDrag, DS_DOCKED_RIGHTMOST); + pDockDrag->m_dockZone = DS_DOCKED_RIGHTMOST; + return TRUE; + } + + return FALSE; + } + + + ////////////////////////////////////////////////////////////// + // Definitions for the CTargetTop class nested within CDocker. + // + + // Constructor. + inline CDocker::CTargetTop::CTargetTop() + { + m_image.LoadBitmap(IDW_SDTOP); + } + + inline BOOL CDocker::CTargetTop::CheckTarget(DragPos* pDragPos) + { + CDocker* pDockDrag = pDragPos->pDocker; + assert(pDockDrag); + if (!pDockDrag) return FALSE; + + CPoint pt = pDragPos->pos; + CDocker* pDockTarget = pDockDrag->GetDockUnderDragPoint(pt)->GetTopmostDocker(); + if (pDockTarget != pDockDrag->GetDockAncestor()) + { + Destroy(); + return FALSE; + } + + if (pDockTarget->GetDockStyle() & DS_NO_DOCKCHILD_TOP) + return FALSE; + + CBitmap image = pDockTarget->DpiScaleUpBitmap(CBitmap(IDW_SDTOP)); + int cxImage = image.GetSize().cx; + int cyImage = image.GetSize().cy; + + if (!IsWindow()) + { + Create(); + CRect rc = pDockTarget->GetViewRect(); + VERIFY(pDockTarget->ClientToScreen(rc)); + int xMid = rc.left + (rc.Width() - cxImage) / 2; + VERIFY(SetWindowPos(HWND_TOPMOST, xMid, rc.top + DpiScaleInt(8), + cxImage, cyImage, SWP_NOACTIVATE | SWP_SHOWWINDOW)); + } + + CRect rcTop(0, 0, cxImage, cyImage); + VERIFY(ScreenToClient(pt)); + + // Test if our cursor is in one of the docking zones. + if (rcTop.PtInRect(pt)) + { + pDockTarget->GetDockHint().DisplayHint(pDockTarget, pDockDrag, DS_DOCKED_TOPMOST); + pDockDrag->m_dockZone = DS_DOCKED_TOPMOST; + return TRUE; + } + + return FALSE; + } + + + ///////////////////////////////////// + // Definitions for the CDocker class. + // + + // Constructor. + inline CDocker::CDocker() : m_pDockParent(nullptr), m_pDockAncestor(nullptr), + m_isUndocking(FALSE), m_isClosing(FALSE), m_isDragging(FALSE), + m_dockStartSize(0), m_dockID(0), m_ncHeight(0), + m_newDpi(USER_DEFAULT_SCREEN_DPI), m_oldDpi(USER_DEFAULT_SCREEN_DPI), + m_dockZone(0), m_dockStyle(0), m_dockUnderPoint(0) + { + // Set the initial defaults. + SetDockBar(m_dockBar); + SetDockClient(m_dockClient); + SetDockHint(m_dockHint); + + m_pDockAncestor = this; // Assume this docker is the DockAncestor for now. + m_allDockers.push_back(this); + GetDockClient().SetDocker(this); + } + + + // This function creates the docker, and adds it to the docker hierarchy as docked. + inline CDocker* CDocker::AddDockedChild(CDocker* pDocker, DWORD dockStyle, + int dockSize, int dockID /* = 0*/) + { + // Create the new docker window as a child of this docker. + // This permanently sets the frame window as the docker window's owner, + // even when its parent is subsequently changed. + + assert(pDocker); + return AddDockedChild(DockPtr(pDocker), dockStyle, dockSize, dockID); + } + + // This function creates the docker, and adds it to the docker hierarchy as docked. + inline CDocker* CDocker::AddDockedChild(DockPtr docker, DWORD dockStyle, + int dockSize, int dockID /* = 0*/) + { + // Create the new docker window as a child of this docker. + // This permanently sets the frame window as the docker window's owner, + // even when its parent is subsequently changed. + + CDocker* pDocker = docker.get(); + assert(pDocker); + if (!pDocker) + return nullptr; + + // Store the docker's unique pointer in the DockAncestor's vector for later deletion. + GetAllChildren().push_back(std::move(docker)); + GetDockAncestor()->m_allDockers.push_back(pDocker); + + pDocker->SetDockStyle(dockStyle); + pDocker->m_dockID = dockID; + pDocker->m_pDockAncestor = GetDockAncestor(); + pDocker->m_pDockParent = this; + HWND frame = GetDockAncestor()->GetAncestor(); + pDocker->Create(frame); + pDocker->SetParent(*this); + + // Dock the docker window. + if (dockStyle & DS_DOCKED_CONTAINER) + DockInContainer(pDocker, dockStyle); + else + Dock(pDocker, dockStyle); + + pDocker->SetDockSize(dockSize); + + // Issue TRACE warnings for any missing resources. + HMODULE module = GetApp()->GetResourceHandle(); + + if (!(dockStyle & DS_NO_RESIZE)) + { + if (!FindResource(module, MAKEINTRESOURCE(IDW_SPLITH), RT_GROUP_CURSOR)) + TRACE("*** WARNING: Horizontal cursor resource missing. ***\n"); + if (!FindResource(module, MAKEINTRESOURCE(IDW_SPLITV), RT_GROUP_CURSOR)) + TRACE("*** WARNING: Vertical cursor resource missing. ***\n"); + } + + if (!(dockStyle & DS_NO_UNDOCK)) + { + if (!FindResource(module, MAKEINTRESOURCE(IDW_SDCENTER), RT_BITMAP)) + TRACE("*** WARNING: Docking center bitmap resource missing. ***\n"); + if (!FindResource(module, MAKEINTRESOURCE(IDW_SDLEFT), RT_BITMAP)) + TRACE("*** WARNING: Docking left bitmap resource missing. ***\n"); + if (!FindResource(module, MAKEINTRESOURCE(IDW_SDRIGHT), RT_BITMAP)) + TRACE("*** WARNING: Docking right bitmap resource missing. ***\n"); + if (!FindResource(module, MAKEINTRESOURCE(IDW_SDTOP), RT_BITMAP)) + TRACE("*** WARNING: Docking top bitmap resource missing. ***\n"); + if (!FindResource(module, MAKEINTRESOURCE(IDW_SDBOTTOM), RT_BITMAP)) + TRACE("*** WARNING: Docking center bottom resource missing. ***\n"); + } + + if (dockStyle & DS_DOCKED_CONTAINER) + { + if (!FindResource(module, MAKEINTRESOURCE(IDW_SDMIDDLE), RT_BITMAP)) + TRACE("*** WARNING Docking container bitmap resource missing. ***\n"); + } + + RecalcDockLayout(); + return pDocker; + } + + // This function creates the docker, and adds it to the docker hierarchy as undocked. + inline CDocker* CDocker::AddUndockedChild(CDocker* pDocker, DWORD dockStyle, + int dockSize, RECT rc, int dockID /* = 0*/, bool isHidden /* = false */) + { + assert(pDocker); + return AddUndockedChild(DockPtr(pDocker), dockStyle, dockSize, rc, dockID, isHidden); + } + + // This function creates the docker, and adds it to the docker hierarchy as undocked. + inline CDocker* CDocker::AddUndockedChild(DockPtr docker, DWORD dockStyle, + int dockSize, RECT rc, int dockID /* = 0*/, bool isHidden /* = false */) + { + CDocker* pDocker = docker.get(); + assert(pDocker); + if (!pDocker) + return nullptr; + + // Store the Docker's unique pointer in the DockAncestor's vector for later deletion. + GetAllChildren().push_back(std::move(docker)); + GetDockAncestor()->m_allDockers.push_back(pDocker); + + pDocker->SetDockSize(dockSize); + pDocker->SetDockStyle(dockStyle & 0XFFFFFF0); + pDocker->m_isUndocking = TRUE; // IsUndocked reports FALSE. + pDocker->m_dockID = dockID; + pDocker->m_pDockAncestor = GetDockAncestor(); + + // Initially create the as a child window of the frame. + // This makes the frame window the owner of our docker. + HWND frame = GetDockAncestor()->GetAncestor(); + pDocker->Create(frame); + pDocker->SetParent(*this); + + // Change the Docker to a POPUP window. + DWORD style = WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_VISIBLE; + pDocker->SetStyle(style); + pDocker->SetRedraw(FALSE); + pDocker->SetParent(0); + VERIFY(pDocker->SetWindowPos(HWND_TOP, rc, SWP_FRAMECHANGED)); + pDocker->RecalcDockLayout(); + pDocker->SetWindowText(pDocker->GetCaption().c_str()); + pDocker->SetRedraw(TRUE); + + if (isHidden) + pDocker->Hide(); + else + pDocker->RedrawWindow(RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_ALLCHILDREN); + pDocker->m_isUndocking = FALSE; // IsUndocked now reports TRUE. + + return pDocker; + } + + // Calls CheckTarget for each possible target zone. + inline void CDocker::CheckAllTargets(DragPos* pDragPos) const + { + if (!GetDockAncestor()->m_targetCentre.CheckTarget(pDragPos)) + { + if (!GetDockAncestor()->m_targetLeft.CheckTarget(pDragPos)) + { + if (!GetDockAncestor()->m_targetTop.CheckTarget(pDragPos)) + { + if (!GetDockAncestor()->m_targetRight.CheckTarget(pDragPos)) + { + if (!GetDockAncestor()->m_targetBottom.CheckTarget(pDragPos)) + { + // Not in a docking zone, so clean up. + CDocker* pDockDrag = pDragPos->pDocker; + if (pDockDrag) + { + GetDockHint().Destroy(); + pDockDrag->m_dockZone = 0; + } + } + } + } + } + } + } + + // Closes all the child dockers of this dock ancestor. + inline void CDocker::CloseAllDockers() + { + assert(this == GetDockAncestor()); // Must call CloseAllDockers from the DockAncestor. + + for (const DockPtr& ptr : GetAllChildren()) + { + // The CDocker is destroyed when the window is destroyed. + ptr->m_isClosing = TRUE; + ptr->Destroy(); // Destroy the window. + } + + m_dockChildren.clear(); + + // Delete any child containers this container might have. + if (GetContainer()) + { + std::vector AllContainers = GetContainer()->GetAllContainers(); + for (const ContainerInfo& ci : AllContainers) + { + if (GetContainer() != ci.pContainer) + GetContainer()->RemoveContainer(ci.pContainer, FALSE); + } + } + + RecalcDockLayout(); + } + + // Close all dock target windows. + inline void CDocker::CloseAllTargets() const + { + GetDockAncestor()->m_targetCentre.Destroy(); + GetDockAncestor()->m_targetLeft.Destroy(); + GetDockAncestor()->m_targetTop.Destroy(); + GetDockAncestor()->m_targetRight.Destroy(); + GetDockAncestor()->m_targetBottom.Destroy(); + } + + inline void CDocker::ConvertToChild(HWND parent) const + { + DWORD style = WS_CHILD | WS_VISIBLE; + SetStyle(style); + SetParent(parent); + GetDockBar().SetParent(parent); + } + + // Change the window to an "undocked" style. + inline void CDocker::ConvertToPopup(RECT rc, BOOL showUndocked) + { + ShowWindow(SW_HIDE); + DWORD style = WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME; + SetStyle(style); + + // Change the window's parent and reposition it. + if (GetDockBar().IsWindow()) + GetDockBar().ShowWindow(SW_HIDE); + + VERIFY(SetWindowPos(HWND_TOP, 0, 0, 0, 0, SWP_NOSENDCHANGING | SWP_HIDEWINDOW | SWP_NOREDRAW)); + m_pDockParent = 0; + SetParent(0); + + DWORD styleShow = showUndocked ? SWP_SHOWWINDOW : 0U; + VERIFY(SetWindowPos(HWND_TOP, rc, styleShow | SWP_FRAMECHANGED | SWP_NOOWNERZORDER)); + VERIFY(GetDockClient().SetWindowPos(HWND_TOP, GetClientRect(), SWP_SHOWWINDOW)); + SetWindowText(GetCaption().c_str()); + } + + // Docks the specified docker inside this docker. + inline void CDocker::Dock(CDocker* pDocker, UINT dockStyle) + { + assert(pDocker); + if (!pDocker) return; + + pDocker->m_pDockParent = this; + pDocker->SetDockStyle(dockStyle); + m_dockChildren.push_back(pDocker); + pDocker->ConvertToChild(*this); + + // Limit the docked size to half the parent's size if it won't fit inside parent. + if (((dockStyle & 0xF) == DS_DOCKED_LEFT) || ((dockStyle &0xF) == DS_DOCKED_RIGHT)) + { + int width = GetDockClient().GetWindowRect().Width(); + int barWidth = pDocker->GetBarWidth(); + if (pDocker->m_dockStartSize >= (width - barWidth)) + pDocker->SetDockSize(std::max(width/2 - barWidth, barWidth)); + } + else + { + int height = GetDockClient().GetWindowRect().Height(); + int barWidth = pDocker->GetBarWidth(); + if (pDocker->m_dockStartSize >= (height - barWidth)) + pDocker->SetDockSize(std::max(height/2 - barWidth, barWidth)); + } + + // Redraw the docked windows. + if (GetAncestor().IsWindowVisible()) + { + GetTopmostDocker()->SetForegroundWindow(); + + // Give the view window focus unless its child already has it. + if (!pDocker->GetView().IsChild(GetFocus())) + pDocker->GetView().SetFocus(); + + GetTopmostDocker()->SetRedraw(FALSE); + pDocker->SetDefaultCaptionHeight(); + RecalcDockLayout(); + GetTopmostDocker()->SetRedraw(TRUE); + GetTopmostDocker()->RedrawWindow(); + + // Update the Dock captions. + GetDockAncestor()->PostMessage(UWM_DOCKACTIVATE); + } + } + + // Add a container to an existing container. + inline void CDocker::DockInContainer(CDocker* pDocker, DWORD dockStyle, BOOL selectPage) + { + if ((dockStyle & DS_DOCKED_CONTAINER) && GetContainer()) + { + // Transfer any dock children to this docker. + pDocker->MoveDockChildren(this); + + // Transfer container children to the target container. + CDockContainer* pContainer = GetContainer(); + CDockContainer* pContainerSource = pDocker->GetContainer(); + std::vector allContainers = pContainerSource->GetAllContainers(); + for (const ContainerInfo& ci : allContainers) + { + CDockContainer* pContainerChild = ci.pContainer; + if (pContainerChild != pContainerSource) + { + // Remove child container from pContainerSource. + pContainerChild->ShowWindow(SW_HIDE); + pContainerSource->RemoveContainer(pContainerChild); + CDocker* pDockChild = GetDockFromView(pContainerChild); + assert(pDockChild); + if (pDockChild) + { + pDockChild->SetParent(*this); + pDockChild->m_pDockParent = this; + } + } + } + + pDocker->m_pDockParent = this; + pDocker->ShowWindow(SW_HIDE); + pDocker->SetStyle(WS_CHILD); + pDocker->SetDockStyle(dockStyle); + pDocker->SetParent(*this); + pDocker->GetDockBar().SetParent(*GetDockAncestor()); + + // Insert the containers in reverse order. + for (ContainerInfo& ci : allContainers) + { + pContainer->AddContainer(ci.pContainer, TRUE, selectPage); + } + } + + // Redraw the docked windows. + pDocker->RecalcDockLayout(); + } + + // Docks the specified docker inside the dock ancestor. + inline void CDocker::DockOuter(CDocker* pDocker, DWORD dockStyle) + { + assert(pDocker); + if (!pDocker) return; + + pDocker->m_pDockParent = GetDockAncestor(); + + DWORD outerDocking = dockStyle & 0xF0000; + DWORD dockSide = outerDocking / 0x10000; + dockStyle &= 0xFFF0FFFF; + dockStyle |= dockSide; + + // Set the dock styles + DWORD style = WS_CHILD | WS_VISIBLE; + pDocker->SetStyle(style); + pDocker->ShowWindow(SW_HIDE); + pDocker->SetDockStyle(dockStyle); + + // Set the docking relationships. + auto it = GetDockAncestor()->m_dockChildren.begin(); + GetDockAncestor()->m_dockChildren.insert(it, pDocker); + pDocker->SetParent(*GetDockAncestor()); + pDocker->GetDockBar().SetParent(*GetDockAncestor()); + + // Limit the docked size to half the parent's size if it won't fit inside parent. + if (((dockStyle & 0xF) == DS_DOCKED_LEFT) || ((dockStyle &0xF) == DS_DOCKED_RIGHT)) + { + int width = GetDockAncestor()->GetDockClient().GetWindowRect().Width(); + int barWidth = pDocker->GetBarWidth(); + if (pDocker->m_dockStartSize >= (width - barWidth)) + pDocker->SetDockSize(std::max(width/2 - barWidth, barWidth)); + } + else + { + int height = GetDockAncestor()->GetDockClient().GetWindowRect().Height(); + int barWidth = pDocker->GetBarWidth(); + if (pDocker->m_dockStartSize >= (height - barWidth)) + pDocker->SetDockSize(std::max(height/2 - barWidth, barWidth)); + } + + // Redraw the docked windows. + if (GetAncestor().IsWindowVisible()) + { + GetTopmostDocker()->SetForegroundWindow(); + + // Give the view window focus unless its child already has it. + if (!pDocker->GetView().IsChild(GetFocus())) + pDocker->GetView().SetFocus(); + + GetTopmostDocker()->SetRedraw(FALSE); + pDocker->SetDefaultCaptionHeight(); + RecalcDockLayout(); + GetTopmostDocker()->SetRedraw(TRUE); + GetTopmostDocker()->RedrawWindow(); + + // Update the Dock captions. + GetDockAncestor()->PostMessage(UWM_DOCKACTIVATE); + } + } + + // Updates the view for all dockers in this dock family. + // Call this when the DPI changes. + inline void CDocker::DpiUpdateDockerSizes() + { + std::vector v(m_allDockers.begin(), m_allDockers.end()); + for (CDocker* docker : v) + { + if (docker->IsWindow() && (docker->GetTopmostDocker() == this)) + { + // Reset the docker size. + int size = (docker->GetDockSize() * GetWindowDpi(*GetTopmostDocker())) / + GetTopmostDocker()->m_oldDpi; + docker->SetDockSize(size); + } + } + + GetTopmostDocker()->m_oldDpi = GetWindowDpi(*GetTopmostDocker()); + RecalcDockLayout(); + } + + // Draws all the captions. + inline void CDocker::DrawAllCaptions() const + { + for (CDocker* pDocker : GetAllDockers()) + { + if (pDocker->IsDocked() || pDocker == GetDockAncestor()) + pDocker->GetDockClient().DrawCaption(); + } + } + + // Static callback function to enumerate top level dockers excluding + // the one being dragged. Top level windows are enumerated in Z order. + inline BOOL CALLBACK CDocker::EnumWindowsProc(HWND top, LPARAM lparam) + { + CDocker* pThis = reinterpret_cast(lparam); + assert(dynamic_cast(pThis)); + if (!pThis) return FALSE; + + CPoint pt = pThis->m_dockPoint; + + // Update top if the DockAncestor is a child of the top level window. + if (::IsChild(top, pThis->GetDockAncestor()->GetHwnd())) + top = pThis->GetDockAncestor()->GetHwnd(); + + // Assign this docker's m_dockUnderPoint. + pThis->m_dockUnderPoint = nullptr; + if (pThis->IsRelated(top) && top != pThis->GetHwnd()) + { + CRect rc; + VERIFY(::GetWindowRect(top, &rc)); + if (rc.PtInRect(pt)) + { + pThis->m_dockUnderPoint = top; + return FALSE; // Stop enumerating. + } + } + + return TRUE; // Continue enumerating. + } + + // Returns the docker that has a child window with keyboard focus. + // The active docker's caption is drawn with a different color. + inline CDocker* CDocker::GetActiveDocker() const + { + CDocker* pDockActive = nullptr; + HWND test = ::GetFocus(); + + while (test != nullptr) + { + HWND parent = ::GetParent(test); + if (parent == test) break; // Might be owned window, not parent. + test = parent; + + CDocker* pDock = reinterpret_cast(::SendMessage(test, UWM_GETCDOCKER, 0, 0)); + if (pDock) + { + pDockActive = pDock; + break; + } + } + + return pDockActive; + } + + // Returns a Docker's active view. Returns the container's active view for a docker with + // a DockContainer, returns the the active MDI child for a docker with a TabbedMDI, + // or the docker's view for a simple docker. Can return nullptr. + inline CWnd* CDocker::GetActiveView() const + { + CWnd* pView; + if (GetContainer()) + pView = GetContainer()->GetActiveView(); + else if (GetTabbedMDI()) + pView = GetTabbedMDI()->GetActiveMDIChild(); + else + pView = &GetView(); + + return pView; + } + + // Returns a pointer to the view if it is a CDockContainer. + // Returns nullptr if the view is not a CDockContainer. + // Returns nullptr if the docker or it's view are not created. + inline CDockContainer* CDocker::GetContainer() const + { + // returns nullptr if not a CDockContainer* + if (IsWindow() && GetView().IsWindow()) + return reinterpret_cast(GetView().SendMessage(UWM_GETCDOCKCONTAINER)); + + return nullptr; + } + + // The GetDockAncestor function retrieves the pointer to the + // ancestor (root docker parent) of the docker. + inline CDocker* CDocker::GetDockAncestor() const + { + return m_pDockAncestor; + } + + // Returns the docker that has the specified Dock ID. + inline CDocker* CDocker::GetDockFromID(int dockID) const + { + if (GetDockAncestor()) + { + for (const DockPtr& ptr : GetAllChildren()) + { + if (dockID == ptr->GetDockID()) + return ptr.get(); + } + } + + return 0; + } + + // Returns the child docker that has the specified view. + inline CDocker* CDocker::GetDockFromView(CWnd* pView) const + { + CDocker* pDocker = nullptr; + for (const DockPtr& dockPtr : GetAllChildren()) + { + if (&dockPtr->GetView() == pView) + pDocker = dockPtr.get(); + } + + if (&GetDockAncestor()->GetView() == pView) + pDocker = GetDockAncestor(); + + return pDocker; + } + + // Returns the size of the docker to be used if it is redocked. + // Note: This function returns 0 if the docker has the DS_DOCKED_CONTAINER style. + inline int CDocker::GetDockSize() const + { + return m_dockStartSize; + } + + // Retrieves the Docker whose view window contains the specified point. + // Used when dragging undocked dockers over other dockers to provide + // the docker that needs to display the dock targets and dock hints. + inline CDocker* CDocker::GetDockUnderDragPoint(POINT pt) + { + // Step 1: Find the top level Docker under the point. + // EnumWindows assigns the Docker under the point to m_dockUnderPoint. + + m_dockPoint = pt; + EnumWindows(EnumWindowsProc, reinterpret_cast(this)); + + // Step 2: Find the docker child whose view window has the point. + CDocker* pDockTarget = nullptr; + + HWND dockTest = m_dockUnderPoint; + HWND dockParent = m_dockUnderPoint; + + if (m_dockUnderPoint != nullptr) + { + while (IsRelated(dockTest)) + { + dockParent = dockTest; + CPoint ptLocal = pt; + VERIFY(::ScreenToClient(dockParent, &ptLocal)); + dockTest = ::ChildWindowFromPoint(dockParent, ptLocal); + if (dockTest == dockParent) break; + } + + CDocker* pDockParent = reinterpret_cast + (::SendMessage(dockParent, UWM_GETCDOCKER, 0, 0)); + assert(pDockParent); + + CRect rc = pDockParent->GetDockClient().GetWindowRect(); + if (rc.PtInRect(pt)) + pDockTarget = pDockParent; + } + + return pDockTarget; + } + + // Retrieve the DPI of the monitor the window is on. This usually provides + // the same value as the GetWindowDpi function, but not when the user + // changes DPI settings manually and a WM_SETTINGCHANGE message is sent. + // This function uses the GetDpiForMonitor function. + inline int CDocker::GetMonitorDpi(HWND wnd) + { + // Retrieve window's default dpi as a fallback. + CClientDC clientDC(wnd); + int dpi = GetDeviceCaps(clientDC, LOGPIXELSX); + + // Retrieve the monitor's dpi if we can. + using PGETDPIFORMONITOR = HRESULT (WINAPI*)(HMONITOR hmonitor, + int dpiType, UINT* dpiX, UINT* dpiY); + HMODULE shcore = ::GetModuleHandle(_T("shcore")); + if (shcore) + { + PGETDPIFORMONITOR pGetDpiForMonitor = reinterpret_cast( + reinterpret_cast(::GetProcAddress(shcore, "GetDpiForMonitor"))); + + if (pGetDpiForMonitor) + { + HMONITOR hMonitor = ::MonitorFromWindow(wnd, MONITOR_DEFAULTTOPRIMARY); + UINT dpiX; + UINT dpiY; + HRESULT hr = pGetDpiForMonitor(hMonitor, 0, &dpiX, &dpiY); + if (SUCCEEDED(hr)) + { + dpi = static_cast(dpiX); + } + } + } + + return dpi; + } + + // Returns the pointer to the view window if it is a CTabbedMDI. + // Returns nullptr if not a CTabbedMDI. + inline CTabbedMDI* CDocker::GetTabbedMDI() const + { + // Returns nullptr if not a CTabbedMDI*. + if (IsWindow()) + return reinterpret_cast(GetView().SendMessage(UWM_GETCTABBEDMDI)); + + return nullptr; + } + + // Retrieves the text height for the caption. + inline int CDocker::GetTextHeight() + { + int dpi = GetWindowDpi(*this); + NONCLIENTMETRICS info = GetNonClientMetrics(); + LOGFONT lf = info.lfStatusFont; + lf.lfHeight = -MulDiv(9, dpi, POINTS_PER_INCH); + + CClientDC dc(*this); + dc.CreateFontIndirect(lf); + CSize textSize = dc.GetTextExtentPoint32(_T("Text"), lstrlen(_T("Text"))); + return textSize.cy; + } + + // Returns the docker's parent at the top of the Z order. + // Could be the dock ancestor or an undocked docker. + inline CDocker* CDocker::GetTopmostDocker() const + { + CDocker* pDockTopLevel = (CDocker* const)this; + + while (pDockTopLevel->GetDockParent()) + { + assert(pDockTopLevel != pDockTopLevel->GetDockParent()); + pDockTopLevel = pDockTopLevel->GetDockParent(); + } + + return pDockTopLevel; + } + + // Undocks a docker (if needed) and hides it. + // To unhide the docker, dock it. + inline void CDocker::Hide() + { + if (IsDocked()) + { + CDockContainer* pContainer = GetContainer(); + + if (pContainer) + { + if (pContainer == pContainer->GetContainerParent()) + UndockContainer(pContainer, GetCursorPos(), FALSE); + else + pContainer->GetContainerParent()->RemoveContainer(pContainer, FALSE); + } + else + { + CDocker* pDockUndockedFrom = SeparateFromDock(); + pDockUndockedFrom->RecalcDockLayout(); + } + } + + ShowWindow(SW_HIDE); + RecalcDockLayout(); + } + + // Returns true if the specified window is a descendant of this docker. + inline BOOL CDocker::IsChildOfDocker(HWND wnd) const + { + while ((wnd != nullptr) && (wnd != *GetDockAncestor())) + { + if ( wnd == *this ) return TRUE; + wnd = ::GetParent(wnd); + } + + return FALSE; + } + + // Returns TRUE if this docker is docked. + inline BOOL CDocker::IsDocked() const + { + return (((m_dockStyle&0xF) || (m_dockStyle & DS_DOCKED_CONTAINER)) && !m_isUndocking); // Boolean expression + } + + // Returns TRUE if the wnd is a docker within this dock family. + inline BOOL CDocker::IsRelated(HWND wnd) const + { + if (*GetDockAncestor() == wnd) return TRUE; + + for (const DockPtr& dockPtr : GetAllChildren()) + { + if (dockPtr.get()->GetHwnd() == wnd) return TRUE; + } + + return FALSE; + } + + // Returns TRUE if the docker is docked, or is a dock ancestor that + // has a CDockContainer with tabs. + inline BOOL CDocker::IsUndockable() const + { + BOOL isUndockable = IsDocked(); + + CDockContainer* pContainer = GetContainer(); + if (this == GetDockAncestor()) + { + if (pContainer && (pContainer->GetItemCount() > 0)) + isUndockable = TRUE; + } + + return isUndockable; + } + + // Returns TRUE if the docker is undocked. + inline BOOL CDocker::IsUndocked() const + { + return (!((m_dockStyle&0xF)|| (m_dockStyle & DS_DOCKED_CONTAINER)) && !m_isUndocking); + } + + // Loads the information for CDockContainers from the registry. + inline BOOL CDocker::LoadContainerRegistrySettings(LPCTSTR registryKeyName) + { + BOOL isLoaded = FALSE; + if (registryKeyName) + { + isLoaded = TRUE; + + // Load Dock container tab order and active container. + const CString dockSettings = _T("\\Dock Settings"); + const CString dockKeyName = _T("Software\\") + CString(registryKeyName) + dockSettings; + CRegKey settingsKey; + + try + { + if (ERROR_SUCCESS != settingsKey.Open(HKEY_CURRENT_USER, dockKeyName, KEY_READ)) + throw CUserException(); + + UINT container = 0; + CString dockContainerName; + dockContainerName.Format(_T("DockContainer%u"), container); + CRegKey containerKey; + + while (ERROR_SUCCESS == containerKey.Open(settingsKey, dockContainerName, KEY_READ)) + { + // Load tab order + isLoaded = TRUE; + UINT tabNumber = 0; + DWORD tabID; + std::vector tabOrder; + CString tabKeyName; + tabKeyName.Format(_T("Tab%u"), tabNumber); + while (ERROR_SUCCESS == containerKey.QueryDWORDValue(tabKeyName, tabID)) + { + tabOrder.push_back(tabID); + tabKeyName.Format(_T("Tab%u"), ++tabNumber); + } + + // Set tab order. + DWORD parentID; + if (ERROR_SUCCESS == containerKey.QueryDWORDValue(_T("Parent Container"), parentID)) + { + CDocker* pDocker = GetDockFromID(static_cast(parentID)); + if (!pDocker) + pDocker = this; + + CDockContainer* pParentContainer = pDocker->GetContainer(); + if (!pParentContainer) + throw CUserException(); + + for (UINT tab = 0; tab < tabOrder.size(); ++tab) + { + CDocker* pOldDocker = GetDockFromView(pParentContainer->GetContainerFromIndex(tab)); + if (!pOldDocker) + throw CUserException(); + + UINT oldID = static_cast(pOldDocker->GetDockID()); + + auto it = std::find(tabOrder.begin(), tabOrder.end(), oldID); + UINT oldTab = static_cast(it - tabOrder.begin()); + + if (tab >= pParentContainer->GetAllContainers().size()) + throw CUserException(); + + if (oldTab >= pParentContainer->GetAllContainers().size()) + throw CUserException(); + + if (tab != oldTab) + pParentContainer->SwapTabs(static_cast(tab), static_cast(oldTab)); + } + } + + // Set the active container. + DWORD activeContainer; + if (ERROR_SUCCESS == containerKey.QueryDWORDValue(_T("Active Container"), activeContainer)) + { + CDocker* pDocker = GetDockFromID(static_cast(activeContainer)); + if (pDocker) + { + CDockContainer* pContainer = pDocker->GetContainer(); + if (!pContainer) + throw CUserException(); + + int page = pContainer->GetContainerIndex(pContainer); + if (page >= 0) + pContainer->SelectPage(page); + } + } + + dockContainerName.Format(_T("DockContainer%u"), ++container); + } + } + + catch (const CUserException&) + { + TRACE("*** WARNING: Failed to load dock containers from registry. ***\n"); + CloseAllDockers(); + + // Delete the bad key from the registry. + const CString appKeyName = _T("Software\\") + CString(registryKeyName); + CRegKey appKey; + if (ERROR_SUCCESS == appKey.Open(HKEY_CURRENT_USER, appKeyName, KEY_READ)) + appKey.RecurseDeleteKey(dockSettings); + } + } + + return isLoaded; + } + + // Recreates the docker layout based on information stored in the registry. + // Assumes the DockAncestor window is already created. + inline BOOL CDocker::LoadDockRegistrySettings(LPCTSTR registryKeyName) + { + BOOL isLoaded = FALSE; + + if (registryKeyName) + { + isLoaded = TRUE; + std::list dockList; + const CString dockSettings = _T("\\Dock Settings"); + const CString dockKeyName = _T("Software\\") + CString(registryKeyName) + dockSettings; + CRegKey settingsKey; + + try + { + if (ERROR_SUCCESS != settingsKey.Open(HKEY_CURRENT_USER, dockKeyName, KEY_READ)) + throw CUserException(); + + DWORD bufferSize = sizeof(DockInfo); + DockInfo info; + int i = 0; + CString dockChildName; + dockChildName.Format(_T("DockChild%d"), i); + + // Fill the DockList vector from the registry. + while (ERROR_SUCCESS == settingsKey.QueryBinaryValue(dockChildName, &info, &bufferSize)) + { + dockList.push_back(info); + i++; + dockChildName.Format(_T("DockChild%d"), i); + } + + if (dockList.size() > 0) + isLoaded = TRUE; + + // Add the dock ancestor's style. + DWORD style; + if (ERROR_SUCCESS != settingsKey.QueryDWORDValue(_T("DockAncestor"), style)) + throw CUserException(); + + SetDockStyle(style); + + // Add dockers without parents first. + for (const DockInfo& di : dockList) + { + if ((di.dockParentID == 0) || (di.isInAncestor)) + { + DockPtr docker = NewDockerFromID(di.dockID); + CDocker* pDocker = docker.get(); + if (!pDocker) + throw CUserException(); + + if ((di.dockStyle & 0xF) || (di.isInAncestor)) + AddDockedChild(std::move(docker), di.dockStyle, + di.dockSize, di.dockID); + else + AddUndockedChild(std::move(docker), di.dockStyle, + di.dockSize, di.rect, di.dockID, di.isHidden); + } + } + + // Remove dockers without parents from dockList. + auto it = dockList.begin(); + while (it != dockList.end()) + { + if (((*it).dockParentID == 0) || ((*it).isInAncestor)) + it = dockList.erase(it); + else + ++it; + } + + // Add remaining dockers + while (dockList.size() > 0) + { + bool found = false; + for (it = dockList.begin(); it != dockList.end(); ++it) + { + DockInfo di = *it; + CDocker* pDockParent = GetDockFromID(di.dockParentID); + + if (pDockParent != nullptr) + { + DockPtr docker = NewDockerFromID(di.dockID); + if (docker.get() == nullptr) + throw CUserException(); + + pDockParent->AddDockedChild(std::move(docker), + di.dockStyle, di.dockSize, di.dockID); + found = true; + dockList.erase(it); + break; + } + } + + if (!found) + throw CUserException(); + + if (!VerifyDockers()) + throw CUserException(); + } + } + + catch (const CUserException&) + { + TRACE("*** WARNING: Failed to load dockers from registry. ***\n"); + isLoaded = FALSE; + CloseAllDockers(); + + // Delete the bad key from the registry. + const CString appKeyName = _T("Software\\") + CString(registryKeyName); + CRegKey appKey; + if (ERROR_SUCCESS == appKey.Open(HKEY_CURRENT_USER, appKeyName, KEY_READ)) + appKey.RecurseDeleteKey(dockSettings); + } + } + + if (isLoaded) + LoadContainerRegistrySettings(registryKeyName); + + return isLoaded; + } + + // Used internally by Dock and Undock. + inline void CDocker::MoveDockChildren(CDocker* pDockTarget) + { + assert(pDockTarget); + if (!pDockTarget) return; + + // Transfer any dock children from the current docker to the target docker. + for (CDocker* pDocker : m_dockChildren) + { + pDockTarget->m_dockChildren.push_back(pDocker); + pDocker->m_pDockParent = pDockTarget; + pDocker->SetParent(*pDockTarget); + pDocker->GetDockBar().SetParent(*pDockTarget); + } + m_dockChildren.clear(); + } + + // Used in LoadRegistrySettings. Creates a new Docker from the specified ID. + // Returns a unique_ptr. + inline DockPtr CDocker::NewDockerFromID(int /*id*/) + { + // Override this function to create the Docker objects as shown below. + + DockPtr docker; + /* switch(id) + { + case ID_CLASSES: + docker = std::make_unique(); + break; + case ID_FILES: + docker = std::make_unique(); + break; + default: + TRACE("Unknown Dock ID\n"); + break; + } */ + + return docker; + } + + // Called when the this docker is activated. + inline LRESULT CDocker::OnActivate(UINT, WPARAM wparam, LPARAM) + { + if ((this != GetDockAncestor()) && IsUndocked()) + { + GetDockAncestor()->PostMessage(UWM_DOCKACTIVATE); + + // Give the view window focus unless its child already has it. + if ((wparam != WA_INACTIVE) && !GetView().IsChild(GetFocus())) + GetView().SetFocus(); + } + + return 0; + } + + // Called when splitter bar move has ended. + inline LRESULT CDocker::OnBarEnd(DragPos* pDragPos) + { + POINT pt = pDragPos->pos; + VERIFY(ScreenToClient(pt)); + + ResizeDockers(pDragPos); + return 0; + } + + // Called when the splitter bar is moved. + inline LRESULT CDocker::OnBarMove(DragPos* pDragPos) + { + CPoint pt = pDragPos->pos; + VERIFY(ScreenToClient(pt)); + + if (pt != m_oldPoint) + { + ResizeDockers(pDragPos); + m_oldPoint = pt; + } + + return 0; + } + + // Begin moving the splitter bar. + inline LRESULT CDocker::OnBarStart(DragPos* pDragPos) + { + CPoint pt = pDragPos->pos; + VERIFY(ScreenToClient(pt)); + m_oldPoint = pt; + + return 0; + } + + // Called when the close button is pressed. + inline void CDocker::OnClose() + { + m_isClosing = TRUE; + + if (IsDocked()) + { + // Undock the docker and hide it. + Hide(); + } + + // Destroy the docker and its children. + Destroy(); + } + + // Called when this docker is created. + inline int CDocker::OnCreate(CREATESTRUCT&) + { + if (GetParent().GetExStyle() & WS_EX_LAYOUTRTL) + { + DWORD exStyle = static_cast(GetExStyle()); + SetExStyle(exStyle | WS_EX_LAYOUTRTL); + } + + // Create the various child windows. + GetDockClient().Create(*this); + + assert(&GetView()); // Use SetView in the docker's constructor to set the view window. + GetView().Create(GetDockClient()); + + // Create the slider bar belonging to this docker. + GetDockBar().SetDocker(this); + if (GetDockAncestor() != this) + GetDockBar().Create(*GetDockAncestor()); + + // Now remove the WS_POPUP style. It was required to allow this window + // to be owned by the frame window. + SetStyle(WS_CHILD); + SetParent(GetParent()); // Reinstate the window's parent. + + // Set the default color for the splitter bar if it hasn't already been set. + if (!GetDockBar().GetBrushBkgnd().GetHandle()) + { + COLORREF rgbColour = GetSysColor(COLOR_BTNFACE); + HWND frame = GetDockAncestor()->GetAncestor(); + + ReBarTheme* pTheme = reinterpret_cast + (::SendMessage(frame, UWM_GETRBTHEME, 0, 0)); + + if (pTheme && pTheme->UseThemes && pTheme->clrBkgnd2 != 0) + rgbColour = pTheme->clrBkgnd2; + + SetBarColor(rgbColour); + } + + // Set the caption height based on text height. + SetDefaultCaptionHeight(); + + CDockContainer* pContainer = GetContainer(); + if (pContainer) + { + SetCaption(pContainer->GetDockCaption().c_str()); + } + + return 0; + } + + // Called when the window is about to be destroyed. + inline void CDocker::OnDestroy() + { + // Destroy any dock children first + for (CDocker* pDocker : m_dockChildren) + { + pDocker->Destroy(); + } + + CDockContainer* pContainer = GetContainer(); + if (pContainer && IsUndocked()) + { + if (pContainer->GetAllContainers().size() > 1) + { + // This container has children, so destroy them now. + for (const ContainerInfo& ci : pContainer->GetAllContainers()) + { + if (ci.pContainer != pContainer) + { + // Reset container parent before destroying the dock window. + CDocker* pDocker = GetDockFromView(ci.pContainer); + assert(pDocker); + if (pDocker) + { + if (pContainer->IsWindow()) + pContainer->SetParent(pDocker->GetDockClient()); + + pDocker->Destroy(); + } + } + } + } + } + + GetDockBar().Destroy(); + + if (this == GetDockAncestor()) + { + m_dockChildren.clear(); + m_allDockers.clear(); + m_allDockChildren.clear(); + } + else + { + // Post a docker destroyed message. + if (GetDockAncestor()->IsWindow()) + GetDockAncestor()->PostMessage(UWM_DOCKDESTROYED, + reinterpret_cast(this), 0); + } + } + + // Called in response to a UWM_DOCKACTIVATE message. + inline LRESULT CDocker::OnDockActivated(UINT, WPARAM, LPARAM) + { + // Redraw captions to take account of focus change + if (this == GetDockAncestor()) + DrawAllCaptions(); + + return 0; + } + + // Called when this docker is destroyed. + inline LRESULT CDocker::OnDockDestroyed(UINT, WPARAM wparam, LPARAM) + { + CDocker* pDocker = reinterpret_cast(wparam); + + assert( this == GetDockAncestor() ); + for (auto it = GetAllChildren().begin(); it != GetAllChildren().end(); ++it) + { + if ((*it).get() == pDocker) + { + GetAllChildren().erase(it); + break; + } + } + + std::deque& dockers = GetDockAncestor()->m_allDockers; + for (auto it = dockers.begin(); it != dockers.end(); ++it) + { + if ((*it) == pDocker) + { + dockers.erase(it); + break; + } + } + + return 0; + } + + // Completes the docking. Docks the window on the dock target (if any). + inline LRESULT CDocker::OnDockEnd(DragPos* pDragPos) + { + CDocker* pDocker = pDragPos->pDocker; + assert(pDocker); + if (!pDocker) return 0; + + UINT dockZone = pDragPos->dockZone; + CRect rc = pDocker->GetWindowRect(); + + switch (dockZone) + { + case DS_DOCKED_LEFT: + case DS_DOCKED_RIGHT: + pDocker->SetDockSize(rc.Width()); + Dock(pDocker, pDocker->GetDockStyle() | dockZone); + break; + case DS_DOCKED_TOP: + case DS_DOCKED_BOTTOM: + pDocker->SetDockSize(rc.Height()); + Dock(pDocker, pDocker->GetDockStyle() | dockZone); + break; + case DS_DOCKED_CONTAINER: + { + CDockContainer* pContainer = GetContainer(); + assert(pContainer); + if (pContainer) + { + CDockContainer* pCurrent = pDocker->GetContainer(); + assert(pCurrent); + if (pCurrent) + { + CDockContainer* pActive = pCurrent->GetActiveContainer(); + DockInContainer(pDocker, pDocker->GetDockStyle() | dockZone, FALSE); + if (pActive) + pContainer->SetActiveContainer(pActive); + else + pContainer->SelectPage(0); + } + } + } + break; + case DS_DOCKED_LEFTMOST: + case DS_DOCKED_RIGHTMOST: + pDocker->SetDockSize(rc.Width()); + DockOuter(pDocker, pDocker->GetDockStyle() | dockZone); + break; + case DS_DOCKED_TOPMOST: + case DS_DOCKED_BOTTOMMOST: + pDocker->SetDockSize(rc.Height()); + DockOuter(pDocker, pDocker->GetDockStyle() | dockZone); + break; + } + + GetDockHint().Destroy(); + CloseAllTargets(); + + return 0; + } + + // Performs the docking move. + inline LRESULT CDocker::OnDockMove(DragPos* pDragPos) + { + CheckAllTargets(pDragPos); + return 0; + } + + // Starts the undocking. + inline LRESULT CDocker::OnDockStart(DragPos* pDragPos) + { + if (IsDocked() && !(GetDockStyle() & DS_NO_UNDOCK)) + { + Undock(GetCursorPos()); + WPARAM wparam = static_cast(HTCAPTION); + LPARAM lparam = MAKELPARAM(pDragPos->pos.x, pDragPos->pos.y); + SendMessage(WM_NCLBUTTONDOWN, wparam, lparam); + } + + return 0; + } + + // Called in response to a WM_DPICHANGED message that is sent to a top-level + // window when the DPI changes. + // Only top-level windows receive a WM_DPICHANGED message, so this message is + // handled when an undocked docker is moved between monitors. + inline LRESULT CDocker::OnDpiChanged(UINT, WPARAM, LPARAM lparam) + { + if (IsUndocked()) // Ignore dockers currently being undocked. + { + // An undocked docker has moved to a different monitor. + LPRECT prc = reinterpret_cast(lparam); + SetRedraw(FALSE); + SetWindowPos(HWND_TOP, *prc, SWP_SHOWWINDOW); + SetRedraw(TRUE); + RedrawWindow(); + } + + return 0; + } + + // Called in response to a WM_DPICHANGED_BEFOREPARENT message that is sent to child + // windows after a DPI change. A WM_DPICHANGED_BEFOREPARENT is only received when the + // application is DPI_AWARENESS_PER_MONITOR_AWARE. + inline LRESULT CDocker::OnDpiChangedBeforeParent(UINT, WPARAM, LPARAM) + { + SetDefaultCaptionHeight(); + + // Reset the docker size. + if (GetDockAncestor() != GetTopmostDocker()) + m_dockStartSize = m_dockStartSize * GetTopmostDocker()->m_newDpi / + GetTopmostDocker()->m_oldDpi; + + return 0; + } + + // Called when docker resizing is complete. + inline LRESULT CDocker::OnExitSizeMove(UINT, WPARAM, LPARAM) + { + m_isDragging = FALSE; + SendNotify(UWN_DOCKEND); + + return 0; + } + + // Called before the window's DPI change is processed. + inline LRESULT CDocker::OnGetDpiScaledSize(UINT, WPARAM wparam, LPARAM) + { + // Update the grab point with the DPI changes. + m_oldDpi = GetWindowDpi(*this); + m_newDpi = static_cast(wparam); + + // Return FALSE to indicate computed size isn't modified. + return FALSE; + } + + // Called when the window is activated with a mouse click. + inline LRESULT CDocker::OnMouseActivate(UINT, WPARAM, LPARAM) + { + CPoint pt = GetCursorPos(); + + if (PtInRect(GetDockClient().GetWindowRect(), pt)) // only for this docker. + { + GetDockAncestor()->PostMessage(UWM_DOCKACTIVATE); + } + + return 0; // Return 0 to stop propagating this message to parent windows. + } + + // Called with a left mouse button double click on the non-client area. + inline LRESULT CDocker::OnNCLButtonDblClk(UINT msg, WPARAM wparam, LPARAM lparam) + { + m_isDragging = FALSE; + return FinalWindowProc(msg, wparam, lparam); + } + + // Process docker notifications, + inline LRESULT CDocker::OnNotify(WPARAM, LPARAM lparam) + { + DragPos* pdp = (DragPos*)lparam; + + if (IsWindowVisible()) + { + LPNMHDR pHeader = reinterpret_cast(lparam); + switch (pHeader->code) + { + case UWN_BARSTART: return OnBarStart(pdp); + case UWN_BARMOVE: return OnBarMove(pdp); + case UWN_BAREND: return OnBarEnd(pdp); + case UWN_DOCKSTART: return OnDockStart(pdp); + case UWN_DOCKMOVE: return OnDockMove(pdp); + case UWN_DOCKEND: return OnDockEnd(pdp); + } + } + + return 0; + } + + // Called when the SystemParametersInfo function changes a system-wide + // setting or when policy settings (including display settings) have changed. + inline LRESULT CDocker::OnSettingChange(UINT, WPARAM, LPARAM) + { + if (this == GetTopmostDocker()) + { + SetRedraw(FALSE); + int newDPI = GetMonitorDpi(*this); + int oldDPI = GetWindowDpi(*this); + + if (newDPI != oldDPI) + { + m_newDpi = newDPI; + m_oldDpi = newDPI; + + for (const DockPtr& ptr : GetAllDockChildren()) + { + if (ptr->IsWindow() && IsChildOfDocker(ptr->GetHwnd())) + { + int size = (ptr->m_dockStartSize * newDPI) / oldDPI; + ptr->SetDockSize(size); + } + } + + CRect rc = GetWindowRect(); + int width = (rc.Width() * newDPI) / oldDPI; + int height = (rc.Height() * newDPI) / oldDPI; + rc.right = rc.left + width; + rc.bottom = rc.top + height; + SetWindowPos(HWND_TOP, rc, SWP_FRAMECHANGED | SWP_SHOWWINDOW); + } + + RecalcDockLayout(); + SetRedraw(TRUE); + RedrawWindow(); + } + return 0; + } + + // Called when the docker is resized. + inline LRESULT CDocker::OnSize(UINT, WPARAM, LPARAM) + { + if (this == GetTopmostDocker()) + { + // Reposition the dock children. + if (IsUndocked() && IsWindowVisible() && !m_isClosing) + RecalcDockLayout(); + } + + return 0; + } + + // Called when the system colors are changed. + inline LRESULT CDocker::OnSysColorChange(UINT msg, WPARAM wparam, LPARAM lparam) + { + if (this == GetDockAncestor()) + { + COLORREF color = GetSysColor(COLOR_BTNFACE); + HWND frame = GetDockAncestor()->GetAncestor(); + + ReBarTheme* pTheme = reinterpret_cast(::SendMessage( + frame, UWM_GETRBTHEME, 0, 0)); + + if (pTheme && pTheme->UseThemes && pTheme->clrBand2 != 0) + color = pTheme->clrBkgnd2; + else + color = GetSysColor(COLOR_BTNFACE); + + // Set the splitter bar color for each docker descendant. + for (const DockPtr& dockPtr : GetAllChildren()) + dockPtr->SetBarColor(color); + + // Set the splitter bar color for the docker ancestor. + SetBarColor(color); + } + + return FinalWindowProc(msg, wparam, lparam); + } + + // Called in response to a system command (docker window is moved or closed). + inline LRESULT CDocker::OnSysCommand(UINT msg, WPARAM wparam, LPARAM lparam) + { + // The "wparam & 0xFFF0" below is a requirement mentioned in the + // description of WM_SYSCOMMAND in the Windows API documentation. + + switch(wparam & 0xFFF0) + { + case SC_MOVE: + // An undocked docker is being moved. + { + UINT isEnabled = FALSE; + m_isDragging = TRUE; + SetCursor(LoadCursor(nullptr, IDC_ARROW)); + VERIFY(::SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &isEnabled, 0)); + + // Turn on DragFullWindows for this move. + VERIFY(::SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, TRUE, 0, 0)); + + // Process this message. + DefWindowProc(WM_SYSCOMMAND, wparam, lparam); + + // Return DragFullWindows to its previous state. + VERIFY(::SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, isEnabled, 0, 0)); + return 0; + } + default: + break; + } + return FinalWindowProc(msg, wparam, lparam); + } + + // Called after the docker is moved or resized. + inline LRESULT CDocker::OnWindowPosChanged(UINT msg, WPARAM wparam, LPARAM lparam) + { + if (m_isDragging) + { + // Send a Move notification to the parent. + if (IsLeftButtonDown()) + { + LPWINDOWPOS wPos = (LPWINDOWPOS)lparam; + if (!(wPos->flags & SWP_NOMOVE)) + SendNotify(UWN_DOCKMOVE); + } + else + { + CloseAllTargets(); + } + } + + return FinalWindowProc(msg, wparam, lparam); + } + + // Set the CREATESTURCT parameters before the window is created + inline void CDocker::PreCreate(CREATESTRUCT& cs) + { + // Call base class function to set defaults. + CWnd::PreCreate(cs); + + // Specify the WS_POPUP style to have this window owned. + if (this != GetDockAncestor()) + cs.style |= WS_POPUP; + + cs.style |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS; + cs.dwExStyle |= WS_EX_TOOLWINDOW; + } + + inline void CDocker::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = _T("Win32++ Docker"); + wc.hCursor = ::LoadCursor(nullptr, IDC_ARROW); + } + + // One of the steps required for undocking. + inline void CDocker::PromoteFirstChild() + { + // Promote our first child to replace ourself. + if (m_pDockParent) + { + std::deque& children = m_pDockParent->m_dockChildren; + + for (auto it = children.begin(); it != children.end(); ++it) + { + if ((*it) == this) + { + if (m_dockChildren.size() > 0) + // Swap our first child for ourself as a child of the parent. + (*it) = m_dockChildren[0]; + else + // Remove ourself as a child of the parent. + children.erase(it); + + // Done. + break; + } + } + } + + // Transfer styles and data and children to the child docker. + CDocker* pDockFirstChild = nullptr; + if (m_dockChildren.size() > 0) + { + pDockFirstChild = m_dockChildren[0]; + pDockFirstChild->m_dockStyle = (pDockFirstChild->m_dockStyle & + 0xFFFFFFF0) | (m_dockStyle & 0xF); + pDockFirstChild->m_dockStartSize = m_dockStartSize; + + if (m_pDockParent) + { + pDockFirstChild->m_pDockParent = m_pDockParent; + pDockFirstChild->SetParent(*m_pDockParent); + pDockFirstChild->GetDockBar().SetParent(*m_pDockParent); + } + else + { + for (auto it = m_dockChildren.begin() + 1; it != m_dockChildren.end(); ++it) + (*it)->ShowWindow(SW_HIDE); + + pDockFirstChild->ConvertToPopup(GetWindowRect(), TRUE); + pDockFirstChild->GetDockBar().ShowWindow(SW_HIDE); + } + + m_dockChildren.erase(m_dockChildren.begin()); + MoveDockChildren(pDockFirstChild); + } + } + + // Called by RecalcDockLayout to reposition child dockers. + inline void CDocker::RecalcDockChildLayout(CRect& rc) + { + // This function positions the Docker's dock children, the Dockers client area + // and draws the dockbar bars. + + // Notes: + // 1) This function is called recursively. + // 2) The client area and child dockers are positioned simultaneously + // with DeferWindowPos to avoid drawing errors in complex docker + // arrangements. + // 3) The docker's client area contains the docker's caption (if any) + // and the docker's view window. + + // Note: All top level dockers are undocked, including the dock ancestor. + + bool isRTL = false; + isRTL = ((GetExStyle() & WS_EX_LAYOUTRTL)) != 0; + + if (IsDocked()) + { + rc.OffsetRect(-rc.left, -rc.top); + } + + HDWP hdwp = BeginDeferWindowPos(static_cast(m_dockChildren.size()) +2); + + // Step 1: Calculate the position of each Docker child, DockBar, and + // Client window. The client area = the docker rect minus the area of + // dock children and the dock bar (splitter bar). + for (CDocker* pDocker : m_dockChildren) + { + CRect rcChild = rc; + int dockSize = pDocker->m_dockStartSize; + int minSize = 30; + + // Calculate the size of the Docker children. + switch (pDocker->GetDockStyle() & 0xF) + { + case DS_DOCKED_LEFT: + if (isRTL) + { + rcChild.left = rcChild.right - dockSize; + rcChild.left = std::min(rcChild.left, rc.right - minSize); + rcChild.left = std::max(rcChild.left, rc.left + minSize); + } + else + { + rcChild.right = rcChild.left + dockSize; + rcChild.right = std::max(rcChild.right, rc.left + minSize); + rcChild.right = std::min(rcChild.right, rc.right - minSize); + } + break; + case DS_DOCKED_RIGHT: + if (isRTL) + { + rcChild.right = rcChild.left + dockSize; + rcChild.right = std::max(rcChild.right, rc.left + minSize); + rcChild.right = std::min(rcChild.right, rc.right - minSize); + } + else + { + rcChild.left = rcChild.right - dockSize; + rcChild.left = std::min(rcChild.left, rc.right - minSize); + rcChild.left = std::max(rcChild.left, rc.left + minSize); + } + + break; + case DS_DOCKED_TOP: + rcChild.bottom = rcChild.top + dockSize; + rcChild.bottom = std::max(rcChild.bottom, rc.top + minSize); + rcChild.bottom = std::min(rcChild.bottom, rc.bottom - minSize); + break; + case DS_DOCKED_BOTTOM: + rcChild.top = rcChild.bottom - dockSize; + rcChild.top = std::min(rcChild.top, rc.bottom - minSize); + rcChild.top = std::max(rcChild.top, rc.top + minSize); + + break; + } + + if (pDocker->IsDocked()) + { + // Position this docker's children. + hdwp = pDocker->DeferWindowPos(hdwp, 0, rcChild, + SWP_SHOWWINDOW | SWP_FRAMECHANGED); + pDocker->m_childRect = rcChild; + + rc.SubtractRect(rc, rcChild); + + // Calculate the dimensions of the splitter bar. + CRect barRect = rc; + DWORD dockSide = pDocker->GetDockStyle() & 0xF; + + if (DS_DOCKED_LEFT == dockSide) + { + if (isRTL) barRect.left = barRect.right - pDocker->GetBarWidth(); + else barRect.right = barRect.left + pDocker->GetBarWidth(); + } + + if (DS_DOCKED_RIGHT == dockSide) + { + if (isRTL) barRect.right = barRect.left + pDocker->GetBarWidth(); + else barRect.left = barRect.right - pDocker->GetBarWidth(); + } + + if (DS_DOCKED_TOP == dockSide) barRect.bottom = barRect.top + + pDocker->GetBarWidth(); + if (DS_DOCKED_BOTTOM == dockSide) barRect.top = barRect.bottom - + pDocker->GetBarWidth(); + + // Save the splitter bar position. We will reposition it later. + pDocker->m_barRect = barRect; + rc.SubtractRect(rc, barRect); + } + } + + // Step 2: Position the Dock client and dock bar. + if (GetDockClient().IsWindow()) + { + hdwp = GetDockClient().DeferWindowPos(hdwp, 0, rc, + SWP_SHOWWINDOW | SWP_FRAMECHANGED); + } + VERIFY(EndDeferWindowPos(hdwp)); + + // Position the dockbar. Only docked dockers have a dock bar. + if (IsDocked()) + { + CRect barRect; + barRect.IntersectRect(m_barRect, GetDockParent()->GetViewRect()); + + // The SWP_NOCOPYBITS forces a redraw of the dock bar. + VERIFY(GetDockBar().SetWindowPos(HWND_TOP, barRect, + SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOCOPYBITS)); + } + + // Step 3: Now recurse through the docker's children. They might have + // children of their own. + for (CDocker* pDocker : m_dockChildren) + { + pDocker->RecalcDockChildLayout(pDocker->m_childRect); + } + } + + // Repositions the dock children of a top level docker. + inline void CDocker::RecalcDockLayout() + { + if (GetDockAncestor()->IsWindow()) + { + CRect rc = GetTopmostDocker()->GetViewRect(); + GetTopmostDocker()->RecalcDockChildLayout(rc); + GetTopmostDocker()->UpdateWindow(); + } + } + + // Called when the docker's splitter bar is dragged. + inline void CDocker::ResizeDockers(DragPos* pDragPos) + { + assert(pDragPos); + if (!pDragPos) return; + + POINT pt = pDragPos->pos; + VERIFY(ScreenToClient(pt)); + int posX = pt.x; + int posY = pt.y; + + CDocker* pDocker = pDragPos->pDocker; + assert(pDocker); + if (!pDocker) return; + + RECT rcDock = pDocker->GetWindowRect(); + VERIFY(ScreenToClient(rcDock)); + + int barWidth = pDocker->GetDockBar().GetWidth(); + int dockSize; + + BOOL isRTL = false; + isRTL = ((GetExStyle() & WS_EX_LAYOUTRTL)) != 0; + + switch (pDocker->GetDockStyle() & 0xF) + { + case DS_DOCKED_LEFT: + if (isRTL) dockSize = rcDock.right - std::max(posX, barWidth / 2) - (barWidth / 2); + else dockSize = std::max(posX, barWidth / 2) - rcDock.left - (barWidth / 2); + + dockSize = std::max(-barWidth, dockSize); + pDocker->SetDockSize(dockSize); + break; + case DS_DOCKED_RIGHT: + if (isRTL) dockSize = std::max(posX, barWidth / 2) - rcDock.left - (barWidth / 2); + else dockSize = rcDock.right - std::max(posX, barWidth / 2) - (barWidth / 2); + + dockSize = std::max(-barWidth, dockSize); + pDocker->SetDockSize(dockSize); + break; + case DS_DOCKED_TOP: + dockSize = std::max(posY, barWidth / 2) - rcDock.top - (barWidth / 2); + dockSize = std::max(-barWidth, dockSize); + pDocker->SetDockSize(dockSize); + break; + case DS_DOCKED_BOTTOM: + dockSize = rcDock.bottom - std::max(posY, barWidth / 2) - (barWidth / 2); + dockSize = std::max(-barWidth, dockSize); + pDocker->SetDockSize(dockSize); + break; + } + + RecalcDockLayout(); + } + + // Stores the docking container configuration in the registry. + inline void CDocker::SaveContainerRegistrySettings(CRegKey& dockKey, + CDockContainer* pContainer, UINT& container) + { + CRegKey containerKey; + CString dockContainerName; + dockContainerName.Format(_T("DockContainer%u"), container++); + if (ERROR_SUCCESS != dockKey.Create(dockKey, dockContainerName)) + throw CUserException(); + + if (ERROR_SUCCESS != containerKey.Open(dockKey, dockContainerName)) + throw CUserException(); + + // Store the container group's parent. + CDocker* pDocker = GetDockFromView(pContainer); + if (pDocker == nullptr) + throw CUserException(); + DWORD id = static_cast(pDocker->GetDockID()); + if (ERROR_SUCCESS != containerKey.SetDWORDValue(_T("Parent Container"), id)) + throw CUserException(); + + // Store the active (selected) container. + pDocker = GetDockFromView(pContainer->GetActiveContainer()); + if (pDocker == nullptr) + id = 0; + else + id = static_cast(pDocker->GetDockID()); + + if (ERROR_SUCCESS != containerKey.SetDWORDValue(_T("Active Container"), id)) + throw CUserException(); + + // Store the tab order. + for (size_t u2 = 0; u2 < pContainer->GetAllContainers().size(); ++u2) + { + dockContainerName = _T("Tab"); + dockContainerName << u2; + CDockContainer* pTab = pContainer->GetContainerFromIndex(u2); + if (pTab == nullptr) + throw CUserException(); + pDocker = GetDockFromView(pTab); + if (pDocker == nullptr) + throw CUserException(); + DWORD tabID = static_cast(pDocker->GetDockID()); + + if (ERROR_SUCCESS != containerKey.SetDWORDValue(dockContainerName, tabID)) + throw CUserException(); + } + } + + // Stores the docking configuration in the registry. + // NOTE: This function assumes that each docker has a unique DockID. + inline BOOL CDocker::SaveDockRegistrySettings(LPCTSTR registryKeyName) + { + std::vector sortedDockers = SortDockers(); + std::vector allDockInfo; + + if (registryKeyName) + { + CRegKey appKey; + CRegKey dockKey; + const CString appKeyName = _T("Software\\") + CString(registryKeyName); + const CString dockKeyName = _T("Dock Settings"); + try + { + if (!VerifyDockers()) + throw CUserException(); + + // Create the App's registry key. + if (ERROR_SUCCESS != appKey.Create(HKEY_CURRENT_USER, appKeyName)) + throw CUserException(); + + if (ERROR_SUCCESS != appKey.Open(HKEY_CURRENT_USER, appKeyName)) + throw CUserException(); + + // Remove Old Docking info ... + appKey.RecurseDeleteKey(dockKeyName); + + // Fill the DockInfo vector with the docking information. + for (CDocker* pDocker : sortedDockers) + { + DockInfo di = {}; + if (!pDocker->IsWindow()) + throw CUserException(); + + di.dockID = pDocker->GetDockID(); + di.dockStyle = pDocker->GetDockStyle(); + di.dockSize = pDocker->GetDockSize(); + di.rect = pDocker->GetWindowRect(); + if (pDocker->GetDockParent()) + di.dockParentID = pDocker->GetDockParent()->GetDockID(); + + di.isInAncestor = (pDocker->GetDockParent() == GetDockAncestor()); + di.isHidden = !pDocker->IsWindowVisible(); + + allDockInfo.push_back(di); + } + + if (ERROR_SUCCESS != dockKey.Create(appKey, dockKeyName)) + throw CUserException(); + + if (ERROR_SUCCESS != dockKey.Open(appKey, dockKeyName)) + throw CUserException(); + + // Add the dock settings information to the registry. + for (size_t t = 0; t < allDockInfo.size(); ++t) + { + DockInfo di = allDockInfo[t]; + CString dockChildName; + dockChildName << _T("DockChild") << t; + if (ERROR_SUCCESS != dockKey.SetBinaryValue(dockChildName, &di, sizeof(DockInfo))) + throw CUserException(); + } + + // Add dock container info to the registry. + UINT container = 0; + + if (GetContainer()) + SaveContainerRegistrySettings(dockKey, GetContainer(), container); + + for (CDocker* pDocker : sortedDockers) + { + CDockContainer* pContainer = pDocker->GetContainer(); + + if (pContainer && ( !(pDocker->GetDockStyle() & DS_DOCKED_CONTAINER) )) + { + SaveContainerRegistrySettings(dockKey, pContainer, container); + } + } + + // Add the dock ancestor's style to the registry. + DWORD style = GetDockStyle(); + if (ERROR_SUCCESS != dockKey.SetDWORDValue(_T("DockAncestor"), style)) + throw CUserException(); + } + + catch (const CUserException&) + { + TRACE("*** WARNING: Failed to save dock settings in registry. ***\n"); + + // Roll back the registry changes by deleting the subkeys. + if (appKey.GetKey()) + { + appKey.RecurseDeleteKey(dockKeyName); + } + + return FALSE; + } + } + + return TRUE; + } + + // Sends a docking notification to the docker below the cursor. + inline void CDocker::SendNotify(UINT messageID) + { + DragPos dragPos = {}; + dragPos.hdr.code = messageID; + dragPos.hdr.hwndFrom = GetHwnd(); + dragPos.pos = GetCursorPos(); + dragPos.dockZone = m_dockZone; + dragPos.pDocker = this; + m_dockZone = 0; + + CDocker* pDocker = GetDockUnderDragPoint(dragPos.pos); + + if (pDocker) + pDocker->SendMessage(WM_NOTIFY, 0, reinterpret_cast(&dragPos)); + else + { + if (GetDockHint().IsWindow()) + GetDockHint().Destroy(); + + CloseAllTargets(); + } + } + + // This performs some of the tasks required for undocking. + // It is also used when a docker is hidden. + inline CDocker* CDocker::SeparateFromDock() + { + CDocker* pDockUndockedFrom = GetDockParent(); + if (!pDockUndockedFrom && (m_dockChildren.size() > 0)) + pDockUndockedFrom = m_dockChildren[0]; + + PromoteFirstChild(); + m_pDockParent = nullptr; + + if (GetDockBar().IsWindow()) + GetDockBar().ShowWindow(SW_HIDE); + + m_dockStyle = m_dockStyle & 0xFFFFFFF0; + m_dockStyle &= ~DS_DOCKED_CONTAINER; + + return pDockUndockedFrom; + } + + // Sets the caption text. + inline void CDocker::SetCaption(LPCTSTR caption) + { + GetDockClient().SetCaption(caption); + + if (IsWindow() && (this != GetDockAncestor())) + SetWindowText(caption); + } + + // Sets the caption's foreground and background colors. + // foregnd1 specifies the foreground color(focused). + // backgnd1 specifies the background color(focused). + // foregnd2 specifies the foreground color(not focused). + // backgnd2 specifies the background color(not focused). + // penColor specifies the pen color used for drawing the outline. + inline void CDocker::SetCaptionColors(COLORREF foregnd1, COLORREF backgnd1, + COLORREF foreGnd2, COLORREF backGnd2, COLORREF penColor /*= RGB(160, 150, 140)*/) const + { + GetDockClient().SetCaptionColors(foregnd1, backgnd1, foreGnd2, backGnd2, penColor); + } + + // Sets the height of the caption + inline void CDocker::SetCaptionHeight(int height) + { + m_ncHeight = height; + } + + // Sets the caption height based on the current text height. + inline void CDocker::SetDefaultCaptionHeight() + { + SetCaptionHeight(std::max(20, GetTextHeight() + 5)); + } + + // Sets the dock client window for this docker. + inline void CDocker::SetDockClient(CDockClient& dockClient) + { + m_pDockClient = &dockClient; + m_pDockClient->SetDocker(this); + } + + // Sets the size of a docked docker + inline void CDocker::SetDockSize(int dockSize) + { + m_dockStartSize = dockSize; + } + + // Sets the docker's style from one or more of the following: + // DS_DOCKED_LEFT, DS_DOCKED_RIGHT, DS_DOCKED_TOP, DS_DOCKED_BOTTOM, + // DS_NO_DOCKCHILD_LEFT, DS_NO_DOCKCHILD_RIGHT, DS_NO_DOCKCHILD_TOP, + // DS_NO_DOCKCHILD_BOTTOM, DS_NO_RESIZE, DS_NO_CAPTION, DS_NO_CLOSE, + // DS_NO_UNDOCK, DS_CLIENTEDGE, DS_DOCKED_CONTAINER, + // DS_DOCKED_LEFTMOST, DS_DOCKED_RIGHTMOST, DS_DOCKED_TOPMOST, + // DS_DOCKED_BOTTOMMOST. + inline void CDocker::SetDockStyle(DWORD dockStyle) + { + if (IsWindow()) + { + if ((dockStyle & DS_CLIENTEDGE) != (m_dockStyle & DS_CLIENTEDGE)) + { + if (dockStyle & DS_CLIENTEDGE) + { + DWORD exStyle = GetDockClient().GetExStyle() | WS_EX_CLIENTEDGE; + GetDockClient().SetExStyle(exStyle); + GetDockClient().RedrawWindow(RDW_INVALIDATE | + RDW_UPDATENOW | RDW_ERASE | RDW_FRAME); + } + else + { + DWORD exStyle = GetDockClient().GetExStyle(); + exStyle &= ~WS_EX_CLIENTEDGE; + GetDockClient().SetExStyle(exStyle); + GetDockClient().RedrawWindow(RDW_INVALIDATE | + RDW_UPDATENOW | RDW_ERASE | RDW_FRAME); + } + } + } + + m_dockStyle = dockStyle; + if (IsWindow()) + { + RecalcDockLayout(); + } + } + + // Assigns the view window to the docker. + // The docker's view can be changed during runtime. + // The docker's view can be a DockContainer or another child window. + // Note: DockContainers have their own view which is not set here. + inline void CDocker::SetView(CWnd& view) + { + GetDockClient().SetView(view); + CDockContainer* pContainer = GetContainer(); + if (pContainer) + { + SetCaption(pContainer->GetDockCaption().c_str()); + pContainer->SetDocker(this); + } + } + + // Position and draw the undocked window, unless it is about to be closed. + inline void CDocker::SetUndockPosition(CPoint pt, BOOL showUndocked) + { + m_isUndocking = TRUE; + CRect rc; + rc = GetDockClient().GetWindowRect(); + CRect testRect = rc; + testRect.bottom = std::min(testRect.bottom, testRect.top + m_ncHeight); + if ( !testRect.PtInRect(pt)) + rc.SetRect(pt.x - rc.Width()/2, pt.y - m_ncHeight/2, pt.x + + rc.Width()/2, pt.y - m_ncHeight/2 + rc.Height()); + + if (!m_isClosing) + ConvertToPopup(rc, showUndocked); + + m_isUndocking = FALSE; + + // Send the undock notification to the frame. + NMHDR nmhdr = {}; + nmhdr.hwndFrom = GetHwnd(); + nmhdr.code = UWN_UNDOCKED; + nmhdr.idFrom = static_cast(m_dockID); + HWND frame = GetDockAncestor()->GetAncestor(); + assert(frame); + WPARAM wparam = static_cast(m_dockID); + LPARAM lparam = reinterpret_cast(&nmhdr); + ::SendMessage(frame, WM_NOTIFY, wparam, lparam); + + // Initiate the window move. + SetCursorPos(pt.x, pt.y); + VERIFY(ScreenToClient(pt)); + wparam = static_cast(SC_MOVE | 0x0002); + lparam = MAKELPARAM(pt.x, pt.y); + PostMessage(WM_SYSCOMMAND, wparam, lparam); + } + + // Returns a vector of sorted dockers, used by SaveRegistrySettings. + inline std::vector CDocker::SortDockers() + { + std::vector vSorted; + + // Add undocked top level dockers + for (const DockPtr& ptr : GetAllChildren()) + { + if (!ptr->GetDockParent()) + vSorted.push_back(ptr.get()); + } + + // Add dock ancestor's children. + vSorted.insert(vSorted.end(), GetDockAncestor()->GetDockChildren().begin(), + GetDockAncestor()->GetDockChildren().end()); + + // Add other dock children. + int index = 0; + auto itSort = vSorted.begin(); + while (itSort != vSorted.end()) + { + vSorted.insert(vSorted.end(), (*itSort)->GetDockChildren().begin(), + (*itSort)->GetDockChildren().end()); + itSort = vSorted.begin() + (++index); + } + + // Add dockers docked in containers. + std::vector vDockContainers; + for (CDocker* pDocker : vSorted) + { + if (pDocker->GetContainer()) + vDockContainers.push_back(pDocker); + } + + for (CDocker* pDocker : vDockContainers) + { + CDockContainer* pContainer = pDocker->GetContainer(); + assert(pContainer); + if (pContainer != nullptr) + { + for (size_t i = 0; i < pContainer->GetAllContainers().size(); ++i) + { + CDockContainer* pChild = pContainer->GetContainerFromIndex(i); + + if (pChild != pContainer) + { + CDocker* pDocker1 = GetDockFromView(pChild); + assert(pDocker1); + vSorted.push_back(pDocker1); + } + } + } + } + + if (GetContainer()) + { + CDockContainer* pContainer = GetContainer(); + + for (size_t i = 0; i < pContainer->GetAllContainers().size(); ++i) + { + CDockContainer* pChild = pContainer->GetContainerFromIndex(i); + + if (pChild != pContainer) + { + CDocker* pDocker = GetDockFromView(pChild); + assert(pDocker); + vSorted.push_back(pDocker); + } + } + } + + return vSorted; + } + + // Undocks a docker. + // Called when the user undocks a docker, or when a docker is closed. + inline void CDocker::Undock(CPoint pt, BOOL showUndocked) + { + CDocker* pDockUndockedFrom = SeparateFromDock(); + + // Position and draw the undocked window, unless it is about to be closed. + SetUndockPosition(pt, showUndocked); + + // Give the view window focus unless its child already has it. + if (!GetView().IsChild(GetFocus())) + GetView().SetFocus(); + + RecalcDockLayout(); + if ((pDockUndockedFrom) && (pDockUndockedFrom->GetTopmostDocker() != + GetTopmostDocker())) + { + pDockUndockedFrom->RecalcDockLayout(); + } + } + + // Undocks a CDockContainer. + // Called when the user undocks a container, or when a container is closed. + inline void CDocker::UndockContainer(CDockContainer* pContainer, CPoint pt, + BOOL showUndocked) + { + assert(pContainer); + if (!pContainer) return; + + assert(this == GetDockFromView(pContainer->GetContainerParent())); + + if (GetDockFromView(pContainer) == GetDockAncestor()) return; + + CDocker* pDockUndockedFrom = this; + if (&GetView() == pContainer) + { + // The parent container is being undocked, so we need + // to transfer our child containers to a different docker. + + // Choose a new docker from among the dockers for child containers. + CDocker* pDockNew = nullptr; + CDocker* pDockOld = GetDockFromView(pContainer); + assert(pDockOld); + std::vector AllContainers = pContainer->GetAllContainers(); + auto it = AllContainers.begin(); + while ((pDockNew == nullptr) && (it != AllContainers.end())) + { + if ((*it).pContainer != pContainer) + { + pDockNew = (*it).pContainer->GetDocker(); + assert(pDockNew); + } + + ++it; + } + + if (pDockNew) + { + // Move containers from the old docker to the new docker. + pDockNew->m_isUndocking = TRUE; // IsUndocked will report FALSE. + CDockContainer* pContainerNew = pDockNew->GetContainer(); + assert(pContainerNew); + if (pContainerNew) + { + for (const ContainerInfo& ci : AllContainers) + { + if (ci.pContainer != pContainer) + { + CDockContainer* pChildContainer = ci.pContainer; + pContainer->RemoveContainer(pChildContainer); + if (pContainerNew != pChildContainer) + { + pContainerNew->AddContainer(pChildContainer); + CDocker* pDocker = GetDockFromView(pChildContainer); + assert(pDocker); + pDocker->SetParent(*pDockNew); + pDocker->m_pDockParent = pDockNew; + } + } + } + } + + // Now transfer the old docker's settings to the new one. + pDockUndockedFrom = pDockNew; + pDockNew->m_dockStyle = pDockOld->m_dockStyle; + pDockNew->m_dockStartSize = pDockOld->m_dockStartSize; + if (pDockOld->IsDocked()) + { + pDockNew->m_pDockParent = pDockOld->m_pDockParent; + pDockNew->SetParent(pDockOld->GetParent()); + } + else + { + CRect rc = pDockOld->GetWindowRect(); + pDockNew->ShowWindow(SW_HIDE); + DWORD style = WS_POPUP| WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_VISIBLE; + pDockNew->SetStyle(style); + pDockNew->m_pDockParent = nullptr; + pDockNew->SetParent(nullptr); + VERIFY(pDockNew->SetWindowPos(HWND_TOP, rc, SWP_SHOWWINDOW | + SWP_FRAMECHANGED | SWP_NOOWNERZORDER)); + } + pDockNew->GetDockBar().SetParent(pDockOld->GetParent()); + pDockNew->GetView().SetFocus(); + + // Transfer the Dock children to the new docker. + pDockOld->MoveDockChildren(pDockNew); + + // Insert pDockNew into its DockParent's DockChildren vector. + if (pDockNew->m_pDockParent) + { + std::deque& children = pDockNew->m_pDockParent->m_dockChildren; + for (auto p = children.begin(); p != children.end(); ++p) + { + if (*p == this) + { + children.insert(p, pDockNew); + break; + } + } + } + + pDockNew->m_isUndocking = FALSE; // IsUndocked reports undocked state. + } + } + else + { + // This is a child container, so simply remove it from the parent. + CDockContainer* pContainerParent = GetContainer(); + assert(pContainerParent); + if (pContainerParent) + { + pContainerParent->RemoveContainer(pContainer, showUndocked); + pContainerParent->SetTabSize(); + pContainerParent->SetFocus(); + if (pContainerParent->GetViewPage().IsWindow()) + pContainerParent->GetViewPage().SetParent(*pContainerParent); + } + } + + // Finally do the actual undocking. + CDocker* pDocker = GetDockFromView(pContainer); + assert(pDocker); + if (!pDocker) return; + + CRect rc = GetDockClient().GetWindowRect(); + VERIFY(ScreenToClient(rc)); + VERIFY(pDocker->GetDockClient().SetWindowPos(HWND_TOP, rc, SWP_SHOWWINDOW)); + pDocker->Undock(pt, showUndocked); + pDocker->GetDockBar().SetParent(*GetDockAncestor()); + pDockUndockedFrom->RecalcDockLayout(); + pDocker->BringWindowToTop(); + } + + // Undocks a CDockContainer group. + // Called when the user undocks a container group from a CDockFrame. + inline void CDocker::UndockContainerGroup() + { + CDockContainer* pContainer = GetContainer(); + assert(pContainer); + if (pContainer) + { + CDockContainer* pParent = pContainer->GetContainerParent(); + CDockContainer* pActive = pContainer->GetActiveContainer(); + auto& pAllContainers = pParent->GetAllContainers(); + if (pActive) + { + assert(pAllContainers.size() > 0); + size_t lastTab = pAllContainers.size() - 1; + CDockContainer* pContainerLast = pContainer->GetContainerFromIndex(lastTab); + GetDockAncestor()->UndockContainer(pContainerLast, GetCursorPos(), FALSE); + + // Move each container's docker to the undocked last container's docker, + // using Hide then DockInContainer. + while (pAllContainers.size() > 0) + { + lastTab = pAllContainers.size() - 1; + CDockContainer* pContainerNext = pContainer->GetContainerFromIndex(lastTab); + CDocker* pDocker = pContainerNext->GetDocker(); + pDocker->Hide(); + pContainerLast->GetDocker()->DockInContainer(pDocker, pDocker->GetDockStyle()); + } + + // Restore the active container and redraw. + pContainerLast->SetActiveContainer(pActive); + pContainerLast->GetDocker()->ShowWindow(SW_SHOW); + pContainerLast->RedrawWindow(); + GetDockAncestor()->RecalcDockLayout(); + } + } + } + + // A diagnostic routine that verifies the integrity of the docking layout. + inline BOOL CDocker::VerifyDockers() + { + BOOL isVerified = TRUE; + + // Check dock ancestor + for (const DockPtr& dockPtr : GetAllChildren()) + { + if (GetDockAncestor() != dockPtr->m_pDockAncestor) + isVerified = FALSE; + } + + // Check presence of dock parent. + for (const DockPtr& dockPtr : GetAllChildren()) + { + if (dockPtr->IsUndocked() && dockPtr->m_pDockParent != nullptr) + isVerified = FALSE; + + if (dockPtr->IsDocked() && dockPtr->m_pDockParent == nullptr) + isVerified = FALSE; + } + + // Check dock parent/child relationship. + for (const DockPtr& dockPtr : GetAllChildren()) + { + for (CDocker* pDocker : dockPtr->m_dockChildren) + { + if (pDocker->m_pDockParent != dockPtr.get()) + isVerified = FALSE; + + if (pDocker->GetParent() != dockPtr.get()->GetHwnd()) + isVerified = FALSE; + } + } + + // Check dock parent chain. + for (const DockPtr& dockPtr : GetAllChildren()) + { + CDocker* pDockTopLevel = dockPtr->GetTopmostDocker(); + if (pDockTopLevel->IsDocked()) + isVerified = FALSE; + } + + assert(isVerified); + return isVerified; + } + + inline LRESULT CDocker::WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) + { + switch (msg) + { + case WM_ACTIVATE: return OnActivate(msg, wparam, lparam); + case WM_DPICHANGED: return OnDpiChanged(msg, wparam, lparam); + case WM_DPICHANGED_BEFOREPARENT: return OnDpiChangedBeforeParent(msg, wparam, lparam); + case WM_EXITSIZEMOVE: return OnExitSizeMove(msg, wparam, lparam); + case WM_GETDPISCALEDSIZE: return OnGetDpiScaledSize(msg, wparam, lparam); + case WM_MOUSEACTIVATE: return OnMouseActivate(msg, wparam, lparam); + case WM_NCLBUTTONDBLCLK: return OnNCLButtonDblClk(msg, wparam, lparam); + case WM_SETTINGCHANGE: return OnSettingChange(msg, wparam, lparam); + case WM_SIZE: return OnSize(msg, wparam, lparam); + case WM_SYSCOLORCHANGE: return OnSysColorChange(msg, wparam, lparam); + case WM_SYSCOMMAND: return OnSysCommand(msg, wparam, lparam); + case WM_WINDOWPOSCHANGED: return OnWindowPosChanged(msg, wparam, lparam); + + // Messages defined by Win32++ + case UWM_DOCKACTIVATE: return OnDockActivated(msg, wparam, lparam); + case UWM_DOCKDESTROYED: return OnDockDestroyed(msg, wparam, lparam); + case UWM_GETCDOCKER: return reinterpret_cast(this); + } + + return CWnd::WndProcDefault(msg, wparam, lparam); + } + + + /////////////////////////////////////////// + // Declaration of the CDockContainer class. + // + + // Constructor. + inline CDockContainer::CDockContainer() : m_currentPage(0), + m_pDocker(nullptr), m_pContainerParent(nullptr), m_tabIcon(nullptr), + m_pressedTab(-1), m_isHideSingleTab(FALSE) + { + m_pViewPage = &m_viewPage; + m_pContainerParent = this; + m_viewPage.SetContainer(this); + } + + // Adds a container to the group. Set Insert to TRUE to insert the container + // as the first tab, or FALSE to add it as the last tab. + inline void CDockContainer::AddContainer(CDockContainer* pContainer, + BOOL insert /* = FALSE */, BOOL selectPage) + { + assert(pContainer); + assert(this == m_pContainerParent); // Must be performed by parent container. + if (!pContainer || !m_pContainerParent) return; + + ContainerInfo ci; + ci.pContainer = pContainer; + ci.tabText = pContainer->GetTabText(); + ci.tabImage = GetImages().Add( pContainer->GetTabIcon() ); + int newPage = 0; + if (insert) + { + m_allInfo.insert(m_allInfo.begin(), ci); + } + else + { + newPage = static_cast(m_allInfo.size()); + m_allInfo.push_back(ci); + } + + if (IsWindow()) + { + TCITEM tie = {}; + tie.mask = TCIF_TEXT | TCIF_IMAGE; + tie.iImage = ci.tabImage; + size_t newPageIndex = static_cast(newPage); + tie.pszText = const_cast(m_allInfo[newPageIndex].tabText.c_str()); + InsertItem(newPage, &tie); + + if (selectPage) + SelectPage(newPage); + + SetTabSize(); + } + + pContainer->m_pContainerParent = this; + if (pContainer->IsWindow()) + { + // Set the parent container relationships. + pContainer->GetViewPage().SetParent(*this); + pContainer->GetViewPage().ShowWindow(SW_HIDE); + RecalcLayout(); + } + } + + // Adds Resource IDs to toolbar buttons. + // A resource ID of 0 is a separator. + inline void CDockContainer::AddToolBarButton(UINT id, BOOL isEnabled /* = TRUE */) + { + GetToolBarData().push_back(id); + GetToolBar().AddButton(id, isEnabled); + } + + // Creates the toolbar within the viewpage. + inline void CDockContainer::CreateToolBar() + { + // Create the toolbar. + if (GetViewPage().IsWindow()) + { + m_toolBarData.clear(); + GetToolBar().Create(GetViewPage()); + DWORD style = GetToolBar().GetStyle(); + style |= CCS_NODIVIDER; + GetToolBar().SetStyle(style); + SetupToolBar(); + if (GetToolBarData().size() > 0) + { + // Load the default images if no images are loaded. + if (!GetToolBar().SendMessage(TB_GETIMAGELIST, 0, 0)) + SetToolBarImages(RGB(192, 192, 192), IDW_MAIN, 0, 0); + + GetToolBar().Autosize(); + } + else + GetToolBar().ShowWindow(SW_HIDE); + } + } + + // Draw the tabs. + inline void CDockContainer::DrawTabs(CDC& dc) + { + // Draw the tab buttons: + for (int i = 0; i < GetItemCount(); ++i) + { + CRect rcItem; + GetItemRect(i, rcItem); + if (!rcItem.IsRectEmpty()) + { + if (i == GetCurSel()) + { + dc.CreateSolidBrush(RGB(248, 248, 248)); + dc.SetBkColor(RGB(248, 248, 248)); + } + else + { + dc.CreateSolidBrush(RGB(200, 200, 200)); + dc.SetBkColor(RGB(200, 200, 200)); + } + + dc.CreatePen(PS_SOLID, 1, RGB(160, 160, 160)); + dc.RoundRect(rcItem.left, rcItem.top, rcItem.right + 1, rcItem.bottom, 6, 6); + + CSize szImage = GetImages().GetIconSize(); + int padding = DpiScaleInt(4); + + if (rcItem.Width() >= szImage.cx + 2 * padding) + { + CString str = GetDockTabText(i); + int image = GetDockTabImageID(i); + int yOffset = (rcItem.Height() - szImage.cy) / 2; + + // Draw the icon. + int drawleft = rcItem.left + padding; + int drawtop = rcItem.top + yOffset; + GetImages().Draw(dc, image, CPoint(drawleft, drawtop), ILD_NORMAL); + + // Calculate the size of the text. + CRect rcText = rcItem; + + if (image >= 0) + rcText.left += szImage.cx + padding; + + rcText.left += padding; + + // Draw the text. + dc.SelectObject(GetTabFont()); + dc.DrawText(str, -1, rcText, DT_LEFT | DT_VCENTER | + DT_SINGLELINE | DT_END_ELLIPSIS | DT_NOPREFIX); + } + } + } + } + + // Returns a pointer to the container at the specified tab number. + inline CDockContainer* CDockContainer::GetContainerFromIndex(size_t index) const + { + CDockContainer* pContainer = nullptr; + if (index < m_allInfo.size()) + pContainer = m_allInfo[index].pContainer; + + return pContainer; + } + + // Returns a pointer to the currently active container. + inline CDockContainer* CDockContainer::GetActiveContainer() const + { + assert(m_pContainerParent); + if (!m_pContainerParent) return nullptr; + + if (m_pContainerParent->m_allInfo.size() > 0) + { + size_t index = static_cast(m_pContainerParent->m_currentPage); + return m_pContainerParent->m_allInfo[index].pContainer; + } + else + return 0; + } + + // Returns a pointer to the active view window, or nullptr if there is no active view. + inline CWnd* CDockContainer::GetActiveView() const + { + if (GetActiveContainer()) + return GetActiveContainer()->GetView(); + else + return 0; + } + + // Returns a reference to the vector of container information + inline const std::vector& CDockContainer::GetAllContainers() const + { + return m_pContainerParent->m_allInfo; + } + + // Returns a pointer to the container with the specified view. + inline CDockContainer* CDockContainer::GetContainerFromView(CWnd* pView) const + { + assert(pView); + + CDockContainer* pViewContainer = nullptr; + for (const ContainerInfo& ci : GetAll()) + { + CDockContainer* pContainer = ci.pContainer; + if (pContainer->GetView() == pView) + { + pViewContainer = pContainer; + break; + } + } + + return pViewContainer; + } + + // Returns the tab index of the specified container. + inline int CDockContainer::GetContainerIndex(CDockContainer* pContainer) const + { + assert(pContainer); + int index = -1; + + for (auto it = GetAll().begin(); it != GetAll().end(); ++it) + { + if ((*it).pContainer == pContainer) + { + index = static_cast(std::distance(GetAll().begin(), it)); + break; + } + } + + return index; + } + + // Returns the size (width and height) of the caption text. + inline SIZE CDockContainer::GetMaxTabTextSize() const + { + CSize sz; + + for (auto it = m_allInfo.begin(); it != m_allInfo.end(); ++it) + { + CSize tempSize; + CClientDC dc(*this); + dc.SelectObject(GetTabFont()); + tempSize = dc.GetTextExtentPoint32(it->tabText, lstrlen(it->tabText)); + if (tempSize.cx > sz.cx) + sz = tempSize; + } + + return sz; + } + + // Returns a container tab's image index. + inline int CDockContainer::GetDockTabImageID(int tab) const + { + size_t index = static_cast(tab); + assert (index < GetAllContainers().size()); + return GetAllContainers()[index].tabImage; + } + + // Returns a container tab's text. + inline CString CDockContainer::GetDockTabText(int tab) const + { + size_t index = static_cast(tab); + assert (index < GetAllContainers().size()); + return GetAllContainers()[index].tabText; + } + + // Returns the size of a bitmap image. + inline CSize CDockContainer::GetTBImageSize(CBitmap* pBitmap) const + { + assert(pBitmap); + if (!pBitmap) return CSize(0, 0); + + assert(pBitmap->GetHandle()); + BITMAP data = pBitmap->GetBitmapData(); + int cy = data.bmHeight; + int dataHeight = data.bmHeight; + int cx = std::max(dataHeight, 16); + + return CSize(cx, cy); + } + + // Called when a HWND is attached to this CWnd. + inline void CDockContainer::OnAttach() + { + m_allInfo.clear(); + + // The parent window must be a docker. + m_pDocker = reinterpret_cast((GetParent().GetParent().SendMessage(UWM_GETCDOCKER))); + assert(dynamic_cast(m_pDocker)); + + // Create and assign the tab's image list. + int iconHeight = DpiScaleInt(16); + iconHeight = iconHeight - iconHeight % 8; + GetImages().Create(iconHeight, iconHeight, ILC_MASK | ILC_COLOR32, 0, 0); + + // Update the font and icons in the tabs. + UpdateTabs(); + + // Add a tab for this container except for the DockAncestor. + if (!GetDocker() || GetDocker()->GetDockAncestor() != GetDocker()) + { + assert(GetView()); // Use SetView in the constructor to set the view window. + + ContainerInfo ci; + ci.pContainer = this; + ci.tabText = GetTabText(); + ci.tabImage = GetImages().Add(GetTabIcon()); + m_allInfo.push_back(ci); + + // Create the page window. + GetViewPage().Create(*this); + + // Create the toolbar. + CreateToolBar(); + } + + SetFixedWidth(TRUE); + SetOwnerDraw(TRUE); + + // Add tabs for each container. + for (size_t i = 0; i < m_allInfo.size(); ++i) + { + // Add tabs for each view. + TCITEM tie = {}; + tie.mask = TCIF_TEXT | TCIF_IMAGE; + tie.iImage = m_allInfo[i].tabImage; + tie.pszText = const_cast(m_allInfo[i].tabText.c_str()); + InsertItem(static_cast(i), &tie); + } + } + + // Called in response to a WM_DPICHANGED_BEFOREPARENT message that is sent + // to child windows after a DPI change. A WM_DPICHANGED_BEFOREPARENT is + // only received when the application is DPI_AWARENESS_PER_MONITOR_AWARE. + inline LRESULT CDockContainer::OnDpiChangedBeforeParent(UINT, WPARAM, LPARAM) + { + UpdateTabs(); + + // Destroy and recreate the toolbar. + GetViewPage().GetToolBar().Destroy(); + CreateToolBar(); + RecalcLayout(); + + return 0; + } + + // Called when the left mouse button is pressed. + // Overrides CTab::OnLButtonDown. + inline LRESULT CDockContainer::OnLButtonDown(UINT msg, WPARAM wparam, LPARAM lparam) + { + CPoint pt(lparam); + TCHITTESTINFO info = {}; + info.pt = pt; + m_pressedTab = HitTest(info); + + return FinalWindowProc(msg, wparam, lparam); + } + + // Called when the left mouse button is released. + // Overrides CTab::OnLButtonUp and takes no action. + inline LRESULT CDockContainer::OnLButtonUp(UINT msg, WPARAM wparam, LPARAM lparam) + { + return FinalWindowProc(msg, wparam, lparam); + } + + // Called when the mouse cursor is moved over the window. + // Overrides CTab::OnMouseLeave. + inline LRESULT CDockContainer::OnMouseLeave(UINT msg, WPARAM wparam, LPARAM lparam) + { + if (IsLeftButtonDown() && (m_pressedTab >= 0)) + { + if (GetDocker() && !(GetDocker()->GetDockStyle() & DS_NO_UNDOCK)) + { + CDockContainer* pContainer = GetActiveContainer(); + GetDocker()->UndockContainer(pContainer, GetCursorPos(), TRUE); + } + } + + m_pressedTab = -1; + return CTab::OnMouseLeave(msg, wparam, lparam); + } + + // Called when the mouse cursor is moved over the window. + inline LRESULT CDockContainer::OnMouseMove(UINT msg, WPARAM wparam, LPARAM lparam) + { + CPoint pt; + pt.x = GET_X_LPARAM(lparam); + pt.y = GET_Y_LPARAM(lparam); + + // Skip if mouse hasn't moved + if ((pt.x == m_oldMousePos.x) && (pt.y == m_oldMousePos.y)) + return FALSE; + + m_oldMousePos.x = pt.x; + m_oldMousePos.y = pt.y; + + if (IsLeftButtonDown()) + { + TCHITTESTINFO info = {}; + info.pt = CPoint(lparam); + int tab = HitTest(info); + if (tab >= 0 && m_pressedTab >= 0) + { + if (tab != m_pressedTab) + { + SwapTabs(tab, m_pressedTab); + m_pressedTab = tab; + SelectPage(tab); + } + } + } + + return CTab::OnMouseMove(msg, wparam, lparam); + } + + // Process notifications (WM_NOTIFY) reflected back from the parent. + inline LRESULT CDockContainer::OnNotifyReflect(WPARAM, LPARAM lparam) + { + LPNMHDR pHeader = reinterpret_cast(lparam); + switch (pHeader->code) + { + case TCN_SELCHANGE: return OnTCNSelChange(pHeader); + } + + return 0; + } + + // Called when the window gets keyboard focus. We set the keyboard focus + // to the active view window. + inline LRESULT CDockContainer::OnSetFocus(UINT msg, WPARAM wparam, LPARAM lparam) + { + // Sets the focus to the active view (or its child). + HWND prevFocus = reinterpret_cast(wparam); + if (GetActiveView() && GetActiveView()->IsWindow()) + { + if (GetActiveView()->IsChild(prevFocus)) + { + // Return focus back to the child of the active view that had it before. + ::SetFocus(prevFocus); + } + else + GetActiveView()->SetFocus(); + } + + return FinalWindowProc(msg, wparam, lparam); + } + + // Called when the window is resized. + inline LRESULT CDockContainer::OnSize(UINT, WPARAM, LPARAM) + { + RecalcLayout(); + return 0; + } + + // Called when the currently selected tab has changed. + inline LRESULT CDockContainer::OnTCNSelChange(LPNMHDR) + { + // Display the newly selected tab page. + int page = GetCurSel(); + SelectPage(page); + + return 0; + } + + // Called prior to window creation to set the CREATESTRUCT parameters. + inline void CDockContainer::PreCreate(CREATESTRUCT& cs) + { + // For Tabs on the bottom, add the TCS_BOTTOM style. + CTab::PreCreate(cs); + cs.style |= TCS_BOTTOM; + } + + // Repositions the child windows when the window is resized. + inline void CDockContainer::RecalcLayout() + { + CDockContainer* parent = GetContainerParent(); + + // Set the tab sizes. + parent->SetTabSize(); + + // Position the View over the tab control's display area. + CRect rc = parent->GetClientRect(); + parent->AdjustRect(FALSE, &rc); + + if (parent->m_allInfo.size() > 0) + { + size_t pageIndex = static_cast(parent->m_currentPage); + CDockContainer* pContainer = parent->m_allInfo[pageIndex].pContainer; + auto& viewPage = pContainer->GetViewPage(); + if (viewPage.IsWindow()) + { + VERIFY(viewPage.SetWindowPos(HWND_TOP, rc, SWP_SHOWWINDOW)); + viewPage.RecalcLayout(); + } + } + + parent->RedrawWindow(RDW_INVALIDATE | RDW_NOCHILDREN); + } + + // Removes the specified child container from this container group. + inline void CDockContainer::RemoveContainer(CDockContainer* pWnd, BOOL updateParent) + { + assert(pWnd); + if (!pWnd) return; + + // Must be called from the container parent. + assert(this == GetContainerParent()); + + // Remove the tab. + int tab = GetContainerIndex(pWnd); + DeleteItem(tab); + + // Remove the ContainerInfo entry. + int image = -1; + for (auto it = m_allInfo.begin(); it != m_allInfo.end(); ++it) + { + if (it->pContainer == pWnd) + { + image = (*it).tabImage; + if (image >= 0) + RemoveImage(image); + + m_allInfo.erase(it); + break; + } + } + + // Set the parent container relationships. + pWnd->GetViewPage().SetParent(*pWnd); + pWnd->m_pContainerParent = pWnd; + + // Display next lowest page. + m_currentPage = std::max(tab - 1, 0); + if (IsWindow() && updateParent) + { + if (GetItemCount() > 0) + SelectPage(m_currentPage); + else + m_pDocker->SetCaption(_T("")); + + RecalcLayout(); + } + } + + // Activates the specified page number. + inline void CDockContainer::SelectPage(int page) + { + if (this != m_pContainerParent) + m_pContainerParent->SelectPage(page); + else + { + if ((page >= 0) && (page < static_cast(m_allInfo.size()))) + { + if (GetCurSel() != page) + SetCurSel(page); + + // Create the new container window if required. + size_t pageIndex = static_cast(page); + if (!m_allInfo[pageIndex].pContainer->IsWindow()) + { + CDockContainer* pContainer = m_allInfo[pageIndex].pContainer; + pContainer->Create(GetParent()); + pContainer->GetViewPage().SetParent(*this); + } + + // Determine the size of the tab page's view area. + CRect rc = GetClientRect(); + AdjustRect(FALSE, &rc); + + // Swap the pages over. + CDockContainer* pNewContainer = m_allInfo[pageIndex].pContainer; + for (const ContainerInfo& ci : m_allInfo) + { + ci.pContainer->GetViewPage().ShowWindow(SW_HIDE); + } + + VERIFY(pNewContainer->GetViewPage().SetWindowPos(HWND_TOP, rc, + SWP_SHOWWINDOW)); + pNewContainer->GetViewPage().GetView()->SetFocus(); + + // Adjust the docking caption. + if (GetDocker()) + { + GetDocker()->SetCaption(pNewContainer->GetDockCaption()); + GetDocker()->RedrawWindow(); + } + + m_currentPage = page; + } + } + } + + // Sets the active container. + inline void CDockContainer::SetActiveContainer(CDockContainer* pContainer) + { + int page = GetContainerIndex(pContainer); + assert (0 <= page); + SelectPage(page); + } + + // Sets the caption of the docker whose view is this container. + inline void CDockContainer::SetDockCaption(LPCTSTR caption) + { + m_caption = caption; + if (IsWindow() && this == GetActiveContainer()) + { + GetContainerParent()->GetDocker()->SetCaption(caption); + GetContainerParent()->GetDocker()->RedrawWindow(); + } + } + + // Shows or hides the tab if it has only one page. + inline void CDockContainer::SetHideSingleTab(BOOL hideSingle) + // Only display tabs if there are two or more. + { + m_isHideSingleTab = hideSingle; + RecalcLayout(); + } + + // Sets the icon for this container's tab. + inline void CDockContainer::SetTabIcon(HICON tabIcon) + { + m_tabIcon = tabIcon; + int index = GetContainerIndex(this); + if (index >= 0) + { + int image = GetContainerParent()->GetImages().Replace(index, tabIcon); + size_t i = static_cast(index); + GetContainerParent()->m_allInfo[i].tabImage = image; + GetContainerParent()->SetTabSize(); + GetContainerParent()->UpdateTabs(); + } + } + + // Sets the icon for this container's tab. + inline void CDockContainer::SetTabIcon(UINT iconID) + { + HICON icon = reinterpret_cast(GetApp()->LoadImage(iconID, + IMAGE_ICON, 0, 0, LR_SHARED)); + SetTabIcon(icon); + } + + // Updates the tabs font based on the window's DPI. + inline void CDockContainer::SetTabsFontSize(int fontSize) + { + // Set the font used in the tabs. + CFont font; + NONCLIENTMETRICS info = GetNonClientMetrics(); + int dpi = GetWindowDpi(*this); + LOGFONT lf = info.lfStatusFont; + lf.lfHeight = -MulDiv(fontSize, dpi, POINTS_PER_INCH); + font.CreateFontIndirect(lf); + SetTabFont(font); + RecalcLayout(); + } + + // Updates the tabs icon size based on the window's DPI. + inline void CDockContainer::SetTabsIconSize(int iconSize) + { + int iconHeight = GetContainerParent()->DpiScaleInt(iconSize); + iconHeight = iconHeight - iconHeight % 8; + + if (this == GetContainerParent()) + { + std::vector& v = GetAll(); + GetImages().Create(iconHeight, iconHeight, ILC_MASK | ILC_COLOR32, 0, 0); + for (size_t i = 0; i < v.size(); ++i) + { + // Set the icons for the container parent. + CDockContainer* pContainer = GetContainerFromIndex(i); + if (pContainer) + v[i].tabImage = GetImages().Add(pContainer->GetTabIcon()); + } + } + else + { + // Set the icons for the container children, used if the container + // is undocked. + GetImages().Create(iconHeight, iconHeight, ILC_MASK | ILC_COLOR32, 0, 0); + GetImages().Add(GetTabIcon()); + } + RecalcLayout(); + } + + // Sets the size of the tabs to accommodate the tab's icon and text. + inline void CDockContainer::SetTabSize() + { + CRect rc = GetClientRect(); + AdjustRect(FALSE, &rc); + if (rc.Width() < 0) + rc.SetRectEmpty(); + + int itemWidth = 0; + int itemHeight = 1; + + CSize szImage = GetImages().GetIconSize(); + int padding = DpiScaleInt(4); + szImage.cx = szImage.cx + 2 * padding; + + if ((m_allInfo.size() > 0) && ((GetItemCount() != 1) || !m_isHideSingleTab)) + { + int imageX = szImage.cx; + int imageY = szImage.cy; + int tabTextWidth = GetMaxTabTextSize().cx; + itemWidth = std::min(imageX + tabTextWidth + padding, + (rc.Width() - 2) / static_cast(m_allInfo.size())); + itemHeight = std::max(imageY, GetTextHeight()) + padding; + } + + SetItemSize(itemWidth, itemHeight); + } + + // Sets the tab text for this container's tab. + inline void CDockContainer::SetTabText(LPCTSTR text) + { + m_tabText = text; + int index = GetContainerIndex(this); + if (index >= 0) + { + size_t i = static_cast(index); + GetContainerParent()->m_allInfo[i].tabText = text; + GetContainerParent()->SetTabSize(); + } + } + + // Sets the Image List for toolbars. A Disabled image list is created from + // ToolBarID if one doesn't already exist. + inline void CDockContainer::SetTBImageList(CToolBar& toolBar, UINT id, COLORREF mask) + { + // Get the image size. + CBitmap bm(id); + + // Assert if we failed to load the bitmap. + assert(bm.GetHandle() != nullptr); + + // Scale the bitmap to the window's DPI. + CBitmap dpiImage = DpiScaleUpBitmap(bm); + CSize sz = GetTBImageSize(&dpiImage); + + // Set the toolbar's image list. + CImageList imageList; + imageList.Create(sz.cx, sz.cy, ILC_COLOR32 | ILC_MASK, 0, 0); + imageList.Add(dpiImage, mask); + toolBar.SetImageList(imageList); + } + + // Sets the disabled Image List for toolbars. + inline void CDockContainer::SetTBImageListDis(CToolBar& toolBar, UINT id, + COLORREF mask) + { + // Get the image size. + CBitmap bm(id); + + // Assert if we failed to load the bitmap. + assert(bm.GetHandle() != nullptr); + + // Scale the bitmap to the window's DPI. + CBitmap dpiImage = DpiScaleUpBitmap(bm); + CSize sz = GetTBImageSize(&dpiImage); + + // Set the toolbar's image list. + CImageList imageList; + imageList.Create(sz.cx, sz.cy, ILC_COLOR32 | ILC_MASK, 0, 0); + imageList.Add(dpiImage, mask); + toolBar.SetDisableImageList(imageList); + } + + // Sets the Hot Image List for additional toolbars. + inline void CDockContainer::SetTBImageListHot(CToolBar& toolBar, UINT id, + COLORREF mask) + { + // Get the image size. + CBitmap bm(id); + + // Assert if we failed to load the bitmap. + assert(bm.GetHandle() != nullptr); + + // Scale the bitmap to the window's DPI. + CBitmap dpiImage = DpiScaleUpBitmap(bm); + CSize sz = GetTBImageSize(&dpiImage); + + // Set the toolbar's image list. + CImageList imageList; + imageList.Create(sz.cx, sz.cy, ILC_COLOR32 | ILC_MASK, 0, 0); + imageList.Add(dpiImage, mask); + toolBar.SetHotImageList(imageList); + } + + // Sets the toolbar's imagelist. Assumes the width of the button image + // equals the height, with a minimum width of 16. + // The color mask is ignored for 32bit bitmaps, but is required for 24bit bitmaps. + // The color mask is often gray RGB(192,192,192) or magenta (255,0,255). + // The hot and disabled bitmap resources can be 0. + // A disabled image list is created from the normal image list if one isn't + // provided. + inline void CDockContainer::SetToolBarImages(COLORREF mask, UINT normalID, + UINT hotID, UINT disabledID) + { + // Set the normal button images. + SetTBImageList(GetToolBar(), normalID, mask); + + // Set the hot button images. + if (hotID != 0) + SetTBImageListHot(GetToolBar(), hotID, mask); + else + SetTBImageListHot(GetToolBar(), normalID, mask); + + // Set the disabled button images. + if (disabledID != 0) + SetTBImageListDis(GetToolBar(), disabledID, mask); + else + { + CImageList toolBarDisabledImages; + toolBarDisabledImages.CreateDisabledImageList(GetToolBar().GetImageList()); + GetToolBar().SetDisableImageList(toolBarDisabledImages); + } + } + + // Use this function to set the Resource IDs for the toolbar(s). + inline void CDockContainer::SetupToolBar() + { +/* // Set the Resource IDs for the toolbar buttons + AddToolBarButton( IDM_FILE_NEW ); + AddToolBarButton( IDM_FILE_OPEN ); + AddToolBarButton( IDM_FILE_SAVE ); + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_EDIT_CUT ); + AddToolBarButton( IDM_EDIT_COPY ); + AddToolBarButton( IDM_EDIT_PASTE ); + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_FILE_PRINT ); + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_HELP_ABOUT ); +*/ + } + + // Sets or changes the container's view window. + // The view window can be any resizeable child window. + inline void CDockContainer::SetView(CWnd& wnd) const + { + GetViewPage().SetView(wnd); + } + + // Swaps the positions of the specified tabs. + inline void CDockContainer::SwapTabs(int tab1, int tab2) + { + size_t tab1Index = static_cast(tab1); + size_t tab2Index = static_cast(tab2); + assert (tab1Index < GetContainerParent()->m_allInfo.size()); + assert (tab2Index < GetContainerParent()->m_allInfo.size()); + + if (tab1 != tab2) + { + ContainerInfo info1 = GetContainerParent()->m_allInfo[tab1Index]; + ContainerInfo info2 = GetContainerParent()->m_allInfo[tab2Index]; + + TCITEM Item1 = {}; + Item1.mask = TCIF_IMAGE | TCIF_PARAM | TCIF_RTLREADING | TCIF_STATE | TCIF_TEXT; + Item1.cchTextMax = info1.tabText.GetLength()+1; + Item1.pszText = const_cast(info1.tabText.c_str()); + GetItem(tab1, &Item1); + + TCITEM Item2 = {}; + Item2.mask = TCIF_IMAGE | TCIF_PARAM | TCIF_RTLREADING | TCIF_STATE | TCIF_TEXT; + Item2.cchTextMax = info2.tabText.GetLength()+1; + Item2.pszText = const_cast(info2.tabText.c_str()); + GetItem(tab2, &Item2); + + SetItem(tab1, &Item2); + SetItem(tab2, &Item1); + GetContainerParent()->m_allInfo[tab1Index] = info2; + GetContainerParent()->m_allInfo[tab2Index] = info1; + } + } + + // Updates the font and icons in the tabs. + inline void CDockContainer::UpdateTabs() + { + SetTabsFontSize(); + SetTabsIconSize(); + } + + // Process the window's messages. + inline LRESULT CDockContainer::WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) + { + switch (msg) + { + case WM_LBUTTONDOWN: return OnLButtonDown(msg, wparam, lparam); + case WM_LBUTTONUP: return OnLButtonUp(msg, wparam, lparam); + case WM_MOUSELEAVE: return OnMouseLeave(msg, wparam, lparam); + case WM_MOUSEMOVE: return OnMouseMove(msg, wparam, lparam); + case WM_SETFOCUS: return OnSetFocus(msg, wparam, lparam); + case WM_SIZE: return OnSize(msg, wparam, lparam); + case WM_DPICHANGED_BEFOREPARENT: return OnDpiChangedBeforeParent(msg, wparam, lparam); + case UWM_GETCDOCKCONTAINER: return reinterpret_cast(this); + } + + // pass unhandled messages on to CTab for processing + return CTab::WndProcDefault(msg, wparam, lparam); + } + + + /////////////////////////////////////////// + // Declaration of the nested CViewPage class + // This is the class for the window displayed over the client area + // of the tab control. The toolbar and view window are child windows of the + // viewpage window. Only the ViewPage of the parent CDockContainer is displayed. + // Its contents are updated with the view window of the active container + // whenever a different tab is selected. + + inline CDockContainer::CViewPage::CViewPage() : m_pContainer(nullptr), + m_pView(nullptr), m_pTab(nullptr) + { + m_pToolBar = &m_toolBar; + } + + + // Returns a pointer to the parent dock container. + inline CDockContainer* CDockContainer::CViewPage::GetContainer() const + { + assert(m_pContainer); + return m_pContainer; + } + + // Forwards command messages (WM_COMMAND) to the active container. + inline BOOL CDockContainer::CViewPage::OnCommand(WPARAM wparam, LPARAM lparam) + { + BOOL isHandled = FALSE; + CDockContainer* pContainer = GetContainer(); + if (pContainer) + { + CDockContainer* pActiveContainer = pContainer->GetActiveContainer(); + if (pActiveContainer && pActiveContainer->IsWindow()) + { + isHandled = pActiveContainer->SendMessage(WM_COMMAND, wparam, + lparam) ? TRUE : FALSE; + } + } + + return isHandled; + } + + // Called during window creation. Creates the child view window. + inline int CDockContainer::CViewPage::OnCreate(CREATESTRUCT&) + { + if (m_pView) + m_pView->Create(*this); + + return 0; + } + + // Process WM_NOTIFY notifications from the child view window. + inline LRESULT CDockContainer::CViewPage::OnNotify(WPARAM wparam, LPARAM lparam) + { + LPNMHDR pHeader = reinterpret_cast(lparam); + switch (pHeader->code) + { + + // Display tooltips for the toolbar. + case TTN_GETDISPINFO: + { + int index = GetToolBar().HitTest(); + LPNMTTDISPINFO lpDispInfo = reinterpret_cast(lparam); + if (index >= 0) + { + UINT id = GetToolBar().GetCommandID(index); + if (id > 0) + { + m_tooltip = LoadString(id); + lpDispInfo->lpszText = const_cast(m_tooltip.c_str()); + } + else + m_tooltip = _T(""); + } + } + break; + case NM_CUSTOMDRAW: + { + if (pHeader->hwndFrom == GetToolBar()) + { + // Pass Toolbar's custom draw up to CFrame. + return GetAncestor().SendMessage(WM_NOTIFY, wparam, lparam); + } + } + break; + } // switch LPNMHDR + + return 0; + } + + // Called before window creation. Sets the WNDCLASS parameters. + inline void CDockContainer::CViewPage::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = _T("Win32++ TabPage"); + wc.hCursor = ::LoadCursor(nullptr, IDC_ARROW); + } + + // Called when the window is resized. Repositions the toolbar and view window. + inline void CDockContainer::CViewPage::RecalcLayout() const + { + CRect rc = GetClientRect(); + if (GetToolBar().IsWindow() && GetToolBar().IsWindowVisible()) + { + GetToolBar().Autosize(); + CRect rcToolBar = GetToolBar().GetClientRect(); + rc.top += rcToolBar.Height(); + } + + if (GetView()) + VERIFY(GetView()->SetWindowPos(HWND_TOP, rc, SWP_SHOWWINDOW)); + } + + // Sets or changes the View window displayed within the container. + inline void CDockContainer::CViewPage::SetView(CWnd& wndView) + { + if (m_pView != &wndView) + { + // Hide the existing view window (if any). + if (m_pView && m_pView->IsWindow()) + m_pView->ShowWindow(SW_HIDE); + + // Assign the view window. + m_pView = &wndView; + + if (IsWindow()) + { + if (!GetView()->IsWindow()) + GetView()->Create(*this); + else + { + GetView()->SetParent(*this); + GetView()->ShowWindow(); + } + + // The new view must not be a dockcontainer. + assert(GetView()->SendMessage(UWM_GETCDOCKCONTAINER) == 0); + + RecalcLayout(); + } + } + } + + // Process the window's messages. + inline LRESULT CDockContainer::CViewPage::WndProcDefault(UINT msg, + WPARAM wparam, LPARAM lparam) + { + switch (msg) + { + case WM_SIZE: + RecalcLayout(); + break; + } + + // pass unhandled messages on for default processing. + return CWnd::WndProcDefault(msg, wparam, lparam); + } + +} // namespace Win32xx + +#endif // _WIN32XX_DOCKING_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_exception.h b/packages/media/cpp/packages/Win32xx/include/wxx_exception.h new file mode 100644 index 00000000..034e1b7a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_exception.h @@ -0,0 +1,633 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + + +#ifndef _WIN32XX_EXCEPTION_H_ +#define _WIN32XX_EXCEPTION_H_ + + +// +// Sample code, demonstrating how to use CUserException with a string resource: +// +// try +// { +// ... +// if (failed) +// throw CUserException(id)); +// ... +// } +// catch(const CException &e) // catch all exceptions inherited from CException +// { +// // display the exception in a message box +// ::MessageBox(nullptr, LoadString(e.GetMessageID()), AtoT(e.what()), MB_ICONERROR); +// } + +// +// Sample code, demonstrating how to use CUserException with a text string: +// +// try +// { +// ... +// if (failed) +// throw CUserException(_T("Some Text")); +// ... +// } +// catch(const CException &e) // catch all exceptions inherited from CException +// { +// // display the exception in a message box +// ::MessageBox(nullptr, e.GetText(), AtoT(e.what()), MB_ICONERROR); +// } + + +namespace Win32xx +{ + //////////////////////////////////////////////////////////////////////// + // This is the base class for all exceptions defined by Win32++. + // This class has a pure virtual function and is an abstract class. + // We can't throw a CException directly, but we can throw any exception + // inherited from CException. We can catch all exceptions inherited from + // CException with a single catch statement. + // + class CException : public std::exception + { + public: + CException(int messageID) noexcept; + CException(LPCTSTR text = nullptr, int messageID = 0) noexcept; + CException(const CException& rhs) noexcept; + CException& operator=(const CException&) noexcept; + virtual ~CException() noexcept; + + DWORD GetError() const noexcept; + LPCTSTR GetErrorString() const noexcept; + int GetMessageID() const noexcept; + LPCTSTR GetText() const noexcept; + virtual const char* what() const noexcept = 0; // pure virtual function + + private: + TCHAR m_text[WXX_MAX_STRING_SIZE]; + TCHAR m_errorString[WXX_MAX_STRING_SIZE]; + int m_messageID; + DWORD m_error; + }; + + + /////////////////////////////////////////////////////////// + // This exception is used by CArchive and CFile to indicate + // a problem creating or accessing a file. + // Note: Each function guarantees not to throw an exception. + class CFileException : public CException + { + public: + CFileException(LPCTSTR filePath, int messageID) noexcept; + CFileException(LPCTSTR filePath, LPCTSTR text = nullptr, int messageID = 0) noexcept; + CFileException(const CFileException& rhs) noexcept; + CFileException& operator=(const CFileException& rhs) noexcept; + virtual ~CFileException() noexcept override; + + LPCTSTR GetFilePath() const noexcept; + LPCTSTR GetFileName() const noexcept; + virtual const char* what () const noexcept override; + + private: + TCHAR m_filePath[WXX_MAX_STRING_SIZE]; + }; + + + ////////////////////////////////////////////////////////////// + // This exception is used by the Win32++ framework to indicate + // errors that prevent Win32++ from running. + // Note: Each function guarantees not to throw an exception. + class CNotSupportedException : public CException + { + public: + CNotSupportedException(int messageID) noexcept; + CNotSupportedException(LPCTSTR text = nullptr, int messageID = 0) noexcept; + CNotSupportedException(const CNotSupportedException& rhs) noexcept; + CNotSupportedException& operator=(const CNotSupportedException& rhs) noexcept; + virtual ~CNotSupportedException() noexcept override; + virtual const char* what() const noexcept override; + }; + + + ////////////////////////////////////////////////////////////// + // This exception is used by the Win32++ framework to indicate + // a failure to create a GDI resource. + // Note: Each function guarantees not to throw an exception. + class CResourceException : public CException + { + public: + CResourceException(int messageID) noexcept; + CResourceException(LPCTSTR text = nullptr, int messageID = 0) noexcept; + CResourceException(const CResourceException& rhs) noexcept; + CResourceException& operator=(const CResourceException& rhs) noexcept; + virtual ~CResourceException() noexcept override; + virtual const char* what() const noexcept override; + }; + + + //////////////////////////////////////////////////////////////////////// + // This exception it thrown by CDataExchange when verifications fail. + // It is also the exception that is typically thrown by users. + // Users have the option of specifying text when the exception is thrown, + // and the option of specifying a message ID which could load text from + // a resource. + // Note: Each function guarantees not to throw an exception. + class CUserException : public CException + { + public: + CUserException(int messageID) noexcept; + CUserException(LPCTSTR text = nullptr, int messageID = 0) noexcept; + CUserException(const CUserException& rhs) noexcept; + CUserException& operator=(const CUserException& rhs) noexcept; + virtual ~CUserException() noexcept override; + virtual const char* what() const noexcept override; + }; + + + ///////////////////////////////////////////////////////////////////// + // This is thrown when an attempt to create a thread or window fails. + // GetErrorString can be used to retrieve the reason for the failure. + // Note: Each function guarantees not to throw an exception. + class CWinException : public CException + { + public: + CWinException(int messageID) noexcept; + CWinException(LPCTSTR text= nullptr, int messageID = 0) noexcept; + CWinException(const CWinException& rhs) noexcept; + CWinException& operator=(const CWinException& rhs) noexcept; + virtual ~CWinException() noexcept override; + virtual const char* what () const noexcept override; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + //////////////////////////////////////// + // Definitions for the CException class. + // + + // CException constructor. + inline CException::CException(int messageID) noexcept + : m_messageID(messageID), m_error(::GetLastError()) + { + *m_text = {}; + *m_errorString = {}; + + // Store error information in m_errorString. + DWORD flags = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS; + ::FormatMessage(flags, nullptr, m_error, 0, m_errorString, WXX_MAX_STRING_SIZE-1, nullptr); + + if (m_error == 0 && IsAppRunning()) + StrCopy(m_errorString, GetApp()->MsgNoError(), WXX_MAX_STRING_SIZE); + } + + + // CException constructor. + inline CException::CException(LPCTSTR text /*= nullptr*/, int messageID /*= 0*/) noexcept + : m_messageID(messageID), m_error(::GetLastError()) + { + *m_text = {}; + *m_errorString = {}; + + if (text) + StrCopy(m_text, text, WXX_MAX_STRING_SIZE); + + // Store error information in m_errorString. + DWORD flags = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS; + ::FormatMessage(flags, nullptr, m_error, 0, m_errorString, WXX_MAX_STRING_SIZE-1, nullptr); + + if (m_error == 0 && IsAppRunning()) + StrCopy(m_errorString, GetApp()->MsgNoError(), WXX_MAX_STRING_SIZE); + } + + // CException copy constructor. + inline CException::CException(const CException& rhs) noexcept + { + *m_text = {}; + *m_errorString = {}; + + m_messageID = rhs.m_messageID; + m_error = rhs.m_error; + + StrCopy(m_text, rhs.m_text, WXX_MAX_STRING_SIZE); + StrCopy(m_errorString, rhs.m_errorString, WXX_MAX_STRING_SIZE); + } + + // CException assignment operator. + inline CException& CException::operator=(const CException& rhs) noexcept + { + *m_text = {}; + *m_errorString = {}; + + m_messageID = rhs.m_messageID; + m_error = rhs.m_error; + + StrCopy(m_text, rhs.m_text, WXX_MAX_STRING_SIZE); + StrCopy(m_errorString, rhs.m_errorString, WXX_MAX_STRING_SIZE); + + return *this; + } + + // CException destructor. + inline CException::~CException() noexcept + { + } + + // Returns the error reported by GetLastError. + inline DWORD CException::GetError() const noexcept + { + return m_error; + } + + // Retrieves the error string from GetLastError. + inline LPCTSTR CException::GetErrorString() const noexcept + { + return m_errorString; + } + + // Retrieves the message ID specified when the exception is thrown. + // This could be a resource ID for a string in the resource script (resource.rc). + inline int CException::GetMessageID() const noexcept + { + return m_messageID; + } + + // Retrieves the string specified when the exception is thrown. + inline LPCTSTR CException::GetText() const noexcept + { + return m_text; + } + + + //////////////////////////////////////////// + // Definitions for the CFileException class. + // + + // CFileException constructor + inline CFileException::CFileException(LPCTSTR filePath, int messageID) noexcept + : CException(messageID) + { + *m_filePath = {}; + + // Display some text in the debugger. + TRACE(_T("*** CFileException thrown ***\n")); + + if (filePath) + { + StrCopy(m_filePath, filePath, WXX_MAX_STRING_SIZE); + TRACE(_T("File name: ")); + TRACE(filePath); + TRACE(_T("\n")); + } + + if (GetError() != 0) + TRACE(GetErrorString()); + } + + // CFileException constructor. + inline CFileException::CFileException( + LPCTSTR filePath, LPCTSTR text /*= nullptr*/, int messageID /*= 0*/) noexcept + : CException(text, messageID) + { + *m_filePath = {}; + + // Display some text in the debugger. + TRACE(_T("*** CFileException thrown ***\n")); + + if (filePath) + { + StrCopy(m_filePath, filePath, WXX_MAX_STRING_SIZE); + TRACE(_T("File name: ")); + TRACE(filePath); + TRACE(_T("\n")); + } + + if (text) + { + TRACE(text); + TRACE(_T("\n")); + } + + if (GetError() != 0) + TRACE(GetErrorString()); + } + + // CFileException copy constructor. + inline CFileException::CFileException(const CFileException& rhs) noexcept + : CException(rhs) + { + *m_filePath = {}; + StrCopy(m_filePath, rhs.m_filePath, WXX_MAX_STRING_SIZE); + } + + // CFileException assignment operator. + inline CFileException& CFileException::operator=(const CFileException& rhs) noexcept + { + CException::operator =(rhs); + *m_filePath = {}; + StrCopy(m_filePath, rhs.m_filePath, WXX_MAX_STRING_SIZE); + + return *this; + } + + // CFileException destructor. + inline CFileException::~CFileException() noexcept + { + } + + // Returns the filename and path specified when the exception was thrown. + inline LPCTSTR CFileException::GetFilePath() const noexcept + { + return m_filePath; + } + + // Returns the filename excluding the path. + inline LPCTSTR CFileException::GetFileName() const noexcept + { + // Get the index of the first character after the last '\'. + int index = lstrlen(m_filePath); + while ( index > 0 && m_filePath[index-1] != _T('\\') ) + { + --index; + } + + return m_filePath + index; // pointer arithmetic + } + + // Returns the exception type as a char string. Use AtoT to convert this to TCHAR. + inline const char* CFileException::what() const noexcept + { + return "Win32xx::CFileException"; + } + + + /////////////////////////////////////////////////// + // Definitions of the CNotSupportedException class. + // + + // CNotSupportedException constructor. + inline CNotSupportedException::CNotSupportedException(int messageID) noexcept + : CException(messageID) + { + // Display some text in the debugger. + TRACE(_T("*** CNotSupportedException thrown ***\n")); + + if (GetError() != 0) + TRACE(GetErrorString()); + } + + // CNotSupportedException constructor. + inline CNotSupportedException::CNotSupportedException( + LPCTSTR text /*= nullptr*/, int messageID /*= 0*/) noexcept + : CException(text, messageID) + { + // Display some text in the debugger. + TRACE(_T("*** CNotSupportedException thrown ***\n")); + + if (text) + { + TRACE(text); + TRACE(_T("\n")); + } + + if (GetError() != 0) + TRACE(GetErrorString()); + } + + // CNotSupportedException copy constructor. + inline CNotSupportedException::CNotSupportedException( + const CNotSupportedException& rhs) noexcept + : CException(rhs) + { + } + + // CNotSupportedException assignment operator. + inline CNotSupportedException& CNotSupportedException::operator=( + const CNotSupportedException& rhs) noexcept + { + CException::operator=(rhs); + return *this; + } + + // CNotSupportedException destructor. + inline CNotSupportedException::~CNotSupportedException() noexcept + { + if (GetError() != 0) + TRACE(GetErrorString()); + } + + // Returns the exception type as a char string. Use AtoT to convert this to TCHAR. + inline const char* CNotSupportedException::what() const noexcept + { + return "Win32xx::CNotSupportedException"; + } + + + /////////////////////////////////////////////// + // Definitions of the CResourceException class. + // + + // CResourceException constructor + inline CResourceException::CResourceException(int messageID) noexcept + : CException(messageID) + { + // Display some text in the debugger. + TRACE(_T("*** CResourceException thrown ***\n")); + + if (GetError() != 0) + TRACE(GetErrorString()); + } + + // CResourceException constructor. + inline CResourceException::CResourceException( + LPCTSTR text /*= nullptr*/, int messageID /*= 0*/) noexcept + : CException(text, messageID) + { + // Display some text in the debugger. + TRACE(_T("*** CResourceException thrown ***\n")); + + if (text) + { + TRACE(text); + TRACE(_T("\n")); + } + + if (GetError() != 0) + TRACE(GetErrorString()); + } + + // CResourceException copy constructor. + inline CResourceException::CResourceException(const CResourceException& rhs) noexcept + : CException(rhs) + { + } + + // CResourceException assignment operator. + inline CResourceException& CResourceException::operator=(const CResourceException& rhs) noexcept + { + CException::operator=(rhs); + return *this; + } + + // CResourceException destructor. + inline CResourceException::~CResourceException() noexcept + { + } + + // Returns the exception type as a char string. Use AtoT to convert this to TCHAR. + inline const char* CResourceException::what() const noexcept + { + return "Win32xx::CResourceException"; + } + + + /////////////////////////////////////////// + // Definitions of the CUserException class. + // + + // CUserException constructor. + inline CUserException::CUserException(int messageID) noexcept + : CException(messageID) + { + // Display some text in the debugger. + TRACE(_T("*** CUserException thrown ***\n")); + } + + // CUserException constructor. + inline CUserException::CUserException(LPCTSTR text /*= nullptr*/, int messageID /*= 0*/) noexcept + : CException(text, messageID) + { + // Display some text in the debugger. + TRACE(_T("*** CUserException thrown ***\n")); + + if (text) + { + TRACE(text); + TRACE(_T("\n")); + } + } + + // CUserException copy constructor. + inline CUserException::CUserException(const CUserException& rhs) noexcept + : CException(rhs) + { + } + + // CUserException assignment operator. + inline CUserException& CUserException::operator=(const CUserException& rhs) noexcept + { + CException::operator=(rhs); + return *this; + } + + // CUserException destructor. + inline CUserException::~CUserException() noexcept + { + } + + // Returns the exception type as a char string. Use AtoT to convert this to TCHAR. + inline const char* CUserException::what() const noexcept + { + return "Win32xx::CUserException"; + } + + + /////////////////////////////////////////// + // Definitions for the CWinException class. + // + + // CWinException constructor. + inline CWinException::CWinException(int messageID) noexcept + : CException(messageID) + { + // Display some text in the debugger. + TRACE(_T("*** CWinException thrown ***\n")); + + if (GetError() != 0) + TRACE(GetErrorString()); + } + + // CWinException constructor. + inline CWinException::CWinException(LPCTSTR text, int messageID) noexcept + : CException(text, messageID) + { + // Display some text in the debugger. + TRACE(_T("*** CWinException thrown ***\n")); + if (text) + { + TRACE(text); + TRACE(_T("\n")); + } + + if (GetError() != 0) + TRACE(GetErrorString()); + } + + // CWinFileException copy constructor. + inline CWinException::CWinException(const CWinException& rhs) noexcept + : CException(rhs) + { + } + + // CWinFileException assignment operator. + inline CWinException& CWinException::operator=(const CWinException& rhs) noexcept + { + CException::operator =(rhs); + return *this; + } + + // CWinException destructor. + inline CWinException::~CWinException() noexcept + { + } + + // Returns the exception type as a char string. Use AtoT to convert this to TCHAR. + inline const char * CWinException::what() const noexcept + { + return "Win32xx::CWinException"; + } + + +} // namespace Win32xx + + +#endif // _WIN32XX_EXCEPTION_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_file.h b/packages/media/cpp/packages/Win32xx/include/wxx_file.h new file mode 100644 index 00000000..2dafda97 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_file.h @@ -0,0 +1,540 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +#ifndef _WIN32XX_FILE_H_ +#define _WIN32XX_FILE_H_ + + +#include "wxx_wincore.h" + + +namespace Win32xx +{ + + ////////////////////////////////////////////////////////// + // The CFile class manages files. It can be used to + // create, read from, write to, rename, and remove a file. + class CFile + { + public: + // File open flags. + enum OpenFlags + { + modeCreate = CREATE_ALWAYS, // Creates a new file. Truncates existing file to length 0. + modeNoTruncate = OPEN_ALWAYS, // Creates a new file or opens an existing one. + shareExclusive = 0x0010, // Denies read and write access to all others. + shareDenyWrite = 0x0020, // Denies write access to all others. + shareDenyRead = 0x0030, // Denies read access to all others. + shareDenyNone = 0x0040, // No sharing restrictions. + modeRead = 0x0100, // Requests read access only. + modeWrite = 0x0200, // Requests write access only. + modeReadWrite = 0x0300, // Requests read and write access. + modeNone = 0x0400 // Requests neither read nor write access. + }; + + CFile(); + CFile(HANDLE file); + CFile(LPCTSTR fileName, UINT openFlags); + CFile(LPCTSTR fileName, UINT openFlags, DWORD attributes); + virtual ~CFile(); + operator HANDLE() const; + + void Close(); + void Flush() const; + CString GetFileDirectory() const; + const CString& GetFileName() const; + CString GetFileNameExt() const; + CString GetFileNameWOExt() const; + const CString& GetFilePath() const; +#ifndef WIN32_LEAN_AND_MEAN + CString GetFileTitle() const; +#endif + HANDLE GetHandle() const; + ULONGLONG GetLength() const; + ULONGLONG GetPosition() const; + void LockRange(ULONGLONG pos, ULONGLONG count) const; + void Open(LPCTSTR fileName, UINT openFlags, + DWORD attributes = FILE_ATTRIBUTE_NORMAL); + UINT Read(void* buffer, UINT count) const; + void Remove(LPCTSTR fileName) const; + void Rename(LPCTSTR oldName, LPCTSTR newName) const; + ULONGLONG Seek(LONGLONG seekTo, UINT method) const; + void SeekToBegin() const; + ULONGLONG SeekToEnd() const; + void SetFilePath(LPCTSTR fileName); + void SetLength(LONGLONG length) const; + void UnlockRange(ULONGLONG pos, ULONGLONG count) const; + void Write(const void* buffer, UINT count) const; + + private: + CFile(const CFile&) = delete; + CFile& operator=(const CFile&) = delete; + + CString m_fileName; + CString m_filePath; + HANDLE m_file; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + /////////////////////////////////// + // Definitions for the CFile class. + // + + inline CFile::CFile() : m_file(INVALID_HANDLE_VALUE) + { + } + + inline CFile::CFile(HANDLE file) : m_file(file) + { + } + + // Possible nOpenFlag values: CREATE_NEW, CREATE_ALWAYS, OPEN_EXISTING, + // OPEN_ALWAYS, TRUNCATE_EXISTING. + // Default value: OPEN_EXISTING | modeReadWrite + // The following modes are also supported: + // modeCreate Creates a new file. Truncates an existing file to length 0. + // modeNoTruncate Creates a a new file, or opens an existing one. + // modeRead Requests read access only. + // modeWrite Requests write access only. + // modeReadWrite Requests read and write access. + // modeNone Requests neither read nor write access. + // shareExclusive Denies read and write access to all others. + // shareDenyWrite Denies write access to all others. + // shareDenyRead Denies read access to all others. + // shareDenyNone No sharing restrictions. + // Refer to CreateFile in the Windows API documentation for more information. + inline CFile::CFile(LPCTSTR fileName, UINT openFlags) : m_file(INVALID_HANDLE_VALUE) + { + assert(fileName); + Open(fileName, openFlags); // Throws CFileException on failure. + } + + // Possible attribute values: + // FILE_ATTRIBUTE_ARCHIVE, FILE_ATTRIBUTE_ENCRYPTED, + // FILE_ATTRIBUTE_HIDDEN, FILE_ATTRIBUTE_NORMAL, + // FILE_ATTRIBUTE_NOT_CONTENT_INDEXED, FILE_ATTRIBUTE_OFFLINE, + // FILE_ATTRIBUTE_READONLY, FILE_ATTRIBUTE_SYSTEM, + // FILE_ATTRIBUTE_TEMPORARY, FILE_FLAG_BACKUP_SEMANTICS, + // FILE_FLAG_DELETE_ON_CLOSE, FILE_FLAG_NO_BUFFERING, + // FILE_FLAG_OPEN_NO_RECALL, FILE_FLAG_OPEN_REPARSE_POINT, + // FILE_FLAG_OVERLAPPED, FILE_FLAG_POSIX_SEMANTICS, + // FILE_FLAG_RANDOM_ACCESS, FILE_FLAG_SEQUENTIAL_SCAN, + // FILE_FLAG_WRITE_THROUGH. + // Refer to CreateFile in the Windows API documentation for more information. + inline CFile::CFile(LPCTSTR fileName, UINT openFlags, DWORD attributes) : m_file(INVALID_HANDLE_VALUE) + { + assert(fileName); + Open(fileName, openFlags, attributes); // Throws CFileException on failure. + } + + inline CFile::~CFile() + { + if (m_file != INVALID_HANDLE_VALUE) + ::CloseHandle(m_file); + } + + inline CFile::operator HANDLE() const + { + return m_file; + } + + // Closes the file associated with this object. Closed file can no longer + // be read or written to. + // Refer to CloseHandle in the Windows API documentation for more information. + inline void CFile::Close() + { + m_fileName.Empty(); + m_filePath.Empty(); + + if (m_file != INVALID_HANDLE_VALUE) + { + if (!::CloseHandle(m_file)) + { + m_file = INVALID_HANDLE_VALUE; + throw CFileException(GetFilePath(), GetApp()->MsgFileClose()); + } + } + + m_file = INVALID_HANDLE_VALUE; + } + + // Causes any remaining data in the file buffer to be written to the file. + // Refer to FlushFileBuffers in the Windows API documentation for more information. + inline void CFile::Flush() const + { + assert(m_file != INVALID_HANDLE_VALUE); + if ( !::FlushFileBuffers(m_file)) + throw CFileException(GetFilePath(), GetApp()->MsgFileFlush()); + } + + // Returns the file handle associated with this object. + inline HANDLE CFile::GetHandle() const + { + return m_file; + } + + // Returns the directory of the file associated with this object. + inline CString CFile::GetFileDirectory() const + { + CString directory; + + int sep = m_filePath.ReverseFind(_T('\\')); + if (sep > 0) + directory = m_filePath.Left(sep); + + return directory; + } + + // Returns the filename of the file associated with this object, not + // including the directory. + inline const CString& CFile::GetFileName() const + { + return m_fileName; + } + + // Returns the extension part of the filename of the file associated with + // this object. + inline CString CFile::GetFileNameExt() const + { + CString extension; + int dot = m_fileName.ReverseFind(_T('.')); + if (dot >= 0) + extension = m_fileName.Mid(dot+1); + + return extension; + } + + // Returns the filename of the file associated with this object, not + // including the directory, without its extension. + inline CString CFile::GetFileNameWOExt() const + { + CString fileNameWOExt = m_fileName; + int dot = m_fileName.ReverseFind(_T('.')); + if (dot >= 0) + fileNameWOExt = m_fileName.Left(dot); + + return fileNameWOExt; + } + + // Returns the full filename including the directory of the file associated + // with this object. + inline const CString& CFile::GetFilePath() const + { + return m_filePath; + } + +#ifndef WIN32_LEAN_AND_MEAN + // Returns the string that the system would use to display the file name to + // the user. The string might or might not contain the filename's extension + // depending on user settings. + // Refer to GetFileTitle in the Windows API documentation for more information. + inline CString CFile::GetFileTitle() const + { + CString fileTitle; + int buffSize = m_filePath.GetLength(); + if (buffSize > 0) + { + ::GetFileTitle(m_filePath, fileTitle.GetBuffer(buffSize), static_cast(buffSize)); + fileTitle.ReleaseBuffer(); + } + + return fileTitle; + } +#endif + + // Returns the length of the file in bytes. + // Refer to SetFilePointer in the Windows API documentation for more information. + inline ULONGLONG CFile::GetLength() const + { + assert(m_file != INVALID_HANDLE_VALUE); + + LONG highPosCur = 0; + LONG highPosEnd = 0; + + DWORD lowPosCur = SetFilePointer(m_file, 0, &highPosCur, FILE_CURRENT); + DWORD lowPosEnd = SetFilePointer(m_file, 0, &highPosEnd, FILE_END); + SetFilePointer(m_file, static_cast(lowPosCur), &highPosCur, FILE_BEGIN); + + ULONGLONG result = (static_cast(highPosEnd) << 32) + lowPosEnd; + return result; + } + + // Returns the current value of the file pointer that can be used in + // subsequent calls to Seek. + // Refer to SetFilePointer in the Windows API documentation for more information. + inline ULONGLONG CFile::GetPosition() const + { + assert(m_file != INVALID_HANDLE_VALUE); + LONG high = 0; + DWORD lowPos = SetFilePointer(m_file, 0, &high, FILE_CURRENT); + + ULONGLONG result = (static_cast(high) << 32) + lowPos; + return result; + } + + // Locks a range of bytes in and open file. + // Refer to LockFile in the Windows API documentation for more information. + inline void CFile::LockRange(ULONGLONG pos, ULONGLONG count) const + { + assert(m_file != INVALID_HANDLE_VALUE); + + DWORD posHigh = static_cast(pos >> 32); + DWORD posLow = static_cast(pos & 0xFFFFFFFF); + DWORD countHigh = static_cast(count >> 32); + DWORD countLow = static_cast(count & 0xFFFFFFFF); + + if (!::LockFile(m_file, posLow, posHigh, countLow, countHigh)) + throw CFileException(GetFilePath(), GetApp()->MsgFileLock()); + } + + // Prepares a file to be written to or read from. + // Possible openFlag values: CREATE_NEW, CREATE_ALWAYS, OPEN_EXISTING, + // OPEN_ALWAYS, TRUNCATE_EXISTING + // Default value: OPEN_EXISTING | modeReadWrite + // The following modes are also supported: + // modeCreate Creates a new file. Truncates an existing file to length 0. + // modeNoTruncate Creates a a new file, or opens an existing one. + // modeRead Requests read access only. + // modeWrite Requests write access only. + // modeReadWrite Requests read and write access. + // modeNone Requests neither read nor write access. + // shareExclusive Denies read and write access to all others. + // shareDenyWrite Denies write access to all others. + // shareDenyRead Denies read access to all others. + // shareDenyNone No sharing restrictions. + // Possible attribute values: + // FILE_ATTRIBUTE_ARCHIVE, FILE_ATTRIBUTE_ENCRYPTED, + // FILE_ATTRIBUTE_HIDDEN, FILE_ATTRIBUTE_NORMAL, + // FILE_ATTRIBUTE_NOT_CONTENT_INDEXED, FILE_ATTRIBUTE_OFFLINE, + // FILE_ATTRIBUTE_READONLY, FILE_ATTRIBUTE_SYSTEM, + // FILE_ATTRIBUTE_TEMPORARY, FILE_FLAG_BACKUP_SEMANTICS, + // FILE_FLAG_DELETE_ON_CLOSE, FILE_FLAG_NO_BUFFERING, + // FILE_FLAG_OPEN_NO_RECALL, FILE_FLAG_OPEN_REPARSE_POINT, + // FILE_FLAG_OVERLAPPED, FILE_FLAG_POSIX_SEMANTICS, + // FILE_FLAG_RANDOM_ACCESS, FILE_FLAG_SEQUENTIAL_SCAN, + // FILE_FLAG_WRITE_THROUGH. + // Refer to CreateFile in the Windows API documentation for more information. + inline void CFile::Open(LPCTSTR fileName, UINT openFlags, DWORD attributes) + { + if (m_file != INVALID_HANDLE_VALUE) + Close(); + + DWORD access = 0; + switch (openFlags & 0xF00) + { + case modeNone: + access = 0; break; + case modeRead: + access = GENERIC_READ; break; + case modeWrite: + access = GENERIC_WRITE; break; + case modeReadWrite: + access = GENERIC_READ | GENERIC_WRITE; break; + default: + access = GENERIC_READ | GENERIC_WRITE; break; + } + + DWORD share = 0; + switch (openFlags & 0xF0) + { + case shareExclusive: share = 0; break; + case shareDenyWrite: share = FILE_SHARE_READ; break; + case shareDenyRead: share = FILE_SHARE_WRITE; break; + case shareDenyNone: share = FILE_SHARE_READ | FILE_SHARE_WRITE; break; + default: share = 0; break; + } + + DWORD create = openFlags & 0xF; + if (create & OPEN_ALWAYS) openFlags = OPEN_ALWAYS; + if (create == 0) create = OPEN_EXISTING; + + m_file = ::CreateFile(fileName, access, share, nullptr, create, attributes, 0); + + if (INVALID_HANDLE_VALUE == m_file) + { + throw CFileException(fileName, GetApp()->MsgFileOpen()); + } + + if (m_file != INVALID_HANDLE_VALUE) + { + SetFilePath(fileName); + } + + } + + // Reads from the file, storing the contents in the specified buffer. + // Refer to ReadFile in the Windows API documentation for more information. + inline UINT CFile::Read(void* buffer, UINT count) const + { + assert(m_file != INVALID_HANDLE_VALUE); + + if (count == 0) return 0; + + assert(buffer); + DWORD read = 0; + + if (!::ReadFile(m_file, buffer, count, &read, nullptr)) + throw CFileException(GetFilePath(), GetApp()->MsgFileRead()); + + return read; + } + + // Renames the specified file. + // Refer to MoveFile in the Windows API documentation for more information. + inline void CFile::Rename(LPCTSTR oldName, LPCTSTR newName) const + { + if (!::MoveFile(oldName, newName)) + throw CFileException(oldName, GetApp()->MsgFileRename()); + } + + // Deletes the specified file. + // Refer to DeleteFile in the Windows API documentation for more information. + inline void CFile::Remove(LPCTSTR fileName) const + { + if (!::DeleteFile(fileName)) + throw CFileException(fileName, GetApp()->MsgFileRemove()); + } + + // Positions the current file pointer. + // Permitted values for method are: FILE_BEGIN, FILE_CURRENT, or FILE_END. + // Refer to SetFilePointer in the Windows API documentation for more information. + inline ULONGLONG CFile::Seek(LONGLONG seekTo, UINT method) const + { + assert(m_file != INVALID_HANDLE_VALUE); + assert(method == FILE_BEGIN || method == FILE_CURRENT || method == FILE_END); + + LONG high = static_cast(seekTo >> 32); + LONG low = static_cast(seekTo & 0xFFFFFFFF); + + DWORD lowPos = SetFilePointer(m_file, low, &high, method); + + ULONGLONG result = (static_cast(high) << 32) + lowPos; + return result; + } + + // Sets the current file pointer to the beginning of the file. + // Refer to Seek in the Windows API documentation for more information. + inline void CFile::SeekToBegin() const + { + assert(m_file != INVALID_HANDLE_VALUE); + Seek(0, FILE_BEGIN); + } + + // Sets the current file pointer to the end of the file. + // Refer to Seek in the Windows API documentation for more information. + inline ULONGLONG CFile::SeekToEnd() const + { + assert(m_file != INVALID_HANDLE_VALUE); + return Seek(0, FILE_END); + } + + // Assigns the specified full file path to this object. + // Call this function if the file path is not supplied when the CFile is + // constructed. + // Note: this function does not open or create the specified file. + inline void CFile::SetFilePath(LPCTSTR fileName) + { + LPTSTR pShortFileName = nullptr; + + DWORD buffSize = ::GetFullPathName(fileName, 0, 0, 0); + int buffer = static_cast(buffSize); + if (buffer > 0) + { + ::GetFullPathName(fileName, buffSize, m_filePath.GetBuffer(buffer), &pShortFileName); + + if (pShortFileName != nullptr) + m_fileName = pShortFileName; + else + m_fileName = _T(""); + + m_filePath.ReleaseBuffer(); + } + } + + // Changes the length of the file to the specified value. + // Refer to SetEndOfFile in the Windows API documentation for more information. + inline void CFile::SetLength(LONGLONG length) const + { + assert(m_file != INVALID_HANDLE_VALUE); + + Seek(length, FILE_BEGIN); + if (!::SetEndOfFile(m_file)) + throw CFileException(GetFilePath(), GetApp()->MsgFileLength()); + } + + // Unlocks a range of bytes in an open file. + // Refer to UnlockFile in the Windows API documentation for more information. + inline void CFile::UnlockRange(ULONGLONG pos, ULONGLONG count) const + { + assert(m_file != INVALID_HANDLE_VALUE); + + DWORD posHigh = static_cast(pos >> 32); + DWORD posLow = static_cast(pos & 0xFFFFFFFF); + DWORD countHigh = static_cast(count >> 32); + DWORD countLow = static_cast(count & 0xFFFFFFFF); + + if (!::UnlockFile(m_file, posLow, posHigh, countLow, countHigh)) + throw CFileException(GetFilePath(), GetApp()->MsgFileUnlock()); + } + + // Writes the specified buffer to the file. + // Refer to WriteFile in the Windows API documentation for more information. + inline void CFile::Write(const void* buffer, UINT count) const + { + assert(m_file != INVALID_HANDLE_VALUE); + + if (count == 0) return; + + assert(buffer); + DWORD written = 0; + if (!::WriteFile(m_file, buffer, count, &written, nullptr)) + throw CFileException(GetFilePath(), GetApp()->MsgFileWrite()); + + if (written != count) + throw CFileException(GetFilePath(), GetApp()->MsgFileWrite()); + } + +} // namespace Win32xx + +#endif diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_filefind.h b/packages/media/cpp/packages/Win32xx/include/wxx_filefind.h new file mode 100644 index 00000000..477e45b7 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_filefind.h @@ -0,0 +1,376 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////// +// Acknowledgement: +// +// The original author of CFileFind is: +// +// Robert C. Tausworthe +// email: robert.c.tausworthe@ieee.org +// +//////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////// +// The CFileFind provides a means of finding one or more +// files that match a search string. Information can be +// extracted from each file found. + + +// Example code +/* + +CFileFind ff; +if (ff.FindFirstFile(_T("C:\\SomeFolder\\*.*"))) +{ + do + { + // Do something with each file found + std::cout << ff.GetFilePath() << std::endl; + } + while (ff.FindNextFile()); +} + +*/ + + +#ifndef _WIN32XX_FILEFIND_H_ +#define _WIN32XX_FILEFIND_H_ + +#include "wxx_wincore.h" + + +namespace Win32xx +{ + + //////////////////////////////////////////////////////// + // CFindFile finds one or more files matching the string + // specified by FindFirstFile. + class CFileFind + { + public: + CFileFind(); + virtual ~CFileFind(); + + BOOL FindFirstFile(LPCTSTR fileSearch = nullptr); + BOOL FindNextFile(); + FILETIME GetCreationTime() const; + DWORD GetFileAttributes() const; + CString GetFileName() const; + CString GetFilePath() const; + CString GetFileTitle() const; + CString GetFileURL() const; + FILETIME GetLastAccessTime() const; + FILETIME GetLastWriteTime() const; + ULONGLONG GetLength() const; + CString GetRoot() const; + BOOL IsArchived() const; + BOOL IsCompressed() const; + BOOL IsDirectory() const; + BOOL IsDots() const; + BOOL IsHidden() const; + BOOL IsNormal() const; + BOOL IsReadOnly() const; + BOOL IsSystem() const; + BOOL IsTemporary() const; + + private: + void Close(); + + WIN32_FIND_DATA m_findData; + HANDLE m_fileFind; + CString m_root; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + /////////////////////////////////////// + // Definitions for the CFindFile class. + // + + // Construct a CFileFind object for file searches. + inline CFileFind::CFileFind() + { + m_fileFind = INVALID_HANDLE_VALUE; + m_findData = {}; + } + + inline CFileFind::~CFileFind() + { + Close(); + } + + // Closes the FileFind handle and returns the CFileFind object to default. + inline void CFileFind::Close() + { + m_findData = {}; + + if (m_fileFind != INVALID_HANDLE_VALUE) + ::FindClose(m_fileFind); + + m_root.Empty(); + m_fileFind = INVALID_HANDLE_VALUE; + } + + // Searches a directory for a file or subdirectory with a name that matches + // the fileSearch. The fileSearch can contain a valid directory or path, and a + // file name that can contain the '?' and '*' wildcard characters. + // A name of "*.*" is used if no name is specified. + // Returns TRUE if a matching file was found, FALSE otherwise. + // Refer to FindFirstFile in the Windows API documentation for more information. + inline BOOL CFileFind::FindFirstFile(LPCTSTR fileSearch /* = nullptr */) + { + // Reset the this to default. + Close(); + + // Default the name to all files in the current directory. + if (fileSearch == nullptr) + fileSearch = _T("*.*"); + + // Search for the first file matching the name. + m_fileFind = ::FindFirstFile(fileSearch, &m_findData); + + if (m_fileFind == INVALID_HANDLE_VALUE) + { + Close(); + return FALSE; + } + + // Extract the directory part of the name (if any) + CString str = fileSearch; + int delimiter = str.ReverseFind(_T('\\')); + if (delimiter >= 0) + { + m_root = str.Left(delimiter); + m_root += _T('\\'); + } + + return TRUE; + } + + // Finds the next file or directory that matches the string specified in FindFirstFile. + // Return TRUE if the next file was found, FALSE on failure. + // Refer to FindNextFile in the Windows API documentation for more information. + inline BOOL CFileFind::FindNextFile() + { + assert(m_fileFind != INVALID_HANDLE_VALUE); + + BOOL isFound = ::FindNextFile(m_fileFind, &m_findData); + + if (!isFound) + Close(); + + return isFound; + } + + // Return the found file's creation time + inline FILETIME CFileFind::GetCreationTime() const + { + assert(m_fileFind != INVALID_HANDLE_VALUE); + return m_findData.ftCreationTime; + } + + // Returns the found file's attributes. Possible attributes are: + // FILE_ATTRIBUTE_ARCHIVE; FILE_ATTRIBUTE_COMPRESSED; FILE_ATTRIBUTE_DIRECTORY; + // FILE_ATTRIBUTE_ENCRYPTED; FILE_ATTRIBUTE_HIDDEN; FILE_ATTRIBUTE_NORMAL; + // FILE_ATTRIBUTE_OFFLINE; FILE_ATTRIBUTE_READONLY; FILE_ATTRIBUTE_REPARSE_POINT; + // FILE_ATTRIBUTE_SPARSE_FILE; FILE_ATTRIBUTE_SYSTEM; FILE_ATTRIBUTE_TEMPORARY. + inline DWORD CFileFind::GetFileAttributes() const + { + assert(m_fileFind != INVALID_HANDLE_VALUE); + return m_findData.dwFileAttributes; + } + + // Return the found file's name, including the file's extension. + inline CString CFileFind::GetFileName() const + { + assert(m_fileFind != INVALID_HANDLE_VALUE); + return m_findData.cFileName; + } + + // Returns the full path of the found file, including the directory, + // file title, and extension. + // Refer to GetFullPathName in the Windows API documentation for more information. + inline CString CFileFind::GetFilePath() const + { + assert(m_fileFind != INVALID_HANDLE_VALUE); + + CString searchName = m_root + m_findData.cFileName; + CString filePath; + + int buffSize = static_cast(::GetFullPathName(searchName, 0, 0, 0)); + if (buffSize > 0) + { + ::GetFullPathName(searchName, static_cast(buffSize), filePath.GetBuffer(buffSize), nullptr); + filePath.ReleaseBuffer(); + } + + return filePath; + } + + // Return the file name, without the extension. + inline CString CFileFind::GetFileTitle() const + { + assert(m_fileFind != INVALID_HANDLE_VALUE); + + CString name = m_findData.cFileName; + if (!IsDots()) + { + int dot = name.ReverseFind(_T('.')); + if (dot >= 0) + name = name.Left(dot); + } + return name; + } + + // Return the URL form of the path name, viz., file://path. + inline CString CFileFind::GetFileURL() const + { + assert(m_fileFind != INVALID_HANDLE_VALUE); + + CString str(_T("file://")); + str += GetFilePath(); + return str; + } + + // Return the last access time of the found file. + inline FILETIME CFileFind::GetLastAccessTime() const + { + assert(m_fileFind != INVALID_HANDLE_VALUE); + return m_findData.ftLastAccessTime; + } + + // Return the last write time of the found file. + inline FILETIME CFileFind::GetLastWriteTime() const + { + assert(m_fileFind != INVALID_HANDLE_VALUE); + return m_findData.ftLastWriteTime; + } + + // Return the length of the found file, in bytes. + inline ULONGLONG CFileFind::GetLength() const + { + assert(m_fileFind != INVALID_HANDLE_VALUE); + ULONGLONG length = m_findData.nFileSizeHigh; + length <<= 32; + return length | m_findData.nFileSizeLow; + } + + // Return the directory part of the name search string. + inline CString CFileFind::GetRoot() const + { + assert(m_fileFind != INVALID_HANDLE_VALUE); + return m_root; + } + + // Return TRUE if the archive attribute is set. + inline BOOL CFileFind::IsArchived() const + { + assert(m_fileFind != INVALID_HANDLE_VALUE); + return (m_findData.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE) ? TRUE : FALSE; + } + + // Return TRUE if the found file is compressed. + inline BOOL CFileFind::IsCompressed() const + { + assert(m_fileFind != INVALID_HANDLE_VALUE); + return (m_findData.dwFileAttributes & FILE_ATTRIBUTE_COMPRESSED) ? TRUE : FALSE; + } + + // Return TRUE if the found file is a directory. + inline BOOL CFileFind::IsDirectory() const + { + assert(m_fileFind != INVALID_HANDLE_VALUE); + return (m_findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? TRUE : FALSE; + } + + // Return TRUE if the found file is the current directory or parent directory. + inline BOOL CFileFind::IsDots() const + { + assert(m_fileFind != INVALID_HANDLE_VALUE); + LPCTSTR fn = m_findData.cFileName; + return (IsDirectory() && (fn[0] == _T('.')) && ((fn[1] == _T('\0') || + (fn[1] == _T('.') && fn[2] == _T('\0'))))); + } + + // Return TRUE if the found file is hidden. + inline BOOL CFileFind::IsHidden() const + { + assert(m_fileFind != INVALID_HANDLE_VALUE); + return (m_findData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) ? TRUE : FALSE; + } + + // Return TRUE if the found file has the FILE_ATTRIBUTE_NORMAL attribute. + inline BOOL CFileFind::IsNormal() const + { + assert(m_fileFind != INVALID_HANDLE_VALUE); + return (m_findData.dwFileAttributes & FILE_ATTRIBUTE_NORMAL) ? TRUE : FALSE; + } + + // Return TRUE if the found file is read only. + inline BOOL CFileFind::IsReadOnly() const + { + assert(m_fileFind != INVALID_HANDLE_VALUE); + return (m_findData.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? TRUE : FALSE; + } + + // Return TRUE if the found file is a system file. + inline BOOL CFileFind::IsSystem() const + { + assert(m_fileFind != INVALID_HANDLE_VALUE); + return (m_findData.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) ? TRUE : FALSE; + } + + // Return TRUE if the found file is a temporary file. + inline BOOL CFileFind::IsTemporary() const + { + assert(m_fileFind != INVALID_HANDLE_VALUE); + return (m_findData.dwFileAttributes & FILE_ATTRIBUTE_TEMPORARY) ? TRUE : FALSE; + } + + +} + + +#endif // _WIN32XX_FILEFIND_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_folderdialog.h b/packages/media/cpp/packages/Win32xx/include/wxx_folderdialog.h new file mode 100644 index 00000000..16d11b86 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_folderdialog.h @@ -0,0 +1,351 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////////// +// CFolderDialog class. +// This class wraps SHBrowseForFolder to display a dialog for +// choosing a folder. +// +// The memory for the PIDL(s) created by this class is +// freed when the object goes out of scope. + + +//////////////////////////////////////////////////////////////////// +// +// Coding example. +// +// CFolderDialog fd; +// +// // Set the root folder to list the computer's drives (or C:). +// PIDLIST_ABSOLUTE pidlRoot = ILCreateFromPath(_T("C:")); +// fd.SetRoot(pidlRoot); +// +// // Set the title for the dialog. +// fd.SetTitle(_T("Choose a folder")); +// +// // Display the dialog +// if (fd.DoModal() == IDOK) +// { +// // Do something with the folder found +// MessageBox(fd.GetFolderPath(), _T("Folder Chosen"), MB_OK); +// } +// +// // Release the memory allocated for our pidlRoot. +// ILFree(pidlRoot); +// +//////////////////////////////////////////////////////////////////// + + +#ifndef _WIN32XX_FOLDERDIALOG_H_ +#define _WIN32XX_FOLDERDIALOG_H_ + +#include "wxx_dialog.h" + + +namespace Win32xx +{ + /////////////////////////////////////////////////////// + // CFolderDialog manages a dialog box that allows users + // to select a folder. + class CFolderDialog : public CDialog + { + public: + CFolderDialog(); + virtual ~CFolderDialog() override; + + virtual INT_PTR DoModal(HWND parent = nullptr) override; + + CString GetDisplayName() const { return m_displayName; } + CString GetFolderPath() const; + LPITEMIDLIST GetFolderPidl() const { return m_fullPidl; } + int GetImageIndex() const { return m_imageIndex; } + UINT GetFlags() const { return m_flags; } + void EnableOK(BOOL enable = TRUE) const; + void SetExpanded(LPCWSTR path) const; + void SetExpanded(LPITEMIDLIST pItemIDList) const; + void SetFlags(UINT flags) { m_flags = flags; } + void SetOKText(LPCWSTR text) const; + void SetRoot(LPITEMIDLIST pItemIDList); + void SetSelection(LPITEMIDLIST pItemIDList) const; + void SetSelection(LPCTSTR path) const; + void SetStatusText(LPCTSTR text) const; + void SetTitle(LPCTSTR title); + + protected: + virtual void OnCancel() override; + virtual void OnInitialized(); + virtual void OnIUnknown(LPARAM lparam); + virtual void OnOK() override; + virtual void OnSelChanged(); + virtual int OnValidateFailed(LPARAM lparam); + + private: + CFolderDialog(const CFolderDialog&) = delete; + CFolderDialog& operator=(const CFolderDialog&) = delete; + + static int CALLBACK BrowseCallbackProc(HWND wnd, UINT msg, LPARAM param1, LPARAM lparam2); + + CString m_displayName; + CString m_title; + BROWSEINFO m_bi; + LPITEMIDLIST m_pidlRoot; + LPITEMIDLIST m_fullPidl; + int m_imageIndex; + UINT m_flags; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + /////////////////////////////////////////// + // Definitions for the CFolderDialog class. + // + + inline CFolderDialog::CFolderDialog() : m_pidlRoot(nullptr), m_fullPidl(nullptr), m_imageIndex(0) + { + m_bi = {}; + m_bi.lpfn = BrowseCallbackProc; + m_bi.lParam = reinterpret_cast(this); + + // Set the default flags. + // BIF_RETURNONLYFSDIRS - Only return file system directories. + // BIF_NEWDIALOGSTYLE - Provides a resizable dialog without an edit box. + // BIF_NONEWFOLDERBUTTON - Do not include the New Folder button in the browse dialog box. + m_flags = BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE | BIF_NONEWFOLDERBUTTON; + } + + inline CFolderDialog::~CFolderDialog() + { + // Free the memory allocated to our pidls. + CoTaskMemFree(m_fullPidl); + } + + // The callback function used to send messages to and process messages + // from a Browse dialog box displayed in response to a call to SHBrowseForFolder. + inline int CALLBACK CFolderDialog::BrowseCallbackProc(HWND wnd, UINT msg, LPARAM param1, LPARAM param2) + { + CFolderDialog* pThis = reinterpret_cast(param2); + int result = 0; + + if (pThis->GetHwnd() == nullptr) + { + pThis->m_wnd = wnd; + pThis->AddToMap(); + } + + switch (msg) + { + case BFFM_INITIALIZED: + pThis->OnInitialized(); + break; + case BFFM_SELCHANGED: + pThis->OnSelChanged(); + break; + case BFFM_VALIDATEFAILED: + result = pThis->OnValidateFailed(param1); + break; + case BFFM_IUNKNOWN: + pThis->OnIUnknown(param1); + break; + } + + return result; + } + + // Displays the folder browser dialog. + inline INT_PTR CFolderDialog::DoModal(HWND parent) + { + CoTaskMemFree(m_fullPidl); + m_displayName.Empty(); + m_fullPidl = nullptr; + m_bi.lpszTitle = m_title.c_str(); + m_bi.pszDisplayName = m_displayName.GetBuffer(MAX_PATH); + m_bi.ulFlags = m_flags; + m_bi.hwndOwner = parent; + m_bi.pidlRoot = m_pidlRoot; + + LPITEMIDLIST pidl = ::SHBrowseForFolder(&m_bi); + m_displayName.ReleaseBuffer(); + + INT_PTR result = 0; + if (pidl) + { + m_fullPidl = pidl; + result = IDOK; + OnOK(); + } + else + { + result = IDCANCEL; + OnCancel(); + } + + // Prepare the CWnd for reuse. + Cleanup(); + + return result; + } + + // Enables or disables the OK button. + inline void CFolderDialog::EnableOK(BOOL enable /*TRUE*/) const + { + SendMessage(BFFM_ENABLEOK, static_cast(enable), 0); + } + + // Returns the path of the selected folder. + // Refer to SHGetPathFromIDList in the Windows API documentation for more information. + inline CString CFolderDialog::GetFolderPath() const + { + CString str; + SHGetPathFromIDList(m_fullPidl, str.GetBuffer(MAX_PATH)); + str.ReleaseBuffer(); + + return str; + } + + // Called when the cancel button is pressed. + inline void CFolderDialog::OnCancel() + { + } + + // Called when the Folder dialog is displayed. + // Override this function to perform tasks when the dialog starts. + inline void CFolderDialog::OnInitialized() + { + // An example of things that can be done here. + + // EnableOK(FALSE); + // SetOKText(L"OK Text"); + // SetStatusText(_T("Here is some status text")); + // SetExpanded(L"C:\\Program Files"); + // SetSelection(_T("C:\\Temp")); + } + + // Called when an IUnknown interface is available to the dialog box. + inline void CFolderDialog::OnIUnknown(LPARAM) + { + } + + // Called when the OK button is pressed. + inline void CFolderDialog::OnOK() + { + } + + // Called when the selection has changed in the dialog box. + inline void CFolderDialog::OnSelChanged() + { + } + + // Called when the user typed an invalid name into the dialog's edit box. + inline int CFolderDialog::OnValidateFailed(LPARAM) + { + // returns zero to dismiss the dialog or nonzero to keep the dialog displayed. + return 1; + } + + // Specifies the path of a folder to expand in the Browse dialog box. + // Refer to BFFM_SETEXPANDED in the Windows API documentation for more information. + inline void CFolderDialog::SetExpanded(LPCWSTR path) const + { + WPARAM wparam = static_cast(TRUE); + LPARAM lparam = reinterpret_cast(path); + SendMessage(BFFM_SETEXPANDED, wparam, lparam); + } + + // Specifies the path of a folder to expand in the Browse dialog box. + // Refer to BFFM_SETEXPANDED in the Windows API documentation for more information. + inline void CFolderDialog::SetExpanded(LPITEMIDLIST pItemIDList) const + { + WPARAM wparam = static_cast(FALSE); + LPARAM lparam = reinterpret_cast(pItemIDList); + SendMessage(BFFM_SETEXPANDED, wparam, lparam); + } + + // Sets the text of the OK button. + // Refer to BFFM_SETOKTEXT in the Windows API documentation for more information. + inline void CFolderDialog::SetOKText(LPCWSTR text) const + { + SendMessage(BFFM_SETOKTEXT, 0, reinterpret_cast(text)); + } + + // Sets the location of the root folder from which to start browsing. + inline void CFolderDialog::SetRoot(LPITEMIDLIST pItemIDList) + { + m_pidlRoot = pItemIDList; + } + + // Specifies the path of a folder to select. + // Refer to BFFM_SETSELECTION in the Windows API documentation for more information. + inline void CFolderDialog::SetSelection(LPITEMIDLIST pItemIDList) const + { + SendMessage(BFFM_SETSELECTION, FALSE, reinterpret_cast(pItemIDList)); + } + + // Specifies the path of a folder to select. + // Refer to BFFM_SETSELECTION in the Windows API documentation for more information. + inline void CFolderDialog::SetSelection(LPCTSTR path) const + { + SendMessage(BFFM_SETSELECTION, TRUE, reinterpret_cast(path)); + } + + // Sets the status text. + // This is incompatible with the BIF_USENEWUI or BIF_NEWDIALOGSTYLE flags. + // Refer to BFFM_SETSTATUSTEXT in the Windows API documentation for more information. + inline void CFolderDialog::SetStatusText(LPCTSTR text) const + { + SendMessage(BFFM_SETSTATUSTEXT, 0, reinterpret_cast(text)); + } + + // Sets the title of the browse for folder dialog. + inline void CFolderDialog::SetTitle(LPCTSTR title) + { + if (title) + m_title = title; + else + m_title.Empty(); + + m_bi.lpszTitle = m_title.c_str(); + } + +} +#endif // _WIN32XX_FOLDERDIALOG_H_ + diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_folderdialogex.h b/packages/media/cpp/packages/Win32xx/include/wxx_folderdialogex.h new file mode 100644 index 00000000..c75dec07 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_folderdialogex.h @@ -0,0 +1,205 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////// +// CFolderDialogEx class. +// This class provides a modal dialog that allows users to select a +// folder. It is based on the IFileDialog interface. +// +// CFolderDialogEx is a modern replacement for the CFolderDialog class. +// It supports dark mode applications, whereas CFolderDialog does not. +// +// Note: CFolderDialogEx requires Windows Vista or later. + + +///////////////////////////////////////////////////////////// +// Coding example. +// +// CFolderDialogEx chooseFolder; +// chooseFolder.SetInitialFolder(L"C:\\Temp"); +// chooseFolder.SetTitle(L"This is a title!"); +// if (chooseFolder.DoModal() == IDOK) +// { +// TaskDialog(nullptr, nullptr, L"Choosen Folder:", +// chooseFolder.GetFolderName(), 0, TDCBF_OK_BUTTON, +// TD_INFORMATION_ICON, nullptr); +// } + + +#ifndef _WIN32XX_FOLDERDIALOGEX_H_ +#define _WIN32XX_FOLDERDIALOGEX_H_ + +#include "wxx_dialog.h" + + +namespace Win32xx +{ + //////////////////////////////////////////////////////////// + // CFolderDialogEx uses the IFileDialog interface to display + // a dialog that allows the user to select a folder. + class CFolderDialogEx : public CDialog + { + public: + CFolderDialogEx() = default; // Constructor + virtual ~CFolderDialogEx() = default; // Destructor + + virtual INT_PTR DoModal(HWND hParent = nullptr); + + const CStringW& GetFolderName() const; + void SetInitialFolder(const CStringW& initialFolder); + void SetTitle(const CStringW& title); + + private: + CFolderDialogEx(const CFolderDialogEx&) = delete; + CFolderDialogEx& operator=(const CFolderDialogEx&) = delete; + + CStringW m_folderName; + CStringW m_initialFolderName; + CStringW m_title; + }; +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + ///////////////////////////////////////////// + // Definitions for the CFolderDialogEx class. + // + + // Displays a modal dialog that allows the user to select a folder. + // Returns IDOK when a folder is selected, and returns IDCANCEL otherwise. + // If a folder is selected, it's name can be retrieved by GetFolderName(). + inline INT_PTR CFolderDialogEx::DoModal(HWND hParent) + { + INT_PTR result = IDCANCEL; + m_folderName.Empty(); + + // Create the IFileDialog interface. + IFileDialog* pFileDialog; + if (SUCCEEDED(::CoCreateInstance(CLSID_FileOpenDialog, nullptr, + CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pFileDialog)))) + { + // Set the option to display only folders. + DWORD options; + if (SUCCEEDED(pFileDialog->GetOptions(&options))) + { + pFileDialog->SetOptions(options | FOS_PICKFOLDERS); + + // Set the initial folder if specified. + if (!m_initialFolderName.IsEmpty()) + { + using PSHCREATEITEMFROMPARSINGNAME = HRESULT(WINAPI*)(PCWSTR, IBindCtx*, REFIID, void**); + HMODULE shell32 = ::GetModuleHandle(_T("Shell32.dll")); + if (shell32 != nullptr) + { + PSHCREATEITEMFROMPARSINGNAME pSHCreateItemFromParsingName = reinterpret_cast( + reinterpret_cast(::GetProcAddress(shell32, "SHCreateItemFromParsingName"))); + + if (pSHCreateItemFromParsingName != nullptr) + { + IShellItem* pFolder = nullptr; + if (SUCCEEDED(pSHCreateItemFromParsingName(m_initialFolderName, + nullptr, IID_PPV_ARGS(&pFolder)))) + { + pFileDialog->SetFolder(pFolder); + pFolder->Release(); + } + } + } + } + + // Set the dialog's title if specified. + if (!m_title.IsEmpty()) + pFileDialog->SetTitle(m_title); + + // Display the dialog. + if (SUCCEEDED(pFileDialog->Show(hParent))) + { + IShellItem* pShellItem; + if (SUCCEEDED(pFileDialog->GetResult(&pShellItem))) + { + PWSTR pFilePath = 0; + if (SUCCEEDED(pShellItem->GetDisplayName(SIGDN_DESKTOPABSOLUTEPARSING, &pFilePath))) + { + m_folderName = pFilePath; + CoTaskMemFree(pFilePath); + result = IDOK; + } + } + + pShellItem->Release(); + } + } + + pFileDialog->Release(); + } + else + throw CWinException(GetApp()->MsgWndDialog()); + + return result; + } + + // Retrieves a const reference to a CString containing the name of the + // folder selected by the user when the modal dialog is displayed. + inline const CStringW& CFolderDialogEx::GetFolderName() const + { + return m_folderName; + } + + // Sets the initial folder displayed by the modal dialog. This can be + // assigned from either a LPCWSTR, or a CStringW, or a CString when + // compiled with the Unicode character set. + inline void CFolderDialogEx::SetInitialFolder(const CStringW& initialFolder) + { + m_initialFolderName = initialFolder; + } + + // Sets the caption of the modal dialog. This can be assigned from either + // a LPCWSTR, or a CStringW, or a CString when compiled with the Unicode + // character set. + inline void CFolderDialogEx::SetTitle(const CStringW& title) + { + m_title = title; + } + +} // namespace Win32xx + + +#endif // _WIN32XX_FOLDERDIALOGEX_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_frame.h b/packages/media/cpp/packages/Win32xx/include/wxx_frame.h new file mode 100644 index 00000000..26db6691 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_frame.h @@ -0,0 +1,3800 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////// +// wxx_frame.h +// Declaration of the following classes: +// CFrameT, CFrame, and CDockFrame. + +// The classes declared in this file support frames with the Single +// Document Interface (SDI). Refer to wxx_mdi.h for support for the +// Multiple Document Interface (MDI) frames. + +// CFrame inherits from CFrameT. +// CFrameT uses each of the following classes: +// * CReBar for managing the frame's rebar control. +// * CMenuBar for managing the menu inside the rebar. +// * CToolBar for managing the frame's toolbar. +// * CStatusBar for managing the frame's status bar. +// In each case the members for these classes are exposed by a GetXXX +// function, allowing them to be accessed or sent messages. + +// CFrame is responsible for creating a "frame" window. This window has a +// menu and and several child windows, including a toolbar (usually hosted +// within a rebar), a status bar, and a view positioned over the frame +// window's non-client area. The "view" window is a separate CWnd object +// assigned to the frame with the SetView function. + +// When compiling an application with these classes, it will need to be linked +// with Comctl32.lib. + +// To create a SDI frame application, inherit a CMainFrame class from CFrame. +// Use the Frame sample application as the starting point for your own frame +// applications. +// Refer to the Notepad and Scribble samples for examples on how to use these +// classes to create a frame application. + +// To create a SDI frame application that supports docking, inherit a CMainFrame +// class from CDockFrame. +// Refer to the Dock, DockContainer and DockTabbedMDI sample for example on how +// to create a docking frame application. + + +#ifndef _WIN32XX_FRAME_H_ +#define _WIN32XX_FRAME_H_ + + +#include "wxx_dialog.h" +#include "wxx_docking.h" +#include "wxx_menubar.h" +#include "wxx_menumetrics.h" +#include "wxx_rebar.h" +#include "wxx_regkey.h" +#include "wxx_statusbar.h" +#include "wxx_toolbar.h" +#include "default_resource.h" + + +namespace Win32xx +{ +// Disable false override warnings for Clang compilers. +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Winconsistent-missing-override" +#endif + + /////////////////////////////////////////////////////// + // CFrameT is the base class for all frames in Win32++. + // The template parameter T is either CWnd or CDocker. + template + class CFrameT : public T + { + public: + + struct InitValues + { + CRect position; + int showCmd; + BOOL showStatusBar; + BOOL showToolBar; + + // The constructor displays the statusbar and toolbar by default. + InitValues() : showCmd(SW_SHOW), showStatusBar(TRUE), showToolBar(TRUE) + {} + }; + + CFrameT(); + virtual ~CFrameT() override; + + // Accessors and mutators for the menubar, rebar, statusbar, and toolbar. + CMenuBar& GetMenuBar() const { return *m_pMenuBar; } + CReBar& GetReBar() const { return *m_pReBar; } + CStatusBar& GetStatusBar() const { return *m_pStatusBar; } + CToolBar& GetToolBar() const { return *m_pToolBar; } + void SetMenuBar(CMenuBar& menuBar) { m_pMenuBar = &menuBar; } + void SetReBar(CReBar& reBar) { m_pReBar = &reBar; } + void SetStatusBar(CStatusBar& statusBar) { m_pStatusBar = &statusBar; } + void SetToolBar(CToolBar& toolBar) { m_pToolBar = &toolBar; } + + // Other accessors and mutators. + HACCEL GetFrameAccel() const { return m_accel; } + const CMenu& GetFrameMenu() const { return m_menu; } + const InitValues& GetInitValues() const { return m_initValues; } + const CFont& GetMenuFont() const { return m_menuFont; } + const MenuTheme& GetMenuBarTheme() const { return m_mbTheme; } + int GetMenuIconHeight() const; + const CMenuMetrics& GetMenuMetrics() const { return m_menuMetrics; } + const std::vector& GetMRUEntries() const { return m_mruEntries; } + CString GetMRUEntry(UINT index); + size_t GetMRULimit() const { return m_maxMRU; } + CString GetRegistryKeyName() const { return m_keyName; } + const ReBarTheme& GetReBarTheme() const { return m_rbTheme; } + const CFont& GetStatusBarFont() const { return m_statusBarFont; } + const StatusBarTheme& GetStatusBarTheme() const { return m_sbTheme; } + const std::vector& GetToolBarData() const { return m_toolBarData; } + const ToolBarTheme& GetToolBarTheme() const { return m_tbTheme; } + CString GetStatusText() const { return m_statusText; } + CString GetTitle() const { return T::GetWindowText(); } + CWnd& GetView() const; + CString GetXPThemeName() const; + BOOL IsMDIFrame() const { return static_cast(T::SendMessage(UWM_GETCMDIFRAMET)); } + void RemoveKbdHook(); + void ResetMenuMetrics() { m_menuMetrics.SetMetrics(*this); } + void SetAccelerators(UINT accelID); + void SetFrameMenu(UINT menuID); + void SetFrameMenu(CMenu menu); + void SetInitValues(const InitValues& values); + void SetKbdHook(); + void SetMenuFont(HFONT font); + void SetMenuTheme(const MenuTheme& mt); + void SetMRULimit(UINT MRULimit); + void SetReBarTheme(const ReBarTheme& rbt); + void SetStatusBarFont(HFONT font); + void SetStatusBarTheme(const StatusBarTheme& sbt); + void SetStatusText(LPCTSTR text); + void SetTitle(LPCTSTR text) { T::SetWindowText(text); } + void SetToolBarTheme(const ToolBarTheme& tbt); + void SetView(CWnd& view); + + protected: + // Override these functions as required. + virtual void AddDisabledMenuImage(HICON icon, COLORREF mask); + virtual BOOL AddMenuIcon(UINT menuItemID, UINT iconID, UINT disabledIconID = 0); + virtual BOOL AddMenuIcon(UINT menuItemID, HICON icon, HICON disabledIcon = nullptr); + virtual UINT AddMenuIcons(const std::vector& menuData, COLORREF mask, + UINT bitmapID, UINT disabledID = 0); + virtual void AddMenuBarBand(); + virtual void AddMRUEntry(LPCTSTR MRUEntry); + virtual void AddToolBarBand(CToolBar& tb, DWORD bandStyle, UINT id); + virtual void AddToolBarButton(UINT id, BOOL isEnabled = TRUE, + LPCTSTR text = nullptr, int image = -1); + virtual void AdjustFrameRect(RECT viewRect); + virtual void ClearMenuIcons(); + virtual void CreateToolBar(); + virtual LRESULT CustomDrawMenuBar(NMHDR* pNMHDR); + virtual LRESULT CustomDrawToolBar(NMHDR* pNMHDR); + virtual void DrawMenuItem(LPDRAWITEMSTRUCT pDrawItem); + virtual void DrawMenuItemBkgnd(LPDRAWITEMSTRUCT pDrawItem); + virtual void DrawMenuItemCheckmark(LPDRAWITEMSTRUCT pDrawItem); + virtual void DrawMenuItemIcon(LPDRAWITEMSTRUCT pDrawItem); + virtual void DrawMenuItemText(LPDRAWITEMSTRUCT pDrawItem); + virtual BOOL DrawReBarBkgnd(CDC& dc, CReBar& rebar); + virtual void DrawStatusBar(LPDRAWITEMSTRUCT pDrawItem); + virtual BOOL DrawStatusBarBkgnd(CDC& dc, CStatusBar& statusBar); + virtual void DrawVistaMenuBkgnd(LPDRAWITEMSTRUCT pDrawItem); + virtual void DrawVistaMenuCheckmark(LPDRAWITEMSTRUCT pDrawItem); + virtual void DrawVistaMenuText(LPDRAWITEMSTRUCT pDrawItem); + virtual CRect GetViewRect() const; + virtual BOOL LoadRegistrySettings(LPCTSTR keyName); + virtual BOOL LoadRegistryMRUSettings(UINT maxMRU = 0); + virtual void MeasureMenuItem(MEASUREITEMSTRUCT* pMIS); + virtual LRESULT OnActivate(UINT msg, WPARAM wparam, LPARAM lparam); + virtual void OnClose() override; + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual LRESULT OnCustomDraw(LPNMHDR pNMHDR); + virtual void OnDestroy() override; + virtual LRESULT OnDpiChanged(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnDrawItem(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnDrawRBBkgnd(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnDrawSBBkgnd(UINT msg, WPARAM wparam, LPARAM lparam); + virtual BOOL OnHelp(); + virtual LRESULT OnInitMenuPopup(UINT msg, WPARAM wparam, LPARAM lparam); + virtual void OnKeyboardHook(int code, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnMeasureItem(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnMenuChar(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnMenuSelect(UINT msg, WPARAM wparam, LPARAM lparam); + virtual void OnMenuUpdate(UINT id) override; + virtual LRESULT OnNotify(WPARAM wparam, LPARAM lparam) override; + virtual LRESULT OnRBNHeightChange(LPNMHDR pNMHDR); + virtual LRESULT OnRBNLayoutChanged(LPNMHDR pNMHDR); + virtual LRESULT OnRBNMinMax(LPNMHDR pNMHDR); + virtual LRESULT OnSettingChange(UINT, WPARAM, LPARAM); + virtual LRESULT OnSize(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnSysColorChange(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnSysCommand(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnThemeChanged(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnTTNGetDispInfo(LPNMTTDISPINFO pNMTDI); + virtual LRESULT OnUndocked(); + virtual LRESULT OnUnInitMenuPopup(UINT, WPARAM wparam, LPARAM lparam); + virtual BOOL OnViewStatusBar(); + virtual BOOL OnViewToolBar(); + virtual LRESULT OnWindowPosChanged(UINT msg, WPARAM wparam, LPARAM lparam); + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual void PreRegisterClass(WNDCLASS& wc) override; + virtual void RecalcLayout(); + virtual void RecalcViewLayout(); + virtual void RemoveMRUEntry(LPCTSTR MRUEntry); + virtual BOOL SaveRegistryMRUSettings(); + virtual BOOL SaveRegistrySettings(); + virtual void SetMenuBarBandSize(); + virtual UINT SetMenuIcons(const std::vector& menuData, + COLORREF mask, UINT toolBarID, UINT toolBarDisabledID = 0); + virtual void SetStatusIndicators(); + virtual void SetStatusParts(); + virtual void SetTBImageList(CToolBar& toolBar, UINT id, COLORREF mask); + virtual void SetTBImageListDis(CToolBar& toolBar, UINT id, COLORREF mask); + virtual void SetTBImageListHot(CToolBar& toolBar, UINT id, COLORREF mask); + virtual void SetTheme(); + virtual void SetToolBarImages(COLORREF mask, UINT toolBarID, + UINT toolBarHotID = 0, UINT toolBarDisabledID = 0); + virtual void SetToolBarImages(CToolBar& toolbar, COLORREF mask, + UINT toolBarID, UINT toolBarHotID = 0, UINT toolBarDisabledID = 0); + virtual void SetupMenuIcons(); + virtual void SetupToolBar(); + virtual void ShowMenu(BOOL show); + virtual void ShowStatusBar(BOOL show); + virtual void ShowToolBar(BOOL show); + virtual void UpdateMRUMenu(); + virtual void UpdateSettings(); + + // Not intended to be overridden. + CRect ExcludeChildRect(const CRect& clientRect, HWND child) const; + BOOL IsUsingDarkMenu() const { return m_useDarkMenu; } + BOOL IsUsingIndicatorStatus() const { return m_useIndicatorStatus; } + BOOL IsUsingMenuStatus() const { return m_useMenuStatus; } + BOOL IsUsingOwnerDrawnMenu() const { return m_useOwnerDrawnMenu; } + BOOL IsUsingReBar() const { return m_useReBar; } + BOOL IsUsingStatusBar() const { return m_useStatusBar; } + BOOL IsUsingThemes() const { return m_useThemes; } + BOOL IsUsingToolBar() const { return m_useToolBar; } + BOOL IsUsingVistaMenu() const { return m_menuMetrics.IsVistaMenu(); } + void UseDarkMenu(BOOL useDarkMenu) { m_useDarkMenu = useDarkMenu; } + void UseIndicatorStatus(BOOL useIndicatorStatus) { m_useIndicatorStatus = useIndicatorStatus; } + void UseMenuStatus(BOOL useMenuStatus) { m_useMenuStatus = useMenuStatus; } + void UseOwnerDrawnMenu(BOOL useOwnerDraw) { m_useOwnerDrawnMenu = useOwnerDraw; } + void UseReBar(BOOL useReBar) { m_useReBar = useReBar; } + void UseStatusBar(BOOL useStatusBar) { m_useStatusBar = useStatusBar; } + void UseThemes(BOOL useThemes) { m_useThemes = useThemes; } + void UseToolBar(BOOL useToolBar) { m_useToolBar = useToolBar; } + + LRESULT WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) override; + + private: + using MenuData = std::vector; // all menu item data for a popup menu + + CFrameT(const CFrameT&) = delete; + CFrameT& operator=(const CFrameT&) = delete; + CSize GetTBImageSize(CBitmap* pBitmap) const; + void UpdateMenuBarBandSize(); + static LRESULT CALLBACK StaticKeyboardProc(int code, WPARAM wparam, LPARAM lparam); + + std::vector m_menusData; // vector of menu data for multiple popup menus + std::vector m_mruEntries; // vector of CStrings for MRU entries + std::vector m_menuItemIDs; // vector of menu icon resource IDs + std::vector m_toolBarData; // vector of resource IDs for ToolBar buttons + std::vector m_indicators; // vector of CStrings for status indicators + InitValues m_initValues; // struct of initial values + CDialog m_aboutDialog; // Help about dialog + CMenuBar m_menuBar; // Default CMenuBar object + CReBar m_reBar; // Default CReBar object + CStatusBar m_statusBar; // Default CStatusBar object + CToolBar m_toolBar; // Default CToolBar object + CMenuBar* m_pMenuBar; // Pointer to the CMenuBar object we actually use + CReBar* m_pReBar; // Pointer to the CReBar object we actually use + CStatusBar* m_pStatusBar; // Pointer to the CStatusBar object we actually use + CToolBar* m_pToolBar; // Pointer to the CToolBar object we actually use + CMenu m_menu; // The menu used by the menubar or the frame's window + CFont m_menuFont; // Menu and menubar font + CFont m_statusBarFont; // StatusBar font + CString m_keyName; // CString for Registry key name + CString m_statusText; // CString for status text + CString m_tooltip; // CString for tool tips + MenuTheme m_mbTheme; // struct of theme info for the popup Menu and MenuBar + ReBarTheme m_rbTheme; // struct of theme info for the ReBar + StatusBarTheme m_sbTheme; // struct of theme info for the StatusBar + ToolBarTheme m_tbTheme; // struct of theme info for the ToolBar + HACCEL m_accel; // handle to the frame's accelerator table (used by MDI without MDI child) + CWnd* m_pView; // pointer to the View CWnd object + size_t m_maxMRU; // maximum number of MRU entries + HWND m_oldFocus; // The window that had focus prior to the app's deactivation + HHOOK m_kbdHook; // Keyboard hook. + + CMenuMetrics m_menuMetrics; // The MenuMetrics object + CImageList m_menuImages; // Imagelist of menu icons + CImageList m_menuDisabledImages; // Imagelist of disabled menu icons + BOOL m_useOwnerDrawnMenu; // Set to TRUE for custom drawn menu items. + BOOL m_useDarkMenu; // Set to TRUE to manually draw a dark menu. + BOOL m_useIndicatorStatus; // Set to TRUE to see indicators in status bar. + BOOL m_useMenuStatus; // Set to TRUE to see menu and toolbar updates in status bar. + BOOL m_useReBar; // Set to TRUE if ReBars are to be used. + BOOL m_useStatusBar; // Set to TRUE if the statusbar is used. + BOOL m_useThemes; // Set to TRUE if themes are to be used. + BOOL m_useToolBar; // Set to TRUE if the toolbar is used. + BOOL m_altKeyPressed; // Set to TRUE if the alt key is held down. + + }; // class CFrameT + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + + /////////////////////////////////////////////////////////////// + // CFrame manages the frame window. CFrame also manages the + // creation and position of child windows, such as the menubar, + // toolbar, view window and statusbar. + class CFrame : public CFrameT + { + public: + CFrame() = default; + virtual ~CFrame() override = default; + + private: + CFrame(const CFrame&) = delete; + CFrame& operator=(const CFrame&) = delete; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + //////////////////////////////////// + // Definitions for the CFrame class. + // + template + inline CFrameT::CFrameT() : m_aboutDialog(IDW_ABOUT), m_accel(nullptr), + m_pView(nullptr), m_maxMRU(0), m_oldFocus(nullptr), m_kbdHook(nullptr), + m_useOwnerDrawnMenu(TRUE), m_useDarkMenu(FALSE), + m_useIndicatorStatus(TRUE), m_useMenuStatus(TRUE), + m_useStatusBar(TRUE), m_useThemes(TRUE), m_useToolBar(TRUE), + m_altKeyPressed(FALSE) + { + m_mbTheme = {}; + m_rbTheme = {}; + m_sbTheme = {}; + m_tbTheme = {}; + m_indicators.assign(3, CString()); + + // By default, we use the rebar. + m_useReBar = TRUE; + + // Assign the default menubar, rebar, statusbar and toolbar. + SetMenuBar(m_menuBar); + SetReBar(m_reBar); + SetStatusBar(m_statusBar); + SetToolBar(m_toolBar); + } + + template + inline CFrameT::~CFrameT() + { + if (m_kbdHook != nullptr) + ::UnhookWindowsHookEx(m_kbdHook); + } + + // Adds the grayscale image of the specified icon the disabled menu image list. + // This function is called by AddMenuIcon. + template + inline void CFrameT::AddDisabledMenuImage(HICON icon, COLORREF mask) + { + CClientDC desktopDC(*this); + CMemDC memDC(desktopDC); + + // m_menuImages should already have this image. + assert(m_menuImages.GetHandle() != nullptr); + + int cxImage = m_menuImages.GetIconSize().cx; + int cyImage = cxImage; + + memDC.CreateCompatibleBitmap(desktopDC, cxImage, cyImage); + CRect rc; + rc.SetRect(0, 0, cxImage, cyImage); + + // Set the mask color to gray for the new ImageList. + if (GetDeviceCaps(desktopDC, BITSPIXEL) < 24) + { + HPALETTE hPal = desktopDC.GetCurrentPalette(); + UINT index = ::GetNearestPaletteIndex(hPal, mask); + if (index != CLR_INVALID) mask = PALETTEINDEX(index); + } + + memDC.SolidFill(mask, rc); + + // Draw the icon on the memory DC. + memDC.DrawIconEx(0, 0, icon, cxImage, cyImage, 0, 0, DI_NORMAL); + + // Detach the bitmap so we can use it. + CBitmap bitmap = memDC.DetachBitmap(); + bitmap.ConvertToDisabled(mask); + + if (m_menuDisabledImages.GetHandle() == nullptr) + m_menuDisabledImages.Create(cxImage, cyImage, ILC_COLOR24 | ILC_MASK, 1, 0); + + m_menuDisabledImages.Add(bitmap, mask); + } + + // Adds an icon to an internal ImageList for use with popup menu items. + template + inline BOOL CFrameT::AddMenuIcon(UINT menuItemID, UINT iconID, UINT disabledIconID) + { + HICON icon = static_cast(GetApp()->LoadImage(iconID, IMAGE_ICON, + 0, 0, LR_SHARED)); + HICON disabledIcon = static_cast(GetApp()->LoadImage( + disabledIconID, IMAGE_ICON, 0, 0, LR_SHARED)); + return AddMenuIcon(menuItemID, icon, disabledIcon); + } + + // Adds an icon to an internal ImageList for use with popup menu items. + template + inline BOOL CFrameT::AddMenuIcon(UINT menuItemID, HICON icon, + HICON disabledIcon) + { + assert(icon != nullptr); + + int cxImage; + int cyImage; + + // Create a new ImageList if required. + if (m_menuImages.GetHandle() == nullptr) + { + cyImage = GetMenuIconHeight(); + cxImage = cyImage; + m_menuImages.Create(cxImage, cyImage, ILC_COLOR32 | ILC_MASK, 1, 0); + m_menuItemIDs.clear(); + } + else + { + cxImage = m_menuImages.GetIconSize().cx; + cyImage = cxImage; + } + + if (m_menuImages.Add(icon) != -1) + { + m_menuItemIDs.push_back(menuItemID); + + // Set the mask color to gray for the new ImageList. + COLORREF mask = RGB(192, 192, 192); + CClientDC desktopDC(*this); + if (GetDeviceCaps(desktopDC, BITSPIXEL) < 24) + { + HPALETTE hPal = desktopDC.GetCurrentPalette(); + UINT index = ::GetNearestPaletteIndex(hPal, mask); + if (index != CLR_INVALID) mask = PALETTEINDEX(index); + } + + if (m_menuDisabledImages.GetHandle() == nullptr) + m_menuDisabledImages.Create(cxImage, cyImage, ILC_COLOR32 | ILC_MASK, 1, 0); + + if (disabledIcon == nullptr) + AddDisabledMenuImage(icon, mask); + else + m_menuDisabledImages.Add(disabledIcon); + + return TRUE; + } + + return FALSE; + } + + // Adds the icons from a bitmap resource to an internal ImageList for use + // with popup menu items. + // Note: Images for menu icons can be sized 16x16 or 16x15 pixels or higher. + // If the images are too big to fit in the menu, they are ignored. + template + inline UINT CFrameT::AddMenuIcons(const std::vector& menuData, + COLORREF mask, UINT bitmapID, UINT disabledID) + { + // Count the MenuData entries excluding separators. + int images = 0; + for (const UINT& data : menuData) + { + if (data != 0) // Don't count separators + ++images; + } + + // Load the button images from the resource ID. + CBitmap bitmap(bitmapID); + + // Assert if we failed to load the bitmap. + assert(bitmap.GetHandle() != nullptr); + + if ((images == 0) || (bitmap.GetHandle() == nullptr)) + return static_cast(m_menuItemIDs.size()); // No valid images, so nothing to do! + + // Resize the bitmap + CSize bitmapSize = bitmap.GetSize(); + int scale = GetMenuIconHeight() / bitmapSize.cy; + m_menuItemIDs.clear(); + if (scale > 0) + { + bitmap = ScaleUpBitmap(bitmap, scale); + int bitmapSizeY = bitmap.GetSize().cy; + int newSize = std::max(bitmapSizeY, 16); + + // Create the ImageList. + m_menuImages.Create(newSize, newSize, ILC_COLOR32 | ILC_MASK, images, 0); + + // Add the resource IDs to the m_menuIcons vector. + for (auto it = menuData.begin(); it != menuData.end(); ++it) + { + if ((*it) != 0) + m_menuItemIDs.push_back(*it); + } + + // Add the images to the imageList. + m_menuImages.Add(bitmap, mask); + + // Add the images to the disabled image list. + if (disabledID != 0) + { + // Create the disabled ImageList from disabledID. + CBitmap disabled(disabledID); + scale = GetMenuIconHeight() / disabled.GetSize().cy; + if (scale > 0) + { + disabled = ScaleUpBitmap(disabled, scale); + int disabledSizeY = disabled.GetSize().cy; + newSize = std::max(disabledSizeY, 16); + m_menuDisabledImages.Create(newSize, newSize, ILC_COLOR32 | + ILC_MASK, images, 0); + m_menuDisabledImages.Add(disabled, mask); + } + else + m_menuDisabledImages.CreateDisabledImageList(m_menuImages); + } + else + m_menuDisabledImages.CreateDisabledImageList(m_menuImages); + } + + // return the number of menu icons. + return static_cast(m_menuItemIDs.size()); + } + + // Adds a MenuBar to the rebar control. + template + inline void CFrameT::AddMenuBarBand() + { + REBARBANDINFO rbbi = {}; + rbbi.fMask = RBBIM_STYLE | RBBIM_CHILD | RBBIM_ID; + rbbi.fStyle = RBBS_BREAK | RBBS_VARIABLEHEIGHT; + rbbi.hwndChild = GetMenuBar(); + rbbi.wID = IDW_MENUBAR; + + // Note: rbbi.cbSize is set inside the InsertBand function. + GetReBar().InsertBand(-1, rbbi); + GetReBar().SetMenuBar(GetMenuBar()); + + if (GetReBarTheme().LockMenuBand) + GetReBar().ShowGripper(GetReBar().GetBand(GetMenuBar()), FALSE); + + UpdateMenuBarBandSize(); + } + + // Adds an entry to the Most Recently Used (MRU) list. + template + inline void CFrameT::AddMRUEntry(LPCTSTR mruEntry) + { + // Erase possible duplicate entries from vector. + RemoveMRUEntry(mruEntry); + + // Insert the entry at the beginning of the vector. + m_mruEntries.insert(m_mruEntries.begin(), mruEntry); + + // Delete excessive MRU entries. + if (m_mruEntries.size() > m_maxMRU) + { + m_mruEntries.erase(m_mruEntries.begin() + + static_cast(m_maxMRU), m_mruEntries.end()); + } + + UpdateMRUMenu(); + } + + // Adds a ToolBar to the rebar control. + template + inline void CFrameT::AddToolBarBand(CToolBar& tb, DWORD bandStyle, UINT id) + { + // Create the ToolBar Window. + DWORD style = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | + WS_CLIPSIBLINGS | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT | + CCS_NODIVIDER | CCS_NORESIZE | CCS_NOPARENTALIGN; + tb.CreateEx(0, TOOLBARCLASSNAME, 0, style, 0, 0, 0, 0, GetReBar(), 0); + + // Fill the REBARBAND structure. + REBARBANDINFO rbbi = {}; + rbbi.fMask = RBBIM_STYLE | RBBIM_CHILD | RBBIM_ID; + rbbi.fStyle = bandStyle; + rbbi.hwndChild = tb; + rbbi.wID = id; + + // Note: rbbi.cbSize is set inside the InsertBand function. + GetReBar().InsertBand(-1, rbbi); + } + + // Adds Resource IDs to toolbar buttons. + // A resource ID of 0 is a separator. + template + inline void CFrameT::AddToolBarButton(UINT id, BOOL isEnabled /* = TRUE*/, + LPCTSTR text /* = nullptr */, int image /* = -1 */) + { + m_toolBarData.push_back(id); + + GetToolBar().AddButton(id, isEnabled, image); + + if (text != nullptr) + GetToolBar().SetButtonText(id, text); + } + + // Adjust the size of the frame to accommodate the View window's dimensions. + template + inline void CFrameT::AdjustFrameRect(RECT viewRect) + { + // Adjust for the view styles. + CRect rc = viewRect; + DWORD style = GetView().GetStyle(); + DWORD exStyle = GetView().GetExStyle(); + VERIFY(AdjustWindowRectEx(&rc, style, FALSE, exStyle)); + + // Adjust for the frame's non-client area. + int width = T::GetWindowRect().Width() - T::GetClientRect().Width() + rc.Width(); + int height = T::GetWindowRect().Height() - GetViewRect().Height() + rc.Height(); + + // Calculate final rect size, and reposition frame. + VERIFY(T::SetWindowPos(HWND_TOP, 0, 0, width, height, SWP_NOMOVE)); + } + + // Clears the normal and disabled image lists for menu icons. + template + inline void CFrameT::ClearMenuIcons() + { + m_menuItemIDs.clear(); + m_menuImages.Destroy(); + m_menuDisabledImages.Destroy(); + } + + // Creates the frame's toolbar. Additional toolbars can be added with + // AddToolBarBand if the frame uses a rebar. + template + inline void CFrameT::CreateToolBar() + { + m_toolBarData.clear(); + + if (GetReBar().IsWindow()) + // Create the toolbar inside rebar. + AddToolBarBand(GetToolBar(), RBBS_BREAK|RBBS_GRIPPERALWAYS, IDW_TOOLBAR); + else + // Create the toolbar without a rebar. + GetToolBar().Create(*this); + + SetupToolBar(); + + if (GetToolBarData().size() > 0) + { + // Load the default images if no images are loaded. + if (!GetToolBar().SendMessage(TB_GETIMAGELIST, 0, 0)) + SetToolBarImages(RGB(192, 192, 192), IDW_MAIN, 0, 0); + + GetToolBar().Autosize(); + } + else + { + TRACE("\n*** WARNING: No resource IDs assigned to the toolbar. ***\n\n"); + ShowToolBar(FALSE); + } + + if (GetReBar().IsWindow()) + { + SIZE MaxSize = GetToolBar().GetMaxSize(); + WPARAM wparam = reinterpret_cast(GetToolBar().GetHwnd()); + LPARAM lparam = reinterpret_cast(&MaxSize); + GetReBar().SendMessage(UWM_TBRESIZE, wparam, lparam); + + if (GetReBarTheme().UseThemes && GetReBarTheme().LockMenuBand) + { + // Hide gripper for single toolbar. + if (GetReBar().GetBandCount() <= 2) + GetReBar().ShowGripper(GetReBar().GetBand(GetToolBar()), FALSE); + } + } + } + + // CustomDraw is used to render the MenuBar's toolbar buttons. + template + inline LRESULT CFrameT::CustomDrawMenuBar(NMHDR* pNMHDR) + { + LPNMTBCUSTOMDRAW lpNMCustomDraw = (LPNMTBCUSTOMDRAW)pNMHDR; + CMenuBar* pMenubar = reinterpret_cast + (::SendMessage(pNMHDR->hwndFrom, UWM_GETCMENUBAR, 0, 0)); + assert(pMenubar != nullptr); + + switch (lpNMCustomDraw->nmcd.dwDrawStage) + { + // Begin paint cycle. + case CDDS_PREPAINT: + // Send NM_CUSTOMDRAW item draw, and post-paint notification messages. + return CDRF_NOTIFYITEMDRAW | CDRF_NOTIFYPOSTPAINT ; + + // An item is about to be drawn. + case CDDS_ITEMPREPAINT: + { + UINT state = lpNMCustomDraw->nmcd.uItemState; + DWORD item = static_cast(lpNMCustomDraw->nmcd.dwItemSpec); + + if (GetMenuBarTheme().UseThemes) + { + CRect rc = lpNMCustomDraw->nmcd.rc; + + // Leave a pixel gap above and below the drawn rectangle. + if (IsUsingVistaMenu()) + rc.InflateRect(0, -2); + else + rc.InflateRect(0, -1); + + CDC drawDC(lpNMCustomDraw->nmcd.hdc); + if (state & (CDIS_HOT | CDIS_SELECTED)) + { + UINT buttonState = pMenubar->GetButtonState(item); + if ((state & CDIS_SELECTED) || (buttonState & TBSTATE_PRESSED)) + { + drawDC.GradientFill(GetMenuBarTheme().clrPressed1, + GetMenuBarTheme().clrPressed2, rc, TRUE); + } + else if (state & CDIS_HOT) + { + drawDC.GradientFill(GetMenuBarTheme().clrHot1, + GetMenuBarTheme().clrHot2, rc, TRUE); + } + + // Draw border. + drawDC.CreatePen(PS_SOLID, 1, GetMenuBarTheme().clrOutline); + drawDC.MoveTo(rc.left, rc.bottom); + drawDC.LineTo(rc.left, rc.top); + drawDC.LineTo(rc.right-1, rc.top); + drawDC.LineTo(rc.right-1, rc.bottom); + drawDC.MoveTo(rc.right-1, rc.bottom); + drawDC.LineTo(rc.left, rc.bottom); + } + + UINT itemID = static_cast(lpNMCustomDraw->nmcd.dwItemSpec); + CString str = pMenubar->GetButtonText(itemID); + + // Draw highlight text. + CFont font = pMenubar->GetFont(); + drawDC.SelectObject(font); + + rc.bottom += 1; + drawDC.SetBkMode(TRANSPARENT); + drawDC.SetTextColor(GetMenuBarTheme().clrText); + UINT format = DT_VCENTER | DT_CENTER | DT_SINGLELINE | DT_HIDEPREFIX; + + // Turn off 'hide prefix' style for keyboard navigation. + if (m_altKeyPressed || pMenubar->IsAltMode()) + format &= ~DT_HIDEPREFIX; + + drawDC.DrawText(str, str.GetLength(), rc, format); + + return CDRF_SKIPDEFAULT; // No further drawing. + } + } + return CDRF_DODEFAULT; // Do default drawing. + } + + return 0; + } + + // With CustomDraw we manually control the drawing of each toolbar button. + // Supports toolbars with or without the BTNS_LIST style. + // Supports buttons with or without the BTNS_WHOLEDROPDOWN and BTNS_DROPDOWN styles. + // Requires the toolbar buttons to have images. + template + inline LRESULT CFrameT::CustomDrawToolBar(NMHDR* pNMHDR) + { + if (GetToolBarTheme().UseThemes) + { + LPNMTBCUSTOMDRAW pCustomDraw = (LPNMTBCUSTOMDRAW)pNMHDR; + CToolBar* pTB = static_cast(T::GetCWndPtr(pNMHDR->hwndFrom)); + + if (pTB) + { + switch (pCustomDraw->nmcd.dwDrawStage) + { + // Begin paint cycle. + case CDDS_PREPAINT: + // Send NM_CUSTOMDRAW item draw, and post-paint notification messages. + return CDRF_NOTIFYITEMDRAW | CDRF_NOTIFYPOSTPAINT ; + + // An item is about to be drawn. + case CDDS_ITEMPREPAINT: + { + CDC drawDC(pCustomDraw->nmcd.hdc); + CRect rc = pCustomDraw->nmcd.rc; + UINT state = pCustomDraw->nmcd.uItemState; + UINT item = static_cast(pCustomDraw->nmcd.dwItemSpec); + + // Calculate text size. + CString str; + CSize textSize; + if (pTB->HasText()) // Does any button have text? + { + drawDC.SelectObject(pTB->GetFont()); + str = pTB->GetButtonText(item); + textSize = drawDC.GetTextExtentPoint32(str, str.GetLength()); + } + + // Draw outline rectangle. + bool isHot = (state & CDIS_HOT) != 0; + if (isHot) + { + drawDC.CreatePen(PS_SOLID, 1, GetToolBarTheme().clrOutline); + drawDC.MoveTo(rc.left, rc.top); + drawDC.LineTo(rc.left, rc.bottom-1); + drawDC.LineTo(rc.right-1, rc.bottom-1); + drawDC.LineTo(rc.right-1, rc.top); + drawDC.LineTo(rc.left, rc.top); + } + + // Draw filled gradient background. + rc.InflateRect(-1, -1); + bool isPressed = (pTB->GetButtonState(item) & TBSTATE_PRESSED) != 0; + bool isChecked = (pTB->GetButtonState(item) & TBSTATE_CHECKED) != 0; + if (isPressed) + { + drawDC.GradientFill(GetToolBarTheme().clrPressed1, + GetToolBarTheme().clrPressed2, rc, TRUE); + } + else if (isChecked) + { + drawDC.GradientFill(GetToolBarTheme().clrPressed1, + GetToolBarTheme().clrPressed2, rc, TRUE); + } + else if (isHot) + { + drawDC.GradientFill(GetToolBarTheme().clrHot1, + GetToolBarTheme().clrHot2, rc, TRUE); + } + + // Get the appropriate image list depending on the button state. + CImageList toolBarImages; + bool isDisabled = (state & CDIS_DISABLED) != 0; + if (isDisabled) + { + toolBarImages = pTB->GetDisabledImageList(); + if (toolBarImages.GetHandle() == nullptr) + { + CImageList toolBarDisabledImages; + toolBarDisabledImages.CreateDisabledImageList(pTB->GetImageList()); + pTB->SetDisableImageList(toolBarDisabledImages); + toolBarImages = pTB->GetDisabledImageList(); + } + } + else if (isHot) + { + toolBarImages = pTB->GetHotImageList(); + if (toolBarImages.GetHandle() == nullptr) + // Use normal images as hot images. + toolBarImages = pTB->GetImageList(); + } + else + { + toolBarImages = pTB->GetImageList(); + } + + // Assert if the toolbar images aren't set. + assert(toolBarImages.GetHandle() != nullptr); + + DWORD style = pTB->GetButtonStyle(item); + DWORD exStyle = pTB->GetExtendedStyle(); + bool isDropDown = ((style & BTNS_DROPDOWN) && (exStyle & + TBSTYLE_EX_DRAWDDARROWS)); + bool isWholeDropDown = (style & BTNS_WHOLEDROPDOWN) != 0; + bool isListToolbar = (pTB->GetStyle() & TBSTYLE_LIST) != 0; + + // Calculate dropdown width. + int dropDownWidth = 0; + if (isDropDown || isWholeDropDown) + { + // Use the internal Marlett font to determine the + // width for the drop down arrow section. + int cyMenuCheck = ::GetSystemMetrics(SM_CYMENUCHECK) * + GetWindowDpi(*this) / GetWindowDpi(HWND_DESKTOP); + drawDC.CreateFont(cyMenuCheck, 0, 0, 0, FW_NORMAL, 0, 0, 0, + SYMBOL_CHARSET, 0, 0, 0, 0, _T("Marlett")); + + drawDC.GetCharWidth('6', '6', &dropDownWidth); + } + + // Calculate image position. + CSize szImage = toolBarImages.GetIconSize(); + int xImage = 0; + int yImage = 0; + int pressedOffset = (state & CDIS_SELECTED) ? 1 : 0; + + if (isListToolbar) + { + // Calculate the image position for the BTNS_LIST toolbar style. + // This style positions the button text to the right of the bitmap. + xImage = rc.left + pressedOffset; + yImage = (rc.bottom - rc.top - szImage.cy +2) / 2 + pressedOffset; + } + else + { + // Calculate the image position without the BTNS_LIST toolbar style. + int dropAjust = (dropDownWidth * 3) / 4; + xImage = (rc.right + rc.left - szImage.cx - dropAjust) / 2 + pressedOffset; + yImage = (rc.bottom + rc.top - szImage.cy - textSize.cy) / 2; + } + + if (isDropDown || isWholeDropDown) + { + // Calculate arrow position for the BTNS_DROPDOWN + // and BTNS_WHOLEDROPDOWN button styles. + int arrowHeight = (dropDownWidth + 1) / 5; + int xArrow = rc.right - dropDownWidth / 2; + int yArrow = (yImage + szImage.cy + arrowHeight) / 2; + + if (isDropDown) + { + yArrow = (rc.Height() + arrowHeight) / 2; + } + + if (isListToolbar) + { + yArrow += 1; + } + + // Draw separate background for dropdown arrow. + if (isHot && isDropDown) + { + CRect arrowRect = rc; + arrowRect.left = arrowRect.right - dropDownWidth; + drawDC.GradientFill(GetToolBarTheme().clrPressed1, + GetToolBarTheme().clrPressed2, arrowRect, TRUE); + } + + // Draw the dropdown arrow. + drawDC.CreatePen(PS_SOLID, 1, RGB(0, 0, 0)); + for (int i = arrowHeight; i >= 0; --i) + { + drawDC.MoveTo(xArrow - i-1, yArrow - i+1); + drawDC.LineTo(xArrow + i, yArrow - i+1); + } + + // Draw the line between icon and dropdown arrow. + if (isDropDown && isHot) + { + drawDC.CreatePen(PS_SOLID, 1, GetToolBarTheme().clrOutline); + drawDC.MoveTo(rc.right - dropDownWidth, rc.top); + drawDC.LineTo(rc.right - dropDownWidth, rc.bottom); + } + } + + // Draw the button image. + TBBUTTON tbb = {}; + int button = pTB->CommandToIndex(item); + pTB->GetButton(button, tbb); + int image = tbb.iBitmap; + toolBarImages.Draw(drawDC, image, CPoint(xImage, yImage), ILD_TRANSPARENT); + + // Draw the text. + if (!str.IsEmpty()) + { + // Calculate the text position. + int width = rc.right - rc.left - (isDropDown ? dropDownWidth : 0); + int textSizeX = textSize.cx; + int textSizeY = textSize.cy; + CRect textRect(0, 0, std::min(textSizeX, width), textSizeY); + + int xOffset = rc.left + (rc.Width() - textRect.Width()) / 2; + if (isDropDown) + xOffset -= dropDownWidth / 2; + + int yOffset = yImage + szImage.cy + 1; + + if (isListToolbar) + { + int textSpace = rc.Width() - szImage.cx - textRect.Width() - dropDownWidth; + xOffset = rc.left + szImage.cx + textSpace / 2; + yOffset = (rc.Height() - textRect.Height())/2 + pressedOffset + 1; + } + + OffsetRect(&textRect, xOffset, yOffset); + + // Select the toolbar's font with a transparent background. + int mode = drawDC.SetBkMode(TRANSPARENT); + drawDC.SelectObject(pTB->GetFont()); + + if (isDisabled) + { + // Draw disabled text twice for embossed look. + textRect.OffsetRect(1, 1); + drawDC.SetTextColor(RGB(255, 255, 255)); + drawDC.DrawText(str, str.GetLength(), textRect, DT_LEFT); + textRect.OffsetRect(-1, -1); + drawDC.SetTextColor(GetSysColor(COLOR_GRAYTEXT)); + drawDC.DrawText(str, str.GetLength(), textRect, DT_LEFT); + } + else + { + // Draw normal text. + if ((GetMenuBarTheme().UseThemes)) + drawDC.SetTextColor(GetMenuBarTheme().clrText); + else + drawDC.SetTextColor(GetSysColor(COLOR_BTNTEXT)); + drawDC.DrawText(str, str.GetLength(), textRect, DT_LEFT | DT_END_ELLIPSIS); + } + + drawDC.SetBkMode(mode); + } + } + + return CDRF_SKIPDEFAULT; // No further drawing. + } + } + } + return 0; + } + + // Called by OnDrawItem to render the popup menu items. + template + inline void CFrameT::DrawMenuItem(LPDRAWITEMSTRUCT pDrawItem) + { + MenuItemData* pmid = reinterpret_cast(pDrawItem->itemData); + + // Update status text when the menu item is deselected. + if (!(pDrawItem->itemState & ODS_SELECTED)) + if (IsUsingMenuStatus() && GetStatusBar().IsWindow()) + GetStatusBar().SetPartText(0, m_statusText, SBT_OWNERDRAW); + + // Create and configure the memory DC. + CDC drawDC = pDrawItem->hDC; + CRect itemRect = pDrawItem->rcItem; + CMemDC memDC(drawDC); + memDC.CreateCompatibleBitmap(drawDC, itemRect.Width(), itemRect.Height()); + memDC.BitBlt(0, 0, itemRect.Width(), itemRect.Height(), drawDC, + itemRect.left, itemRect.top, SRCCOPY); + memDC.SelectObject(GetMenuFont()); + + // Swap the PDIS->hDC with a memory DC for double buffering. + pDrawItem->hDC = memDC; + pDrawItem->rcItem.top = 0; + pDrawItem->rcItem.bottom = itemRect.Height(); + + if (IsUsingVistaMenu() && !IsUsingDarkMenu()) + { + DrawVistaMenuBkgnd(pDrawItem); + + if (!(pmid->mii.fType & MFT_SEPARATOR)) + { + if (pDrawItem->itemState & ODS_CHECKED) + DrawVistaMenuCheckmark(pDrawItem); + + DrawVistaMenuText(pDrawItem); + } + } + else + { + // Draw the gutter. + CRect gutter = GetMenuMetrics().GetGutterRect(pDrawItem->rcItem); + + if (IsUsingThemes()) + { + const MenuTheme& mbt = GetMenuBarTheme(); + memDC.GradientFill(mbt.clrPressed1, mbt.clrPressed2, gutter, FALSE); + } + else + { + memDC.SolidFill(RGB(255, 255, 255), gutter); + } + + if (pmid->mii.fType & MFT_SEPARATOR) + { + // Draw the separator. + CRect sepRect = pDrawItem->rcItem; + sepRect.left = gutter.Width(); + if (IsUsingDarkMenu()) + memDC.SolidFill(RGB(0, 0, 0), sepRect); + else + memDC.SolidFill(RGB(255, 255, 255), sepRect); + + sepRect.top += sepRect.Height() / 2; + memDC.CreatePen(PS_SOLID, 1, RGB(128, 128, 128)); + memDC.MoveTo(sepRect.left, sepRect.top); + memDC.LineTo(sepRect.right, sepRect.top); + } + else + { + DrawMenuItemBkgnd(pDrawItem); + DrawMenuItemText(pDrawItem); + + if (pDrawItem->itemState & ODS_CHECKED) + DrawMenuItemCheckmark(pDrawItem); + } + } + + if (!(pmid->mii.fType & MFT_SEPARATOR)) + { + if (!(pDrawItem->itemState & ODS_CHECKED)) + DrawMenuItemIcon(pDrawItem); + } + + // Copy from the memory DC to the menu item drawing DC. + drawDC.BitBlt(itemRect.left, itemRect.top, itemRect.Width(), + itemRect.Height(), memDC, 0, 0, SRCCOPY); + + // Return pDrawItem to its previous values. + pDrawItem->hDC = drawDC; + pDrawItem->rcItem = itemRect; + } + + // Draws the popup menu background if uxtheme.dll is not loaded. + template + inline void CFrameT::DrawMenuItemBkgnd(LPDRAWITEMSTRUCT pDrawItem) + { + // Draw the item background + bool isDisabled = (pDrawItem->itemState & ODS_GRAYED) != 0; + bool isSelected = (pDrawItem->itemState & ODS_SELECTED) != 0; + CRect drawRect = pDrawItem->rcItem; + CDC drawDC(pDrawItem->hDC); + + if ((isSelected) && (!isDisabled)) + { + // draw selected item background. + if (IsUsingThemes()) + { + const MenuTheme& mbt = GetMenuBarTheme(); + drawDC.CreateSolidBrush(mbt.clrHot1); + drawDC.CreatePen(PS_SOLID, 1, mbt.clrOutline); + } + else + { + drawDC.CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); + drawDC.CreatePen(PS_SOLID, 1, GetSysColor(COLOR_BTNFACE)); + } + + drawDC.Rectangle(drawRect.left, drawRect.top, drawRect.right, drawRect.bottom); + } + else + { + // draw non-selected item background. + drawRect.left = GetMenuMetrics().GetGutterRect(pDrawItem->rcItem).Width(); + if (IsUsingDarkMenu()) + drawDC.SolidFill(RGB(0, 0, 0), drawRect); + else + drawDC.SolidFill(RGB(255, 255, 255), drawRect); + } + } + + // Draws the popup menu checkmark or radiocheck if uxtheme.dll is not loaded. + template + inline void CFrameT::DrawMenuItemCheckmark(LPDRAWITEMSTRUCT pDrawItem) + { + CRect rc = pDrawItem->rcItem; + MenuItemData* pmid = reinterpret_cast(pDrawItem->itemData); + UINT buttonType = pmid->mii.fType; + const MenuTheme& mbt = GetMenuBarTheme(); + int cxCheck = T::DpiScaleInt(16); + int cyCheck = T::DpiScaleInt(16); + CRect gutter = GetMenuMetrics().GetGutterRect(rc); + int left = (gutter.Width() - cxCheck) / 2; + int top = rc.top + (rc.Height() - cyCheck) / 2; + CRect bkRect(left, top, left + cxCheck, top + cyCheck); + CDC drawDC(pDrawItem->hDC); + + // Draw the checkmark's background rectangle first. + if (IsUsingThemes() && !IsUsingVistaMenu()) + { + drawDC.CreatePen(PS_SOLID, 1, mbt.clrOutline); + if (IsUsingThemes()) + drawDC.CreateSolidBrush(mbt.clrHot2); + else + drawDC.CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); + + drawDC.Rectangle(bkRect); + } + + CMemDC maskDC(drawDC); + maskDC.CreateBitmap(cxCheck, cyCheck, 1, 1, nullptr); + CRect checkRect(0, 0, cxCheck, cyCheck); + + // Copy the check mark bitmap to the mask's device context. + if (buttonType == MFT_RADIOCHECK) + maskDC.DrawFrameControl(checkRect, DFC_MENU, DFCS_MENUBULLET); + else + maskDC.DrawFrameControl(checkRect, DFC_MENU, DFCS_MENUCHECK); + + int xoffset = (buttonType == MFT_RADIOCHECK)? 1 : 2; + int yoffset = 0; + + // Draw a white or black check mark as required. + CMemDC memDC(drawDC); + memDC.CreateCompatibleBitmap(drawDC, cxCheck, cyCheck); + memDC.BitBlt(0, 0, cxCheck, cyCheck, memDC, 0, 0, WHITENESS); + + if ((pDrawItem->itemState & ODS_SELECTED) && IsUsingThemes()) + { + // Draw a white checkmark. + maskDC.BitBlt(0, 0, cxCheck, cyCheck, maskDC, 0, 0, DSTINVERT); + memDC.BitBlt(0, 0, cxCheck, cyCheck, maskDC, 0, 0, SRCAND); + drawDC.BitBlt(bkRect.left + xoffset, bkRect.top + yoffset, cxCheck, + cyCheck, memDC, 0, 0, SRCPAINT); + } + else + { + // Draw a black checkmark. + memDC.BitBlt(0, 0, cxCheck, cyCheck, maskDC, 0, 0, SRCAND); + drawDC.BitBlt(bkRect.left + xoffset, bkRect.top + yoffset, cxCheck, + cyCheck, memDC, 0, 0, SRCAND); + + if (IsUsingDarkMenu()) + { + // Draw a gray checkmark over black checkmark. + CRect rcCheck(0, 0, cxCheck, cyCheck); + constexpr COLORREF gray = RGB(192, 192, 192); + memDC.SolidFill(gray, rcCheck); + maskDC.BitBlt(0, 0, cxCheck, cyCheck, maskDC, 0, 0, DSTINVERT); + memDC.BitBlt(0, 0, cxCheck, cyCheck, maskDC, 0, 0, SRCAND); + drawDC.BitBlt(bkRect.left + xoffset, bkRect.top + yoffset, + cxCheck, cyCheck, memDC, 0, 0, SRCPAINT); + } + } + } + + // Called by DrawMenuItem to draw icons in popup menus. + template + inline void CFrameT::DrawMenuItemIcon(LPDRAWITEMSTRUCT pDrawItem) + { + if (m_menuImages.GetHandle() == 0) + return; + + // Get icon size. + CSize iconSize = m_menuImages.GetIconSize(); + int xIcon = iconSize.cx; + int yIcon = iconSize.cy; + + // get the drawing rectangle. + CRect itemRect = pDrawItem->rcItem; + CRect gutter = GetMenuMetrics().GetGutterRect(pDrawItem->rcItem); + int left = (gutter.Width() - xIcon) / 2; + int top = itemRect.top + (itemRect.Height() - yIcon) / 2; + + // get the icon's location in the image list. + int image = -1; + for (size_t i = 0 ; i < m_menuItemIDs.size(); ++i) + { + if (pDrawItem->itemID == m_menuItemIDs[i]) + image = static_cast(i); + } + + // Draw the image. + if (image >= 0 ) + { + bool isDisabled = (pDrawItem->itemState & (ODS_GRAYED | ODS_DISABLED)) != 0; + + if ((isDisabled) && (m_menuDisabledImages.GetHandle())) + m_menuDisabledImages.Draw(pDrawItem->hDC, image, + CPoint(left, top), ILD_TRANSPARENT); + else + m_menuImages.Draw(pDrawItem->hDC, image, CPoint(left, top), + ILD_TRANSPARENT); + } + } + + // Draws the popup menu text if uxtheme.dll is not loaded. + template + inline void CFrameT::DrawMenuItemText(LPDRAWITEMSTRUCT pDrawItem) + { + MenuItemData* pmid = reinterpret_cast(pDrawItem->itemData); + CString itemText = pmid->itemText; + bool isDisabled = (pDrawItem->itemState & ODS_GRAYED) != 0; + COLORREF colorText = GetSysColor(isDisabled ? COLOR_GRAYTEXT : COLOR_MENUTEXT); + if (IsUsingDarkMenu()) + { + colorText = isDisabled ? RGB(192, 192, 192) : RGB(255, 255, 255); + } + + // Calculate the text rect size. + CRect textRect = GetMenuMetrics().GetTextRect(pDrawItem->rcItem); + + // Find the position of tab character. + int tab = itemText.Find(_T('\t')); + + // Draw the item text. + SetTextColor(pDrawItem->hDC, colorText); + int mode = SetBkMode(pDrawItem->hDC, TRANSPARENT); + + UINT format = DT_VCENTER | DT_LEFT | DT_SINGLELINE; + // Turn on 'hide prefix' style for mouse navigation. + CMenuBar* pMenubar = reinterpret_cast + (::SendMessage(pDrawItem->hwndItem, UWM_GETCMENUBAR, 0, 0)); + if (pMenubar != nullptr) + { + if (!m_altKeyPressed && !pMenubar->IsAltMode()) + format |= DT_HIDEPREFIX; + } + + DrawText(pDrawItem->hDC, itemText, tab, textRect, format); + + // Draw text after tab, right aligned. + if (tab != -1) + { + DrawText(pDrawItem->hDC, itemText.Mid(tab + 1), -1, textRect, + DT_SINGLELINE | DT_RIGHT | DT_VCENTER); + } + + SetBkMode(pDrawItem->hDC, mode); + } + + // Draws the ReBar's background when ReBar themes are enabled. + // Returns TRUE when the default background drawing is suppressed. + template + inline BOOL CFrameT::DrawReBarBkgnd(CDC& dc, CReBar& rebar) + { + BOOL isDrawn = TRUE; + + const ReBarTheme& rt = GetReBarTheme(); + if (!rt.UseThemes) + isDrawn = FALSE; + + if (!rt.clrBkgnd1 && !rt.clrBkgnd2 && !rt.clrBand1 && !rt.clrBand2) + isDrawn = FALSE; + + if (isDrawn) + { + assert(rebar.IsWindow()); + + bool isVertical = (rebar.GetStyle() & CCS_VERT) != 0; + + // Create our memory DC. + CRect rebarRect = rebar.GetClientRect(); + int width = rebarRect.Width(); + int height = rebarRect.Height(); + CMemDC memDC(dc); + memDC.CreateCompatibleBitmap(dc, width, height); + + // Draw to ReBar background to the memory DC. + memDC.SolidFill(rt.clrBkgnd2, rebarRect); + memDC.GradientFill(rt.clrBkgnd1, rt.clrBkgnd2, rebarRect, FALSE); + + if (rt.clrBand1 || rt.clrBand2) + { + // Draw the individual band backgrounds. + for (int band = 0; band < rebar.GetBandCount(); ++band) + { + if (rebar.IsBandVisible(band)) + { + if (band != rebar.GetBand(GetMenuBar())) + { + // Determine the size of this band. + CRect bandRect = rebar.GetBandRect(band); + + if (isVertical) + { + int right = bandRect.right; + bandRect.right = bandRect.bottom; + bandRect.bottom = right; + } + + // Determine the size of the child window. + REBARBANDINFO rbbi = {}; + rbbi.fMask = RBBIM_CHILD; + rebar.GetBandInfo(band, rbbi); + CWnd* pChild = T::GetCWndPtr(rbbi.hwndChild); + assert(pChild); + CRect childRect = pChild->GetWindowRect(); + pChild->ScreenToClient(childRect); + + // Determine our drawing rectangle. + int startPad = IsXPThemed() ? 2 : 0; + CRect drawRect = bandRect; + CRect borderRect = rebar.GetBandBorders(band); + if (isVertical) + { + drawRect.bottom = drawRect.top + childRect.Height() + borderRect.top; + drawRect.top -= startPad; + } + else + { + drawRect.right = drawRect.left + childRect.Width() + borderRect.left; + drawRect.left -= startPad; + } + + if (!rt.FlatStyle) + VERIFY(::InflateRect(&drawRect, 1, 1)); + + // Fill the Source CDC with the band's background. + CMemDC sourceDC(dc); + sourceDC.CreateCompatibleBitmap(dc, width, height); + sourceDC.GradientFill(rt.clrBand1, rt.clrBand2, drawRect, !isVertical); + + // Set Curve amount for rounded edges. + int curve = rt.RoundBorders ? T::DpiScaleInt(12) : 0; + + // Create our mask for rounded edges using RoundRect. + CMemDC maskDC(dc); + maskDC.CreateCompatibleBitmap(dc, width, height); + + int left = drawRect.left; + int right = drawRect.right; + int top = drawRect.top; + int bottom = drawRect.bottom; + int cx = drawRect.Width();// + xPad; + int cy = drawRect.Height(); + + if (rt.FlatStyle) + { + maskDC.SolidFill(RGB(0, 0, 0), drawRect); + maskDC.BitBlt(left, top, cx, cy, maskDC, left, top, PATINVERT); + maskDC.RoundRect(left, top, right, bottom, curve, curve); + } + else + { + maskDC.SolidFill(RGB(0, 0, 0), drawRect); + maskDC.RoundRect(left, top, right, bottom, curve, curve); + maskDC.BitBlt(left, top, cx, cy, maskDC, left, top, PATINVERT); + } + + // Copy Source DC to Memory DC using the RoundRect mask. + memDC.BitBlt(left, top, cx, cy, sourceDC, left, top, SRCINVERT); + memDC.BitBlt(left, top, cx, cy, maskDC, left, top, SRCAND); + memDC.BitBlt(left, top, cx, cy, sourceDC, left, top, SRCINVERT); + } + } + } + } + + if (rt.UseLines) + { + // Draw lines between bands. + for (int j = 0; j < GetReBar().GetBandCount() - 1; ++j) + { + CRect bandRect = GetReBar().GetBandRect(j); + if (isVertical) + { + int rebarTop = rebarRect.top; + bandRect.top = std::max(0, rebarTop - 4); + bandRect.right += 2; + } + else + { + int rebarLeft = rebarRect.left; + bandRect.left = std::max(0, rebarLeft - 4); + bandRect.bottom += 2; + } + memDC.DrawEdge(bandRect, EDGE_ETCHED, BF_BOTTOM | BF_ADJUST); + } + } + + // Copy the Memory DC to the window's DC. + dc.BitBlt(0, 0, width, height, memDC, 0, 0, SRCCOPY); + } + + return isDrawn; + } + + // Draws the status bar text with the appropriate color. + template + inline void CFrameT::DrawStatusBar(LPDRAWITEMSTRUCT pDrawItem) + { + CDC dc(pDrawItem->hDC); + CRect partRect = pDrawItem->rcItem; + dc.SetBkMode(TRANSPARENT); + if (IsUsingThemes()) + dc.SetTextColor(GetStatusBarTheme().clrText); + else + dc.SetTextColor(RGB(0, 0, 0)); + + assert(pDrawItem->itemData != 0); + CString text = reinterpret_cast(pDrawItem->itemData); + dc.DrawText(text, text.GetLength(), partRect, DT_SINGLELINE | DT_VCENTER); + } + + // Draws the StatusBar's background when StatusBar themes are enabled. + // Returns TRUE when the default background drawing is suppressed. + template + inline BOOL CFrameT::DrawStatusBarBkgnd(CDC& dc, CStatusBar& statusbar) + { + BOOL isDrawn = FALSE; + + // XP Themes are required to modify the statusbar's background. + if (IsXPThemed()) + { + const StatusBarTheme& sbTheme = GetStatusBarTheme(); + if (sbTheme.UseThemes) + { + // Create our memory DC. + CRect rc = statusbar.GetClientRect(); + int width = rc.Width(); + int height = rc.Height(); + CMemDC memDC(dc); + memDC.CreateCompatibleBitmap(dc, width, height); + + // Fill the background with a color gradient. + memDC.GradientFill(sbTheme.clrBkgnd1, sbTheme.clrBkgnd2, + statusbar.GetClientRect(), FALSE); + + // Copy the Memory DC to the window's DC. + dc.BitBlt(0, 0, width, height, memDC, 0, 0, SRCCOPY); + + isDrawn = TRUE; + } + } + + return isDrawn; + } + + // Draws the popup menu background if uxtheme.dll is loaded. + template + inline void CFrameT::DrawVistaMenuBkgnd(LPDRAWITEMSTRUCT pDrawItem) + { + int stateID = GetMenuMetrics().ToItemStateId(pDrawItem->itemState); + + if (GetMenuMetrics().IsThemeBackgroundPartiallyTransparent( + MENU_POPUPITEM, stateID)) + { + CRect selRect = GetMenuMetrics().GetSelectionRect(pDrawItem->rcItem); + GetMenuMetrics().DrawThemeBackground(pDrawItem->hDC, + MENU_POPUPBACKGROUND, 0, &selRect, nullptr); + } + + // Draw the gutter. + CRect gutter = GetMenuMetrics().GetGutterRect(pDrawItem->rcItem); + if (GetMenuMetrics().IsThemeBackgroundPartiallyTransparent( + MENU_POPUPITEM, stateID)) + { + GetMenuMetrics().DrawThemeBackground(pDrawItem->hDC, + MENU_POPUPGUTTER, 0, &gutter, nullptr); + } + + MenuItemData* pmid = reinterpret_cast(pDrawItem->itemData); + if (pmid->mii.fType & MFT_SEPARATOR) + { + // Draw the separator. + CRect sepRect = GetMenuMetrics().GetSeperatorRect(pDrawItem->rcItem); + GetMenuMetrics().DrawThemeBackground(pDrawItem->hDC, + MENU_POPUPSEPARATOR, 0, &sepRect, nullptr); + } + + CRect selRect = GetMenuMetrics().GetSelectionRect(pDrawItem->rcItem); + GetMenuMetrics().DrawThemeBackground(pDrawItem->hDC, MENU_POPUPITEM, + stateID, &selRect, nullptr); + } + + // Draws the popup menu checkmark if uxtheme.dll is loaded. + template + inline void CFrameT::DrawVistaMenuCheckmark(LPDRAWITEMSTRUCT pDrawItem) + { + MenuItemData* pmid = reinterpret_cast(pDrawItem->itemData); + + // Draw the checkmark background. + int stateID = GetMenuMetrics().ToItemStateId(pDrawItem->itemState); + CRect rcCheckBackground = GetMenuMetrics().GetCheckBackgroundRect(pDrawItem->rcItem); + int backgroundStateID = GetMenuMetrics().ToCheckBackgroundStateId(stateID); + GetMenuMetrics().DrawThemeBackground(pDrawItem->hDC, + MENU_POPUPCHECKBACKGROUND, backgroundStateID, &rcCheckBackground, nullptr); + + // Draw the checkmark. + CRect rcCheck = GetMenuMetrics().GetCheckRect(pDrawItem->rcItem); + int checkStateID = GetMenuMetrics().ToCheckStateId(pmid->mii.fType, stateID); + GetMenuMetrics().DrawThemeBackground(pDrawItem->hDC, MENU_POPUPCHECK, + checkStateID, &rcCheck, nullptr); + } + + // Draws the popup menu text if uxtheme.dll is loaded. + template + inline void CFrameT::DrawVistaMenuText(LPDRAWITEMSTRUCT pDrawItem) + { + MenuItemData* pmid = reinterpret_cast(pDrawItem->itemData); + + // Calculate the text rect size. + CStringW itemText(TtoW(pmid->itemText)); + CRect textRect = GetMenuMetrics().GetTextRect(pDrawItem->rcItem); + + // find the position of tab character. + int tab = itemText.Find(L'\t'); + + // Draw the item text before the tab. + ULONG accel = ((pDrawItem->itemState & ODS_NOACCEL) ? DT_HIDEPREFIX : 0U); + int stateID = GetMenuMetrics().ToItemStateId(pDrawItem->itemState); + DWORD flags = DT_SINGLELINE | DT_LEFT | DT_VCENTER | accel; + GetMenuMetrics().DrawThemeText(pDrawItem->hDC, MENU_POPUPITEM, stateID, + itemText, tab, flags, 0, &textRect); + + // Draw the item text after the tab. + if (tab != -1) + { + flags = DT_SINGLELINE | DT_RIGHT | DT_VCENTER | accel; + CStringW text = itemText.Mid(tab + 1); + GetMenuMetrics().DrawThemeText(pDrawItem->hDC, MENU_POPUPITEM, + stateID, text, -1, flags, 0, &textRect); + } + } + + // Calculates the remaining client rect when a child window is excluded. + // Note: Assumes the child window touches 3 of the client rect's borders. + // e.g. CRect rc = ExcludeChildRect(GetClientRect(), GetStatusBar()); + template + inline CRect CFrameT::ExcludeChildRect(const CRect& clientRect, HWND child) const + { + CRect clientRC = clientRect; + if (T::ClientToScreen(clientRC)) + { + CRect childRect; + VERIFY(::GetWindowRect(child, &childRect)); + + if (clientRC.Width() == childRect.Width()) + { + if (clientRC.top == childRect.top) + clientRC.top += childRect.Height(); + else + clientRC.bottom -= childRect.Height(); + } + else + { + if (clientRC.left == childRect.left) + clientRC.left += childRect.Width(); + else + clientRC.right -= childRect.Width(); + } + + VERIFY(T::ScreenToClient(clientRC)); + } + + return clientRC; + } + + // Returns the preferred height of menu icons that fits nicely within a + // menu item. The value returned will be a multiple of 8 (e.g. 16, 24 or 32). + template + inline int CFrameT::GetMenuIconHeight() const + { + return GetMenuMetrics().GetMenuIconHeight(); + } + + // Returns a MRU entry given its index. + template + inline CString CFrameT::GetMRUEntry(UINT index) + { + CString pathName; + if (index < m_mruEntries.size()) + { + pathName = m_mruEntries[index]; + + // Now put the selected entry at index 0. + AddMRUEntry(pathName); + } + return pathName; + } + + // Returns the size of a bitmap image. + template + inline CSize CFrameT::GetTBImageSize(CBitmap* pBitmap) const + { + assert(pBitmap); + if (!pBitmap) return CSize(0, 0); + + assert(pBitmap->GetHandle()); + BITMAP data = pBitmap->GetBitmapData(); + int cy = data.bmHeight; + int cx = std::max(cy, 16); + + return CSize(cx, cy); + } + + // Returns the XP theme name. + template + inline CString CFrameT::GetXPThemeName() const + { + HMODULE theme = ::GetModuleHandle(_T("uxtheme.dll")); + WCHAR themeName[31] = L""; + if (theme != nullptr) + { + using GETCURRENTTHEMENAME = HRESULT (WINAPI*)(LPWSTR, int, LPWSTR, int, LPWSTR, int); + GETCURRENTTHEMENAME pfn = reinterpret_cast( + reinterpret_cast(::GetProcAddress(theme, "GetCurrentThemeName"))); + pfn(nullptr, 0, themeName, 30, nullptr, 0); + } + + return CString(themeName); + } + + // Returns a reference to the view window. + template <> + inline CWnd& CFrameT::GetView() const + { + return CDocker::GetView(); + } + + // Returns a reference to the view window. + template + inline CWnd& CFrameT::GetView() const + { + // Note: Use SetView to set the view window. + assert(m_pView); + return *m_pView; + } + + // Returns the dimensions of the view window. + template + inline CRect CFrameT::GetViewRect() const + { + CRect clientRect = T::GetClientRect(); + + if (GetStatusBar().IsWindow() && GetStatusBar().IsWindowVisible()) + clientRect = ExcludeChildRect(clientRect, GetStatusBar()); + + if (GetReBar().IsWindow() && GetReBar().IsWindowVisible()) + clientRect = ExcludeChildRect(clientRect, GetReBar()); + else + if (GetToolBar().IsWindow() && GetToolBar().IsWindowVisible()) + clientRect = ExcludeChildRect(clientRect, GetToolBar()); + + return clientRect; + } + + // Load the MRU list from the registry. + template + inline BOOL CFrameT::LoadRegistryMRUSettings(UINT maxMRU /*= 0*/) + { + // KeyName must be set before calling LoadRegistryMRUSettings. + assert(!m_keyName.IsEmpty()); + + CRegKey recentKey; + BOOL loaded = FALSE; + SetMRULimit(maxMRU); + std::vector mruEntries; + const CString recentKeyName = _T("Software\\") + m_keyName + _T("\\Recent Files"); + + if (ERROR_SUCCESS == recentKey.Open(HKEY_CURRENT_USER, recentKeyName, KEY_READ)) + { + CString pathName; + CString fileKeyName; + for (UINT i = 0; i < m_maxMRU; ++i) + { + DWORD bufferSize = 0; + fileKeyName.Format(_T("File %d"), i+1); + + if (ERROR_SUCCESS == recentKey.QueryStringValue(fileKeyName, + nullptr, &bufferSize)) + { + // load the entry from the registry. + int buffer = static_cast(bufferSize); + if (ERROR_SUCCESS == recentKey.QueryStringValue(fileKeyName, + pathName.GetBuffer(buffer), &bufferSize)) + { + pathName.ReleaseBuffer(); + + if (pathName.GetLength() > 0) + mruEntries.push_back( pathName ); + } + else + { + pathName.ReleaseBuffer(); + TRACE(_T("\n*** WARNING: LoadRegistryMRUSettings: \ + QueryStringValue failed. ***\n")); + } + } + } + + // successfully loaded all MRU values, so store them. + m_mruEntries = std::move(mruEntries); + loaded = TRUE; + } + + return loaded; + } + + // Loads various frame settings from the registry. + template + inline BOOL CFrameT::LoadRegistrySettings(LPCTSTR keyName) + { + assert (keyName != nullptr); + + m_keyName = keyName; + const CString settingsKeyName = _T("Software\\") + m_keyName + + _T("\\Frame Settings"); + BOOL isOK = FALSE; + InitValues values = {}; + CRegKey key; + if (ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, settingsKeyName, KEY_READ)) + { + try + { + DWORD top, left, width, height, showCmd, statusBar, toolBar; + + if (ERROR_SUCCESS != key.QueryDWORDValue(_T("Top"), top)) + throw CUserException(); + if (ERROR_SUCCESS != key.QueryDWORDValue(_T("Left"), left)) + throw CUserException(); + if (ERROR_SUCCESS != key.QueryDWORDValue(_T("Width"), width)) + throw CUserException(); + if (ERROR_SUCCESS != key.QueryDWORDValue(_T("Height"), height)) + throw CUserException(); + if (ERROR_SUCCESS != key.QueryDWORDValue(_T("ShowCmd"), showCmd)) + throw CUserException(); + if (ERROR_SUCCESS != key.QueryDWORDValue(_T("StatusBar"), statusBar)) + throw CUserException(); + if (ERROR_SUCCESS != key.QueryDWORDValue(_T("ToolBar"), toolBar)) + throw CUserException(); + + int l = static_cast(left); + int t = static_cast(top); + int r = static_cast(left + width); + int b = static_cast(top + height); + + CPoint midpoint((l + r) / 2, (t + b) / 2); + CPoint midtop((l + r)/2, t); + + HMONITOR monitor = ::MonitorFromPoint(midpoint, MONITOR_DEFAULTTONULL); + if (monitor == nullptr) + throw CUserException(); + + MONITORINFO mi = {}; + mi.cbSize = sizeof(mi); + ::GetMonitorInfo(monitor, &mi); + CRect workArea = mi.rcWork; + + // Check if window is mostly within work area. + if (!workArea.PtInRect(midpoint)) + throw CUserException(); + + // Check if the caption is within the work area. + if (!workArea.PtInRect(midtop)) + throw CUserException(); + + if (width <= 0 || height <= 0) + throw CUserException(); + + values.position = CRect(l, t, r, b); + values.showCmd = (SW_MAXIMIZE == showCmd) ? SW_MAXIMIZE : SW_SHOW; + values.showStatusBar = (statusBar & 1) ? TRUE : FALSE; + values.showToolBar = (toolBar & 1) ? TRUE : FALSE; + + isOK = TRUE; + } + + catch (const CUserException&) + { + TRACE("*** ERROR: Failed to load values from registry, using defaults. ***\n"); + + // Delete the bad key from the registry. + const CString appKeyName = _T("Software\\") + m_keyName; + CRegKey appKey; + if (ERROR_SUCCESS == appKey.Open(HKEY_CURRENT_USER, appKeyName, KEY_READ)) + appKey.DeleteSubKey(_T("Frame Settings")); + + values = {}; + } + } + + SetInitValues(values); + return isOK; + } + + // Determines the size of the popup menus. + template + inline void CFrameT::MeasureMenuItem(MEASUREITEMSTRUCT *pMIS) + { + MenuItemData* pMID = reinterpret_cast(pMIS->itemData); + // Does itemData contain a valid MenuItemData struct? + assert(::IsMenu(pMID->menu)); + + // Get the font used in menu items. + CClientDC dc(*this); + LOGFONT lf = GetMenuFont().GetLogFont(); + + // Default menu items are bold, so take this into account. + if (static_cast(::GetMenuDefaultItem(pMID->menu, TRUE, + GMDI_USEDISABLED)) != -1) + { + lf.lfWeight = FW_BOLD; + } + + dc.CreateFontIndirect(lf); + CSize size = GetMenuMetrics().GetItemSize(pMID, dc); + + // if the type is not a separator. + if (~pMID->mii.fType & MFT_SEPARATOR) + { + // Account for icon height. + int iconGap = T::DpiScaleInt(4); + int sizeY = size.cy; + size.cy = std::max(sizeY, GetMenuIconHeight() + iconGap); + } + + // Fill the MEASUREITEMSTRUCT struct with the new size. + pMIS->itemWidth = static_cast(size.cx); + pMIS->itemHeight = static_cast(size.cy); + } + + // Called when the frame is activated (WM_ACTIVATE received). + template + inline LRESULT CFrameT::OnActivate(UINT msg, WPARAM wparam, LPARAM lparam) + { + // Perform default processing first. + T::FinalWindowProc(msg, wparam, lparam); + + if (LOWORD(wparam) == WA_INACTIVE) + { + // Remove the keyboard hook used by the keyboard indicators. + RemoveKbdHook(); + + // Save the hwnd of the window that currently has focus. + // This must be CFrame window itself or a child window. + if (!T::IsIconic()) m_oldFocus = ::GetFocus(); + + // Ensure no toolbar button is still hot. + if (GetToolBar().IsWindow()) + GetToolBar().SendMessage(TB_SETHOTITEM, static_cast(-1), 0); + } + else + { + // Set the keyboard hook by the keyboard indicators if + // m_useIndicatorStatus is TRUE. + SetKbdHook(); + + // Now set the focus to the appropriate child window. + if (m_oldFocus != nullptr) ::SetFocus(m_oldFocus); + } + + // Update DockClient captions. + T::PostMessage(UWM_DOCKACTIVATE); + + // Also update DockClient captions if the view is a docker. + if (GetView().IsWindow() && GetView().SendMessage(UWM_GETCDOCKER)) + GetView().PostMessage(UWM_DOCKACTIVATE); + + return 0; + } + + // Called in response to a WM_CLOSE message for the frame. + template + inline void CFrameT::OnClose() + { + SaveRegistrySettings(); + T::ShowWindow(SW_HIDE); + this->Destroy(); + } + + // This is called when the frame window is being created. + // Override this in CMainFrame if you wish to modify what happens here. + template + inline int CFrameT::OnCreate(CREATESTRUCT&) + { + // Set the icon. + T::SetIconLarge(IDW_MAIN); + T::SetIconSmall(IDW_MAIN); + + // Set the keyboard accelerators. + SetAccelerators(IDW_MAIN); + + // Set the Caption. + SetTitle(LoadString(IDW_MAIN)); + + // Set the theme for the frame elements. + SetTheme(); + + // Create the rebar and menubar. + if (IsUsingReBar()) + { + // Create the rebar. + GetReBar().Create(*this); + + // Create the menubar inside rebar. + GetMenuBar().Create(GetReBar()); + AddMenuBarBand(); + + // Disable XP themes for the menubar. + GetMenuBar().SetWindowTheme(L" ", L" "); + } + + // Setup the menu if IDW_MAIN menu resource is defined. + CMenu menu(IDW_MAIN); + if (::IsMenu(menu)) + { + SetFrameMenu(menu); + if (m_maxMRU > 0) + UpdateMRUMenu(); + } + else + ShowMenu(FALSE); // No menu if IDW_MAIN menu resource isn't defined. + + // Configure the menu metrics and fonts. + ResetMenuMetrics(); + UpdateSettings(); + + // Create the ToolBar. + if (IsUsingToolBar()) + { + CreateToolBar(); + ShowToolBar(GetInitValues().showToolBar); + } + else + { + if (IsMenu(GetFrameMenu())) + GetFrameMenu().EnableMenuItem(IDW_VIEW_TOOLBAR, MF_GRAYED); + } + + SetupMenuIcons(); + + // Create the status bar. + if (IsUsingStatusBar()) + { + GetStatusBar().Create(*this); + GetStatusBar().SetFont(m_statusBarFont, FALSE); + ShowStatusBar(GetInitValues().showStatusBar); + CString status = LoadString(IDW_READY); + + // Is the IDW_READY string resource defined? + if (!status.IsEmpty()) + SetStatusText(status); + } + else + { + if (IsMenu(GetFrameMenu())) + GetFrameMenu().EnableMenuItem(IDW_VIEW_STATUSBAR, MF_GRAYED); + } + + // Use SetView in CMainFrame's constructor to set the view window. + assert(&GetView()); + + // Create the view window. + if (!GetView().IsWindow()) + GetView().Create(*this); + GetView().SetFocus(); + + // Set the frame as the main window for this thread. + GetApp()->SetMainWnd(*this); + + // Reposition the child windows. + RecalcLayout(); + + return 0; + } + + // Handles CustomDraw notification from WM_NOTIFY. + template + inline LRESULT CFrameT::OnCustomDraw(LPNMHDR pNMHDR) + { + if ( ::SendMessage(pNMHDR->hwndFrom, UWM_GETCTOOLBAR, 0, 0) ) + { + if (pNMHDR->hwndFrom == GetMenuBar()) + return CustomDrawMenuBar(pNMHDR); + else + return CustomDrawToolBar(pNMHDR); + } + + return 0; + } + + // Called when the frame is about to be destroyed (WM_DESTROY received). + // Calls PostQuitMessage to end the application. + template + inline void CFrameT::OnDestroy() + { + GetView().Destroy(); + GetMenuBar().Destroy(); + GetToolBar().Destroy(); + GetReBar().Destroy(); + GetStatusBar().Destroy(); + + ::PostQuitMessage(0); // Terminates the application. + } + + // Called in response to a WM_DPICHANGED message that is sent to a + // top-level window when the DPI changes. Only top-level windows receive a + // WM_DPICHANGED message. + template + inline LRESULT CFrameT::OnDpiChanged(UINT, WPARAM, LPARAM lparam) + { + T::SetRedraw(FALSE); + + // Resize the frame, using the suggested new window size. + RECT* const pWindowRect = reinterpret_cast(lparam); + assert(pWindowRect); + T::SetWindowPos(HWND_TOP, *pWindowRect, SWP_NOZORDER | SWP_NOACTIVATE); + + // Update the rebar, menubar and statusbar. + ResetMenuMetrics(); + UpdateSettings(); + + // Destroy and re-create the current toolbar. + if (GetToolBar().IsWindow()) + { + BOOL isToolbarShown = GetToolBar().IsWindowVisible(); + if (GetReBar().IsWindow()) + { + int band = GetReBar().GetBand(GetToolBar()); + if (band >= 0) + GetReBar().DeleteBand(band); + } + + GetToolBar().Destroy(); + CreateToolBar(); // CreateToolbar calls SetupToolBar. + ShowToolBar(isToolbarShown); + } + + // Update the menu icons. + ClearMenuIcons(); + SetupMenuIcons(); + + RecalcLayout(); + + T::SetRedraw(TRUE); + T::RedrawWindow(); + return 0; + } + + // OwnerDraw is used to render the popup menu items. + template + inline LRESULT CFrameT::OnDrawItem(UINT, WPARAM, LPARAM lparam) + { + LPDRAWITEMSTRUCT pDrawItem = reinterpret_cast(lparam); + + if (pDrawItem != nullptr) + { + // Some control types, such as status bars, do not set the value of CtlType. + // We use hwndItem to detect the control. + if (pDrawItem->hwndItem == GetStatusBar()) + { + DrawStatusBar(pDrawItem); + } + else if (::IsMenu(reinterpret_cast(pDrawItem->hwndItem))) + { + DrawMenuItem(pDrawItem); + } + } + + return TRUE; + } + + // Called when the rebar's background is redrawn. + template + inline LRESULT CFrameT::OnDrawRBBkgnd(UINT, WPARAM wparam, LPARAM lparam) + { + CDC* pDC = reinterpret_cast(wparam); + assert(dynamic_cast(pDC)); + + CReBar* pRebar = reinterpret_cast(lparam); + assert(dynamic_cast(pRebar)); + + if (pDC == nullptr || pRebar == nullptr) + return 0; + + return DrawReBarBkgnd(*pDC, *pRebar); + } + + // Called when the statusbar's background is redrawn. + template + inline LRESULT CFrameT::OnDrawSBBkgnd(UINT, WPARAM wparam, LPARAM lparam) + { + CDC* pDC = reinterpret_cast(wparam); + assert(dynamic_cast(pDC)); + + CStatusBar* pStatusbar = reinterpret_cast(lparam); + assert(dynamic_cast(pStatusbar)); + + if (pDC == nullptr || pStatusbar == nullptr) + return 0; + + return DrawStatusBarBkgnd(*pDC, *pStatusbar); + } + + // Called to display help (WM_HELP received or selected via menu). + template + inline BOOL CFrameT::OnHelp() + { + // Ensure only one dialog displayed even for multiple hits of the F1 button. + if (!m_aboutDialog.IsWindow()) + { + m_aboutDialog.DoModal(*this); + } + + return TRUE; + } + + // Called when the menu's modal loop begins (WM_INITMENUPOPUP received). + template + inline LRESULT CFrameT::OnInitMenuPopup(UINT msg, WPARAM wparam, LPARAM lparam) + { + CMenu menu = reinterpret_cast(wparam); + + // The system menu shouldn't be owner drawn. + if (HIWORD(lparam) || (T::GetSystemMenu() == menu)) + return CWnd::WndProcDefault(msg, wparam, lparam); + + if (IsUsingThemes()) + { + MENUINFO mi = {}; + mi.cbSize = sizeof(mi); + mi.fMask = MIM_BACKGROUND | MIM_APPLYTOSUBMENUS; + + // Change the background brush color for dark menu. + if (IsUsingDarkMenu()) + mi.hbrBack = static_cast(GetStockObject(BLACK_BRUSH)); + else + mi.hbrBack = 0; + + menu.SetMenuInfo(mi); + } + + if (m_useOwnerDrawnMenu) + { + // A vector to store this menu's item data. + MenuData menuData; + + bool hasTabs = false; + + for (int i = 0; i < menu.GetMenuItemCount(); ++i) + { + // The MenuItemData pointer is deleted in OnUnInitMenuPopup. + MenuItemDataPtr itemDataPtr(std::make_unique()); + MENUITEMINFO mii = {}; + mii.cbSize = sizeof(mii); + mii.fMask = MIIM_TYPE | MIIM_DATA; + mii.dwTypeData = itemDataPtr->itemText.GetBuffer(WXX_MAX_STRING_SIZE); + mii.cch = WXX_MAX_STRING_SIZE; + + // Update the state of menu items. + UINT menuItem = menu.GetMenuItemID(i); + OnMenuUpdate(menuItem); + + // Specify owner-draw for the menu item type. + UINT position = static_cast(i); + if (menu.GetMenuItemInfo(position, mii, TRUE)) + { + itemDataPtr->itemText.ReleaseBuffer(); + if (itemDataPtr->itemText.Find(_T("\t")) >= 0) + hasTabs = true; + + if (mii.dwItemData == 0) + { + itemDataPtr->menu = menu; + itemDataPtr->pos = position; + itemDataPtr->mii = mii; + mii.dwItemData = reinterpret_cast(itemDataPtr.get()); + mii.fType |= MFT_OWNERDRAW; + menu.SetMenuItemInfo(position, mii, TRUE); // Store pItem in mii + menuData.push_back(std::move(itemDataPtr)); + } + } + } + + // If one item has a tab, all should have a tab. + if (hasTabs) + { + UINT itemCount = static_cast(menu.GetMenuItemCount()); + for (UINT u = 0; u < itemCount; ++u) + { + MenuItemData* pData = reinterpret_cast( + menu.GetMenuItemData(u, TRUE)); + if (pData && pData->itemText.Find(_T('\t')) < 0) + pData->itemText += _T('\t'); // Append a tab + } + } + + // m_menuItemIDs can store the menu item data for multiple popup menus. + // There will be multiple popup menus if submenus are opened. + if (menuData.size() != 0) + m_menusData.push_back(std::move(menuData)); + } + + return 0; + } + + // Called by the keyboard hook procedure whenever a key is pressed. + template + inline void CFrameT::OnKeyboardHook(int code, WPARAM wparam, LPARAM lparam) + { + // Detect the state of the toggle keys. + if (HC_ACTION == code) + { + if ((wparam == VK_CAPITAL) || (wparam == VK_NUMLOCK) || + (wparam == VK_SCROLL) || (wparam == VK_INSERT)) + { + SetStatusIndicators(); + } + } + + // Detect the press state of the alt key. + if (wparam == VK_MENU) + { + bool keyState = (lparam & 0x80000000) != 0; + if (!m_altKeyPressed && !keyState) + { + m_altKeyPressed = TRUE; + if (GetMenuBar().IsWindow()) + GetMenuBar().RedrawWindow(); + } + + if (m_altKeyPressed && keyState) + { + m_altKeyPressed = FALSE; + if (GetMenuBar().IsWindow()) + GetMenuBar().RedrawWindow(); + } + } + } + + // Called before the Popup menu is displayed, so that the MEASUREITEMSTRUCT + // values can be assigned with the menu item's dimensions. + template + inline LRESULT CFrameT::OnMeasureItem(UINT msg, WPARAM wparam, LPARAM lparam) + { + LPMEASUREITEMSTRUCT pmis = reinterpret_cast(lparam); + if (pmis->CtlType != ODT_MENU) + return CWnd::WndProcDefault(msg, wparam, lparam); + + MeasureMenuItem(pmis); + return TRUE; + } + + // Called when a menu is active, and a key is pressed other than an accelerator. + template + inline LRESULT CFrameT::OnMenuChar(UINT msg, WPARAM wparam, LPARAM lparam) + { + if ((GetMenuBar().IsWindow()) && (LOWORD(wparam)!= VK_SPACE)) + { + // Activate MenuBar for key pressed with Alt key held down. + GetMenuBar().MenuChar(msg, wparam, lparam); + return -1; + } + + return CWnd::WndProcDefault(msg, wparam, lparam); + } + + // Called when a menu item is selected. + template + inline LRESULT CFrameT::OnMenuSelect(UINT, WPARAM wparam, LPARAM lparam) + { + // Set the StatusBar text when we hover over a menu. + // Only popup submenus have status strings. + if (IsUsingMenuStatus() && GetStatusBar().IsWindow()) + { + UINT id = LOWORD (wparam); + HMENU menu = reinterpret_cast(lparam); + + if ((menu != T::GetMenu()) && (id != 0) && !(HIWORD(wparam) & MF_POPUP)) + GetStatusBar().SetPartText(0, LoadString(id), SBT_OWNERDRAW); + else + GetStatusBar().SetPartText(0, m_statusText, SBT_OWNERDRAW); + } + + return 0; + } + + // Called when a menu item is about to be displayed. Override this function + // to enable or disable the menu item, or add a check mark. Also call this + // base function to update the 'Tool Bar' and 'Status Bar' menu status. + template + inline void CFrameT::OnMenuUpdate(UINT id) + { + // Update the check buttons before displaying the menu. + switch(id) + { + case IDW_VIEW_STATUSBAR: + { + bool isWindow = (GetStatusBar().IsWindow() != 0); // != 0 converts BOOL to bool. + bool isVisible = GetStatusBar().IsWindow() && GetStatusBar().IsWindowVisible(); + if (isWindow) + GetFrameMenu().EnableMenuItem(id, MF_ENABLED); + else + GetFrameMenu().EnableMenuItem(id, MF_DISABLED); + + if (isVisible) + GetFrameMenu().CheckMenuItem(id, MF_CHECKED); + else + GetFrameMenu().CheckMenuItem(id, MF_UNCHECKED); + } + break; + case IDW_VIEW_TOOLBAR: + { + bool isWindow = (GetToolBar().IsWindow() != 0); // != 0 converts BOOL to bool. + bool isVisible = GetToolBar().IsWindow() && GetToolBar().IsWindowVisible(); + if (isWindow) + GetFrameMenu().EnableMenuItem(id, MF_ENABLED); + else + GetFrameMenu().EnableMenuItem(id, MF_DISABLED); + + if (isVisible) + GetFrameMenu().CheckMenuItem(id, MF_CHECKED); + else + GetFrameMenu().CheckMenuItem(id, MF_UNCHECKED); + } + break; + } + } + + // Called when a notification from a child window (WM_NOTIFY) is received. + template + inline LRESULT CFrameT::OnNotify(WPARAM, LPARAM lparam) + { + LPNMHDR pHeader = reinterpret_cast(lparam); + switch (pHeader->code) + { + case static_cast(NM_CUSTOMDRAW): return OnCustomDraw(pHeader); + case RBN_HEIGHTCHANGE: return OnRBNHeightChange(pHeader); + case RBN_LAYOUTCHANGED: return OnRBNLayoutChanged(pHeader); + case RBN_MINMAX: return OnRBNMinMax(pHeader); + case TTN_GETDISPINFO: return OnTTNGetDispInfo(reinterpret_cast(lparam)); + case UWN_UNDOCKED: return OnUndocked(); + } + + return 0; + } + + // Called when the rebar's height changes. + template + inline LRESULT CFrameT::OnRBNHeightChange(LPNMHDR) + { + RecalcLayout(); + + return 0; + } + + // Notification of rebar layout change. + template + inline LRESULT CFrameT::OnRBNLayoutChanged(LPNMHDR) + { + if (GetReBarTheme().UseThemes && GetReBarTheme().BandsLeft) + GetReBar().MoveBandsLeft(); + + return 0; + } + + // Notification of a rebar band minimized or maximized. + template + inline LRESULT CFrameT::OnRBNMinMax(LPNMHDR) + { + if (GetReBarTheme().UseThemes && GetReBarTheme().ShortBands) + return 1; // Suppress maximise or minimise rebar band. + + return 0; + } + + // Tool tip notification from the toolbar. + template + inline LRESULT CFrameT::OnTTNGetDispInfo(LPNMTTDISPINFO pNMTDI) + { + // Find the ToolBar that generated the tooltip + CPoint pt(static_cast(GetMessagePos())); + HWND wnd = ::WindowFromPoint(pt); + CToolBar* pToolBar = reinterpret_cast(::SendMessage(wnd, UWM_GETCTOOLBAR, 0, 0)); + + // Set the tooltip's text from the ToolBar button's CommandID. + if (pToolBar && (pToolBar != &m_menuBar)) + { + assert(dynamic_cast(pToolBar)); + LPNMTTDISPINFO lpDispInfo = pNMTDI; + int index = pToolBar->HitTest(); + if (index >= 0) + { + UINT id = static_cast(pToolBar->GetCommandID(index)); + if (id != 0) + { + m_tooltip = LoadString(id); + lpDispInfo->lpszText = const_cast(m_tooltip.c_str()); + } + else + m_tooltip = _T(""); + } + } + + return 0; + } + + // Called when the SystemParametersInfo function changes a system-wide + // setting or when policy settings have changed. + template + inline LRESULT CFrameT::OnSettingChange(UINT msg, WPARAM wparam, LPARAM lparam) + { + OnSysColorChange(msg, wparam, lparam); + UpdateSettings(); + return 0; + } + + // Called when the frame window is resized. + template + inline LRESULT CFrameT::OnSize(UINT, WPARAM, LPARAM) + { + RecalcLayout(); + return 0; + } + + // Called in response to a WM_SYSCOLORCHANGE message. This message is sent + // to all top-level windows when a change is made to a system color setting. + template + inline LRESULT CFrameT::OnSysColorChange(UINT msg, WPARAM, LPARAM) + { + // Honour theme color changes + if (GetReBar().IsWindow()) + { + for (int band = 0; band < GetReBar().GetBandCount(); ++band) + { + GetReBar().SetBandColor(band, GetSysColor(COLOR_BTNTEXT), GetSysColor(COLOR_BTNFACE)); + } + } + + UpdateSettings(); + SetTheme(); + + // Reposition and redraw everything. + RecalcLayout(); + T::RedrawWindow(RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN); + + // Forward the message to the view window. + if (GetView().IsWindow()) + GetView().PostMessage(msg, 0, 0); + + return 0; + } + + // Called in response to a WM_SYSCOMMAND notification. This notification + // is passed on to the MenuBar to process alt keys and maximize or restore. + template + inline LRESULT CFrameT::OnSysCommand(UINT msg, WPARAM wparam, LPARAM lparam) + { + // The "wparam & 0xFFF0" below is a requirement mentioned in the + // description of WM_SYSCOMMAND in the Windows API documentation. + + if ((SC_KEYMENU == (wparam & 0xFFF0)) && (VK_SPACE != lparam) && GetMenuBar().IsWindow()) + { + GetMenuBar().SysCommand(msg, wparam, lparam); + return 0; + } + + if (SC_MINIMIZE == (wparam & 0xFFF0)) + m_oldFocus = ::GetFocus(); + + // Pass remaining system commands on for default processing. + return CWnd::WndProcDefault(msg, wparam, lparam); + } + + // Called in response to a WM_THEMECHANGED message. This message is sent + // to all top-level windows following a theme change event. + template + inline LRESULT CFrameT::OnThemeChanged(UINT, WPARAM, LPARAM) + { + // Reset the menu metrics on theme change. + ResetMenuMetrics(); + + // Update the menu icons. + SetupMenuIcons(); + + return 0; + } + + // Notification of undocked from CDocker received via OnNotify. + template + inline LRESULT CFrameT::OnUndocked() + { + m_oldFocus = nullptr; + return 0; + } + + // Called when the drop-down menu or submenu has been destroyed. + template + inline LRESULT CFrameT::OnUnInitMenuPopup(UINT, WPARAM wparam, LPARAM) + { + CMenu menu = reinterpret_cast(wparam); + bool doPopBack = false; + + for (int i = 0; i < menu.GetMenuItemCount(); i++) + { + UINT position = static_cast(i); + MENUITEMINFO mii = {}; + mii.cbSize = sizeof(mii); + mii.fMask = MIIM_STATE | MIIM_ID | MIIM_SUBMENU | MIIM_CHECKMARKS | MIIM_TYPE | MIIM_DATA; + menu.GetMenuItemInfo(position, mii, TRUE); + + MenuItemData* pItemData = reinterpret_cast(mii.dwItemData); + if (pItemData != nullptr) + { + mii.fType = pItemData->mii.fType; + mii.dwTypeData = const_cast(pItemData->itemText.c_str()); + mii.cch = static_cast(pItemData->itemText.GetLength()); + mii.dwItemData = 0; + VERIFY(menu.SetMenuItemInfo(position, mii, TRUE)); + doPopBack = true; + } + } + + // Release the memory allocated for all the menu items for this popup menu. + if (doPopBack) + m_menusData.pop_back(); + + return 0; + } + + // Called in response to menu input to display or hide the status bar. + template + inline BOOL CFrameT::OnViewStatusBar() + { + BOOL show = !(GetStatusBar().IsWindow() && GetStatusBar().IsWindowVisible()); + ShowStatusBar(show); + return TRUE; + } + + // Called in response to menu input to display or hide the tool bar. + template + inline BOOL CFrameT::OnViewToolBar() + { + BOOL show = !(GetToolBar().IsWindow() && GetToolBar().IsWindowVisible()); + ShowToolBar(show); + return TRUE; + } + + // Called when the window's size or position has changed. + template + LRESULT CFrameT::OnWindowPosChanged(UINT msg, WPARAM wparam, LPARAM lparam) + { + return T::FinalWindowProc(msg, wparam, lparam); + } + + // Sets frame window creation parameters prior to the frame window's creation. + template + inline void CFrameT::PreCreate(CREATESTRUCT& cs) + { + // Set the frame window styles + cs.style = WS_OVERLAPPEDWINDOW | WS_VISIBLE; + if (GetInitValues().showCmd == SW_MAXIMIZE) + cs.style |= WS_MAXIMIZE; + + // Set the original window position. + CRect initPos = GetInitValues().position; + if ((initPos.Width() > 0) && (initPos.Height()) > 0) + { + cs.x = initPos.left; + cs.y = initPos.top; + cs.cx = initPos.Width(); + cs.cy = initPos.Height(); + } + } + + // Set the frame's class parameters prior to the frame window's creation. + template + inline void CFrameT::PreRegisterClass(WNDCLASS& wc) + { + // Set the Window Class + wc.lpszClassName = _T("Win32++ Frame"); + } + + // Repositions the frame's child windows. + template + inline void CFrameT::RecalcLayout() + { + // Resize the status bar + if (GetStatusBar().IsWindow() && GetStatusBar().IsWindowVisible()) + { + VERIFY(GetStatusBar().SetWindowPos(HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW)); + + SetStatusParts(); + } + + // Resize the rebar or toolbar. + if (GetReBar().IsWindow()) + { + GetReBar().SendMessage(WM_SIZE, 0, 0); + GetReBar().Invalidate(); + } + else if (GetToolBar().IsWindow() && GetToolBar().IsWindowVisible()) + GetToolBar().Autosize(); + + // Position the view window. + if (GetView().IsWindow()) + RecalcViewLayout(); + + // Adjust rebar bands. + if (GetReBar().IsWindow()) + { + if (GetReBarTheme().UseThemes && GetReBarTheme().BandsLeft) + GetReBar().MoveBandsLeft(); + + if (GetMenuBar().IsWindow()) + SetMenuBarBandSize(); + } + } + + // Resize the view window. + template + inline void CFrameT::RecalcViewLayout() + { + VERIFY(GetView().SetWindowPos(HWND_TOP, GetViewRect(), SWP_SHOWWINDOW)); + } + + // Removes an entry from the MRU list. + template + inline void CFrameT::RemoveMRUEntry(LPCTSTR MRUEntry) + { + for (auto it = m_mruEntries.begin(); it != m_mruEntries.end(); ++it) + { + if ((*it) == MRUEntry) + { + m_mruEntries.erase(it); + break; + } + } + + UpdateMRUMenu(); + } + + // Saves the current MRU settings in the registry. + template + inline BOOL CFrameT::SaveRegistryMRUSettings() + { + // Store the MRU entries in the registry. + try + { + // Delete Old MRUs. + const CString appKeyName = _T("Software\\") + m_keyName; + CRegKey appKey; + if (ERROR_SUCCESS != appKey.Open(HKEY_CURRENT_USER, appKeyName)) + throw CUserException(); + + appKey.DeleteSubKey(_T("Recent Files")); + + if (m_maxMRU > 0) + { + const CString recentKeyName = _T("Software\\") + m_keyName + _T("\\Recent Files"); + CRegKey recentKey; + + // Add Current MRUs. + if (ERROR_SUCCESS != recentKey.Create(HKEY_CURRENT_USER, recentKeyName)) + throw CUserException(); + + if (ERROR_SUCCESS != recentKey.Open(HKEY_CURRENT_USER, recentKeyName)) + throw CUserException(); + + CString subKeyName; + CString pathName; + for (size_t i = 0; i < m_maxMRU; ++i) + { + subKeyName.Format(_T("File %d"), i + 1); + + if (i < m_mruEntries.size()) + { + pathName = m_mruEntries[i]; + + if (ERROR_SUCCESS != recentKey.SetStringValue(subKeyName, pathName)) + throw CUserException(); + } + } + } + } + + catch (const CUserException&) + { + TRACE("*** ERROR: Failed to save registry MRU settings. ***\n"); + + const CString appKeyName = _T("Software\\") + m_keyName; + CRegKey appKey; + + if (ERROR_SUCCESS == appKey.Open(HKEY_CURRENT_USER, appKeyName)) + { + // Roll back the registry changes by deleting this subkey. + appKey.DeleteSubKey(_T("Recent Files")); + } + + return FALSE; + } + + return TRUE; + } + + // Saves various frame window settings in the registry. + template + inline BOOL CFrameT::SaveRegistrySettings() + { + if (!m_keyName.IsEmpty()) + { + try + { + const CString settingsKeyName = _T("Software\\") + m_keyName + _T("\\Frame Settings"); + CRegKey settingsKey; + + if (ERROR_SUCCESS != settingsKey.Create(HKEY_CURRENT_USER, settingsKeyName)) + throw CUserException(); + if (ERROR_SUCCESS != settingsKey.Open(HKEY_CURRENT_USER, settingsKeyName)) + throw CUserException(); + + // Store the window position in the registry. + WINDOWPLACEMENT wndpl = {}; + wndpl.length = sizeof(wndpl); + + if (T::GetWindowPlacement(wndpl)) + { + // Get the Frame's window position + CRect rc = wndpl.rcNormalPosition; + DWORD top = static_cast(rc.top); + DWORD left = static_cast(rc.left); + DWORD width = static_cast(rc.Width()); + DWORD height = static_cast(rc.Height()); + DWORD showCmd = wndpl.showCmd; + + if (ERROR_SUCCESS != settingsKey.SetDWORDValue(_T("Top"), top)) + throw CUserException(); + if (ERROR_SUCCESS != settingsKey.SetDWORDValue(_T("Left"), left)) + throw CUserException(); + if (ERROR_SUCCESS != settingsKey.SetDWORDValue(_T("Width"), width)) + throw CUserException(); + if (ERROR_SUCCESS != settingsKey.SetDWORDValue(_T("Height"), height)) + throw CUserException(); + if (ERROR_SUCCESS != settingsKey.SetDWORDValue(_T("ShowCmd"), showCmd)) + throw CUserException(); + } + + // Store the ToolBar and statusbar states. + DWORD showToolBar = GetToolBar().IsWindow() && GetToolBar().IsWindowVisible(); + DWORD showStatusBar = GetStatusBar().IsWindow() && GetStatusBar().IsWindowVisible(); + + if (ERROR_SUCCESS != settingsKey.SetDWORDValue(_T("ToolBar"), showToolBar)) + throw CUserException(); + if (ERROR_SUCCESS != settingsKey.SetDWORDValue(_T("StatusBar"), showStatusBar)) + throw CUserException(); + } + + catch (const CUserException&) + { + TRACE("*** ERROR: Failed to save registry settings. ***\n"); + + const CString appKeyName = _T("Software\\") + m_keyName; + CRegKey appKey; + + if (ERROR_SUCCESS == appKey.Open(HKEY_CURRENT_USER, appKeyName)) + { + // Roll back the registry changes by deleting this subkey. + appKey.DeleteSubKey(_T("Frame Settings")); + } + + return FALSE; + } + + return SaveRegistryMRUSettings(); + } + + return TRUE; + } + + // Removes the keyboard hook installed by SetKbdHook. The hook is used to + // display the keyboard indicator status for the CAPs lock, NUM lock, + // Scroll lock and Insert keys. + template + inline void CFrameT::RemoveKbdHook() + { + if (m_kbdHook != nullptr) + ::UnhookWindowsHookEx(m_kbdHook); + + m_kbdHook = nullptr; + } + + // Sets the accelerator table for the application for this window. + template + inline void CFrameT::SetAccelerators(UINT accelID) + { + m_accel = LoadAccelerators(GetApp()->GetResourceHandle(), MAKEINTRESOURCE(accelID)); + if (m_accel) + GetApp()->SetAccelerators(m_accel, *this); + } + + // Sets the frame's menu from a Resource ID. + // A resource ID of 0 removes the menu from the frame. + template + inline void CFrameT::SetFrameMenu(UINT menuID) + { + CMenu menu; + if (menuID != 0) + { + // Sets the frame's menu from a resource ID. + menu.LoadMenu(menuID); + assert (::IsMenu(menu)); + } + + SetFrameMenu(menu); + } + + // Sets the frame's menu. + template + inline void CFrameT::SetFrameMenu(CMenu menu) + { + m_menu = menu; + + if (GetMenuBar().IsWindow()) + { + GetMenuBar().SetupMenuBar( GetFrameMenu() ); + BOOL show = (menu.GetHandle())? TRUE : FALSE; + ShowMenu(show); + } + else + { + T::SetMenu(m_menu); + T::DrawMenuBar(); + } + } + + // Sets the initial values from the InitValues struct. The InitValues struct + // is used to load and store the initial values, usually saved in the + // registry or an INI file. + template + inline void CFrameT::SetInitValues(const InitValues& values) + { + m_initValues = values; + } + + // Installs a keyboard hook if m_useIndicatorStatus is true. The + // hook is used to display the keyboard indicator status for the + // CAPs lock, NUM lock, Scroll lock and Insert keys. + template + inline void CFrameT::SetKbdHook() + { + if (m_useIndicatorStatus) + { + GetApp()->SetMainWnd(*this); + m_kbdHook = ::SetWindowsHookEx(WH_KEYBOARD, StaticKeyboardProc, 0, + ::GetCurrentThreadId()); + SetStatusIndicators(); + } + } + + // Sets the menu icons. Any previous menu icons are removed. + template + inline UINT CFrameT::SetMenuIcons(const std::vector& menuData, + COLORREF mask, UINT toolBarID, UINT) + { + // Remove any existing menu icons. + ClearMenuIcons(); + + // Exit if no ToolBarID is specified. + if (toolBarID == 0) return 0; + + // Add the menu icons from the bitmap IDs. + return AddMenuIcons(menuData, mask, toolBarID, 0); + } + + // Sets the minimum width of the MenuBar band to the width of the rebar. + // This prevents other bands from moving to this MenuBar's row. + template + inline void CFrameT::SetMenuBarBandSize() + { + CReBar& rb = GetReBar(); + int band = rb.GetBand(GetMenuBar()); + if (band >= 0) + { + REBARBANDINFO rbbi = {}; + rbbi.fMask = RBBIM_CHILDSIZE | RBBIM_SIZE; + rb.GetBandInfo(band, rbbi); + int width; + if ((GetReBarTheme().UseThemes) && (GetReBarTheme().LockMenuBand)) + { + CRect rcClient = T::GetClientRect(); + CRect rcBorder = rb.GetBandBorders(band); + width = rcClient.Width() - rcBorder.Width() - 2; + } + else + width = GetMenuBar().GetMaxSize().cx; + + rbbi.cxMinChild = static_cast(width); + rbbi.cx = static_cast(width); + + rb.SetBandInfo(band, rbbi); + } + } + + // Sets the font used by the menubar and popup menu items. + template + inline void CFrameT::SetMenuFont(HFONT font) + { + m_menuFont = font; + + if (GetMenuBar().IsWindow()) + { + GetMenuBar().SetFont(font); + SetFrameMenu(GetFrameMenu()); + UpdateMenuBarBandSize(); + } + } + + // Sets the theme colors for the MenuBar and the popup Menu items. + // Note: If Aero Themes are supported, they are used for popup menu items instead. + template + inline void CFrameT::SetMenuTheme(const MenuTheme& mt) + { + m_mbTheme = mt; + + if (GetMenuBar().IsWindow()) + GetMenuBar().Invalidate(); + } + + // Sets the maximum number of MRU entries. + template + inline void CFrameT::SetMRULimit(UINT mruLimit) + { + // Remove any excess MRU entries. + if (mruLimit < m_mruEntries.size()) + { + m_mruEntries.erase(m_mruEntries.begin() + static_cast(mruLimit), + m_mruEntries.end()); + } + + m_maxMRU = mruLimit; + UpdateMRUMenu(); + } + + // Stores the rebar's theme colors. + template + inline void CFrameT::SetReBarTheme(const ReBarTheme& rbt) + { + m_rbTheme = rbt; + } + + // Sets the font used by the status bar. + template + inline void CFrameT::SetStatusBarFont(HFONT font) + { + m_statusBarFont = font; + + if (GetStatusBar().IsWindow()) + GetStatusBar().SetFont(font); + } + + // Stores the statusbar's theme colors. + template + inline void CFrameT::SetStatusBarTheme(const StatusBarTheme& sbt) + { + m_sbTheme = sbt; + } + + // Displays the caps lock, mum lock, and scroll lock key states. + template + inline void CFrameT::SetStatusIndicators() + { + if (GetStatusBar().IsWindow() && (IsUsingIndicatorStatus())) + { + CString cap = LoadString(IDW_INDICATOR_CAPS); + CString num = LoadString(IDW_INDICATOR_NUM); + CString scrl = LoadString(IDW_INDICATOR_SCRL); + CString empty; + + CString old0 = m_indicators[0]; + CString old1 = m_indicators[1]; + CString old2 = m_indicators[2]; + + m_indicators[0] = (::GetKeyState(VK_CAPITAL) & 0x0001) ? cap : empty; + m_indicators[1] = (::GetKeyState(VK_NUMLOCK) & 0x0001) ? num : empty; + m_indicators[2] = (::GetKeyState(VK_SCROLL) & 0x0001) ? scrl : empty; + + // Update the indicators text. + // We need member variables for owner drawn text to keep the text in scope. + // Only set the indicator if it changed. + if (old0 != m_indicators[0]) + GetStatusBar().SetPartText(1, m_indicators[0], SBT_OWNERDRAW); + if (old1 != m_indicators[1]) + GetStatusBar().SetPartText(2, m_indicators[1], SBT_OWNERDRAW); + if (old2 != m_indicators[2]) + GetStatusBar().SetPartText(3, m_indicators[2], SBT_OWNERDRAW); + } + } + + // Creates and resizes the 4 parts in the status bar. + template + inline void CFrameT::SetStatusParts() + { + if (IsUsingIndicatorStatus() && GetStatusBar().IsWindow()) + { + // Calculate the width of the text indicators. + CClientDC statusDC(GetStatusBar()); + statusDC.SelectObject(GetStatusBar().GetFont()); + CString cap = LoadString(IDW_INDICATOR_CAPS); + CString num = LoadString(IDW_INDICATOR_NUM); + CString scrl = LoadString(IDW_INDICATOR_SCRL); + CSize capSize = statusDC.GetTextExtentPoint32(cap, cap.GetLength()); + CSize numSize = statusDC.GetTextExtentPoint32(num, num.GetLength()); + CSize scrlSize = statusDC.GetTextExtentPoint32(scrl, scrl.GetLength()); + + bool hasGripper = (GetStatusBar().GetStyle() & SBARS_SIZEGRIP) != 0; + int cxGripper = hasGripper ? 20 : 0; + int cxBorder = 8; + + // Adjust for DPI aware. + int dpi = GetWindowDpi(*this); + cxGripper = MulDiv(cxGripper, dpi, USER_DEFAULT_SCREEN_DPI); + capSize.cx += cxBorder; + numSize.cx += cxBorder; + scrlSize.cx += cxBorder; + + // Get the coordinates of the window's client area. + CRect clientRect = T::GetClientRect(); + int clientRight = clientRect.right; + int width = std::max(300, clientRight); + + // Create 4 panes. + GetStatusBar().SetPartWidth(0, width - (capSize.cx + numSize.cx + + scrlSize.cx + cxGripper)); + GetStatusBar().SetPartWidth(1, capSize.cx); + GetStatusBar().SetPartWidth(2, numSize.cx); + GetStatusBar().SetPartWidth(3, scrlSize.cx); + } + } + + // Stores the status text and displays it in the StatusBar. + template + inline void CFrameT::SetStatusText(LPCTSTR text) + { + m_statusText = text; + + if (GetStatusBar().IsWindow()) + { + // Place text in the 1st pane + GetStatusBar().SetPartText(0, m_statusText, SBT_OWNERDRAW); + } + } + + // Sets the theme colors for the frame's rebar, toolbar and menubar. + // Override this function to modify the theme colors. + template + inline void CFrameT::SetTheme() + { + // Avoid themes if using less than 16 bit colors. + CClientDC DesktopDC(*this); + if (DesktopDC.GetDeviceCaps(BITSPIXEL) < 16) + UseThemes(FALSE); + + BOOL t = TRUE; + BOOL f = FALSE; + + if (IsUsingThemes()) + { + // Predefined themes. + enum Themetype{ Win11, Win7, XP_Blue, XP_Silver, XP_Olive, gray }; + + // Default theme. + int theme = gray; + + if (GetWinVersion() < 2600) // For Windows XP. + { + // Retrieve the XP theme name. + CString xpThemeName = GetXPThemeName(); + + if (xpThemeName == _T("NormalColor")) + theme = XP_Blue; + if (xpThemeName == _T("Metallic")) + theme = XP_Silver; + if (xpThemeName == _T("HomeStead")) + theme = XP_Olive; + } + else if (GetWinVersion() <= 2601) + { + // For Vista and Windows 7. + theme = Win7; + } + else + { + // For Windows 8, 8.1, 10 and 11. + theme = Win11; + } + + switch (theme) + { + case Win11: // A pale blue scheme without gradients, suitable for Windows 8, 8.1, 10 and 11. + { + MenuTheme mt = {t, RGB(180, 250, 255), RGB(140, 190, 255), + RGB(240, 250, 255), RGB(120, 170, 220), RGB(127, 127, 255), + RGB(0, 0, 0) }; + ReBarTheme rbt = {t, RGB(235, 237, 250), RGB(235, 237, 250), + RGB(235, 237, 250), RGB(235, 237, 250), f, t, t, f, t, f }; + StatusBarTheme sbt = {t, RGB(235, 237, 250), RGB(235, 237, 250), + RGB(0, 0, 0) }; + ToolBarTheme tbt = {t, RGB(180, 250, 255), RGB(140, 190, 255), + RGB(150, 220, 255), RGB(80, 100, 255), RGB(127, 127, 255)}; + + SetMenuTheme(mt); // Sets the theme for popup menus and MenuBar. + SetReBarTheme(rbt); + SetStatusBarTheme(sbt); + SetToolBarTheme(tbt); + } + break; + + case Win7: // A pale blue color scheme suitable for Vista and Windows 7. + { + MenuTheme mt = {t, RGB(180, 250, 255), RGB(140, 190, 255), + RGB(240, 250, 255), RGB(120, 170, 220), + RGB(127, 127, 255), RGB(0, 0, 0) }; + ReBarTheme rbt = {t, RGB(225, 230, 255), RGB(240, 242, 250), + RGB(248, 248, 248), RGB(180, 200, 230), f, t, t, t, t, f}; + StatusBarTheme sbt = {t, RGB(225, 230, 255), RGB(240, 242, 250), + RGB(0, 0, 0) }; + ToolBarTheme tbt = {t, RGB(180, 250, 255), RGB(140, 190, 255), + RGB(150, 220, 255), RGB(80, 100, 255), RGB(127, 127, 255)}; + + SetMenuTheme(mt); // Sets the theme for popup menus and MenuBar. + SetReBarTheme(rbt); + SetStatusBarTheme(sbt); + SetToolBarTheme(tbt); + } + break; + + case XP_Blue: + { + // Used for XP default (blue) color scheme. + MenuTheme mt = {t, RGB(255, 230, 190), RGB(255, 190, 100), + RGB(220,230,250), RGB(150,190,245), RGB(128, 128, 200), + RGB(0, 0, 0) }; + ReBarTheme rbt = {t, RGB(150,190,245), RGB(196,215,250), + RGB(220,230,250), RGB( 70,130,220), f, t, t, t, t, f}; + StatusBarTheme sbt = {t, RGB(150,190,245), RGB(196,215,250), RGB(0, 0, 0) }; + ToolBarTheme tbt = {t, RGB(255, 230, 190), RGB(255, 190, 100), + RGB(255, 140, 40), RGB(255, 180, 80), RGB(192, 128, 255)}; + + SetMenuTheme(mt); // Sets the theme for popup menus and MenuBar. + SetReBarTheme(rbt); + SetStatusBarTheme(sbt); + SetToolBarTheme(tbt); + } + break; + + case XP_Silver: + { + // Used for XP Silver color scheme. + MenuTheme mt = {t, RGB(196, 215, 250), RGB( 120, 180, 220), + RGB(240, 240, 245), RGB(170, 165, 185), + RGB(128, 128, 150), RGB(0, 0, 0) }; + ReBarTheme rbt = {t, RGB(225, 220, 240), RGB(240, 240, 245), + RGB(245, 240, 255), RGB(160, 155, 180), f, t, t, t, t, f}; + StatusBarTheme sbt = {t, RGB(225, 220, 240), RGB(240, 240, 245), + RGB(0, 0, 0) }; + ToolBarTheme tbt = {t, RGB(192, 210, 238), RGB(192, 210, 238), + RGB(152, 181, 226), RGB(152, 181, 226), RGB(49, 106, 197)}; + + SetMenuTheme(mt); // Sets the theme for popup menus and MenuBar. + SetReBarTheme(rbt); + SetStatusBarTheme(sbt); + SetToolBarTheme(tbt); + } + break; + + case XP_Olive: + { + // Used for XP Olive color scheme. + MenuTheme mt = {t, RGB(255, 230, 190), RGB(255, 190, 100), + RGB(249, 255, 227), RGB(178, 191, 145), + RGB(128, 128, 128), RGB(0, 0, 0) }; + ReBarTheme rbt = {t, RGB(215, 216, 182), RGB(242, 242, 230), + RGB(249, 255, 227), RGB(178, 191, 145), f, t, t, t, t, f}; + StatusBarTheme sbt = {t, RGB(215, 216, 182), RGB(242, 242, 230), + RGB(0, 0, 0) }; + ToolBarTheme tbt = {t, RGB(255, 230, 190), RGB(255, 190, 100), + RGB(255, 140, 40), RGB(255, 180, 80), RGB(200, 128, 128)}; + + SetMenuTheme(mt); // Sets the theme for popup menus and MenuBar. + SetReBarTheme(rbt); + SetStatusBarTheme(sbt); + SetToolBarTheme(tbt); + } + break; + + case gray: // A color scheme suitable for 16 bit colors. Suitable for Windows older than XP. + { + MenuTheme mt = {t, RGB(182, 189, 210), RGB( 182, 189, 210), + RGB(200, 196, 190), RGB(200, 196, 190), RGB(100, 100, 100), + RGB(0, 0, 0) }; + ReBarTheme rbt = {t, RGB(212, 208, 200), RGB(212, 208, 200), + RGB(230, 226, 222), RGB(220, 218, 208), f, t, t, t, t, f}; + StatusBarTheme sbt = {t, RGB(212, 208, 200), RGB(212, 208, 200), + RGB(0, 0, 0) }; + ToolBarTheme tbt = {t, RGB(182, 189, 210), RGB(182, 189, 210), + RGB(133, 146, 181), RGB(133, 146, 181), RGB(10, 36, 106)}; + + SetMenuTheme(mt); // Sets the theme for popup menus and MenuBar. + SetReBarTheme(rbt); + SetStatusBarTheme(sbt); + SetToolBarTheme(tbt); + } + break; + } + } + else + { + // Set a default menu theme. This allows the menu to display icons. + MenuTheme mt = {FALSE, RGB(182, 189, 210), RGB( 182, 189, 210), + RGB(200, 196, 190), RGB(200, 196, 190), RGB(100, 100, 100), + RGB(0, 0, 0)}; + SetMenuTheme(mt); // Sets the theme for popup menus and MenuBar. + } + + RecalcLayout(); + } + + // Sets the Image List for additional toolbars. + template + inline void CFrameT::SetTBImageList(CToolBar& toolBar, UINT id, COLORREF mask) + { + // Get the image size. + CBitmap bm(id); + + // Assert if we failed to load the bitmap. + assert(bm.GetHandle() != nullptr); + + // Scale the bitmap to the window's DPI. + CBitmap dpiImage = T::DpiScaleUpBitmap(bm); + CSize sz = GetTBImageSize(&dpiImage); + + // Set the toolbar's image list. + CImageList imageList; + imageList.Create(sz.cx, sz.cy, ILC_COLOR32 | ILC_MASK, 0, 0); + imageList.Add(dpiImage, mask); + toolBar.SetImageList(imageList); + + // Inform the rebar of the change to the Toolbar. + if (GetReBar().IsWindow()) + { + SIZE maxSize = toolBar.GetMaxSize(); + WPARAM wparam = reinterpret_cast(toolBar.GetHwnd()); + LPARAM lparam = reinterpret_cast(&maxSize); + GetReBar().SendMessage(UWM_TBRESIZE, wparam, lparam); + } + } + + // Sets the Disabled Image List for additional toolbars. + template + inline void CFrameT::SetTBImageListDis(CToolBar& toolBar, UINT id, COLORREF mask) + { + // Get the image size. + CBitmap bm(id); + + // Assert if we failed to load the bitmap. + assert(bm.GetHandle() != nullptr); + + // Scale the bitmap to the window's DPI. + CBitmap dpiImage = T::DpiScaleUpBitmap(bm); + CSize sz = GetTBImageSize(&dpiImage); + + // Set the toolbar's disabled image list. + CImageList imageList; + imageList.Create(sz.cx, sz.cy, ILC_COLOR32 | ILC_MASK, 0, 0); + imageList.Add(dpiImage, mask); + toolBar.SetDisableImageList(imageList); + + // Inform the rebar of the change to the Toolbar. + if (GetReBar().IsWindow()) + { + SIZE maxSize = toolBar.GetMaxSize(); + WPARAM wparam = reinterpret_cast(toolBar.GetHwnd()); + LPARAM lparam = reinterpret_cast(&maxSize); + GetReBar().SendMessage(UWM_TBRESIZE, wparam, lparam); + } + } + + // Sets the Hot Image List for additional toolbars. + template + inline void CFrameT::SetTBImageListHot(CToolBar& toolBar, UINT id, COLORREF mask) + { + // Get the image size. + CBitmap bm(id); + + // Assert if we failed to load the bitmap. + assert(bm.GetHandle() != nullptr); + + // Scale the bitmap to the window's DPI. + CBitmap dpiImage = T::DpiScaleUpBitmap(bm); + CSize sz = GetTBImageSize(&dpiImage); + + // Set the toolbar's hot image list. + CImageList imageList; + imageList.Create(sz.cx, sz.cy, ILC_COLOR32 | ILC_MASK, 0, 0); + imageList.Add(dpiImage, mask); + toolBar.SetHotImageList(imageList); + + // Inform the rebar of the change to the Toolbar. + if (GetReBar().IsWindow()) + { + SIZE MaxSize = toolBar.GetMaxSize(); + WPARAM wparam = reinterpret_cast(toolBar.GetHwnd()); + LPARAM lparam = reinterpret_cast(&MaxSize); + GetReBar().SendMessage(UWM_TBRESIZE, wparam, lparam); + } + } + + // Sets sets the toolbar's image lists. The ToolBarIDs are bitmap resources + // containing a set of toolbar button images. Each toolbar button image + // must have a minimum height of 16. Its height must equal its width. + // The color mask is ignored for 32bit bitmaps, but is required for 24bit bitmaps + // The color mask is often gray RGB(192,192,192) or magenta (255,0,255) + // The Hot and disabled bitmap resources can be 0. + // A Disabled image list is created from toolBarID if one isn't provided. + template + inline void CFrameT::SetToolBarImages(CToolBar& toolbar, COLORREF mask, + UINT toolBarID, UINT toolBarHotID, UINT toolBarDisabledID) + { + // Set the normal image list. + SetTBImageList(toolbar, toolBarID, mask); + + // Set the hot image list. + if (toolBarHotID != 0) + { + SetTBImageListHot(toolbar, toolBarHotID, mask); + } + + if (toolBarDisabledID != 0) + { + SetTBImageListDis(toolbar, toolBarDisabledID, mask); + } + else + { + CImageList toolBarDisabledImages; + toolBarDisabledImages.CreateDisabledImageList(toolbar.GetImageList()); + toolbar.SetDisableImageList(toolBarDisabledImages); + } + } + + // Sets the toolbar's image lists. The ToolBarIDs are bitmap resources + // containing a set of toolbar button images. Each toolbar button image + // must have a minimum height of 16. Its height must equal its width. + // The color mask is ignored for 32bit bitmaps, but is required for 24bit bitmaps + // The color mask is often gray RGB(192,192,192) or magenta (255,0,255) + // The Hot and disabled bitmap resources can be 0. + // A Disabled image list is created from toolBarID if one isn't provided. + template + inline void CFrameT::SetToolBarImages(COLORREF mask, UINT toolBarID, + UINT toolBarHotID, UINT toolBarDisabledID) + { + SetToolBarImages(GetToolBar(), mask, toolBarID, toolBarHotID, toolBarDisabledID); + } + + // Assigns icons to the dropdown menu items. By default the toolbar icons + // are added to the menu items. Override this function to assign additional + // or different icons to the drop down menu items. + template + inline void CFrameT::SetupMenuIcons() + { + // Add the set of toolbar images to the menu. + if (GetToolBarData().size() > 0) + { + // Add the icons for popup menu. + AddMenuIcons(GetToolBarData(), RGB(192, 192, 192), IDW_MAIN, 0); + } + } + + // Override this function to set the Resource IDs for the toolbar(s). + template + inline void CFrameT::SetupToolBar() + { +/* // Set the Resource IDs for the toolbar buttons + AddToolBarButton( IDM_FILE_NEW ); + AddToolBarButton( IDM_FILE_OPEN ); + AddToolBarButton( IDM_FILE_SAVE ); + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_EDIT_CUT, FALSE ); // disabled button + AddToolBarButton( IDM_EDIT_COPY, FALSE ); // disabled button + AddToolBarButton( IDM_EDIT_PASTE, FALSE ); // disabled button + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_FILE_PRINT ); + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_HELP_ABOUT ); +*/ + } + + // Stores the tool bar's theme colors. + template + inline void CFrameT::SetToolBarTheme(const ToolBarTheme& tbt) + { + m_tbTheme = tbt; + if (GetToolBar().IsWindow()) + GetToolBar().GetParent().RedrawWindow(RDW_INVALIDATE|RDW_ALLCHILDREN); + } + + // Sets or changes the frame's view window. + template <> + inline void CFrameT::SetView(CWnd& wndView) + { + CDocker::SetView(wndView); + } + + // Sets or changes the frame's view window. + template + inline void CFrameT::SetView(CWnd& wndView) + { + if (m_pView != &wndView) + { + // Hide the old view if any. + if (m_pView && m_pView->IsWindow()) + m_pView->ShowWindow(SW_HIDE); + + // Assign the new view. + m_pView = &wndView; + + if (T::IsWindow()) + { + if (!m_pView->IsWindow()) + m_pView->Create(*this); + else + GetView().SetParent(*this); + + CRect rc = GetViewRect(); + VERIFY(GetView().SetWindowPos(HWND_TOP, rc, SWP_SHOWWINDOW)); + } + } + } + + // Hides or shows the menu. + template + inline void CFrameT::ShowMenu(BOOL show) + { + if (show) + { + if (GetReBar().IsWindow()) + GetReBar().ShowBand(GetReBar().GetBand(GetMenuBar()), TRUE); + else + T::SetMenu(m_menu); + } + else + { + if (GetReBar().IsWindow()) + GetReBar().ShowBand(GetReBar().GetBand(GetMenuBar()), FALSE); + else + T::SetMenu(nullptr); + } + + if (GetReBar().IsWindow()) + { + if (GetReBarTheme().UseThemes && GetReBarTheme().BandsLeft) + GetReBar().MoveBandsLeft(); + } + + // Reposition the Windows. + RecalcLayout(); + } + + // Hides or shows the status bar. + template + inline void CFrameT::ShowStatusBar(BOOL show) + { + if (GetStatusBar().IsWindow()) + { + if (show) + { + GetStatusBar().ShowWindow(SW_SHOW); + } + else + { + GetStatusBar().ShowWindow(SW_HIDE); + } + } + + // Reposition the windows. + RecalcLayout(); + } + + // Hides or shows the tool bar. + template + inline void CFrameT::ShowToolBar(BOOL show) + { + if (GetToolBar().IsWindow()) + { + if (show) + { + if (GetReBar().IsWindow()) + GetReBar().ShowBand(GetReBar().GetBand(GetToolBar()), TRUE); + else + GetToolBar().ShowWindow(SW_SHOW); + } + else + { + if (GetReBar().IsWindow()) + GetReBar().ShowBand(GetReBar().GetBand(GetToolBar()), FALSE); + else + GetToolBar().ShowWindow(SW_HIDE); + } + } + + if (GetReBar().IsWindow()) + { + if (GetReBarTheme().UseThemes && GetReBarTheme().BandsLeft) + GetReBar().MoveBandsLeft(); + } + + // Reposition the windows. + RecalcLayout(); + } + + // Called by the keyboard hook to update status information. + template + inline LRESULT CALLBACK CFrameT::StaticKeyboardProc(int code, + WPARAM wparam, LPARAM lparam) + { + HWND frame = GetApp()->GetMainWnd(); + CFrameT* pFrame = static_cast< CFrameT* >(CWnd::GetCWndPtr(frame)); + assert(dynamic_cast*>(pFrame) != nullptr); + + if (pFrame != nullptr) + pFrame->OnKeyboardHook(code, wparam, lparam); + + return ::CallNextHookEx(0, code, wparam, lparam); + } + + // Update the MenuBar band size. + template + inline void CFrameT::UpdateMenuBarBandSize() + { + int band = GetReBar().GetBand(GetMenuBar()); + if (band >= 0) + { + CSize sizeMenuBar = GetMenuBar().GetMaxSize(); + GetReBar().ResizeBand(band, sizeMenuBar); + } + } + + // Updates the menu item information for the Most Recently Used (MRU) list. + template + inline void CFrameT::UpdateMRUMenu() + { + if (!T::IsWindow() ) return; + + // Create a vector of CStrings containing the MRU menu entries. + std::vector mruStrings; + + if (m_mruEntries.size() > 0) + { + for (UINT n = 0; n < m_mruEntries.size(); ++n) + { + CString str = m_mruEntries[n]; + + // Prefix the string with its number. + CString count; + count.Format(_T("%d "), n + 1); + str = count + str; + + // Trim the string if its too long. + if (str.GetLength() > WXX_MAX_STRING_SIZE - 10) + { + // Extract the first part of the string up until the first '\\'. + CString prefix; + int index = str.Find(_T('\\')); + if (index >= 0) + prefix = str.Left(index + 1); + + // Reduce the string to fit within WXX_MAX_STRING_SIZE. + CString gap = _T("..."); + str.Delete(0, str.GetLength() - WXX_MAX_STRING_SIZE + + prefix.GetLength() + gap.GetLength()+1); + + // Remove the front of the string up to the next '\\' if any. + index = str.Find(_T('\\')); + if (index >= 0) + str.Delete(0, index); + + str = prefix + gap + str; + } + + mruStrings.push_back(str); + } + } + else + { + mruStrings.push_back(_T("Recent Files")); + } + + // Set MRU menu items. + MENUITEMINFO mii = {}; + mii.cbSize = sizeof(mii); + + // We place the MRU items under the left most menu item. + CMenu fileMenu = GetFrameMenu().GetSubMenu(0); + + if (fileMenu.GetHandle()) + { + // Remove all but the first MRU Menu entry. + for (UINT u = IDW_FILE_MRU_FILE2; u <= IDW_FILE_MRU_FILE1 + + mruStrings.size(); ++u) + { + fileMenu.DeleteMenu(u, MF_BYCOMMAND); + } + + int maxMRUIndex = static_cast(mruStrings.size() -1); + for (int item = maxMRUIndex; item >= 0; --item) + { + size_t index = static_cast(item); + UINT pos = static_cast(item); + mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE; + mii.fState = (m_mruEntries.size() == 0)? MFS_GRAYED : 0U; + mii.fType = MFT_STRING; + mii.wID = IDW_FILE_MRU_FILE1 + pos; + mii.dwTypeData = const_cast(mruStrings[index].c_str()); + + if (item == maxMRUIndex) + // Replace the last MRU entry first. + VERIFY(fileMenu.SetMenuItemInfo(IDW_FILE_MRU_FILE1, mii, FALSE)); + else + // Insert the other MRU entries next. + VERIFY(fileMenu.InsertMenuItem(IDW_FILE_MRU_FILE1 + pos + 1, mii, FALSE)); + } + } + + T::DrawMenuBar(); + } + + // Updates the settings for the rebar, menubar and status bar to + // account for changes in the frame window's DPI. + template + inline void CFrameT::UpdateSettings() + { + // Create the menubar and statusbar fonts. + int dpi = GetWindowDpi(*this); + NONCLIENTMETRICS metrics = GetNonClientMetrics(); + int fontHeight = -MulDiv(9, dpi, POINTS_PER_INCH); + metrics.lfMenuFont.lfHeight = fontHeight; + metrics.lfStatusFont.lfHeight = fontHeight; + SetMenuFont(CFont(metrics.lfMenuFont)); + SetStatusBarFont(CFont(metrics.lfStatusFont)); + } + + // Provides default processing of the frame window's messages. + // The frame's WndProc function should pass unhandled window messages to + // this function. + template + inline LRESULT CFrameT::WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) + { + switch (msg) + { + case WM_ACTIVATE: return OnActivate(msg, wparam, lparam); + case WM_DPICHANGED: return OnDpiChanged(msg, wparam, lparam); + case WM_THEMECHANGED: return OnThemeChanged(msg, wparam, lparam); + case WM_DRAWITEM: return OnDrawItem(msg, wparam, lparam); + case WM_ERASEBKGND: return 0; + case WM_HELP: return OnHelp(); + case WM_INITMENUPOPUP: return OnInitMenuPopup(msg, wparam, lparam); + case WM_MENUCHAR: return OnMenuChar(msg, wparam, lparam); + case WM_MEASUREITEM: return OnMeasureItem(msg, wparam, lparam); + case WM_MENUSELECT: return OnMenuSelect(msg, wparam, lparam); + case WM_SETTINGCHANGE: return OnSettingChange(msg, wparam, lparam); + case WM_SIZE: return OnSize(msg, wparam, lparam); + case WM_SYSCOLORCHANGE: return OnSysColorChange(msg, wparam, lparam); + case WM_SYSCOMMAND: return OnSysCommand(msg, wparam, lparam); + case WM_UNINITMENUPOPUP: return OnUnInitMenuPopup(msg, wparam, lparam); + + // Messages defined by Win32++. + case UWM_GETFRAMEVIEW: return reinterpret_cast(GetView().GetHwnd()); + case UWM_GETMBTHEME: return reinterpret_cast(&GetMenuBarTheme()); + case UWM_GETRBTHEME: return reinterpret_cast(&GetReBarTheme()); + case UWM_GETSBTHEME: return reinterpret_cast(&GetStatusBarTheme()); + case UWM_GETTBTHEME: return reinterpret_cast(&GetToolBarTheme()); + case UWM_DRAWRBBKGND: return OnDrawRBBkgnd(msg, wparam, lparam); + case UWM_DRAWSBBKGND: return OnDrawSBBkgnd(msg, wparam, lparam); + case UWM_GETCFRAMET: return reinterpret_cast(this); + + } // switch msg + + return CWnd::WndProcDefault(msg, wparam, lparam); + } + + +} // namespace Win32xx + +#endif // _WIN32XX_FRAME_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_gdi.h b/packages/media/cpp/packages/Win32xx/include/wxx_gdi.h new file mode 100644 index 00000000..e9c0329f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_gdi.h @@ -0,0 +1,5321 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////// +// wxx_gdi.h +// Declaration of the following classes: +// CBitmapInfoPtr; CGDIObject; CBitmap; CBrush; CFont; CPalette; CPen; +// CRgn; CDC; CClintDC; CClientDCEx; CEnhMetaFileDC; CMemDC; CPrintDC; +// CMetaFileDC; CWindowDC. + +// The CDC class provides a device context, along with the various associated +// objects such as Bitmaps, Brushes, Bitmaps, Fonts and Pens. This class +// handles the creation, selection, deselection and deletion of these objects +// automatically. It also automatically deletes or releases the device context +// itself as appropriate. Any failure to create the new GDI object throws an +// exception. +// +// The CDC class is sufficient for most GDI programming needs. Sometimes +// however we need to have the GDI object separated from the device context. +// Wrapper classes for GDI objects are provided for this purpose. The classes +// are CBitmap, CBrush, CFont, CPalette, CPen and CRgn. These classes +// automatically delete any GDI resources they create when their destructor +// is called. These wrapper class objects can be attached to the CDC as +// shown below. +// +// Coding Example without CDC ... +// void DrawLine() +// { +// // Create the device contexts, bitmap, pen and draw a line. +// HDC clientDC = ::GetDC(GetHwnd()); +// HDC memDC = ::CreateCompatibleDC(clientDC); +// HBITMAP bitmap = ::CreateCompatibleBitmap(clientDC, cx, cy); +// HBITMAP oldBitmap = static_cast(::SelectObject(memDC, bitmap)); +// HPEN pen1 = ::CreatePen(PS_SOLID, 1, RGB(255,0,0); +// HPEN oldPen = static_cast(::SelectObject(memDC, pen1)); +// ::MoveToEx(memDC, 0, 0, nullptr); +// ::LineTo(memDC, 50, 50); +// +// // Select a new pen into memDC and draw a line. +// HPEN pen2 = ::CreatePen(PS_SOLID, 1, RGB(0,255,0); +// oldPen = static_cast(::SelectObject(memDC, pen2)); +// ::LineTo(memDC, 80, 80); +// +// // Copy the bitmap to the client device context. +// ::BitBlt(clientDC, 0, 0, cx, cy, memDC, 0, 0); +// +// // Cleanup. +// ::DeleteObject(pen1); +// ::SelectObject(memDC, oldPen); +// ::DeleteObject(pen2); +// ::SelectObject(memDC, oldBitmap); +// ::DeleteObject(bitmap); +// ::DeleteDC(memDC); +// ::ReleaseDC(GetHwnd(), clientDC); +// } +// +// Coding Example with CDC classes ... +// void DrawLine() +// { +// // Create the device contexts, bitmap, pen and draw a line. +// CClientDC clientDC(*this) +// CMemDC memDC(clientDC); +// memDC.CreateCompatibleBitmap(clientDC, cx, cy); +// memDC.CreatePen(PS_SOLID, 1, RGB(255,0,0); +// memDC.MoveTo(0, 0); +// memDC.LineTo(50, 50); +// +// // Select a new pen into memDC and draw a line. +// memDC.CreatePen(PS_SOLID, 1, RGB(0,255,0)); +// memDC.LineTo(80,80); +// +// // Copy the bitmap to the client device context. +// clientDC.BitBlt(0, 0, cx, cy, memDC, 0, 0); +// } +// +// Coding Example with CDC classes and CPen ... +// void DrawLine() +// { +// // Create the device contexts, bitmap, pen and draw a line. +// CClientDC clientDC(*this) +// CMemDC memDC(clientDC); +// memDC.CreateCompatibleBitmap(clientDC, cx, cy); +// CPen pen1(PS_SOLID, 1, RGB(255,0,0)); +// memDC.SelectObject(pen1); +// memDC.MoveTo(0, 0); +// memDC.LineTo(50, 50); +// +// // Select a new pen into memDC and draw a line. +// CPen pen2(PS_SOLID, 1, RGB(0,255,0)); +// memDC.SelectObject(pen2); +// memDC.LineTo(80,80); +// +// // Copy the bitmap to the client device context. +// clientDC.BitBlt(0, 0, cx, cy, memDC, 0, 0); +// } + +// Notes: +// * When the CDC object goes out of scope, its destructor is called, releasing +// or deleting the device context if Win32++ created it. +// * When the CBitmap, CBrush, CFont, CPalette, CPen and CRgn objects go out +// of scope, the destructor is called deleting their GDI object if Win32++ +// created it. +// * When the CDC object's destructor is called, any GDI objects created by one of +// the CDC member functions (CDC::CreatePen for example) will be deleted. +// * Bitmaps can only be selected into one device context at a time. +// * Other GDI resources can be selected into more than one device context at a time. +// * Palettes use SelectPalatte to select them into device the context. +// * Clipping regions use SelectClipRgn to select them into the device context. +// * Other regions use SelectObject to select them into the device context. +// * All the GDI classes are reference counted. This allows functions to safely +// pass these objects by value, as well as by pointer or by reference. +// * If SelectObject is used to select say a CPen into a device context, the +// CPen shouldn't be changed or destroyed while it is selected into device +// context is valid. Create a new pen for the device context or select a +// different one. +// * There is no need to select the old object back into the device context +// when SelectObject is used. +// * Reference counting allows all GDI classes to be copied safely. This means +// they can be safely returned by value from functions. The associated GDI +// resource is only deleted (if appropriate) when the last copy of the +// object goes out of scope. +// * A copy of a GDI class is a clone of the original. Both class objects +// manipulate the one GDI resource. + + +// The CBitmapInfoPtr class is a convenient wrapper for the BITMAPINFO structure. +// The size of the BITMAPINFO structure is dependent on the type of HBITMAP, and its +// space needs to be allocated dynamically. CBitmapInfoPtr automatically allocates +// and deallocates the memory for the structure. A CBitmapInfoPtr object can be +// used anywhere in place of a LPBITMAPINFO. LPBITMAPINFO is used in functions like +// GetDIBits and SetDIBits. +// +// Coding example ... +// CDC memDC = CreateCompatibleDC(0); +// CBitmapInfoPtr pbmi(bitmap); +// memDC.GetDIBits(bitmap, 0, pbmi->bmiHeader.biHeight, nullptr, pbmi, DIB_RGB_COLORS); + + +#ifndef _WIN32XX_GDI_H_ +#define _WIN32XX_GDI_H_ + + +#include "wxx_appcore0.h" +#include "wxx_wincore0.h" +#include "wxx_metafile.h" + +// Disable a macro from Windowsx.h +#undef CopyRgn + +namespace Win32xx +{ + + ///////////////////////////////////////////////////////////////// + // CGDIObject provides the functionality of a HGDIOBJECT + // This is the base class for other classes managing GDI objects, + // such as bitmaps, brushes, palettes, fonts, pens and regions. + class CGDIObject + { + public: + CGDIObject(); + CGDIObject(const CGDIObject& rhs); + virtual ~CGDIObject(); + CGDIObject& operator=(const CGDIObject& rhs); + CGDIObject& operator=(HGDIOBJ object); + + void Attach(HGDIOBJ object); + void Destroy(); + HGDIOBJ Detach(); + HGDIOBJ GetHandle() const; + int GetObject(int count, LPVOID pObject) const; + + protected: + void Assign(HGDIOBJ object); + void Release(); + + private: + std::shared_ptr m_pData; + }; + + + /////////////////////////////////////// + // CBitmap manages a bitmap GDI object. + class CBitmap final : public CGDIObject + { + public: + CBitmap(); + CBitmap(HBITMAP bitmap); + CBitmap(LPCTSTR resourceName); + CBitmap(UINT resourceID); + CBitmap(const CBitmap& rhs); + CBitmap& operator=(const CBitmap& rhs); + operator HBITMAP() const; + virtual ~CBitmap() override; + + void ConvertToDisabled(COLORREF mask) const; + void CopyImage(HBITMAP origBitmap, int cxDesired = 0, int cyDesired = 0, UINT flags = 0); + void CreateBitmap(int width, int height, UINT planes, UINT bitsPerPixel, LPCVOID pBits); + void CreateCompatibleBitmap(HDC dc, int width, int height); + void CreateDIBSection(HDC dc, const LPBITMAPINFO pBMI, UINT colorUse, LPVOID* ppBits, + HANDLE section, DWORD offset); + void CreateDIBitmap(HDC dc, const BITMAPINFOHEADER* pBMIH, DWORD init, LPCVOID pInit, + const LPBITMAPINFO pBMI, UINT colorUse); + void CreateMappedBitmap(UINT bitmapID, UINT flags = 0, LPCOLORMAP pColorMap = nullptr, + int mapSize = 0); + void CreateBitmapIndirect(const BITMAP& bitmap); + CSize GetBitmapDimensionEx() const; + int GetDIBits(HDC dc, UINT startScan, UINT scanLines, LPVOID pBits, LPBITMAPINFO pBMI, + UINT colorUse) const; + void GrayScaleBitmap() const; + BOOL LoadBitmap(LPCTSTR resourceName); + BOOL LoadBitmap(UINT id); + BOOL LoadImage(LPCTSTR resourceName, UINT flags = 0); + BOOL LoadImage(UINT id, UINT flags = 0); + BOOL LoadImage(LPCTSTR resourceName, int cxDesired, int cyDesired, UINT flags); + BOOL LoadImage(UINT id, int cxDesired, int cyDesired, UINT flags); + BOOL LoadOEMBitmap(UINT bitmapID); + int SetDIBits(HDC dc, UINT startScan, UINT scanLines, LPCVOID pBits, + const LPBITMAPINFO pBMI, UINT colorUse) const; + CSize SetBitmapDimensionEx(int width, int height) const; + void TintBitmap (int red, int green, int blue) const; + + // Accessors + BITMAP GetBitmapData() const; + CSize GetSize() const; + }; + + + ///////////////////////////////////// + // CBrush manages a brush GDI object. + class CBrush final : public CGDIObject + { + public: + CBrush(); + CBrush(HBRUSH brush); + CBrush(COLORREF color); + CBrush(const CBrush& rhs); + CBrush& operator=(const CBrush& rhs); + operator HBRUSH() const; + virtual ~CBrush() override; + + void CreateBrushIndirect(LOGBRUSH logBrush); + void CreateDIBPatternBrush(HGLOBAL hDIBPacked, UINT colorSpec); + void CreateDIBPatternBrushPt(LPCVOID pPackedDIB, UINT usage); + void CreateHatchBrush(int index, COLORREF color); + void CreatePatternBrush(HBITMAP bitmap); + void CreateSolidBrush(COLORREF color); + LOGBRUSH GetLogBrush() const; + }; + + + /////////////////////////////////// + // CFont manages a font GDI object. + class CFont final : public CGDIObject + { + public: + CFont(); + CFont(HFONT font); + CFont(const LOGFONT& logFont); + CFont(const CFont& rhs); + CFont& operator=(const CFont& rhs); + operator HFONT() const; + virtual ~CFont() override; + + // Create methods + void CreateFontIndirect(const LOGFONT& logFont); + void CreatePointFont(int pointSize, LPCTSTR faceName, HDC dc = nullptr, + BOOL isBold = FALSE, BOOL isItalic = FALSE); + void CreatePointFontIndirect(const LOGFONT& logFont, HDC dc = nullptr); + void CreateFont(int height, int width, int escapement, + int orientation, int weight, DWORD italic, DWORD underline, + DWORD strikeOut, DWORD charSet, DWORD outPrecision, + DWORD clipPrecision, DWORD quality, DWORD pitchAndFamily, + LPCTSTR faceName); + + // Accessors + LOGFONT GetLogFont() const; + }; + + + ///////////////////////////////////////// + // CPalette manages a palette GDI object. + class CPalette final : public CGDIObject + { + public: + CPalette(); + CPalette(HPALETTE palette); + CPalette(const CPalette& rhs); + CPalette& operator=(const CPalette& rhs); + operator HPALETTE() const; + virtual ~CPalette() override; + + // Create methods + void CreateHalftonePalette(HDC dc); + void CreatePalette(LPLOGPALETTE pLogPalette); + + // Attributes + int GetEntryCount() const; + UINT GetPaletteEntries(UINT startIndex, UINT entries, LPPALETTEENTRY pPaletteColors) const; + UINT SetPaletteEntries(UINT startIndex, UINT entries, LPPALETTEENTRY pPaletteColors) const; + + // Operations + BOOL ResizePalette(UINT entries) const; + BOOL AnimatePalette(UINT startIndex, UINT entries, LPPALETTEENTRY pPaletteColors) const; + UINT GetNearestPaletteIndex (COLORREF color) const; + }; + + + ///////////////////////////////// + // CPen manages a pen GDI object. + class CPen final : public CGDIObject + { + public: + CPen(); + CPen(HPEN pen); + CPen(int penStyle, int width, COLORREF color); + CPen(int penStyle, int width, LOGBRUSH logBrush, + int styleCount = 0, const DWORD* pStyle = nullptr); + CPen(const CPen& rhs); + CPen& operator=(const CPen& rhs); + operator HPEN() const; + virtual ~CPen() override; + + void CreatePen(int penStyle, int width, COLORREF color); + void CreatePenIndirect(LOGPEN logPen); + void ExtCreatePen(int penStyle, int width, LOGBRUSH logBrush, + int styleCount = 0, const DWORD* pStyle = nullptr) ; + EXTLOGPEN GetExtLogPen() const; + LOGPEN GetLogPen() const; + }; + + + //////////////////////////////////// + // CRgn manages a region GDI object. + class CRgn final : public CGDIObject + { + public: + CRgn(); + CRgn(HRGN rgn); + CRgn(const CRgn& rhs); + CRgn& operator=(const CRgn& rhs); + operator HRGN() const; + virtual ~CRgn() override; + + // Create methods + void CreateEllipticRgn(int x1, int y1, int x2, int y2); + void CreateEllipticRgnIndirect(RECT rc); + void CreateFromData(const XFORM* pXForm, int count, const RGNDATA* pRgnData); + void CreateFromPath(HDC dc); + void CreatePolygonRgn(LPPOINT pPoints, int count, int mode); + void CreatePolyPolygonRgn(LPPOINT pPoints, LPINT pPolyCounts, int count, int polyFillMode); + void CreateRectRgn(int x1, int y1, int x2, int y2); + void CreateRectRgnIndirect(RECT rc); + void CreateRoundRectRgn(int x1, int y1, int x2, int y2, int x3, int y3); + + // Operations + int CombineRgn(HRGN src1, HRGN src2, int combineMode) const; + int CombineRgn(HRGN src, int combineMode) const; + int CopyRgn(HRGN src) const; + BOOL EqualRgn(HRGN rgn) const; + int GetRegionData(LPRGNDATA pRgnData, int dataSize) const; + int GetRgnBox(RECT& rc) const; + int OffsetRgn(int x, int y) const; + int OffsetRgn(POINT& pt) const; + BOOL PtInRegion(int x, int y) const; + BOOL PtInRegion(POINT& pt) const; + BOOL RectInRegion(RECT rc) const; + void SetRectRgn(int x1, int y1, int x2, int y2) const; + void SetRectRgn(RECT rc) const; + }; + + + // A structure that contains the data members for CDC. + struct CDC_Data + { + // Constructor + CDC_Data() : dc(nullptr), isManagedHDC(false), wnd(nullptr), + savedDCState(0), isPaintDC(false) + { + ps = {}; + } + + CBitmap bitmap; + CBrush brush; + CFont font; + CPalette palette; + CPen pen; + CRgn rgn; + HDC dc; // The HDC belonging to this CDC. + bool isManagedHDC; // Delete/Release the HDC on destruction. + HWND wnd; // The HWND of a Window or Client window DC. + int savedDCState; // The save state of the HDC. + bool isPaintDC; + PAINTSTRUCT ps; + }; + + + ///////////////////////////////////////////////////////////////////////// + // CDC manages a GDI device context. A device context is a structure + // that defines a set of graphic objects and their associated attributes, + // as well as the graphic modes that affect output. The graphic objects + // include a pen for line drawing, a brush for painting and filling, a + // bitmap for copying or scrolling parts of the screen, a palette for + // defining the set of available colors, a region for clipping and other + // operations, and a path for painting and drawing operations. + class CDC + { + friend class CEnhMetaFileDC; + friend class CMetaFileDC; + + public: + CDC(); // Constructs a new CDC without assigning a HDC. + CDC(HDC dc); // Constructs a new CDC and assigns a HDC. + CDC(const CDC& rhs); // Constructs a new copy of the CDC. + virtual ~CDC(); + operator HDC() const { return GetHDC(); } // Converts a CDC to a HDC. + CDC& operator=(const CDC& rhs); // Assigns a CDC to an existing CDC. + CDC& operator=(HDC dc); + + void Attach(HDC dc); + void Destroy(); + HDC Detach(); + HDC GetHDC() const; + BOOL RestoreDC(int savedDC) const; + int SaveDC() const; + CBitmap SelectObject(HBITMAP bitmap) const; + CBrush SelectObject(HBRUSH brush) const; + CFont SelectObject(HFONT font) const; + CPen SelectObject(HPEN pen) const; + int SelectObject(HRGN rgn) const; + CPalette SelectPalette(HPALETTE palette, BOOL forceBkgnd) const; + + // Initialization + void CreateCompatibleDC(HDC source); + void CreateDC(LPCTSTR driver, LPCTSTR device, LPCTSTR output, const DEVMODE* pInitData); + int GetDeviceCaps(int index) const; + void CreateIC(LPCTSTR driver, LPCTSTR device, LPCTSTR output, const DEVMODE* pInitData); + + // Create Bitmaps + void CreateBitmap(int cx, int cy, UINT planes, UINT bitsPerPixel, LPCVOID pColors) const; + void CreateCompatibleBitmap(HDC dc, int cx, int cy) const; + void CreateDIBSection(HDC dc, const LPBITMAPINFO pBMI, UINT usage, LPVOID* ppBits, + HANDLE section, DWORD offset) const; + CBitmap DetachBitmap() const; + + BOOL LoadBitmap(UINT id) const; + BOOL LoadBitmap(LPCTSTR resName) const; + BOOL LoadImage(UINT id, UINT flags) const; + BOOL LoadImage(LPCTSTR resName, UINT flags) const; + BOOL LoadImage(UINT id, int cxDesired, int cyDesired, UINT flags) const; + BOOL LoadImage(LPCTSTR resourceName, int cxDesired, int cyDesired, UINT flags) const; + BOOL LoadOEMBitmap(UINT bitmapID) const; // for OBM_/OCR_/OIC + + void CreateBitmapIndirect(const BITMAP& bitmap) const; + void CreateDIBitmap(HDC dc, const BITMAPINFOHEADER& pBMIH, DWORD init, + LPCVOID pInit, const LPBITMAPINFO pBMI, UINT usage) const; + void CreateMappedBitmap(UINT bitmapID, UINT flags /*= 0*/, + LPCOLORMAP pColorMap /*= nullptr*/, int mapSize /*= 0*/) const; + + // Create Brushes + void CreateBrushIndirect(LOGBRUSH logBrush) const; + void CreateDIBPatternBrush(HGLOBAL hDIBPacked, UINT colorSpec) const; + void CreateDIBPatternBrushPt(LPCVOID pPackedDIB, UINT usage) const; + void CreateHatchBrush(int style, COLORREF color) const; + void CreatePatternBrush(HBITMAP bitmap) const; + void CreateSolidBrush(COLORREF color) const; + + // Create Fonts + void CreateFontIndirect(const LOGFONT& lf) const; + void CreatePointFont(int pointSize, LPCTSTR faceName, HDC dc = nullptr, + BOOL isBold = FALSE, BOOL isItalic = FALSE) const; + void CreatePointFontIndirect(const LOGFONT& logFont, HDC dc = nullptr) const; + + void CreateFont(int height, int width, int escapement, int orientation, + int weight, DWORD italic, DWORD underline, DWORD strikeOut, + DWORD charSet, DWORD outputPrecision, DWORD clipPrecision, + DWORD quality, DWORD pitchAndFamily, LPCTSTR faceName) const; + + // Create Palettes + void CreatePalette(LPLOGPALETTE pLogPalette, BOOL forceBkgnd) const; + void CreateHalftonePalette(BOOL forceBkgnd) const; + + // Create Pens + void CreatePen(int style, int width, COLORREF color) const; + void CreatePenIndirect(LOGPEN logPen) const; + void ExtCreatePen(int penStyle, int width, LOGBRUSH logBrush, + int styleCount, const DWORD* pStyle) const; + + // Retrieve and Select Stock Objects + HGDIOBJ GetStockObject(int index) const; + HGDIOBJ SelectStockObject(int index) const; + + // Create Regions + int CreateEllipticRgn(int left, int top, int right, int bottom) const; + int CreateEllipticRgnIndirect(RECT rc) const; + int CreatePolygonRgn(LPPOINT pPointArray, int points, int polyFillMode) const; + int CreatePolyPolygonRgn(LPPOINT pPointArray, LPINT pPolyCounts, + int count, int polyFillMode) const; + int CreateRectRgn(int left, int top, int right, int bottom) const; + int CreateRectRgnIndirect(RECT rc) const; + int CreateRgnFromData(const XFORM* pXform, int count, const RGNDATA* pRgnData) const; + int CreateRgnFromPath(HDC dc) const; + int CreateRoundRectRgn(int x1, int y1, int x2, int y2, int x3, int y3) const; + + // Wrappers for WinAPI functions + int EnumObjects(int objectType, GOBJENUMPROC pObjectFunc, LPARAM lparam) const; + + // Point and Line Drawing Functions + BOOL AngleArc(int x, int y, int radius, float startAngle, float sweepAngle) const; + BOOL Arc(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) const; + BOOL Arc(RECT rc, POINT start, POINT end) const; + BOOL ArcTo(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) const; + BOOL ArcTo(RECT rc, POINT start, POINT end) const; + BOOL CloseFigure() const; + int GetArcDirection() const; + CPoint GetCurrentPosition() const; + COLORREF GetPixel(int x, int y) const; + COLORREF GetPixel(POINT pt) const; + int GetROP2() const; + BOOL LineTo(int x, int y) const; + BOOL LineTo(POINT pt) const; + CPoint MoveTo(int x, int y) const; + CPoint MoveTo(POINT pt) const; + BOOL PolyBezier(const POINT* pPointArray, int count) const; + BOOL PolyBezierTo(const POINT* pPointArray, int count) const; + BOOL PolyDraw(const POINT* pPointArray, const BYTE* pTypes, int count) const; + BOOL Polyline(LPPOINT pPointArray, int count) const; + BOOL PolylineTo(const POINT* pPointArray, int count) const; + BOOL PolyPolyline(const POINT* pPointArray, const DWORD* pPolyPoints, int count) const; + int SetArcDirection(int arcDirection) const; + COLORREF SetPixel(int x, int y, COLORREF color) const; + COLORREF SetPixel(POINT pt, COLORREF color) const; + BOOL SetPixelV(int x, int y, COLORREF color) const; + BOOL SetPixelV(POINT pt, COLORREF color) const; + int SetROP2(int drawMode) const; + + // Shape Drawing Functions + BOOL Chord(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) const; + BOOL Chord(RECT rc, POINT start, POINT end) const; + BOOL DrawFocusRect(RECT rc) const; + BOOL Ellipse(int x1, int y1, int x2, int y2) const; + BOOL Ellipse(RECT rc) const; + BOOL Pie(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) const; + BOOL Pie(RECT rc, POINT start, POINT end) const; + BOOL PolyPolygon(LPPOINT pPointArray, LPINT pPolyCounts, int count) const; + BOOL Polygon(LPPOINT pPointArray, int count) const; + BOOL Rectangle(int x1, int y1, int x2, int y2) const; + BOOL Rectangle(RECT rc) const; + BOOL RoundRect(int x1, int y1, int x2, int y2, int width, int height) const; + BOOL RoundRect(RECT rc, int width, int height) const; + + // Fill and Image Drawing functions + BOOL DrawEdge(RECT rc, UINT edge, UINT flags) const; + BOOL DrawIcon(int x, int y, HICON icon) const; + BOOL DrawIcon(POINT point, HICON icon) const; + BOOL DrawIconEx(int xLeft, int yTop, HICON icon, int cxWidth, int cyWidth, + UINT index, HBRUSH flickerFreeDraw, UINT flags) const; + + BOOL DrawFrameControl(RECT rc, UINT type, UINT state) const; + BOOL FillRect(RECT rc, HBRUSH brush) const; + BOOL FillRgn(HRGN rgn, HBRUSH brush) const; + BOOL FrameRect(RECT rc, HBRUSH brush) const; + BOOL FrameRgn(HRGN rgn, HBRUSH brush, int width, int height) const; + int GetPolyFillMode() const; + BOOL GradientFill(PTRIVERTEX pVertex, ULONG vertex, PVOID pMesh, + ULONG mesh, ULONG mode) const; + void GradientFill(COLORREF color1, COLORREF color2, RECT rc, BOOL isVertical) const; + BOOL InvertRect(RECT rc) const; + BOOL PaintRgn(HRGN rgn) const; + int SetPolyFillMode(int polyFillMode) const; + void SolidFill(COLORREF color, RECT rc) const; + + // Bitmap Functions + BOOL BitBlt(int x, int y, int width, int height, HDC hSrc, int xSrc, + int ySrc, DWORD rop) const; + void DrawBitmap(int x, int y, int cx, int cy, HBITMAP image, COLORREF mask) const; + BOOL ExtFloodFill(int x, int y, COLORREF color, UINT fillType) const; + BOOL FloodFill(int x, int y, COLORREF color) const; + int GetDIBits(HBITMAP bitmap, UINT startScan, UINT scanLines, LPVOID pBits, + LPBITMAPINFO pBMI, UINT usage) const; + BITMAP GetBitmapData() const; + CBitmap GetCurrentBitmap() const; + int GetStretchBltMode() const; + BOOL MaskBlt(int xDest, int yDest, int width, int height, HDC hSrc, + int xSrc, int ySrc, HBITMAP mask, int xMask, int yMask, + DWORD rop) const; + BOOL PatBlt(int x, int y, int width, int height, DWORD rop) const; + int SetDIBits(HBITMAP bitmap, UINT startScan, UINT scanLines, + LPCVOID pBits, LPBITMAPINFO pBMI, UINT colorUse) const; + int StretchDIBits(int xDest, int yDest, int destWidth, + int destHeight, int xSrc, int ySrc, int srcWidth, int srcHeight, + LPCVOID pBits, const LPBITMAPINFO pBMI, UINT usage, DWORD rop) const; + BOOL StretchBlt(int x, int y, int width, int height, HDC src, + int xSrc, int ySrc, int srcWidth, int srcHeight, DWORD rop) const; + int SetStretchBltMode(int stretchMode) const; + BOOL TransparentBlt(int x, int y, int width, int height, HDC hSrc, + int xSrc, int ySrc, int widthSrc, int heightSrc, + UINT transparent) const; + + // Brush Functions + CPoint GetBrushOrgEx() const; + CBrush GetCurrentBrush() const; + COLORREF GetDCBrushColor() const; + LOGBRUSH GetLogBrush() const; + CPoint SetBrushOrgEx(int x, int y); + COLORREF SetDCBrushColor(COLORREF color) const; + + // Font Functions + CFont GetCurrentFont() const; + DWORD GetFontData(DWORD table, DWORD offset, LPVOID buffer, DWORD data) const; + DWORD GetFontLanguageInfo() const; + DWORD GetGlyphOutline(UINT query, UINT format, LPGLYPHMETRICS pGM, + DWORD bufferSize, LPVOID buffer, const MAT2* pMAT2) const; + DWORD GetKerningPairs(DWORD numPairs, LPKERNINGPAIR pKrnPair) const; + LOGFONT GetLogFont() const; + DWORD SetMapperFlags(DWORD flag) const; + + // Palette and color functions + CPalette GetCurrentPalette() const; + COLORREF GetNearestColor(COLORREF color) const; + BOOL GetColorAdjustment(LPCOLORADJUSTMENT pCA) const; + BOOL SetColorAdjustment(const COLORADJUSTMENT* pCA) const; + UINT RealizePalette() const; + BOOL UpdateColors() const; + + // Pen Functions + CPen GetCurrentPen() const; + LOGPEN GetLogPen() const; + BOOL GetMiterLimit(PFLOAT limit) const; + BOOL SetMiterLimit(FLOAT newLimit, PFLOAT oldLimit) const; + + // Clipping and Region Functions + BOOL AbortPath() const; + BOOL BeginPath() const; + BOOL EndPath() const; + int ExcludeClipRect(int left, int top, int right, int bottom) const; + int ExcludeClipRect(RECT rc) const; + int ExtSelectClipRgn(HRGN rgn, int mode) const; + BOOL FlattenPath() const; + int GetClipBox(RECT& rc) const; + int GetPath(POINT* pointArray, BYTE* types, int count) const; + int IntersectClipRect(int left, int top, int right, int bottom) const; + int IntersectClipRect(RECT rc) const; + int OffsetClipRgn(int xOffset, int yOffset) const; + BOOL PtVisible(int x, int y) const; + BOOL RectVisible(RECT rc) const; + BOOL SelectClipPath(int mode) const; + int SelectClipRgn(HRGN rgn) const; + BOOL StrokeAndFillPath() const; + BOOL StrokePath() const; + BOOL WidenPath() const; + + // Co-ordinate Functions + BOOL DPtoLP(LPPOINT pPointArray, int count) const; + BOOL DPtoLP(RECT& rc) const; + BOOL LPtoDP(LPPOINT pPointArray, int count) const; + BOOL LPtoDP(RECT& rc) const; + + // Layout Functions + DWORD GetLayout() const; + DWORD SetLayout(DWORD layout) const; + + // Mapping functions + int GetMapMode() const; + + BOOL GetViewportOrgEx(LPPOINT pPoint) const; + BOOL GetViewportExtEx(LPSIZE pSize) const; + BOOL GetWindowExtEx(LPSIZE pSize) const; + BOOL GetWindowOrgEx(LPPOINT pPoint) const; + BOOL OffsetViewportOrgEx(int width, int height, LPPOINT pPoint = nullptr) const; + BOOL OffsetWindowOrgEx(int width, int height, LPPOINT pPoint = nullptr) const; + BOOL ScaleViewportExtEx(int xNum, int xDenom, int yNum, int yDenom, + LPSIZE pSize = nullptr) const; + BOOL ScaleWindowExtEx(int xNum, int xDenom, int yNum, int yDenom, + LPSIZE pSize = nullptr) const; + int SetMapMode(int mapMode) const; + BOOL SetViewportExtEx(int x, int y, LPSIZE pSize = nullptr) const; + BOOL SetViewportExtEx(SIZE size, LPSIZE pSizeRet = nullptr) const; + BOOL SetViewportOrgEx(int x, int y, LPPOINT pPoint = nullptr) const; + BOOL SetViewportOrgEx(POINT point, LPPOINT pPointRet = nullptr) const; + BOOL SetWindowExtEx(int x, int y, LPSIZE pSize = nullptr) const; + BOOL SetWindowExtEx(SIZE size, LPSIZE pSizeRet = nullptr) const; + BOOL SetWindowOrgEx(POINT point, LPPOINT pPointRet = nullptr) const; + BOOL SetWindowOrgEx(int x, int y, LPPOINT pPoint = nullptr) const; + + // MetaFile Functions + BOOL PlayMetaFile(HMETAFILE metaFile) const; + BOOL PlayMetaFile(HENHMETAFILE enhMetaFile, RECT bounds) const; + + // Printer Functions + int AbortDoc() const; + int EndDoc() const; + int EndPage() const; + int SetAbortProc(BOOL (CALLBACK* pfn)(HDC, int)) const; + int StartDoc(LPDOCINFO pDocInfo) const; + int StartPage() const; + + // Text Functions + int DrawText(LPCTSTR string, int count, RECT rc, UINT format) const; + BOOL ExtTextOut(int x, int y, UINT options, RECT rc, LPCTSTR string, + int count = -1, LPINT pDxWidths = nullptr) const; + COLORREF GetBkColor() const; + int GetBkMode() const; + UINT GetTextAlign() const; + COLORREF GetTextColor() const; + int GetTextFace(int count, LPTSTR facename) const; + BOOL GetTextMetrics(TEXTMETRIC& metrics) const; + COLORREF SetBkColor(COLORREF color) const; + int SetBkMode(int bkMode) const; + UINT SetTextAlign(UINT flags) const; + COLORREF SetTextColor(COLORREF color) const; + int DrawTextEx(LPTSTR string, int count, RECT rc, UINT format, + LPDRAWTEXTPARAMS pDTParams) const; + BOOL GetCharABCWidths(UINT firstChar, UINT lastChar, LPABC pABC) const; + BOOL GetCharABCWidthsI(UINT first, UINT cgi, LPWORD pGI, LPABC pABC) const; + BOOL GetCharWidthI(UINT first, UINT cgi, LPWORD pGI, int* buffer) const; + DWORD GetCharacterPlacement(LPCTSTR string, int count, int maxExtent, + LPGCP_RESULTS results, DWORD flags) const; + BOOL GetCharWidth(UINT firstChar, UINT lastChar, int* buffer) const; + BOOL GetCharWidthFloat(UINT firstChar, UINT lastChar, float* buffer) const; + CSize GetTabbedTextExtent(LPCTSTR string, int count, int tabPositions, + LPINT pTabStopPositions) const; + int GetTextCharacterExtra() const; + CSize GetTextExtentPoint32(LPCTSTR string, int count) const; + CSize GetTextExtentPoint32(LPCTSTR string) const; + BOOL GrayString(HBRUSH brush, GRAYSTRINGPROC pOutputFunc, LPARAM pData, + int count, int x, int y, int width, int height) const; + int SetTextCharacterExtra(int charExtra) const; + int SetTextJustification(int breakExtra, int breakCount) const; + CSize TabbedTextOut(int x, int y, LPCTSTR string, int count, + int tabPositions, LPINT pTabStopPositions, int tabOrigin) const; + BOOL TextOut(int x, int y, LPCTSTR string, int count = -1) const; + + protected: + void Assign(HDC object); + PAINTSTRUCT* GetPaintStruct() const { return &m_pData->ps; } + void Release(); + void SetPaintDC(bool isPaintDC) const { m_pData->isPaintDC = isPaintDC; } + void SetWindow(HWND wnd) const { m_pData->wnd = wnd; } + + private: + std::shared_ptr m_pData; // pointer to the class's data members + }; + + + ///////////////////////////////////////////////////////////// + // CClientDC manages a GDI device context for the client area + // of a window. + class CClientDC final : public CDC + { + public: + CClientDC(HWND wnd); + CClientDC(const CClientDC& rhs); + CClientDC& operator=(const CClientDC& rhs); + virtual ~CClientDC() override; + }; + + + /////////////////////////////////////////////////////////////////// + // CClientDCEx manages a GDI device context for the client area + // of a window. A clip region can be specified, along with flags + // such as DCX_WINDOW, DCX_CACHE, DCX_PARENTCLIP, DCX_CLIPSIBLINGS, + // DCX_CLIPCHILDREN, DCX_NORESETATTRS, DCX_LOCKWINDOWUPDATE, + // DCX_EXCLUDERGN, DCX_INTERSECTRGN and DCX_VALIDATE. + class CClientDCEx final : public CDC + { + public: + CClientDCEx(HWND wnd, HRGN clip, DWORD flags); + CClientDCEx(const CClientDCEx& rhs); + CClientDCEx& operator=(const CClientDCEx& rhs); + virtual ~CClientDCEx() override; + }; + + + //////////////////////////////////////////////////////////////////// + // CMemDC manage a memory device context that is compatible with the + // specified device context. If this device context 0, the memory DC + // is compatible with the application's current screen. + class CMemDC final : public CDC + { + public: + explicit CMemDC(HDC dc); + CMemDC(const CMemDC& rhs); + CMemDC& operator=(const CMemDC& rhs); + virtual ~CMemDC() override; + }; + + + /////////////////////////////////////////////////////////////// + // CPaintDC manages a GDI device used for painting via WM_PAINT + // on the specified window. + class CPaintDC final : public CDC + { + public: + CPaintDC(HWND wnd); + CPaintDC(const CPaintDC& rhs); + CPaintDC& operator=(const CPaintDC& rhs); + virtual ~CPaintDC() override; + }; + + + /////////////////////////////////////////////////////////////////// + // CWindowDC manages a GDI device context for the specified window, + // including its client and non-client areas. + class CWindowDC final : public CDC + { + public: + CWindowDC(HWND wnd); + CWindowDC(const CWindowDC& rhs); + CWindowDC& operator=(const CWindowDC& rhs); + virtual ~CWindowDC() override; + }; + + + /////////////////////////////////////////////// + // CMetaFileDC manages a GDI device context for + // a Windows-format metafile. + class CMetaFileDC final : public CDC + { + public: + CMetaFileDC(); + CMetaFileDC(const CMetaFileDC& rhs); + CMetaFileDC& operator=(const CMetaFileDC& rhs); + virtual ~CMetaFileDC() override; + + CMetaFile Close(); + void Create(LPCTSTR fileName = nullptr); + }; + + + /////////////////////////////////////////////////////////////////// + // CEnhMetaFileDC manages a GDI device context for a Windows-format + // enhanced metafile. + class CEnhMetaFileDC final : public CDC + { + public: + CEnhMetaFileDC(); + CEnhMetaFileDC(const CEnhMetaFileDC& rhs); + CEnhMetaFileDC& operator=(const CEnhMetaFileDC& rhs); + virtual ~CEnhMetaFileDC() override; + + CEnhMetaFile CloseEnhanced(); + void CreateEnhanced(HDC ref, LPCTSTR fileName, const RECT* pBounds, + LPCTSTR description); + }; + + + ///////////////////////////////////////////////////////////////////////// + // The CBitmapInfoPtr class is a convenient wrapper for the BITMAPINFO + // structure. The BITMAPINFO structure is used in the GetDIBits and + // SetDIBits Window API functions. + // + // This class creates the colors array of the correct size based on the + // color format (bit count) of the bitmap, and fills the BITMAPINFOHEADER. + class CBitmapInfoPtr + { + public: + CBitmapInfoPtr(const BITMAP& bitmap); + CBitmapInfoPtr(HBITMAP bitmap); + LPBITMAPINFO get() const { return m_pbmiArray; } + operator LPBITMAPINFO() const { return m_pbmiArray; } + LPBITMAPINFO operator->() const { return m_pbmiArray; } + + private: + CBitmapInfoPtr(const CBitmapInfoPtr&) = delete; + CBitmapInfoPtr& operator=(const CBitmapInfoPtr&) = delete; + void CreateBitmapInfo(const BITMAP& data); + LPBITMAPINFO m_pbmiArray; + std::vector m_bmi; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + //////////////////////////////////////// + // Definitions for the CGDIObject class. + // + + // Constructs the CGDIObject. + inline CGDIObject::CGDIObject() : m_pData(std::make_shared()) + { + } + + // Note: A copy of a CGDIObject is a clone of the original. + // Both objects manipulate the one HGDIOBJ. + inline CGDIObject::CGDIObject(const CGDIObject& rhs) + { + m_pData = rhs.m_pData; + } + + // Deconstructs the CGDIObject. + inline CGDIObject::~CGDIObject() + { + Release(); + } + + // Note: A copy of a CGDIObject is a clone of the original. + // Both objects manipulate the one HGDIOBJ. + inline CGDIObject& CGDIObject::operator=( const CGDIObject& rhs ) + { + if (this != &rhs) + { + Release(); + m_pData = rhs.m_pData; + } + + return *this; + } + + inline CGDIObject& CGDIObject::operator=(HGDIOBJ object) + { + Attach(object); + return *this; + } + + // Attach and own the GDI handle. + inline void CGDIObject::Assign(HGDIOBJ object) + { + Attach(object); + m_pData->isManagedObject = true; + } + + // Attaches a GDI handle to the CGDIObject. + inline void CGDIObject::Attach(HGDIOBJ object) + { + assert(m_pData); + + if (m_pData && object != m_pData->hGDIObject) + { + // Release any existing GDI object. + if (m_pData->hGDIObject != nullptr) + { + Release(); + m_pData = std::make_shared(); + } + + if (object != nullptr) + { + // Add the GDI object to this CCGDIObject. + std::shared_ptr pCGDIData = GetApp()->GetCGDIData(object).lock(); + if (pCGDIData) + { + m_pData = std::move(pCGDIData); + } + else + { + // Add the GDI object data to the map. + m_pData->hGDIObject = object; + GetApp()->AddCGDIDataToMap(object, m_pData); + } + } + } + } + + // Deletes the GDI object if it is managed and returns this object to its + // default state. + inline void CGDIObject::Destroy() + { + assert(m_pData); + + if (m_pData && m_pData->hGDIObject != nullptr) + { + if (IsAppRunning()) // Is the CWinApp object still valid? + GetApp()->RemoveGDIObjectFromMap(m_pData->hGDIObject); + + if (m_pData->isManagedObject) + ::DeleteObject(m_pData->hGDIObject); + + // Nullify all copies of m_pData. + *m_pData.get() = {}; + } + } + + // Detaches the HGDIOBJ from this CGDIObject and all its copies. + // The CGDIObject and its copies are returned to the default state. + // Note: We rarely need to detach the HGDIOBJ from CGDIObject. + // The framework will delete the HGDIOBJ automatically if required + // when the last copy of the CDC goes out of scope. + // This also applies to classes inherited from CGDIObject, namely + // CBitmap, CBrush, CFont, CPalette, CPen and CRgn. + inline HGDIOBJ CGDIObject::Detach() + { + assert(m_pData); + assert(m_pData->hGDIObject); + + HGDIOBJ object = m_pData->hGDIObject; + GetApp()->RemoveGDIObjectFromMap(object); + + // Nullify all copies of m_pData. + *m_pData.get() = {}; + + // Make a new shared_ptr for this object. + m_pData = std::make_shared(); + + return object; + } + + // Returns the GDI handle (HGDIOBJ) associated with this object. + inline HGDIOBJ CGDIObject::GetHandle() const + { + assert(m_pData); + return m_pData ? m_pData->hGDIObject : 0; + } + + // Retrieves information for the specified graphics object. + // Refer to GetObject in the Windows API documentation for more information. + inline int CGDIObject::GetObject(int count, LPVOID pObject) const + { + assert(m_pData); + return m_pData ? ::GetObject(m_pData->hGDIObject, count, pObject) : 0; + } + + // Destroys m_pData if this is the only copy of the CGDIObject. + inline void CGDIObject::Release() + { + assert(m_pData); + + if (m_pData.use_count() == 1) + { + Destroy(); + } + } + + + ///////////////////////////////////// + // Definitions for the CBitmap class. + // + + inline CBitmap::CBitmap() + { + } + + inline CBitmap::CBitmap(HBITMAP bitmap) + { + Attach(bitmap); + } + + inline CBitmap::CBitmap(LPCTSTR resourceName) + { + LoadBitmap(resourceName); + } + + inline CBitmap::CBitmap(UINT resourceID) + { + LoadBitmap(resourceID); + } + + inline CBitmap::CBitmap(const CBitmap& rhs) : CGDIObject(rhs) + { + } + + inline CBitmap& CBitmap::operator=(const CBitmap& rhs) + { + CGDIObject::operator =(rhs); + return *this; + } + + inline CBitmap::operator HBITMAP() const + { + return static_cast(GetHandle()); + } + + inline CBitmap::~CBitmap() + { + } + + // Loads a bitmap from a resource using the resource ID. + // Refer to LoadImage in the Windows API documentation for more information. + inline BOOL CBitmap::LoadBitmap(UINT resourceID) + { + return LoadBitmap(MAKEINTRESOURCE(resourceID)); + } + + // Loads a bitmap from a resource using the resource string. + // Refer to LoadImage in the Windows API documentation for more information. + inline BOOL CBitmap::LoadBitmap(LPCTSTR resourceName) + { + HBITMAP bitmap = static_cast(::LoadImage(GetApp()->GetResourceHandle(), + resourceName, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR)); + if (bitmap != nullptr) + { + Assign(bitmap); + } + return bitmap ? TRUE : FALSE; + } + + // Loads a bitmap from a resource using the resource ID. + // Refer to LoadImage in the Windows API documentation for more information. + inline BOOL CBitmap::LoadImage(UINT id, UINT flags) + { + return LoadImage(MAKEINTRESOURCE(id), flags); + } + + // Loads a bitmap from a resource using the resource ID. + // Refer to LoadImage in the Windows API documentation for more information. + inline BOOL CBitmap::LoadImage(UINT id, int cxDesired, int cyDesired, UINT flags) + { + return LoadImage(MAKEINTRESOURCE(id), cxDesired, cyDesired, flags); + } + + // Loads a bitmap from a resource using the resource string. + // Refer to LoadImage in the Windows API documentation for more information. + inline BOOL CBitmap::LoadImage(LPCTSTR resourceName, UINT flags) + { + HBITMAP bitmap = static_cast(::LoadImage(GetApp()->GetResourceHandle(), + resourceName, IMAGE_BITMAP, 0, 0, flags)); + if (bitmap != nullptr) + { + Assign(bitmap); + } + return bitmap ? TRUE : FALSE; + } + + // Loads a bitmap from a resource using the resource string. + // Refer to LoadImage in the Windows API documentation for more information. + inline BOOL CBitmap::LoadImage(LPCTSTR resourceName, int cxDesired, int cyDesired, UINT flags) + { + HBITMAP bitmap = static_cast(::LoadImage(GetApp()->GetResourceHandle(), + resourceName, IMAGE_BITMAP, cxDesired, cyDesired, flags)); + if (bitmap != nullptr) + { + Assign(bitmap); + } + return bitmap ? TRUE : FALSE; + } + + // Loads a predefined bitmap. + // Predefined bitmaps include: OBM_BTNCORNERS, OBM_BTSIZE, OBM_CHECK, OBM_CHECKBOXES, OBM_CLOSE, OBM_COMBO + // OBM_DNARROW, OBM_DNARROWD, OBM_DNARROWI, OBM_LFARROW, OBM_LFARROWD, OBM_LFARROWI, OBM_MNARROW,OBM_OLD_CLOSE + // OBM_OLD_DNARROW, OBM_OLD_LFARROW, OBM_OLD_REDUCE, OBM_OLD_RESTORE, OBM_OLD_RGARROW, OBM_OLD_UPARROW + // OBM_OLD_ZOOM, OBM_REDUCE, OBM_REDUCED, OBM_RESTORE, OBM_RESTORED, OBM_RGARROW, OBM_RGARROWD, OBM_RGARROWI + // OBM_SIZE, OBM_UPARROW, OBM_UPARROWD, OBM_UPARROWI, OBM_ZOOM, OBM_ZOOMD + // Refer to LoadBitmap in the Windows API documentation for more information. + inline BOOL CBitmap::LoadOEMBitmap(UINT bitmapID) // for OBM_/OCR_/OIC_ + { + HBITMAP bitmap = ::LoadBitmap(0, MAKEINTRESOURCE(bitmapID)); + if (bitmap != nullptr) + { + Assign(bitmap); + } + return bitmap ? TRUE : FALSE; + } + + // Rapidly converts the bitmap image to pale grayscale image suitable for disabled icons. + // The mask is the transparent color. Pixels with this color are not converted. + // Supports 32 bit, 24 bit, 16 bit and 8 bit colors. + // For 16 and 8 bit colors, ensure the mask is a color in the current palette. + inline void CBitmap::ConvertToDisabled(COLORREF mask) const + { + BITMAP data = GetBitmapData(); + + // Requires 8 bits per pixel + if (data.bmBitsPixel < 8) + return; + + // Copy the image data into the 'bits' byte array. + CWindowDC dc(HWND_DESKTOP); + CBitmapInfoPtr pbmi(*this); + BITMAPINFOHEADER& bmiHeader = pbmi->bmiHeader; + bmiHeader.biBitCount = 24; + UINT scanLines = static_cast(data.bmHeight); + VERIFY(dc.GetDIBits(*this, 0, scanLines, nullptr, pbmi, DIB_RGB_COLORS)); + DWORD size = pbmi->bmiHeader.biSizeImage; + std::vector vBits(size, 0); + byte* bits = vBits.data(); + VERIFY(dc.GetDIBits(*this, 0, scanLines, bits, pbmi, DIB_RGB_COLORS)); + + UINT widthBytes = bmiHeader.biSizeImage / bmiHeader.biHeight; + int yOffset = 0; + int xOffset; + size_t index; + + for (int row = 0; row < bmiHeader.biHeight; ++row) + { + xOffset = 0; + + for (int column = 0; column < bmiHeader.biWidth; ++column) + { + // Calculate the index. + index = size_t(yOffset) + size_t(xOffset); + + // Skip for colors matching the mask. + if ((bits[index + 0] != GetRValue(mask)) || + (bits[index + 1] != GetGValue(mask)) || + (bits[index + 2] != GetBValue(mask))) + { + BYTE byGray = BYTE(110 + (bits[index + 2] * 3 + bits[index + 1] * + 6 + bits[index + 0]) / 20); + bits[index] = byGray; + bits[index + 1] = byGray; + bits[index + 2] = byGray; + } + + // Increment the horizontal offset. + xOffset += bmiHeader.biBitCount >> 3; + } + + // Increment vertical offset. + yOffset += widthBytes; + } + + VERIFY(dc.SetDIBits(*this, 0, scanLines, bits, pbmi, DIB_RGB_COLORS)); + } + + // Creates a new image and copies the attributes of the specified image + // to the new one. If necessary, the function stretches the bits to fit + // the desired size of the new image. + // Refer to CopyImage in the Windows API documentation for more information. + inline void CBitmap::CopyImage(HBITMAP origBitmap, int cxDesired, int cyDesired, UINT flags) + { + assert(origBitmap); + CBitmap orig(origBitmap); + + HBITMAP bitmap = (HBITMAP)::CopyImage(origBitmap, IMAGE_BITMAP, + cxDesired, cyDesired, flags); + if (bitmap == nullptr) + throw CResourceException(GetApp()->MsgGdiBitmap()); + + Assign(bitmap); + if (flags & LR_COPYDELETEORG) + { + orig.Detach(); + } + } + + // Creates a new bitmap using the bitmap data and colors specified by the + //bitmap resource and the color mapping information. + // Refer to CreateMappedBitmap in the Windows API documentation for more information. + inline void CBitmap::CreateMappedBitmap(UINT bitmapID, UINT flags /*= 0*/, + LPCOLORMAP pColorMap /*= nullptr*/, int mapSize /*= 0*/) + { + HBITMAP bitmap = ::CreateMappedBitmap(GetApp()->GetResourceHandle(), bitmapID, + static_cast(flags), pColorMap, mapSize); + if (bitmap == nullptr) + throw CResourceException(GetApp()->MsgGdiBitmap()); + + Assign(bitmap); + } + + // Creates a bitmap with the specified width, height, and color format (color planes and bits-per-pixel). + // Refer to CreateBitmap in the Windows API documentation for more information. + inline void CBitmap::CreateBitmap(int width, int height, UINT planes, UINT bitsPerPixel, LPCVOID pBits) + { + HBITMAP bitmap = ::CreateBitmap(width, height, planes, bitsPerPixel, pBits); + if (bitmap == nullptr) + throw CResourceException(GetApp()->MsgGdiBitmap()); + + Assign(bitmap); + } + + // Creates a bitmap with the width, height, and color format specified in the BITMAP structure. + // Refer to CreateBitmapIndirect in the Windows API documentation for more information. + inline void CBitmap::CreateBitmapIndirect(const BITMAP& bitmap) + { + HBITMAP copyBitmap = ::CreateBitmapIndirect(&bitmap); + if (copyBitmap == nullptr) + throw CResourceException(GetApp()->MsgGdiBitmap()); + + Assign(copyBitmap); + } + + // Creates a bitmap compatible with the specified device context. + // Refer to CreateCompatibleBitmap in the Windows API documentation for more information. + inline void CBitmap::CreateCompatibleBitmap(HDC dc, int width, int height) + { + HBITMAP bitmap = ::CreateCompatibleBitmap(dc, width, height); + if (bitmap == nullptr) + throw CResourceException(GetApp()->MsgGdiBitmap()); + + Assign(bitmap); + } + + // Retrieves the BITMAP structure. + // Refer to GetObject in the Windows API documentation for more information. + inline BITMAP CBitmap::GetBitmapData() const + { + assert(GetHandle() != nullptr); + BITMAP data = {}; + VERIFY(::GetObject(GetHandle(), sizeof(data), &data)); + return data; + } + + // Retrieves the dimensions of a compatible bitmap. + // The retrieved dimensions must have been set by the SetBitmapDimensionEx function. + // Refer to GetBitmapDimensionEx in the Windows API documentation for more information. + inline CSize CBitmap::GetBitmapDimensionEx() const + { + assert(GetHandle() != nullptr); + CSize Size; + VERIFY(::GetBitmapDimensionEx(static_cast(GetHandle()), &Size)); + return Size; + } + + // The SetBitmapDimensionEx function assigns preferred dimensions to a bitmap. + // These dimensions can be used by applications; however, they are not used by the system. + // Refer to SetBitmapDimensionEx in the Windows API documentation for more information. + inline CSize CBitmap::SetBitmapDimensionEx(int width, int height) const + { + assert(GetHandle() != nullptr); + CSize Size; + VERIFY(::SetBitmapDimensionEx(static_cast(GetHandle()), width, height, Size)); + return Size; + } + + // Creates a compatible bitmap (DDB) from a DIB and, optionally, sets the bitmap bits. + // A CBitmapInfoPtr object can be used for the LPBITMAPINFO parameter. + // Refer to CreateDIBitmap in the Windows API documentation for more information. + inline void CBitmap::CreateDIBitmap(HDC dc, const BITMAPINFOHEADER* pBMIH, + DWORD init, LPCVOID pInit, const LPBITMAPINFO pBMI, UINT colorUse) + { + HBITMAP bitmap = ::CreateDIBitmap(dc, pBMIH, init, pInit, pBMI, colorUse); + Assign(bitmap); + } + + inline CSize CBitmap::GetSize() const + { + assert(GetHandle() != nullptr); + BITMAP bitmap = GetBitmapData(); + CSize size(bitmap.bmWidth, bitmap.bmHeight); + + return size; + } + + // Convert a bitmap image to gray scale. + inline void CBitmap::GrayScaleBitmap() const + { + // Requires 8 bits per pixel. + BITMAP data = GetBitmapData(); + if (data.bmBitsPixel < 8) + return; + + // Create our LPBITMAPINFO object. + CBitmapInfoPtr pbmi(*this); + BITMAPINFOHEADER& bmiHeader = pbmi->bmiHeader; + bmiHeader.biBitCount = 24; + + // Create the reference DC for GetDIBits to use. + CMemDC memDC(0); + + // Use GetDIBits to create a DIB from our DDB, and extract the color data + UINT scanLines = static_cast(bmiHeader.biHeight); + VERIFY(GetDIBits(memDC, 0, scanLines, nullptr, pbmi, DIB_RGB_COLORS)); + std::vector vBits(bmiHeader.biSizeImage, 0); + byte* pByteArray = &vBits[0]; + + memDC.GetDIBits(*this, 0, scanLines, pByteArray, pbmi, DIB_RGB_COLORS); + UINT heightBytes = bmiHeader.biSizeImage/bmiHeader.biHeight; + + int yOffset = 0; + int xOffset; + size_t index; + + for (int row=0; row < bmiHeader.biHeight; ++row) + { + xOffset = 0; + + for (int column=0; column < bmiHeader.biWidth; ++column) + { + // Calculate index + index = size_t(yOffset) + size_t(xOffset); + + int gray = (pByteArray[index] + pByteArray[index + 1] * 6 + + pByteArray[index + 2] * 3) / 10; + BYTE byGray = static_cast(gray); + pByteArray[index] = byGray; + pByteArray[index +1] = byGray; + pByteArray[index +2] = byGray; + + // Increment the horizontal offset. + xOffset += bmiHeader.biBitCount >> 3; + } + + // Increment vertical offset. + yOffset += heightBytes; + } + + // Save the modified color back into our source DDB. + VERIFY(SetDIBits(memDC, 0, scanLines, pByteArray, pbmi, DIB_RGB_COLORS)); + } + + // Modifies the color of the Device Dependent Bitmap, by the color. + // correction values specified. The correction values can range from -255 to +255. + // This function gains its speed by accessing the bitmap color information + // directly, rather than using GetPixel/SetPixel. + inline void CBitmap::TintBitmap (int cRed, int cGreen, int cBlue) const + { + // Create our LPBITMAPINFO object. + CBitmapInfoPtr pbmi(*this); + BITMAPINFOHEADER& bmiHeader = pbmi->bmiHeader; + bmiHeader.biBitCount = 24; + + // Create the reference DC for GetDIBits to use. + CMemDC memDC(nullptr); + + // Use GetDIBits to create a DIB from our DDB, and extract the color data + UINT scanLines = static_cast(bmiHeader.biHeight); + VERIFY(GetDIBits(memDC, 0, scanLines, nullptr, pbmi, DIB_RGB_COLORS)); + std::vector vBits(bmiHeader.biSizeImage, 0); + byte* pByteArray = &vBits[0]; + + VERIFY(GetDIBits(memDC, 0, scanLines, pByteArray, pbmi, DIB_RGB_COLORS)); + UINT widthBytes = bmiHeader.biSizeImage/bmiHeader.biHeight; + + // Ensure sane color correction values. + cBlue = std::min(cBlue, 255); + cBlue = std::max(cBlue, -255); + cRed = std::min(cRed, 255); + cRed = std::max(cRed, -255); + cGreen = std::min(cGreen, 255); + cGreen = std::max(cGreen, -255); + + // Precalculate the RGB modification values. + int b1 = 256 - cBlue; + int g1 = 256 - cGreen; + int r1 = 256 - cRed; + + int b2 = 256 + cBlue; + int g2 = 256 + cGreen; + int r2 = 256 + cRed; + + // Modify the color. + int yOffset = 0; + int xOffset; + size_t index; + for (int Row=0; Row < bmiHeader.biHeight; ++Row) + { + xOffset = 0; + + for (int Column=0; Column < bmiHeader.biWidth; ++Column) + { + // Calculate the index. + index = size_t(yOffset) + size_t(xOffset); + + // Adjust the color values. + if (cBlue > 0) + pByteArray[index] = static_cast(cBlue + (((pByteArray[index] *b1)) >>8)); + else if (cBlue < 0) + pByteArray[index] = static_cast((pByteArray[index] *b2) >>8); + + if (cGreen > 0) + pByteArray[index+1] = static_cast(cGreen + (((pByteArray[index+1] *g1)) >>8)); + else if (cGreen < 0) + pByteArray[index+1] = static_cast((pByteArray[index+1] *g2) >>8); + + if (cRed > 0) + pByteArray[index+2] = static_cast(cRed + (((pByteArray[index+2] *r1)) >>8)); + else if (cRed < 0) + pByteArray[index+2] = static_cast((pByteArray[index+2] *r2) >>8); + + // Increment the horizontal offset. + xOffset += bmiHeader.biBitCount >> 3; + } + + // Increment vertical offset. + yOffset += widthBytes; + } + + // Save the modified color back into our source DDB. + VERIFY(SetDIBits(memDC, 0, scanLines, pByteArray, pbmi, DIB_RGB_COLORS)); + } + + // Creates a DIB that applications can write to directly. The function gives you + // a pointer to the location of the bitmap bit values. You can supply a handle to + // a file-mapping object that the function will use to create the bitmap, + // or you can let the system allocate the memory for the bitmap. + // A CBitmapInfoPtr object can be used for the LPBITMAPINFO parameter. + inline void CBitmap::CreateDIBSection(HDC dc, const LPBITMAPINFO pBMI, + UINT colorUse, LPVOID* pBits, HANDLE hSection, DWORD offset) + { + HBITMAP bitmap = ::CreateDIBSection(dc, pBMI, colorUse, pBits, hSection, offset); + Assign(bitmap); + } + + // Retrieves the bits of the specified compatible bitmap and copies them + // into a buffer as a DIB using the specified format. + // A CBitmapInfoPtr object can be used for the LPBITMAPINFO parameter. + // Refer to GetDIBits in the Windows API documentation for more information. + inline int CBitmap::GetDIBits(HDC dc, UINT startScan, UINT scanLines, + LPVOID pBits, LPBITMAPINFO pBMI, UINT colorUse) const + { + assert(GetHandle() != nullptr); + return ::GetDIBits(dc, static_cast(GetHandle()), startScan, + scanLines, pBits, pBMI, colorUse); + } + + // Sets the pixels in a compatible bitmap (DDB) using the color data found in the specified DIB. + // A CBitmapInfoPtr object can be used for the LPBITMAPINFO parameter. + // Refer to SetDIBits in the Windows API documentation for more information. + inline int CBitmap::SetDIBits(HDC dc, UINT startScan, UINT scanLines, + LPCVOID pBits, const LPBITMAPINFO pBMI, UINT colorUse) const + { + assert(GetHandle() != nullptr); + return ::SetDIBits(dc, static_cast(GetHandle()), startScan, + scanLines, pBits, pBMI, colorUse); + } + + + /////////////////////////////////// + // Definitions of the CBrush class. + // + inline CBrush::CBrush() + { + } + + inline CBrush::CBrush(HBRUSH brush) + { + Attach(brush); + } + + inline CBrush::CBrush(COLORREF color) + { + try + { + CreateSolidBrush(color); + } + + catch(...) + { + Release(); // Cleanup + throw; // Rethrow + } + } + + inline CBrush::CBrush(const CBrush& rhs) : CGDIObject(rhs) + { + } + + inline CBrush& CBrush::operator=(const CBrush& rhs) + { + CGDIObject::operator =(rhs); + return *this; + } + + inline CBrush::operator HBRUSH() const + { + return static_cast(GetHandle()); + } + + inline CBrush::~CBrush() + { + } + + // Creates a logical brush that has the specified solid color. + // Refer to CreateSolidBrush in the Windows API documentation for more information. + inline void CBrush::CreateSolidBrush(COLORREF color) + { + HBRUSH brush = ::CreateSolidBrush(color); + if (brush == nullptr) + throw CResourceException(GetApp()->MsgGdiBrush()); + + Assign(brush); + } + + // Creates a logical brush that has the specified hatch pattern and color. + // Refer to CreateHatchBrush in the Windows API documentation for more information. + inline void CBrush::CreateHatchBrush(int index, COLORREF color) + { + HBRUSH brush = ::CreateHatchBrush(index, color); + if (brush == nullptr) + throw CResourceException(GetApp()->MsgGdiBrush()); + + Assign(brush); + } + + // Creates a logical brush from style, color, and pattern specified in the LOGPRUSH struct. + // Refer to CreateBrushIndirect in the Windows API documentation for more information. + inline void CBrush::CreateBrushIndirect(LOGBRUSH logBrush) + { + HBRUSH brush = ::CreateBrushIndirect(&logBrush); + if (brush == nullptr) + throw CResourceException(GetApp()->MsgGdiBrush()); + + Assign(brush); + } + + // Creates a logical brush that has the pattern specified by the specified + // device-independent bitmap (DIB). + // Refer to CreateDIBPatternBrush in the Windows API documentation for more information. + inline void CBrush::CreateDIBPatternBrush(HGLOBAL hDIBPacked, UINT colorSpec) + { + HBRUSH brush = ::CreateDIBPatternBrush(hDIBPacked, colorSpec); + if (brush == nullptr) + throw CResourceException(GetApp()->MsgGdiBrush()); + + Assign(brush); + } + + // Creates a logical brush that has the pattern specified by the device-independent + // bitmap (DIB). + // Refer to CreateDIBPatternBrushPt in the Windows API documentation for more information. + inline void CBrush::CreateDIBPatternBrushPt(LPCVOID pPackedDIB, UINT usage) + { + HBRUSH brush = ::CreateDIBPatternBrushPt(pPackedDIB, usage); + if (brush == nullptr) + throw CResourceException(GetApp()->MsgGdiBrush()); + + Assign(brush); + } + + // Creates a logical brush with the specified bitmap pattern. The bitmap + // can be a DIB section bitmap, which is created by the CreateDIBSection + // function, or it can be a device-dependent bitmap. + // Refer to CreatePatternBrush in the Windows API documentation for more information. + inline void CBrush::CreatePatternBrush(HBITMAP bitmap) + { + HBRUSH brush = ::CreatePatternBrush(bitmap); + if (brush == nullptr) + throw CResourceException(GetApp()->MsgGdiBrush()); + + Assign(brush); + } + + // Retrieves the LOGBRUSH structure that defines the style, color, and pattern + // of a physical brush. + // Refer to GetObject in the Windows API documentation for more information. + inline LOGBRUSH CBrush::GetLogBrush() const + { + assert(GetHandle() != nullptr); + LOGBRUSH logBrush = {}; + VERIFY(::GetObject (GetHandle(), sizeof(logBrush), &logBrush)); + return logBrush; + } + + + ////////////////////////////////// + // Definitions of the CFont class. + // + inline CFont::CFont() + { + } + + inline CFont::CFont(HFONT font) + { + Attach(font); + } + + inline CFont::CFont(const LOGFONT& logFont) + { + try + { + CreateFontIndirect(logFont); + } + + catch(...) + { + Release(); // Cleanup + throw; // Rethrow; + } + } + + inline CFont::CFont(const CFont& rhs) : CGDIObject(rhs) + { + } + + inline CFont& CFont::operator=(const CFont& rhs) + { + CGDIObject::operator =(rhs); + return *this; + } + + inline CFont::operator HFONT() const + { + return static_cast(GetHandle()); + } + + inline CFont::~CFont() + { + } + + // Creates a logical font that has the specified characteristics. + // Refer to CreateFontIndirect in the Windows API documentation for more information. + inline void CFont::CreateFontIndirect(const LOGFONT& logFont) + { + HFONT font = ::CreateFontIndirect(&logFont); + if (font == nullptr) + throw CResourceException(GetApp()->MsgGdiFont()); + + Assign(font); + } + + // Creates a font of a specified typeface and point size. + // Refer to CreateFontIndirect in the Windows API documentation for more information. + inline void CFont::CreatePointFont(int pointSize, LPCTSTR faceName, + HDC dc /*= nullptr*/, BOOL isBold /*= FALSE*/, BOOL isItalic /*= FALSE*/) + { + LOGFONT logFont = {}; + logFont.lfCharSet = DEFAULT_CHARSET; + logFont.lfHeight = pointSize; + + StrCopy(logFont.lfFaceName, faceName, LF_FACESIZE); + + if (isBold) + logFont.lfWeight = FW_BOLD; + if (isItalic) + logFont.lfItalic = 1; + + CreatePointFontIndirect(logFont, dc); + } + + // Creates a font of a specified typeface and point size. + // This function automatically converts the height in lfHeight to logical + // units using the specified device context. + // Refer to CreateFontIndirect in the Windows API documentation for more information. + inline void CFont::CreatePointFontIndirect(const LOGFONT& logFont, HDC dc /* = nullptr*/) + { + CClientDC desktopDC(HWND_DESKTOP); + CDC fontDC = (dc == nullptr) ? desktopDC : CDC(dc); + + // Set the new logfont's font size to logical units using the device context. + // 72 points/inch, 10 decipoints/point. + LOGFONT newLogFont = logFont; + POINT pt = { 0, 0 }; + pt.y = ::MulDiv(fontDC.GetDeviceCaps(LOGPIXELSY), logFont.lfHeight, 720); + VERIFY(fontDC.DPtoLP(&pt, 1)); + + POINT ptOrg = { 0, 0 }; + VERIFY(fontDC.DPtoLP(&ptOrg, 1)); + + newLogFont.lfHeight = -abs(pt.y - ptOrg.y); + CreateFontIndirect (newLogFont); + } + + // Creates a logical font with the specified characteristics. + // Refer to CreateFont in the Windows API documentation for more information. + inline void CFont::CreateFont(int height, int width, int escapement, + int orientation, int weight, DWORD italic, DWORD underline, + DWORD strikeOut, DWORD charSet, DWORD outPrecision, + DWORD clipPrecision, DWORD quality, DWORD pitchAndFamily, + LPCTSTR faceName) + { + HFONT font = ::CreateFont(height, width, escapement, + orientation, weight, italic, underline, strikeOut, + charSet, outPrecision, clipPrecision, quality, + pitchAndFamily, faceName); + + if (font == nullptr) + throw CResourceException(GetApp()->MsgGdiFont()); + + Assign(font); + } + + // Retrieves the LOGFONT structure that contains font attributes. + // Refer to GetObject in the Windows API documentation for more information. + inline LOGFONT CFont::GetLogFont() const + { + assert(GetHandle() != nullptr); + LOGFONT logFont = {}; + VERIFY(::GetObject(GetHandle(), sizeof(logFont), &logFont)); + return logFont; + } + + + ///////////////////////////////////// + // Definitions of the CPalette class. + // + inline CPalette::CPalette() + { + } + + inline CPalette::CPalette(HPALETTE palette) + { + Attach(palette); + } + + inline CPalette::CPalette(const CPalette& rhs) : CGDIObject(rhs) + { + } + + inline CPalette& CPalette::operator=(const CPalette& rhs) + { + CGDIObject::operator =(rhs); + return *this; + } + + inline CPalette::operator HPALETTE() const + { + return static_cast(GetHandle()); + } + + inline CPalette::~CPalette () + { + } + + // Creates a logical palette from the information in the specified LOGPALETTE structure. + // Refer to CreatePalette in the Windows API documentation for more information. + inline void CPalette::CreatePalette(LPLOGPALETTE lpLogPalette) + { + HPALETTE palette = ::CreatePalette (lpLogPalette); + if (palette == nullptr) + throw CResourceException(GetApp()->MsgGdiPalette()); + + Assign(palette); + } + + // Creates a halftone palette for the specified device context (DC). + // Refer to CreateHalftonePalette in the Windows API documentation for more information. + inline void CPalette::CreateHalftonePalette(HDC dc) + { + HPALETTE palette = ::CreateHalftonePalette(dc); + if (palette == nullptr) + throw CResourceException(GetApp()->MsgGdiPalette()); + + Assign(palette); + ::RealizePalette(dc); + } + + // Retrieve the number of entries in the palette. + // Refer to GetObject in the Windows API documentation for more information. + inline int CPalette::GetEntryCount() const + { + assert(GetHandle() != nullptr); + WORD entries = 0; + VERIFY(::GetObject(GetHandle(), sizeof(WORD), &entries)); + return static_cast(entries); + } + + // Retrieves a specified range of palette entries from the palette. + // Refer to GetPaletteEntries in the Windows API documentation for more information. + inline UINT CPalette::GetPaletteEntries(UINT startIndex, UINT entries, + LPPALETTEENTRY pPaletteColors) const + { + assert(GetHandle() != nullptr); + return ::GetPaletteEntries(static_cast(GetHandle()), + startIndex, entries, pPaletteColors); + } + + // Sets RGB (red, green, blue) color values and flags in a range of entries in the palette. + // Refer to SetPaletteEntries in the Windows API documentation for more information. + inline UINT CPalette::SetPaletteEntries(UINT startIndex, UINT entries, + LPPALETTEENTRY pPaletteColors) const + { + assert(GetHandle() != nullptr); + return ::SetPaletteEntries(static_cast(GetHandle()), + startIndex, entries, pPaletteColors); + } + + // Replaces entries in the palette. + // Refer to AnimatePalette in the Windows API documentation for more information. + inline BOOL CPalette::AnimatePalette(UINT startIndex, UINT entries, + LPPALETTEENTRY pPaletteColors) const + { + assert(GetHandle() != nullptr); + return ::AnimatePalette(static_cast(GetHandle()), startIndex, + entries, pPaletteColors); + } + + // Increases or decreases the size of the palette based on the specified value. + // Refer to ResizePalette in the Windows API documentation for more information. + inline BOOL CPalette::ResizePalette(UINT entries) const + { + assert(GetHandle() != nullptr); + return ::ResizePalette(static_cast(GetHandle()), entries); + } + + // Retrieves the index for the entry in the palette most closely matching a + // specified color value. + // Refer to GetNearestPaletteIndex in the Windows API documentation for more information. + inline UINT CPalette::GetNearestPaletteIndex(COLORREF color) const + { + assert(GetHandle() != nullptr); + return ::GetNearestPaletteIndex(static_cast(GetHandle()), color); + } + + + /////////////////////////////////// + // Declarations for the CPen class. + // + inline CPen::CPen() + { + } + + inline CPen::CPen(HPEN pen) + { + Attach(pen); + } + + inline CPen::CPen(int penStyle, int width, COLORREF color) + { + try + { + CreatePen(penStyle, width, color); + } + + catch(...) + { + Release(); // Cleanup + throw; // Rethrow + } + } + + inline CPen::CPen(int penStyle, int width, LOGBRUSH logBrush, + int styleCount /*= 0*/, const DWORD* pStyle /*= nullptr*/) + { + try + { + Attach(::ExtCreatePen(static_cast(penStyle), + static_cast(width), &logBrush, + static_cast(styleCount), pStyle)); + } + + catch(...) + { + Release(); // Cleanup + throw; // Rethrow + } + } + + inline CPen::CPen(const CPen& rhs) : CGDIObject(rhs) + { + } + + inline CPen& CPen::operator=(const CPen& rhs) + { + CGDIObject::operator =(rhs); + return *this; + } + + inline CPen::operator HPEN () const + { + return static_cast(GetHandle()); + } + + inline CPen::~CPen() + { + } + + // Creates a logical pen that has the specified style, width, and color. + // Refer to CreatePen in the Windows API documentation for more information. + inline void CPen::CreatePen(int penStyle, int width, COLORREF color) + { + HPEN pen = ::CreatePen(penStyle, width, color); + Assign(pen); + } + + // Creates a logical pen that has the style, width, and color specified in a structure. + // Refer to CreatePenIndirect in the Windows API documentation for more information. + inline void CPen::CreatePenIndirect(LOGPEN logPen) + { + HPEN pen = ::CreatePenIndirect(&logPen); + Assign(pen); + } + + // Retrieves the LOGPEN struct that specifies the pen's style, width, and color. + // Refer to GetObject in the Windows API documentation for more information. + inline LOGPEN CPen::GetLogPen() const + { + assert(GetHandle() != nullptr); + + LOGPEN logPen = {}; + VERIFY(::GetObject(GetHandle(), sizeof(logPen), &logPen)); + return logPen; + } + + // Creates a logical cosmetic or geometric pen that has the specified + // style, width, and brush attributes. + // Refer to ExtCreatePen in the Windows API documentation for more information. + inline void CPen::ExtCreatePen(int penStyle, int width, LOGBRUSH logBrush, + int styleCount /* = 0*/, const DWORD* pStyle /*= nullptr*/) + { + HPEN pen = ::ExtCreatePen(static_cast(penStyle), + static_cast(width), &logBrush, + static_cast(styleCount), pStyle); + Assign(pen); + } + + // Retrieves the EXTLOGPEN struct that specifies the pen's style, width, + // color and brush attributes. + // Refer to GetObject in the Windows API documentation for more information. + inline EXTLOGPEN CPen::GetExtLogPen() const + { + assert(GetHandle() != nullptr); + + EXTLOGPEN exLogPen = {}; + VERIFY(::GetObject(GetHandle(), sizeof(exLogPen), &exLogPen)); + return exLogPen; + } + + + ///////////////////////////////// + // Definitions of the CRgn class. + // + inline CRgn::CRgn() + { + } + + inline CRgn::CRgn(HRGN rgn) + { + Attach(rgn); + } + + inline CRgn::CRgn(const CRgn& rhs) : CGDIObject(rhs) + { + } + + inline CRgn& CRgn::operator=(const CRgn& rhs) + { + CGDIObject::operator =(rhs); + return *this; + } + + inline CRgn::operator HRGN() const + { + return static_cast(GetHandle()); + } + + inline CRgn::~CRgn() + { + } + + // Creates a rectangular region. + // Refer to CreateRectRgn in the Windows API documentation for more information. + inline void CRgn::CreateRectRgn(int x1, int y1, int x2, int y2) + { + HRGN rgn = ::CreateRectRgn(x1, y1, x2, y2); + if (rgn == nullptr) + throw CResourceException(GetApp()->MsgGdiRegion()); + + Assign(rgn); + } + + inline void CRgn::CreateRectRgnIndirect(RECT rc) + // Creates a rectangular region. + // Refer to CreateRectRgnIndirect in the Windows API documentation for more information. + { + HRGN rgn = ::CreateRectRgnIndirect(&rc); + if (rgn == nullptr) + throw CResourceException(GetApp()->MsgGdiRegion()); + + Assign(rgn); + } + + // Creates an elliptical region. + // Refer to CreateEllipticRgn in the Windows API documentation for more information. + inline void CRgn::CreateEllipticRgn(int x1, int y1, int x2, int y2) + { + HRGN rgn = ::CreateEllipticRgn(x1, y1, x2, y2); + if (rgn == nullptr) + throw CResourceException(GetApp()->MsgGdiRegion()); + + Assign(rgn); + } + + // Creates an elliptical region. + // Refer to CreateEllipticRgnIndirect in the Windows API documentation for more information. + inline void CRgn::CreateEllipticRgnIndirect(RECT rc) + { + HRGN rgn = ::CreateEllipticRgnIndirect(&rc); + if (rgn == nullptr) + throw CResourceException(GetApp()->MsgGdiRegion()); + + Assign(rgn); + } + + // Creates a polygonal region. + // Refer to CreatePolygonRgn in the Windows API documentation for more information. + inline void CRgn::CreatePolygonRgn(LPPOINT pPoints, int count, int mode) + { + HRGN rgn = ::CreatePolygonRgn(pPoints, count, mode); + if (rgn == nullptr) + throw CResourceException(GetApp()->MsgGdiRegion()); + + Assign(rgn); + } + + // Creates a region consisting of a series of polygons. The polygons can overlap. + // Refer to CreatePolyPolygonRgn in the Windows API documentation for more information. + inline void CRgn::CreatePolyPolygonRgn(LPPOINT pPoints, LPINT pPolyCounts, int count, int polyFillMode) + { + HRGN rgn = ::CreatePolyPolygonRgn(pPoints, pPolyCounts, count, polyFillMode); + if (rgn == nullptr) + throw CResourceException(GetApp()->MsgGdiRegion()); + + Assign(rgn); + } + + // Creates a rectangular region with rounded corners. + // Refer to CreateRoundRectRgn in the Windows API documentation for more information. + inline void CRgn::CreateRoundRectRgn(int x1, int y1, int x2, int y2, int x3, int y3) + { + HRGN rgn = ::CreateRoundRectRgn(x1, y1, x2, y2, x3, y3); + if (rgn == nullptr) + throw CResourceException(GetApp()->MsgGdiRegion()); + + Assign(rgn); + } + + // Creates a region from the path that is selected into the specified + // device context. The resulting region uses device coordinates. + // Refer to PathToRegion in the Windows API documentation for more information. + inline void CRgn::CreateFromPath(HDC dc) + { + assert(dc != nullptr); + HRGN rgn = ::PathToRegion(dc); + if (rgn == nullptr) + throw CResourceException(GetApp()->MsgGdiRegion()); + + Assign(rgn); + } + + // Creates a region from the specified region and transformation data. + // If the XFORM pointer is nullptr, the identity transformation is used. + // Refer to ExtCreateRegion in the Windows API documentation for more information. + inline void CRgn::CreateFromData(const XFORM* pXForm, int count, const RGNDATA* pRgnData) + { + HRGN rgn = ::ExtCreateRegion(pXForm, static_cast(count), pRgnData); + if (rgn == nullptr) + throw CResourceException(GetApp()->MsgGdiRegion()); + + Assign(rgn); + } + + // Converts the region into a rectangular region with the specified coordinates. + // Refer to SetRectRgn in the Windows API documentation for more information. + inline void CRgn::SetRectRgn(int x1, int y1, int x2, int y2) const + { + assert(GetHandle() != nullptr); + VERIFY(::SetRectRgn(static_cast(GetHandle()), x1, y1, x2, y2)); + } + + // Converts the region into a rectangular region with the specified coordinates. + // Refer to SetRectRgn in the Windows API documentation for more information. + inline void CRgn::SetRectRgn(RECT rc) const + { + assert(GetHandle() != nullptr); + VERIFY(::SetRectRgn(static_cast(GetHandle()), rc.left, rc.top, rc.right, rc.bottom)); + } + + // Combines two specified regions and stores the result. + // Refer to CombineRgn in the Windows API documentation for more information. + inline int CRgn::CombineRgn(HRGN hSrc1, HRGN hSrc2, int combineMode) const + { + assert(GetHandle() != nullptr); + return ::CombineRgn(static_cast(GetHandle()), hSrc1, hSrc2, combineMode); + } + + // Combines the specified region with the current region. + // Refer to CombineRgn in the Windows API documentation for more information. + inline int CRgn::CombineRgn(HRGN hSrc, int combineMode) const + { + assert(GetHandle() != nullptr); + return ::CombineRgn(static_cast(GetHandle()), (HRGN)GetHandle(), + hSrc, combineMode); + } + + // Assigns the specified region to the current region. + // Refer to CombineRgn in the Windows API documentation for more information. + inline int CRgn::CopyRgn(HRGN hSrc) const + { + assert(GetHandle() != nullptr); + assert(hSrc); + return ::CombineRgn(static_cast(GetHandle()), hSrc, nullptr, RGN_COPY); + } + + // Checks the two regions to determine whether they are identical. + // Refer to EqualRgn in the Windows API documentation for more information. + inline BOOL CRgn::EqualRgn(HRGN rgn) const + { + assert(GetHandle() != nullptr); + return ::EqualRgn(static_cast(GetHandle()), rgn); + } + + // Moves a region by the specified offsets. + // Refer to OffsetRgn in the Windows API documentation for more information. + inline int CRgn::OffsetRgn(int x, int y) const + { + assert(GetHandle() != nullptr); + return ::OffsetRgn(static_cast(GetHandle()), x, y); + } + + // Moves a region by the specified offsets. + // Refer to OffsetRgn in the Windows API documentation for more information. + inline int CRgn::OffsetRgn(POINT& pt) const + { + assert(GetHandle() != nullptr); + return ::OffsetRgn(static_cast(GetHandle()), pt.x, pt.y); + } + + // Retrieves the bounding rectangle of the region, and stores it in the specified RECT. + // The return value indicates the region's complexity: NULLREGION; + // SIMPLEREGION; or COMPLEXREGION. + // Refer to GetRgnBox in the Windows API documentation for more information. + inline int CRgn::GetRgnBox(RECT& rc) const + { + assert(GetHandle() != nullptr); + return ::GetRgnBox(static_cast(GetHandle()), &rc); + } + + // Fills the specified buffer with data describing a region. + // Refer to GetRegionData in the Windows API documentation for more information. + inline int CRgn::GetRegionData(LPRGNDATA pRgnData, int dataSize) const + { + assert(GetHandle() != nullptr); + return static_cast(::GetRegionData(static_cast(GetHandle()), + static_cast(dataSize), pRgnData)); + } + + // Determines whether the specified point is inside the specified region. + // Refer to PtInRegion in the Windows API documentation for more information. + inline BOOL CRgn::PtInRegion(int x, int y) const + { + assert(GetHandle() != nullptr); + return ::PtInRegion(static_cast(GetHandle()), x, y); + } + + // Determines whether the specified point is inside the specified region. + // Refer to PtInRegion in the Windows API documentation for more information. + inline BOOL CRgn::PtInRegion(POINT& pt) const + { + assert(GetHandle() != nullptr); + return ::PtInRegion(static_cast(GetHandle()), pt.x, pt.y); + } + + // Determines whether the specified rect is inside the specified region. + // Refer to RectInRegion in the Windows API documentation for more information. + inline BOOL CRgn::RectInRegion(RECT rc) const + { + assert(GetHandle() != nullptr); + return ::RectInRegion(static_cast(GetHandle()), &rc); + } + + + //////////////////////////////// + // Definitions of the CDC class. + // + + inline CDC::CDC() : m_pData(std::make_shared()) + { + } + + // This constructor assigns a pre-existing HDC to the CDC. + // The HDC will NOT be released or deleted when the CDC object is destroyed. + // Note: this constructor permits a call like this: + // CDC MyCDC = SomeHDC; + inline CDC::CDC(HDC dc) : m_pData(std::make_shared()) + { + Attach(dc); + } + + // Note: this assignment operator permits a call like this: + // CDC MyCDC; + // MyCDC = SomeHDC; + inline CDC& CDC::operator=(HDC dc) + { + Attach(dc); + return *this; + } + + // The copy constructor is called when a temporary copy of the CDC needs to + // be created. This can happen when a CDC is passed by value in a function + // call. Each CDC copy manages the same Device Context and GDI object. + inline CDC::CDC(const CDC& rhs) // Copy constructor + { + m_pData = rhs.m_pData; + } + + // Note: A copy of a CDC is a clone of the original. + // Both objects manipulate the one HDC + inline CDC& CDC::operator=(const CDC& rhs) + { + if (this != &rhs) + { + Release(); + m_pData = rhs.m_pData; + } + + return *this; + } + + inline CDC::~CDC () + { + Release(); + } + + // Returns the HDC assigned to this CDC. + inline HDC CDC::GetHDC() const + { + return m_pData->dc; + } + + // Attach and own the HDC. + inline void CDC::Assign(HDC object) + { + Attach(object); + m_pData->isManagedHDC = true; + } + + // Attaches a HDC to the CDC object. + inline void CDC::Attach(HDC dc) + { + assert(m_pData); + + if (m_pData && dc != m_pData->dc) + { + if (m_pData->dc) + { + Release(); + + // Assign values to our data members. + m_pData = std::make_shared(); + } + + if (dc != nullptr) + { + std::shared_ptr pCDCData = GetApp()->GetCDCData(dc).lock(); + if (pCDCData) + { + m_pData = std::move(pCDCData); + } + else + { + m_pData->dc = dc; + + // Add the CDC data to the map. + GetApp()->AddCDCDataToMap(dc, m_pData); + m_pData->savedDCState = SaveDC(); + } + } + } + } + + // Detaches the HDC from this CDC object and all its copies. + // The CDC object and its copies are returned to the default state. + // The detached HDC is left untouched. + // Note: We rarely need to detach the HDC from a CDC. The framework will + // release or delete the HDC automatically if required when the + // last copy of the CDC goes out of scope. + // Use Detach to keep changes made to the device context, such as + // when handling WM_CTLCOLORBTN, WM_CTLCOLOREDIT, WM_CTLCOLORDLG, + // WM_CTLCOLORLISTBOX, WM_CTLCOLORSCROLLBAR or WM_CTLCOLORSTATIC. + inline HDC CDC::Detach() + { + assert(m_pData); + assert(m_pData->dc != nullptr); + + HDC dc = m_pData->dc; + GetApp()->RemoveDCFromMap(dc); + + // Nullify all copies of m_pData. + *m_pData.get() = {}; + + // Make a new shared_ptr for this object. + m_pData = std::make_shared(); + + return dc; + } + + // Enumerates the pens or brushes available for the device context. This + // function calls the application-defined callback function once for each + // available object, supplying data describing that object. + // Refer to EnumObjects in the Windows API documentation for more information. + inline int CDC::EnumObjects(int objectType, GOBJENUMPROC pObjectFunc, + LPARAM lparam) const + { + assert(m_pData->dc != nullptr); + return ::EnumObjects(m_pData->dc, objectType, pObjectFunc, lparam); + } + + // Creates a memory device context (DC) compatible with the specified device. + // Refer to CreateCompatibleDC in the Windows API documentation for more information. + inline void CDC::CreateCompatibleDC(HDC hSource) + { + assert(m_pData->dc == nullptr); + HDC dc = ::CreateCompatibleDC(hSource); + + if (dc == nullptr) + throw CResourceException(GetApp()->MsgGdiDC()); + + Assign(dc); + } + + // Creates a device context (DC) for a device using the specified name. + // Refer to CreateDC in the Windows API documentation for more information. + inline void CDC::CreateDC(LPCTSTR driver, LPCTSTR device, LPCTSTR output, + const DEVMODE* pInitData) + { + assert(m_pData->dc == nullptr); + HDC dc = ::CreateDC(driver, device, output, pInitData); + + if (dc == nullptr) + throw CResourceException(GetApp()->MsgGdiDC()); + + Assign(dc); + } + + // Creates an information context for the specified device. The information + // context provides a fast way to get information about the device without + // creating a device context (DC). The GDI drawing functions however, cannot + // accept a handle to an information context. + // Refer to CreateIC in the Windows API documentation for more information. + inline void CDC::CreateIC(LPCTSTR driver, LPCTSTR device, LPCTSTR output, + const DEVMODE* pInitData) + { + assert(m_pData->dc == nullptr); + HDC dc = ::CreateIC(driver, device, output, pInitData); + + if (dc == nullptr) + throw CResourceException(GetApp()->MsgGdiIC()); + + Assign(dc); + } + + // Draws the specified bitmap to the specified DC using the mask color + // provided as the transparent colour. + // Suitable for use with a Window DC or a memory DC. + inline void CDC::DrawBitmap(int x, int y, int cx, int cy, HBITMAP bitmap, + COLORREF mask) const + { + // Create the Image memory DC + CMemDC imageDC(*this); + imageDC.SetBkColor(mask); + imageDC.SelectObject(bitmap); + + // Create the Mask memory DC + CMemDC maskDC(*this); + maskDC.CreateBitmap(cx, cy, 1, 1, nullptr); + maskDC.BitBlt(0, 0, cx, cy, imageDC, 0, 0, SRCCOPY); + + // Mask the image to 'this' DC + BitBlt(x, y, cx, cy, imageDC, 0, 0, SRCINVERT); + BitBlt(x, y, cx, cy, maskDC, 0, 0, SRCAND); + BitBlt(x, y, cx, cy, imageDC, 0, 0, SRCINVERT); + } + + // Fills the specified rectangle with a color gradient. + inline void CDC::GradientFill(COLORREF color1, COLORREF color2, RECT rc, + BOOL isVertical) const + { + SolidFill(color1, rc); + + TRIVERTEX vertex[2] = {}; + vertex[0].x = rc.left; + vertex[0].y = rc.top; + vertex[0].Red = COLOR16(GetRValue(color1) << 8); + vertex[0].Green = COLOR16(GetGValue(color1) << 8); + vertex[0].Blue = COLOR16(GetBValue(color1) << 8); + vertex[0].Alpha = 0; + + vertex[1].x = rc.right; + vertex[1].y = rc.bottom; + vertex[1].Red = COLOR16(GetRValue(color2) << 8); + vertex[1].Green = COLOR16(GetGValue(color2) << 8); + vertex[1].Blue = COLOR16(GetBValue(color2) << 8); + vertex[1].Alpha = 0; + + // Create a GRADIENT_RECT structure that + // references the TRIVERTEX vertices. + GRADIENT_RECT rect = {}; + rect.UpperLeft = 0; + rect.LowerRight = 1; + + // Draw a gradient filled rectangle. + const ULONG GradientFillRectH = 0x00000000; + const ULONG GradientFillRectV = 0x00000001; + ULONG mode = isVertical ? GradientFillRectV : GradientFillRectH; + GradientFill(vertex, 2, &rect, 1, mode); + } + + // Destroys m_pData if this is the only copy of the CDC object. + inline void CDC::Release() + { + assert(m_pData); + + if (m_pData.use_count() == 1) + { + Destroy(); + } + } + + // Restores a device context (DC) to the specified state. + // Refer to RestoreDC in the Windows API documentation for more information. + inline BOOL CDC::RestoreDC(int savedDC) const + { + assert(m_pData->dc != nullptr); + return ::RestoreDC(m_pData->dc, savedDC); + } + + // Saves the current state of the specified device context. + // Refer to SaveDC in the Windows API documentation for more information. + inline int CDC::SaveDC() const + { + assert(m_pData->dc != nullptr); + return ::SaveDC(m_pData->dc); + } + + // Select a bitmap into the device context. + // There is no need to select the old object back into the device context + // when SelectObject is used. + // Refer to SelectObject in the Windows API documentation for more information. + inline CBitmap CDC::SelectObject(HBITMAP bitmap) const + { + assert(m_pData->dc != nullptr); + CBitmap oldBitmap = static_cast(::SelectObject(m_pData->dc, bitmap)); + if (oldBitmap.GetHandle() == nullptr) + // throws if an error occurs (bitmap is invalid or incompatible). + throw CResourceException(GetApp()->MsgGdiSelObject()); + + m_pData->bitmap = bitmap; + return oldBitmap; + } + + // Select a brush into the device context. + // There is no need to select the old object back into the device context + // when SelectObject is used. + // Refer to SelectObject in the Windows API documentation for more information. + inline CBrush CDC::SelectObject(HBRUSH brush) const + { + assert(m_pData->dc != nullptr); + CBrush oldBrush = static_cast(::SelectObject(m_pData->dc, brush)); + if (oldBrush.GetHandle() == nullptr) + // throws if an error occurs. + throw CResourceException(GetApp()->MsgGdiSelObject()); + + m_pData->brush = brush; + return oldBrush; + } + + // Select a font into the device context. + // There is no need to select the old object back into the device context + // when SelectObject is used. + // Refer to SelectObject in the Windows API documentation for more information. + inline CFont CDC::SelectObject(HFONT font) const + { + assert(m_pData->dc != nullptr); + CFont oldFont = static_cast(::SelectObject(m_pData->dc, font)); + if (oldFont.GetHandle() == nullptr) + // throws if an error occurs. + throw CResourceException(GetApp()->MsgGdiSelObject()); + + m_pData->font = font; + return oldFont; + } + + // Select a pen into the device context. + // There is no need to select the old object back into the device context + // when SelectObject is used. + // Refer to SelectObject in the Windows API documentation for more information. + inline CPen CDC::SelectObject(HPEN pen) const + { + assert(m_pData->dc != nullptr); + CPen oldPen = static_cast(::SelectObject(m_pData->dc, pen)); + if (oldPen.GetHandle() == nullptr) + // throws if an error occurs. + throw CResourceException(GetApp()->MsgGdiSelObject()); + + m_pData->pen = pen; + return oldPen; + } + + // Select a region into the device context. + // The return value indicates the region's complexity: NULLREGION; + // SIMPLEREGION; or COMPLEXREGION. There is no need to select the old + // object back into the device context when SelectObject is used. + // Refer to SelectObject in the Windows API documentation for more information. + inline int CDC::SelectObject(HRGN rgn) const + { + assert(m_pData->dc != nullptr); + HANDLE rgnType = ::SelectObject(m_pData->dc, rgn); + if (rgnType == HGDI_ERROR || rgnType == nullptr) + // throws if an error occurs. + throw CResourceException(GetApp()->MsgGdiSelObject()); + + m_pData->rgn = rgn; + return static_cast (reinterpret_cast(rgnType)); + } + + // Select a palette into the device context. + // There is no need to select the old object back into the device context + // when SelectPalette is used. + // Refer to SelectPalette in the Windows API documentation for more information. + inline CPalette CDC::SelectPalette(const HPALETTE palette, BOOL forceBkgnd) const + { + assert(m_pData->dc != nullptr); + CPalette oldPalette = ::SelectPalette(m_pData->dc, palette, forceBkgnd); + if (oldPalette.GetHandle() == nullptr) + // throws if an error occurs. + throw CResourceException(GetApp()->MsgGdiSelObject()); + + m_pData->palette = palette; + return oldPalette; + } + + // Fills a rectangle with a solid color + inline void CDC::SolidFill(COLORREF color, RECT rc) const + { + COLORREF oldColor = SetBkColor(color); + VERIFY(ExtTextOut(0, 0, ETO_OPAQUE, rc, nullptr, 0, 0)); + SetBkColor(oldColor); + } + + ///////////////////////// + // Bitmap functions + + // Creates and selects a bitmap compatible with the specified device context. + // Refer to CreateCompatibleBitmap in the Windows API documentation for more information. + inline void CDC::CreateCompatibleBitmap(HDC dc, int cx, int cy) const + { + assert(m_pData->dc != nullptr); + + CBitmap bitmap; + bitmap.CreateCompatibleBitmap(dc, cx, cy); + SelectObject(bitmap); + } + + // Creates a bitmap and selects it into the device context. + // Refer to CreateBitmap in the Windows API documentation for more information. + inline void CDC::CreateBitmap(int cx, int cy, UINT planes, UINT bitsPerPixel, + LPCVOID pColors) const + { + assert(m_pData->dc != nullptr); + + CBitmap bitmap; + bitmap.CreateBitmap(cx, cy, planes, bitsPerPixel, pColors); + SelectObject(bitmap); + } + + // Creates a bitmap and selects it into the device context. + // Refer to CreateBitmapIndirect in the Windows API documentation for more information. + inline void CDC::CreateBitmapIndirect (const BITMAP& bitmap) const + { + assert(m_pData->dc != nullptr); + + CBitmap newBitmap; + newBitmap.CreateBitmapIndirect(bitmap); + SelectObject(newBitmap); + } + + // Creates a bitmap and selects it into the device context. + // A CBitmapInfoPtr object can be used for the LPBITMAPINFO parameter. + // Refer to CreateDIBitmap in the Windows API documentation for more information. + inline void CDC::CreateDIBitmap(HDC dc, const BITMAPINFOHEADER& bmih, DWORD init, + LPCVOID pInit, const LPBITMAPINFO pBMI, UINT flags) const + { + assert(m_pData->dc != nullptr); + + CBitmap newBitmap; + newBitmap.CreateDIBitmap(dc, &bmih, init, pInit, pBMI, flags); + SelectObject(newBitmap); + } + + // Creates a bitmap and selects it into the device context. + // A CBitmapInfoPtr object can be used for the LPBITMAPINFO parameter. + // Refer to CreateDIBSection in the Windows API documentation for more information. + inline void CDC::CreateDIBSection(HDC dc, const LPBITMAPINFO pBMI, UINT usage, + LPVOID* pBits, HANDLE hSection, DWORD offset) const + { + assert(m_pData->dc != nullptr); + + CBitmap newBitmap; + newBitmap.CreateDIBSection(dc, pBMI, usage, pBits, hSection, offset); + SelectObject(newBitmap); + } + + // Provides a convenient method of detaching a bitmap from a memory device context. + // Returns the CBitmap detached from the DC. + // Usage: CBitmap bitmap = memDC.DetachBitmap(); + inline CBitmap CDC::DetachBitmap() const + { + assert(m_pData->dc != nullptr); + + // Create a stock bitmap to replace the current one. + CBitmap bitmap; + bitmap.CreateBitmap(1, 1, 1, 1, 0); + + return SelectObject(bitmap); + } + + // Deletes or releases the device context if managed and returns this + // object to its default state. + inline void CDC::Destroy() + { + assert(m_pData); + + if (m_pData->dc != nullptr) + { + // Return the DC back to its initial state. + HDC dc = m_pData->dc; + ::RestoreDC(dc, m_pData->savedDCState); + + if (IsAppRunning()) // Is the CWinApp object still valid? + GetApp()->RemoveDCFromMap(dc); + + if (m_pData->isManagedHDC) + { + // We need to release a window DC, end a paint DC, + // and delete a memory DC. + if (m_pData->wnd != nullptr) + { + if (m_pData->isPaintDC) + ::EndPaint(m_pData->wnd, &m_pData->ps); + else + ::ReleaseDC(m_pData->wnd, dc); + } + else + ::DeleteDC(dc); + } + + // Nullify all copies of m_pData. + *m_pData.get() = {}; + } + } + + // Retrieves the BITMAP information for the current HBITMAP. + // Refer to GetObject in the Windows API documentation for more information. + inline BITMAP CDC::GetBitmapData() const + { + assert(m_pData->dc != nullptr); + + HBITMAP bitmap = (HBITMAP)::GetCurrentObject(m_pData->dc, OBJ_BITMAP); + BITMAP bitmapInfo = {}; + VERIFY(::GetObject(bitmap, sizeof(bitmapInfo), &bitmapInfo)); + return bitmapInfo; + } + + // Retrieves the currently selected bitmap. + // Refer to GetCurrentObject in the Windows API documentation for more information. + inline CBitmap CDC::GetCurrentBitmap() const + { + assert(m_pData->dc != nullptr); + return static_cast(::GetCurrentObject(m_pData->dc, OBJ_BITMAP)); + } + + // Loads a bitmap from the resource and selects it into the device context. + // Returns TRUE if successful. + // Refer to LoadBitmap in the Windows API documentation for more information. + inline BOOL CDC::LoadBitmap(UINT id) const + { + return LoadBitmap(MAKEINTRESOURCE(id)); + } + + // Loads a bitmap from the resource and selects it into the device context. + // Returns TRUE if successful. + // Refer to LoadBitmap in the Windows API documentation for more information. + inline BOOL CDC::LoadBitmap(LPCTSTR resourceName) const + { + assert(m_pData->dc != nullptr); + + CBitmap bitmap; + BOOL isLoaded = bitmap.LoadBitmap(resourceName); + + if (isLoaded) + { + SelectObject(bitmap); + } + + return isLoaded; + } + + // Loads a bitmap from the resource and selects it into the device context. + // The flags parameter can be one of LR_DEFAULTCOLOR, LR_CREATEDIBSECTION, + // LR_LOADFROMFILE, LR_LOADTRANSPARENT, LR_MONOCHROME, LR_SHARED and LR_VGACOLOR. + // Returns TRUE if successful. + // Refer to LoadImage in the Windows API documentation for more information. + inline BOOL CDC::LoadImage(UINT id, UINT flags) const + { + return LoadImage(MAKEINTRESOURCE(id), flags); + } + + // Loads a bitmap from the resource and selects it into the device context. + // The flags parameter can be one of LR_DEFAULTCOLOR, LR_CREATEDIBSECTION, + // LR_LOADFROMFILE, LR_LOADTRANSPARENT, LR_MONOCHROME, LR_SHARED and LR_VGACOLOR. + // Returns TRUE if successful. + // Refer to LoadImage in the Windows API documentation for more information. + inline BOOL CDC::LoadImage(LPCTSTR resourceName, UINT flags) const + { + assert(m_pData->dc != nullptr); + + CBitmap bitmap; + BOOL isLoaded = bitmap.LoadImage(resourceName, flags); + + if (isLoaded) + { + SelectObject(bitmap); + } + + return isLoaded; + } + + // Loads a bitmap from a resource using the resource ID. + // Refer to LoadImage in the Windows API documentation for more information. + inline BOOL CDC::LoadImage(UINT id, int cxDesired, int cyDesired, UINT flags) const + { + return LoadImage(MAKEINTRESOURCE(id), cxDesired, cyDesired, flags); + } + + // Loads a bitmap from a resource using the resource string. + // Refer to LoadImage in the Windows API documentation for more information. + inline BOOL CDC::LoadImage(LPCTSTR resourceName, int cxDesired, + int cyDesired, UINT flags) const + { + { + assert(m_pData->dc != nullptr); + + CBitmap bitmap; + BOOL isLoaded = bitmap.LoadImage(resourceName, cxDesired, cyDesired, flags); + + if (isLoaded) + { + SelectObject(bitmap); + } + + return isLoaded; + } + } + + // Loads a predefined system bitmap and selects it into the device context. + // Returns TRUE if successful. + // Refer to LoadBitmap in the Windows API documentation for more information. + inline BOOL CDC::LoadOEMBitmap(UINT bitmapID) const // for OBM_/OCR_/OIC_ + { + assert(m_pData->dc != nullptr); + + CBitmap bitmap; + BOOL isLoaded = bitmap.LoadOEMBitmap(bitmapID); + + if (isLoaded) + { + SelectObject(bitmap); + } + + return isLoaded; + } + + // Creates and selects a new bitmap using the bitmap data and colors specified by + // the bitmap resource and the color mapping information. + // Refer to CreateMappedBitmap in the Windows API documentation for more information. + inline void CDC::CreateMappedBitmap(UINT bitmapID, UINT flags /*= 0*/, + LPCOLORMAP pColorMap /*= nullptr*/, int mapSize /*= 0*/) const + { + assert(m_pData->dc != nullptr); + + CBitmap bitmap; + bitmap.CreateMappedBitmap(bitmapID, static_cast(flags), pColorMap, mapSize); + SelectObject(bitmap); + } + + /////////////////// + // Brush functions. + + // Creates the brush with the specified pattern, and selects it into the device context. + // Refer to CreatePatternBrush in the Windows API documentation for more information. + inline void CDC::CreatePatternBrush(HBITMAP bitmap) const + { + assert(m_pData->dc != nullptr); + + CBrush brush; + brush.CreatePatternBrush(bitmap); + SelectObject(brush); + } + + // Creates the brush with the specified color, and selects it into the device context. + // Refer to CreateSolidBrush in the Windows API documentation for more information. + inline void CDC::CreateSolidBrush(COLORREF color) const + { + assert(m_pData->dc != nullptr); + + CBrush brush; + brush.CreateSolidBrush(color); + SelectObject(brush); + } + + // Retrieves the currently selected brush object. + // Refer to GetCurrentObject in the Windows API documentation for more information. + inline CBrush CDC::GetCurrentBrush() const + { + assert(m_pData->dc != nullptr); + return static_cast(::GetCurrentObject(m_pData->dc, OBJ_BRUSH)); + } + + // Retrieves the current brush information + // Refer to GetObject in the Windows API documentation for more information. + inline LOGBRUSH CDC::GetLogBrush() const + { + assert(m_pData->dc != nullptr); + + HBRUSH brush = static_cast(::GetCurrentObject(m_pData->dc, OBJ_BRUSH)); + LOGBRUSH logBrush = {}; + VERIFY(::GetObject(brush, sizeof(logBrush), &logBrush)); + return logBrush; + } + + // Creates the brush and selects it into the device context. + // Refer to CreateBrushIndirect in the Windows API documentation for more information. + inline void CDC::CreateBrushIndirect(LOGBRUSH logBrush) const + { + assert(m_pData->dc != nullptr); + + CBrush brush; + brush.CreateBrushIndirect(logBrush); + SelectObject(brush); + } + + // Creates a brush with the specified hatch pattern and color, and selects + // it into the device context. + // Refer to CreateHatchBrush in the Windows API documentation for more information. + inline void CDC::CreateHatchBrush(int style, COLORREF color) const + { + assert(m_pData->dc != nullptr); + + CBrush brush; + brush.CreateHatchBrush(style, color); + SelectObject(brush); + } + + // Creates a logical from the specified device-independent bitmap (DIB), + // and selects it into the device context. + // Refer to CreateDIBPatternBrush in the Windows API documentation for more information. + inline void CDC::CreateDIBPatternBrush(HGLOBAL hDIBPacked, UINT colorSpec) const + { + assert(m_pData->dc != nullptr); + + CBrush brush; + brush.CreateDIBPatternBrush(hDIBPacked, colorSpec); + SelectObject(brush); + } + + // Creates a logical from the specified device-independent bitmap (DIB), + // and selects it into the device context. + // Refer to CreateDIBPatternBrushPt in the Windows API documentation for more information. + inline void CDC::CreateDIBPatternBrushPt(LPCVOID pPackedDIB, UINT usage) const + { + assert(m_pData->dc != nullptr); + + CBrush brush; + brush.CreateDIBPatternBrushPt(pPackedDIB, usage); + SelectObject(brush); + } + + // Retrieves the current brush origin for the specified device context. + // Refer to GetBrushOrgEx in the Windows API documentation for more information. + inline CPoint CDC::GetBrushOrgEx() const + { + assert(m_pData->dc != nullptr); + CPoint pt; + VERIFY(::GetBrushOrgEx(m_pData->dc, &pt)); + return pt; + } + + + // Sets the brush origin that GDI assigns to the next brush an application + // selects into the specified device context. Returns the old brush origin. + // Refer to SetBrushOrgEx in the Windows API documentation for more information. + inline CPoint CDC::SetBrushOrgEx(int x, int y) + { + assert(m_pData->dc != nullptr); + CPoint oldPt; + VERIFY(::SetBrushOrgEx(m_pData->dc, x, y, &oldPt)); + return oldPt; + } + + + ////////////////// + // Font functions. + + // Creates a logical font and selects it into the device context. + // Refer to CreateFontIndirect in the Windows API documentation for more information. + inline void CDC::CreateFontIndirect(const LOGFONT& lf) const + { + assert(m_pData->dc != nullptr); + + CFont font; + font.CreateFontIndirect(lf); + SelectObject(font); + } + + // Creates a font of a specified typeface and point size and selects it + // into the device context. + // Refer to CreateFontIndirect in the Windows API documentation for more information. + inline void CDC::CreatePointFont(int pointSize, LPCTSTR faceName, HDC dc /*= nullptr*/, + BOOL isBold /*= FALSE*/, BOOL isItalic /*= FALSE*/) const + { + assert(m_pData->dc != nullptr); + + CFont font; + font.CreatePointFont(pointSize, faceName, dc, isBold, isItalic); + SelectObject(font); + } + + // Creates a font of a specified typeface and point size. + // This function automatically converts the height in lfHeight to logical + // units using the specified device context. + // Refer to CreateFontIndirect in the Windows API documentation for more information. + inline void CDC::CreatePointFontIndirect(const LOGFONT& logFont, HDC dc) const + { + assert(m_pData->dc != nullptr); + + CFont font; + font.CreatePointFontIndirect(logFont, dc); + SelectObject(font); + } + + // Retrieves the currently selected font. + // Refer to GetCurrentObject in the Windows API documentation for more information. + inline CFont CDC::GetCurrentFont() const + { + assert(m_pData->dc != nullptr); + return static_cast(::GetCurrentObject(m_pData->dc, OBJ_FONT)); + } + + // Retrieves the current font information. + // Refer to GetObject in the Windows API documentation for more information. + inline LOGFONT CDC::GetLogFont() const + { + assert(m_pData->dc != nullptr); + + HFONT font = static_cast(::GetCurrentObject(m_pData->dc, OBJ_FONT)); + LOGFONT logFont = {}; + VERIFY(::GetObject(font, sizeof(logFont), &logFont)); + return logFont; + } + + // Creates a logical font with the specified characteristics. + // Refer to CreateFont in the Windows API documentation for more information. + inline void CDC::CreateFont ( + int height, // height of font + int width, // average character width + int escapement, // angle of escapement + int orientation, // base-line orientation angle + int weight, // font weight + DWORD italic, // italic attribute option + DWORD underline, // underline attribute option + DWORD strikeOut, // strikeout attribute option + DWORD charSet, // character set identifier + DWORD outputPrecision, // output precision + DWORD clipPrecision, // clipping precision + DWORD quality, // output quality + DWORD pitchAndFamily, // pitch and family + LPCTSTR faceName // typeface name + ) const + + { + assert(m_pData->dc != nullptr); + + CFont font; + font.CreateFont(height, width, escapement, orientation, weight, + italic, underline, strikeOut, charSet, outputPrecision, + clipPrecision, quality, pitchAndFamily, faceName); + + SelectObject(font); + } + + + ///////////////////// + // Palette functions. + + // Creates and selects a palette. + // Refer to CreatePalette in the Windows API documentation for more information. + inline void CDC::CreatePalette(LPLOGPALETTE pLogPalette, BOOL forceBkgnd) const + { + assert(m_pData->dc != nullptr); + + CPalette palette; + palette.CreatePalette(pLogPalette); + SelectPalette(palette, forceBkgnd); + RealizePalette(); + } + + // Retrieves the currently selected palette. + // Refer to GetCurrentObject in the Windows API documentation for more information. + inline CPalette CDC::GetCurrentPalette() const + { + assert(m_pData->dc != nullptr); + return static_cast(::GetCurrentObject(m_pData->dc, OBJ_PAL)); + } + + // Retrieves a color value identifying a color from the system palette that + // will be displayed when the specified color value is used. + // Refer to GetNearestColor in the Windows API documentation for more information. + inline COLORREF CDC::GetNearestColor(COLORREF color) const + { + assert(m_pData->dc != nullptr); + return ::GetNearestColor(m_pData->dc, color); + } + + // Use this to realize changes to the device context palette. + // Refer to RealizePalette in the Windows API documentation for more information. + inline UINT CDC::RealizePalette() const + { + assert(m_pData->dc != nullptr); + return ::RealizePalette(m_pData->dc); + } + + // Creates and selects halftone palette. + // Refer to CreateHalftonePalette in the Windows API documentation for more information. + inline void CDC::CreateHalftonePalette(BOOL forceBkgnd) const + { + assert(m_pData->dc != nullptr); + + CPalette palette; + palette.CreateHalftonePalette(*this); + SelectPalette(palette, forceBkgnd); + RealizePalette(); + } + + // Retrieves the color adjustment values for the device context. + // Refer to GetColorAdjustment in the Windows API documentation for more information. + inline BOOL CDC::GetColorAdjustment(LPCOLORADJUSTMENT pCA) const + { + assert(m_pData->dc != nullptr); + return ::GetColorAdjustment(m_pData->dc, pCA); + } + + // Sets the color adjustment values for the device context. + // Refer to SetColorAdjustment in the Windows API documentation for more information. + inline BOOL CDC::SetColorAdjustment(const COLORADJUSTMENT* pCA) const + { + assert(m_pData->dc != nullptr); + return ::SetColorAdjustment(m_pData->dc, pCA); + } + + // Updates the client area of the specified device context by remapping the + // current colors in the client area to the currently realized logical palette. + // Refer to UpdateColors in the Windows API documentation for more information. + inline BOOL CDC::UpdateColors() const + { + assert(m_pData->dc != nullptr); + return ::UpdateColors(m_pData->dc); + } + + + ///////////////// + // Pen functions. + + // Creates the pen and selects it into the device context. + // Refer to CreatePen in the Windows API documentation for more information. + inline void CDC::CreatePen (int style, int width, COLORREF color) const + { + assert(m_pData->dc != nullptr); + + CPen pen; + pen.CreatePen(style, width, color); + SelectObject(pen); + } + + // Creates the pen and selects it into the device context. + // Refer to CreatePenIndirect in the Windows API documentation for more information. + inline void CDC::CreatePenIndirect (LOGPEN logPen) const + { + assert(m_pData->dc != nullptr); + + CPen pen; + pen.CreatePenIndirect(logPen); + SelectObject(pen); + } + + // Creates a logical cosmetic or geometric pen that has the specified + // style, width, and brush attributes. + // Refer to ExtCreatePen in the Windows API documentation for more information. + inline void CDC::ExtCreatePen(int penStyle, int width, LOGBRUSH logBrush, + int styleCount , const DWORD* pStyle) const + { + assert(m_pData->dc != nullptr); + + CPen pen; + pen.ExtCreatePen(penStyle, width, logBrush, styleCount, pStyle); + SelectObject(pen); + } + + // Retrieves the currently selected pen. + // Refer to GetCurrentObject in the Windows API documentation for more information. + inline CPen CDC::GetCurrentPen() const + { + assert(m_pData->dc != nullptr); + return static_cast(::GetCurrentObject(m_pData->dc, OBJ_PEN)); + } + + // Retrieves the current pen information as a LOGPEN. + // Refer to GetObject in the Windows API documentation for more information. + inline LOGPEN CDC::GetLogPen() const + { + assert(m_pData->dc != nullptr); + + HPEN pen = static_cast(::GetCurrentObject(m_pData->dc, OBJ_PEN)); + LOGPEN logPen = {}; + VERIFY(::GetObject(pen, sizeof(logPen), &logPen)); + return logPen; + } + + //////////////////////////////////// + // Retrieve and Select Stock Objects + + // Retrieves a stock brush, pen, or font. + // index values: BLACK_BRUSH, DKGRAY_BRUSH, DC_BRUSH, HOLLOW_BRUSH, + // LTGRAY_BRUSH, NULL_BRUSH, WHITE_BRUSH, BLACK_PEN, DC_PEN, + // ANSI_FIXED_FONT, ANSI_VAR_FONT, DEVICE_DEFAULT_FONT, + // DEFAULT_GUI_FONT, OEM_FIXED_FONT, SYSTEM_FONT, + // or SYSTEM_FIXED_FONT. + // Refer to GetStockObject in the Windows API documentation for more information. + inline HGDIOBJ CDC::GetStockObject(int index) const + { + return ::GetStockObject(index); + } + + // Selects a stock brush, pen, or font into the device context. + // index values: BLACK_BRUSH, DKGRAY_BRUSH, DC_BRUSH, HOLLOW_BRUSH, + // LTGRAY_BRUSH, NULL_BRUSH, WHITE_BRUSH, BLACK_PEN, DC_PEN, + // ANSI_FIXED_FONT, ANSI_VAR_FONT, DEVICE_DEFAULT_FONT, + // DEFAULT_GUI_FONT, OEM_FIXED_FONT, SYSTEM_FONT, + // or SYSTEM_FIXED_FONT. + // Refer to GetStockObject in the Windows API documentation for more information. + inline HGDIOBJ CDC::SelectStockObject(int index) const + { + assert(m_pData->dc != nullptr); + HGDIOBJ stockObject = ::GetStockObject(index); + + HGDIOBJ oldObject = ::SelectObject(m_pData->dc, stockObject); + if (oldObject == nullptr) + throw CResourceException(GetApp()->MsgGdiSelObject()); + + return oldObject; + } + + + //////////////////// + // Region functions. + + // Creates a rectangular region from the rectangle co-ordinates. + // The return value specifies the region's complexity: NULLREGION; + // SIMPLEREGION; COMPLEXREGION; or ERROR. + // Refer to CreateRectRgn in the Windows API documentation for more information. + inline int CDC::CreateRectRgn(int left, int top, int right, int bottom) const + { + assert(m_pData->dc != nullptr); + + CRgn rgn; + rgn.CreateRectRgn(left, top, right, bottom); + int Complexity = SelectClipRgn(rgn); + return Complexity; + } + + // Creates a rectangular region from the rectangle co-ordinates. + // The return value specifies the region's complexity: NULLREGION; + // SIMPLEREGION; COMPLEXREGION; or ERROR. + // Refer to CreateRectRgnIndirect in the Windows API documentation for more information. + inline int CDC::CreateRectRgnIndirect(RECT rc) const + { + assert(m_pData->dc != nullptr); + + CRgn rgn; + rgn.CreateRectRgnIndirect(rc); + int Complexity = SelectClipRgn(rgn); + return Complexity; + } + + // Creates a region from the specified region data and transformation data. + // The return value specifies the region's complexity: NULLREGION;S + // IMPLEREGION; COMPLEXREGION; or ERROR. + // Notes: GetRegionData can be used to get a region's data. + // If the XFROM pointer is nullptr, the identity transformation is used. + // Refer to ExtCreateRegion in the Windows API documentation for more information. + inline int CDC::CreateRgnFromData(const XFORM* pXform, int count, const RGNDATA* pRgnData) const + { + assert(m_pData->dc != nullptr); + + CRgn rgn; + rgn.CreateFromData(pXform, count, pRgnData); + int Complexity = SelectClipRgn(rgn); + return Complexity; + } + + // Creates the elliptical region from the bounding rectangle co-ordinates, + // and selects it into the device context. + // The return value specifies the region's complexity: NULLREGION; + // SIMPLEREGION; COMPLEXREGION; or ERROR. + // Refer to CreateEllipticRgn in the Windows API documentation for more information. + inline int CDC::CreateEllipticRgn(int left, int top, int right, int bottom) const + { + assert(m_pData->dc != nullptr); + + CRgn rgn; + rgn.CreateEllipticRgn(left, top, right, bottom); + int Complexity = SelectClipRgn(rgn); + return Complexity; + } + + // Creates the elliptical region from the bounding rectangle co-ordinates. + // and selects it into the device context. + // The return value specifies the region's complexity: NULLREGION; + // SIMPLEREGION; COMPLEXREGION; or ERROR. + // Refer to CreateEllipticRgnIndirect in the Windows API documentation for more information. + inline int CDC::CreateEllipticRgnIndirect(RECT rc) const + { + assert(m_pData->dc != nullptr); + + CRgn rgn; + rgn.CreateEllipticRgnIndirect(rc); + int Complexity = SelectClipRgn(rgn); + m_pData->rgn = rgn; + return Complexity; + } + + // Creates the polygon region from the array of points and selects it into + // the device context. The polygon is presumed closed. + // The return value specifies the region's complexity: NULLREGION; + // SIMPLEREGION; COMPLEXREGION; or ERROR. + // Refer to CreatePolygonRgn in the Windows API documentation for more information. + inline int CDC::CreatePolygonRgn(LPPOINT pPointArray, int points, int polyFillMode) const + { + assert(m_pData->dc != nullptr); + + CRgn rgn; + rgn.CreatePolygonRgn(pPointArray, points, polyFillMode); + int Complexity = SelectClipRgn(rgn); + return Complexity; + } + + // Creates the polygon region from a series of polygons.The polygons can overlap. + // The return value specifies the region's complexity: NULLREGION; + // SIMPLEREGION; COMPLEXREGION; or ERROR. + // Refer to CreatePolyPolygonRgn in the Windows API documentation for more information. + inline int CDC::CreatePolyPolygonRgn(LPPOINT pPointArray, LPINT pCount, int count, int polyFillMode) const + { + assert(m_pData->dc != nullptr); + + CRgn rgn; + rgn.CreatePolyPolygonRgn(pPointArray, pCount, count, polyFillMode); + int Complexity = SelectClipRgn(rgn); + m_pData->rgn = rgn; + return Complexity; + } + + // Creates a region from the path that is selected into the specified + // device context. The resulting region uses device coordinates. + // Refer to PathToRegion in the Windows API documentation for more information. + inline int CDC::CreateRgnFromPath(HDC dc) const + { + assert(m_pData->dc != nullptr); + + CRgn rgn; + rgn.CreateFromPath(dc); + int Complexity = SelectClipRgn(rgn); + return Complexity; + } + + // Creates a rectangular region with rounded corners. + // Refer to CreateRoundRectRgn in the Windows API documentation for more information. + inline int CDC::CreateRoundRectRgn(int x1, int y1, int x2, int y2, int x3, int y3) const + { + assert(m_pData->dc != nullptr); + + CRgn rgn; + rgn.CreateRoundRectRgn(x1, y1, x2, y2, x3, y3); + int Complexity = SelectClipRgn(rgn); + return Complexity; + } + + + ///////////////////////////////// + // Wrappers for WinAPI functions. + + + // Retrieves device-specific information for the specified device. + // Refer to GetDeviceCaps in the Windows API documentation for more information. + inline int CDC::GetDeviceCaps (int index) const + { + assert(m_pData->dc != nullptr); + return ::GetDeviceCaps(m_pData->dc, index); + } + + /////////////////// + // Brush functions. + + // Retrieves the current brush color from the device context. + // Refer to GetDCBrushColor in the Windows API documentation for more information. + inline COLORREF CDC::GetDCBrushColor() const + { + assert(m_pData->dc != nullptr); + return ::GetDCBrushColor(m_pData->dc); + } + + // Sets the current brush color for the device context. + // Refer to SetDCBrushColor in the Windows API documentation for more information. + inline COLORREF CDC::SetDCBrushColor(COLORREF color) const + { + assert(m_pData->dc != nullptr); + return ::SetDCBrushColor(m_pData->dc, color); + } + + + ////////////////// + // Font Functions. + + + // Retrieves font metric data for a TrueType font. + // Refer to GetFontData in the Windows API documentation for more information. + inline DWORD CDC::GetFontData(DWORD table, DWORD offset, LPVOID buffer, DWORD data) const + { + assert(m_pData->dc != nullptr); + return ::GetFontData(m_pData->dc, table, offset, buffer, data); + } + + // Returns information about the currently selected font for the display context. + // Refer to GetFontLanguageInfo in the Windows API documentation for more information. + inline DWORD CDC::GetFontLanguageInfo() const + { + assert(m_pData->dc != nullptr); + return ::GetFontLanguageInfo(m_pData->dc); + } + + // Retrieves the outline or bitmap for a character in the TrueType font + // that is selected into the device context. + // Refer to GetGlyphOutline in the Windows API documentation for more information. + inline DWORD CDC::GetGlyphOutline(UINT query, UINT format, + LPGLYPHMETRICS pGM, DWORD bufSize,LPVOID buffer, + const MAT2* pMAT2) const + { + assert(m_pData->dc != nullptr); + return ::GetGlyphOutline(m_pData->dc, query, format, pGM, bufSize, buffer, pMAT2); + } + + // Retrieves the character-kerning pairs for the currently selected font + // for the device context. + // Refer to GetKerningPairs in the Windows API documentation for more information. + inline DWORD CDC::GetKerningPairs(DWORD numPairs, LPKERNINGPAIR pKrnPair) const + { + assert(m_pData->dc != nullptr); + return ::GetKerningPairs(m_pData->dc, numPairs, pKrnPair); + } + + // Alters the algorithm the font mapper uses when it maps logical fonts + // to physical fonts. + // Refer to SetMapperFlags in the Windows API documentation for more information. + inline DWORD CDC::SetMapperFlags(DWORD flag) const + { + assert(m_pData->dc != nullptr); + return ::SetMapperFlags(m_pData->dc, flag); + } + + // Retrieves the miter limit for the device context. The miter limit is + // used when drawing geometric lines that have miter joins. + // Refer to GetMiterLimit in the Windows API documentation for more information. + inline BOOL CDC::GetMiterLimit(PFLOAT pLimit) const + { + assert(m_pData->dc != nullptr); + return ::GetMiterLimit(m_pData->dc, pLimit); + } + + // Sets the limit for the length of miter joins for the device context. + // Refer to SetMiterLimit in the Windows API documentation for more information. + inline BOOL CDC::SetMiterLimit(FLOAT newLimit, PFLOAT pOldLimit) const + { + assert(m_pData->dc != nullptr); + return ::SetMiterLimit(m_pData->dc, newLimit, pOldLimit); + } + + + ////////////////////// + // Clipping functions. + + + // Creates a new clipping region that consists of the existing clipping + // region minus the specified rectangle. + // Refer to ExcludeClipRect in the Windows API documentation for more information. + inline int CDC::ExcludeClipRect(int left, int top, int right, int bottom) const + { + assert(m_pData->dc != nullptr); + return ::ExcludeClipRect(m_pData->dc, left, top, right, bottom); + } + + // Creates a new clipping region that consists of the existing clipping + // region minus the specified rectangle. + // Refer to ExcludeClipRect in the Windows API documentation for more information. + inline int CDC::ExcludeClipRect(RECT rc) const + { + assert(m_pData->dc != nullptr); + return ::ExcludeClipRect(m_pData->dc, rc.left, rc.top, rc.right, rc.bottom); + } + + // Retrieves the dimensions of the tightest bounding rectangle that can be + // drawn around the current visible area on the device. + // Refer to GetClipBox in the Windows API documentation for more information. + inline int CDC::GetClipBox (RECT& rc) const + { + assert(m_pData->dc != nullptr); + return ::GetClipBox(m_pData->dc, &rc); + } + + // Creates a new clipping region from the intersection of the current + // clipping region and the specified rectangle. + // Refer to IntersectClipRect in the Windows API documentation for more information. + inline int CDC::IntersectClipRect(int left, int top, int right, int bottom) const + { + assert(m_pData->dc != nullptr); + return ::IntersectClipRect(m_pData->dc, left, top, right, bottom); + } + + // Creates a new clipping region from the intersection of the current + // clipping region and the specified rectangle. + // Refer to IntersectClipRect in the Windows API documentation for more information. + inline int CDC::IntersectClipRect(RECT rc) const + { + assert(m_pData->dc != nullptr); + return ::IntersectClipRect(m_pData->dc, rc.left, rc.top, rc.right, rc.bottom); + } + + // Determines whether any part of the specified rectangle lies within the + // clipping region of a device context. + // Refer to RectVisible in the Windows API documentation for more information. + inline BOOL CDC::RectVisible(RECT rc) const + { + assert(m_pData->dc != nullptr); + return ::RectVisible (m_pData->dc, &rc); + } + + // Selects a region as the current clipping region for the specified device + // context. + // Note: Only a copy of the selected region is used. + // To remove a device-context's clipping region, specify a nullptr + // region handle. + // Refer to SelectClipRgn in the Windows API documentation for more information. + inline int CDC::SelectClipRgn(HRGN rgn) const + { + assert(m_pData->dc != nullptr); + int rgnType = ::SelectClipRgn(m_pData->dc, rgn); + if (rgnType == ERROR) + // throws if an error occurs. + throw CResourceException(GetApp()->MsgGdiSelObject()); + + return rgnType; + } + + // The AbortPath function closes and discards any paths in the specified + // device context. + // Refer to AbortPath in the Windows API documentation for more information. + inline BOOL CDC::AbortPath() const + { + assert(m_pData->dc != nullptr); + return ::AbortPath(m_pData->dc); + } + + // Opens a path bracket in the device context. + // Refer to BeginPath in the Windows API documentation for more information. + inline BOOL CDC::BeginPath() const + { + assert(m_pData->dc != nullptr); + return ::BeginPath(m_pData->dc); + } + + // Closes a path bracket and selects the path defined by the bracket into + // the device context. + // Refer to EndPath in the Windows API documentation for more information. + inline BOOL CDC::EndPath() const + { + assert(m_pData->dc != nullptr); + return ::EndPath(m_pData->dc); + } + + // Combines the specified region with the current clipping region using the + // specified mode. + // Refer to ExtSelectClipRgn in the Windows API documentation for more information. + inline int CDC::ExtSelectClipRgn(HRGN rgn, int mode) const + { + assert(m_pData->dc != nullptr); + int rgnType = ::ExtSelectClipRgn(m_pData->dc, rgn, mode); + if (rgnType == ERROR) + // throws if an error occurs. + throw CResourceException(GetApp()->MsgGdiSelObject()); + + return rgnType; + } + + // Transforms any curves in the path that is selected into the device + // context, turning each curve into a sequence of lines. + // Refer to FlattenPath in the Windows API documentation for more information. + inline BOOL CDC::FlattenPath() const + { + assert(m_pData->dc != nullptr); + return ::FlattenPath(m_pData->dc); + } + + // Retrieves the coordinates defining the endpoints of lines and the + // control points of curves found in the path that is selected into + // the device context. + // pointArray: An array of POINT structures that receives the line + // endpoints and curve control points, in logical coordinates. + // types: Pointer to an array of bytes that receives the vertex types + // (PT_MOVETO, PT_LINETO or PT_BEZIERTO). + // count: The total number of POINT structures that can be stored in the + // array pointed to by pPoints. + // Refer to GetPath in the Windows API documentation for more information. + inline int CDC::GetPath(POINT* pointArray, BYTE* types, int count) const + { + assert(m_pData->dc != nullptr); + return ::GetPath(m_pData->dc, pointArray, types, count); + } + + // Determines whether the specified point is within the clipping region of + // a device context. + // Refer to PtVisible in the Windows API documentation for more information. + inline BOOL CDC::PtVisible(int x, int y) const + { + assert(m_pData->dc != nullptr); + return ::PtVisible (m_pData->dc, x, y); + } + + // Moves the clipping region of a device context by the specified offsets. + // Refer to OffsetClipRgn in the Windows API documentation for more information. + inline int CDC::OffsetClipRgn(int xOffset, int yOffset) const + { + assert(m_pData->dc != nullptr); + return ::OffsetClipRgn (m_pData->dc, xOffset, yOffset); + } + + // Selects the current path as a clipping region for the device context, + // combining the new region with any existing clipping region using the + // specified mode. + // Refer to SelectClipPath in the Windows API documentation for more information. + inline BOOL CDC::SelectClipPath(int mode) const + { + assert(m_pData->dc != nullptr); + return ::SelectClipPath(m_pData->dc, mode); + } + + // The StrokeAndFillPath function closes any open figures in a path, + // strokes the outline of the path by using the current pen, and fills + // its interior by using the current brush. + // Refer to StrokeAndFillPath in the Windows API documentation for more information. + inline BOOL CDC::StrokeAndFillPath() const + { + assert(m_pData->dc != nullptr); + return ::StrokeAndFillPath(m_pData->dc); + } + + // The StrokePath function renders the specified path by using the current + // pen. + // Refer to StrokePath in the Windows API documentation for more information. + inline BOOL CDC::StrokePath() const + { + assert(m_pData->dc != nullptr); + return ::StrokePath(m_pData->dc); + } + + // Redefines the current path as the area that would be painted if the path + // were stroked using the pen currently selected into the device context. + // Refer to WidenPath in the Windows API documentation for more information. + inline BOOL CDC::WidenPath() const + { + assert(m_pData->dc != nullptr); + return ::WidenPath(m_pData->dc); + } + + + //////////////////////////////////// + // Point and Line Drawing Functions. + + + // Returns the current position in logical coordinates. + // Refer to GetCurrentPositionEx in the Windows API documentation for more information. + inline CPoint CDC::GetCurrentPosition() const + { + assert(m_pData->dc != nullptr); + CPoint pt; + VERIFY(::GetCurrentPositionEx(m_pData->dc, &pt)); + return pt; + } + + // Retrieves the red, green, blue (RGB) color value of the pixel at the + // specified coordinates. + // Refer to GetPixel in the Windows API documentation for more information. + inline COLORREF CDC::GetPixel(int x, int y) const + { + assert(m_pData->dc != nullptr); + return ::GetPixel(m_pData->dc, x, y); + } + + // Retrieves the red, green, blue (RGB) color value of the pixel at the + // specified coordinates. + // Refer to GetPixel in the Windows API documentation for more information. + inline COLORREF CDC::GetPixel(POINT pt) const + { + assert(m_pData->dc != nullptr); + return ::GetPixel(m_pData->dc, pt.x, pt.y); + } + + // Updates the current position to the specified point. + // Refer to MoveToEx in the Windows API documentation for more information. + inline CPoint CDC::MoveTo(int x, int y) const + { + assert(m_pData->dc != nullptr); + CPoint previous; + ::MoveToEx(m_pData->dc, x, y, &previous); + return previous; + } + + // Updates the current position to the specified point + // Refer to MoveToEx in the Windows API documentation for more information. + inline CPoint CDC::MoveTo(POINT pt) const + { + assert(m_pData->dc != nullptr); + CPoint previous; + ::MoveToEx(m_pData->dc, pt.x, pt.y, &previous); + return previous; + } + + // Draws a line from the current position up to, but not including, the + // specified point. + // Refer to LineTo in the Windows API documentation for more information. + inline BOOL CDC::LineTo(int x, int y) const + { + assert(m_pData->dc != nullptr); + return ::LineTo(m_pData->dc, x, y); + } + + // Draws a line from the current position up to, but not including, the + // specified point. + // Refer to LineTo in the Windows API documentation for more information. + inline BOOL CDC::LineTo(POINT pt) const + { + assert(m_pData->dc != nullptr); + return ::LineTo(m_pData->dc, pt.x, pt.y); + } + + // Sets the current foreground mix mode. GDI uses the foreground mix mode + // to combine pens and interiors of filled objects with the colors already + // on the screen. + // Refer to SetROP2 in the Windows API documentation for more information. + inline int CDC::SetROP2(int drawMode) const + { + assert(m_pData->dc != nullptr); + return ::SetROP2(m_pData->dc, drawMode); + } + + // Sets the pixel at the specified coordinates to the specified color. + // Refer to SetPixel in the Windows API documentation for more information. + inline COLORREF CDC::SetPixel (int x, int y, COLORREF color) const + { + assert(m_pData->dc != nullptr); + return ::SetPixel(m_pData->dc, x, y, color); + } + + // Draws an elliptical arc. + // Refer to Arc in the Windows API documentation for more information. + inline BOOL CDC::Arc(int x1, int y1, int x2, int y2, int x3, int y3, + int x4, int y4) const + { + assert(m_pData->dc != nullptr); + return ::Arc(m_pData->dc, x1, y1, x2, y2, x3, y3, x4, y4); + } + + // Draws an elliptical arc. + // Refer to Arc in the Windows API documentation for more information. + inline BOOL CDC::Arc(RECT rc, POINT start, POINT end) const + { + assert(m_pData->dc != nullptr); + return ::Arc(m_pData->dc, rc.left, rc.top, rc.right, rc.bottom, + start.x, start.y, end.x, end.y); + } + + // Draws an elliptical arc. + // Refer to ArcTo in the Windows API documentation for more information. + inline BOOL CDC::ArcTo(int x1, int y1, int x2, int y2, int x3, int y3, + int x4, int y4) const + { + assert(m_pData->dc != nullptr); + return ::ArcTo(m_pData->dc, x1, y1, x2, y2, x3, y3, x4, y4); + } + + // Draws an elliptical arc. + // Refer to ArcTo in the Windows API documentation for more information. + inline BOOL CDC::ArcTo(RECT rc, POINT ptStart, POINT ptEnd) const + { + assert(m_pData->dc != nullptr); + return ::ArcTo (m_pData->dc, rc.left, rc.top, rc.right, rc.bottom, + ptStart.x, ptStart.y, ptEnd.x, ptEnd.y); + } + + // Draws a line segment and an arc. + // Refer to AngleArc in the Windows API documentation for more information. + inline BOOL CDC::AngleArc(int x, int y, int radius, float startAngle, + float sweepAngle) const + { + assert(m_pData->dc != nullptr); + return ::AngleArc(m_pData->dc, x, y, static_cast(radius), + startAngle, sweepAngle); + } + + // Closes the figure by drawing a line from the current position to the + // first point of the figure. + // Refer to CloseFigure in the Windows API documentation for more information. + inline BOOL CDC::CloseFigure() const + { + assert(m_pData->dc != nullptr); + return ::CloseFigure(m_pData->dc); + } + + // Retrieves the foreground mix mode of the specified device context. The + // mix mode specifies how the pen or interior color and the color already + // on the screen are combined to yield a new color. + // Refer to GetROP2 in the Windows API documentation for more information. + inline int CDC::GetROP2() const + { + assert(m_pData->dc != nullptr); + return ::GetROP2(m_pData->dc); + } + + // Retrieves the current arc direction (AD_COUNTERCLOCKWISE or AD_CLOCKWISE). + // Refer to GetArcDirection in the Windows API documentation for more information. + inline int CDC::GetArcDirection() const + { + assert(m_pData->dc != nullptr); + return ::GetArcDirection(m_pData->dc); + } + + // Sets the current arc direction (AD_COUNTERCLOCKWISE or AD_CLOCKWISE). + // Refer to SetArcDirection in the Windows API documentation for more information. + inline int CDC::SetArcDirection(int arcDirection) const + { + assert(m_pData->dc != nullptr); + return ::SetArcDirection(m_pData->dc, arcDirection); + } + + // Draws a set of line segments and Bezier curves. + // Refer to PolyDraw in the Windows API documentation for more information. + inline BOOL CDC::PolyDraw(const POINT* pPointArray, const BYTE* pTypes, + int count) const + { + assert(m_pData->dc != nullptr); + return ::PolyDraw(m_pData->dc, pPointArray, pTypes, count); + } + + // Draws a series of line segments by connecting the points in the specified array. + // Refer to Polyline in the Windows API documentation for more information. + inline BOOL CDC::Polyline(LPPOINT pPointArray, int count) const + { + assert(m_pData->dc != nullptr); + return ::Polyline(m_pData->dc, pPointArray, count); + } + + // Draws multiple series of connected line segments. + // Refer to PolyPolyline in the Windows API documentation for more information. + inline BOOL CDC::PolyPolyline(const POINT* pPointArray, + const DWORD* pPolyPoints, int count) const + { + assert(m_pData->dc != nullptr); + return ::PolyPolyline(m_pData->dc, pPointArray, pPolyPoints, + static_cast(count)); + } + + // Draws one or more straight lines. + // Refer to PolylineTo in the Windows API documentation for more information. + inline BOOL CDC::PolylineTo(const POINT* pPointArray, int count) const + { + assert(m_pData->dc != nullptr); + return ::PolylineTo(m_pData->dc, pPointArray, static_cast(count)); + } + + // Draws one or more Bezier curves. + // Refer to PolyBezier in the Windows API documentation for more information. + inline BOOL CDC::PolyBezier(const POINT* pPointArray, int count) const + { + assert(m_pData->dc != nullptr); + return ::PolyBezier(m_pData->dc, pPointArray, static_cast(count)); + } + + // Draws one or more Bezier curves. + // Refer to PolyBezierTo in the Windows API documentation for more information. + inline BOOL CDC::PolyBezierTo(const POINT* pPointArray, int count) const + { + assert(m_pData->dc != nullptr); + return ::PolyBezierTo(m_pData->dc, pPointArray, static_cast(count)); + } + + // Sets the pixel at the specified coordinates to the specified color. + // Refer to SetPixel in the Windows API documentation for more information. + inline COLORREF CDC::SetPixel(POINT pt, COLORREF color) const + { + assert(m_pData->dc != nullptr); + return ::SetPixel(m_pData->dc, pt.x, pt.y, color); + } + + // Sets the pixel at the specified coordinates to the closest approximation + // of the specified color. + // Refer to SetPixelV in the Windows API documentation for more information. + inline BOOL CDC::SetPixelV(int x, int y, COLORREF color) const + { + assert(m_pData->dc != nullptr); + return ::SetPixelV(m_pData->dc, x, y, color); + } + + // Sets the pixel at the specified coordinates to the closest approximation + // of the specified color. + // Refer to SetPixelV in the Windows API documentation for more information. + inline BOOL CDC::SetPixelV(POINT pt, COLORREF color) const + { + assert(m_pData->dc != nullptr); + return ::SetPixelV(m_pData->dc, pt.x, pt.y, color); + } + + + /////////////////////////// + // Shape Drawing Functions. + + + // Draws a rectangle in the style used to indicate that the rectangle has + // the focus. + // Refer to DrawFocusRect in the Windows API documentation for more information. + inline BOOL CDC::DrawFocusRect(RECT rc) const + { + assert(m_pData->dc != nullptr); + return ::DrawFocusRect(m_pData->dc, &rc); + } + + // Draws an ellipse. The center of the ellipse is the center of the + // specified bounding rectangle. + // Refer to Ellipse in the Windows API documentation for more information. + inline BOOL CDC::Ellipse(int x1, int y1, int x2, int y2) const + { + assert(m_pData->dc != nullptr); + return ::Ellipse(m_pData->dc, x1, y1, x2, y2); + } + + // Draws an ellipse. The center of the ellipse is the center of the + // specified bounding rectangle. + // Refer to Ellipse in the Windows API documentation for more information. + inline BOOL CDC::Ellipse(RECT rc) const + { + assert(m_pData->dc != nullptr); + return ::Ellipse(m_pData->dc, rc.left, rc.top, rc.right, rc.bottom); + } + + // Draws a polygon consisting of two or more vertices connected by straight + // lines. + // Refer to Polygon in the Windows API documentation for more information. + inline BOOL CDC::Polygon(LPPOINT pPointArray, int count) const + { + assert(m_pData->dc != nullptr); + return ::Polygon(m_pData->dc, pPointArray, count); + } + + // Draws a rectangle. The rectangle is outlined by using the current pen + // and filled by using the current brush. + // Refer to Rectangle in the Windows API documentation for more information. + inline BOOL CDC::Rectangle(int x1, int y1, int x2, int y2) const + { + assert(m_pData->dc != nullptr); + return ::Rectangle(m_pData->dc, x1, y1, x2, y2); + } + + // Draws a rectangle. The rectangle is outlined by using the current pen + // and filled by using the current brush. + // Refer to Rectangle in the Windows API documentation for more information. + inline BOOL CDC::Rectangle(RECT rc) const + { + assert(m_pData->dc != nullptr); + return ::Rectangle(m_pData->dc, rc.left, rc.top, rc.right, rc.bottom); + } + + // Draws a rectangle with rounded corners. + // Refer to RoundRect in the Windows API documentation for more information. + inline BOOL CDC::RoundRect(int x1, int y1, int x2, int y2, int width, + int height) const + { + assert(m_pData->dc != nullptr); + return ::RoundRect(m_pData->dc, x1, y1, x2, y2, width, height); + } + + // Draws a rectangle with rounded corners. + // Refer to RoundRect in the Windows API documentation for more information. + inline BOOL CDC::RoundRect(RECT rc, int width, int height) const + { + assert(m_pData->dc != nullptr); + return ::RoundRect(m_pData->dc, rc.left, rc.top, rc.right, rc.bottom, + width, height ); + } + + // Draws a chord (a region bounded by the intersection of an ellipse and a + // line segment, called a secant). + // Refer to Chord in the Windows API documentation for more information. + inline BOOL CDC::Chord(int x1, int y1, int x2, int y2, int x3, int y3, + int x4, int y4) const + { + assert(m_pData->dc != nullptr); + return ::Chord(m_pData->dc, x1, y1, x2, y2, x3, y3, x4, y4); + } + + // Draws a chord (a region bounded by the intersection of an ellipse and a + // line segment, called a secant). + // Refer to Chord in the Windows API documentation for more information. + inline BOOL CDC::Chord(RECT rc, POINT start, POINT end) const + { + assert(m_pData->dc != nullptr); + return ::Chord(m_pData->dc, rc.left, rc.top, rc.right, rc.bottom, + start.x, start.y, end.x, end.y); + } + + // Draws a pie-shaped wedge bounded by the intersection of an ellipse and + // two radials. + // Refer to Pie in the Windows API documentation for more information. + inline BOOL CDC::Pie(int x1, int y1, int x2, int y2, int x3, int y3, + int x4, int y4) const + { + assert(m_pData->dc != nullptr); + return ::Pie(m_pData->dc, x1, y1, x2, y2, x3, y3, x4, y4); + } + + // Draws a pie-shaped wedge bounded by the intersection of an ellipse and + // two radials. + // Refer to Pie in the Windows API documentation for more information. + inline BOOL CDC::Pie(RECT rc, POINT start, POINT end) const + { + assert(m_pData->dc != nullptr); + return ::Pie(m_pData->dc, rc.left, rc.top, rc.right, rc.bottom, + start.x, start.y, end.x, end.y); + } + + // Draws a series of closed polygons. + // Refer to PolyPolygon in the Windows API documentation for more information. + inline BOOL CDC::PolyPolygon(LPPOINT pPointArray, LPINT pPolyCounts, + int count) const + { + assert(m_pData->dc != nullptr); + return ::PolyPolygon(m_pData->dc, pPointArray, pPolyCounts, count); + } + + + ///////////////////////////////// + // Fill and 3D Drawing functions. + + + // Fills a rectangle by using the specified brush. + // Refer to FillRect in the Windows API documentation for more information. + inline BOOL CDC::FillRect(RECT rc, HBRUSH brush) const + { + assert(m_pData->dc != nullptr); + return (::FillRect(m_pData->dc, &rc, brush) ? TRUE : FALSE); + } + + // Inverts a rectangle in a window by performing a logical NOT operation on + // the color values for each pixel in the rectangle's interior. + // Refer to InvertRect in the Windows API documentation for more information. + inline BOOL CDC::InvertRect(RECT rc) const + { + assert(m_pData->dc != nullptr); + return ::InvertRect( m_pData->dc, &rc); + } + + // Draws an icon or cursor, performing the specified raster operations, and + // stretching or compressing the icon or cursor as specified. + // Refer to DrawIconEx in the Windows API documentation for more information. + inline BOOL CDC::DrawIconEx(int xLeft, int yTop, HICON icon, int cxWidth, + int cyWidth, UINT index, HBRUSH flickerFreeDraw, UINT flags) const + { + assert(m_pData->dc != nullptr); + return ::DrawIconEx(m_pData->dc, xLeft, yTop, icon, cxWidth, cyWidth, + index, flickerFreeDraw, flags); + } + + // Draws one or more edges of rectangle. + // Refer to DrawEdge in the Windows API documentation for more information. + inline BOOL CDC::DrawEdge(RECT rc, UINT edge, UINT flags) const + { + assert(m_pData->dc != nullptr); + return ::DrawEdge(m_pData->dc, const_cast(&rc), edge, flags); + } + + // Draws a frame control of the specified type and style. + // Refer to DrawFrameControl in the Windows API documentation for more information. + inline BOOL CDC::DrawFrameControl(RECT rc, UINT type, UINT state) const + { + assert(m_pData->dc != nullptr); + return ::DrawFrameControl(m_pData->dc, const_cast(&rc), type, state); + } + + // Fills a region by using the specified brush. + // Refer to FillRgn in the Windows API documentation for more information. + inline BOOL CDC::FillRgn(HRGN rgn, HBRUSH brush) const + { + assert(m_pData->dc != nullptr); + return ::FillRgn(m_pData->dc, rgn, brush); + } + + // Fills rectangle and triangle structures. + // Refer to GradientFill in the Windows API documentation for more information. + inline BOOL CDC::GradientFill(PTRIVERTEX pVertex, ULONG vertex, + PVOID pMesh, ULONG mesh, ULONG mode) const + { + assert(m_pData->dc != nullptr); + + CString system; + ::GetSystemDirectory(system.GetBuffer(MAX_PATH), MAX_PATH); + system.ReleaseBuffer(); + + // Use runtime dynamic linking. Avoids the need to explicitly link Msimg32.lib. + static HMODULE msimg32 = ::LoadLibrary(system + _T("\\msimg32.dll")); + if (msimg32) + { + using PGRADIENTFILL = BOOL(WINAPI*)(HDC, PTRIVERTEX, ULONG, PVOID, + ULONG, ULONG); + + PGRADIENTFILL pGradientFill = reinterpret_cast( + reinterpret_cast(::GetProcAddress(msimg32, "GradientFill"))); + + if (pGradientFill) + return pGradientFill(m_pData->dc, pVertex, vertex, pMesh, mesh, mode); + } + + return FALSE; + } + + // Draws an icon or cursor. + // Refer to DrawIcon in the Windows API documentation for more information. + inline BOOL CDC::DrawIcon(int x, int y, HICON icon) const + { + assert(m_pData->dc != nullptr); + return ::DrawIcon(m_pData->dc, x, y, icon); + } + + // Draws an icon or cursor. + // Refer to DrawIcon in the Windows API documentation for more information. + inline BOOL CDC::DrawIcon(POINT pt, HICON icon) const + { + assert(m_pData->dc != nullptr); + return ::DrawIcon(m_pData->dc, pt.x, pt.y, icon); + } + + // Draws a border around the specified rectangle by using the specified brush. + // Refer to FrameRect in the Windows API documentation for more information. + inline BOOL CDC::FrameRect(RECT rc, HBRUSH brush) const + { + assert(m_pData->dc != nullptr); + return (::FrameRect(m_pData->dc, &rc, brush)) ? TRUE : FALSE; + } + + // Draws a border around the specified region by using the specified brush. + // Refer to FrameRgn in the Windows API documentation for more information. + inline BOOL CDC::FrameRgn(HRGN rgn, HBRUSH brush, int width, int height) const + { + assert(m_pData->dc != nullptr); + return ::FrameRgn(m_pData->dc, rgn, brush, width, height); + } + + // Retrieves the current polygon fill mode. + // Refer to GetPolyFillMode in the Windows API documentation for more information. + inline int CDC::GetPolyFillMode() const + { + assert(m_pData->dc != nullptr); + return ::GetPolyFillMode(m_pData->dc); + } + + // Paints the specified region by using the brush currently selected into + // the device context. + // Refer to PaintRgn in the Windows API documentation for more information. + inline BOOL CDC::PaintRgn(HRGN rgn) const + { + assert(m_pData->dc != nullptr); + return ::PaintRgn(m_pData->dc, rgn); + } + + // Sets the polygon fill mode for functions that fill polygons. + // Refer to SetPolyFillMode in the Windows API documentation for more information. + inline int CDC::SetPolyFillMode(int polyFillMode) const + { + assert(m_pData->dc != nullptr); + return ::SetPolyFillMode(m_pData->dc, polyFillMode); + } + + + //////////////////// + // Bitmap Functions. + + // Copies the color data for a rectangle of pixels in a DIB to the + // specified destination rectangle. + // A CBitmapInfoPtr object can be used for the LPBITMAPINFO parameter. + // Refer to StretchDIBits in the Windows API documentation for more information. + inline int CDC::StretchDIBits(int xDest, int yDest, int destWidth, + int destHeight, int xSrc, int ySrc, int srcWidth, int srcHeight, + LPCVOID pBits, const LPBITMAPINFO pBMI, UINT usage, DWORD rop) const + { + assert(m_pData->dc != nullptr); + return ::StretchDIBits(m_pData->dc, xDest, yDest, destWidth, + destHeight, xSrc, ySrc, srcWidth, srcHeight, pBits, pBMI, usage, + rop); + } + + // Paints the specified rectangle using the brush that is currently + // selected into the device context. + // Refer to PatBlt in the Windows API documentation for more information. + inline BOOL CDC::PatBlt(int x, int y, int width, int height, DWORD rop) const + { + assert(m_pData->dc != nullptr); + return ::PatBlt(m_pData->dc, x, y, width, height, rop); + } + + // Performs a bit-block transfer of the color data corresponding to a + // rectangle of pixels from the specified source device context into a + // destination device context. + // Refer to BitBlt in the Windows API documentation for more information. + inline BOOL CDC::BitBlt(int x, int y, int width, int height, HDC hSrc, + int xSrc, int ySrc, DWORD rop) const + { + assert(m_pData->dc != nullptr); + return ::BitBlt(m_pData->dc, x, y, width, height, hSrc, xSrc, ySrc, rop); + } + + // Combines the color data for the source and destination bitmaps using the + // specified mask and raster operation. + // xDest x coordinate of destination upper-left corner + // yDest y coordinate of destination upper-left corner + // width width of source and destination + // height height of source and destination + // hSrc pointer to source DC + // xSrc x coordinate of upper-left corner of source + // ySrc y coordinate of upper-left corner of source + // mask handle to monochrome bit mask + // xMask horizontal offset into mask bitmap + // yMask vertical offset into mask bitmap + // rop raster operation code + // Refer to MaskBlt in the Windows API documentation for more information. + inline BOOL CDC::MaskBlt(int xDest, int yDest, int width, int height, + HDC hSrc, int xSrc, int ySrc, HBITMAP mask, int xMask, int yMask, + DWORD rop) const + { + assert(m_pData->dc != nullptr); + return ::MaskBlt(m_pData->dc, xDest, yDest, width, height, hSrc, xSrc, + ySrc, mask, xMask, yMask, rop); + } + + // Copies a bitmap from a source rectangle into a destination rectangle, + // stretching or compressing the bitmap to fit the dimensions of the + // destination rectangle, if necessary. + // x x coordinate of destination upper-left corner + // y y coordinate of destination upper-left corner + // width width of destination rectangle + // height height of destination rectangle + // hSrc handle to source DC + // xSrc x coordinate of source upper-left corner + // ySrc y coordinate of source upper-left corner + // srcWidth width of source rectangle + // srcHeight height of source rectangle + // rop raster operation code + // Refer to StretchBlt in the Windows API documentation for more information. + inline BOOL CDC::StretchBlt(int x, int y, int width, int height, HDC src, + int xSrc, int ySrc, int srcWidth, int srcHeight, DWORD rop) const + { + assert(m_pData->dc != nullptr); + return ::StretchBlt(m_pData->dc, x, y, width, height, src, xSrc, ySrc, + srcWidth, srcHeight, rop); + } + + // Retrieves the bits of the specified compatible bitmap and copies them + // into a buffer as a DIB using the specified format. + // A CBitmapInfoPtr object can be used for the LPBITMAPINFO parameter. + // Refer to GetDIBits in the Windows API documentation for more information. + inline int CDC::GetDIBits(HBITMAP bitmap, UINT startScan, UINT scanLines, + LPVOID pBits, LPBITMAPINFO pBMI, UINT usage) const + { + assert(m_pData->dc != nullptr); + return ::GetDIBits(m_pData->dc, bitmap, startScan, scanLines, pBits, + pBMI, usage); + } + + // Sets the pixels in a compatible bitmap (DDB) using the color data found + // in the specified DIB. + // A CBitmapInfoPtr object can be used for the LPBITMAPINFO parameter. + // Refer to SetDIBits in the Windows API documentation for more information. + inline int CDC::SetDIBits(HBITMAP bitmap, UINT startScan, UINT scanLines, LPCVOID pBits, LPBITMAPINFO pBMI, UINT colorUse) const + { + assert(m_pData->dc != nullptr); + return ::SetDIBits(m_pData->dc, bitmap, startScan, scanLines, pBits, pBMI, colorUse); + } + + // Retrieves the current stretching mode. + // Possible modes: BLACKONWHITE, COLORONCOLOR, HALFTONE, STRETCH_ANDSCANS, + // STRETCH_DELETESCANS, STRETCH_HALFTONE, STRETCH_ORSCANS, + // WHITEONBLACK. + // Refer to GetStretchBltMode in the Windows API documentation for more information. + inline int CDC::GetStretchBltMode() const + { + assert(m_pData->dc != nullptr); + return ::GetStretchBltMode(m_pData->dc); + } + + // Sets the stretching mode. + // Possible modes: BLACKONWHITE, COLORONCOLOR, HALFTONE, STRETCH_ANDSCANS, + // STRETCH_DELETESCANS, STRETCH_HALFTONE, STRETCH_ORSCANS, + // WHITEONBLACK. + // Refer to SetStretchBltMode in the Windows API documentation for more information. + inline int CDC::SetStretchBltMode(int stretchMode) const + { + assert(m_pData->dc != nullptr); + return ::SetStretchBltMode(m_pData->dc, stretchMode); + } + + // Performs a bit-block transfer of the color data corresponding to a + // rectangle of pixels from the specified source device context into a + // destination device context. + // x x coordinate of destination upper-left corner + // y y coordinate of destination upper-left corner + // width width of destination rectangle + // height height of destination rectangle + // hSrc handle to source DC + // xSrc x coordinate of source upper-left corner + // ySrc y coordinate of source upper-left corner + // widthSrc width of source rectangle + // heightSrc height of source rectangle + // transparent color to make transparent + // Refer to TransparentBlt in the Windows API documentation for more information. + inline BOOL CDC::TransparentBlt(int x, int y, int width, int height, + HDC hSrc, int xSrc, int ySrc, int widthSrc, int heightSrc, + UINT transparent) const + { + assert(m_pData->dc != nullptr); + return ::TransparentBlt(m_pData->dc, x, y, width, height, hSrc, xSrc, + ySrc, widthSrc, heightSrc, transparent); + } + + // Fills an area of the display surface with the current brush. + // Refer to FloodFill in the Windows API documentation for more information. + inline BOOL CDC::FloodFill(int x, int y, COLORREF color) const + { + assert(m_pData->dc != nullptr); + return ::FloodFill(m_pData->dc, x, y, color); + } + + // Fills an area of the display surface with the current brush. + // Fill type: FLOODFILLBORDER or FLOODFILLSURFACE + // Refer to ExtFloodFill in the Windows API documentation for more information. + inline BOOL CDC::ExtFloodFill(int x, int y, COLORREF color, UINT fillType) const + { + assert(m_pData->dc != nullptr); + return ::ExtFloodFill(m_pData->dc, x, y, color, fillType ); + } + + + ///////////////////////// + // co-ordinate functions. + + // Converts device coordinates into logical coordinates. + // Refer to DPtoLP in the Windows API documentation for more information. + inline BOOL CDC::DPtoLP(LPPOINT pPointArray, int count) const + { + assert(m_pData->dc != nullptr); + return ::DPtoLP(m_pData->dc, pPointArray, count); + } + + // Converts device coordinates into logical coordinates. + // Refer to DPtoLP in the Windows API documentation for more information. + inline BOOL CDC::DPtoLP(RECT& rc) const + { + assert(m_pData->dc != nullptr); + return ::DPtoLP(m_pData->dc, reinterpret_cast(&rc), 2); + } + + // Converts logical coordinates into device coordinates. + // Refer to LPtoDP in the Windows API documentation for more information. + inline BOOL CDC::LPtoDP(LPPOINT pPointArray, int count) const + { + assert(m_pData->dc != nullptr); + return ::LPtoDP(m_pData->dc, pPointArray, count); + } + + // Converts logical coordinates into device coordinates. + // Refer to LPtoDP in the Windows API documentation for more information. + inline BOOL CDC::LPtoDP(RECT& rc) const + { + assert(m_pData->dc != nullptr); + return ::LPtoDP(m_pData->dc, reinterpret_cast(&rc), 2); + } + + + /////////////////// + // Layout Functions + + // Returns the layout of a device context (LAYOUT_RTL and + // LAYOUT_BITMAPORIENTATIONPRESERVED). + // Refer to GetLayout in the Windows API documentation for more information. + inline DWORD CDC::GetLayout() const + { + assert(m_pData->dc != nullptr); + return ::GetLayout(m_pData->dc); + } + + // Sets the layout of a device context (DC). + // layout values: LAYOUT_RTL or LAYOUT_BITMAPORIENTATIONPRESERVED + // Refer to SetLayout in the Windows API documentation for more information. + inline DWORD CDC::SetLayout(DWORD layout) const + { + assert(m_pData->dc != nullptr); + return ::SetLayout(m_pData->dc, layout); + } + + ///////////////////// + // Mapping Functions. + + + // Retrieves the current mapping mode. + // Possible modes: MM_ANISOTROPIC, MM_HIENGLISH, MM_HIMETRIC, MM_ISOTROPIC, + // MM_LOENGLISH, MM_LOMETRIC, MM_TEXT, and MM_TWIPS. + // Refer to GetMapMode in the Windows API documentation for more information. + inline int CDC::GetMapMode() const + { + assert(m_pData->dc != nullptr); + return ::GetMapMode(m_pData->dc); + } + + // Retrieves the x-coordinates and y-coordinates of the viewport origin + // for the device context. + // Refer to GetViewportOrgEx in the Windows API documentation for more information. + inline BOOL CDC::GetViewportOrgEx(LPPOINT pPoint) const + { + assert(m_pData->dc != nullptr); + return ::GetViewportOrgEx(m_pData->dc, pPoint); + } + + // Sets the mapping mode of the specified device context. + // Refer to SetMapMode in the Windows API documentation for more information. + inline int CDC::SetMapMode(int mapMode) const + { + assert(m_pData->dc != nullptr); + return ::SetMapMode(m_pData->dc, mapMode); + } + + // Specifies which device point maps to the window origin (0,0). + // Refer to SetViewportOrgEx in the Windows API documentation for more information. + inline BOOL CDC::SetViewportOrgEx(int x, int y, LPPOINT pPoint /* = nullptr */) const + { + assert(m_pData->dc != nullptr); + return ::SetViewportOrgEx(m_pData->dc, x, y, pPoint); + } + + // Specifies which device point maps to the window origin (0,0). + // Refer to SetViewportOrgEx in the Windows API documentation for more information. + inline BOOL CDC::SetViewportOrgEx(POINT point, LPPOINT pPointRet /* = nullptr */) const + { + assert(m_pData->dc != nullptr); + return SetViewportOrgEx(point.x, point.y, pPointRet); + } + + // Modifies the viewport origin for the device context using the specified + // horizontal and vertical offsets. + // Refer to OffsetViewportOrgEx in the Windows API documentation for more information. + inline BOOL CDC::OffsetViewportOrgEx(int width, int height, LPPOINT pPoint /* = nullptr */) const + { + assert(m_pData->dc != nullptr); + return ::OffsetViewportOrgEx(m_pData->dc, width, height, pPoint); + } + + // Retrieves the x-extent and y-extent of the current viewport for the + // device context. + // Refer to GetViewportExtEx in the Windows API documentation for more information. + inline BOOL CDC::GetViewportExtEx(LPSIZE pSize) const + { + assert(m_pData->dc != nullptr); + return ::GetViewportExtEx(m_pData->dc, pSize); + } + + // Sets the horizontal and vertical extents of the viewport for the device + // context by using the specified values. + // Refer to SetViewportExtEx in the Windows API documentation for more information. + inline BOOL CDC::SetViewportExtEx(int x, int y, LPSIZE pSize ) const + { + assert(m_pData->dc != nullptr); + return ::SetViewportExtEx(m_pData->dc, x, y, pSize); + } + + // Sets the horizontal and vertical extents of the viewport for the device + // context by using the specified values. + // Refer to SetViewportExtEx in the Windows API documentation for more information. + inline BOOL CDC::SetViewportExtEx(SIZE size, LPSIZE pSizeRet ) const + { + assert(m_pData->dc != nullptr); + return SetViewportExtEx(size.cx, size.cy, pSizeRet); + } + + // Modifies the viewport for the device context using the ratios formed by + // the specified multiplicands and divisors. + // Refer to ScaleViewportExtEx in the Windows API documentation for more information. + inline BOOL CDC::ScaleViewportExtEx(int xNum, int xDenom, int yNum, + int yDenom, LPSIZE pSize ) const + { + assert(m_pData->dc != nullptr); + return ::ScaleViewportExtEx(m_pData->dc, xNum, xDenom, yNum, yDenom, pSize); + } + + // Retrieves the x-coordinates and y-coordinates of the window origin for + // the device context. + // Refer to GetWindowOrgEx in the Windows API documentation for more information. + inline BOOL CDC::GetWindowOrgEx(LPPOINT pPoint) const + { + assert(m_pData->dc != nullptr); + return ::GetWindowOrgEx(m_pData->dc, pPoint); + } + + // Specifies which window point maps to the viewport origin (0,0). + // Refer to SetWindowOrgEx in the Windows API documentation for more information. + inline BOOL CDC::SetWindowOrgEx(int x, int y, LPPOINT pPoint ) const + { + assert(m_pData->dc != nullptr); + return ::SetWindowOrgEx(m_pData->dc, x, y, pPoint); + } + + // Specifies which window point maps to the viewport origin (0,0). + // Refer to SetWindowOrgEx in the Windows API documentation for more information. + inline BOOL CDC::SetWindowOrgEx(POINT point, LPPOINT pPointRet ) const + { + assert(m_pData->dc != nullptr); + return SetWindowOrgEx(point.x, point.y, pPointRet); + } + + // Modifies the window origin for the device context using the specified + // horizontal and vertical offsets. + // Refer to OffsetWindowOrgEx in the Windows API documentation for more information. + inline BOOL CDC::OffsetWindowOrgEx(int width, int height, LPPOINT pPoint ) const + { + assert(m_pData->dc != nullptr); + return ::OffsetWindowOrgEx(m_pData->dc, width, height, pPoint); + } + + // Retrieves the x-extent and y-extent of the window for the device context. + // Refer to GetWindowExtEx in the Windows API documentation for more information. + inline BOOL CDC::GetWindowExtEx(LPSIZE pSize) const + { + assert(m_pData->dc != nullptr); + return ::GetWindowExtEx(m_pData->dc, pSize); + } + + // Sets the horizontal and vertical extents of the window for the device + // context by using the specified values. + // Refer to SetWindowExtEx in the Windows API documentation for more information. + inline BOOL CDC::SetWindowExtEx(int x, int y, LPSIZE pSize ) const + { + assert(m_pData->dc != nullptr); + return ::SetWindowExtEx(m_pData->dc, x, y, pSize); + } + + // Sets the horizontal and vertical extents of the window for the device + // context by using the specified values. + // Refer to SetWindowExtEx in the Windows API documentation for more information. + inline BOOL CDC::SetWindowExtEx(SIZE size, LPSIZE pSizeRet) const + { + assert(m_pData->dc != nullptr); + return SetWindowExtEx(size.cx, size.cy, pSizeRet); + } + + // Modifies the window for the device context using the ratios formed by + // the specified multiplicands and divisors. + // Refer to ScaleWindowExtEx in the Windows API documentation for more information. + inline BOOL CDC::ScaleWindowExtEx(int xNum, int xDenom, int yNum, + int yDenom, LPSIZE pSize) const + { + assert(m_pData->dc != nullptr); + return ::ScaleWindowExtEx(m_pData->dc, xNum, xDenom, yNum, yDenom, pSize); + } + + + ///////////////////// + // MetaFile Functions + + + // Displays the picture stored in the specified metafile. + // Refer to PlayMetaFile in the Windows API documentation for more information. + inline BOOL CDC::PlayMetaFile(HMETAFILE metaFile) const + { + assert(m_pData->dc != nullptr); + return ::PlayMetaFile(m_pData->dc, metaFile); + } + + // Displays the picture stored in the specified enhanced-format metafile. + // Refer to PlayEnhMetaFile in the Windows API documentation for more information. + inline BOOL CDC::PlayMetaFile(HENHMETAFILE enhMetaFile, RECT bounds) const + { + assert(m_pData->dc != nullptr); + return ::PlayEnhMetaFile(m_pData->dc, enhMetaFile, &bounds); + } + + + ///////////////////// + // Printer Functions. + + + // Starts a print job. + // Refer to StartDoc in the Windows API documentation for more information. + inline int CDC::StartDoc(LPDOCINFO pDocInfo) const + { + assert(m_pData->dc != nullptr); + return ::StartDoc(m_pData->dc, pDocInfo); + } + + // Ends a print job. + // Refer to EndDoc in the Windows API documentation for more information. + inline int CDC::EndDoc() const + { + assert(m_pData->dc != nullptr); + return ::EndDoc(m_pData->dc); + } + + // Prepares the printer driver to accept data. + // Refer to StartPage in the Windows API documentation for more information. + inline int CDC::StartPage() const + { + assert(m_pData->dc != nullptr); + return ::StartPage(m_pData->dc); + } + + // Notifies the device that the application has finished writing to a page. + // Refer to EndPage in the Windows API documentation for more information. + inline int CDC::EndPage() const + { + assert(m_pData->dc != nullptr); + return ::EndPage(m_pData->dc); + } + + // Stops the current print job and erases everything drawn since the last + // call to the StartDoc function. + // Refer to AbortDoc in the Windows API documentation for more information. + inline int CDC::AbortDoc() const + { + assert(m_pData->dc != nullptr); + return ::AbortDoc(m_pData->dc); + } + + // Sets the application-defined abort function that allows a print job to + // be cancelled during spooling. + // Refer to SetAbortProc in the Windows API documentation for more information. + inline int CDC::SetAbortProc(BOOL (CALLBACK* pfn)(HDC, int)) const + { + assert(m_pData->dc != nullptr); + return ::SetAbortProc(m_pData->dc, pfn); + } + + + ////////////////// + // Text Functions. + + // Draws text using the currently selected font, background color, and text + // color. + // Refer to ExtTextOut in the Windows API documentation for more information. + inline BOOL CDC::ExtTextOut(int x, int y, UINT options, RECT rc, + LPCTSTR string, int count /*= -1*/, LPINT pDxWidths /*=nullptr*/) const + { + assert(m_pData->dc != nullptr); + + if (count == -1) + count = lstrlen (string); + + return ::ExtTextOut(m_pData->dc, x, y, options, &rc, string, + static_cast(count), pDxWidths); + } + + // Draws formatted text in the specified rectangle. + // Refer to DrawText in the Windows API documentation for more information. + inline int CDC::DrawText(LPCTSTR string, int count, RECT rc, UINT format) const + { + assert(m_pData->dc != nullptr); + return ::DrawText(m_pData->dc, string, count, const_cast(&rc), + format ); + } + + // Retrieves the text-alignment setting. + // Return values: TA_BASELINE, TA_BOTTOM, TA_TOP, TA_CENTER, TA_LEFT, + // TA_RIGHT, TA_RTLREADING, TA_NOUPDATECP, TA_UPDATECP. + // Refer to GetTextAlign in the Windows API documentation for more information. + inline UINT CDC::GetTextAlign() const + { + assert(m_pData->dc != nullptr); + return ::GetTextAlign(m_pData->dc); + } + + // Sets the text-alignment setting. + // Return values: TA_BASELINE, TA_BOTTOM, TA_TOP, TA_CENTER, TA_LEFT, + // TA_RIGHT, TA_RTLREADING, TA_NOUPDATECP, TA_UPDATECP. + // Refer to SetTextAlign in the Windows API documentation for more information. + inline UINT CDC::SetTextAlign(UINT flags) const + { + assert(m_pData->dc != nullptr); + return ::SetTextAlign(m_pData->dc, flags); + } + + // Retrieves the typeface name of the font that is selected into the device + // context. + // Refer to GetTextFace in the Windows API documentation for more information. + inline int CDC::GetTextFace(int count, LPTSTR faceName) const + { + assert(m_pData->dc != nullptr); + return ::GetTextFace(m_pData->dc, count, faceName); + } + + // Fills the specified buffer with the metrics for the currently selected + // font. + // Refer to GetTextMetrics in the Windows API documentation for more information. + inline BOOL CDC::GetTextMetrics(TEXTMETRIC& metrics) const + { + assert(m_pData->dc != nullptr); + return ::GetTextMetrics(m_pData->dc, &metrics); + } + + // Returns the current background color. + // Refer to GetBkColor in the Windows API documentation for more information. + inline COLORREF CDC::GetBkColor() const + { + assert(m_pData->dc != nullptr); + return ::GetBkColor(m_pData->dc); + } + + // Sets the current background color to the specified color value. + // Refer to SetBkColor in the Windows API documentation for more information. + inline COLORREF CDC::SetBkColor(COLORREF color) const + { + assert(m_pData->dc != nullptr); + return ::SetBkColor(m_pData->dc, color); + } + + // Retrieves the current text color. + // Refer to GetTextColor in the Windows API documentation for more information. + inline COLORREF CDC::GetTextColor() const + { + assert(m_pData->dc != nullptr); + return ::GetTextColor(m_pData->dc); + } + + // Sets the current text color. + // Refer to SetTextColor in the Windows API documentation for more information. + inline COLORREF CDC::SetTextColor(COLORREF color) const + { + assert(m_pData->dc != nullptr); + return ::SetTextColor(m_pData->dc, color); + } + + // Returns the current background mix mode (OPAQUE or TRANSPARENT). + // Refer to GetBkMode in the Windows API documentation for more information. + inline int CDC::GetBkMode() const + { + assert(m_pData->dc != nullptr); + return ::GetBkMode(m_pData->dc); + } + + // Sets the current background mix mode (OPAQUE or TRANSPARENT). + // Refer to SetBkMode in the Windows API documentation for more information. + inline int CDC::SetBkMode(int bkMode) const + { + assert(m_pData->dc != nullptr); + return ::SetBkMode(m_pData->dc, bkMode); + } + + // Draws formatted text in the specified rectangle with more formatting options. + // Refer to DrawTextEx in the Windows API documentation for more information. + inline int CDC::DrawTextEx(LPTSTR string, int count, RECT rc, UINT format, + LPDRAWTEXTPARAMS pDTParams) const + { + assert(m_pData->dc != nullptr); + return ::DrawTextEx(m_pData->dc, string, count, const_cast(&rc), + format, pDTParams); + } + + // Retrieves the widths, in logical units, of consecutive characters in a + // specified range from the current TrueType font. This function succeeds + // only with TrueType fonts. + // Refer to GetCharABCWidths in the Windows API documentation for more information. + inline BOOL CDC::GetCharABCWidths(UINT firstChar, UINT lastChar, LPABC pABC) const + { + assert(m_pData->dc != nullptr); + return::GetCharABCWidths(m_pData->dc, firstChar, lastChar, pABC); + } + + // Retrieves information about a character string, such as character + // widths, caret positioning, ordering within the string, and glyph + // rendering. + // Refer to GetCharacterPlacement in the Windows API documentation for more information. + inline DWORD CDC::GetCharacterPlacement(LPCTSTR string, int count, + int maxExtent, LPGCP_RESULTS results, DWORD flags) const + { + assert(m_pData->dc != nullptr); + return ::GetCharacterPlacement(m_pData->dc, string, count, maxExtent, + results, flags); + } + + // Retrieves the widths, in logical coordinates, of consecutive characters + // in a specified range from the current font. + // Refer to GetCharWidth in the Windows API documentation for more information. + inline BOOL CDC::GetCharWidth(UINT firstChar, UINT lastChar, int* buffer) const + { + assert(m_pData->dc != nullptr); + return ::GetCharWidth(m_pData->dc, firstChar, lastChar, buffer); + } + + // Retrieves the fractional widths of consecutive characters in a specified + // range from the current font. + // Refer to GetCharWidthFloat in the Windows API documentation for more information. + inline BOOL CDC::GetCharWidthFloat(UINT firstChar, UINT lastChar, float* buffer) const + { + assert(m_pData->dc != nullptr); + return ::GetCharWidthFloat(m_pData->dc, firstChar, lastChar, buffer); + } + + // Computes the width and height of the specified string of text. + // Refer to GetTextExtentPoint32 in the Windows API documentation for more information. + inline CSize CDC::GetTextExtentPoint32(LPCTSTR string, int count) const + { + assert(m_pData->dc != nullptr); + assert(string != nullptr); + assert(count <= lstrlen(string)); + CSize sz; + VERIFY(::GetTextExtentPoint32(m_pData->dc, string, count, &sz)); + return sz; + } + + // Computes the width and height of the specified string of text. + // Refer to GetTextExtentPoint32 in the Windows API documentation for more information. + inline CSize CDC::GetTextExtentPoint32(LPCTSTR string) const + { + assert(string != nullptr); + return GetTextExtentPoint32(string, lstrlen(string)); + } + + // Computes the width and height of a character string. + // Refer to GetTabbedTextExtent in the Windows API documentation for more information. + inline CSize CDC::GetTabbedTextExtent(LPCTSTR string, int count, + int tabPositions, LPINT pTabStopPositions) const + { + assert(m_pData->dc != nullptr); + DWORD size = ::GetTabbedTextExtent(m_pData->dc, string, count, + tabPositions, pTabStopPositions); + CSize sz(size); + return sz; + } + + // Draws gray text at the specified location. + // Refer to GrayString in the Windows API documentation for more information. + inline BOOL CDC::GrayString(HBRUSH brush, GRAYSTRINGPROC pOutputFunc, + LPARAM pData, int count, int x, int y, int width, int height) const + { + assert(m_pData->dc != nullptr); + return ::GrayString(m_pData->dc, brush, pOutputFunc, pData, count, x, + y, width, height); + } + + // Specifies the amount of space the system should add to the break + // characters in a string of text. + // Refer to SetTextJustification in the Windows API documentation for more information. + inline int CDC::SetTextJustification(int breakExtra, int breakCount) const + { + assert(m_pData->dc != nullptr); + return ::SetTextJustification(m_pData->dc, breakExtra, breakCount); + } + + // Retrieves the current inter-character spacing for the device context. + // Refer to GetTextCharacterExtra in the Windows API documentation for more information. + inline int CDC::GetTextCharacterExtra() const + { + assert(m_pData->dc != nullptr); + return ::GetTextCharacterExtra(m_pData->dc); + } + + // Sets the inter-character spacing. + // Refer to SetTextCharacterExtra in the Windows API documentation for more information. + inline int CDC::SetTextCharacterExtra(int charExtra) const + { + assert(m_pData->dc != nullptr); + return ::SetTextCharacterExtra(m_pData->dc, charExtra); + } + + // Writes a character string at a specified location, expanding tabs to the + // values specified in an array of tab-stop positions. + // Refer to TabbedTextOut in the Windows API documentation for more information. + inline CSize CDC::TabbedTextOut(int x, int y, LPCTSTR string, int count, + int tabPositions, LPINT pTabStopPositions, int tabOrigin) const + { + assert(m_pData->dc != nullptr); + LONG size = ::TabbedTextOut(m_pData->dc, x, y, string, count, + tabPositions, pTabStopPositions, tabOrigin); + CSize sz(static_cast(size)); + return sz; + } + + // Writes a character string at the specified location. + // Refer to TextOut in the Windows API documentation for more information. + inline BOOL CDC::TextOut(int x, int y, LPCTSTR string, int count/* = -1*/) const + { + assert(m_pData->dc != nullptr); + if (count == -1) + count = lstrlen (string); + + return ::TextOut(m_pData->dc, x, y, string, count); + } + + // Retrieves the widths, in logical units, of consecutive glyph indices in + // a specified range from the current TrueType font. This function succeeds + // only with TrueType fonts. + // Refer to GetCharABCWidthsI in the Windows API documentation for more information. + inline BOOL CDC::GetCharABCWidthsI(UINT giFirst, UINT cgi, LPWORD pGI, LPABC pABC) const + { + assert(m_pData->dc != nullptr); + return ::GetCharABCWidthsI(m_pData->dc, giFirst, cgi, pGI, pABC); + } + + // Retrieves the widths, in logical coordinates, of consecutive glyph + // indices in a specified range from the current font. + // Refer to GetCharWidthI in the Windows API documentation for more information. + inline BOOL CDC::GetCharWidthI(UINT giFirst, UINT cgi, LPWORD pGI, int* buffer) const + { + assert(m_pData->dc != nullptr); + return ::GetCharWidthI(m_pData->dc, giFirst, cgi, pGI, buffer); + } + + + /////////////////////////////////////// + // Definitions for the CClientDC class. + // + + inline CClientDC::CClientDC(HWND wnd) + { + if (wnd == nullptr) wnd = GetDesktopWindow(); + assert(::IsWindow(wnd)); + + try + { + HDC dc = ::GetDC(wnd); + if (dc == nullptr) + throw CResourceException(GetApp()->MsgGdiGetDC()); + + Assign(dc); + SetWindow(wnd); + } + + catch (...) + { + Release(); // Cleanup + throw; // Rethrow + } + } + + inline CClientDC::CClientDC(const CClientDC& rhs) : CDC(rhs) + { + } + + inline CClientDC& CClientDC::operator=(const CClientDC& rhs) + { + CDC::operator=(rhs); + return *this; + } + + inline CClientDC::~CClientDC() + { + } + + + ///////////////////////////////////////// + // Definitions for the CClientDCEx class. + // + + inline CClientDCEx::CClientDCEx(HWND wnd, HRGN clip, DWORD flags) + { + if (wnd == nullptr) wnd = GetDesktopWindow(); + assert(::IsWindow(wnd)); + + try + { + HDC dc = ::GetDCEx(wnd, clip, flags); + if (dc == nullptr) + throw CResourceException(GetApp()->MsgGdiGetDCEx()); + + if (clip != nullptr && (flags & (DCX_INTERSECTRGN | DCX_EXCLUDERGN))) + { + CRgn region(clip); + region.Detach(); // The system owns the region now. + } + + Assign(dc); + SetWindow(wnd); + } + + catch (...) + { + Release(); // Cleanup + throw; // Rethrow + } + } + + inline CClientDCEx::CClientDCEx(const CClientDCEx& rhs) : CDC(rhs) + { + } + + inline CClientDCEx& CClientDCEx::operator=(const CClientDCEx& rhs) + { + CDC::operator=(rhs); + return *this; + } + + inline CClientDCEx::~CClientDCEx() + { + } + + + //////////////////////////////////// + // Definitions for the CMemDC class. + // + + inline CMemDC::CMemDC(HDC dc) + { + try + { + CreateCompatibleDC(dc); + } + + catch (...) + { + Release(); // Cleanup + throw; // Rethrow + } + } + + inline CMemDC::CMemDC(const CMemDC& rhs) : CDC(rhs) + { + } + + inline CMemDC& CMemDC::operator=(const CMemDC& rhs) + { + CDC::operator=(rhs); + return *this; + } + + inline CMemDC::~CMemDC() + { + } + + + ////////////////////////////////////// + // Definitions for the CPaintDC class. + // + + inline CPaintDC::CPaintDC(HWND wnd) + { + assert(::IsWindow(wnd)); + + try + { + HDC dc = ::BeginPaint(wnd, GetPaintStruct()); + if (dc == nullptr) + throw CResourceException(GetApp()->MsgGdiBeginPaint()); + + Assign(dc); + SetPaintDC(true); + SetWindow(wnd); + } + + catch (...) + { + Release(); // Cleanup + throw; // Rethrow + } + } + + inline CPaintDC::CPaintDC(const CPaintDC& rhs) : CDC(rhs) + { + } + + inline CPaintDC& CPaintDC::operator=(const CPaintDC& rhs) + { + CDC::operator=(rhs); + return *this; + } + + inline CPaintDC::~CPaintDC() + { + } + + + /////////////////////////////////////// + // Definitions for the CWindowDC class. + // + + inline CWindowDC::CWindowDC(HWND wnd) + { + if (wnd == nullptr) wnd = GetDesktopWindow(); + assert(::IsWindow(wnd)); + + try + { + HDC dc = ::GetWindowDC(wnd); + if (dc == nullptr) + throw CResourceException(GetApp()->MsgGdiGetWinDC()); + + Assign(dc); + SetWindow(wnd); + } + + catch (...) + { + Release(); // Cleanup + throw; // Rethrow + } + } + + inline CWindowDC::CWindowDC(const CWindowDC& rhs) : CDC(rhs) + { + } + + inline CWindowDC& CWindowDC::operator=(const CWindowDC& rhs) + { + CDC::operator=(rhs); + return *this; + } + + inline CWindowDC::~CWindowDC() + { + } + + + ///////////////////////////////////////// + // Definitions for the CMetaFileDC class. + // + + inline CMetaFileDC::CMetaFileDC() + { + } + + inline CMetaFileDC::CMetaFileDC(const CMetaFileDC& rhs) : CDC(rhs) + { + } + + inline CMetaFileDC& CMetaFileDC::operator=(const CMetaFileDC& rhs) + { + CDC::operator=(rhs); + return *this; + } + + inline CMetaFileDC::~CMetaFileDC() + { + if (m_pData.use_count() == 1) + { + // Assert here if the metafile was created but not closed. + assert(GetHDC() == nullptr); + + if (GetHDC()) + { + ::DeleteMetaFile(Close()); + } + } + } + + // Closes the metafile and returns a CMetaFile object. + // The CMetaFile object automatically deletes the HMETAFILE when the last + // copy of the CMetaFile goes out of scope. + inline CMetaFile CMetaFileDC::Close() + { + assert(GetHDC()); + + HDC dc = Detach(); + HMETAFILE meta = ::CloseMetaFile(dc); + return CMetaFile(meta); + } + + inline void CMetaFileDC::Create(LPCTSTR fileName /*= nullptr*/) + { + try + { + assert(GetHDC() == nullptr); + HDC dc = ::CreateMetaFile(fileName); + if (dc == nullptr) + throw CResourceException(GetApp()->MsgGdiDC()); + + Assign(dc); + } + catch (...) + { + Release(); // Cleanup + throw; // Rethrow + } + } + + + //////////////////////////////////////////// + // Definitions for the CEnhMetaFileDC class. + // + + inline CEnhMetaFileDC::CEnhMetaFileDC() + { + } + + inline CEnhMetaFileDC::CEnhMetaFileDC(const CEnhMetaFileDC& rhs) : CDC(rhs) + { + } + + inline CEnhMetaFileDC& CEnhMetaFileDC::operator=(const CEnhMetaFileDC& rhs) + { + CDC::operator=(rhs); + return *this; + } + + inline CEnhMetaFileDC::~CEnhMetaFileDC() + { + if (m_pData.use_count() == 1) + { + // Assert here if the enhanced metafile was created but not closed. + assert(GetHDC() == nullptr); + + if (GetHDC()) + { + ::DeleteEnhMetaFile(CloseEnhanced()); + } + } + } + + // Closes the enhanced metafile and returns a CEnhMetaFile object. + // The CEnhMetaFile object automatically deletes the HENHMETAFILE when the + // last copy of the CEnhMetaFile goes out of scope. + inline CEnhMetaFile CEnhMetaFileDC::CloseEnhanced() + { + assert(GetHDC()); + + HDC dc = Detach(); + HENHMETAFILE enhMeta = ::CloseEnhMetaFile(dc); + return CEnhMetaFile(enhMeta); + } + + inline void CEnhMetaFileDC::CreateEnhanced(HDC ref, LPCTSTR fileName, + const RECT* pBounds, LPCTSTR description) + { + try + { + assert(GetHDC() == nullptr); + HDC dc = ::CreateEnhMetaFile(ref, fileName, pBounds, description); + if (dc == nullptr) + throw CResourceException(GetApp()->MsgGdiDC()); + + Assign(dc); + } + catch (...) + { + Release(); // Cleanup + throw; // Rethrow + } + } + + + //////////////////////////////////////////// + // Definitions for the CBitmapInfoPtr class. + // + + // Construct the CBitmapInfoPtr from the handle to a bitmap. + inline CBitmapInfoPtr::CBitmapInfoPtr(HBITMAP bitmap) + { + BITMAP data = {}; + VERIFY(::GetObject(bitmap, sizeof(data), &data)); + CreateBitmapInfo(data); + } + + // Construct the CBitmapInfoPtr from a BITMAP struct. + inline CBitmapInfoPtr::CBitmapInfoPtr(const BITMAP& bitmap) + { + // The specified BITMAP must have the following members assigned: + // bmHeight; bmWidth; and bmBitsPixel. + CreateBitmapInfo(bitmap); + } + + // Creates and assigns a BITMAPINFO struct from the specified BITMAP. + inline void CBitmapInfoPtr::CreateBitmapInfo(const BITMAP& data) + { + // Convert the color format to a count of bits. + WORD cClrBits = data.bmBitsPixel; + if (cClrBits <= 1) cClrBits = 1; + else if (cClrBits <= 4) cClrBits = 4; + else if (cClrBits <= 8) cClrBits = 8; + else if (cClrBits <= 16) cClrBits = 16; + else if (cClrBits <= 24) cClrBits = 24; + else cClrBits = 32; + + // Allocate memory for the BITMAPINFO structure. + UINT uQuadSize = (cClrBits >= 24) ? 0 : UINT(sizeof(RGBQUAD)) * (1 << cClrBits); + m_bmi.assign(sizeof(BITMAPINFOHEADER) + uQuadSize, 0); + m_pbmiArray = reinterpret_cast(m_bmi.data()); + + m_pbmiArray->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + m_pbmiArray->bmiHeader.biHeight = data.bmHeight; + m_pbmiArray->bmiHeader.biWidth = data.bmWidth; + m_pbmiArray->bmiHeader.biPlanes = 1; // All bitmaps have 1 plane. + m_pbmiArray->bmiHeader.biBitCount = data.bmBitsPixel; + m_pbmiArray->bmiHeader.biCompression = BI_RGB; + m_pbmiArray->bmiHeader.biSizeImage = static_cast( + ((data.bmWidth * cClrBits + 31) & ~31) / 8 * data.bmHeight); + + if (m_pbmiArray->bmiHeader.biBitCount < 24) + m_pbmiArray->bmiHeader.biClrUsed = (1U << m_pbmiArray->bmiHeader.biBitCount); + + // Note: Calling GetDIBits clears bmiHeader.biClrUsed. It may need + // to be set again following a call to GetDIBits to support bitmaps + // with a bit count less than 24. + } + + +} // namespace Win32xx + +#endif // _WIN32XX_GDI_H_ + diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_hglobal.h b/packages/media/cpp/packages/Win32xx/include/wxx_hglobal.h new file mode 100644 index 00000000..579aa964 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_hglobal.h @@ -0,0 +1,112 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +#ifndef _WIN32XX_HGLOBAL_H_ +#define _WIN32XX_HGLOBAL_H_ + +namespace Win32xx +{ + //////////////////////////////////////////////////////////////// + // CHGlobal is a class used to wrap a global memory handle. + // It automatically frees the global memory when the object goes + // out of scope. This class is used by CDevMode and CDevNames + // defined in wxx_printdialogs.h + class CHGlobal + { + public: + CHGlobal() : m_global(nullptr) {} + CHGlobal(HGLOBAL handle) : m_global(handle) {} + CHGlobal(size_t size) : m_global(nullptr) { Alloc(size); } + ~CHGlobal() { Free(); } + + void Alloc(size_t size); + void Free(); + HGLOBAL Get() const { return m_global; } + void Reassign(HGLOBAL handle); + + operator HGLOBAL() const { return m_global; } + + private: + CHGlobal(const CHGlobal&) = delete; + CHGlobal& operator=(const CHGlobal&) = delete; + + HGLOBAL m_global; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + ////////////////////////////////////// + // Definitions for the CHGlobal class. + // + + // Allocates a new global memory buffer for this object. + inline void CHGlobal::Alloc(size_t size) + { + Free(); + m_global = ::GlobalAlloc(GHND, size); + if (m_global == nullptr) + throw std::bad_alloc(); + } + + // Manually frees the global memory assigned to this object. + inline void CHGlobal::Free() + { + if (m_global != nullptr) + VERIFY(::GlobalFree(m_global) == nullptr); // Fails if the memory was already freed. + + m_global = nullptr; + } + + // Reassign is used when global memory has been reassigned, as + // can occur after a call to ::PrintDlg, ::PrintDlgEx, or ::PageSetupDlg. + // It assigns a new memory handle to be managed by this object + // and assumes any old memory has already been freed. + inline void CHGlobal::Reassign(HGLOBAL global) + { + m_global = global; + } + +} + + +#endif // _WIN32XX_HGLOBAL_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_imagelist.h b/packages/media/cpp/packages/Win32xx/include/wxx_imagelist.h new file mode 100644 index 00000000..c3819b02 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_imagelist.h @@ -0,0 +1,732 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////////////////////////// +// wxx_imagelist.h +// Declaration of the CImageList class + +// The CImageList class manages an image list. +// An image list is a collection of images of the same size, each of which +// can be referred to by its index. Image lists are used to efficiently manage +// large sets of icons or bitmaps. All images in an image list are contained +// in a single, wide bitmap in screen device format. An image list can also +// include a monochrome bitmap that contains masks that are used to draw +// images transparently. + + +#ifndef _WIN32XX_IMAGELIST_H_ +#define _WIN32XX_IMAGELIST_H_ + + +#include "wxx_appcore0.h" +#include "wxx_rect.h" + + +namespace Win32xx +{ + // Forward declaration. + class CBitmap; + + + /////////////////////////////////////////////////////////////////////// + // The CImageList class that provides the functionality of image lists. + // An image list is a collection of images of the same size, each of + // which can be referred to by its index. + class CImageList final + { + friend class CWinApp; + + public: + // Construction and Destruction + CImageList(); + CImageList(HIMAGELIST images); + CImageList(const CImageList& rhs); + ~CImageList(); + + // Operators + CImageList& operator=(const CImageList& rhs); + CImageList& operator=(HIMAGELIST rhs); + operator HIMAGELIST () const; + + // Initialization + void Create(int cx, int cy, UINT flags, int initial, int grow); + void Create(int bitmapID, int cx, int grow, COLORREF mask); + void Create(LPCTSTR resourceName, int cx, int grow, COLORREF mask); + void Create(HIMAGELIST images); + BOOL CreateDisabledImageList(HIMAGELIST normalImages); + void CreateDragImage(HWND header, int index); + void CreateDragImage(HWND listView, int item, CPoint& pt); + void CreateDragImage(HWND treeView, HTREEITEM item); + + // Operations + int Add(HBITMAP bitmap) const; + int Add(HBITMAP bitmap, HBITMAP mask) const; + int Add(HBITMAP bitmap, COLORREF mask) const; + int Add(HICON icon) const; + int AddIcon(UINT iconID) const; + void Attach(HIMAGELIST images); + BOOL BeginDrag(int image, CPoint hotSpot) const; + BOOL Copy(int dst, int src, UINT flags /*= ILCF_MOVE*/) const; + void Destroy(); + HIMAGELIST Detach(); + BOOL DragEnter(HWND lock, CPoint point) const; + BOOL DragLeave(HWND lock) const; + BOOL DragMove(CPoint point) const; + BOOL DragShowNolock(BOOL show) const; + BOOL Draw(HDC dc, int image, POINT point, UINT style) const; + BOOL DrawEx(HDC dc, int image, POINT pt, SIZE sz, COLORREF bckgnd, + COLORREF frgnd, UINT style) const; + BOOL DrawIndirect(IMAGELISTDRAWPARAMS* pILDParams) const; + void EndDrag() const; + HICON ExtractIcon(int index) const; + void Read(LPSTREAM pStream); + BOOL Remove(int image) const; + BOOL Replace(int image, HBITMAP bitmap, HBITMAP mask) const; + int Replace(int image, HICON icon) const; + BOOL Write(LPSTREAM pStream) const; + + // Accessors and mutators + COLORREF GetBkColor() const; + HIMAGELIST GetDragImage(POINT* pPoint, POINT* pHotspot) const; + HIMAGELIST GetHandle() const; + HICON GetIcon(int image, UINT flags) const; + CSize GetIconSize() const; + int GetImageCount() const; + BOOL GetImageInfo(int image, IMAGEINFO* pImageInfo) const; + COLORREF SetBkColor(COLORREF bckgnd) const; + BOOL SetDragCursorImage(int drag, int dxHotspot, int dyHotspot) const; + + private: + void Assign(HIMAGELIST images); + void Release(); + + std::shared_ptr m_pData; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + //////////////////////////////////////// + // Definitions for the CImageList class. + // + + inline CImageList::CImageList() : m_pData(std::make_shared()) + { + } + + inline CImageList::CImageList(HIMAGELIST images) : m_pData(std::make_shared()) + { + Attach(images); + } + + // Note: A copy of a CImageList is a clone of the original. + // Both objects manipulate the one HIMAGELIST. + inline CImageList::CImageList(const CImageList& rhs) + { + m_pData = rhs.m_pData; + } + + // Destructor + inline CImageList::~CImageList() + { + Release(); + } + + // Note: A copy of a CImageList is a clone of the original. + inline CImageList& CImageList::operator=(const CImageList& rhs) + { + if (this != &rhs) + { + Release(); + m_pData = rhs.m_pData; + } + + return *this; + } + + inline CImageList& CImageList::operator=(HIMAGELIST rhs) + { + Attach(rhs); + return *this; + } + + // Retrieves the image list's handle. + inline CImageList::operator HIMAGELIST () const + { + return m_pData->images; + } + + // Adds an image or images to an image list. + // Refer to ImageList_Add in the Windows API documentation for more information. + inline int CImageList::Add(HBITMAP bitmap) const + { + assert(m_pData); + assert(m_pData->images); + return ::ImageList_Add(m_pData->images, bitmap, 0); + } + + // Adds an image or images to an image list, generating a mask from the specified bitmap. + // Refer to ImageList_Add in the Windows API documentation for more information. + inline int CImageList::Add(HBITMAP bitmap, HBITMAP mask) const + { + assert(m_pData); + assert(m_pData->images); + return ::ImageList_Add(m_pData->images, bitmap, mask); + } + + // Adds an image or images to an image list, using the specified color as the mask. + // Refer to ImageList_AddMasked in the Windows API documentation for more information. + inline int CImageList::Add(HBITMAP bitmap, COLORREF mask) const + { + assert(m_pData); + assert(m_pData->images); + return ::ImageList_AddMasked(m_pData->images, bitmap, mask); + } + + // Adds an icon specified by its handle to the image list. + // Refer to ImageList_ReplaceIcon in the Windows API documentation for more information. + inline int CImageList::Add(HICON icon) const + { + assert(m_pData); + assert(m_pData->images); + + // Append the icon to the image list + return ::ImageList_ReplaceIcon(m_pData->images, -1, icon); + } + + // Adds an icon specified by its resource ID to the image list. + // Refer to ImageList_ReplaceIcon in the Windows API documentation for more information. + inline int CImageList::AddIcon(UINT iconID) const + { + HICON icon = GetApp()->LoadIcon(iconID); + return Add(icon); + } + + // Attaches an existing ImageList to this CImageList. + inline void CImageList::Attach(HIMAGELIST images) + { + assert(m_pData); + + if (images != m_pData->images) + { + // Release any existing ImageList. + if (m_pData->images) + { + Release(); + m_pData = std::make_shared(); + } + + if (images != nullptr) + { + // Add the image list to this CImageList. + std::shared_ptr pCImlData = GetApp()->GetCImlData(images).lock(); + if (pCImlData) + { + m_pData = std::move(pCImlData); + } + else + { + // Add the ImageList Data to the map. + m_pData->images = images; + GetApp()->AddCImlDataToMap(m_pData->images, m_pData); + } + } + } + } + + // Attach and own the specified image list. + inline void CImageList::Assign(HIMAGELIST images) + { + Attach(images); + m_pData->isManagedHiml = true; + } + + // Begins dragging an image. + // Refer to ImageList_BeginDrag in the Windows API documentation for more information. + inline BOOL CImageList::BeginDrag(int image, CPoint hotSpot) const + { + assert(m_pData); + assert(m_pData->images); + return ::ImageList_BeginDrag(m_pData->images, image, hotSpot.x, hotSpot.y); + } + + // Copies images within the image list. + // Possible flags: ILCF_MOVE, ILCF_SWAP. + // Refer to ImageList_Copy in the Windows API documentation for more information. + inline BOOL CImageList::Copy(int Dest, int Src, UINT flags /*= ILCF_MOVE*/) const + { + assert(m_pData); + assert(m_pData->images); + return ::ImageList_Copy(*this, Dest, *this, Src, flags); + } + + // Creates a new image list. + // Possible flag values: + // ILC_COLOR Use the default behavior if none of the other ILC_COLOR* flags is specified. + // ILC_COLOR4 Use a 4-bit (16-color) device-independent bitmap (DIB) section as the bitmap + // for the image list. + // ILC_COLOR8 Use an 8-bit DIB section. The colors used for the color table are the same + // colors as the halftone palette. + // ILC_COLOR16 Use a 16-bit (32/64k-color) DIB section. + // ILC_COLOR24 Use a 24-bit DIB section. + // ILC_COLOR32 Use a 32-bit DIB section. + // ILC_COLORDDB Use a device-dependent bitmap. + // ILC_MASK Use a mask. The image list contains two bitmaps, one of which is a + // monochrome bitmap used as a mask. If this value is not included, + // the image list contains only one bitmap. + // Refer to ImageList_Create in the Windows API documentation for more information. + inline void CImageList::Create(int cx, int cy, UINT flags, int initial, int grow) + { + assert(m_pData); + + HIMAGELIST images = ::ImageList_Create(cx, cy, flags, initial, grow); + + if (images == nullptr) + throw CResourceException(GetApp()->MsgImageList()); + + Assign(images); + } + + // Creates a new image list. + // cx The width of each image. + // nGrow The number of images by which the image list can grow when the + // system needs to make room for new images. + // crMask The color used to generate a mask. Each pixel of this color in + // the specified bitmap is changed to black, and the corresponding + // bit in the mask is set to 1. If this parameter is the CLR_NONE + // value, no mask is generated. + // Refer to ImageList_Create in the Windows API documentation for more information. + inline void CImageList::Create(int bitmapID, int cx, int grow, COLORREF mask) + { + assert(m_pData); + + LPCTSTR bitmapName = MAKEINTRESOURCE(bitmapID); + Create(bitmapName, cx, grow, mask); + } + + // Creates a new image list. + // + // cx The width of each image. + // nGrow The number of images by which the image list can grow when the + // system needs to make room for new images. + // crMask The color used to generate a mask. Each pixel of this color in + // the specified bitmap is changed to black, and the corresponding + // bit in the mask is set to 1. If this parameter is the CLR_NONE + // value, no mask is generated. + // Refer to ImageList_LoadBitmap in the Windows API documentation for more information. + inline void CImageList::Create(LPCTSTR resourceName, int cx, int grow, COLORREF mask) + { + assert(m_pData); + + HIMAGELIST images = ::ImageList_LoadBitmap(GetApp()->GetResourceHandle(), resourceName, cx, grow, mask); + if (images == nullptr) + throw CResourceException(GetApp()->MsgImageList()); + + Assign(images); + } + + // Creates a duplicate ImageList + // Refer to ImageList_Duplicate in the Windows API documentation for more information. + inline void CImageList::Create(HIMAGELIST images) + { + assert(m_pData); + + HIMAGELIST copyImages = ::ImageList_Duplicate(images); + if (copyImages == nullptr) + throw CResourceException(GetApp()->MsgImageList()); + + Assign(copyImages); + } + + // Creates a gray scale image list from the specified color image list. + inline BOOL CImageList::CreateDisabledImageList(HIMAGELIST normalImages) + { + assert(normalImages); + + int count = ::ImageList_GetImageCount(normalImages); + if (count > 0) + { + int cx, cy; + ::ImageList_GetIconSize(normalImages, &cx, &cy); + + // Create the disabled ImageList. + Create(cx, cy, ILC_COLOR24 | ILC_MASK, count, 0); + + // Process each image in the ImageList. + for (int i = 0; i < count; ++i) + { + CClientDC desktopDC(HWND_DESKTOP); + CMemDC memDC(desktopDC); + memDC.CreateCompatibleBitmap(desktopDC, cx, cx); + CRect rc; + rc.SetRect(0, 0, cx, cx); + + // Set the mask color to gray for the new ImageList + COLORREF mask = RGB(200, 200, 200); + if (GetDeviceCaps(desktopDC, BITSPIXEL) < 24) + { + HPALETTE hPal = static_cast(GetCurrentObject(desktopDC, OBJ_PAL)); + UINT index = GetNearestPaletteIndex(hPal, mask); + if (index != CLR_INVALID) + mask = PALETTEINDEX(index); + } + memDC.SolidFill(mask, rc); + + // Draw the image on the memory DC. + ::ImageList_Draw(normalImages, i, memDC, 0, 0, ILD_NORMAL); + + // Convert the bitmap to grayscale and add it to the image list. + CBitmap bitmap = memDC.DetachBitmap(); + bitmap.ConvertToDisabled(mask); + Add(bitmap, mask); + } + } + + return (m_pData->images != nullptr) ? TRUE : FALSE; + } + + // Creates a transparent version of an item image within the header control. + // Refer to Header_CreateDragImage in the Windows API documentation for more information. + inline void CImageList::CreateDragImage(HWND header, int index) + { + assert(::IsWindow(header)); + HIMAGELIST images = Header_CreateDragImage(header, index); + + if (images == nullptr) + throw CResourceException(GetApp()->MsgGdiImageList()); + + Assign(images); + } + + // Creates a drag image list for the specified item. + // Refer to ListView_CreateDragImage in the Windows API documentation for more information. + inline void CImageList::CreateDragImage(HWND listView, int item, CPoint& pt) + { + assert(::IsWindow(listView)); + HIMAGELIST images = ListView_CreateDragImage(listView, item, &pt); + + if (images == nullptr) + throw CResourceException(GetApp()->MsgGdiImageList()); + + Assign(images); + } + + // Creates a dragging bitmap for the specified item in a tree-view control. + // It also creates an image list for the bitmap and adds the bitmap to the image list. + // Refer to TreeView_CreateDragImage in the Windows API documentation for more information. + inline void CImageList::CreateDragImage(HWND treeView, HTREEITEM item) + { + assert(::IsWindow(treeView)); + HIMAGELIST images = TreeView_CreateDragImage(treeView, item); + + if (images == nullptr) + throw CResourceException(GetApp()->MsgGdiImageList()); + + Assign(images); + } + + // Destroys the image list if it is managed and returns this object to its + // default state. + inline void CImageList::Destroy() + { + assert(m_pData); + + if (m_pData && m_pData->images != nullptr) + { + if (IsAppRunning()) // Is the CWinApp object still valid? + GetApp()->RemoveImageListFromMap(m_pData->images); + + if (m_pData->isManagedHiml) + ::ImageList_Destroy(m_pData->images); + + // Nullify all copies of m_pData. + *m_pData.get() = {}; + } + } + + // Detaches the HIMAGELIST from all CImageList objects. + // Note: We rarely need to detach the HIMAGELIST from CImageList. + // The framework will delete the HIMAGELIST automatically if required. + inline HIMAGELIST CImageList::Detach() + { + assert(m_pData); + + HIMAGELIST images = m_pData->images; + GetApp()->RemoveImageListFromMap(images); + + // Nullify all copies of m_pData. + *m_pData.get() = {}; + + // Make a new shared_ptr for this object. + m_pData = std::make_shared(); + + return images; + } + + // Displays the drag image at the specified position within the window. + // Refer to ImageList_DragEnter in the Windows API documentation for more information. + inline BOOL CImageList::DragEnter(HWND lock, CPoint point) const + { + assert(m_pData->images); + return ::ImageList_DragEnter(lock, point.x, point.y); + } + + // Unlocks the specified window and hides the drag image, allowing the window to be updated. + // Refer to ImageList_DragLeave in the Windows API documentation for more information. + inline BOOL CImageList::DragLeave(HWND lock) const + { + return ::ImageList_DragLeave(lock); + } + + // Moves the image that is being dragged during a drag-and-drop operation. + // This function is typically called in response to a WM_MOUSEMOVE message. + // Refer to ImageList_DragMove in the Windows API documentation for more information. + inline BOOL CImageList::DragMove(CPoint point) const + { + return ::ImageList_DragMove(point.x, point.y); + } + + // Shows or hides the drag image during a drag operation, without locking the window. + // Refer to ImageList_DragShowNolock in the Windows API documentation for more information. + inline BOOL CImageList::DragShowNolock(BOOL show) const + { + return ::ImageList_DragShowNolock(show); + } + + // Draws an image list item in the specified device context. + // Refer to ImageList_Draw in the Windows API documentation for more information. + inline BOOL CImageList::Draw(HDC dc, int image, POINT point, UINT style) const + { + assert(m_pData->images); + return ::ImageList_Draw(m_pData->images, image, dc, point.x, point.y, style); + } + + // Draws an image list item in the specified device context. The function + // uses the specified drawing style and blends the image with the specified color. + // nStyle can have the following values: + // ILD_BLEND25, ILD_FOCUS + // Draws the image, blending 25 percent with the blend color specified by rgbFg. + // This value has no effect if the image list does not contain a mask. + // ILD_BLEND50, ILD_SELECTED, ILD_BLEND + // Draws the image, blending 50 percent with the blend color specified by rgbFg. + // This value has no effect if the image list does not contain a mask. + // ILD_MASK Draws the mask. + // ILD_NORMAL Draws the image using the background color for the image list. If + // the background color is the CLR_NONE value, the image is drawn + // transparently using the mask. + // ILD_TRANSPARENT Draws the image transparently using the mask, regardless of + // the background color. This value has no effect if the image list + // does not contain a mask. + // ILD_IMAGE If the overlay does not require a mask to be drawn set the + // ILD_IMAGE flag. This causes ImageList_DrawEx to just draw the + // image, ignoring the mask. + // Refer to ImageList_Draw in the Windows API documentation for more information. + inline BOOL CImageList::DrawEx(HDC dc, int image, POINT pt, SIZE sz, + COLORREF bckgnd, COLORREF frgnd, UINT style) const + { + assert(m_pData->images); + return ::ImageList_DrawEx(m_pData->images, image, dc, pt.x, pt.y, sz.cx, + sz.cy, bckgnd, frgnd, style); + } + + // Draws an image list image based on an IMAGELISTDRAWPARAMS structure. + // Refer to ImageList_DrawIndirect in the Windows API documentation for more information. + inline BOOL CImageList::DrawIndirect(IMAGELISTDRAWPARAMS* pimldp) const + { + assert(m_pData->images); + return ::ImageList_DrawIndirect(pimldp); + } + + // Ends a drag operation. + // Refer to ImageList_EndDrag in the Windows API documentation for more information. + inline void CImageList::EndDrag() const + { + assert(m_pData->images); + ::ImageList_EndDrag(); + } + + // Creates an icon or cursor based on an image and mask in an image list. + // Refer to ImageList_ExtractIcon in the Windows API documentation for more information. + inline HICON CImageList::ExtractIcon(int index) const + { + assert(m_pData->images); + return ::ImageList_ExtractIcon(GetApp()->GetResourceHandle(), *this, index); + } + + // Retrieves the current background color for an image list. + // Refer to ImageList_GetBkColor in the Windows API documentation for more information. + inline COLORREF CImageList::GetBkColor() const + { + assert(m_pData->images); + return ::ImageList_GetBkColor(*this); + } + + // Retrieves the temporary image list that is used for the drag image. + // pHotspot - Pointer to a POINT structure that receives the offset of the + // drag image relative to the drag position. Can be nullptr. + // Refer to ImageList_GetDragImage in the Windows API documentation for more information. + inline HIMAGELIST CImageList::GetDragImage(POINT* pPoint, POINT* pHotspot) const + { + assert(m_pData->images); + return ::ImageList_GetDragImage(pPoint, pHotspot); + } + + // Returns the HIMAGELIST assigned to this CImageList. + inline HIMAGELIST CImageList::GetHandle() const + { + return m_pData->images; + } + + // Creates an icon from an image and mask in an image list. + // Refer to ImageList_GetIcon in the Windows API documentation for more information. + inline HICON CImageList::GetIcon(int image, UINT flags) const + { + assert(m_pData->images); + return ::ImageList_GetIcon(m_pData->images, image, flags); + } + + // Retrieves the dimensions of images in an image list. + // Refer to ImageList_GetIconSize in the Windows API documentation for more information. + inline CSize CImageList::GetIconSize() const + { + assert(m_pData->images); + int cx = 0; + int cy = 0; + ::ImageList_GetIconSize(m_pData->images, &cx, &cy); + return CSize(cx, cy); + } + + // Retrieves the number of images in an image list. + // Refer to ImageList_GetImageCount in the Windows API documentation for more information. + inline int CImageList::GetImageCount() const + { + assert(m_pData->images); + return ::ImageList_GetImageCount(m_pData->images); + } + + // Retrieves information about an image. + // Refer to ImageList_GetImageInfo in the Windows API documentation for more information. + inline BOOL CImageList::GetImageInfo(int image, IMAGEINFO* pImageInfo) const + { + assert(m_pData->images); + assert(pImageInfo); + return ::ImageList_GetImageInfo(m_pData->images, image, pImageInfo); + } + + // Reads the image list from a stream. + // Refer to ImageList_Read in the Windows API documentation for more information. + inline void CImageList::Read(LPSTREAM pStream) + { + HIMAGELIST images = ::ImageList_Read(pStream); + if (images) + { + Assign(images); + } + } + + // Destroys m_pData if this is the only copy of the CImageList. + inline void CImageList::Release() + { + assert(m_pData); + + if (m_pData.use_count() == 1) + { + Destroy(); + } + } + + // Removes an image from an image list. + // Refer to ImageList_Remove in the Windows API documentation for more information. + inline BOOL CImageList::Remove(int image) const + { + assert(m_pData->images); + return ::ImageList_Remove(m_pData->images, image); + } + + // Replaces an image in an image list with a new image. + // Refer to ImageList_Replace in the Windows API documentation for more information. + inline BOOL CImageList::Replace(int image, HBITMAP bitmap, HBITMAP mask) const + { + assert(m_pData->images); + return ::ImageList_Replace(m_pData->images, image, bitmap, mask); + } + + // Replaces an image with an icon or cursor. + // Refer to ImageList_ReplaceIcon in the Windows API documentation for more information. + inline int CImageList::Replace(int image, HICON icon) const + { + assert(m_pData->images); + return ::ImageList_ReplaceIcon(m_pData->images, image, icon); + } + + // Sets the background color for an image list.This function only works if + // you add an icon or use ImageList_AddMasked with a black and white bitmap. + // Without a mask, the entire image is drawn; hence the background color is + // not visible. + // Refer to ImageList_SetBkColor in the Windows API documentation for more information. + inline COLORREF CImageList::SetBkColor(COLORREF bckgnd) const + { + assert(m_pData->images); + return ::ImageList_SetBkColor(*this, bckgnd); + } + + // Creates a new drag image by combining the specified image (typically a + // mouse cursor image) with the current drag image. + // Refer to ImageList_SetDragCursorImage in the Windows API documentation for more information. + inline BOOL CImageList::SetDragCursorImage(int drag, int dxHotspot, int dyHotspot) const + { + assert(m_pData->images); + return ::ImageList_SetDragCursorImage(*this, drag, dxHotspot, dyHotspot); + } + + // Writes the image list to a stream. + // Refer to ImageList_Write in the Windows API documentation for more information. + inline BOOL CImageList::Write(LPSTREAM pStream) const + { + assert(m_pData->images); + return ImageList_Write(*this, pStream); + } + +} // namespace Win32xx + +#endif // _WIN32XX_IMAGELIST_H_ + diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_listview.h b/packages/media/cpp/packages/Win32xx/include/wxx_listview.h new file mode 100644 index 00000000..bfda19a1 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_listview.h @@ -0,0 +1,1068 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + + +#ifndef _WIN32XX_LISTVIEW_H_ +#define _WIN32XX_LISTVIEW_H_ + +#include "wxx_wincore.h" + + +namespace Win32xx +{ + + ///////////////////////////////////////////////////////////// + // ClistView manages a List View control. A list-view control + // is a window that displays a collection of items. Each item + // consists of an icon and a label. + class CListView : public CWnd + { + public: + CListView() = default; + virtual ~CListView() override = default; + virtual void OnAttach() override; + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual void PreRegisterClass(WNDCLASS& wc) override; + + // Accessors and mutators + CSize ApproximateViewRect(CSize sz = CSize(-1, -1), int count = -1) const; + COLORREF GetBkColor( ) const; + BOOL GetBkImage( LVBKIMAGE& image ) const; + UINT GetCallbackMask( ) const; + BOOL GetCheckState( int item ) const; + BOOL GetColumn( int col, LVCOLUMN& colInfo ) const; + BOOL GetColumnOrderArray( LPINT pArrayOfCol, int count = -1 ) const; + int GetColumnWidth( int col ) const; + int GetCountPerPage( ) const; + HWND GetEditControl( ) const; + DWORD GetExtendedStyle( ) const; + HWND GetHeader( ) const; + HCURSOR GetHotCursor( ); + int GetHotItem( ) const; + DWORD GetHoverTime( ) const; + CImageList GetImageList( int imageType ) const; + BOOL GetItem( LVITEM& itemInfo ) const; + int GetItemCount( ) const; + DWORD_PTR GetItemData( int item ) const; + BOOL GetItemPosition( int item, CPoint& pt ) const; + BOOL GetItemRect( int item, RECT& rc, UINT code ) const; + CRect GetItemRect(int item, UINT code) const; + UINT GetItemState( int item, UINT mask ) const; + CString GetItemText( int item, int subItem, int textMax = 260 ) const; + int GetNextItem( int item, int flags ) const; + UINT GetNumberOfWorkAreas( ) const; + BOOL GetOrigin( CPoint& pt ) const; + UINT GetSelectedCount( ) const; + int GetSelectionMark( ) const; + int GetStringWidth( LPCTSTR string ) const; + BOOL GetSubItemRect( int item, int subItem, int code, RECT& rc ) const; + COLORREF GetTextBkColor( ) const; + COLORREF GetTextColor( ) const; + HWND GetToolTips( ) const; + int GetTopIndex( ) const; + BOOL GetViewRect( RECT& rc ) const; + void GetWorkAreas( int workAreas, LPRECT pRectArray ) const; + BOOL SetBkColor( COLORREF color ) const; + BOOL SetBkImage( LVBKIMAGE& pImage ) const; + BOOL SetCallbackMask( UINT mask ) const; + void SetCheckState( int item, BOOL checked = TRUE ) const; + BOOL SetColumn( int col, const LVCOLUMN& columnInfo ) const; + BOOL SetColumnOrderArray( int count, LPINT pArrayOfCol) const; + BOOL SetColumnWidth( int col, int cx ) const; + DWORD SetExtendedStyle( DWORD exStyle ) const; + HCURSOR SetHotCursor( HCURSOR cursor ) const; + int SetHotItem( int index ) const; + DWORD SetHoverTime( DWORD hoverTime = static_cast(-1) ) const; + CSize SetIconSpacing( int cx, int cy ) const; + CSize SetIconSpacing( CSize sz ) const; + CImageList SetImageList( HIMAGELIST images, int imageListType ); + BOOL SetItem( LVITEM& itemInfo ) const; + BOOL SetItem( int item, int subItem, UINT mask, LPCTSTR text, int image, + UINT state, UINT stateMask, LPARAM lparam, int indent ) const; + void SetItemCount( int count ) const; + void SetItemCountEx( int count, DWORD flags = LVSICF_NOINVALIDATEALL ) const; + BOOL SetItemData( int item, DWORD_PTR data ) const; + BOOL SetItemPosition( int item, CPoint& pt ) const; + BOOL SetItemState( int item, LVITEM& itemInfo ) const; + void SetItemState( int item, UINT state, UINT mask ) const; + void SetItemText( int item, int subItem, LPCTSTR text ) const; + int SetSelectionMark( int index ) const; + BOOL SetTextBkColor( COLORREF color ) const; + BOOL SetTextColor( COLORREF color ) const; + HWND SetToolTips ( HWND toolTip ) const; + void SetWorkAreas( int workAreas, LPCRECT pRectArray ) const; + int SubItemHitTest( LVHITTESTINFO& hitInfo) const; + + // Operations + BOOL Arrange( UINT code ) const; + CImageList CreateDragImage( int item, CPoint& pt ) const; + BOOL DeleteAllItems( ) const; + BOOL DeleteColumn( int col ) const; + BOOL DeleteItem( int item ) const; + HWND EditLabel( int item ) const; + BOOL EnsureVisible( int item, BOOL isPartialOK ) const; + int FindItem( LVFINDINFO& findInfo, int start = -1 ) const; + int HitTest( LVHITTESTINFO& hitTestInfo ) const; + int HitTest( CPoint pt, UINT* flags = nullptr ) const; + int InsertColumn( int col, const LVCOLUMN& colInfo ) const; + int InsertColumn( int col, LPCTSTR columnHeading, int format = LVCFMT_LEFT, + int width = -1, int subItem = -1 ) const; + int InsertItem( const LVITEM& itemInfo ) const; + int InsertItem( int item, LPCTSTR text ) const; + int InsertItem( int item, LPCTSTR text, int image ) const; + int InsertItem( UINT mask, int item, LPCTSTR text, UINT state, + UINT stateMask, int image, LPARAM lparam ) const; + BOOL RedrawItems( int first, int last ) const; + BOOL Scroll( CSize sz ) const; + BOOL SortItems( PFNLVCOMPARE pCompareFn, DWORD_PTR data ) const; + BOOL Update( int item ) const; + + private: + CListView(const CListView&) = delete; + CListView& operator=(const CListView&) = delete; + + CImageList m_normalImages; + CImageList m_smallImages; + CImageList m_stateImages; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + /////////////////////////////////////// + // Definitions for the CListView class. + // + + // Calculates the approximate width and height required to display a given + // number of items. + // Refer to ListView_ApproximateViewRect in the Windows API documentation for more information. + inline CSize CListView::ApproximateViewRect(CSize sz /*= CSize(-1, -1)*/, int count /* = -1*/) const + { + assert(IsWindow()); + return CSize( ListView_ApproximateViewRect( *this, sz.cx, sz.cy, count ) ); + } + + // Arranges items in icon view. + // Refer to ListView_Arrange in the Windows API documentation for more information. + inline BOOL CListView::Arrange(UINT code) const + { + assert(IsWindow()); + return ListView_Arrange(*this, code); + } + + // Creates a drag image list for the specified item. + // Refer to ListView_CreateDragImage in the Windows API documentation for more information. + inline CImageList CListView::CreateDragImage(int item, CPoint& pt) const + { + assert(IsWindow()); + CImageList images; + images.CreateDragImage(*this, item, pt); + return images; + } + + // Removes all items from the list-view control. + // Refer to ListView_DeleteAllItems in the Windows API documentation for more information. + inline BOOL CListView::DeleteAllItems() const + { + assert(IsWindow()); + return ListView_DeleteAllItems(*this); + } + + // Removes a column from the list-view control. + // Refer to ListView_DeleteColumn in the Windows API documentation for more information. + inline BOOL CListView::DeleteColumn(int col) const + { + assert(IsWindow()); + return ListView_DeleteColumn(*this, col); + } + + // Removes an item from the list-view control. + // Refer to ListView_DeleteItem in the Windows API documentation for more information. + inline BOOL CListView::DeleteItem(int item) const + { + assert(IsWindow()); + return ListView_DeleteItem(*this, item); + } + + // Begins in-place editing of the list-view item's text. + // Refer to ListView_EditLabel in the Windows API documentation for more information. + inline HWND CListView::EditLabel(int item) const + { + assert(IsWindow()); + return ListView_EditLabel(*this, item); + } + + // Ensures that a list-view item is either entirely or partially visible, + // scrolling the list-view control if necessary. + // Refer to LVM_ENSUREVISIBLE in the Windows API documentation for more information. + inline BOOL CListView::EnsureVisible(int item, BOOL isPartialOK) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(item); + LPARAM lparam = static_cast(isPartialOK); + return static_cast(SendMessage(LVM_ENSUREVISIBLE, wparam, lparam)); + } + + // Searches for a list-view item with the specified characteristics. + // Refer to ListView_FindItem in the Windows API documentation for more information. + inline int CListView::FindItem(LVFINDINFO& findInfo, int start /*= -1*/) const + { + assert(IsWindow()); + return ListView_FindItem(*this, start, &findInfo); + } + + // Retrieves the background color of the list-view control. + // Refer to ListView_GetBkColor in the Windows API documentation for more information. + inline COLORREF CListView::GetBkColor( ) const + { + assert(IsWindow()); + return ListView_GetBkColor( *this ); + } + + // Retrieves the background image in the list-view control. + // Refer to ListView_GetBkImage in the Windows API documentation for more information. + inline BOOL CListView::GetBkImage( LVBKIMAGE& image ) const + { + assert(IsWindow()); + return ListView_GetBkImage( *this, &image ); + } + + // Retrieves the callback mask for the list-view control. + // Refer to ListView_GetCallbackMask in the Windows API documentation for more information. + inline UINT CListView::GetCallbackMask( ) const + { + assert(IsWindow()); + return static_cast(ListView_GetCallbackMask( *this )); + } + + // Determines if an item in the list-view control is selected. + // Refer to ListView_GetCheckState in the Windows API documentation for more information. + inline BOOL CListView::GetCheckState( int item ) const + { + assert(IsWindow()); + return static_cast(ListView_GetCheckState( *this, item )); + } + + // Retrieves the attributes of the list-view control's column. + // Refer to ListView_GetColumn in the Windows API documentation for more information. + inline BOOL CListView::GetColumn( int col, LVCOLUMN& colInfo ) const + { + assert(IsWindow()); + return ListView_GetColumn( *this, col, &colInfo); + } + + // Retrieves the current left-to-right order of columns in the list-view + // control. + // Refer to ListView_GetColumnOrderArray in the Windows API documentation for more information. + inline BOOL CListView::GetColumnOrderArray( LPINT pArrayOfCol, int count /*= -1*/ ) const + { + assert(IsWindow()); + return ListView_GetColumnOrderArray( *this, count, pArrayOfCol); + } + + // Retrieves the width of a column in report or list view. + // Refer to ListView_GetColumnWidth in the Windows API documentation for more information. + inline int CListView::GetColumnWidth( int col ) const + { + assert(IsWindow()); + return ListView_GetColumnWidth( *this, col ); + } + + // Calculates the number of items that can fit vertically in the visible + // area of the list-view control when in list or report view. Only fully + // visible items are counted. + // Refer to ListView_GetCountPerPage in the Windows API documentation for more information. + inline int CListView::GetCountPerPage( ) const + { + assert(IsWindow()); + return ListView_GetCountPerPage( *this ); + } + + // Retrieves the handle to the edit control being used to edit the + // list-view item's text. + // Refer to ListView_GetEditControl in the Windows API documentation for more information. + inline HWND CListView::GetEditControl( ) const + { + assert(IsWindow()); + return ListView_GetEditControl(*this); + } + + // Retrieves the extended styles that are currently in use for the + // list-view control. + // Refer to ListView_GetExtendedListViewStyle in the Windows API documentation for more information. + inline DWORD CListView::GetExtendedStyle( ) const + { + assert(IsWindow()); + return ListView_GetExtendedListViewStyle( *this ); + } + + // Retrieves the handle to the header control used by the list-view control. + // Refer to ListView_GetHeader in the Windows API documentation for more information. + inline HWND CListView::GetHeader( ) const + { + assert(IsWindow()); + return ListView_GetHeader(*this); + } + + // Retrieves the HCURSOR used when the pointer is over an item while hot + // tracking is enabled. + // Refer to ListView_GetHotCursor in the Windows API documentation for more information. + inline HCURSOR CListView::GetHotCursor( ) + { + assert(IsWindow()); + return ListView_GetHotCursor( *this ); + } + + // Retrieves the index of the hot item. + // Refer to ListView_GetHotItem in the Windows API documentation for more information. + inline int CListView::GetHotItem( ) const + { + assert(IsWindow()); + return ListView_GetHotItem( *this ); + } + + // Retrieves the amount of time that the mouse cursor must hover over an + // item before it is selected. + // Refer to ListView_GetHoverTime in the Windows API documentation for more information. + inline DWORD CListView::GetHoverTime( ) const + { + assert(IsWindow()); + return ListView_GetHoverTime( *this ); + } + + // Retrieves the handle to an image list used for drawing list-view items. + // imageType: LVSIL_NORMAL; LVSIL_SMALL; or LVSIL_STATE. + // Refer to ListView_GetImageList in the Windows API documentation for more information. + inline CImageList CListView::GetImageList( int imageType ) const + { + assert(IsWindow()); + HIMAGELIST images = ListView_GetImageList( *this, imageType ); + return CImageList(images); + } + + // Retrieves some or all of the list-view item's attributes. + // Refer to ListView_GetItem in the Windows API documentation for more information. + inline BOOL CListView::GetItem( LVITEM& itemInfo ) const + { + assert(IsWindow()); + return ListView_GetItem( *this, &itemInfo ); + } + + // Retrieves the number of items in the list-view control. + // Refer to ListView_GetItemCount in the Windows API documentation for more information. + inline int CListView::GetItemCount( ) const + { + assert(IsWindow()); + return ListView_GetItemCount( *this ); + } + + // Retrieves the value(lparam) specific to the item. + // Refer to LVM_GETITEM in the Windows API documentation for more information. + inline DWORD_PTR CListView::GetItemData( int item ) const + { + assert(IsWindow()); + + LVITEM lvi = {}; + lvi.iItem = item; + lvi.mask = LVIF_PARAM; + SendMessage(LVM_GETITEM, 0, reinterpret_cast(&lvi)); + return static_cast(lvi.lParam); + } + + // Retrieves the position of the list-view item. + // Refer to ListView_GetItemPosition in the Windows API documentation for more information. + inline BOOL CListView::GetItemPosition( int item, CPoint& pt ) const + { + assert(IsWindow()); + return ListView_GetItemPosition( *this, item, &pt ); + } + + // Retrieves the bounding rectangle for all or part of an item in the + // current view. + // code: LVIR_BOUNDS; LVIR_ICON; LVIR_LABEL; or LVIR_SELECTBOUNDS. + // Refer to ListView_GetItemRect in the Windows API documentation for more information. + inline BOOL CListView::GetItemRect( int item, RECT& rc, UINT code ) const + { + assert(IsWindow()); + return ListView_GetItemRect( *this, item, &rc, static_cast(code) ); + } + + // Retrieves the bounding rectangle for all or part of an item in the + // current view. + // code: LVIR_BOUNDS; LVIR_ICON; LVIR_LABEL; or LVIR_SELECTBOUNDS. + // Refer to ListView_GetItemRect in the Windows API documentation for more information. + inline CRect CListView::GetItemRect(int item, UINT code) const + { + assert(IsWindow()); + CRect rc; + ListView_GetItemRect(*this, item, &rc, static_cast(code)); + return rc; + } + + // Retrieves the state of the list-view item. + // Possible values of mask: + // LVIS_CUT The item is marked for a cut-and-paste operation. + // LVIS_DROPHILITED The item is highlighted as a drag-and-drop target. + // LVIS_FOCUSED The item has the focus, so it is surrounded by a standard focus rectangle. + // LVIS_SELECTED The item is selected. + // LVIS_OVERLAYMASK Use this mask to retrieve the item's overlay image index. + // LVIS_STATEIMAGEMASK Use this mask to retrieve the item's state image index. + // Refer to ListView_GetItemState in the Windows API documentation for more information. + inline UINT CListView::GetItemState( int item, UINT mask ) const + { + assert(IsWindow()); + return ListView_GetItemState( *this, item, mask ); + } + + // Retrieves the text of the list-view item. + // Note: Although the list-view control allows any length string to be stored + // as item text, only the first 260 characters are displayed. + // Refer to LVM_GETITEM in the Windows API documentation for more information. + inline CString CListView::GetItemText( int item, int subItem, int textMax /* = 260 */ ) const + { + assert(IsWindow()); + + CString str; + if (textMax > 0) + { + LVITEM lvi = {}; + lvi.iItem = item; + lvi.iSubItem = subItem; + lvi.mask = LVIF_TEXT; + lvi.cchTextMax = textMax; + lvi.pszText = str.GetBuffer(textMax); + SendMessage(LVM_GETITEM, 0 , reinterpret_cast(&lvi)); + str.ReleaseBuffer(); + } + return str; + } + + // Searches for a list-view item that has the specified properties and + // bears the specified relationship to a specified item. + // Refer to ListView_GetNextItem in the Windows API documentation for more information. + inline int CListView::GetNextItem( int item, int flags ) const + { + assert(IsWindow()); + return ListView_GetNextItem( *this, item, flags ); + } + + // Retrieves the working areas from the list-view control. + // Refer to LVM_GETNUMBEROFWORKAREAS in the Windows API documentation for more information. + inline UINT CListView::GetNumberOfWorkAreas( ) const + { + assert(IsWindow()); + UINT workAreas = 0; + SendMessage(LVM_GETNUMBEROFWORKAREAS, 0, reinterpret_cast(&workAreas)); + return workAreas; + } + + // Retrieves the current view origin for the list-view control. + // Refer to ListView_GetOrigin in the Windows API documentation for more information. + inline BOOL CListView::GetOrigin( CPoint& pt ) const + { + assert(IsWindow()); + return ListView_GetOrigin( *this, &pt ); + } + + // Determines the number of selected items in the list-view control. + // Refer to LVM_GETSELECTEDCOUNT in the Windows API documentation for more information. + inline UINT CListView::GetSelectedCount( ) const + { + assert(IsWindow()); + return static_cast(SendMessage( LVM_GETSELECTEDCOUNT, 0, 0 )); + } + + // Retrieves the selection mark from the list-view control. + // Refer to LVM_GETSELECTIONMARK in the Windows API documentation for more information. + inline int CListView::GetSelectionMark( ) const + { + assert(IsWindow()); + return static_cast(SendMessage( LVM_GETSELECTIONMARK, 0, 0 )); + } + + // Determines the width of a specified string using the list-view control's + // current font. + // Refer to LVM_GETSTRINGWIDTH in the Windows API documentation for more information. + inline int CListView::GetStringWidth( LPCTSTR string ) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(string); + return static_cast(SendMessage( LVM_GETSTRINGWIDTH, 0, lparam)); + } + + // Retrieves information about the rectangle that surrounds a subitem in + // the list-view control. + // Refer to ListView_GetSubItemRect in the Windows API documentation for more information. + inline BOOL CListView::GetSubItemRect( int item, int subItem, int code, RECT& rc ) const + { + assert(IsWindow()); + return ListView_GetSubItemRect( *this, item, subItem, code, &rc ); + } + + // Retrieves the text background color of the list-view control. + // Refer to ListView_GetTextBkColor in the Windows API documentation for more information. + inline COLORREF CListView::GetTextBkColor( ) const + { + assert(IsWindow()); + return ListView_GetTextBkColor( *this ); + } + + // Retrieves the text color of the list-view control. + // Refer to ListView_GetTextColor in the Windows API documentation for more information. + inline COLORREF CListView::GetTextColor( ) const + { + assert(IsWindow()); + return ListView_GetTextColor( *this ); + } + + // Retrieves the ToolTip control that the list-view control uses to display + // ToolTips. + // Refer to ListView_GetToolTips in the Windows API documentation for more information. + inline HWND CListView::GetToolTips( ) const + { + assert(IsWindow()); + return ListView_GetToolTips(*this); + } + + // Retrieves the index of the topmost visible item when in list or report + // view. + // Refer to ListView_GetTopIndex in the Windows API documentation for more information. + inline int CListView::GetTopIndex( ) const + { + assert(IsWindow()); + return ListView_GetTopIndex( *this ); + } + + // Retrieves the bounding rectangle of all items in the list-view control. + // Refer to ListView_GetViewRect in the Windows API documentation for more information. + inline BOOL CListView::GetViewRect( RECT& rc ) const + { + assert(IsWindow()); + return ListView_GetViewRect( *this, &rc ); + } + + // Retrieves the working areas from the list-view control. + // Refer to LVM_GETWORKAREAS in the Windows API documentation for more information. + inline void CListView::GetWorkAreas( int workAreas, LPRECT pRectArray ) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(workAreas); + LPARAM lparam = reinterpret_cast(pRectArray); + SendMessage(LVM_GETWORKAREAS, wparam, lparam); + } + + // Determines which list-view item, if any, is at a specified position. + // Refer to ListView_HitTest in the Windows API documentation for more information. + inline int CListView::HitTest(LVHITTESTINFO& hitInfo) const + { + assert(IsWindow()); + return ListView_HitTest(*this, &hitInfo); + } + + // Determines which list-view item, if any, is at a specified position. + // Refer to ListView_HitTest in the Windows API documentation for more information. + inline int CListView::HitTest(CPoint pt, UINT* pFlags /*= nullptr*/) const + { + assert(IsWindow()); + + LVHITTESTINFO hti = {}; + hti.flags = *pFlags; + hti.pt = pt; + return ListView_HitTest(*this, &hti); + } + + // Inserts a new column in the list-view control. + // Refer to ListView_InsertColumn in the Windows API documentation for more information. + inline int CListView::InsertColumn(int col, const LVCOLUMN& colInfo) const + { + assert(IsWindow()); + return ListView_InsertColumn(*this, col, &colInfo); + } + + // Inserts a new column in the list-view control. + // format : + // LVCFMT_BITMAP_ON_RIGHT The bitmap appears to the right of text. + // LVCFMT_CENTER Text is centered. + // LVCFMT_IMAGE The item displays an image from an image list. + // LVCFMT_JUSTIFYMASK A bitmask used to select those bits of fmt that control field justification. + // LVCFMT_LEFT Text is left-aligned. + // LVCFMT_RIGHT Text is right-aligned. + // Refer to ListView_InsertColumn in the Windows API documentation for more information. + inline int CListView::InsertColumn(int col, LPCTSTR columnHeading, int format /*= LVCFMT_LEFT*/, + int width /*= -1*/, int subItem /*= -1*/) const + { + assert(IsWindow()); + + LVCOLUMN lvc = {}; + lvc.mask = LVCF_TEXT | LVCF_ORDER | LVCF_FMT; + if (-1 != width) + { + lvc.mask |= LVCF_WIDTH; + lvc.cx = width; + } + if (-1 != subItem) + { + lvc.mask |= LVCF_SUBITEM; + lvc.iSubItem = subItem; + } + + lvc.iOrder = col; + lvc.pszText = const_cast(columnHeading); + lvc.fmt = format; + lvc.iSubItem = subItem; + return ListView_InsertColumn(*this, col, &lvc); + } + + // Inserts a new item in the list-view control. + // Refer to ListView_InsertItem in the Windows API documentation for more information. + inline int CListView::InsertItem(const LVITEM& itemInfo) const + { + assert(IsWindow()); + return ListView_InsertItem(*this, &itemInfo); + } + + // Inserts a new item in the list-view control. + // Refer to ListView_InsertItem in the Windows API documentation for more information. + inline int CListView::InsertItem(int item, LPCTSTR text) const + { + assert(IsWindow()); + + LVITEM lvi = {}; + lvi.iItem = item; + lvi.pszText = const_cast(text); + lvi.mask = LVIF_TEXT; + return ListView_InsertItem(*this, &lvi); + } + + // Inserts a new item in the list-view control. + // Refer to ListView_InsertItem in the Windows API documentation for more information. + inline int CListView::InsertItem(int item, LPCTSTR text, int image) const + { + assert(IsWindow()); + + LVITEM lvi = {}; + lvi.iItem = item; + lvi.pszText = const_cast(text); + lvi.iImage = image; + lvi.mask = LVIF_TEXT | LVIF_IMAGE; + return ListView_InsertItem(*this, &lvi); + } + + inline int CListView::InsertItem(UINT mask, int item, LPCTSTR text, UINT state, + UINT stateMask, int image, LPARAM lparam) const + { + assert(IsWindow()); + + LVITEM lvi = {}; + lvi.mask = mask; + lvi.iItem = item; + lvi.pszText = const_cast(text); + lvi.iImage = image; + lvi.state = state; + lvi.stateMask = stateMask; + lvi.lParam = lparam; + return ListView_InsertItem(*this, &lvi); + } + + // This function is called when a list-view window is attached to the + // this CListView object. + inline void CListView::OnAttach() + { + // LVS_SHAREIMAGELISTS: + // The image list will not be deleted when the control is destroyed. + // Allows Win32++ to control the destruction of the image list. + DWORD style = GetStyle(); + SetStyle(style | LVS_SHAREIMAGELISTS); + } + + // Sets the window creation parameters. + inline void CListView::PreCreate(CREATESTRUCT& cs) + { + cs.style = WS_CHILD | WS_VISIBLE | LVS_SHAREIMAGELISTS; + + // LVS_SHAREIMAGELISTS: + // The image list will not be deleted when the control is destroyed. + // Allows Win32++ to control the destruction of the image list. + } + + // Sets the window class parameters. + inline void CListView::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = WC_LISTVIEW; + } + + // Forces the list-view control to redraw a range of items. + // Refer to ListView_RedrawItems in the Windows API documentation for more information. + inline BOOL CListView::RedrawItems(int first, int last) const + { + assert(IsWindow()); + return ListView_RedrawItems(*this, first, last); + } + + // Scrolls the content of the list-view control. + // Refer to ListView_Scroll in the Windows API documentation for more information. + inline BOOL CListView::Scroll(CSize sz) const + { + assert(IsWindow()); + return ListView_Scroll(*this, sz.cx, sz.cy); + } + + // Sets the background color of the list-view control. + // Refer to ListView_SetBkColor in the Windows API documentation for more information. + inline BOOL CListView::SetBkColor( COLORREF bkColor ) const + { + assert(IsWindow()); + return ListView_SetBkColor(*this, bkColor); + } + + // Sets the background image in the list-view control. + // Refer to ListView_SetBkImage in the Windows API documentation for more information. + inline BOOL CListView::SetBkImage( LVBKIMAGE& bkImage ) const + { + assert(IsWindow()); + return ListView_SetBkImage(*this, &bkImage); + } + + // Changes the callback mask for the list-view control. + // Refer to ListView_SetCallbackMask in the Windows API documentation for more information. + inline BOOL CListView::SetCallbackMask( UINT mask ) const + { + assert(IsWindow()); + return ListView_SetCallbackMask(*this, mask); + } + + // Used to select or deselect an item in the list-view control. + // This should only be used for list-view controls with the + // LVS_EX_CHECKBOXES style. + // Refer to ListView_SetItemState in the Windows API documentation for more information. + inline void CListView::SetCheckState(int item, BOOL checked /*= TRUE*/) const + { + assert(IsWindow()); + ListView_SetItemState(*this, item, INDEXTOSTATEIMAGEMASK(( + checked != FALSE) ? 2U : 1U), LVIS_STATEIMAGEMASK); + } + + // Sets the attributes of the list-view column. + // Refer to ListView_SetColumn in the Windows API documentation for more information. + inline BOOL CListView::SetColumn(int col, const LVCOLUMN& colInfo) const + { + assert(IsWindow()); + return ListView_SetColumn(*this, col, &colInfo); + } + + // Sets the left-to-right order of columns in the list-view control. + // Refer to ListView_SetColumnOrderArray in the Windows API documentation for more information. + inline BOOL CListView::SetColumnOrderArray(int count, LPINT pArrayOfCol) const + { + assert(IsWindow()); + return ListView_SetColumnOrderArray(*this, count, pArrayOfCol); + } + + // Used to change the width of a column in report view or the width of all columns in list-view mode. + // Refer to ListView_SetColumnWidth in the Windows API documentation for more information. + inline BOOL CListView::SetColumnWidth(int col, int cx) const + { + assert(IsWindow()); + return ListView_SetColumnWidth(*this, col, cx); + } + + // Sets extended styles for the list-view control. + // Refer to ListView_SetExtendedListViewStyle in the Windows API documentation for more information. + inline DWORD CListView::SetExtendedStyle( DWORD exStyle ) const + { + assert(IsWindow()); + return ListView_SetExtendedListViewStyle(*this, static_cast(exStyle)); + } + + // Sets the HCURSOR that the list-view control uses when the pointer is + // over an item while hot tracking is enabled. + // Refer to ListView_SetHotCursor in the Windows API documentation for more information. + inline HCURSOR CListView::SetHotCursor(HCURSOR cursor) const + { + assert(IsWindow()); + return ListView_SetHotCursor(*this, cursor); + } + + // Sets the hot item in the list-view control. + // Refer to ListView_SetHotItem in the Windows API documentation for more information. + inline int CListView::SetHotItem(int index) const + { + assert(IsWindow()); + return ListView_SetHotItem(*this, index); + } + + // Sets the amount of time that the mouse cursor must hover over an item before it is selected. + // Refer to ListView_SetHoverTime in the Windows API documentation for more information. + inline DWORD CListView::SetHoverTime(DWORD hoverTime /*= -1*/) const + { + assert(IsWindow()); + return ListView_SetHoverTime(*this, hoverTime); + } + + // Sets the spacing between icons in list-view controls set to the LVS_ICON style. + // Refer to ListView_SetIconSpacing in the Windows API documentation for more information. + inline CSize CListView::SetIconSpacing( int cx, int cy ) const + { + assert(IsWindow()); + return CSize(ListView_SetIconSpacing(*this, cx, cy)); + } + + // Sets the spacing between icons in the list-view control set to the LVS_ICON style. + // Refer to ListView_SetIconSpacing in the Windows API documentation for more information. + inline CSize CListView::SetIconSpacing(CSize sz) const + { + assert(IsWindow()); + return CSize(ListView_SetIconSpacing(*this, sz.cx, sz.cy)); + } + + // Assigns an image list to the list-view control. + // Valid imageListType values: LVSIL_NORMAL, LVSIL_SMALL, LVSIL_STATE. + // Refer to ListView_SetImageList in the Windows API documentation for more information. + inline CImageList CListView::SetImageList(HIMAGELIST images, int imageListType) + { + assert(IsWindow()); + CImageList oldImages = ListView_SetImageList(*this, images, imageListType); + if (imageListType == LVSIL_STATE) + m_stateImages = images; + else if (imageListType == LVSIL_SMALL) + m_smallImages = images; + else + m_normalImages = images; + + return oldImages; + } + + // Sets some or all of a list-view item's attributes. + // The declaration for TVITEM: + // typedef struct _LVITEM { + // UINT mask; + // int iItem; + // int iSubItem; + // UINT state; + // UINT stateMask; + // LPTSTR pText; + // int cchTextMax; + // int iImage; + // LPARAM lparam; + // } LVITEM, *LVITEM&; + // Refer to ListView_SetItem in the Windows API documentation for more information. + inline BOOL CListView::SetItem(LVITEM& itemInfo) const + { + assert(IsWindow()); + return ListView_SetItem(*this, &itemInfo); + } + + // Sets some or all of a list-view item's attributes. + // Refer to ListView_SetItem in the Windows API documentation for more information. + inline BOOL CListView::SetItem(int item, int subItem, UINT mask, + LPCTSTR text, int image, UINT state, UINT stateMask, LPARAM lparam, + int indent) const + { + assert(IsWindow()); + + LVITEM lvi = {}; + lvi.iItem = item; + lvi.iSubItem = subItem; + lvi.mask = mask; + lvi.pszText = const_cast(text); + lvi.iImage = image; + lvi.state = state; + lvi.stateMask = stateMask; + lvi.lParam = lparam; + lvi.iIndent = indent; + + return ListView_SetItem( *this, &lvi); + } + + // Causes the list-view control to allocate memory for the specified number of items. + // Refer to ListView_SetItemCount in the Windows API documentation for more information. + inline void CListView::SetItemCount(int count) const + { + assert(IsWindow()); + ListView_SetItemCount(*this, count); + } + + // Sets the virtual number of items in a virtual list view. + // Refer to ListView_SetItemCountEx in the Windows API documentation for more information. + inline void CListView::SetItemCountEx(int count, DWORD flags /*= LVSICF_NOINVALIDATEALL*/) const + { + assert(IsWindow()); + ListView_SetItemCountEx(*this, count, flags); + } + + // Sets the value(lparam) specific to the item. + // Refer to ListView_SetItem in the Windows API documentation for more information. + inline BOOL CListView::SetItemData(int item, DWORD_PTR data) const + { + assert(IsWindow()); + + LVITEM lvi = {}; + lvi.iItem = item; + lvi.lParam = static_cast(data); + lvi.mask = LVIF_PARAM; + return ListView_SetItem(*this, &lvi); + } + + // Moves an item to a specified position in the list-view control (in icon + // or small icon view). + // Refer to ListView_SetItemPosition in the Windows API documentation for more information. + inline BOOL CListView::SetItemPosition(int item, CPoint& pt) const + { + assert(IsWindow()); + return ListView_SetItemPosition(*this, item, pt.x, pt.y); + } + + // Changes the state of an item in the list-view control. + // Possible values of the mask: + // LVIS_CUT The item is marked for a cut-and-paste operation. + // LVIS_DROPHILITED The item is highlighted as a drag-and-drop target. + // LVIS_FOCUSED The item has the focus, so it is surrounded by a standard focus rectangle. + // LVIS_SELECTED The item is selected. + // LVIS_OVERLAYMASK Use this mask to retrieve the item's overlay image index. + // LVIS_STATEIMAGEMASK Use this mask to retrieve the item's state image index. + // Refer to ListView_SetItemState in the Windows API documentation for more information. + inline BOOL CListView::SetItemState(int item, LVITEM& itemInfo) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(item); + LPARAM lparam = reinterpret_cast(&itemInfo); + return static_cast(SendMessage(LVM_SETITEMSTATE, wparam, lparam)); + } + + // Changes the state of an item in the list-view control. + // Possible values of the state and mask: + // LVIS_CUT The item is marked for a cut-and-paste operation. + // LVIS_DROPHILITED The item is highlighted as a drag-and-drop target. + // LVIS_FOCUSED The item has the focus, so it is surrounded by a standard focus rectangle. + // LVIS_SELECTED The item is selected. + // LVIS_OVERLAYMASK Use this mask to retrieve the item's overlay image index. + // LVIS_STATEIMAGEMASK Use this mask to retrieve the item's state image index. + // Refer to ListView_SetItemState in the Windows API documentation for more information. + inline void CListView::SetItemState( int item, UINT state, UINT mask ) const + { + assert(IsWindow()); + ListView_SetItemState(*this, item, state, mask); + } + + // Changes the text of a list-view item or subitem. + // Refer to ListView_SetItemText in the Windows API documentation for more information. + inline void CListView::SetItemText(int item, int subItem, LPCTSTR text) const + { + assert(IsWindow()); + ListView_SetItemText(*this, item, subItem, const_cast(text)); + } + + // Sets the selection mark in the list-view control. + // Refer to ListView_SetSelectionMark in the Windows API documentation for more information. + inline int CListView::SetSelectionMark( int index ) const + { + assert(IsWindow()); + return ListView_SetSelectionMark(*this, index); + } + + // Sets the background color of text in the list-view control. + // Refer to ListView_SetTextBkColor in the Windows API documentation for more information. + inline BOOL CListView::SetTextBkColor( COLORREF color ) const + { + assert(IsWindow()); + return ListView_SetTextBkColor(*this, color); + } + + // Sets the text color of the list-view control. + // Refer to ListView_SetTextColor in the Windows API documentation for more information. + inline BOOL CListView::SetTextColor(COLORREF color) const + { + assert(IsWindow()); + return ListView_SetTextColor(*this, color); + } + + // Sets the ToolTip control that the list-view control will use to display + // ToolTips. + // Refer to LVM_SETTOOLTIPS in the Windows API documentation for more information. + inline HWND CListView::SetToolTips(HWND toolTip) const + { + assert(IsWindow()); + WPARAM wparam = reinterpret_cast(toolTip); + return reinterpret_cast(SendMessage(LVM_SETTOOLTIPS, wparam, 0)); + } + + // Sets the working area within the list-view control. + // Refer to LVM_SETWORKAREAS in the Windows API documentation for more information. + inline void CListView::SetWorkAreas(int workAreas, LPCRECT pRectArray) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(workAreas); + LPARAM lparam = reinterpret_cast(pRectArray); + SendMessage(LVM_SETWORKAREAS, wparam, lparam); + } + + // Uses an application-defined comparison function to sort the items of + // the list-view control. + // Refer to ListView_SortItems in the Windows API documentation for more information. + inline BOOL CListView::SortItems(PFNLVCOMPARE pCompareFn, DWORD_PTR data) const + { + assert(IsWindow()); + return ListView_SortItems(*this, pCompareFn, data); + } + + // Determines which list-view item or subitem is located at a given + // position. + // Refer to ListView_SubItemHitTest in the Windows API documentation for more information. + inline int CListView::SubItemHitTest(LVHITTESTINFO& hitInfo) const + { + assert(IsWindow()); + return ListView_SubItemHitTest(*this, &hitInfo); + } + + // Updates a list-view item. If the list-view control has the + // LVS_AUTOARRANGE style, the list-view control is rearranged. + // Refer to ListView_Update in the Windows API documentation for more information. + inline BOOL CListView::Update(int item) const + { + assert(IsWindow()); + return ListView_Update(*this, item); + } + +} // namespace Win32xx + +#endif // _WIN32XX_LISTVIEW_H_ + diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_mdi.h b/packages/media/cpp/packages/Win32xx/include/wxx_mdi.h new file mode 100644 index 00000000..8b20a45b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_mdi.h @@ -0,0 +1,1170 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////// +// wxx_mdi.h +// Declaration of the CMDIChild and CMDIFrame classes + +// The classes defined here add MDI frames support to Win32++. MDI +// (Multiple Document Interface) frames host one or more child windows. The +// child windows hosted by a MDI frame can be different types. For example, +// some MDI child windows could be used to edit text, while others could be +// used to display a bitmap. Four classes are defined here to support MDI +// frames: + + +// 1) CMDIFrameT. This class inherits from CFrameT, and adds the functionality +// required by MDI frames. It keeps track of the MDI children created and +// destroyed, and adjusts the menu when a MDI child is activated. Use the +// AddMDIChild function to add MDI child windows to the MDI frame. Inherit +// from CMDIFrame to create your own MDI frame. +// +// 2) CMDIChild: All MDI child windows (i.e. CWnd classes) should inherit from +// this class. Each MDI child type can have a different frame menu. +// +// 3) CMDIClient: This class is used by CMDIFrameT to host the MDIChild windows. +// +// 4) CMDIFrame: This class inherits from CMDIFrameT. It provides a +// MDI frame. Inherit your CMainFrame class from CMDIFrame to create a MDI +// frame. +// +// 5) CMDIDockFrame: This class inherits from CMDIFrameT. It provides +// a MDI frame that supports docking. Inherit your CMainFrame from CMDIDockFrame +// to create a MDI frame that supports docking. + +// Use the MDIFrame generic application as the starting point for your own MDI +// frame applications. +// Refer to the MDIDemo sample for an example on how to use these classes to +// create a MDI frame application with different types of MDI child windows. + + +#ifndef _WIN32XX_MDI_H_ +#define _WIN32XX_MDI_H_ + +#include "wxx_frame.h" +#include + + +namespace Win32xx +{ + + /////////////////////////////////////////////////////////////// + // CMDIChild manages a MDI child window. CMDIChild also manages + // the creation and position of the MDI Child's view window. + class CMDIChild : public CWnd + { + public: + CMDIChild(); + virtual ~CMDIChild() override; + + // These are the functions you might wish to override. + virtual HWND Create(HWND parent = nullptr) override; + virtual void RecalcLayout(); + + // These functions aren't virtual, and shouldn't be overridden. + HACCEL GetChildAccel() const { return m_childAccel; } + HMENU GetChildMenu() const { return m_childMenu; } + CWnd& GetView() const; + void SetView(CWnd& view); + void SetHandles(HMENU menu, HACCEL accel); + void MDIActivate() const; + void MDIDestroy() const; + void MDIMaximize() const; + void MDIRestore() const; + + protected: + // These are the functions you might wish to override. + virtual void OnClose() override; + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual LRESULT OnMDIActivate(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnWindowPosChanged(UINT msg, WPARAM wparam, LPARAM lparam); + + // Not intended to be overridden. + LRESULT FinalWindowProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + LRESULT WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) override; + + private: + CMDIChild(const CMDIChild&) = delete; + CMDIChild& operator=(const CMDIChild&) = delete; + + CWnd* m_pView; // pointer to the View CWnd object + CMenu m_childMenu; + HACCEL m_childAccel; + }; + + /////////////////////////////////////////////////////////////////////////// + // CMDIClient manages the MDI frame's MDI client window. + // The MDI client window manages the arrangement of the MDI child windows. + template + class CMDIClient : public T // T is either CWnd, or CDocker::CDockClient. + { + public: + CMDIClient() = default; + virtual ~CMDIClient() override = default; + + protected: + // Overridable virtual functions + virtual HWND Create(HWND parent) override; + virtual LRESULT OnMDIActivate(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnMDIDestroy(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnMDIGetActive(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + + private: + CMDIClient(const CMDIClient&) = delete; + CMDIClient& operator=(const CMDIClient&) = delete; + }; + + /////////////////////////////////////////////////////////////////////////// + // The CMDIFrameT class is the base class for all MDI frames. MDI Frames + // can hold one or more MDI children. The template parameter T is typically + // either CFrame or CDockFrame. + template + class CMDIFrameT : public T + { + public: + CMDIFrameT(); + virtual ~CMDIFrameT() override = default; + + // Override these functions as required. + virtual CMDIChild* AddMDIChild(CMDIChild* pMDIChild); + virtual CMDIChild* AddMDIChild(MDIChildPtr MDIChild); + virtual HWND Create(HWND parent = nullptr) override; + virtual void RemoveMDIChild(CMDIChild* pChild); + virtual BOOL RemoveAllMDIChildren(); + + // These functions aren't virtual. Don't override these. + CMDIChild* GetActiveMDIChild() const; + CMenu GetActiveMenu() const; + const std::vector& GetAllMDIChildren() const { return m_mdiChildren; } + CWnd& GetMDIClient() const { return *m_pMdiClient; } + BOOL IsMDIChildMaxed() const; + void MDICascade(int nType = 0) const; + void MDIIconArrange() const; + void MDIMaximize() const; + void MDINext() const; + void MDIPrev() const; + void MDIRestore() const; + void MDITile(int nType = 0) const; + void SetActiveMDIChild(CMDIChild* pChild); + void SetMDIClient(CWnd& mdiClient) { m_pMdiClient = &mdiClient; } + + protected: + // Overridable virtual functions + virtual LRESULT CustomDrawMenuBar(NMHDR* pNMHDR) override; + virtual void OnClose() override; + virtual LRESULT OnInitMenuPopup(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual LRESULT OnMDIActivated(UINT msg, WPARAM wparam, LPARAM); + virtual LRESULT OnMDIDestroyed(UINT msg, WPARAM wparam, LPARAM); + virtual void OnMDIMaximized(BOOL isMaxed); + virtual void OnMenuUpdate(UINT id) override; + virtual BOOL OnViewStatusBar() override; + virtual BOOL OnViewToolBar() override; + virtual LRESULT OnWindowPosChanged(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual BOOL PreTranslateMessage(MSG& msg) override; + virtual void RecalcLayout() override; + virtual void UpdateFrameMenu(CMenu menu); + + // Not intended to be overridden + LRESULT FinalWindowProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + LRESULT WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) override; + + private: + CMDIFrameT(const CMDIFrameT&) = delete; + CMDIFrameT& operator=(const CMDIFrameT&) = delete; + void UpdateMDIMenu(CMenu menuWindow); + + std::vector m_mdiChildren; + CMDIClient m_mdiClient; + CWnd* m_pMdiClient; + }; + + + ////////////////////////////////////////////////////////////////////////// + // The CMDIFrame class provides a frame window that can host one or + // more MDI child windows. CMDIFrame also manages the creation and + // position of child windows, such as the menubar, toolbar, and statusbar. + class CMDIFrame : public CMDIFrameT + { + public: + CMDIFrame() = default; + virtual ~CMDIFrame() override = default; + + private: + CMDIFrame(const CMDIFrame&) = delete; + CMDIFrame& operator=(const CMDIFrame&) = delete; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + //////////////////////////////////////// + // Definitions for the CMDIFrameT class. + // + + template + inline CMDIFrameT::CMDIFrameT() + { + // Assign the MDI client window. + SetMDIClient(m_mdiClient); + } + + // Create the MDI frame. + template + inline HWND CMDIFrameT::Create(HWND parent /* = nullptr */) + { + // The view for a CMDIFrame is the MDIClient. + T::SetView(GetMDIClient()); + + return T::Create(parent); + } + + // Adds a MDI child to the MDI frame. The pointer to the MDI child will be + // automatically deleted when the MDI Frame destroys the MDI child. + template + inline CMDIChild* CMDIFrameT::AddMDIChild(CMDIChild* pMDIChild) + { + assert(pMDIChild != nullptr); // Cannot add Null MDI Child + return AddMDIChild(MDIChildPtr(pMDIChild)); + } + + // Adds a MDI child to the MDI frame. The pointer to the MDI child will be + // automatically deleted when the MDI Frame destroys the MDI child. + template + inline CMDIChild* CMDIFrameT::AddMDIChild(MDIChildPtr MDIChild) + { + CMDIChild* pMDIChild = MDIChild.get(); + assert(pMDIChild != nullptr); // Cannot add null MDI Child + if (pMDIChild == nullptr) + return nullptr; + + m_mdiChildren.push_back(std::move(MDIChild)); + pMDIChild->Create(GetMDIClient()); + + return pMDIChild; + } + + // Updates the menu items in the "Window" submenu when MDI child windows + // are created or destroyed. + template + inline void CMDIFrameT::UpdateMDIMenu(CMenu windowMenu) + { + if (!windowMenu.GetHandle()) + return; + + // Delete previously appended items. + int items = windowMenu.GetMenuItemCount(); + UINT lastID = windowMenu.GetMenuItemID(--items); + if ((lastID >= IDW_FIRSTCHILD) && (lastID < IDW_FIRSTCHILD + 10)) + { + while ((lastID >= IDW_FIRSTCHILD) && (lastID < IDW_FIRSTCHILD + 10)) + { + windowMenu.DeleteMenu(static_cast(items), MF_BYPOSITION); + lastID = windowMenu.GetMenuItemID(--items); + } + + // Delete the separator too. + windowMenu.DeleteMenu(static_cast(items), MF_BYPOSITION); + } + + UINT window = 0; + + for (const MDIChildPtr& ChildPtr : GetAllMDIChildren()) + { + if (ChildPtr->IsWindow()) + { + // Add Separator + if (window == 0) + windowMenu.AppendMenu(MF_SEPARATOR, 0, reinterpret_cast(0)); + + // Add a menu entry for each MDI child (up to 9) + if (window < 9) + { + CString strMenuItem(ChildPtr->GetWindowText()); + + if (strMenuItem.GetLength() > WXX_MAX_STRING_SIZE -10) + { + // Truncate the string if its too long + strMenuItem.Delete(strMenuItem.GetLength() - WXX_MAX_STRING_SIZE -10); + strMenuItem += _T(" ..."); + } + + CString menuString; + menuString.Format(_T("&%d %s"), window+1, strMenuItem.c_str()); + + windowMenu.AppendMenu(MF_STRING, IDW_FIRSTCHILD + static_cast( + window), menuString); + + if (GetActiveMDIChild() == ChildPtr.get()) + windowMenu.CheckMenuItem(IDW_FIRSTCHILD + window, MF_CHECKED); + + ++window; + } + else if (9 == window) + // For the 10th MDI child, add this menu item and return. + // The MDIClient creates a dialog when this menu entry is selected. + { + windowMenu.AppendMenu(MF_STRING, IDW_FIRSTCHILD + + UINT_PTR(window), _T("&Windows...")); + return; + } + } + } + } + + // CustomDraw is used to render the MenuBar's toolbar buttons. + template + inline LRESULT CMDIFrameT::CustomDrawMenuBar(NMHDR* pNMHDR) + { + // Do the normal menubar custom drawing for the frame. + LRESULT result = T::CustomDrawMenuBar(pNMHDR); + + // Retrieve the pointer to the CMenuBar + LPNMTBCUSTOMDRAW lpNMCustomDraw = reinterpret_cast(pNMHDR); + CMenuBar* pMenubar = reinterpret_cast + (::SendMessage(pNMHDR->hwndFrom, UWM_GETCMENUBAR, 0, 0)); + + assert(pMenubar != nullptr); + + // Do the additional menubar custom drawing for the MDI frame. + if (pMenubar != nullptr) + { + switch (lpNMCustomDraw->nmcd.dwDrawStage) + { + // An item is about to be drawn. + case CDDS_ITEMPREPAINT: + { + DWORD item = static_cast(lpNMCustomDraw->nmcd.dwItemSpec); + + // Draw over MDI Max button. + if (IsMDIChildMaxed() && (item == 0)) + { + CWnd* pActiveChild = GetActiveMDIChild(); + if (pActiveChild) + { + HICON icon = reinterpret_cast(pActiveChild-> + SendMessage(WM_GETICON, ICON_SMALL, 0)); + if (icon == 0) + icon = GetApp()->LoadStandardIcon(IDI_APPLICATION); + + CRect rc = lpNMCustomDraw->nmcd.rc; + int cx = ::GetSystemMetrics(SM_CXSMICON) * GetWindowDpi(*this) / + GetWindowDpi(HWND_DESKTOP); + int cy = ::GetSystemMetrics(SM_CYSMICON) * GetWindowDpi(*this) / + GetWindowDpi(HWND_DESKTOP); + + int y = 1 + (pMenubar->GetWindowRect().Height() - cy) / 2; + int x = (rc.Width() - cx) / 2; + + CDC drawDC(lpNMCustomDraw->nmcd.hdc); + drawDC.DrawIconEx(x, y, icon, cx, cy, 0, 0, DI_NORMAL); + } + return CDRF_SKIPDEFAULT; // No further drawing + } + } + + return result; + + // Painting cycle has completed. + case CDDS_POSTPAINT: + { + if (IsMDIChildMaxed()) + { + // Draw the MDI Minimize, Restore and Close buttons. + CDC dc(lpNMCustomDraw->nmcd.hdc); + pMenubar->DrawAllMDIButtons(dc); + } + } + break; + } + } + + return result; + } + + // Returns the menu of the Active MDI Child if any, otherwise returns + // the MDI Frame's menu. + template + inline CMenu CMDIFrameT::GetActiveMenu() const + { + CMenu menu = T::GetFrameMenu(); + + if (GetActiveMDIChild()) + if (GetActiveMDIChild()->GetChildMenu()) + menu = GetActiveMDIChild()->GetChildMenu(); + + return menu; + } + + // Overrides CWnd::FinalWindowProc to call DefFrameProc instead of DefWindowProc. + template + inline LRESULT CMDIFrameT::FinalWindowProc(UINT msg, WPARAM wparam, + LPARAM lparam) + { + return ::DefFrameProc(*this, GetMDIClient(), msg, wparam, lparam); + } + + // Returns a pointer to the active MDI child, or nullptr if there is no + // active MDI child. + template + inline CMDIChild* CMDIFrameT::GetActiveMDIChild() const + { + HWND activeChild = reinterpret_cast(GetMDIClient().SendMessage( + WM_MDIGETACTIVE, 0, 0)); + return static_cast(T::GetCWndPtr(activeChild)); + } + + // Returns TRUE if a MDI child is maximized + // Refer to WM_MDIGETACTIVE in the Windows API documentation for more information. + template + inline BOOL CMDIFrameT::IsMDIChildMaxed() const + { + BOOL isMaxed = FALSE; + LPARAM lparam = reinterpret_cast(&isMaxed); + if (GetMDIClient().SendMessage(WM_MDIGETACTIVE, 0, lparam)) + return isMaxed; + return FALSE; + } + + // Arranges the MDI children in a cascade formation. + // Possible values for type are: + // MDITILE_SKIPDISABLED Prevents disabled MDI child windows from being cascaded. + // Refer to WM_MDICASCADE in the Windows API documentation for more information. + template + inline void CMDIFrameT::MDICascade(int type /* = 0*/) const + { + assert(T::IsWindow()); + WPARAM wparam = static_cast(type); + GetMDIClient().SendMessage(WM_MDICASCADE, wparam, 0); + } + + // Re-arranges the icons for minimized MDI children. + // Refer to WM_MDIICONARRANGE in the Windows API documentation for more information. + template + inline void CMDIFrameT::MDIIconArrange() const + { + assert(T::IsWindow()); + GetMDIClient().SendMessage(WM_MDIICONARRANGE, 0, 0); + } + + // Maximize the MDI child. + // Refer to WM_MDIMAXIMIZE in the Windows API documentation for more information. + template + inline void CMDIFrameT::MDIMaximize() const + { + assert(T::IsWindow()); + WPARAM mdiChild = static_cast(GetMDIClient().SendMessage( + WM_MDIGETACTIVE, 0, 0)); + GetMDIClient().SendMessage(WM_MDIMAXIMIZE, mdiChild, 0); + } + + // Activates the next MDI child. + // Refer to WM_MDINEXT in the Windows API documentation for more information. + template + inline void CMDIFrameT::MDINext() const + { + assert(T::IsWindow()); + WPARAM mdiChild = static_cast(GetMDIClient().SendMessage( + WM_MDIGETACTIVE, 0, 0)); + GetMDIClient().SendMessage(WM_MDINEXT, mdiChild, FALSE); + } + + // Activates the previous MDI child. + // Refer to WM_MDINEXT in the Windows API documentation for more information. + template + inline void CMDIFrameT::MDIPrev() const + { + assert(T::IsWindow()); + WPARAM mdiChild = static_cast(GetMDIClient().SendMessage( + WM_MDIGETACTIVE, 0, 0)); + GetMDIClient().SendMessage(WM_MDINEXT, mdiChild, TRUE); + } + + // Restores a mimimized MDI child. + // Refer to WM_MDIRESTORE in the Windows API documentation for more information. + template + inline void CMDIFrameT::MDIRestore() const + { + assert(T::IsWindow()); + WPARAM mdiChild = static_cast(GetMDIClient().SendMessage( + WM_MDIGETACTIVE, 0, 0)); + GetMDIClient().SendMessage(WM_MDIRESTORE, mdiChild, 0); + } + + // Arrange all of the MDI child windows in a tile format. + // Possible values for type are: + // MDITILE_HORIZONTAL Tiles MDI child windows so that one window appears + // above another. + // MDITILE_SKIPDISABLED Prevents disabled MDI child windows from being tiled. + // MDITILE_VERTICAL Tiles MDI child windows so that one window appears + // beside another. + // Refer to WM_MDITILE in the Windows API documentation for more information. + template + inline void CMDIFrameT::MDITile(int type /* = 0*/) const + { + assert(T::IsWindow()); + WPARAM wparam = static_cast(type); + GetMDIClient().SendMessage(WM_MDITILE, wparam, 0); + } + + // Called when the MDI frame is about to close. + template + inline void CMDIFrameT::OnClose() + { + if (RemoveAllMDIChildren()) + { + T::OnClose(); + } + } + + // Called when the menu's modal loop begins (WM_INITMENUPOPUP received). + template + inline LRESULT CMDIFrameT::OnInitMenuPopup(UINT msg, WPARAM wparam, + LPARAM lparam) + { + if (IsMDIChildMaxed()) + { + CWnd* pMaxMDIChild = GetActiveMDIChild(); + if (!pMaxMDIChild) return 0; + + // Suppress owner drawing of the MDI child's system menu + if (::GetSystemMenu(*pMaxMDIChild, FALSE) == + reinterpret_cast(wparam)) + { + return CWnd::WndProcDefault(WM_INITMENUPOPUP, wparam, lparam); + } + } + + return T::OnInitMenuPopup(msg, wparam, lparam); + } + + // Updates the check buttons before displaying the menu. + template + inline void CMDIFrameT::OnMenuUpdate(UINT id) + { + CMenu activeMenu = GetActiveMenu(); + switch (id) + { + case IDW_VIEW_STATUSBAR: + { + bool isVisible = T::GetStatusBar().IsWindow() && + T::GetStatusBar().IsWindowVisible(); + + if (isVisible) + activeMenu.CheckMenuItem(id, MF_CHECKED); + else + activeMenu.CheckMenuItem(id, MF_UNCHECKED); + } + break; + + case IDW_VIEW_TOOLBAR: + { + bool isVisible = T::GetToolBar().IsWindow() && + T::GetToolBar().IsWindowVisible(); + + if (T::IsUsingToolBar()) + activeMenu.EnableMenuItem(id, MF_ENABLED); + else + activeMenu.EnableMenuItem(id, MF_DISABLED); + + if (isVisible) + activeMenu.CheckMenuItem(id, MF_CHECKED); + else + activeMenu.CheckMenuItem(id, MF_UNCHECKED); + } + break; + } + } + + // Called when a MDI child is activated. + template + inline LRESULT CMDIFrameT::OnMDIActivated(UINT, WPARAM wparam, LPARAM) + { + HWND activeMDIChild = reinterpret_cast(wparam); + + if (activeMDIChild) + { + CMDIChild* pMDIChild = static_cast( + T::GetCWndPtr(activeMDIChild)); + assert ( dynamic_cast(T::GetCWndPtr(activeMDIChild)) ); + + if (pMDIChild->GetChildMenu()) + UpdateFrameMenu(pMDIChild->GetChildMenu()); + else + UpdateFrameMenu(T::GetFrameMenu()); + if (pMDIChild->GetChildAccel()) + GetApp()->SetAccelerators(pMDIChild->GetChildAccel(), *this); + else + GetApp()->SetAccelerators(T::GetFrameAccel(), *this); + } + + return 0; + } + + // Called when a MDI child is destroyed. + template + inline LRESULT CMDIFrameT::OnMDIDestroyed(UINT, WPARAM wparam, LPARAM) + { + RemoveMDIChild(reinterpret_cast(wparam)); + return 0; + } + + // Called when a MDI Child maximized state of the MDI child is checked. + template + inline void CMDIFrameT::OnMDIMaximized(BOOL) + { + // Override this function to take an action when a MDI child is + // maximized or restored from maximized. + } + + // Called when the StatusBar is shown. + template + inline BOOL CMDIFrameT::OnViewStatusBar() + { + T::OnViewStatusBar(); + T::GetView().RedrawWindow(RDW_FRAME | RDW_INVALIDATE | RDW_ERASE | + RDW_ALLCHILDREN); + return TRUE; + } + + // Called when the ToolBar window is shown. + template + inline BOOL CMDIFrameT::OnViewToolBar() + { + T::OnViewToolBar(); + T::GetView().RedrawWindow(RDW_FRAME | RDW_INVALIDATE | RDW_ERASE | + RDW_ALLCHILDREN); + return TRUE; + } + + // Called when the MDI frame has been resized. + template + inline LRESULT CMDIFrameT::OnWindowPosChanged(UINT msg, WPARAM wparam, + LPARAM lparam) + { + if (T::GetMenuBar().IsWindow()) + { + // Refresh MenuBar Window + T::GetMenuBar().SetupMenuBar(T::GetMenuBar().GetBarMenu()); + } + + return FinalWindowProc(msg, wparam, lparam); + } + + // Used to translate window messages before they are dispatched to + // the message loop. + template + inline BOOL CMDIFrameT::PreTranslateMessage(MSG& msg) + { + if (WM_KEYFIRST <= msg.message && msg.message <= WM_KEYLAST) + { + if (TranslateMDISysAccel(T::GetView().GetHwnd(), &msg)) + return TRUE; + } + + return T::PreTranslateMessage(msg); + } + + // Repositions the child windows of the MDI frame, such as the toolbar, + // status bar and view window. + template + inline void CMDIFrameT::RecalcLayout() + { + T::RecalcLayout(); + + if (T::GetView().IsWindow()) + MDIIconArrange(); + } + + // Removes all MDI children. + template + inline BOOL CMDIFrameT::RemoveAllMDIChildren() + { + // Collect the CMDIChild pointers in reverse order. + std::vector mdiChildren; + for (auto it = m_mdiChildren.rbegin(); it != m_mdiChildren.rend(); ++it) + { + mdiChildren.push_back((*it).get()); + } + + // Ask each MDIChild to close. + // An element is removed from m_mdiChildren when the MDIChild is closed. + for (auto pMDIChild : mdiChildren) + { + pMDIChild->SendMessage(WM_SYSCOMMAND, SC_CLOSE, 0); + } + + return m_mdiChildren.size() == 0 ? TRUE : FALSE; + } + + // Removes an individual MDI child. + template + inline void CMDIFrameT::RemoveMDIChild(CMDIChild* pChild) + { + for (auto it = m_mdiChildren.begin(); it!= m_mdiChildren.end(); ++it) + { + if ((*it).get() == pChild) + { + m_mdiChildren.erase(it); + break; + } + } + + if (GetActiveMDIChild()) + { + // Update the "Window" menu items. + if (GetActiveMDIChild()->GetChildMenu()) + UpdateFrameMenu(GetActiveMDIChild()->GetChildMenu()); + + // Update the accelerators. + if (GetActiveMDIChild()->GetChildAccel()) + GetApp()->SetAccelerators(GetActiveMDIChild()->GetChildAccel(), *this); + else + GetApp()->SetAccelerators(T::GetFrameAccel(), *this); + } + else + { + T::SetFrameMenu(T::GetFrameMenu()); + GetApp()->SetAccelerators(T::GetFrameAccel(), *this); + } + } + + // Activates the specified MDI child. + // Refer to WM_MDIACTIVATE in the Windows API documentation for more information. + template + inline void CMDIFrameT::SetActiveMDIChild(CMDIChild* pChild) + { + assert ( pChild->IsWindow() ); + + WPARAM wparam = reinterpret_cast(pChild->GetHwnd()); + GetMDIClient().SendMessage(WM_MDIACTIVATE, wparam, 0); + } + + // Updates the frame menu. Also puts the list of CMDIChild windows in the "window" menu. + // The "window" menu item is assumed to be the second from the right. + template + inline void CMDIFrameT::UpdateFrameMenu(CMenu menu) + { + if (menu.GetHandle()) + { + int menuItems = menu.GetMenuItemCount(); + if (menuItems > 0) + { + // The Window menu is typically second from the right. + int windowItem = std::max(menuItems - 2, 0); + CMenu menuWindow = menu.GetSubMenu(windowItem); + + if (menuWindow.GetHandle()) + { + if (T::GetMenuBar().IsWindow()) + { + // Update the popup Window menu. + UpdateMDIMenu(menuWindow); + + // Update the menubar. + T::GetMenuBar().SetupMenuBar(menu); + } + else + { + // Updates the MDI frame's menu adding the MDI children + WPARAM wparam = reinterpret_cast(menu.GetHandle()); + LPARAM lparam = reinterpret_cast(menuWindow.GetHandle()); + GetMDIClient().SendMessage(WM_MDISETMENU, wparam, lparam); + T::DrawMenuBar(); + } + } + } + } + } + + // Provides default processing for the MDI frame window's messages. + template + inline LRESULT CMDIFrameT::WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) + { + switch (msg) + { + case UWM_MDIACTIVATED: return OnMDIActivated(msg, wparam, lparam); + case UWM_MDIDESTROYED: return OnMDIDestroyed(msg, wparam, lparam); + case UWM_MDIGETACTIVE: + { + if (wparam && lparam) + { + LPBOOL pIsMDIChildMax = reinterpret_cast(lparam); + OnMDIMaximized(*pIsMDIChildMax); + } + break; + + } + case UWM_GETCMDIFRAMET: return reinterpret_cast(this); + case WM_WINDOWPOSCHANGED: return OnWindowPosChanged(msg, wparam, lparam); + } + + return T::WndProcDefault(msg, wparam, lparam); + } + + + //////////////////////////////////////// + // Definitions for the CMDIClient class. + // + + // Creates the MDIClient window. + template + inline HWND CMDIClient::Create(HWND parent) + { + assert(parent != nullptr); + + CLIENTCREATESTRUCT clientcreate = {}; + clientcreate.hWindowMenu = nullptr; + clientcreate.idFirstChild = IDW_FIRSTCHILD; + DWORD style = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | + WS_CLIPSIBLINGS | MDIS_ALLCHILDSTYLES; + + // Create the view window + return T::CreateEx(WS_EX_CLIENTEDGE, _T("MDIClient"), _T(""), style, + 0, 0, 0, 0, parent, nullptr, (PSTR) &clientcreate); + } + + // Called when the MDI child window is activated. + template + inline LRESULT CMDIClient::OnMDIActivate(UINT msg, WPARAM wparam, LPARAM lparam) + { + // Suppress redraw to avoid flicker when activating maximized MDI children. + T::SetRedraw(FALSE); + LRESULT result = T::FinalWindowProc(msg, wparam, lparam); + T::SetRedraw(TRUE); + T::RedrawWindow(RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN); + + return result; + } + + // Called when a MDI child window is destroyed. + template + inline LRESULT CMDIClient::OnMDIDestroy(UINT msg, WPARAM wparam, + LPARAM lparam) + { + CWnd* pWnd = T::GetCWndPtr(reinterpret_cast(wparam)); + + // Do default processing first. + T::FinalWindowProc(msg, wparam, lparam); + + // Now remove MDI child. + T::GetParent().SendMessage(UWM_MDIDESTROYED, reinterpret_cast( + pWnd), 0); + + return 0; + } + + // Called when the active MDI child is requested. + template + inline LRESULT CMDIClient::OnMDIGetActive(UINT msg, WPARAM wparam, + LPARAM lparam) + { + // Do default processing first + LRESULT result = T::FinalWindowProc(msg, wparam, lparam); + + SendMessage(T::GetParent(), UWM_MDIGETACTIVE, static_cast( + result), lparam); + + return result; + } + + // Provides default processing for the MDIClient window's messages. + template + inline LRESULT CMDIClient::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) + { + switch (msg) + { + case WM_MDIACTIVATE: return OnMDIActivate(msg, wparam, lparam); + case WM_MDIDESTROY: return OnMDIDestroy(msg, wparam, lparam); + case WM_MDIGETACTIVE: return OnMDIGetActive(msg, wparam, lparam); + } + + return CWnd::WndProcDefault(msg, wparam, lparam); + } + + + /////////////////////////////////////// + // Definitions for the CMDIChild class. + // + + // Sets the MDI Child's menu and accelerator in the constructor, like this ... + // HMENU hChildMenu = LoadMenu(GetApp()->GetResourceHandle(), _T("MdiMenuView")); + // HACCEL hChildAccel = LoadAccelerators(GetApp()->GetResourceHandle(), _T("MDIAccelView")); + // SetHandles(hChildMenu, hChildAccel); + // SetView(m_view); + inline CMDIChild::CMDIChild() : m_pView(nullptr), m_childAccel(0) + { + } + + inline CMDIChild::~CMDIChild() + { + WPARAM wparam = reinterpret_cast(GetHwnd()); + if (IsWindow()) + GetParent().SendMessage(WM_MDIDESTROY, wparam, 0); + } + + // Create the MDI child window and then maximize if required. + // This technique avoids unnecessary flicker when creating maximized MDI children. + inline HWND CMDIChild::Create(HWND parent /*= nullptr*/) + { + CREATESTRUCT cs = {}; + + // Call PreCreate in case its overloaded. + PreCreate(cs); + + // Determine if the window should be created maximized. + BOOL max = FALSE; + CWnd* pParent = GetCWndPtr(parent); + assert(pParent); + if (!pParent) return 0; + + LPARAM lparam = reinterpret_cast(&max); + pParent->SendMessage(WM_MDIGETACTIVE, 0, lparam); + + max = max | (cs.style & WS_MAXIMIZE); + + // Set the Window Class name. + CString ClassName = _T("Win32++ MDI Child"); + if (cs.lpszClass) + ClassName = cs.lpszClass; + + // Set the window style. + DWORD style; + style = static_cast(cs.style) & ~WS_MAXIMIZE; + style |= WS_VISIBLE | WS_OVERLAPPEDWINDOW ; + + // Set window size and position. + int x = CW_USEDEFAULT; + int y = CW_USEDEFAULT; + int cx = CW_USEDEFAULT; + int cy = CW_USEDEFAULT; + if (cs.cx && cs.cy) + { + x = cs.x; + y = cs.y; + cx = cs.cx; + cy = cs.cy; + } + + // Set the extended style. + DWORD exStyle = cs.dwExStyle | WS_EX_MDICHILD; + + // Turn off redraw while creating the window. + pParent->SetRedraw(FALSE); + + // Create the window. + CreateEx(exStyle, ClassName, cs.lpszName, style, x, y, + cx, cy, pParent->GetHwnd(), cs.hMenu, cs.lpCreateParams); + + if (max) + ShowWindow(SW_MAXIMIZE); + + // Turn redraw back on. + pParent->SetRedraw(TRUE); + pParent->RedrawWindow(RDW_INVALIDATE | RDW_ALLCHILDREN); + + // Ensure bits revealed by round corners (XP themes) are redrawn. + VERIFY(SetWindowPos(HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | + SWP_FRAMECHANGED)); + + return GetHwnd(); + } + + // Overrides CWnd::FinalWindowProc to call DefMDIChildProc instead of DefWindowProc. + inline LRESULT CMDIChild::FinalWindowProc(UINT msg, WPARAM wparam, + LPARAM lparam) + { + return ::DefMDIChildProc(*this, msg, wparam, lparam); + } + + // Returns a reference to the view window. + inline CWnd& CMDIChild::GetView() const + { + // Note: Use SetView to set the view window. + assert(m_pView); + return *m_pView; + } + + // Activate a MDI child. + // Refer to WM_MDIACTIVATE in the Windows API documentation for more information. + inline void CMDIChild::MDIActivate() const + { + WPARAM wparam = reinterpret_cast(GetHwnd()); + GetParent().SendMessage(WM_MDIACTIVATE, wparam, 0); + } + + // Destroy a MDI child. + // Refer to WM_MDIDESTROY in the Windows API documentation for more information. + inline void CMDIChild::MDIDestroy() const + { + WPARAM wparam = reinterpret_cast(GetHwnd()); + GetParent().SendMessage(WM_MDIDESTROY, wparam, 0); + } + + // Maximize a MDI child. + // Refer to WM_MDIMAXIMIZE in the Windows API documentation for more information. + inline void CMDIChild::MDIMaximize() const + { + WPARAM wparam = reinterpret_cast(GetHwnd()); + GetParent().SendMessage(WM_MDIMAXIMIZE, wparam, 0); + } + + // Restore a MDI child. + // Refer to WM_MDIRESTORE in the Windows API documentation for more information. + inline void CMDIChild::MDIRestore() const + { + WPARAM wparam = reinterpret_cast(GetHwnd()); + GetParent().SendMessage(WM_MDIRESTORE, wparam, 0); + } + + // Override this to customize what happens when the window asks to be closed. + inline void CMDIChild::OnClose() + { + MDIDestroy(); + } + + // Called when the MDI child is created. + inline int CMDIChild::OnCreate(CREATESTRUCT&) + { + // Create the view window + assert( &GetView() ); // Use SetView in CMDIChild's constructor to set the view window. + GetView().Create(*this); + RecalcLayout(); + + return 0; + } + + // Called when the MDI child is activated. + inline LRESULT CMDIChild::OnMDIActivate(UINT, WPARAM, LPARAM lparam) + { + // This child is being activated. + if (lparam == reinterpret_cast(GetHwnd())) + { + WPARAM wparam = reinterpret_cast(GetHwnd()); + GetAncestor().SendMessage(UWM_MDIACTIVATED, wparam, 0); + GetView().SetFocus(); + } + + // No child is being activated. + if (lparam == 0) + { + GetAncestor().SendMessage(UWM_MDIACTIVATED, 0, 0); + } + + return 0; + } + + // Called when the MDI child is resized. + inline LRESULT CMDIChild::OnWindowPosChanged(UINT msg, WPARAM wparam, + LPARAM lparam) + { + RecalcLayout(); + return FinalWindowProc(msg, wparam, lparam); + } + + // Repositions the MDI child's child windows. + inline void CMDIChild::RecalcLayout() + { + // Resize the view window. + CRect rc = GetClientRect(); + VERIFY(GetView().SetWindowPos( 0, rc.left, rc.top, rc.Width(), + rc.Height(), SWP_SHOWWINDOW )); + } + + // Sets the MDI child's menu and accelerator handles. + inline void CMDIChild::SetHandles(HMENU menu, HACCEL accel) + { + m_childMenu.Attach(menu); + m_childAccel = accel; + + // Note: It is valid to call SetHandles before the window is created. + if (IsWindow()) + { + WPARAM wparam = reinterpret_cast(GetHwnd()); + GetParent().SendMessage(WM_MDIACTIVATE, wparam, 0); + GetAncestor().SendMessage(UWM_MDIACTIVATED, wparam, 0); + } + } + + // Sets or changes the MDI child's view window. + inline void CMDIChild::SetView(CWnd& view) + { + if (m_pView != &view) + { + // Hide the existing view window (if any). + if (m_pView && m_pView->IsWindow()) + m_pView->ShowWindow(SW_HIDE); + + // Assign the view window. + m_pView = &view; + + if (GetHwnd() != nullptr) + { + if (!GetView().IsWindow()) + GetView().Create(*this); + else + { + GetView().SetParent(*this); + GetView().ShowWindow(); + } + + RecalcLayout(); + } + } + } + + // Provides the default processing for the MDI child's window messages. + inline LRESULT CMDIChild::WndProcDefault(UINT msg, WPARAM wparam, + LPARAM lparam) + { + switch (msg) + { + case WM_MDIACTIVATE: return OnMDIActivate(msg, wparam, lparam); + case WM_WINDOWPOSCHANGED: return OnWindowPosChanged(msg, wparam, lparam); + } + return CWnd::WndProcDefault(msg, wparam, lparam); + } + + +} // namespace Win32xx + +#endif // _WIN32XX_MDI_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_menu.h b/packages/media/cpp/packages/Win32xx/include/wxx_menu.h new file mode 100644 index 00000000..8cb39fed --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_menu.h @@ -0,0 +1,796 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////// +// wxx_menu.h +// Declaration of the CMenu class + +// Notes +// 1) Owner-drawn menus send the WM_MEASUREITEM and WM_DRAWITEM messages +// to the window that owns the menu. To manage owner drawing for menus, +// handle these two messages in the CWnd's WndProc function. +// +// 2) CMenu objects are reference counted and can be safely copied. They can +// be returned by value from functions and passed by value in function +// arguments. +// +// 3) In those functions that use a MENUITEMINFO structure, its cbSize member +// is automatically set to the correct value. + +// Program sample +// -------------- +// void CView::CreatePopup() +// { +// CPoint pt = GetCursorPos(); +// +// // Create the menu +// CMenu Popup; +// Popup.CreatePopupMenu(); +// +// // Add some menu items +// Popup.AppendMenu(MF_STRING, 101, _T("Menu Item &1")); +// Popup.AppendMenu(MF_STRING, 102, _T("Menu Item &2")); +// Popup.AppendMenu(MF_STRING, 103, _T("Menu Item &3")); +// Popup.AppendMenu(MF_SEPARATOR); +// Popup.AppendMenu(MF_STRING, 104, _T("Menu Item &4")); +// +// // Set menu item states +// Popup.CheckMenuRadioItem(101, 101, 101, MF_BYCOMMAND); +// Popup.CheckMenuItem(102, MF_BYCOMMAND | MF_CHECKED); +// Popup.EnableMenuItem(103, MF_BYCOMMAND | MF_GRAYED); +// Popup.SetDefaultItem(104); +// +// // Display the popup menu +// Popup.TrackPopupMenu(0, pt.x, pt.y, *this); +// } + + +#ifndef _WIN32XX_MENU_H_ +#define _WIN32XX_MENU_H_ + + +#include "wxx_appcore0.h" + + +namespace Win32xx +{ + + ////////////////////////////////////////////////////////////////////////// + // This class provides support for menus. It provides member functions for + // creating, tracking, updating, and destroying a menu. + class CMenu final + { + public: + // Construction and destruction + CMenu(); + CMenu(UINT id); + CMenu(HMENU menu); + CMenu(const CMenu& rhs); + ~CMenu(); + + // Operators + CMenu& operator=(const CMenu& rhs); + CMenu& operator=(HMENU menu); + operator HMENU () const; + + // Initialization + void Attach(HMENU menu); + void CreateMenu(); + void CreatePopupMenu(); + void Destroy(); + HMENU Detach(); + + HMENU GetHandle() const; + BOOL LoadMenu(LPCTSTR resourceName); + BOOL LoadMenu(UINT resourceID); + BOOL LoadMenuIndirect(const LPMENUTEMPLATE pMenuTemplate); + + // Menu Operations + BOOL TrackPopupMenu(UINT flags, int x, int y, HWND wnd, LPCRECT pRect = 0) const; + BOOL TrackPopupMenuEx(UINT flags, int x, int y, HWND wnd, LPTPMPARAMS pTPMP) const; + + // Menu Item Operations + BOOL AppendMenu(UINT flags, UINT_PTR idOrHandle = 0, LPCTSTR newItemName = nullptr); + BOOL AppendMenu(UINT flags, UINT_PTR idOrHandle, HBITMAP bitmap); + UINT CheckMenuItem(UINT checkItemID, UINT check) const; + BOOL CheckMenuRadioItem(UINT firstID, UINT lastID, UINT itemID, UINT flags) const; + BOOL DeleteMenu(UINT position, UINT flags) const; + UINT EnableMenuItem(UINT enableItemID, UINT enable) const; + int FindMenuItem(LPCTSTR menuName) const; + UINT GetDefaultItem(UINT flags, BOOL byPosition = FALSE) const; + DWORD GetMenuContextHelpId() const; + BOOL GetMenuInfo(MENUINFO& mi) const; + int GetMenuItemCount() const; + ULONG_PTR GetMenuItemData(UINT idOrPos, BOOL byPosition = FALSE) const; + UINT GetMenuItemID(int pos) const; + BOOL GetMenuItemInfo(UINT idOrPos, MENUITEMINFO& menuItemInfo, + BOOL byPosition = FALSE) const; + UINT GetMenuState(UINT idOrPos, UINT flags) const; + int GetMenuString(UINT idOrPos, LPTSTR string, int maxCount, UINT flags) const; + int GetMenuString(UINT idOrPos, CString& string, UINT flags) const; + CMenu GetSubMenu(int pos) const; + BOOL InsertMenu(UINT pos, UINT flags, UINT_PTR idOrHandle = 0, + LPCTSTR newItemName = nullptr) const; + BOOL InsertMenu(UINT pos, UINT flags, UINT_PTR idOrHandle, HBITMAP bitmap) const; + BOOL InsertMenuItem(UINT idOrPos, MENUITEMINFO& menuItemInfo, + BOOL byPosition = FALSE) const; + BOOL InsertPopupMenu(UINT pos, UINT flags, HMENU popupMenu, LPCTSTR newItemName) const; + BOOL ModifyMenu(UINT pos, UINT flags, UINT_PTR idOrHandle = 0, + LPCTSTR newItemName = nullptr) const; + BOOL ModifyMenu(UINT pos, UINT flags, UINT_PTR idOrHandle, HBITMAP bitmap) const; + BOOL RemoveMenu(UINT pos, UINT flags) const; + BOOL SetDefaultItem(UINT idOrPos, BOOL byPosition = FALSE) const; + BOOL SetMenuContextHelpId(DWORD contextHelpID) const; + BOOL SetMenuInfo(const MENUINFO& mi) const; + BOOL SetMenuItemBitmaps(UINT pos, UINT flags, HBITMAP unchecked, + HBITMAP checked) const; + BOOL SetMenuItemInfo(UINT idOrPos, MENUITEMINFO& menuItemInfo, + BOOL byPosition = FALSE) const; + + + + private: + void Assign(HMENU menu); + void Release(); + std::shared_ptr m_pData; + }; + +} // namespace Win32xx + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + //////////////////////// + // Definitions of CMenu. + // + + // Construct an empty CMenu. + inline CMenu::CMenu() : m_pData(std::make_shared()) + { + } + + // Construct a CMenu from a menu ID. + inline CMenu::CMenu(UINT id) : m_pData(std::make_shared()) + { + HMENU menu = ::LoadMenu(GetApp()->GetResourceHandle(), MAKEINTRESOURCE(id)); + if (menu != nullptr) + { + Assign(menu); + } + } + + // Construct a CMenu from a menu handle. + inline CMenu::CMenu(HMENU menu) : m_pData(std::make_shared()) + { + if (menu != nullptr) + Attach(menu); + } + + // Note: A copy of a CMenu is a clone of the original. + // Both objects manipulate the same HMENU and m_pData. + inline CMenu::CMenu(const CMenu& rhs) + { + m_pData = rhs.m_pData; + } + + // Destructor. + inline CMenu::~CMenu() + { + Release(); + } + + // Note: A copy of a CMenu is a clone of the original. + inline CMenu& CMenu::operator=(const CMenu& rhs) + { + if (this != &rhs) + { + Release(); + m_pData = rhs.m_pData; + } + + return *this; + } + + inline CMenu& CMenu::operator=(HMENU menu) + { + Attach(menu); + return *this; + } + + // Retrieves the menu's handle. + inline CMenu::operator HMENU () const + { + return GetHandle(); + } + + // Appends a new item to the end of the specified menu bar, drop-down menu, + // submenu, or shortcut menu. + // Refer to AppendMenu in the Windows API documentation for more information. + inline BOOL CMenu::AppendMenu(UINT flags, UINT_PTR idOrHandle /*= 0*/, LPCTSTR newItemName /*= nullptr*/) + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + return ::AppendMenu(m_pData->menu, flags, idOrHandle, newItemName); + } + + // Appends a new item to the end of the specified menu bar, drop-down menu, + // submenu, or shortcut menu. + // Refer to AppendMenu in the Windows API documentation for more information. + inline BOOL CMenu::AppendMenu(UINT flags, UINT_PTR idOrHandle, HBITMAP bitmap) + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + return ::AppendMenu(m_pData->menu, flags, idOrHandle, + reinterpret_cast(bitmap)); + } + + // Attaches and owns the menu handle. + inline void CMenu::Assign(HMENU menu) + { + Attach(menu); + m_pData->isManagedMenu = true; + } + + // Attaches an existing menu to this CMenu. + inline void CMenu::Attach(HMENU menu) + { + assert(m_pData); + + if (menu != m_pData->menu) + { + // Release any existing menu. + if (m_pData->menu != nullptr) + { + Release(); + m_pData = std::make_shared< CMenu_Data>(); + } + + if (menu != nullptr) + { + // Add the menu to this CMenu. + std::shared_ptr pCMenuData = GetApp()->GetCMenuData(menu).lock(); + if (pCMenuData) + { + m_pData = std::move(pCMenuData); + } + else + { + // Add the menu data to the map. + m_pData->menu = menu; + GetApp()->AddCMenuDataToMap(menu, m_pData); + } + } + } + } + + // Sets the state of the specified menu item's check-mark attribute to + // either selected or clear. + // Refer to CheckMenuItem in the Windows API documentation for more information. + inline UINT CMenu::CheckMenuItem(UINT checkItemID, UINT check) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + return ::CheckMenuItem(m_pData->menu, checkItemID, check); + } + + // Checks a specified menu item and makes it a radio item. At the same + // time, the function clears all other menu items in the associated group + // and clears the radio-item type flag for those items. + // Refer to CheckMenuRadioItem in the Windows API documentation for more information. + inline BOOL CMenu::CheckMenuRadioItem(UINT firstID, UINT lastID, UINT itemID, UINT flags) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + return ::CheckMenuRadioItem(m_pData->menu, firstID, lastID, itemID, flags); + } + + // Creates an empty menu. + // Refer to CreateMenu in the Windows API documentation for more information. + inline void CMenu::CreateMenu() + { + assert(m_pData); + + HMENU menu = ::CreateMenu(); + if (menu == nullptr) + throw CResourceException(GetApp()->MsgMenu()); + + Assign(menu); + } + + // Creates a drop-down menu, submenu, or shortcut menu. The menu is + // initially empty. + // Refer to CreatePopupMenu in the Windows API documentation for more information. + inline void CMenu::CreatePopupMenu() + { + assert(m_pData); + + HMENU menu = ::CreatePopupMenu(); + if (menu == nullptr) + throw CResourceException(GetApp()->MsgMenu()); + + Assign(menu); + } + + // Deletes an item from the specified menu. + // Refer to DeleteMenu in the Windows API documentation for more information. + inline BOOL CMenu::DeleteMenu(UINT pos, UINT flags) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + return ::DeleteMenu(m_pData->menu, pos, flags); + } + + // Destroys the menu if it is managed and returns this object to its + // default state. + inline void CMenu::Destroy() + { + assert(m_pData); + + if (m_pData->menu != nullptr) + { + if (IsAppRunning()) // Is the CWinApp object still valid? + GetApp()->RemoveMenuFromMap(m_pData->menu); + + if (m_pData->isManagedMenu) + { + // The menu will already be destroyed if assigned to a destroyed window. + if (IsMenu(m_pData->menu)) + ::DestroyMenu(m_pData->menu); + } + } + + // Nullify all copies of m_pData. + *m_pData.get() = {}; + } + + // Detaches the HMENU from this CMenu object and all its copies. + // The CMenu object and its copies are returned to the default state. + // Note: We rarely need to detach the HMENU from a CMenu. The framework will + // delete the HMENU automatically if required when the last copy of + // the CMenu goes out of scope. + inline HMENU CMenu::Detach() + { + assert(m_pData); + + HMENU menu = m_pData->menu; + GetApp()->RemoveMenuFromMap(m_pData->menu); + + // Nullify all copies of m_pData. + *m_pData.get() = {}; + + // Make a new shared_ptr for this object. + m_pData = std::make_shared(); + + return menu; + } + + // Returns the HMENU assigned to this CMenu. + inline HMENU CMenu::GetHandle() const + { + assert(m_pData); + return m_pData->menu; + } + + // Enables, disables, or grays the specified menu item. + // The enable parameter must be a combination of either MF_BYCOMMAND or + // MF_BYPOSITION and MF_ENABLED, MF_DISABLED, or MF_GRAYED. + // MF_DISABLED and MF_GRAYED are different without XP themes, but the same + // with XP themes enabled. + // Refer to EnableMenuItem in the Windows API documentation for more information. + inline UINT CMenu::EnableMenuItem(UINT enableItemID, UINT enable) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + return static_cast(::EnableMenuItem(m_pData->menu, enableItemID, enable)); + } + + // Finds the position of a menu item with the specified string. + // Returns -1 if the string is not found. + inline int CMenu::FindMenuItem(LPCTSTR menuName) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + CString str; + int item = -1; + int count = GetMenuItemCount(); + for (int i = 0; i < count; i++) + { + if (GetMenuString(static_cast(i), str, MF_BYPOSITION)) + { + if (str == menuName) + item = i; + } + } + + return item; + } + + // Determines the default menu item. + // The flags parameter specifies how the function searches for menu items. + // This parameter can be zero or more of the following values: + // GMDI_GOINTOPOPUPS; GMDI_USEDISABLED. + // Refer to GetMenuDefaultItem in the Windows API documentation for more information. + inline UINT CMenu::GetDefaultItem(UINT flags, BOOL byPosition /*= FALSE*/) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + return ::GetMenuDefaultItem(m_pData->menu, static_cast(byPosition), flags); + } + + // Retrieves the Help context identifier associated with the menu. + // Refer to GetMenuContextHelpId in the Windows API documentation for more information. + inline DWORD CMenu::GetMenuContextHelpId() const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + return ::GetMenuContextHelpId(m_pData->menu); + } + + // Retrieves the menu information. + // Refer to GetMenuInfo in the Windows API documentation for more information. + inline BOOL CMenu::GetMenuInfo(MENUINFO& mi) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + return ::GetMenuInfo(m_pData->menu, &mi); + } + + // Retrieves the number of menu items. + // Refer to GetMenuItemCount in the Windows API documentation for more information. + inline int CMenu::GetMenuItemCount() const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + return ::GetMenuItemCount(m_pData->menu); + } + + // Retrieves the data assigned to the specified menu item. + // Refer to the description of the dwItemData member of MENUITEMINFO + // in the Windows API documentation for more information. + inline ULONG_PTR CMenu::GetMenuItemData(UINT idOrPos, BOOL byPosition /* = FALSE*/) const + { + MENUITEMINFO mii = {}; + mii.cbSize = sizeof(MENUITEMINFO); + mii.fMask = MIIM_TYPE | MIIM_DATA; + ULONG_PTR pData = 0; + + if (GetMenuItemInfo(idOrPos, mii, byPosition)) + pData = mii.dwItemData; + + return pData; + } + + // Retrieves the menu item identifier of a menu item located at the + // specified position. + // Refer to GetMenuItemID in the Windows API documentation for more information. + inline UINT CMenu::GetMenuItemID(int pos) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + return ::GetMenuItemID(m_pData->menu, pos); + } + + // Retrieves information about the specified menu item. + // Refer to GetMenuItemInfo in the Windows API documentation for more information. + inline BOOL CMenu::GetMenuItemInfo(UINT idOrPos, MENUITEMINFO& menuItemInfo, BOOL byPosition /*= FALSE*/) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + menuItemInfo.cbSize = sizeof(MENUITEMINFO); + return ::GetMenuItemInfo(m_pData->menu, idOrPos, byPosition, &menuItemInfo); + } + + // Retrieves the menu flags associated with the specified menu item. + // Possible values for flags are: MF_BYCOMMAND or MF_BYPOSITION. + // Refer to GetMenuState in the Windows API documentation for more information. + inline UINT CMenu::GetMenuState(UINT idOrPos, UINT flags) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + return ::GetMenuState(m_pData->menu, idOrPos, flags); + } + + // Copies the text string of the specified menu item into the specified + // buffer. + // Refer to GetMenuString in the Windows API documentation for more information. + inline int CMenu::GetMenuString(UINT idOrPos, LPTSTR string, int maxCount, UINT flags) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + assert(string != nullptr); + + return ::GetMenuString(m_pData->menu, idOrPos, string, maxCount, flags); + } + + // Copies the text string of the specified menu item into the specified buffer. + // Refer to GetMenuString in the Windows API documentation for more information. + inline int CMenu::GetMenuString(UINT idOrPos, CString& string, UINT flags) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + int n = ::GetMenuString(m_pData->menu, idOrPos, + string.GetBuffer(WXX_MAX_STRING_SIZE), WXX_MAX_STRING_SIZE, flags); + string.ReleaseBuffer(); + return n; + } + + // Retrieves the CMenu object of a drop-down menu or submenu activated by + // the specified menu item. + // Refer to GetSubMenu in the Windows API documentation for more information. + inline CMenu CMenu::GetSubMenu(int pos) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + return CMenu(::GetSubMenu(m_pData->menu, pos)); + } + + // Inserts a new menu item into a menu, moving other items down the menu. + // Refer to InsertMenu in the Windows API documentation for more information. + inline BOOL CMenu::InsertMenu(UINT pos, UINT flags, UINT_PTR idOrHandle /*= 0*/, LPCTSTR newItemName /*= nullptr*/) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + return ::InsertMenu(m_pData->menu, pos, flags, idOrHandle, newItemName); + } + + // Inserts a new menu item into a menu, moving other items down the menu. + // Refer to InsertMenu in the Windows API documentation for more information. + inline BOOL CMenu::InsertMenu(UINT pos, UINT flags, UINT_PTR idOrHandle, HBITMAP bitmap) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + return ::InsertMenu(m_pData->menu, pos, flags, idOrHandle, + reinterpret_cast(bitmap)); + } + + // Inserts a new menu item at the specified position in the menu. + // Refer to InsertMenuItem in the Windows API documentation for more information. + inline BOOL CMenu::InsertMenuItem(UINT idOrPos, MENUITEMINFO& menuItemInfo, BOOL byPosition /*= FALSE*/) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + menuItemInfo.cbSize = sizeof(MENUITEMINFO); + return ::InsertMenuItem(m_pData->menu, idOrPos, byPosition, &menuItemInfo); + } + + // Inserts a popup menu item at the specified position in the menu. + // Refer to InsertMenu in the Windows API documentation for more information. + inline BOOL CMenu::InsertPopupMenu(UINT pos, UINT flags, HMENU popupMenu, LPCTSTR newItemName) const + { + assert(popupMenu); + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + // Ensure the correct flags are set. + flags &= ~MF_BITMAP; + flags &= ~MF_OWNERDRAW; + flags |= MF_POPUP; + + return ::InsertMenu(m_pData->menu, pos, flags, + reinterpret_cast(popupMenu), newItemName); + } + + // Loads the menu from the specified windows resource. + // Refer to LoadMenu in the Windows API documentation for more information. + inline BOOL CMenu::LoadMenu(LPCTSTR resourceName) + { + assert(m_pData); + assert(m_pData->menu == nullptr); + assert(resourceName); + + HMENU menu = ::LoadMenu(GetApp()->GetResourceHandle(), resourceName); + if (menu != nullptr) + { + Assign(menu); + } + + return m_pData->menu != nullptr; + } + + // Loads the menu from the specified windows resource. + // Refer to LoadMenu in the Windows API documentation for more information. + inline BOOL CMenu::LoadMenu(UINT resourceID) + { + assert(m_pData); + assert(m_pData->menu == nullptr); + + HMENU menu = ::LoadMenu(GetApp()->GetResourceHandle(), MAKEINTRESOURCE(resourceID)); + if (menu != nullptr) + { + Assign(menu); + } + + return m_pData->menu != nullptr; + } + + // Loads the specified menu template and assigns it to this CMenu. + // Refer to LoadMenuIndirect in the Windows API documentation for more information. + inline BOOL CMenu::LoadMenuIndirect(const LPMENUTEMPLATE pMenuTemplate) + { + assert(m_pData); + assert(pMenuTemplate); + + HMENU menu = ::LoadMenuIndirect(pMenuTemplate); + if (menu != nullptr) + { + Assign(menu); + } + + return m_pData->menu ? TRUE : FALSE; + } + + // Changes an existing menu item. This function is used to specify the + // content, appearance, and behavior of the menu item. + // Refer to ModifyMenu in the Windows API documentation for more information. + inline BOOL CMenu::ModifyMenu(UINT pos, UINT flags, UINT_PTR idOrHandle /*= 0*/, LPCTSTR newItemName /*= nullptr*/) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + return ::ModifyMenu(m_pData->menu, pos, flags, idOrHandle, newItemName); + } + + // Changes an existing menu item. This function is used to specify the + // content, appearance, and behavior of the menu item. + // Refer to ModifyMenu in the Windows API documentation for more information. + inline BOOL CMenu::ModifyMenu(UINT pos, UINT flags, UINT_PTR idOrHandle, HBITMAP bitmap) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + return ::ModifyMenu(m_pData->menu, pos, flags, idOrHandle, reinterpret_cast(bitmap)); + } + + // Destroys m_pData if this is the only copy of the CMenu. + inline void CMenu::Release() + { + assert(m_pData); + + if (m_pData.use_count() == 1) + { + Destroy(); + } + } + + // Deletes a menu item or detaches a submenu from the menu. + // Refer to RemoveMenu in the Windows API documentation for more information. + inline BOOL CMenu::RemoveMenu(UINT pos, UINT flags) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + return ::RemoveMenu(m_pData->menu, pos, flags); + } + + // Sets the default menu item for the menu. + // Refer to SetMenuDefaultItem in the Windows API documentation for more information. + inline BOOL CMenu::SetDefaultItem(UINT idOrPos, BOOL byPosition /*= FALSE*/) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + return ::SetMenuDefaultItem(m_pData->menu, idOrPos, static_cast(byPosition)); + } + + // Associates a Help context identifier with the menu. + // Refer to SetMenuContextHelpId in the Windows API documentation for more information. + inline BOOL CMenu::SetMenuContextHelpId(DWORD contextHelpID) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + return ::SetMenuContextHelpId(m_pData->menu, contextHelpID); + } + + // Associates the specified bitmap with a menu item. + // Refer to SetMenuItemBitmaps in the Windows API documentation for more information. + inline BOOL CMenu::SetMenuItemBitmaps(UINT pos, UINT flags, HBITMAP unchecked, HBITMAP checked) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + return ::SetMenuItemBitmaps(m_pData->menu, pos, flags, unchecked, checked); + } + + // Sets the menu information from the specified MENUINFO structure. + // Refer to SetMenuInfo in the Windows API documentation for more information. + inline BOOL CMenu::SetMenuInfo(const MENUINFO& mi) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + return ::SetMenuInfo(m_pData->menu, &mi); + } + + // Changes information about a menu item. + // Refer to SetMenuItemInfo in the Windows API documentation for more information. + inline BOOL CMenu::SetMenuItemInfo(UINT idOrPos, MENUITEMINFO& menuItemInfo, BOOL byPosition /*= FALSE*/) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + menuItemInfo.cbSize = sizeof(MENUITEMINFO); + return ::SetMenuItemInfo(m_pData->menu, idOrPos, byPosition, &menuItemInfo); + } + + // Displays a shortcut menu at the specified location and tracks the + // selection of items on the menu. + // Refer to TrackPopupMenu in the Windows API documentation for more information. + inline BOOL CMenu::TrackPopupMenu(UINT flags, int x, int y, HWND wnd, LPCRECT pRect /*= nullptr*/) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + return ::TrackPopupMenu(m_pData->menu, flags, x, y, 0, wnd, pRect); + } + + // Displays a shortcut menu at the specified location and tracks the + // selection of items on the shortcut menu. + // Refer to TrackPopupMenuEx in the Windows API documentation for more information. + inline BOOL CMenu::TrackPopupMenuEx(UINT flags, int x, int y, HWND wnd, LPTPMPARAMS pTPMP) const + { + assert(m_pData); + assert(IsMenu(m_pData->menu)); + + return ::TrackPopupMenuEx(m_pData->menu, flags, x, y, wnd, pTPMP); + } + +} // namespace Win32xx + +#endif // _WIN32XX_MENU_H_ + diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_menubar.h b/packages/media/cpp/packages/Win32xx/include/wxx_menubar.h new file mode 100644 index 00000000..28c11d10 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_menubar.h @@ -0,0 +1,1312 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +#ifndef _WIN32XX_MENUBAR_H_ +#define _WIN32XX_MENUBAR_H_ + +#include "wxx_wincore.h" +#include "wxx_toolbar.h" + + +namespace Win32xx +{ + + ///////////////////////////////////////////////////////////// + // The CMenuBar class provides a menu inside a rebar control. + // CMenuBar inherits from CToolBar. + class CMenuBar : public CToolBar + { + public: + CMenuBar(); + virtual ~CMenuBar() override = default; + + void DrawAllMDIButtons(CDC& drawDC); + HMENU GetBarMenu() const {return m_topMenu;} + BOOL IsAltMode() const { return m_isAltMode; } + LRESULT MenuChar(UINT msg, WPARAM wparam, LPARAM lparam); + void SetupMenuBar(HMENU menu); + LRESULT SysCommand(UINT msg, WPARAM wparam, LPARAM lparam); + + protected: + // Overridables + virtual void OnAttach() override; + virtual LRESULT OnDrawItem(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnExitMenuLoop(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnInitMenuPopup(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnKeyDown(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnKillFocus(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnLButtonDown(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnLButtonUp(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnMeasureItem(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnMenuChar(UINT msg, WPARAM wparam, LPARAM lparam); + virtual BOOL OnMenuInput(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnMouseLeave(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnMouseMove(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnNotifyReflect(WPARAM wparam, LPARAM lparam) override; + virtual LRESULT OnSysCommand(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnSysKeyDown(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnSysKeyUp(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnTBNDropDown(LPNMTOOLBAR pNMTB); + virtual LRESULT OnTBNHotItemChange(LPNMTBHOTITEM pNMHI); + virtual LRESULT OnWindowPosChanged(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnWindowPosChanging(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual void PreRegisterClass(WNDCLASS& wc) override; + virtual BOOL PreTranslateMessage(MSG& msg) override; + + // Not intended to be overridden. + LRESULT WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) override; + + private: + CMenuBar(const CMenuBar&) = delete; + CMenuBar& operator=(const CMenuBar&) = delete; + + void Cancel() const; + void DoAltKey(WORD keyCode); + void DrawMDIButton(CDC& drawDC, int button, UINT state) const; + void ExitMenu(); + CWnd* GetActiveMDIChild() const; + CWnd* GetMDIClient() const; + UINT GetMenuItemID() const; + void GrabFocus(); + BOOL IsMDIChildMaxed() const; + BOOL IsMDIFrame() const; + LRESULT OnPopupMenu(); + void Press(UINT buttonID, BOOL press) const; + void ProcessMenuItem(); + void ReleaseFocus(); + void StoreHotItem(int hotItem); + void UnpressAll() const; + void UpdateMDIButtons(WPARAM wparam, LPARAM lparam) const; + static LRESULT CALLBACK StaticMsgHook(int code, WPARAM wparam, LPARAM lparam); + + enum MDIButtonType + { + MDI_MIN = 0, + MDI_RESTORE = 1, + MDI_CLOSE = 2 + }; + + CPoint m_oldMousePos; // Old Mouse position + CRect m_mdiRect[3]; // Array of CRect for MDI buttons + HHOOK m_msgHook; // Handle to the message hook + HMENU m_popupMenu; // Handle to the popup menu + HMENU m_selectedMenu; // Handle to the cascaded popup menu + HMENU m_topMenu; // Handle to the top level menu + HWND m_prevFocus; // Handle to window that had focus + int m_hotItem; // Hot item + int m_nMDIButton; // the MDI button (MDIButtonType) pressed + BOOL m_isAltMode; // Alt key toggled? Underlines accelerator when true. + BOOL m_isExitAfter; // Is exit after Popup menu ends? + BOOL m_isKeyMode; // Is Keyboard navigation mode active? + BOOL m_isMenuActive; // Is popup menu active? + BOOL m_isSelectedPopup; // Is a popup (cascade) menu is selected? + }; // class CMenuBar + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + ////////////////////////////////////// + // Definitions for the CMenuBar class. + // + + inline CMenuBar::CMenuBar() : m_msgHook(nullptr), m_popupMenu(nullptr), + m_selectedMenu(nullptr), m_topMenu(nullptr), m_prevFocus(nullptr), + m_hotItem(-1), m_nMDIButton(0), m_isAltMode(FALSE), m_isExitAfter(FALSE), + m_isKeyMode(FALSE), m_isMenuActive(FALSE), m_isSelectedPopup(FALSE) + { + } + + // Cancel certain modes, such as mouse capture. + // Cancels a popup menu. + inline void CMenuBar::Cancel() const + { + SendMessage(WM_CANCELMODE, 0, 0); + } + + // Handle key pressed with Alt held down. + inline void CMenuBar::DoAltKey(WORD keyCode) + { + TCHAR key = static_cast(keyCode); + int item = MapAccelerator(key); + if (item >= 0) + { + GrabFocus(); + m_isKeyMode = TRUE; + m_isAltMode = FALSE; + StoreHotItem(item); + ProcessMenuItem(); + + // Support top menu item without popup menu. + UINT id = GetMenuItemID(); + if (id != UINT(-1)) + { + PostMessage(WM_COMMAND, id, 0); + ExitMenu(); + } + else + m_isMenuActive = TRUE; + + } + else + ::MessageBeep(MB_OK); + } + + // Draws all the MDI buttons on a MDI frame with a maximized MDI child. + inline void CMenuBar::DrawAllMDIButtons(CDC& drawDC) + { + if (!IsMDIFrame()) + return; + + if (IsMDIChildMaxed()) + { + int cx = ::GetSystemMetrics(SM_CXSMICON) * GetWindowDpi(*this) / GetWindowDpi(HWND_DESKTOP); + int cy = ::GetSystemMetrics(SM_CYSMICON) * GetWindowDpi(*this) / GetWindowDpi(HWND_DESKTOP); + CRect rc = GetClientRect(); + int gap = 4; + rc.right -= gap; + + // Assign values to each element of the CRect array + for (int i = 0 ; i < 3 ; ++i) + { + int left = rc.right - (i+1)*cx - gap*(i+1); + int top = rc.bottom/2 - cy/2; + int right = rc.right - i*cx - gap*(i+1); + int bottom = rc.bottom/2 + cy/2; + VERIFY(::SetRect(&m_mdiRect[2 - i], left, top, right, bottom)); + } + + // Hide the MDI button if it won't fit. + for (int k = 0 ; k <= 2 ; ++k) + { + + if (m_mdiRect[k].left < GetMaxSize().cx) + { + VERIFY(::SetRectEmpty(&m_mdiRect[k])); + } + } + + DrawMDIButton(drawDC, MDI_MIN, 0); + DrawMDIButton(drawDC, MDI_RESTORE, 0); + DrawMDIButton(drawDC, MDI_CLOSE, 0); + } + } + + // Draws an individual MDI button. + inline void CMenuBar::DrawMDIButton(CDC& drawDC, int button, UINT state) const + { + if (!IsRectEmpty(&m_mdiRect[button])) + { + // Use the Marlett font to draw special characters. + CFont marlett; + marlett.CreatePointFont(100, _T("Marlett")); + drawDC.SetBkMode(TRANSPARENT); + LOGFONT lf = DpiScaleLogfont(marlett.GetLogFont(), 10); + drawDC.CreateFontIndirect(lf); + + COLORREF grey(GetSysColor(COLOR_BTNFACE)); + COLORREF black(RGB(0, 0, 0)); + COLORREF white(RGB(255, 255, 255)); + + switch (state) + { + case 0: + // Draw a grey box for the normal button to erase other highlighting. + drawDC.SetTextColor(grey); + drawDC.TextOut(m_mdiRect[button].left, m_mdiRect[button].top, _T("\x63"), 1); + drawDC.TextOut(m_mdiRect[button].left, m_mdiRect[button].top, _T("\x64"), 1); + break; + case 1: + // Draw popped up button, black on right and bottom. + drawDC.SetTextColor(white); + drawDC.TextOut(m_mdiRect[button].left, m_mdiRect[button].top, _T("\x63"), 1); + drawDC.SetTextColor(black); + drawDC.TextOut(m_mdiRect[button].left, m_mdiRect[button].top, _T("\x64"), 1); + break; + case 2: + // Draw pressed button, black on left and top. + drawDC.SetTextColor(black); + drawDC.TextOut(m_mdiRect[button].left, m_mdiRect[button].top, _T("\x63"), 1); + drawDC.SetTextColor(white); + drawDC.TextOut(m_mdiRect[button].left, m_mdiRect[button].top, _T("\x64"), 1); + break; + } + + switch (button) + { + case MDI_MIN: + { + // Draw the minimize button. + CRect rc = m_mdiRect[0]; + rc.OffsetRect(DpiScaleInt(1), 0); + + drawDC.SetTextColor(black); + drawDC.TextOut(rc.left, rc.top, _T("\x30"), 1); + break; + } + case MDI_RESTORE: + { + // Draw the restore button. + CRect rc = m_mdiRect[1]; + rc.OffsetRect(1, 0); + + drawDC.SetTextColor(black); + drawDC.TextOut(rc.left, rc.top, _T("\x32"), 1); + break; + } + case MDI_CLOSE: + { + // Draw the close button (a Marlett "r" looks like "X"). + drawDC.SetTextColor(black); + drawDC.TextOut(m_mdiRect[2].left, m_mdiRect[2].top, _T("\x72"), 1); + break; + } + + } + } + } + + // Used when a popup menu is closed. + inline void CMenuBar::ExitMenu() + { + ReleaseFocus(); + m_isKeyMode = FALSE; + m_isMenuActive = FALSE; + m_isAltMode = FALSE; + UnpressAll(); + StoreHotItem(-1); + + CPoint pt = GetCursorPos(); + VERIFY(ScreenToClient(pt)); + + // Update mouse position for hot tracking. + SendMessage(WM_MOUSEMOVE, 0, MAKELONG(pt.x, pt.y)); + } + + // Retrieves a pointer to the active MDI child if any. + inline CWnd* CMenuBar::GetActiveMDIChild() const + { + CWnd* pMDIChild = nullptr; + if (GetMDIClient()) + { + HWND mdiChild = reinterpret_cast(GetMDIClient()->SendMessage(WM_MDIGETACTIVE, 0, 0)); + pMDIChild = GetCWndPtr(mdiChild); + } + + return pMDIChild; + } + + // Retrieves a pointer to the MDIClient. Returns nullptr if there + // is no MDIClient. + inline CWnd* CMenuBar::GetMDIClient() const + { + CWnd* pMDIClient = nullptr; + + // Is the ancestor a CMDIFrame? + if (GetAncestor().SendMessage(UWM_GETCMDIFRAMET) != 0) + { + // Retrieve the window handle of the MDI frame's view. + HWND wnd = reinterpret_cast(GetAncestor().SendMessage(UWM_GETFRAMEVIEW)); + pMDIClient = GetCWndPtr(wnd); + } + + return pMDIClient; + } + + // Retrieve the menu ID from the hot item adjusted for MDI maxed. + inline UINT CMenuBar::GetMenuItemID() const + { + int menuItem = IsMDIChildMaxed() ? m_hotItem - 1 : m_hotItem; + return ::GetMenuItemID(m_topMenu, menuItem); + } + + // Grab the keyboard focus and capture the mouse input. + inline void CMenuBar::GrabFocus() + { + if (::GetFocus() != *this) + m_prevFocus = ::SetFocus(*this); + ::SetCapture(*this); + ::SetCursor(::LoadCursor(0, IDC_ARROW)); + } + + // Returns TRUE of the MDI child is maximized. + inline BOOL CMenuBar::IsMDIChildMaxed() const + { + BOOL isMaxed = FALSE; + if (GetMDIClient()) + { + LPARAM lparam = reinterpret_cast(&isMaxed); + GetMDIClient()->SendMessage(WM_MDIGETACTIVE, 0, lparam); + } + + return isMaxed; + } + + // Returns TRUE if the frame is a MDI frame. + inline BOOL CMenuBar::IsMDIFrame() const + { + return static_cast(GetAncestor().SendMessage(UWM_GETCMDIFRAMET)); + } + + // Used by CFrameT when a menu is active, and a key is pressed other than + // an accelerator. + inline LRESULT CMenuBar::MenuChar(UINT msg, WPARAM wparam, LPARAM lparam) + { + return OnMenuChar(msg, wparam, lparam); + } + + // Called when the window handle (HWND) is attached to this object. + inline void CMenuBar::OnAttach() + { + // We must send this message before sending the TB_ADDBITMAP or + // the TB_ADDBUTTONS message. + SendMessage(TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); + } + + // Forwards owner drawing to the frame. + inline LRESULT CMenuBar::OnDrawItem(UINT, WPARAM wparam, LPARAM lparam) + { + GetAncestor().SendMessage(WM_DRAWITEM, wparam, lparam); + return TRUE; // handled + } + + // Called when a popup menu is closed. + inline LRESULT CMenuBar::OnExitMenuLoop(UINT, WPARAM wparam, LPARAM lparam) + { + if (m_isExitAfter) + ExitMenu(); + GetAncestor().SendMessage(WM_EXITMENULOOP, wparam, lparam); + + return 0; + } + + // Called when a popup menu is created. + inline LRESULT CMenuBar::OnInitMenuPopup(UINT, WPARAM wparam, LPARAM lparam) + { + GetAncestor().SendMessage(WM_INITMENUPOPUP, wparam, lparam); + return 0; + } + + // Called when a key is pressed while the menubar has the mouse captured, + // and the popup menu is not displayed. + inline LRESULT CMenuBar::OnKeyDown(UINT, WPARAM wparam, LPARAM) + { + int first = IsMDIChildMaxed() ? 1 : 0; + TCHAR keycode = static_cast(wparam); + m_isKeyMode = TRUE; + + switch (keycode) + { + case VK_ESCAPE: + ExitMenu(); + break; + + // Handle VK_DOWN, and VK_UP together. + case VK_DOWN: + case VK_UP: + ProcessMenuItem(); + break; + case VK_RETURN: + { + ProcessMenuItem(); + + // Support top menu item without popup menu. + UINT id = GetMenuItemID(); + if (id != UINT(-1)) + { + PostMessage(WM_COMMAND, id, 0); + ExitMenu(); + } + break; + } + + case VK_LEFT: + // Move left to the next topmenu item. + if (m_hotItem > first) + StoreHotItem(m_hotItem -1); + else + StoreHotItem(GetButtonCount() -1); + + if (!m_isAltMode || m_isMenuActive) + ProcessMenuItem(); + + break; + + case VK_RIGHT: + // Move right to the next topmenu item. + if (m_hotItem < GetButtonCount() -1) + StoreHotItem(m_hotItem +1); + else + StoreHotItem(first); + + if (!m_isAltMode || m_isMenuActive) + ProcessMenuItem(); + + break; + + default: + // Handle Accelerator keys with Alt toggled down. + { + int id = MapAccelerator(keycode); + m_isAltMode = FALSE; + if (id >= 0) + { + m_hotItem = CommandToIndex(static_cast(id)); + ProcessMenuItem(); + } + else + ::MessageBeep(MB_OK); + + break; + } + } // switch (wparam) + + return 0; // Discard these messages + } + + // Called when the menu bar loses focus. + inline LRESULT CMenuBar::OnKillFocus(UINT, WPARAM, LPARAM) + { + m_isAltMode = FALSE; + ExitMenu(); + return 0; + } + + // Called when the left mouse button is pressed. + inline LRESULT CMenuBar::OnLButtonDown(UINT msg, WPARAM wparam, LPARAM lparam) + { + m_isKeyMode = FALSE; + m_isMenuActive = FALSE; + m_isAltMode = FALSE; + + // Updates hot item with current mouse position. + FinalWindowProc(WM_MOUSEMOVE, wparam, lparam); + + // Do default processing first. + FinalWindowProc(msg, wparam, lparam); + + m_nMDIButton = 0; + if (IsMDIFrame()) + { + if (IsMDIChildMaxed()) + { + CPoint pt(lparam); + m_nMDIButton = -1; + + if (m_mdiRect[0].PtInRect(pt)) m_nMDIButton = 0; + if (m_mdiRect[1].PtInRect(pt)) m_nMDIButton = 1; + if (m_mdiRect[2].PtInRect(pt)) m_nMDIButton = 2; + + // Draw the three MDI buttons. + if (m_nMDIButton >= 0) + { + CClientDC MenuBarDC(*this); + DrawMDIButton(MenuBarDC, MDI_MIN, (m_nMDIButton == 0) ? 2U : 0U); + DrawMDIButton(MenuBarDC, MDI_RESTORE, (m_nMDIButton == 1) ? 2U : 0U); + DrawMDIButton(MenuBarDC, MDI_CLOSE, (m_nMDIButton == 2) ? 2U : 0U); + } + + // Bring up the MDI Child window's system menu when the icon is pressed. + if (HitTest() == 0) + { + m_hotItem = 0; + if (!m_isAltMode) + ProcessMenuItem(); + } + } + } + + return 0; + } + + // Called when the left mouse button is released. + inline LRESULT CMenuBar::OnLButtonUp(UINT, WPARAM, LPARAM) + { + if (IsMDIFrame()) + { + CWnd* pMDIClient = GetMDIClient(); + CWnd* pMDIChild = GetActiveMDIChild(); + assert(pMDIClient); + + if (pMDIChild && pMDIClient && IsMDIChildMaxed()) + { + CPoint pt = GetCursorPos(); + VERIFY(ScreenToClient(pt)); + + // Process the MDI button action when the left mouse button is up. + if (m_mdiRect[0].PtInRect(pt)) + { + if (MDI_MIN == m_nMDIButton) + pMDIChild->ShowWindow(SW_MINIMIZE); + } + + if (m_mdiRect[1].PtInRect(pt)) + { + WPARAM wparam = reinterpret_cast(pMDIChild->GetHwnd()); + if (MDI_RESTORE == m_nMDIButton) + pMDIClient->PostMessage(WM_MDIRESTORE, wparam, 0); + } + + if (m_mdiRect[2].PtInRect(pt)) + { + if (MDI_CLOSE == m_nMDIButton) + pMDIChild->PostMessage(WM_SYSCOMMAND, SC_CLOSE, 0); + } + } + } + + ExitMenu(); + m_nMDIButton = 0; + return 0; + } + + // Forwards the owner draw processing to the frame. + inline LRESULT CMenuBar::OnMeasureItem(UINT msg, WPARAM wparam, LPARAM lparam) + { + GetAncestor().SendMessage(msg, wparam, lparam); + return TRUE; // handled + } + + // Called when a menu is active and the user presses a key that does not + // correspond to any mnemonic or accelerator key. + inline LRESULT CMenuBar::OnMenuChar(UINT msg, WPARAM wparam, LPARAM lparam) + { + TCHAR keyCode = static_cast(LOWORD(wparam)); + if (!m_isMenuActive) + DoAltKey(keyCode); + + return FinalWindowProc(msg, wparam, lparam); + } + + // StaticMsgHook directs all menu messages here when a popup menu is active. + inline BOOL CMenuBar::OnMenuInput(UINT msg, WPARAM wparam, LPARAM lparam) + { + int first = (IsMDIChildMaxed() ? 1 : 0); + + switch(msg) + { + case WM_SYSKEYDOWN: + { + if ((m_isMenuActive || m_isKeyMode) && + ((wparam == VK_MENU) || (wparam == VK_F10))) + { + Cancel(); + ExitMenu(); + } + return TRUE; + } + case WM_KEYDOWN: + m_isExitAfter = FALSE; + { + switch (wparam) + { + case VK_ESCAPE: + // Use default processing if inside a Sub Menu. + if ((m_selectedMenu) &&(m_selectedMenu != m_popupMenu)) + return FALSE; + + Cancel(); + Press(GetCommandID(m_hotItem), FALSE); + SetHotItem(m_hotItem); + ExitMenu(); + break; + + case VK_LEFT: + { + // Use default processing if inside a Sub Menu. + if ((m_selectedMenu) && (m_selectedMenu != m_popupMenu)) + return FALSE; + + Press(GetCommandID(m_hotItem), FALSE); + + // Move left to the next topmenu item. + m_hotItem = (m_hotItem > first) ? m_hotItem -1 : GetButtonCount() -1; + Cancel(); + + if (!m_isAltMode) + ProcessMenuItem(); + + PostMessage(WM_KEYDOWN, VK_DOWN, 0); + break; + } + + case VK_RIGHT: + { + // Use default processing to open Sub Menu. + if (m_isSelectedPopup) + break; + + Press(GetCommandID(m_hotItem), FALSE); + + // Move right to the next topmenu item. + m_hotItem = (m_hotItem < GetButtonCount() -1) ? m_hotItem +1 : first; + Cancel(); + + if (!m_isAltMode) + ProcessMenuItem(); + + PostMessage(WM_KEYDOWN, VK_DOWN, 0); + break; + } + + case VK_RETURN: + m_isExitAfter = TRUE; + break; + + } // switch (wparam) + + } // case WM_KEYDOWN + + return FALSE; + + case WM_CHAR: + m_isExitAfter = TRUE; + return FALSE; + + case WM_LBUTTONDOWN: + { + m_isExitAfter = TRUE; + if (HitTest() >= 0) + { + // Cancel popup when we hit a button a second time. + Cancel(); + return TRUE; + } + } + return FALSE; + + case WM_LBUTTONDBLCLK: + // Perform default action for DblClick on MDI Maxed icon. + if (IsMDIChildMaxed() && (HitTest() == 0)) + { + CWnd* pMDIChild = GetActiveMDIChild(); + assert(pMDIChild); + if (pMDIChild) + { + CMenu childMenu = pMDIChild->GetSystemMenu(FALSE); + + UINT id = childMenu.GetDefaultItem(FALSE, 0); + if (id) + pMDIChild->PostMessage(WM_SYSCOMMAND, static_cast(id), 0); + } + } + + m_isExitAfter = TRUE; + return FALSE; + + case WM_MENUSELECT: + { + // Store info about selected item. + m_selectedMenu = reinterpret_cast(lparam); + m_isSelectedPopup = ((HIWORD(wparam) & MF_POPUP)) ? TRUE : FALSE; + + // Reflect message back to the frame window. + GetAncestor().SendMessage(WM_MENUSELECT, wparam, lparam); + } + return TRUE; + + case WM_MOUSEMOVE: + { + CPoint pt; + pt.x = GET_X_LPARAM(lparam); + pt.y = GET_Y_LPARAM(lparam); + + // Skip if mouse hasn't moved. + if ((pt.x == m_oldMousePos.x) && (pt.y == m_oldMousePos.y)) + break; + + m_oldMousePos.x = pt.x; + m_oldMousePos.y = pt.y; + VERIFY(ScreenToClient(pt)); + + // Reflect messages back to the MenuBar for hot tracking. + SendMessage(WM_MOUSEMOVE, 0, MAKELPARAM(pt.x, pt.y)); + } + break; + + } + return FALSE; + } + + // Called when the cursor leave the client area of the window. + inline LRESULT CMenuBar::OnMouseLeave(UINT msg, WPARAM wparam, LPARAM lparam) + { + if (IsMDIFrame()) + { + if (IsMDIChildMaxed()) + { + CClientDC MenuBarDC(*this); + + DrawMDIButton(MenuBarDC, MDI_MIN, 0); + DrawMDIButton(MenuBarDC, MDI_RESTORE, 0); + DrawMDIButton(MenuBarDC, MDI_CLOSE, 0); + } + } + + return FinalWindowProc(msg, wparam, lparam); + } + + // Called when the cursor moves. + inline LRESULT CMenuBar::OnMouseMove(UINT msg, WPARAM wparam, LPARAM lparam) + { + // Skip if in keyboard mode and mouse hasn't moved. + CPoint pt = GetCursorPos(); + if ((pt.x == m_oldMousePos.x) && (pt.y == m_oldMousePos.y) && m_isKeyMode) + return FALSE; + + UpdateMDIButtons(wparam, lparam); + return FinalWindowProc(msg, wparam, lparam); + } + + // Process the menubar's notifications. + inline LRESULT CMenuBar::OnNotifyReflect(WPARAM, LPARAM lparam) + { + LPNMHDR pHeader = reinterpret_cast(lparam); + switch (pHeader->code) + { + case TBN_DROPDOWN: return OnTBNDropDown(reinterpret_cast(lparam)); + case TBN_HOTITEMCHANGE: return OnTBNHotItemChange(reinterpret_cast(lparam)); + } + + return 0; + } + + // Display the popup menu for a menu item. This function doesn't complete until + // the popup menu is closed. + inline LRESULT CMenuBar::OnPopupMenu() + { + if (m_isKeyMode) + // Simulate a down arrow key press. + PostMessage(WM_KEYDOWN, VK_DOWN, 0); + + m_isKeyMode = FALSE; + m_isExitAfter = FALSE; + m_oldMousePos = GetCursorPos(); + + CWnd* pMaxMDIChild = nullptr; + if (IsMDIChildMaxed()) + pMaxMDIChild = GetActiveMDIChild(); + + // Load the submenu. + int maxedOffset = IsMDIChildMaxed() ? 1 : 0; + m_popupMenu = ::GetSubMenu(m_topMenu, m_hotItem - maxedOffset); + if (pMaxMDIChild && IsMDIChildMaxed() && (m_hotItem == 0)) + m_popupMenu = pMaxMDIChild->GetSystemMenu(FALSE); + + // Retrieve the bounding rectangle for the toolbar button. + CRect rc = GetItemRect(m_hotItem); + + // Convert rectangle to desktop coordinates. + VERIFY(ClientToScreen(rc)); + + // Position popup above toolbar if it won't fit below. + TPMPARAMS tpm = {}; + tpm.cbSize = sizeof(tpm); + tpm.rcExclude = rc; + + // Set the hot button. + SetHotItem(m_hotItem); + Press(GetCommandID(m_hotItem), TRUE); + + m_isSelectedPopup = FALSE; + m_selectedMenu = nullptr; + m_isMenuActive = TRUE; + + // We hook mouse input to process mouse and keyboard input during + // the popup menu. Messages are sent to StaticMsgHook. + + // Remove any remaining hook first. + TLSData* pTLSData = GetApp()->GetTlsData(); + pTLSData->pMenuBar = this; + if (m_msgHook != nullptr) + ::UnhookWindowsHookEx(m_msgHook); + + // Hook messages about to be processed by the shortcut menu. + m_msgHook = ::SetWindowsHookEx(WH_MSGFILTER, (HOOKPROC)StaticMsgHook, + nullptr, ::GetCurrentThreadId()); + + // Display the shortcut menu. + bool isRightToLeft = false; + isRightToLeft = (((GetAncestor().GetExStyle()) & WS_EX_LAYOUTRTL)) != 0; + int xPos = isRightToLeft ? rc.right : rc.left; + UINT id = static_cast(::TrackPopupMenuEx(m_popupMenu, + TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_VERTICAL, xPos, rc.bottom, + *this, &tpm)); + + // We get here once the TrackPopupMenuEx has ended. + // Remove the message hook. + ::UnhookWindowsHookEx(m_msgHook); + m_msgHook = nullptr; + + // Process MDI Child system menu. + if (IsMDIChildMaxed()) + { + if (pMaxMDIChild && pMaxMDIChild->GetSystemMenu(FALSE) == m_popupMenu) + { + if (id) + { + WPARAM wparam = static_cast(id); + pMaxMDIChild->SendMessage(WM_SYSCOMMAND, wparam, 0); + } + } + } + + SetHotItem(-1); + UnpressAll(); + + return 0; + } + + // Called when the user presses the Alt or F10 button. + inline LRESULT CMenuBar::OnSysCommand(UINT msg, WPARAM wparam, LPARAM lparam) + { + // The "wparam & 0xFFF0" below is a requirement mentioned in the + // description of WM_SYSCOMMAND in the Windows API documentation. + if (SC_KEYMENU == (wparam & 0xFFF0)) + { + if (lparam == 0) + { + // Alt/F10 key toggled. + GrabFocus(); + m_isKeyMode = TRUE; + m_isAltMode = TRUE; + int maxedOffset = (IsMDIChildMaxed()? 1:0); + StoreHotItem(maxedOffset); + } + else + // Handle key pressed with Alt held down. + DoAltKey(static_cast(lparam)); + } + + return FinalWindowProc(msg, wparam, lparam); + } + + // Called when a system key (including F10 or Alt) is pressed. + inline LRESULT CMenuBar::OnSysKeyDown(UINT msg, WPARAM wparam, LPARAM lparam) + { + if ((m_isMenuActive || m_isKeyMode) && + ((wparam == VK_MENU) || (wparam == VK_F10))) + { + ExitMenu(); + return 0; + } + + return FinalWindowProc(msg, wparam, lparam); + } + + // Called when a system key (including F10 or Alt) is released. + inline LRESULT CMenuBar::OnSysKeyUp(UINT msg, WPARAM wparam, LPARAM lparam) + { + ExitMenu(); + RedrawWindow(); + return FinalWindowProc(msg, wparam, lparam); + } + + // Called when a user clicks on a menu button. + inline LRESULT CMenuBar::OnTBNDropDown(LPNMTOOLBAR pNMTB) + { + m_hotItem = pNMTB->iItem; + int menuItem = IsMDIChildMaxed() ? m_hotItem - 1 : m_hotItem; + HMENU menu = ::GetSubMenu(m_topMenu, menuItem); + if (IsMenu(menu)) + { + if (!m_isAltMode) + ProcessMenuItem(); + + m_isMenuActive = TRUE; + } + else + { + // Support top menu item without popup menu. + UINT id = GetMenuItemID(); + if (id != UINT(-1)) + { + PostMessage(WM_COMMAND, id, 0); + ExitMenu(); + } + else + m_isMenuActive = TRUE; + } + return 0; + } + + // Called when a hot item change is about to occur. + // This is used to bring up a new popup menu when required. + inline LRESULT CMenuBar::OnTBNHotItemChange(LPNMTBHOTITEM pNMHI) + { + DWORD flag = pNMHI->dwFlags; + if (m_isMenuActive) + { + // idNew is invalid for HICF_LEAVING. + if ((flag & HICF_MOUSE) && !(flag & HICF_LEAVING)) + { + m_isKeyMode = FALSE; + int button = pNMHI->idNew; + if (button != m_hotItem) + { + m_hotItem = CommandToIndex(static_cast(button)); + Cancel(); + WPARAM wparam = static_cast(button); + PostMessage(TB_PRESSBUTTON, wparam, MAKELONG(TRUE, 0)); + GrabFocus(); + ProcessMenuItem(); + } + else + return -1; + + m_hotItem = button; + } + } + else + if ((flag & HICF_MOUSE) && !(flag & HICF_LEAVING) && m_isAltMode) + m_hotItem = pNMHI->idNew; + + return 0; + } + + // Called when the menubar has been resized. + inline LRESULT CMenuBar::OnWindowPosChanged(UINT msg, WPARAM wparam, LPARAM lparam) + { + InvalidateRect(m_mdiRect[0], TRUE); + InvalidateRect(m_mdiRect[1], TRUE); + InvalidateRect(m_mdiRect[2], TRUE); + { + CClientDC MenuBarDC(*this); + DrawAllMDIButtons(MenuBarDC); + } + + RedrawWindow(); + return FinalWindowProc(msg, wparam, lparam); + } + + // Called when the menubar is being resized. + inline LRESULT CMenuBar::OnWindowPosChanging(UINT msg, WPARAM wparam, LPARAM lparam) + { + // Bypass CToolBar::WndProcDefault for this message. + return FinalWindowProc(msg, wparam, lparam); + } + + // Set the window style, before it is created. + inline void CMenuBar::PreCreate(CREATESTRUCT& cs) + { + cs.style = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | TBSTYLE_TOOLTIPS | + TBSTYLE_LIST | TBSTYLE_FLAT | CCS_NODIVIDER | CCS_NORESIZE; + } + + // Set the window class, + inline void CMenuBar::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = TOOLBARCLASSNAME; + } + + // Sets the pressed state of the menu button (pressed or unpressed). + inline void CMenuBar::Press(UINT buttonID, BOOL press) const + { + PressButton(buttonID, press); + } + + // Process messages before passing them on to the menubar. + inline BOOL CMenuBar::PreTranslateMessage(MSG& msg) + { + // Discard mouse move messages unless over a button. + if (m_isKeyMode && msg.message == WM_MOUSEMOVE) + { + UpdateMDIButtons(msg.wParam, msg.lParam); + int first = (IsMDIChildMaxed() ? 1 : 0); + if (HitTest() < first) + return TRUE; + } + + // Forward mouse left button down to the Ancestor window + // if pressed on it's non client area. + if (m_isKeyMode && msg.message == WM_LBUTTONDOWN) + { + CPoint screenPos = GetCursorPos(); + CPoint clientPos = screenPos; + VERIFY(GetAncestor().ScreenToClient(clientPos)); + CRect rcWindow = GetAncestor().GetWindowRect(); + VERIFY(GetAncestor().ScreenToClient(rcWindow)); + CRect rcClient = GetAncestor().GetClientRect(); + + if (rcWindow.PtInRect(clientPos) && !rcClient.PtInRect(clientPos)) + { + ReleaseFocus(); + + // Pass the Left Mouse Click back up to the frame window (and update cursor). + LPARAM lparam = MAKELPARAM(screenPos.x, screenPos.y); + HWND frame = GetAncestor(); + WPARAM wparam = static_cast(::SendMessage(frame, WM_NCHITTEST, 0, lparam)); + ::SendMessage(frame, WM_NCMOUSEMOVE, wparam, lparam); + ::SendMessage(frame, WM_SETCURSOR, reinterpret_cast(frame), + MAKELPARAM(wparam, WM_NCMOUSEMOVE)); + + ::SendMessage(frame, WM_NCLBUTTONDOWN, wparam, lparam); + } + } + + return FALSE; + } + + // Presses the menubar button and displays the popup menu if the is one. + inline void CMenuBar::ProcessMenuItem() + { + UnpressAll(); + + int menuItem = IsMDIChildMaxed() ? m_hotItem - 1 : m_hotItem; + HMENU menu = ::GetSubMenu(m_topMenu, menuItem); + if (IsMenu(menu) || menuItem < 0) + { + // Display the popup menu. + // Use PostMessage for USER_POPUPMENU (not SendMessage). + PostMessage(UWM_POPUPMENU, 0, 0); + } + else + { + // Support keyboard input for top menu item without popup menu. + m_isSelectedPopup = FALSE; + m_selectedMenu = nullptr; + Press(GetCommandID(m_hotItem), TRUE); + } + + m_isMenuActive = TRUE; + GrabFocus(); + } + + // Releases mouse capture and returns keyboard focus. + inline void CMenuBar::ReleaseFocus() + { + if (m_prevFocus) + ::SetFocus(m_prevFocus); + + ::ReleaseCapture(); + } + + // Set the menubar's (toolbar's) hot item. + inline void CMenuBar::StoreHotItem(int hotItem) + { + m_hotItem = hotItem; + SetHotItem(m_hotItem); + RedrawWindow(); + } + + // Builds the list of menubar (toolbar) buttons from the top level menu. + inline void CMenuBar::SetupMenuBar(HMENU menu) + { + assert(IsWindow()); + m_topMenu = menu; + int maxedOffset = (IsMDIChildMaxed()? 1:0); + + // Remove any existing buttons. + while (GetButtonCount() > 0) + { + if (!DeleteButton(0)) + break; + } + + // Set the Bitmap size to zero. + SetBitmapSize(0, 0); + + if (IsMDIChildMaxed()) + { + // Create an extra button for the MDI child system menu. + // Later we will custom draw the window icon over this button. + TBBUTTON tbb = {}; + tbb.fsState = TBSTATE_ENABLED; + tbb.fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE ; + tbb.iString = reinterpret_cast(_T(" ")); + AddButtons(1, &tbb); + SetButtonText(0, _T(" ")); + } + + for (int i = 0 ; i < ::GetMenuItemCount(menu); ++i) + { + // Assign the ToolBar Button struct. + TBBUTTON tbb = {}; + tbb.idCommand = i + maxedOffset; // Each button needs a unique ID. + tbb.fsState = TBSTATE_ENABLED; + tbb.fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_DROPDOWN; + tbb.iString = reinterpret_cast(_T(" ")); + AddButtons(1, &tbb); + + // Add the menu title to the string table. + CString menuText; + GetMenuString(menu, static_cast(i), menuText.GetBuffer(WXX_MAX_STRING_SIZE), + WXX_MAX_STRING_SIZE, MF_BYPOSITION); + menuText.ReleaseBuffer(); + + // Add extra spaces to menuText for high DPI. + if (GetWindowDpi(*this) >= 150) + menuText = _T(" ") + menuText + _T(" "); + + SetButtonText(static_cast(i + maxedOffset), menuText); + } + } + + // This callback used to capture keyboard input while a popup menu is active. + inline LRESULT CALLBACK CMenuBar::StaticMsgHook(int code, WPARAM wparam, LPARAM lparam) + { + MSG* pMsg = reinterpret_cast(lparam); + TLSData* pTLSData = GetApp()->GetTlsData(); + assert(pTLSData); + if (pTLSData != nullptr) + { + CMenuBar* pMenuBar = pTLSData->pMenuBar; + assert(dynamic_cast(pMenuBar)); + if ((pMenuBar != nullptr) && (MSGF_MENU == code)) + { + // Process the popup menu message. + if (pMenuBar->OnMenuInput(pMsg->message, pMsg->wParam, pMsg->lParam)) + // Return a non-zero value to indicate the message has been + // processed and should not be dispatched further. + return TRUE; + } + } + + return ::CallNextHookEx(nullptr, code, wparam, lparam); + } + + // Called by CFrameT when the user chooses a command from the Window menu + // or when the user chooses the maximize button, minimize button, restore + // button, or close button. + inline LRESULT CMenuBar::SysCommand(UINT msg, WPARAM wparam, LPARAM lparam) + { + return OnSysCommand(msg, wparam, lparam); + } + + // Unpress any currently pressed buttons. + inline void CMenuBar::UnpressAll() const + { + for (int i = 0; i < GetButtonCount(); ++i) + { + UINT id = GetCommandID(i); + PressButton(id, FALSE); + } + } + + // Updates the pressed state of the MDI Buttons. + inline void CMenuBar::UpdateMDIButtons(WPARAM wparam, LPARAM lparam) const + { + CPoint pt; + pt.x = GET_X_LPARAM(lparam); + pt.y = GET_Y_LPARAM(lparam); + + if (IsMDIFrame()) + { + if (IsMDIChildMaxed()) + { + CClientDC MenuBarDC(*this); + int MDIButton = -1; + if (m_mdiRect[0].PtInRect(pt)) MDIButton = 0; + if (m_mdiRect[1].PtInRect(pt)) MDIButton = 1; + if (m_mdiRect[2].PtInRect(pt)) MDIButton = 2; + + if (MK_LBUTTON == wparam) // Mouse moved with left mouse button is held down. + { + // Toggle the MDI button image pressed/unpressed as required. + if (MDIButton >= 0) + { + DrawMDIButton(MenuBarDC, MDI_MIN, ((MDIButton == 0) && (m_nMDIButton == 0)) ? 2U : 0U); + DrawMDIButton(MenuBarDC, MDI_RESTORE, ((MDIButton == 1) && (m_nMDIButton == 1)) ? 2U : 0U); + DrawMDIButton(MenuBarDC, MDI_CLOSE, ((MDIButton == 2) && (m_nMDIButton == 2)) ? 2U : 0U); + } + else + { + DrawMDIButton(MenuBarDC, MDI_MIN, 0); + DrawMDIButton(MenuBarDC, MDI_RESTORE, 0); + DrawMDIButton(MenuBarDC, MDI_CLOSE, 0); + } + } + else // Mouse moved without left mouse button held down. + { + if (MDIButton >= 0) + { + DrawMDIButton(MenuBarDC, MDI_MIN, (MDIButton == 0) ? 1U : 0U); + DrawMDIButton(MenuBarDC, MDI_RESTORE, (MDIButton == 1) ? 1U : 0U); + DrawMDIButton(MenuBarDC, MDI_CLOSE, (MDIButton == 2) ? 1U : 0U); + } + else + { + DrawMDIButton(MenuBarDC, MDI_MIN, 0); + DrawMDIButton(MenuBarDC, MDI_RESTORE, 0); + DrawMDIButton(MenuBarDC, MDI_CLOSE, 0); + } + } + } + } + } + + // Provides default message processing for the menubar. + inline LRESULT CMenuBar::WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) + { + switch (msg) + { + case WM_CHAR: return 0; // Discard these messages. + case WM_DRAWITEM: return OnDrawItem(msg, wparam, lparam); + case WM_EXITMENULOOP: return OnExitMenuLoop(msg, wparam, lparam); + case WM_INITMENUPOPUP: return OnInitMenuPopup(msg, wparam, lparam); + case WM_KEYDOWN: return OnKeyDown(msg, wparam, lparam); + case WM_KILLFOCUS: return OnKillFocus(msg, wparam, lparam); + case WM_LBUTTONDBLCLK: // Intentionally blank + case WM_LBUTTONDOWN: return OnLButtonDown(msg, wparam, lparam); + case WM_LBUTTONUP: return OnLButtonUp(msg, wparam, lparam); + case WM_MEASUREITEM: return OnMeasureItem(msg, wparam, lparam); + case WM_MOUSELEAVE: return OnMouseLeave(msg, wparam, lparam); + case WM_MOUSEMOVE: return OnMouseMove(msg, wparam, lparam); + case WM_SYSKEYDOWN: return OnSysKeyDown(msg, wparam, lparam); + case WM_SYSKEYUP: return OnSysKeyUp(msg, wparam, lparam); + case WM_WINDOWPOSCHANGED: return OnWindowPosChanged(msg, wparam, lparam); + case WM_WINDOWPOSCHANGING: return OnWindowPosChanging(msg, wparam, lparam); + case WM_UNINITMENUPOPUP: // Intentionally blank + case WM_MENURBUTTONUP: return GetAncestor().SendMessage(msg, wparam, lparam); + + // Messages defined by Win32++. + case UWM_POPUPMENU: return OnPopupMenu(); + case UWM_GETCMENUBAR: return reinterpret_cast(this); + + } // switch (msg) + + return CToolBar::WndProcDefault(msg, wparam, lparam); + } // LRESULT CMenuBar::WndProcDefault(...) + +} + +#endif // _WIN32XX_MENUBAR_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_menumetrics.h b/packages/media/cpp/packages/Win32xx/include/wxx_menumetrics.h new file mode 100644 index 00000000..1ed5243d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_menumetrics.h @@ -0,0 +1,547 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////// +// wxx_menumetrics.h +// Declaration of the following classes and structs: +// Margins, MenuItemData, and CMenuMetrics. + + +#ifndef _WIN32XX_MENUMETRICS_H_ +#define _WIN32XX_MENUMETRICS_H_ + +#include "wxx_wincore.h" +#include +#include +#include + + +namespace Win32xx +{ + //////////////////////////////////////////////////////////////// + // The Margins struct is returned by the GetThemeMargins Windows + // API function. Margins are the dimension of the thin border + // around the various theme parts. + struct Margins + { + Margins(int cxLeft, int cxRight, int cyTop, int cyBottom) + : cxLeftWidth(cxLeft), cxRightWidth(cxRight), + cyTopHeight(cyTop), cyBottomHeight(cyBottom) + {} + + Margins() : cxLeftWidth(0), cxRightWidth(0), cyTopHeight(0), cyBottomHeight(0) + {} + + int Width() const { return cxLeftWidth + cxRightWidth; } + int Height() const { return cyTopHeight + cyBottomHeight; } + void SetMargins(int cxLeft, int cxRight, int cyTop, int cyBottom) + { + cxLeftWidth = cxLeft; + cxRightWidth = cxRight; + cyTopHeight = cyTop; + cyBottomHeight = cyBottom; + } + + int cxLeftWidth; // width of left border that retains its size + int cxRightWidth; // width of right border that retains its size + int cyTopHeight; // height of top border that retains its size + int cyBottomHeight; // height of bottom border that retains its size + }; + + + ///////////////////////////////////////////////////////////// + // MenuItemData defines the data for each dropdown menu item. + struct MenuItemData + { + MenuItemData() : menu(nullptr), pos(0) + { + mii = {}; + } + + HMENU menu; + MENUITEMINFO mii; + UINT pos; + CString itemText; + }; + + + /////////////////////////////////////////////////////////////////////////// + // CMenuMetrics is used by CFrameT to retrieve the size of the components + // used to perform owner-drawing of menu items. For Windows Vista and above + // it loads uxtheme.dll and uses its visual style functions for the + // calculations. + class CMenuMetrics + { + public: + CMenuMetrics(); + ~CMenuMetrics(); + + CRect GetCheckBackgroundRect(const CRect& item) const; + CRect GetCheckRect(const CRect& item) const; + CRect GetGutterRect(const CRect& item) const; + CSize GetItemSize(MenuItemData* pmd, CClientDC& dc) const; + int GetMenuIconHeight() const; + CRect GetSelectionRect(const CRect& item) const; + CRect GetSeperatorRect(const CRect& item) const; + CRect GetTextRect(const CRect& item) const; + CSize GetTextSize(MenuItemData* pmd, CClientDC& dc) const; + void Initialize(); + BOOL IsVistaMenu() const; + void SetMetrics(HWND frame); + int ToItemStateId(UINT itemState) const; + int ToCheckBackgroundStateId(int stateID) const; + int ToCheckStateId(UINT type, int stateID) const; + + // Wrappers for Windows API functions. + HRESULT CloseThemeData() const; + HRESULT DrawThemeBackground(HDC dc, int partID, int stateID, const RECT* pRect, + const RECT* pClipRect) const; + HRESULT DrawThemeText(HDC dc, int partID, int stateID, LPCWSTR text, + int charCount, DWORD textFlags, DWORD textFlags2, LPCRECT pRect) const; + HRESULT GetThemePartSize(HDC dc, int partID, int stateID, LPCRECT prc, + THEMESIZE eSize, SIZE* psz) const; + HRESULT GetThemeInt(int partID, int stateID, int propID, int* pVal) const; + HRESULT GetThemeMargins(HDC dc, int partID, int stateID, int propID, + LPRECT prc, Margins* pMargins) const; + HRESULT GetThemeTextExtent(HDC dc, int partID, int stateID, LPCWSTR text, + int charCount, DWORD textFlags, LPCRECT pBoundingRect, LPRECT pExtentRect) const; + BOOL IsThemeBackgroundPartiallyTransparent(int partID, int stateID) const; + HANDLE OpenThemeData(HWND wnd, LPCWSTR classList) const; + + private: + HANDLE m_theme; // Theme handle returned by OpenThemeData. + + Margins m_marCheck; // The check margins value returned by the GetThemeMargins function. + Margins m_marCheckBackground; // The check background margins value returned by the GetThemeMargins function. + Margins m_marItem; // The item margins value returned by the GetThemeMargins function. + Margins m_marText; // The text margins value returned by the GetThemeMargins function. + + CSize m_sizeCheck; // The size of the image used for menu check boxes and radio boxes. + CSize m_sizeSeparator; // The size of the separator menu item. + + using CLOSETHEMEDATA = HRESULT(WINAPI*)(HANDLE); + using DRAWTHEMEBACKGROUND = HRESULT (WINAPI*)(HANDLE, HDC, int, int, const RECT*, const RECT*); + using DRAWTHEMETEXT = HRESULT (WINAPI*)(HANDLE, HDC, int, int, LPCWSTR, int, DWORD, DWORD, LPCRECT); + using GETTHEMEPARTSIZE = HRESULT (WINAPI*)(HANDLE, HDC, int, int, LPCRECT, THEMESIZE, SIZE*); + using GETTHEMEINT = HRESULT (WINAPI*)(HANDLE, int, int, int, int*); + using GETTHEMEMARGINS = HRESULT (WINAPI*)(HANDLE, HDC, int, int, int, LPRECT, Margins*); + using GETTHEMETEXTEXTENT = HRESULT (WINAPI*)(HANDLE, HDC, int, int, LPCWSTR, int, DWORD, LPCRECT, LPCRECT); + using ISTHEMEBGPARTTRANSPARENT = BOOL (WINAPI*)(HANDLE, int, int); + using OPENTHEMEDATA = HANDLE (WINAPI*)(HWND, LPCWSTR); + + // Pointers to functions defined in uxTheme.dll + CLOSETHEMEDATA m_pfnCloseThemeData; + DRAWTHEMEBACKGROUND m_pfnDrawThemeBackground; + DRAWTHEMETEXT m_pfnDrawThemeText; + GETTHEMEPARTSIZE m_pfnGetThemePartSize; + GETTHEMEINT m_pfnGetThemeInt; + GETTHEMEMARGINS m_pfnGetThemeMargins; + GETTHEMETEXTEXTENT m_pfnGetThemeTextExtent; + ISTHEMEBGPARTTRANSPARENT m_pfnIsThemeBGPartTransparent; + OPENTHEMEDATA m_pfnOpenThemeData; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + ////////////////////////////////////////// + // Definitions for the CMenuMetrics class. + // + inline CMenuMetrics::CMenuMetrics() : m_theme(nullptr), + m_pfnCloseThemeData(nullptr), m_pfnDrawThemeBackground(nullptr), + m_pfnDrawThemeText(nullptr), m_pfnGetThemePartSize(nullptr), + m_pfnGetThemeInt(nullptr), m_pfnGetThemeMargins(nullptr), + m_pfnGetThemeTextExtent(nullptr), m_pfnIsThemeBGPartTransparent(nullptr), + m_pfnOpenThemeData(nullptr) + { + Initialize(); + } + + inline CMenuMetrics::~CMenuMetrics() + { + if (m_theme != nullptr) + CloseThemeData(); + } + + // Closes the theme data handle. + inline HRESULT CMenuMetrics::CloseThemeData() const + { + if (m_pfnCloseThemeData) + return m_pfnCloseThemeData(m_theme); + + return E_NOTIMPL; + } + + // Draws the border and fill defined by the visual style for the specified control part. + inline HRESULT CMenuMetrics::DrawThemeBackground(HDC dc, int partID, + int stateID, const RECT *pRect, const RECT *pClipRect) const + { + assert(m_theme); + if (m_pfnDrawThemeBackground) + return m_pfnDrawThemeBackground(m_theme, dc, partID, stateID, pRect, pClipRect); + + return E_NOTIMPL; + } + + // Draws text using the color and font defined by the visual style. + inline HRESULT CMenuMetrics::DrawThemeText(HDC dc, int partID, int stateID, + LPCWSTR text, int charCount, DWORD textFlags, DWORD textFlags2, LPCRECT pRect) const + { + assert(m_theme); + if (m_pfnDrawThemeText) + return m_pfnDrawThemeText(m_theme, dc, partID, stateID, text, charCount, textFlags, textFlags2, pRect); + + return E_NOTIMPL; + } + + inline CRect CMenuMetrics::GetCheckBackgroundRect(const CRect& item) const + { + int cx = m_sizeCheck.cx + m_marCheck.Width(); + int cy = m_sizeCheck.cy + m_marCheck.Height(); + + int x = item.left + m_marCheckBackground.cxLeftWidth + m_marItem.cxLeftWidth; + int y = item.top + (item.Height() - cy) / 2; + + return CRect(x, y, x + cx, y + cy); + } + + inline CRect CMenuMetrics::GetGutterRect(const CRect& item) const + { + int x = item.left; + int y = item.top; + int cx = m_marItem.cxLeftWidth + m_marCheckBackground.Width() + m_marCheck.Width() + m_sizeCheck.cx; + int cy = item.Height(); + + return CRect(x, y, x + cx, y + cy); + } + + inline CRect CMenuMetrics::GetCheckRect(const CRect& item) const + { + int x = item.left + m_marCheckBackground.cxLeftWidth + m_marCheck.cxLeftWidth + m_marItem.cxLeftWidth; + int y = item.top + (item.Height() - m_sizeCheck.cy) / 2; + + return CRect(x, y, x + m_sizeCheck.cx, y + m_sizeCheck.cy); + } + + // Retrieve the size of the menu item. + inline CSize CMenuMetrics::GetItemSize(MenuItemData* pmd, CClientDC& dc) const + { + CSize size; + + // Add icon/check width. + CRect rc; + size.cx += GetGutterRect(rc).Width(); + + if (pmd->mii.fType & MFT_SEPARATOR) + { + // separator height + size.cy = m_sizeSeparator.cy + m_marItem.Height(); + } + else + { + // Add check background horizontal padding. + size.cx += m_marCheckBackground.Width(); + + // Add selection margin padding. + size.cx += m_marItem.Width(); + + size.cx += GetMenuIconHeight() / 4; + + // Account for text width and checkmark height. + CSize sizeText = GetTextSize(pmd, dc); + size.cx += sizeText.cx; + size.cy = std::max(sizeText.cy, m_sizeCheck.cy) + m_marCheckBackground.Height() + + m_marCheck.Height(); + } + + return (size); + } + + inline int CMenuMetrics::GetMenuIconHeight() const + { + int value = m_sizeCheck.cy + m_marCheck.Height(); + return value; + } + + inline CRect CMenuMetrics::GetSelectionRect(const CRect& item) const + { + int x = m_marItem.cxLeftWidth; + int y = item.top; + + return CRect(x, y, item.right - m_marItem.cxRightWidth, y + item.Height()); + } + + inline CRect CMenuMetrics::GetSeperatorRect(const CRect& item) const + { + int left = GetGutterRect(item).right; + int top = item.top; + int right = item.right - m_marItem.cxRightWidth; + int bottom = item.top + m_sizeSeparator.cy; + + return CRect(left, top, right, bottom); + } + + inline CSize CMenuMetrics::GetTextSize(MenuItemData* pmd, CClientDC& dc) const + { + // Calculate the size of the text. + CSize sizeText; + CString itemText = pmd->itemText; + if (IsVistaMenu()) + { + CRect rcText; + GetThemeTextExtent(dc, MENU_POPUPITEM, 0, TtoW(itemText), itemText.GetLength(), + DT_EXPANDTABS, nullptr, &rcText); + + sizeText.SetSize(rcText.right, rcText.bottom); + } + else + { + // Calculate the size of the text. + sizeText = dc.GetTextExtentPoint32(itemText, itemText.GetLength()); + } + + sizeText.cx += m_marText.Width(); + sizeText.cy += m_marText.Height(); + return sizeText; + } + + inline CRect CMenuMetrics::GetTextRect(const CRect& item) const + { + int left = GetGutterRect(item).Width() + m_marText.cxLeftWidth + GetMenuIconHeight() / 4; + int top = item.top + m_marText.cyTopHeight; + int right = item.right - m_marItem.cxRightWidth - m_marText.cxRightWidth; + int bottom = item.bottom - m_marText.cyBottomHeight; + + return CRect(left, top, right, bottom); + } + + // Calculates the original size of the part defined by a visual style. + inline HRESULT CMenuMetrics::GetThemePartSize(HDC dc, int partID, + int stateID, LPCRECT prc, THEMESIZE eSize, SIZE* psz) const + { + assert(m_theme); + if (m_pfnGetThemePartSize) + return m_pfnGetThemePartSize(m_theme, dc, partID, stateID, prc, eSize, psz); + + return E_NOTIMPL; + } + + // Retrieves the value of an int property. + inline HRESULT CMenuMetrics::GetThemeInt(int partID, int stateID, int propID, int* pVal) const + { + assert(m_theme); + if (m_pfnGetThemeInt) + return m_pfnGetThemeInt(m_theme, partID, stateID, propID, pVal); + + return E_NOTIMPL; + } + + // Retrieves the value of a MARGINS property. + inline HRESULT CMenuMetrics::GetThemeMargins(HDC dc, int partID, int stateID, + int propID, LPRECT prc, Margins* pMargins) const + { + assert(m_theme); + if (m_pfnGetThemeMargins) + return m_pfnGetThemeMargins(m_theme, dc, partID, stateID, propID, prc, pMargins); + + return E_NOTIMPL; + } + + // Calculates the size and location of the specified text when rendered in the visual style font. + inline HRESULT CMenuMetrics::GetThemeTextExtent(HDC dc, int partID, + int stateID, LPCWSTR text, int charCount, DWORD textFlags, + LPCRECT pBoundingRect, LPRECT pExtentRect) const + { + assert(m_theme); + if (m_pfnGetThemeTextExtent) + return m_pfnGetThemeTextExtent(m_theme, dc, partID, stateID, text, charCount, textFlags, pBoundingRect, pExtentRect); + + return E_NOTIMPL; + } + + // Initializes the CMenuMetrics member variables. + inline void CMenuMetrics::Initialize() + { + HMODULE uxTheme = ::GetModuleHandle(_T("uxtheme.dll")); + + if (uxTheme != nullptr) + { + m_pfnCloseThemeData = reinterpret_cast( + reinterpret_cast(::GetProcAddress(uxTheme, "CloseThemeData"))); + m_pfnDrawThemeBackground = reinterpret_cast( + reinterpret_cast(::GetProcAddress(uxTheme, "DrawThemeBackground"))); + m_pfnDrawThemeText = reinterpret_cast( + reinterpret_cast(::GetProcAddress(uxTheme, "DrawThemeText"))); + m_pfnGetThemePartSize = reinterpret_cast( + reinterpret_cast(::GetProcAddress(uxTheme, "GetThemePartSize"))); + m_pfnGetThemeInt = reinterpret_cast( + reinterpret_cast(::GetProcAddress(uxTheme, "GetThemeInt"))); + m_pfnGetThemeMargins = reinterpret_cast( + reinterpret_cast(::GetProcAddress(uxTheme, "GetThemeMargins"))); + m_pfnGetThemeTextExtent = reinterpret_cast( + reinterpret_cast(::GetProcAddress(uxTheme, "GetThemeTextExtent"))); + m_pfnIsThemeBGPartTransparent = reinterpret_cast( + reinterpret_cast(::GetProcAddress(uxTheme, "IsThemeBackgroundPartiallyTransparent"))); + m_pfnOpenThemeData = reinterpret_cast( + reinterpret_cast(::GetProcAddress(uxTheme, "OpenThemeData"))); + } + } + + inline void CMenuMetrics::SetMetrics(HWND frame) + { + if (m_theme != nullptr) + { + CloseThemeData(); + m_theme = nullptr; + } + + m_theme = OpenThemeData(frame, VSCLASS_MENU); + + if (m_theme != nullptr) + { + int borderSize = 0; // Border space between item text and accelerator. + int bgBorderSize = 0; // Border space between item text and gutter. + GetThemePartSize(nullptr, MENU_POPUPCHECK, 0, nullptr, TS_TRUE, &m_sizeCheck); + GetThemePartSize(nullptr, MENU_POPUPSEPARATOR, 0, nullptr, TS_TRUE, &m_sizeSeparator); + GetThemeInt(MENU_POPUPITEM, 0, TMT_BORDERSIZE, &borderSize); + GetThemeInt(MENU_POPUPBACKGROUND, 0, TMT_BORDERSIZE, &bgBorderSize); + GetThemeMargins(nullptr, MENU_POPUPCHECK, 0, TMT_CONTENTMARGINS, nullptr, &m_marCheck); + GetThemeMargins(nullptr, MENU_POPUPCHECKBACKGROUND, 0, TMT_CONTENTMARGINS, nullptr, &m_marCheckBackground); + GetThemeMargins(nullptr, MENU_POPUPITEM, 0, TMT_CONTENTMARGINS, nullptr, &m_marItem); + + // Popup text margins + m_marText = m_marItem; + m_marText.cxRightWidth = borderSize; + m_marText.cxLeftWidth = bgBorderSize; + } + else + { + m_sizeCheck.SetSize(::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON)); + m_sizeSeparator.SetSize(1, 7); + m_marCheck.SetMargins(4, 4, 2, 2); + m_marCheckBackground.SetMargins(0, 0, 0, 0); + m_marItem.SetMargins(0, 0, 0, 0); + m_marText.SetMargins(8, 16, 0, 0); + } + } + + // Retrieves whether the background specified by the visual style has transparent pieces or alpha-blended pieces. + inline BOOL CMenuMetrics::IsThemeBackgroundPartiallyTransparent(int partID, int stateID) const + { + assert(m_theme); + if (m_pfnIsThemeBGPartTransparent) + return m_pfnIsThemeBGPartTransparent(m_theme, partID, stateID); + + return FALSE; + } + + // Opens the theme data for a window and its associated class. + inline HANDLE CMenuMetrics::OpenThemeData(HWND wnd, LPCWSTR classList) const + { + if (m_pfnOpenThemeData) + return m_pfnOpenThemeData(wnd, classList); + + return 0; + } + + inline BOOL CMenuMetrics::IsVistaMenu() const + { + return (m_theme != nullptr); + } + + // Convert from item state to MENU_POPUPITEM state. + inline int CMenuMetrics::ToItemStateId(UINT itemState) const + { + const bool isDisabled = ((itemState & (ODS_INACTIVE | ODS_DISABLED)) != 0); + const bool isHot = ((itemState & (ODS_HOTLIGHT | ODS_SELECTED)) != 0); + POPUPITEMSTATES state; + + if (isDisabled) + state = (isHot ? MPI_DISABLEDHOT : MPI_DISABLED); + else if (isHot) + state = MPI_HOT; + else + state= MPI_NORMAL; + + return state; + } + + // Convert to MENU_POPUPCHECKBACKGROUND. + inline int CMenuMetrics::ToCheckBackgroundStateId(int stateID) const + { + POPUPCHECKBACKGROUNDSTATES stateIdCheckBackground; + + // Determine the check background state. + if (stateID == MPI_DISABLED || stateID == MPI_DISABLEDHOT) + stateIdCheckBackground = MCB_DISABLED; + else + stateIdCheckBackground = MCB_NORMAL; + + return stateIdCheckBackground; + } + + // Convert to MENU_POPUPCHECK state. + inline int CMenuMetrics::ToCheckStateId(UINT type, int stateID) const + { + POPUPCHECKSTATES stateIdCheck; + + if (type & MFT_RADIOCHECK) + { + if (stateID == MPI_DISABLED || stateID == MPI_DISABLEDHOT) + stateIdCheck = MC_BULLETDISABLED; + else + stateIdCheck = MC_BULLETNORMAL; + } + else + { + if (stateID == MPI_DISABLED || stateID == MPI_DISABLEDHOT) + stateIdCheck = MC_CHECKMARKDISABLED; + else + stateIdCheck = MC_CHECKMARKNORMAL; + } + + return stateIdCheck; + } + +} + +#endif // _WIN32XX_MENUMETRICS_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_messagepump.h b/packages/media/cpp/packages/Win32xx/include/wxx_messagepump.h new file mode 100644 index 00000000..5d16a1f2 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_messagepump.h @@ -0,0 +1,162 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + + +#ifndef _WIN32XX_MESSAGEPUMP_H_ +#define _WIN32XX_MESSAGEPUMP_H_ + +#include "wxx_messagepump0.h" + +namespace Win32xx +{ + + ////////////////////////////////////////// + // Definitions for the CMessagePump class. + // + + // InitInstance is called when the thread or application starts. + // Override this function to perform tasks such as creating a window. + // Return TRUE to indicate success and run the message loop. + inline BOOL CMessagePump::InitInstance() + { + return TRUE; + } + + // This function translates the thread's window message and dispatches + // them to a window procedure. + inline int CMessagePump::MessageLoop() + { + MSG msg = {}; + int status = 1; + LONG count = 0; + + while (status != 0) + { + // While idle, perform idle processing until OnIdle returns FALSE. + while (!::PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE) && OnIdle(count) != FALSE) + { + count++; + } + + count = 0; + + // Now wait until we get a message. + if ((status = ::GetMessage(&msg, nullptr, 0, 0)) == -1) + return -1; + + if (!PreTranslateMessage(msg)) + { + ::TranslateMessage(&msg); + ::DispatchMessage(&msg); + } + + } + + return LOWORD(msg.wParam); + } + + // This function is called by the MessageLoop. It is called when the message queue + // is empty. Return TRUE to continue idle processing or FALSE to end idle processing + // until another message is queued. The count is incremented each time OnIdle is + // called, and reset to 0 each time a new messages is processed. + inline BOOL CMessagePump::OnIdle(LONG) + { + return FALSE; + } + + // Override this function if your class requires input messages to be + // translated before normal processing. + // Return TRUE if the message is translated. + inline BOOL CMessagePump::PreTranslateMessage(MSG& msg) + { + BOOL isProcessed = FALSE; + + // Only pre-translate mouse and keyboard input events. + if ((msg.message >= WM_KEYFIRST && msg.message <= WM_KEYLAST) || + (msg.message >= WM_MOUSEFIRST && msg.message <= WM_MOUSELAST)) + { + // Process keyboard accelerators + if (::TranslateAccelerator(GetAcceleratorsWindow(), GetAcceleratorTable(), &msg)) + isProcessed = TRUE; + else + { + // Search the chain of parents for pretranslated messages. + for (HWND wnd = msg.hwnd; wnd != nullptr; wnd = ::GetParent(wnd)) + { + CWnd* pWnd = GetApp()->GetCWndFromMap(wnd); + if (pWnd) + { + isProcessed = pWnd->PreTranslateMessage(msg); + if (isProcessed) + break; + } + } + } + } + + return isProcessed; + } + + // Calls InitInstance and runs the message loop. + inline int CMessagePump::Run() + { + // InitInstance runs the App's initialization code. + if (InitInstance()) + { + // Dispatch the window messages. + return MessageLoop(); + } + else + { + TRACE("\n*** ERROR:InitInstance failed! Terminating the thread. ***\n\n"); + ::PostQuitMessage(-1); + return -1; + } + } + + // accel is the handle of the accelerator table. + // accelWnd is the window handle for translated messages. + inline void CMessagePump::SetAccelerators(HACCEL accel, HWND accelWnd) + { + m_accelWnd = accelWnd; + m_accel = accel; + } + +} + +#endif // _WIN32XX_MESSAGEPUMP_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_messagepump0.h b/packages/media/cpp/packages/Win32xx/include/wxx_messagepump0.h new file mode 100644 index 00000000..1f53b5a3 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_messagepump0.h @@ -0,0 +1,75 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +#ifndef _WIN32XX_MESSAGEPUMP0_H_ +#define _WIN32XX_MESSAGEPUMP0_H_ + + +namespace Win32xx +{ + class CMessagePump : public CObject + { + public: + CMessagePump() : m_accel(0), m_accelWnd(0) {} + virtual ~CMessagePump() = default; + + HACCEL GetAcceleratorTable() const { return m_accel; } + HWND GetAcceleratorsWindow() const { return m_accelWnd; } + void SetAccelerators(HACCEL accel, HWND accelWnd); + + // Override this function as required. + virtual int Run(); + + protected: + // Override these functions as required. + virtual BOOL InitInstance(); + virtual int MessageLoop(); + virtual BOOL OnIdle(LONG count); + virtual BOOL PreTranslateMessage(MSG& msg); + + private: + CMessagePump(const CMessagePump&) = delete; + CMessagePump& operator=(const CMessagePump&) = delete; + + HACCEL m_accel; // handle to the accelerator table + HWND m_accelWnd; // handle to the window for accelerator keys + }; + +} + +#endif // _WIN32XX_MESSAGEPUMP0_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_metafile.h b/packages/media/cpp/packages/Win32xx/include/wxx_metafile.h new file mode 100644 index 00000000..f0842bc7 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_metafile.h @@ -0,0 +1,223 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////// +// A metafile is a collection of structures that store a picture in a +// device-independent format. Device independence is the one feature that sets +// metafiles apart from bitmaps. Unlike a bitmap, a metafile guarantees device +// independence. There is a drawback to metafiles however, they are generally +// drawn more slowly than bitmaps. +// +// In 1993, the 32-bit version of Win32/GDI introduced the Enhanced Metafile +// (EMF), a newer version with additional commands. EMF is also used as a +// graphics language for printer drivers. Microsoft recommends that +// "Windows-format" (WMF) functions only "rarely" be used and "enhanced-format" +// (EMF) functions be used instead. +// +//////////////////////////////////////////////////////// + + +#ifndef _WIN32XX_METAFILE_H_ +#define _WIN32XX_METAFILE_H_ + +namespace Win32xx +{ + + struct MetaFileData // A structure that contains the data members for CMetaFile. + { + // Constructor + MetaFileData() : metaFile(nullptr) {} + + HMETAFILE metaFile; + }; + + struct EnhMetaFileData // A structure that contains the data members for CEnhMetaFile. + { + // Constructor + EnhMetaFileData() : enhMetaFile(nullptr) {} + + HENHMETAFILE enhMetaFile; + }; + + ////////////////////////////////////////////////////////////////////////// + // CMetaFile wraps a HMETAFILE. CMetaFile can be used anywhere a HMETAFILE + // can be used. CMetaFile objects are reference counted, so they can be + // safely copied. CMetatFile automatically deletes the HMETAFILE when the + // last copy of the CMetaFile object goes out of scope. The + // CMetaFileDC::Close function returns a CMetaFile object. + class CMetaFile final + { + friend class CMetaFileDC; + + public: + CMetaFile(); + CMetaFile(const CMetaFile& rhs); + ~CMetaFile(); + CMetaFile& operator=(const CMetaFile& rhs); + operator HMETAFILE() { return m_pData->metaFile; } + + private: + CMetaFile(HMETAFILE metaFile); + void Release(); + + MetaDataPtr m_pData; + }; + + + ///////////////////////////////////////////////////// + // CEnhMetaFile wraps a HENHMETAFILE. CEnhMetaFile can be used anywhere a + // HENHMETAFILE can be used. CEnhMetaFile objects are reference counted, + // so they can be safely copied. CEnhMetaFile automatically deletes the + // HENHMETAFILE when the last copy of the CEnhMetaFile object goes out of + // scope. The CMetaFileDC::CloseEnhanced function returns a CEnhMetaFile + // object. + class CEnhMetaFile final + { + friend class CEnhMetaFileDC; + + public: + CEnhMetaFile(); + CEnhMetaFile(const CEnhMetaFile& rhs); + ~CEnhMetaFile(); + CEnhMetaFile& operator=(const CEnhMetaFile& rhs); + operator HENHMETAFILE() { return m_pData->enhMetaFile; } + + private: + CEnhMetaFile(HENHMETAFILE enhMetaFile); + void Release(); + EnhMetaDataPtr m_pData; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + /////////////////////////////////////////// + // Definitions for the the CMetaFile class. + // + inline CMetaFile::CMetaFile() : m_pData(std::make_shared()) + { + } + + // A private constructor used by CMetaFileDC. + inline CMetaFile::CMetaFile(HMETAFILE metaFile) : m_pData(std::make_shared()) + { + m_pData->metaFile = metaFile; + } + + inline CMetaFile::CMetaFile(const CMetaFile& rhs) + { + m_pData = rhs.m_pData; + } + + inline CMetaFile::~CMetaFile() + { + Release(); + } + + inline CMetaFile& CMetaFile::operator=(const CMetaFile& rhs) + { + if (this != &rhs) + { + Release(); + m_pData = rhs.m_pData; + } + + return *this; + } + + inline void CMetaFile::Release() + { + // Delete the metafile when the last copy goes out of scope. + if (m_pData.use_count() == 1 && m_pData->metaFile != nullptr) + { + VERIFY(::DeleteMetaFile(m_pData->metaFile)); + } + } + + + ////////////////////////////////////////////// + // Definitions for the the CEnhMetaFile class. + // + inline CEnhMetaFile::CEnhMetaFile() : m_pData(std::make_shared()) + { + } + + // A private constructor used by CEnhMetaFileDC. + inline CEnhMetaFile::CEnhMetaFile(HENHMETAFILE enhMetaFile) + : m_pData(std::make_shared()) + { + m_pData->enhMetaFile = enhMetaFile; + } + + inline CEnhMetaFile::CEnhMetaFile(const CEnhMetaFile& rhs) + { + m_pData = rhs.m_pData; + } + + inline CEnhMetaFile::~CEnhMetaFile() + { + Release(); + } + + inline CEnhMetaFile& CEnhMetaFile::operator=(const CEnhMetaFile& rhs) + { + if (this != &rhs) + { + Release(); + m_pData = rhs.m_pData; + } + return *this; + } + + inline void CEnhMetaFile::Release() + { + // Delete the enhanced metafile when the last copy goes out of scope. + if (m_pData.use_count() == 1 && m_pData->enhMetaFile != nullptr) + { + VERIFY(::DeleteEnhMetaFile(m_pData->enhMetaFile)); + } + } + + +} // namespace Win32xx + +#endif // _WIN32XX_METAFILE_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_mutex.h b/packages/media/cpp/packages/Win32xx/include/wxx_mutex.h new file mode 100644 index 00000000..ad4a6fe3 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_mutex.h @@ -0,0 +1,242 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + + +#ifndef _WIN32XX_MUTEX_H_ +#define _WIN32XX_MUTEX_H_ + + +/////////////////////////////////////////////////////// +// wxx_mutex.h +// This file contains the declarations of the following set of classes. +// +// 1) CEvent: Creates a named or unnamed event. Use the SetEvent function to +// set the state of an event object to signalled. Use the ResetEvent +// function to reset the state of an event object to non-signalled. +// Threads can check the status of the event with one of the wait +// functions. When the state of an auto-reset event object is +// signalled, it remains signalled until a single waiting thread is +// released. The system then automatically resets the state to +// non-signalled. If no threads are waiting, the event object's +// state remains signalled. +// +// 2) CMutex: Creates a named or unnamed mutex. Threads use one of the wait +// functions to request ownership of the mutex. The state of a mutex +// object is signalled when it is not owned by any thread. Threads +// can check the status of the event with one of the wait functions. +// +// 3) CSemaphore: Creates a named or unnamed semaphore. The state of a +// semaphore object is signalled when its count is greater than +// zero, and non-signalled when its count is equal to zero. The +// initialCount parameter specifies the initial count. +// Each time a waiting thread is released because of the semaphore's +// signalled state, the count of the semaphore is decreased by one. +// Threads can check the status of the event with one of the wait +// functions. +// + + +namespace Win32xx +{ + /////////////////////////////////////////////////////////////////// + // CEvent manages an event object. Event objects can be set to + // a signalled or non-signalled state to facilitate synchronization + // between threads. + class CEvent + { + public: + CEvent(BOOL isInitiallySignaled = FALSE, BOOL isManualReset = FALSE, + LPCTSTR name = nullptr, LPSECURITY_ATTRIBUTES attributes = nullptr); + + HANDLE GetHandle() const { return m_event; } + operator HANDLE() const { return m_event; } + + void ResetEvent(); + void SetEvent(); + + private: + CEvent(const CEvent&) = delete; + CEvent& operator=(const CEvent&) = delete; + + HANDLE m_event; + }; + + ///////////////////////////////////////////////////////// + // CMutex manages a mutex object. A mutex object is a + // synchronization object whose state is set to signalled + // when it is not owned by any thread, and non-signalled + // when it is owned. Only one thread at a time can own + // a mutex object. + class CMutex + { + public: + CMutex(BOOL isInitiallySignaled = FALSE, LPCTSTR name = nullptr, + LPSECURITY_ATTRIBUTES pAttributes = nullptr); + + HANDLE GetHandle() const { return m_mutex; } + operator HANDLE() const { return m_mutex; } + + private: + CMutex(const CMutex&) = delete; + CMutex& operator=(const CMutex&) = delete; + + HANDLE m_mutex; + }; + + /////////////////////////////////////////////////////////////// + // CSemaphore manages a semaphore object. A semaphore object + // is a synchronization object that maintains a count between + // zero and a specified maximum value. The count is decremented + // each time a thread completes a wait for the semaphore object + // and incremented each time a thread releases the semaphore. + class CSemaphore + { + public: + CSemaphore(LONG initialCount, LONG maxCount, LPCTSTR name, + LPSECURITY_ATTRIBUTES attributes = nullptr); + + HANDLE GetHandle() const { return m_semaphore; } + operator HANDLE() const { return m_semaphore; } + BOOL ReleaseSemaphore(LONG releaseCount, LONG* pPreviousCount = nullptr); + + private: + CSemaphore(const CSemaphore&) = delete; + CSemaphore& operator=(const CSemaphore&) = delete; + + HANDLE m_semaphore; + }; + + + ////////////////////////////////////// + // CEvent member function definitions. + // + + // Creates a named or unnamed event. + // Parameters: + // isInitiallySignaled - TRUE the initial state of the created event is signalled, FALSE otherwise + // isManualReset - TRUE requires the use of the ResetEvent function to set the event state to non-signalled. + // - FALSE the event is automatically reset to non-signalled after a single waiting thread has been released. + // name - pointer to a null terminated string specifying the event's name. Can be nullptr. + // - If name matches an existing event, the existing handle is retrieved. + // attributes - Pointer to a SECURITY_ATTRIBUTES structure that determines whether the returned + // handle can be inherited by child processes. If attributes is nullptr, the + // handle cannot be inherited. + inline CEvent::CEvent(BOOL isInitiallySignaled, BOOL isManualReset, LPCTSTR name, + LPSECURITY_ATTRIBUTES attributes) + : m_event(nullptr) + { + m_event = ::CreateEvent(attributes, isManualReset, isInitiallySignaled, name); + if (m_event == nullptr) + throw CResourceException(GetApp()->MsgMtxEvent()); + } + + // Sets the specified event object to the non-signalled state. + inline void CEvent::ResetEvent() + { + VERIFY(::ResetEvent(m_event)); + } + + // Sets the specified event object to the signalled state. + inline void CEvent::SetEvent() + { + VERIFY(::SetEvent(m_event)); + } + + + ////////////////////////////////////// + // CMutex member function definitions. + // + + // Creates a named or unnamed mutex. + // Parameters: + // isInitiallySignaled - TRUE the initial state of the created mutex is signalled, FALSE otherwise + // name - pointer to a null terminated string specifying the mutex's name. Can be nullptr. + // - If name matches an existing mutex, the existing handle is retrieved. + // attributes - Pointer to a SECURITY_ATTRIBUTES structure that determines whether the returned + // handle can be inherited by child processes. If attributes is nullptr, the + // handle cannot be inherited. + inline CMutex::CMutex(BOOL isInitiallySignaled, LPCTSTR name, + LPSECURITY_ATTRIBUTES attributes) + : m_mutex(nullptr) + { + m_mutex = ::CreateMutex(attributes, isInitiallySignaled, name); + if (m_mutex == nullptr) + throw CResourceException(GetApp()->MsgMtxMutex()); + } + + + ////////////////////////////////////// + // CMutex member function definitions. + // + + // Creates a named or unnamed semaphore. + // Parameters: + // initialCount - Initial count for the semaphore object. This value must be greater than or equal + // to zero and less than or equal to lMaximumCount. + // maxCount - Maximum count for the semaphore object. This value must be greater than zero. + // attributes - Pointer to a SECURITY_ATTRIBUTES structure that determines whether the returned + // handle can be inherited by child processes. If attributes is nullptr, the + // handle cannot be inherited. + inline CSemaphore::CSemaphore(LONG initialCount, LONG maxCount, LPCTSTR name, + LPSECURITY_ATTRIBUTES attributes) + : m_semaphore(nullptr) + { + assert(maxCount > 0); + assert(initialCount <= maxCount); + + m_semaphore = ::CreateSemaphore(attributes, initialCount, maxCount, name); + if (m_semaphore == nullptr) + throw CResourceException(GetApp()->MsgMtxSemaphore()); + } + + // Increases the count of the specified semaphore object by a specified amount. + // Parameters: + // releaseCount - Amount by which the semaphore object's current count is to be increased. + // must be greater than zero. + // pPreviousCount - pointer to a variable to receive the previous count. + inline BOOL CSemaphore::ReleaseSemaphore(LONG releaseCount, LONG* pPreviousCount) + { + BOOL result = ::ReleaseSemaphore(m_semaphore, releaseCount, pPreviousCount); + return result; + } + +} + + +#endif // _WIN32XX_MUTEX_H_ + diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_preview.h b/packages/media/cpp/packages/Win32xx/include/wxx_preview.h new file mode 100644 index 00000000..4cb93c50 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_preview.h @@ -0,0 +1,543 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + +// Acknowledgement: +// ================ +// A special thanks to Robert C. Tausworthe for his assistance +// in developing this class. + + +#ifndef _WIN32XX_PREVIEW_H_ +#define _WIN32XX_PREVIEW_H_ + +#include "wxx_wincore.h" +#include "wxx_dialog.h" +#include "wxx_stdcontrols.h" +#include "wxx_printdialogs.h" +#include "default_resource.h" + +///////////////////////////////////////////////////////////////////////////// +// CPrintPreview provides a preview of printed page before sending the print +// job to the printer. CPrintPreview creates a memory device context from the +// printer's device context. Instead of printing directly to the printer, we +// print to the memory DC instead. + + +// To use CPrintPreview, do the following: +// 1) Declare CPrintPreview as CMainFrame's member variable, specifying the +// source's class as the template type. The source is where the PrintPage +// function resides. +// 2) Specify values for the string resources used by CPrintPreview in +// resource.rc. +// 3) Use SetSource to specify to where to call the PrintPage function. +// Alternatively, specify the source in CPrintPreview's constructor. +// 4) Declare a PrintPage function in the source for printing and previewing: +// void PrintPage(CDC& dc, int page); +// 5) Call DoPrintPreview(HWND ownerWindow, int maxPage = 1) to initiate the +// print preview. +// 6) Create the preview window, and swap it into the frame's view. +// 7) Handle UWM_PREVIEWCLOSE to swap back to the default view when the preview +// closes. + +// CPrintPreview calls the view's PrintPage function. This is the same +// function used to print a specified page. When printing, the PrintPage uses +// the specified printer DC. When previewing we supply the memory DC for the +// printer to the PrintPage function instead. + +// After CPrintPreview calls PrintPage, it extracts the bitmap and displays +// it in CPrintPreview's preview pane. + + +namespace Win32xx +{ +/* + 103 DIALOGEX 0, 0, 309, 178 + STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_BORDER + FONT 8, "MS Shell Dlg", 400, 0, 0x1 + BEGIN + PUSHBUTTON "",96,246,2,50,14 + PUSHBUTTON "",92,4,2,50,14 + PUSHBUTTON "",93,55,2,50,14 + PUSHBUTTON "",94,125,2,50,14 + PUSHBUTTON "",95,176,2,50,14 + CONTROL "",97,"PreviewPane",WS_TABSTOP,0,18,309,160 + END +*/ + + // template of the PrintPreview dialog (used in place of a resource script). + static unsigned char previewTemplate[] = + { + 0x01, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x48, 0x00, 0x80, 0x40, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x35, 0x01, + 0xb2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x90, 0x01, + 0x00, 0x01, 0x4d, 0x00, 0x53, 0x00, 0x20, 0x00, 0x53, 0x00, 0x68, 0x00, + 0x65, 0x00, 0x6c, 0x00, 0x6c, 0x00, 0x20, 0x00, 0x44, 0x00, 0x6c, 0x00, + 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x50, 0xf6, 0x00, 0x02, 0x00, 0x32, 0x00, 0x0e, 0x00, + 0x60, 0x00, 0x00, 0x00, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x50, + 0x04, 0x00, 0x02, 0x00, 0x32, 0x00, 0x0e, 0x00, 0x5c, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x50, 0x37, 0x00, 0x02, 0x00, + 0x32, 0x00, 0x0e, 0x00, 0x5d, 0x00, 0x00, 0x00, 0xff, 0xff, 0x80, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x50, 0x7d, 0x00, 0x02, 0x00, 0x32, 0x00, 0x0e, 0x00, + 0x5e, 0x00, 0x00, 0x00, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x50, + 0xb0, 0x00, 0x02, 0x00, 0x32, 0x00, 0x0e, 0x00, 0x5f, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x50, 0x00, 0x00, 0x12, 0x00, + 0x35, 0x01, 0xa0, 0x00, 0x61, 0x00, 0x00, 0x00, 0x50, 0x00, 0x72, 0x00, + 0x65, 0x00, 0x76, 0x00, 0x69, 0x00, 0x65, 0x00, 0x77, 0x00, 0x50, 0x00, + 0x61, 0x00, 0x6e, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + + + ////////////////////////////////////////////// + // CPreviewPane provides the preview pane used + // by CPrintPreview. + class CPreviewPane : public CWnd + { + public: + CPreviewPane(); + virtual ~CPreviewPane() override = default; + + void Render(CDC& dc); + void SetBitmap(const CBitmap& bitmap) { m_bitmap = bitmap; } + + protected: + virtual void OnDraw(CDC& dc) override; + virtual BOOL OnEraseBkgnd(CDC&) override; + virtual LRESULT OnPaint(UINT msg, WPARAM wparam, LPARAM lparam) override; + + private: + CPreviewPane(const CPreviewPane&) = delete; + CPreviewPane& operator=(const CPreviewPane&) = delete; + CBitmap m_bitmap; + }; + + + //////////////////////////////////////////////////////////// + // CPrintPreview adds print preview support to applications. + // It is used to view print output before it is sent to the + // printer. + template + class CPrintPreview : public CDialog + { + public: + CPrintPreview(); + CPrintPreview(T& source); + virtual ~CPrintPreview() override = default; + + CPreviewPane& GetPreviewPane() const { return *m_pPreviewPane; } + void SetPreviewPane(CPreviewPane& previewPane) { m_pPreviewPane = &previewPane; } + void SetSource(T& source) { m_pSource = &source; } + + virtual void DoPrintPreview(HWND ownerWindow, int maxPage = 1); + virtual BOOL OnCloseButton(); + virtual BOOL OnNextButton(); + virtual BOOL OnPrevButton(); + virtual BOOL OnPrintButton(); + virtual BOOL OnPrintSetup(); + virtual void PreviewPage(int page); + virtual void UpdateButtons(); + + protected: + virtual void OnCancel() override { OnCloseButton(); } + virtual BOOL OnInitDialog() override; + virtual void OnOK() override { OnCloseButton(); } + virtual INT_PTR DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual BOOL OnCommand(WPARAM wparam, LPARAM lparam) override; + + private: + CPrintPreview(const CPrintPreview&) = delete; + CPrintPreview& operator=(const CPrintPreview&) = delete; + CPreviewPane m_previewPane; // Default CPreviewPane object + CPreviewPane* m_pPreviewPane; // Pointer to the CPreviewPane object we actually use + CResizer m_resizer; + T* m_pSource; + CButton m_buttonPrint; + CButton m_buttonSetup; + CButton m_buttonNext; + CButton m_buttonPrev; + CButton m_buttonClose; + int m_currentPage; + int m_maxPage; + HWND m_ownerWindow; + }; + +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + ////////////////////////////////////////////////////////// + // Definitions for the CPreviewPane class. + // CPreviewPane provides a preview pane for CPrintPreview. + // + + // Constructor. + inline CPreviewPane::CPreviewPane() + { + // The class name of this custom dialog control. + // This matches the control's class name used in the dialog template. + CString className = _T("PreviewPane"); + + // Register the window class for use as a custom control in the dialog. + WNDCLASS wc = {}; + + if (!::GetClassInfo(GetApp()->GetInstanceHandle(), className, &wc)) + { + wc.lpszClassName = className; + wc.lpfnWndProc = ::DefWindowProc; + wc.hInstance = GetApp()->GetInstanceHandle(); + wc.hbrBackground = static_cast(GetStockObject(GRAY_BRUSH)); + wc.hCursor = ::LoadCursor(nullptr, IDC_ARROW); + VERIFY(::RegisterClass(&wc)); + } + + assert(::GetClassInfo(GetApp()->GetInstanceHandle(), className, &wc)); + } + + // Handle the WM_ERASEBKGND message. + inline BOOL CPreviewPane::OnEraseBkgnd(CDC&) + { + // Suppress background drawing to avoid flicker on Windows XP and earlier. + return TRUE; + } + + // Called to perform the drawing on this window. + inline void CPreviewPane::OnDraw(CDC& dc) + { + Render(dc); + } + + // Handle the WM_PAINT message and call OnDraw. + // Normally OnDraw is suppressed for controls, but we need OnDraw for this window. + inline LRESULT CPreviewPane::OnPaint(UINT, WPARAM, LPARAM) + { + if (::GetUpdateRect(*this, nullptr, FALSE)) + { + CPaintDC dc(*this); + OnDraw(dc); + } + else + // RedrawWindow can require repainting without an update rect. + { + CClientDC dc(*this); + OnDraw(dc); + } + + // No more drawing required + return 0; + } + + // Copies the bitmap (m_Bitmap) to the PreviewPane as a Device + // Independent Bitmap (DIB), scaling the image to fit the window. + inline void CPreviewPane::Render(CDC& dc) + { + if (m_bitmap.GetHandle()) + { + BITMAP bm = m_bitmap.GetBitmapData(); + int border = 10; + CRect rcClient = GetClientRect(); + + double ratio = static_cast(bm.bmHeight) / static_cast(bm.bmWidth); + int previewWidth; + int previewHeight; + + // These borders center the preview with the PreviewPane. + int xBorder = border; + int yBorder = border; + double cxClient = rcClient.Width(); + double cyClient = rcClient.Height(); + + if ((cxClient - 2.0 * border)*ratio < (cyClient - 2.0 * border)) + { + previewWidth = rcClient.Width() - (2 * border); + previewHeight = static_cast(previewWidth * ratio); + yBorder = (rcClient.Height() - previewHeight) / 2; + } + else + { + previewHeight = rcClient.Height() - (2 * border); + previewWidth = static_cast(previewHeight / ratio); + xBorder = (rcClient.Width() - previewWidth) / 2; + } + + // Create the LPBITMAPINFO from the bitmap. + CBitmapInfoPtr pbmi(m_bitmap); + BITMAPINFOHEADER* pBIH = reinterpret_cast(pbmi.get()); + + // Extract the device independent image data. + CMemDC memDC(dc); + UINT scanLines = static_cast(bm.bmHeight); + memDC.GetDIBits(m_bitmap, 0, scanLines, nullptr, pbmi, DIB_RGB_COLORS); + std::vector byteArray(pBIH->biSizeImage, 0); + byte* pByteArray = byteArray.data(); + memDC.GetDIBits(m_bitmap, 0, scanLines, pByteArray, pbmi, DIB_RGB_COLORS); + + // Use half tone stretch mode for smoother rendering. + dc.SetStretchBltMode(HALFTONE); + dc.SetBrushOrgEx(0, 0); + + // Copy the DIB bitmap data to the PreviewPane's DC with stretching. + dc.StretchDIBits(xBorder, yBorder, previewWidth, previewHeight, 0, 0, + bm.bmWidth, bm.bmHeight, pByteArray, pbmi, DIB_RGB_COLORS, SRCCOPY); + + // Draw a gray border around the preview. + CRect rcFill(0, 0, xBorder, previewHeight + yBorder); + dc.FillRect(rcFill, static_cast(::GetStockObject(GRAY_BRUSH))); + + rcFill.SetRect(0, 0, previewWidth + xBorder, yBorder); + dc.FillRect(rcFill, static_cast(::GetStockObject(GRAY_BRUSH))); + + rcFill.SetRect(previewWidth + xBorder, 0, rcClient.Width(), rcClient.Height()); + dc.FillRect(rcFill, static_cast(::GetStockObject(GRAY_BRUSH))); + + rcFill.SetRect(0, previewHeight + yBorder, rcClient.Width(), rcClient.Height()); + dc.FillRect(rcFill, static_cast(::GetStockObject(GRAY_BRUSH))); + } + } + + /////////////////////////////////////////// + // Definitions for the CPrintPreview class. + // + + // Constructor. + template + inline CPrintPreview::CPrintPreview() : + CDialog(reinterpret_cast(previewTemplate)), + m_pSource(0), m_currentPage(0), m_maxPage(1), m_ownerWindow(0) + { + m_pPreviewPane = &m_previewPane; + } + + template + inline CPrintPreview::CPrintPreview(T& source) + : CDialog(reinterpret_cast(previewTemplate)), + m_pSource(0), m_currentPage(0), m_maxPage(1), m_ownerWindow(0) + { + m_pPreviewPane = &m_previewPane; + SetSource(source); + } + + // The dialog's window procedure. It handles the dialog's window messages. + template + inline INT_PTR CPrintPreview::DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) + { + // Pass resizing messages on to the resizer + m_resizer.HandleMessage(msg, wparam, lparam); + + // switch (msg) + // { + // Additional messages to be handled go here + // } + + // Pass unhandled messages on to parent DialogProc + return DialogProcDefault(msg, wparam, lparam); + } + + // Called when the close button is pressed. + template + inline BOOL CPrintPreview::OnCloseButton() + { + ::SendMessage(m_ownerWindow, UWM_PREVIEWCLOSE, 0, 0); + return TRUE; + } + + // Processes the dialog's buttons. + template + inline BOOL CPrintPreview::OnCommand(WPARAM wparam, LPARAM) + { + UINT id = LOWORD(wparam); + switch (id) + { + case IDW_PREVIEWPRINT: return OnPrintButton(); + case IDW_PREVIEWSETUP: return OnPrintSetup(); + case IDW_PREVIEWPREV: return OnPrevButton(); + case IDW_PREVIEWNEXT: return OnNextButton(); + case IDW_PREVIEWCLOSE: return OnCloseButton(); + } + + return FALSE; + } + + // Called when the dialog is initialized. + template + inline BOOL CPrintPreview::OnInitDialog() + { + // Attach the dialog controls to CWnd objects + AttachItem(IDW_PREVIEWPRINT, m_buttonPrint); + AttachItem(IDW_PREVIEWSETUP, m_buttonSetup); + AttachItem(IDW_PREVIEWPREV, m_buttonPrev); + AttachItem(IDW_PREVIEWNEXT, m_buttonNext); + AttachItem(IDW_PREVIEWCLOSE, m_buttonClose); + AttachItem(IDW_PREVIEWPANE, GetPreviewPane()); + + // Assign button text from string resources. + m_buttonPrint.SetWindowText(LoadString(IDW_PREVIEWPRINT)); + m_buttonSetup.SetWindowText(LoadString(IDW_PREVIEWSETUP)); + m_buttonPrev.SetWindowText(LoadString(IDW_PREVIEWPREV)); + m_buttonNext.SetWindowText(LoadString(IDW_PREVIEWNEXT)); + m_buttonClose.SetWindowText(LoadString(IDW_PREVIEWCLOSE)); + + // Support dialog resizing. + m_resizer.Initialize(*this, CRect(0, 0, 100, 120)); + m_resizer.AddChild(m_buttonPrint, CResizer::topleft, 0); + m_resizer.AddChild(m_buttonSetup, CResizer::topleft, 0); + m_resizer.AddChild(m_buttonPrev, CResizer::topleft, 0); + m_resizer.AddChild(m_buttonNext, CResizer::topleft, 0); + m_resizer.AddChild(m_buttonClose, CResizer::topleft, 0); + m_resizer.AddChild(GetPreviewPane(), CResizer::topleft, RD_STRETCH_WIDTH | RD_STRETCH_HEIGHT); + + return TRUE; + } + + // Called when the Next Page button is pressed. + template + inline BOOL CPrintPreview::OnNextButton() + { + PreviewPage(++m_currentPage); + UpdateButtons(); + + return TRUE; + } + + // Called when the Prev Page button is pressed. + template + inline BOOL CPrintPreview::OnPrevButton() + { + PreviewPage(--m_currentPage); + UpdateButtons(); + + return TRUE; + } + + // Called when the Print button is pressed. + // Sends the UWM_PREVIEWPRINT message to the owner window. + template + inline BOOL CPrintPreview::OnPrintButton() + { + ::SendMessage(m_ownerWindow, UWM_PREVIEWPRINT, 0, 0); + return TRUE; + } + + // Called in response to the Print Setup button. + // Sends a UWM_PREVIEWSETUP message to the owner. + template + inline BOOL CPrintPreview::OnPrintSetup() + { + ::SendMessage(m_ownerWindow, UWM_PREVIEWSETUP, 0, 0); + return TRUE; + } + + // Initiate the print preview. + // ownerWindow: Print Preview's notifications are sent to this window. + template + inline void CPrintPreview::DoPrintPreview(HWND ownerWindow, int maxPage) + { + m_ownerWindow = ownerWindow; + assert(maxPage >= 1); + m_maxPage = maxPage; + + // Preview the first page; + m_currentPage = 0; + PreviewPage(0); + } + + // Preview's the specified page. + // This function calls the view's PrintPage function to render the same + // information that would be printed on a page. + // A CResourceException is thrown if there is no default printer. + template + inline void CPrintPreview::PreviewPage(int page) + { + // Get the device context of the default or currently chosen printer. + CPrintDialog printDlg; + CDC printerDC = printDlg.GetPrinterDC(); + + // Create a memory DC for the printer. + // Note: we use the printer's DC here to render text accurately. + CMemDC memDC(printerDC); + + // Create a compatible bitmap for the memory DC + int width = printerDC.GetDeviceCaps(HORZRES); + int height = printerDC.GetDeviceCaps(VERTRES); + + // A bitmap to hold all the pixels of the printed page would be too large. + // Shrinking its dimensions by 4 reduces it to 1/16th its original size. + int shrink = width > 8000 ? 8 : 4; + memDC.CreateCompatibleBitmap(printerDC, width / shrink, height / shrink); + + memDC.SetMapMode(MM_ANISOTROPIC); + memDC.SetWindowExtEx(width, height, nullptr); + memDC.SetViewportExtEx(width / shrink, height / shrink, nullptr); + + // Fill the bitmap with a white background. + CRect rc(0, 0, width, height); + memDC.FillRect(rc, static_cast(::GetStockObject(WHITE_BRUSH))); + + // Call PrintPage from the source. + assert(m_pSource); + m_pSource->PrintPage(memDC, page); + + // Detach the bitmap from the memory DC and save it. + CBitmap bitmap = memDC.DetachBitmap(); + GetPreviewPane().SetBitmap(bitmap); + + // Display the print preview. + UpdateButtons(); + CDC previewDC = GetPreviewPane().GetDC(); + GetPreviewPane().Render(previewDC); + } + + // Enables or disables the page selection buttons. + template + inline void CPrintPreview::UpdateButtons() + { + m_buttonNext.EnableWindow(m_currentPage < m_maxPage - 1); + m_buttonPrev.EnableWindow(m_currentPage > 0); + } + +} + + +#endif // _WIN32XX_PREVIEW_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_printdialogex.h b/packages/media/cpp/packages/Win32xx/include/wxx_printdialogex.h new file mode 100644 index 00000000..1644cb0c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_printdialogex.h @@ -0,0 +1,556 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + + +//////////////////////////////////////////////////////////////////// +// wxx_printdialogex.h +// Declaration of the CPrintDialogEx class. + +// CPrintDialogEx displays the Print dialog, which allows the user to +// select the printer to use. + +// The CPrintDialogEx class stores its global memory in CWinApp. +// This global memory persists after the CPrintDialogEx is destroyed. +// There is no need for the user to manually free the hDevMode and +// hDevNames memory. + +// CPrintDialogEx uses IPrintDialogCallback to forward the print +// dialog's messages for the child dialog box in the lower portion of +// the General page to DialogProc. + +// CPrintDialogEx supports the use of IPrintDialogServices to retrieve +// the currently printer's DevMode, printer name and port name while +// print dialog is displayed. + +// NOTE: CPrintDialogEx throws a CWinException if it is unable +// to display the dialog. + +// NOTE: CPrintDialogEx will throw an exception if there is no default +// printer. You should always wrap DoModal in a in a try/catch block to +// take reasonable (or no) action if there isn't a default printer. +// +// A system always has a default printer if it has a printer. +// +// NOTE: Use the following to retrieve the printer's device context +// for the default or currently selected printer: +// CPrintDialogEx printDialog; +// CDC printerDC = printDialog.GetPrinterDC(); +// + +#ifndef _WIN32XX_PRINTDIALOGEX_H_ +#define _WIN32XX_PRINTDIALOGEX_H_ + +#include "wxx_wincore.h" +#include "wxx_commondlg.h" +#include "wxx_printdialogs.h" + +// Must be Unicode for GNU compilers. +#if !defined __GNUC__ || (defined __GNUC__ && defined UNICODE) + +namespace Win32xx +{ + + /////////////////////////////////////////////////////////////////// + // This class encapsulates the Windows API PrintDlgEx function. + // The PrintDlgEx function displays a property sheet. The property + // sheet allows the user to specify the printer, and the properties + // of the print job. + // NOTE: DoModal throws an exception if there is no default printer + class CPrintDialogEx : public CDialog, + public IPrintDialogCallback, + public IObjectWithSite + { + public: + // Constructor + CPrintDialogEx(DWORD flags = PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS + | PD_NOSELECTION | PD_NOCURRENTPAGE); + + // Destructor + virtual ~CPrintDialogEx() override = default; + + virtual void OnApply() {} // Apply then cancel button pressed. + virtual void OnCancel() override {} // Cancel button pressed or closed. + virtual void OnPrint(){} // Print button pressed. + + // Operations + INT_PTR DoModal(HWND owner /* = nullptr */) override; + int GetCopies() const; + CDevMode GetCurrentDevMode(); + CStringW GetCurrentPortName() const; + CStringW GetCurrentPrinterName() const; + BOOL GetDefaults(); + CString GetDeviceName() const; + CDevMode GetDevMode() const; + CDevNames GetDevNames() const; + CString GetDriverName() const; + const PRINTDLGEX& GetParameters() const { return m_pdex; } + CString GetPortName() const; + CDC GetPrinterDC() const; + BOOL PrintAll() const; + BOOL PrintCollate() const; + BOOL PrintRange() const; + BOOL PrintSelection() const; + BOOL PrintToFile() const; + void SetDefaults(HGLOBAL hDevMode, HGLOBAL hDevNames); + void SetParameters(const PRINTDLGEX& pdx); + + protected: + virtual INT_PTR DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + + // IUnknown + STDMETHOD(QueryInterface)(REFIID riid, void** ppvObject); + STDMETHOD_(ULONG, AddRef)() { return 1; } + STDMETHOD_(ULONG, Release)() { return 1; } + + // IPrintDialogCallback + STDMETHOD(InitDone)() { return S_FALSE; } + STDMETHOD(SelectionChange)() { return S_FALSE; } + STDMETHOD(HandleMessage)(HWND wnd, UINT msg, WPARAM wparam, + LPARAM lparam, LRESULT* pResult); + + // IObjectWithSite + STDMETHOD(GetSite)(REFIID riid, void** ppvSite); + STDMETHOD(SetSite)(IUnknown* pUnknown); + + private: + CPrintDialogEx(const CPrintDialogEx&) = delete; + CPrintDialogEx& operator=(const CPrintDialogEx&) = delete; + PRINTDLGEX m_pdex; + IPrintDialogServices* m_pServices; + CHGlobal m_currentModeBuffer; + }; +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + ////////////////////////////////////////////// + // CPrintDialogEx member function definitions. + // + + // Constructor for CPrintDialogEx class. The flags parameter specifies the + // flags for the PRINTDLGEX structure. Refer to the description of the + // PRINTDLGEX struct in the Windows API documentation. + inline CPrintDialogEx::CPrintDialogEx(DWORD flags) : m_pServices(nullptr) + { + m_pdex = {}; + m_pdex.lStructSize = sizeof(m_pdex); + m_pdex.Flags = flags; + m_pdex.nStartPage = START_PAGE_GENERAL; + m_pdex.Flags &= ~PD_RETURNIC; // information context not used. + m_pdex.Flags &= ~PD_RETURNDC; // not used, use GetPrinterDC to retrieve the dc. + } + + // The dialog's message procedure. Override this function in your derived class + // if you wish to handle messages. + inline INT_PTR CPrintDialogEx::DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) + { + // A typical function might look like this: + + // switch (msg) + // { + // case MESSAGE1: // Some Windows API message + // OnMessage1(); // A user defined function + // break; // Also do default processing + // case MESSAGE2: + // OnMessage2(); + // return x; // Don't do default processing, but instead return + // // a value recommended by the Windows API documentation + // } + + // Always pass unhandled messages on to DialogProcDefault. + return DialogProcDefault(msg, wparam, lparam); + } + + // Display the print dialog, and allow the user to select various options. + // Use SetParameters to specify the pages before calling DoModal. + // An exception is thrown if the dialog isn't created. + // An exception is thrown if there is no default printer. + // Returns PD_RESULT_PRINT, PD_RESULT_APPLY, or PD_RESULT_CANCEL. + inline INT_PTR CPrintDialogEx::DoModal(HWND owner /* = nullptr */) + { + assert(!IsWindow()); // Only one window per CWnd instance allowed. + + // Update the default printer. + GetApp()->UpdateDefaultPrinter(); + + // Assign values to the PRINTDLGEX structure. + m_pdex.hDevMode = GetApp()->GetHDevMode(); + m_pdex.hDevNames = GetApp()->GetHDevNames(); + if (::IsWindow(owner)) + m_pdex.hwndOwner = owner; + else + m_pdex.hwndOwner = GetActiveWindow(); + + m_pdex.lpCallback = (IPrintDialogCallback*)this; + m_pdex.dwResultAction = 0; + + // Create the dialog. + if (S_OK != PrintDlgEx(&m_pdex)) + { + int error = static_cast(CommDlgExtendedError()); + throw CWinException(GetApp()->MsgWndDialog(), error); + } + + switch (m_pdex.dwResultAction) + { + case PD_RESULT_APPLY: + { + // The user clicked the Apply button and later clicked the Cancel + // button. This indicates that the user wants to apply the changes + // made in the property sheet, but does not yet want to print. + GetApp()->UpdatePrinterMemory(m_pdex.hDevMode, m_pdex.hDevNames); + OnApply(); + break; + } + case PD_RESULT_CANCEL: + { + // The user clicked the cancel or close button. + OnCancel(); + break; + } + case PD_RESULT_PRINT: + { + // The user clicked the print button. + GetApp()->UpdatePrinterMemory(m_pdex.hDevMode, m_pdex.hDevNames); + OnPrint(); + break; + } + } + + m_pdex.hDevMode = 0; + m_pdex.hDevNames = 0; + + // Prepare this CWnd for reuse. + Cleanup(); + + return m_pdex.dwResultAction; + } + + // Retrieves the number of copies requested. + inline int CPrintDialogEx::GetCopies() const + { + if ((m_pdex.Flags & PD_USEDEVMODECOPIES) != 0) + return GetDevMode()->dmCopies; + + return static_cast(m_pdex.nCopies); + } + + // Fill a DEVMODE structure with information about the currently + // selected printer, while the print dialog is displayed. + inline CDevMode CPrintDialogEx::GetCurrentDevMode() + { + if (m_pServices != 0) + { + // Retrieve the size of the current DevMode. + UINT size = 0; + DEVMODE tempMode = {}; + m_pServices->GetCurrentDevMode(&tempMode, &size); + + // Retrieve the current DevMode. + m_currentModeBuffer.Alloc(size); + CDevMode devMode(m_currentModeBuffer); + m_pServices->GetCurrentDevMode(devMode, &size); + return devMode; + } + + return CDevMode(nullptr); + } + + // Returns the port name for the currently selected printer, while + // the print dialog is displayed. + inline CStringW CPrintDialogEx::GetCurrentPortName() const + { + CStringW str; + if (m_pServices != nullptr) + { + UINT size = 0; + m_pServices->GetCurrentPortName(nullptr, &size); + int bufferSize = static_cast(size); + m_pServices->GetCurrentPortName(str.GetBuffer(bufferSize), &size); + str.ReleaseBuffer(); + } + + return str; + } + + // Returns the printer name for the currently selected printer, while + // the print dialog is displayed. + inline CStringW CPrintDialogEx::GetCurrentPrinterName() const + { + CStringW str; + if (m_pServices != nullptr) + { + UINT size = 0; + m_pServices->GetCurrentPrinterName(nullptr, &size); + int bufferSize = static_cast(size); + m_pServices->GetCurrentPrinterName(str.GetBuffer(bufferSize), &size); + str.ReleaseBuffer(); + } + + return str; + } + + // Sets the printer and the page settings to default, without displaying a dialog. + // The hDevMode and hDevNames memory is freed and reallocated. + // Returns TRUE if a default printer exists. + inline BOOL CPrintDialogEx::GetDefaults() + { + GetApp()->ResetPrinterMemory(); + GetApp()->UpdateDefaultPrinter(); + + return (GetApp()->GetHDevNames().Get()) ? TRUE : FALSE; + } + + // Retrieves the name of the default or currently selected printer device. + inline CString CPrintDialogEx::GetDeviceName() const + { + if (GetApp()->GetHDevNames().Get() == nullptr) + GetApp()->UpdateDefaultPrinter(); + + CString str; + if (GetApp()->GetHDevNames().Get() != nullptr) + str = GetDevNames().GetDeviceName(); + + return str; + } + + // Returns a pointer to the locked hDevMode memory encapsulated in a CDevMode object. + // There is no need to unlock this memory. The CDevMode object automatically + // unlocks the memory when it goes out of scope. + // Usage: + // CDevMode pDevMode = GetDevMode(); + // Then use pDevMode as if it were a LPDEVMODE. + inline CDevMode CPrintDialogEx::GetDevMode() const + { + if (GetApp()->GetHDevMode().Get() == nullptr) + GetApp()->UpdateDefaultPrinter(); + + if (GetApp()->GetHDevMode().Get() == nullptr) + throw CResourceException(GetApp()->MsgPrintFound()); + + return CDevMode(GetApp()->GetHDevMode()); + } + + // Returns a pointer to the locked hDevNames memory encapsulated in a CDevNames object. + // There is no need to unlock this memory. The CDevNames object automatically + // unlocks the memory when it goes out of scope. + // Usage: + // CDevNames pDevNames = GetDevNames(); + // Then use pDevNames as if it were a LPDEVNAMES. + inline CDevNames CPrintDialogEx::GetDevNames() const + { + if (GetApp()->GetHDevNames().Get() == nullptr) + GetApp()->UpdateDefaultPrinter(); + + if (GetApp()->GetHDevNames().Get() == nullptr) + throw CResourceException(GetApp()->MsgPrintFound()); + + return CDevNames(GetApp()->GetHDevNames()); + } + + // Retrieves the name of the default or currently selected printer driver. + inline CString CPrintDialogEx::GetDriverName() const + { + if (GetApp()->GetHDevNames().Get() == nullptr) + GetApp()->UpdateDefaultPrinter(); + + CString str; + if (GetApp()->GetHDevNames().Get() != nullptr) + str = GetDevNames().GetDriverName(); + + return str; + } + + // Retrieves the name of the default or currently selected printer port. + inline CString CPrintDialogEx::GetPortName() const + { + if (GetApp()->GetHDevNames().Get() == nullptr) + GetApp()->UpdateDefaultPrinter(); + + CString str; + if (GetApp()->GetHDevNames().Get() != nullptr) + str = GetDevNames().GetPortName(); + + return str; + } + + // Returns the device context of the default or currently chosen printer. + // Throws on failure. + inline CDC CPrintDialogEx::GetPrinterDC() const + { + CDC dc; + if (GetApp()->GetHDevNames().Get() == nullptr) + GetApp()->UpdateDefaultPrinter(); + + if ((GetApp()->GetHDevNames().Get() != nullptr) && (GetApp()->GetHDevMode().Get() != 0)) + { + dc.CreateDC(GetDriverName(), GetDeviceName(), + GetPortName(), GetDevMode()); + } + + if (dc.GetHDC() == nullptr) + throw CResourceException(GetApp()->MsgPrintFound()); + + return dc; + } + + inline DECLSPEC_NOTHROW HRESULT CPrintDialogEx::GetSite(REFIID riid, void** ppvSite) + { + if (riid == IID_IPrintDialogServices) + { + *ppvSite = m_pServices; + return S_OK; + } + + return QueryInterface(riid, ppvSite); + } + + // Passes messages on to the DialogProc for processing. + inline DECLSPEC_NOTHROW HRESULT CPrintDialogEx::HandleMessage(HWND wnd, UINT msg, WPARAM wparam, + LPARAM lparam, LRESULT* pResult) + { + if (GetHwnd() == nullptr) + Attach(wnd); + + *pResult = DialogProc(msg, wparam, lparam); + return S_FALSE; // Perform its default message handling. + } + + // Returns TRUE if collate checked. + inline BOOL CPrintDialogEx::PrintCollate() const + { + return (m_pdex.Flags & PD_COLLATE) ? TRUE : FALSE; + } + + // Returns TRUE if printing selection. + inline BOOL CPrintDialogEx::PrintSelection() const + { + return (m_pdex.Flags & PD_SELECTION) ? TRUE : FALSE; + } + + // Returns TRUE if printing all pages. + inline BOOL CPrintDialogEx::PrintAll() const + { + return (!PrintRange() && !PrintSelection()) ? TRUE : FALSE; + } + + // Returns TRUE if printing page range. + inline BOOL CPrintDialogEx::PrintRange() const + { + return (m_pdex.Flags & PD_PAGENUMS) ? TRUE : FALSE; + } + + // Returns TRUE if printing to a file. + inline BOOL CPrintDialogEx::PrintToFile() const + { + return (m_pdex.Flags & PD_PRINTTOFILE) ? TRUE : FALSE; + } + + // Returns a pointer to the requested object. + inline DECLSPEC_NOTHROW HRESULT CPrintDialogEx::QueryInterface(REFIID riid, void** ppvObject) + { + if (ppvObject == nullptr) + return E_POINTER; + + if (IsEqualGUID(riid, IID_IUnknown)) + { + *ppvObject = (IPrintDialogCallback*)this; + return S_OK; + } + else if (IsEqualGUID(riid, IID_IPrintDialogCallback)) + { + *ppvObject = (IPrintDialogCallback*)this; + return S_OK; + } + else if (IsEqualGUID(riid, IID_IObjectWithSite)) + { + *ppvObject = (IObjectWithSite*)this; + return S_OK; + } + + return E_NOINTERFACE; + } + + // Assigns the application's default printer settings to the values + // specified by hDevMode and hDevNames. + inline void CPrintDialogEx::SetDefaults(HGLOBAL hDevMode, HGLOBAL hDevNames) + { + GetApp()->UpdatePrinterMemory(hDevMode, hDevNames); + } + + // Set the parameters of the PRINTDLGEX structure to sensible values. + inline void CPrintDialogEx::SetParameters(const PRINTDLGEX& pdex) + { + m_pdex.lStructSize = sizeof(m_pdex); // size of structure in bytes + m_pdex.Flags = pdex.Flags; // flags + m_pdex.Flags2 = pdex.Flags2; // reserved + m_pdex.ExclusionFlags = pdex.ExclusionFlags; // items to exclude from driver pages + m_pdex.nPageRanges = pdex.nPageRanges; // number of page ranges + m_pdex.nMaxPageRanges = pdex.nMaxPageRanges; // max number of page ranges + m_pdex.lpPageRanges = pdex.lpPageRanges; // array of page ranges + m_pdex.nMinPage = pdex.nMinPage; // min page number + m_pdex.nMaxPage = pdex.nMaxPage; // max page number + m_pdex.nCopies = pdex.nCopies; // number of copies + m_pdex.hInstance = pdex.hInstance; // instance handle + m_pdex.lpPrintTemplateName = pdex.lpPrintTemplateName; // template name for app specific area + m_pdex.nPropertyPages = pdex.nPropertyPages; // number of app property pages in lphPropertyPages + m_pdex.lphPropertyPages = pdex.lphPropertyPages; // array of app property page handles + m_pdex.nStartPage = pdex.nStartPage; // start page id + m_pdex.dwResultAction = pdex.dwResultAction; // result action if S_OK is returned + m_pdex.Flags &= ~PD_RETURNIC; // information context not used. + m_pdex.Flags &= ~PD_RETURNDC; // not used, use GetPrinterDC to retrieve the dc. + + // These are set in DoModal + // m_pdex.hwndOwner - caller's window handle + // m_pdex.lpCallback - app callback interface + } + + inline DECLSPEC_NOTHROW HRESULT CPrintDialogEx::SetSite(IUnknown* pUnknown) + { + m_pServices = (IPrintDialogServices*)pUnknown; + return S_OK; + } +} + +#endif // define (__GNUC__) || (defined (__GNUC__) && defined (UNICODE)) + +#endif // define _WIN32XX_PRINTDIALOGEX_H_ + diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_printdialogs.h b/packages/media/cpp/packages/Win32xx/include/wxx_printdialogs.h new file mode 100644 index 00000000..8d463f9d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_printdialogs.h @@ -0,0 +1,765 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////// +// Acknowledgement: +// +// Developed from code originally provided by: +// +// Robert C. Tausworthe +// email: robert.c.tausworthe@ieee.org +// +//////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////// +// wxx_printdialogs.h +// Declaration of the CPrintDialog and CPageSetupDialog class, along +// with the CGlobalLock class template. + +// CPrintDialog displays the Print dialog, which allows the user to +// select the printer to use. + +// CPageSetupDialog displays the PageSetup dialog, which allows the user +// to select the page settings. + +// The CPrintDialog and CPageSetupDialog classes share global memory +// for their hDevMode and hDevNames handles. This global memory +// persists after the CPrintDialog and CPageSetupDialog objects are +// destructed, and is managed by CWinApp. There is no need for the +// user to manually free the hDevMode and hDevNames memory. + +// CDevMode and CDevNames are typedefs for the CGlobalLock class. They +// provide self unlocking pointers to the hDevMode and hDevNames memory. +// They are used as follows: +// CPrintDialog printDialog; +// CDevNames pDevNames = printDialog.GetDevNames(); +// CDevMode pDevMode = printDialog.GetDevMode(); +// +// NOTE: CPrintDialog and CPageSetupDialog throw a CWinException +// if they are unable to display the dialog. + +// NOTE: CPrintDialog and CPageSetupDialog will throw an exception if +// there is no default printer. You should always wrap DoModal in a in +// a try/catch block to take reasonable (or no) action if there isn't +// a default printer. +// +// A system always has a default printer if it has a printer. +// +// NOTE: Use the following to retrieve the printer's device context +// for the default or currently selected printer: +// CPrintDialog printDialog; +// CDC printerDC = printDialog.GetDefaults(); +// + +#ifndef _WIN32XX_PRINTDIALOGS_H_ +#define _WIN32XX_PRINTDIALOGS_H_ + +#include "wxx_wincore.h" +#include "wxx_commondlg.h" + +namespace Win32xx +{ + + ///////////////////////////////////////////////////////////////////////// + // This class encapsulates the Windows API PrintDlg function. + // The PrintDlg function displays a print dialog. The print dialog + // enables the user to specify the properties of a particular print job. + // NOTE: DoModal throws an exception if there is no default printer. + // NOTE: Setting the PD_ENABLEPRINTHOOK displays the classic print dialog. + class CPrintDialog : public CCommonDialog + { + public: + CPrintDialog(DWORD flags = + PD_ALLPAGES | // The All radio button is initially selected. + PD_USEDEVMODECOPIES | // Supports multiple copies and collation. + PD_NOPAGENUMS | // Disables the Pages radio button and the associated edit controls. + PD_HIDEPRINTTOFILE | // Hides the Print to File check box. + PD_NOSELECTION | // Disables the Selection radio button. + PD_ENABLEPRINTHOOK); // Enables the hook procedure specified in the lpfnPrintHook member. + virtual ~CPrintDialog() override = default; + + virtual INT_PTR DoModal(HWND owner = nullptr) override; + int GetCopies() const; + BOOL GetDefaults(); + CDevMode GetDevMode() const; + CDevNames GetDevNames() const; + CString GetDeviceName() const; + CString GetDriverName() const; + int GetFromPage() const; + const PRINTDLG& GetParameters() const { return m_pd; } + CString GetPortName() const; + CDC GetPrinterDC() const; + int GetToPage() const; + BOOL PrintAll() const; + BOOL PrintCollate() const; + BOOL PrintRange() const; + BOOL PrintSelection() const; + void SetDefaults(HGLOBAL hDevMode, HGLOBAL hDevNames); + void SetParameters(const PRINTDLG& pd); + + protected: + // Override these functions as required. + virtual INT_PTR DialogProc(UINT, WPARAM, LPARAM) override; + + // Not intended to be overridden. + INT_PTR DialogProcDefault(UINT, WPARAM, LPARAM) override; + + private: + CPrintDialog(const CPrintDialog&) = delete; + CPrintDialog& operator=(const CPrintDialog&) = delete; + + PRINTDLG m_pd; // printer selection dlg structure + }; + + + /////////////////////////////////////////////////////////////////// + // This class encapsulates the Windows API PageSetupDlg function. + // The PageSetupDlg function creates a Page Setup dialog box that + // enables the user to specify the attributes of a printed page. + // These attributes include the paper size and source, the page + // orientation (portrait or landscape), and the width of the page + // margins. + // NOTE: DoModal throws an exception if there is no default printer + class CPageSetupDialog : public CCommonDialog + { + public: + CPageSetupDialog( DWORD flags = PSD_MARGINS ); + virtual ~CPageSetupDialog() override = default; + + virtual INT_PTR DoModal(HWND owner = nullptr) override; + CDevMode GetDevMode() const; + CDevNames GetDevNames() const; + void GetMargins(RECT& margin, RECT& minMargin) const; + CSize GetPaperSize() const; + const PAGESETUPDLG& GetParameters() const { return m_psd; } + void SetParameters(const PAGESETUPDLG& psd); + + protected: + // Override these functions as required. + virtual INT_PTR DialogProc(UINT, WPARAM, LPARAM) override; + virtual UINT OnDrawPage(HDC, UINT, RECT); + virtual UINT OnPreDrawPage(WORD paper, WORD flags, const PAGESETUPDLG& psd); + + // Not intended to be overridden. + INT_PTR DialogProcDefault(UINT, WPARAM, LPARAM) override; + static INT_PTR CALLBACK PaintHookProc(HWND, UINT, WPARAM, LPARAM); + + private: + CPageSetupDialog(const CPageSetupDialog&) = delete; + CPageSetupDialog& operator=(const CPageSetupDialog&) = delete; + + PAGESETUPDLG m_psd; // page setup dlg structure + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + ////////////////////////////////////////// + // Definitions for the CPrintDialog class. + // + + // Constructor for CPrintDialog class. The flags parameter specifies the + // flags for the PRINTDLG structure. Refer to the description of the + // PRINTDLG struct in the Windows API documentation. + inline CPrintDialog::CPrintDialog(DWORD flags /* = PD_ALLPAGES | + PD_USEDEVMODECOPIES | PD_NOPAGENUMS | PD_HIDEPRINTTOFILE | PD_NOSELECTION */) + { + // Initialize the PRINTDLG member + m_pd = {}; + m_pd.Flags = flags; + m_pd.Flags &= ~PD_RETURNIC; + m_pd.Flags &= ~PD_RETURNDC; // Use GetPrinterDC to retrieve the dc. + + // Enable the hook proc for the help button. + if (m_pd.Flags & PD_SHOWHELP) + m_pd.Flags |= PD_ENABLEPRINTHOOK; + + SetParameters(m_pd); + } + + // Returns the device context of the default or currently chosen printer. + // Throws on failure. + inline CDC CPrintDialog::GetPrinterDC() const + { + CDC dc; + if (GetApp()->GetHDevNames().Get() == nullptr) + GetApp()->UpdateDefaultPrinter(); + + if ((GetApp()->GetHDevNames().Get() != nullptr) && (GetApp()->GetHDevMode().Get() != nullptr)) + { + dc.CreateDC(GetDriverName(), GetDeviceName(), + GetPortName(), GetDevMode()); + } + + if (dc.GetHDC() == nullptr) + throw CResourceException(GetApp()->MsgPrintFound()); + + return dc; + } + + // Dialog procedure for the print dialog. Override this function + // to customize the message handling. + inline INT_PTR CPrintDialog::DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) + { + // A typical override might look like this: + + // switch (msg) + // { + // case MESSAGE1: // Some Windows API message + // OnMessage1(); // A user defined function + // break; // Also do default processing + + // case MESSAGE2: + // OnMessage2(); + // return x; // Don't do default processing, but + // // instead return a value recommended + // // by the Windows API documentation + // } + + // Always pass unhandled messages on to DialogProcDefault. + return DialogProcDefault(msg, wparam, lparam); + } + + // The default message handling for CPrintDialog. Don't override this + // function, override DialogProc instead. + // Note: OnCancel and OnOK are called by DoModal. + inline INT_PTR CPrintDialog::DialogProcDefault(UINT msg, WPARAM wparam, LPARAM) + { + switch (msg) + { + case WM_INITDIALOG: + { // handle the initialization message + return OnInitDialog(); + } + + case WM_COMMAND: + { + switch (LOWORD(wparam)) + { + case pshHelp: + OnHelpButton(); + return TRUE; + } + break; + } + } + + return 0; + } + + // Display the print dialog, and allow the user to select various options. + // An exception is thrown if the dialog isn't created. + // An exception is thrown if there is no default printer. + inline INT_PTR CPrintDialog::DoModal( HWND owner /* = nullptr */) + { + assert(!IsWindow()); // Only one window per CWnd instance allowed + + // Update the default printer + GetApp()->UpdateDefaultPrinter(); + + // Assign values to the PRINTDLG structure + m_pd.hDevMode = GetApp()->GetHDevMode(); + m_pd.hDevNames = GetApp()->GetHDevNames(); + m_pd.hwndOwner = owner; + + // Retrieve this thread's TLS data + TLSData* pTLSData = GetApp()->GetTlsData(); + + // Create the modal dialog + pTLSData->pWnd = this; + + // invoke the control and save the result + BOOL ok = ::PrintDlg(&m_pd); + + if (ok) + { + GetApp()->UpdatePrinterMemory(m_pd.hDevMode, m_pd.hDevNames); + OnOK(); + ok = IDOK; + } + else + { + int error = static_cast(CommDlgExtendedError()); + if ((error != 0) && (error != CDERR_DIALOGFAILURE)) + // ignore the error caused by closing the dialog + { + // Reset global memory + GetApp()->ResetPrinterMemory(); + throw CWinException(GetApp()->MsgWndDialog(), error); + } + + OnCancel(); + ok = IDCANCEL; + } + + m_pd.hDevMode = nullptr; + m_pd.hDevNames = nullptr; + + // Prepare the CWnd for reuse. + Cleanup(); + + return ok; + } + + // Retrieves the number of copies requested. + inline int CPrintDialog::GetCopies() const + { + if (m_pd.Flags & PD_USEDEVMODECOPIES) + return GetDevMode()->dmCopies; + else + return m_pd.nCopies; + } + + // Sets the printer and the page settings to default, without displaying a + // dialog. The hDevMode and hDevNames memory is freed and reallocated. + // Returns TRUE if a default printer exists. + inline BOOL CPrintDialog::GetDefaults() + { + GetApp()->ResetPrinterMemory(); + GetApp()->UpdateDefaultPrinter(); + + // Return TRUE if default printer exists + return (GetApp()->GetHDevNames().Get()) ? TRUE : FALSE; + } + + // Retrieves the name of the default or currently selected printer device. + inline CString CPrintDialog::GetDeviceName() const + { + + if (GetApp()->GetHDevNames().Get() == nullptr) + GetApp()->UpdateDefaultPrinter(); + + CString str; + if (GetApp()->GetHDevNames().Get() != nullptr) + str = GetDevNames().GetDeviceName(); + + return str; + } + + // Returns a pointer to the locked hDevMode memory encapsulated in a CDevMode object. + // There is no need to unlock this memory. The CDevMode object automatically + // unlocks the memory when it goes out of scope. + // Usage: + // CDevMode pDevMode = GetDevMode(); + // Then use pDevMode as if it were a LPDEVMODE. + inline CDevMode CPrintDialog::GetDevMode() const + { + + if (GetApp()->GetHDevMode().Get() == nullptr) + GetApp()->UpdateDefaultPrinter(); + + if (GetApp()->GetHDevMode().Get() == nullptr) + throw CResourceException(GetApp()->MsgPrintFound()); + + return CDevMode(GetApp()->GetHDevMode()); + } + + // Returns a pointer to the locked hDevNames memory encapsulated in a + // CDevNames object. There is no need to unlock this memory. The CDevNames + // object automatically unlocks the memory when it goes out of scope. + // Usage: + // CDevNames pDevNames = GetDevNames(); + // Then use pDevNames as if it were a LPDEVNAMES. + inline CDevNames CPrintDialog::GetDevNames() const + { + if (GetApp()->GetHDevNames().Get() == nullptr) + GetApp()->UpdateDefaultPrinter(); + + if (GetApp()->GetHDevNames().Get() == nullptr) + throw CResourceException(GetApp()->MsgPrintFound()); + + return CDevNames(GetApp()->GetHDevNames()); + } + + // Retrieves the name of the default or currently selected printer driver. + inline CString CPrintDialog::GetDriverName() const + { + if (GetApp()->GetHDevNames().Get() == nullptr) + GetApp()->UpdateDefaultPrinter(); + + CString str; + if (GetApp()->GetHDevNames().Get() != nullptr) + str = GetDevNames().GetDriverName(); + + return str; + } + + // Retrieves the starting page of the print range. + inline int CPrintDialog::GetFromPage() const + { + return (PrintRange() ? m_pd.nFromPage : -1); + } + + // Retrieves the name of the default or currently selected printer port. + inline CString CPrintDialog::GetPortName() const + { + if (GetApp()->GetHDevNames().Get() == nullptr) + GetApp()->UpdateDefaultPrinter(); + + CString str; + if (GetApp()->GetHDevNames().Get() != nullptr) + str = GetDevNames().GetPortName(); + + return str; + } + + // Retrieves the ending page of the print range. + inline int CPrintDialog::GetToPage() const + { + return (PrintRange() ? m_pd.nToPage : -1); + } + + // Call this function after calling DoModal to determine whether to print + // all pages in the document. + inline BOOL CPrintDialog::PrintAll() const + { + return !PrintRange() && !PrintSelection() ? TRUE : FALSE; + } + + // Call this function after calling DoModal to determine whether the printer + // should collate all printed copies of the document. + inline BOOL CPrintDialog::PrintCollate() const + { + if (m_pd.Flags & PD_USEDEVMODECOPIES) + return (GetDevMode()->dmCollate == DMCOLLATE_TRUE); + else + return (m_pd.Flags & PD_COLLATE ? TRUE : FALSE); + } + + // Call this function after calling DoModal to determine whether to print + // only a range of pages in the document. + inline BOOL CPrintDialog::PrintRange() const + { + return m_pd.Flags & PD_PAGENUMS ? TRUE : FALSE; + } + + // Call this function after calling DoModal to determine whether to print + // only the currently selected items. + inline BOOL CPrintDialog::PrintSelection() const + { + return m_pd.Flags & PD_SELECTION ? TRUE : FALSE; + } + + // Assigns the application's default printer settings to the values + // specified by hDevMode and hDevNames. + inline void CPrintDialog::SetDefaults(HGLOBAL hDevMode, HGLOBAL hDevNames) + { + GetApp()->UpdatePrinterMemory(hDevMode, hDevNames); + } + + // Set the parameters of the PRINTDLG structure to sensible values. + inline void CPrintDialog::SetParameters(const PRINTDLG& pd) + { + m_pd.lStructSize = sizeof(m_pd); + m_pd.hwndOwner = nullptr; // Set this in DoModal. + m_pd.Flags = pd.Flags; + m_pd.nFromPage = pd.nFromPage; + m_pd.nToPage = pd.nToPage; + m_pd.nMinPage = pd.nMinPage; + m_pd.nMaxPage = pd.nMaxPage; + m_pd.nCopies = pd.nCopies; + m_pd.hInstance = GetApp()->GetResourceHandle(); + m_pd.lpfnPrintHook = reinterpret_cast(CDHookProc); + m_pd.lpfnSetupHook = reinterpret_cast(CDHookProc); + m_pd.lCustData = pd.lCustData; + m_pd.hPrintTemplate = pd.hPrintTemplate; + m_pd.hSetupTemplate = pd.hSetupTemplate; + m_pd.lpPrintTemplateName = pd.lpPrintTemplateName; + m_pd.lpSetupTemplateName = pd.lpSetupTemplateName; + m_pd.Flags &= ~PD_RETURNIC; + m_pd.Flags &= ~PD_RETURNDC; // Use GetPrinterDC to retrieve the dc. + } + + + ////////////////////////////////////////////// + // Definitions for the CPageSetupDialog class. + // + + + // Constructor for CPageSetupDialog class. The flags parameter specifies the + // flags for the PAGESETUPDLG structure. Refer to the description of the + // PAGESETUPDLG struct in the Windows API documentation. + inline CPageSetupDialog::CPageSetupDialog( DWORD flags /* = PSD_MARGINS */ ) + { + m_psd = {}; + m_psd.Flags = flags; + + // Enable the hook proc for the help button + if (m_psd.Flags & PSD_SHOWHELP) + m_psd.Flags |= PSD_ENABLEPAGESETUPHOOK; + + SetParameters(m_psd); + } + + // Dialog procedure for the PageSetup dialog. Override this function + // to customize the message handling. + inline INT_PTR CPageSetupDialog::DialogProc(UINT msg, WPARAM wparam, + LPARAM lparam) + { + // A typical override might look like this: + + // switch (msg) + // { + // case MESSAGE1: // Some Windows API message + // OnMessage1(); // A user defined function + // break; // Also do default processing + + // case MESSAGE2: + // OnMessage2(); + // return x; // Don't do default processing, but + // // instead return a value recommended + // // by the Windows API documentation + // } + + // Always pass unhandled messages on to DialogProcDefault. + return DialogProcDefault(msg, wparam, lparam); + } + + // The Default message handling for CPageSetupDialog. Don't override this + // function, override DialogProc instead. + // Note: OnCancel and OnOK are called by DoModal. + inline INT_PTR CPageSetupDialog::DialogProcDefault(UINT msg, WPARAM wparam, + LPARAM) + { + switch (msg) + { + case WM_INITDIALOG: + { // Handle the initialization message. + return OnInitDialog(); + } + + case WM_COMMAND: + { + switch (LOWORD(wparam)) + { + case pshHelp: + OnHelpButton(); + return TRUE; + + } + break; + } + } + + return 0; + } + + // Display the Page Setup dialog, and allow the user to select various options. + // An exception is thrown if the dialog isn't created. + // An exception is thrown if there is no default printer. + inline INT_PTR CPageSetupDialog::DoModal(HWND owner /* = nullptr */) + { + assert(!IsWindow()); // Only one window per CWnd instance allowed. + + // Update the default printer. + GetApp()->UpdateDefaultPrinter(); + + // Assign values to the PAGESETUPDLG structure + m_psd.hDevMode = GetApp()->GetHDevMode(); + m_psd.hDevNames = GetApp()->GetHDevNames(); + m_psd.hwndOwner = owner; + + // Retrieve this thread's TLS data. + TLSData* pTLSData = GetApp()->GetTlsData(); + + // Create the modal dialog. + pTLSData->pWnd = this; + BOOL ok = ::PageSetupDlg(&m_psd); + + if (ok) + { + GetApp()->UpdatePrinterMemory(m_psd.hDevMode, m_psd.hDevNames); + OnOK(); + ok = IDOK; + } + else + { + int error = static_cast(CommDlgExtendedError()); + + // ignore the exception caused by closing the dialog + if ((error != 0) && (error != CDERR_DIALOGFAILURE)) + { + // Reset global memory + GetApp()->ResetPrinterMemory(); + throw CWinException(GetApp()->MsgWndDialog(), error); + } + + OnCancel(); + ok = IDCANCEL; + } + + m_psd.hDevMode = nullptr; + m_psd.hDevNames = nullptr; + + // Prepare the CWnd for reuse. + Cleanup(); + + return ok; + } + + // Returns a pointer to the locked hDevMode memory encapsulated in a + // CDevMode object. There is no need to unlock this memory. The CDevMode + // object automatically unlocks the memory when it goes out of scope. + // Usage: + // CDevMode pDevMode = GetDevMode(); + // Then use pDevMode as if it were a LPDEVMODE + inline CDevMode CPageSetupDialog::GetDevMode() const + { + if (GetApp()->GetHDevMode().Get() == nullptr) + GetApp()->UpdateDefaultPrinter(); + + if (GetApp()->GetHDevMode().Get() == nullptr) + throw CResourceException(GetApp()->MsgPrintFound()); + + return CDevMode(GetApp()->GetHDevMode()); + } + + // Returns a pointer to the locked hDevNames memory encapsulated in a + // CDevNames object. There is no need to unlock this memory. The CDevNames + // object automatically unlocks the memory when it goes out of scope. + // Usage: + // CDevNames pDevNames = GetDevNames(); + // Then use pDevNames as if it were a LPDEVNAMES + inline CDevNames CPageSetupDialog::GetDevNames() const + { + if (GetApp()->GetHDevNames().Get() == nullptr) + GetApp()->UpdateDefaultPrinter(); + + if (GetApp()->GetHDevNames().Get() == nullptr) + throw CResourceException(GetApp()->MsgPrintFound()); + + return CDevNames(GetApp()->GetHDevNames()); + } + + // Call this function after a call to DoModal to retrieve the margins of + // the printer. + inline void CPageSetupDialog::GetMargins(RECT& margin, RECT& minMargin) const + { + margin = m_psd.rtMargin; + minMargin = m_psd.rtMinMargin; + } + + // Call this function to retrieve the size of the paper selected for + // printing. + inline CSize CPageSetupDialog::GetPaperSize() const + { + return CSize(m_psd.ptPaperSize.x, m_psd.ptPaperSize.y); + } + + // This function receives messages that allow the drawing of the paint + // sample page in the Page Setup dialog box to be customized. + inline INT_PTR CALLBACK CPageSetupDialog::PaintHookProc(HWND wnd, + UINT message, WPARAM wparam, LPARAM lparam) + { + if (wnd == nullptr) + return 0; + + // The parent of paint sample window is the Page Setup dialog. + CPageSetupDialog* pDlg = static_cast( + GetCWndPtr(::GetParent(wnd))); + if (pDlg == nullptr) + return 0; + + switch (message) + { + case WM_PSD_PAGESETUPDLG: + { + assert(lparam); + if (lparam == 0) return 0; + PAGESETUPDLG psd = *(reinterpret_cast(lparam)); + return static_cast(pDlg->OnPreDrawPage( + LOWORD(wparam), HIWORD(wparam), psd)); + } + + case WM_PSD_FULLPAGERECT: + case WM_PSD_MINMARGINRECT: + case WM_PSD_MARGINRECT: + case WM_PSD_GREEKTEXTRECT: + case WM_PSD_ENVSTAMPRECT: + case WM_PSD_YAFULLPAGERECT: + { + assert(lparam); + if (lparam == 0) return 0; + RECT rc = *(reinterpret_cast(lparam)); + return static_cast(pDlg->OnDrawPage( + reinterpret_cast(wparam), message, rc)); + } + } + return 0; + } + + // Override this function to customize drawing of the sample page in the + // Page Setup dialog box. It is called in response to the following + // messages: WM_PSD_FULLPAGERECT; WM_PSD_MINMARGINRECT; WM_PSD_MARGINRECT; + // WM_PSD_GREEKTEXTRECT; WM_PSD_ENVSTAMPRECT; and WM_PSD_YAFULLPAGERECT. + inline UINT CPageSetupDialog::OnDrawPage(HDC, UINT, RECT) + { + return 0; // do the default + } + + // Called before drawing is preformed on the sample page. + inline UINT CPageSetupDialog::OnPreDrawPage(WORD /*paper*/, + WORD /*flags*/, const PAGESETUPDLG& /*psd*/) + { + return 0; + } + + // Set the parameters of the PAGESETUPDLG structure to sensible values + inline void CPageSetupDialog::SetParameters(const PAGESETUPDLG& psd) + { + m_psd.lStructSize = sizeof(m_psd); + m_psd.hwndOwner = nullptr; // Set this in DoModal + m_psd.Flags = psd.Flags; + m_psd.ptPaperSize = psd.ptPaperSize; + m_psd.rtMinMargin = psd.rtMinMargin; + m_psd.rtMargin = psd.rtMargin; + m_psd.hInstance = GetApp()->GetResourceHandle(); + m_psd.lCustData = psd.lCustData; + m_psd.lpfnPageSetupHook = reinterpret_cast(CDHookProc); + m_psd.lpfnPagePaintHook = reinterpret_cast(CPageSetupDialog::PaintHookProc); + m_psd.lpPageSetupTemplateName = psd.lpPageSetupTemplateName; + m_psd.hPageSetupTemplate = psd.hPageSetupTemplate; + } + +} + +#endif // _WIN32XX_PRINTDIALOGS_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_propertysheet.h b/packages/media/cpp/packages/Win32xx/include/wxx_propertysheet.h new file mode 100644 index 00000000..5497b2c9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_propertysheet.h @@ -0,0 +1,908 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////// +// wxx_propertysheet.h +// Declaration of the following classes: +// CPropertyPage and CPropertySheet + +// These classes add support for property sheets to Win32++. A property sheet +// will have one or more property pages. These pages are much like dialogs +// that are presented within a tabbed dialog or within a wizard. The data +// on a property page can be validated before the next page is presented. +// Property sheets have three modes of use: Modal, Modeless, and Wizard. +// +// Refer to the PropertySheet demo program for an example of how property sheets +// can be used. + + +#ifndef _WIN32XX_PROPERTYSHEET_H_ +#define _WIN32XX_PROPERTYSHEET_H_ + +#include "wxx_dialog.h" + +#define ID_APPLY_NOW 0x3021 +#define ID_WIZBACK 0x3023 +#define ID_WIZNEXT 0x3024 +#define ID_WIZFINISH 0x3025 +#define ID_HELP 0xE146 + + +namespace Win32xx +{ + + ///////////////////////////////////////////////////////////// + // This class provides support for property pages. A property + // page is an individual page used in a property sheet. + class CPropertyPage : public CDialog + { + public: + CPropertyPage (UINT templateID, LPCTSTR title = nullptr); + virtual ~CPropertyPage() override = default; + virtual INT_PTR DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual BOOL OnApply(); + virtual void OnCancel() override; + virtual void OnHelp(); + virtual BOOL OnInitDialog() override; + virtual BOOL OnKillActive(); + virtual LRESULT OnNotify(WPARAM wparam, LPARAM lparam) override; + virtual void OnOK() override; + virtual BOOL OnQueryCancel(); + virtual BOOL OnQuerySiblings(UINT msg, WPARAM wparam, LPARAM lparam); + virtual BOOL OnSetActive(); + virtual BOOL OnWizardBack(); + virtual BOOL OnWizardFinish(); + virtual BOOL OnWizardNext(); + virtual BOOL PreTranslateMessage(MSG& msg) override; + + void CancelToClose() const; + INT_PTR DialogProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) override; + PROPSHEETPAGE GetPSP() const {return m_psp;} + BOOL IsButtonEnabled(UINT buttonID) const; + LRESULT QuerySiblings(WPARAM wparam, LPARAM lparam) const; + void SetModified(BOOL isChanged) const; + void SetTitle(LPCTSTR title); + void SetWizardButtons(DWORD flags) const; + + private: + CPropertyPage(const CPropertyPage&) = delete; + CPropertyPage& operator=(const CPropertyPage&) = delete; + + static UINT CALLBACK StaticPropSheetPageProc(HWND wnd, UINT msg, + LPPROPSHEETPAGE ppsp); + static INT_PTR CALLBACK StaticDialogProc(HWND hDlg, UINT msg, + WPARAM wparam, LPARAM lparam); + + PROPSHEETPAGE m_psp; + CString m_title; + }; + + + /////////////////////////////////////////////////////////////// + // This class provides support for a property sheet. A property + // sheet is also known as a tab dialog box. It has one or more + // property pages. A Property sheet can present its pages as a + // wizard. + class CPropertySheet : public CWnd + { + public: + CPropertySheet(UINT captionID, HWND parent = nullptr); + CPropertySheet(LPCTSTR caption = nullptr, HWND parent = nullptr); + virtual ~CPropertySheet() override = default; + + // Operations + virtual CPropertyPage* AddPage(CPropertyPage* pPage); + virtual CPropertyPage* AddPage(PropertyPagePtr page); + virtual HWND Create(HWND parent = nullptr) override; + virtual INT_PTR CreatePropertySheet(LPCPROPSHEETHEADER pPSH); + virtual void DestroyButton(int button); + virtual void Destroy() override; + virtual int DoModal(); + virtual void RemovePage(CPropertyPage* page); + + // State functions + BOOL IsModeless() const; + BOOL IsWizard() const; + + // Accessors and mutators + CPropertyPage* GetActivePage() const; + int GetPageCount() const; + int GetPageIndex(CPropertyPage* pPage) const; + HWND GetTabControl() const; + BOOL SetActivePage(int page); + BOOL SetActivePage(CPropertyPage* pPage); + void SetIcon(UINT iconID); + void SetTitle(LPCTSTR title); + void SetWizardMode(BOOL isWizard); + + protected: + virtual LRESULT OnSetDefID(WPARAM wparam); + virtual BOOL PreTranslateMessage(MSG& msg) override; + virtual LRESULT WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) override; + + private: + CPropertySheet(const CPropertySheet&) = delete; + CPropertySheet& operator=(const CPropertySheet&) = delete; + void BuildPageArray(); + static void CALLBACK Callback(HWND hwnd, UINT msg, LPARAM lparam); + + CString m_title; + std::vector m_allPages; // vector of CPropertyPage + std::vector m_allSheetPages; // vector of PROPSHEETPAGE + PROPSHEETHEADER m_psh; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// + +namespace Win32xx +{ + + /////////////////////////////////////////// + // Definitions for the CPropertyPage class. + // + + inline CPropertyPage::CPropertyPage(UINT templateID, LPCTSTR title /* = nullptr*/) + { + m_psp = {}; + SetTitle(title); + + m_psp.dwSize = sizeof(m_psp); + m_psp.dwFlags |= PSP_USECALLBACK; + m_psp.hInstance = GetApp()->GetInstanceHandle(); + m_psp.pszTemplate = MAKEINTRESOURCE(templateID); + m_psp.pszTitle = m_title; + m_psp.pfnDlgProc = (DLGPROC)CPropertyPage::StaticDialogProc; + m_psp.lParam = reinterpret_cast(this); + m_psp.pfnCallback = CPropertyPage::StaticPropSheetPageProc; + } + + // Disables the Cancel button and changes the text of the OK button to "Close." + // Refer to PSM_CANCELTOCLOSE in the Windows API documentation for more information. + inline void CPropertyPage::CancelToClose() const + { + assert(IsWindow()); + SendMessage(PSM_CANCELTOCLOSE, 0, 0); + } + + // Override this function to process the property page's window message. + inline INT_PTR CPropertyPage::DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) + { + // A typical function might look like this: + + // switch (msg) + // { + // case MESSAGE1: // Some Win32 API message + // OnMessage1(); // A user defined function + // break; // Also do default processing + // case MESSAGE2: + // OnMessage2(); + // return x; // Don't do default processing, but instead return + // // a value recommended by the Win32 API documentation + // } + + // Always pass unhandled messages on to DialogProcDefault. + return DialogProcDefault(msg, wparam, lparam); + } + + // Provides default handling for the property page's message. + // The DialogProc functions should pass unhandled messages to this function. + inline INT_PTR CPropertyPage::DialogProcDefault(UINT msg, WPARAM wparam, + LPARAM lparam) + { + switch (msg) + { + case PSM_QUERYSIBLINGS: + return OnQuerySiblings(msg, wparam, lparam); + } + + return CDialog::DialogProcDefault(msg, wparam, lparam); + + } + + // Returns TRUE if the button is enabled. + inline BOOL CPropertyPage::IsButtonEnabled(UINT buttonID) const + { + assert(IsWindow()); + return GetParent().GetDlgItem(buttonID).IsWindowEnabled(); + } + + // This function is called for each page when the Apply, OK or Close button is pressed. + // Override this function in your derived class to perform tasks when actions are applied. + inline BOOL CPropertyPage::OnApply() + { + // Return TRUE to accept the changes; otherwise FALSE. + return TRUE; + } + + // This function is called for each page when the Cancel button is pressed + // Override this function in your derived class when if the cancel button is pressed. + inline void CPropertyPage::OnCancel() + { + // Close the propertysheet. + GetParent().Close(); + } + + // This function is called in response to the PSN_HELP notification. + inline void CPropertyPage::OnHelp() + { + + SendMessage(*this, WM_COMMAND, ID_HELP, 0); + } + + // Called when the cancel button is pressed, and before the cancel has taken place + // Returns TRUE to prevent the cancel operation, or FALSE to allow it. + inline BOOL CPropertyPage::OnQueryCancel() + { + return FALSE; // Allow cancel to proceed + } + + // Responds to a query request from the Property Sheet. + // The values for wparam and lparam are the ones set by the CPropertySheet::QuerySiblings call. + // return FALSE to allow other siblings to be queried, or + // return TRUE to stop query at this page. + inline BOOL CPropertyPage::OnQuerySiblings(UINT, WPARAM, LPARAM) + { + return FALSE; + } + + // Called when the property page is created. + // Override this function to perform operations when the property page is created. + inline BOOL CPropertyPage::OnInitDialog() + { + return TRUE; // Pass Keyboard control to handle in WPARAM + } + + // This is called in response to a PSN_KILLACTIVE notification, which + // is sent whenever the OK or Apply button is pressed. + // It provides an opportunity to validate the page contents before it's closed. + // Return TRUE to prevent the page from losing the activation, or FALSE to allow it. + inline BOOL CPropertyPage::OnKillActive() + { + return FALSE; + } + + // Called when the OK button is pressed if OnApply for each page returns TRUE. + // Override this function to perform tasks when the property sheet is closed. + inline void CPropertyPage::OnOK() + { + // Close the propertysheet. + GetParent().Close(); + } + + // Handles the WM_NOTIFY message and call the appropriate functions. + inline LRESULT CPropertyPage::OnNotify(WPARAM, LPARAM lparam) + { + LPPSHNOTIFY pNotify = reinterpret_cast(lparam); + assert(pNotify); + if (!pNotify) return 0; + + // The framework will call SetWindowLongPtr(DWLP_MSGRESULT, result) + // for non-zero returns. + switch(pNotify->hdr.code) + { + case PSN_SETACTIVE: + return OnSetActive() ? 0 : -1; + case PSN_KILLACTIVE: + return OnKillActive(); + case PSN_APPLY: + if (OnApply()) + { + if (pNotify->lParam) + OnOK(); + return PSNRET_NOERROR; + } + return PSNRET_INVALID_NOCHANGEPAGE; + case PSN_RESET: + OnCancel(); + break; + case PSN_QUERYCANCEL: + return OnQueryCancel(); + case PSN_WIZNEXT: + return OnWizardNext()? 0 : -1; + case PSN_WIZBACK: + return OnWizardBack()? 0 : -1; + case PSN_WIZFINISH: + return !OnWizardFinish(); + case PSN_HELP: + OnHelp(); + break; + default: + return PSNRET_NOERROR; // Page is valid. + } + + return PSNRET_NOERROR; // Page is valid. + } + + // Called when a page becomes active. Override this function to perform tasks + // when a page is activated. + // Return TRUE if the page was successfully set active; otherwise FALSE. + inline BOOL CPropertyPage::OnSetActive() + { + return TRUE; + } + + // This function is called when the Back button is pressed on a wizard page. + // Override this function to perform tasks when the back button is pressed. + // Return TRUE to allow the wizard to go to the previous page; otherwise return FALSE. + inline BOOL CPropertyPage::OnWizardBack() + { + return TRUE; + } + + // This function is called when the Finish button is pressed on a wizard page. + // Override this function to perform tasks when the wizard is finished. + // Return TRUE if the property sheet is destroyed when the wizard finishes; otherwise return FALSE. + inline BOOL CPropertyPage::OnWizardFinish() + { + return TRUE; // Allow wizard to finish. + } + + // This function is called when the Next button is pressed on a wizard page. + // Override this function in your derived class when the next button is pressed. + // Return TRUE to allow the wizard to go to the next page; otherwise return FALSE. + inline BOOL CPropertyPage::OnWizardNext() + { + return TRUE; + } + + // Override this function to filter mouse and keyboard messages prior to + // being passed to the DialogProc. + inline BOOL CPropertyPage::PreTranslateMessage(MSG& msg) + { + // Allow the tab control to translate keyboard input. + if (msg.message == WM_KEYDOWN && GetAsyncKeyState(VK_CONTROL) < 0 && + (msg.wParam == VK_TAB || msg.wParam == VK_PRIOR || msg.wParam == VK_NEXT)) + { + LPARAM lparam = reinterpret_cast(&msg); + if (GetParent().SendMessage(PSM_ISDIALOGMESSAGE, 0, lparam)) + return TRUE; + } + + // Allow the dialog to translate keyboard input. + if ((msg.message >= WM_KEYFIRST) && (msg.message <= WM_KEYLAST)) + { + if (IsDialogMessage(msg)) + return TRUE; + } + + return CWnd::PreTranslateMessage(msg); + } + + // Sent to a property sheet, which then forwards the message to each of its pages. + // Set wparam and lparam to values you want passed to the property pages. + // Returns the non-zero value from a page in the property sheet, or zero if no page + // returns a non-zero value. + // Refer to PSM_QUERYSIBLINGS in the Windows API documentation for more information. + inline LRESULT CPropertyPage::QuerySiblings(WPARAM wparam, LPARAM lparam) const + { + assert(IsWindow()); + return GetParent().SendMessage(PSM_QUERYSIBLINGS, wparam, lparam); + } + + // The property sheet will enable the Apply button if IsChanged is TRUE. + // Refer to PSM_CHANGED and PSM_UNCHANGED in the Windows API documentation for more information. + inline void CPropertyPage::SetModified(BOOL isChanged) const + { + assert(IsWindow()); + + WPARAM wparam = reinterpret_cast(GetHwnd()); + if (isChanged) + GetParent().SendMessage(PSM_CHANGED, wparam, 0); + else + GetParent().SendMessage(PSM_UNCHANGED, wparam, 0); + } + + // Sets the title of the property page. + inline void CPropertyPage::SetTitle(LPCTSTR title) + { + if (title) + { + m_title = title; + m_psp.dwFlags |= PSP_USETITLE; + } + else + { + m_title.Empty(); + m_psp.dwFlags &= ~PSP_USETITLE; + } + + m_psp.pszTitle = m_title; + } + + // Enables or disables the various buttons on a wizard property page. + // flags: A value that specifies which wizard buttons are enabled. You can combine one or more of the following flags. + // PSWIZB_BACK Enable the Back button. If this flag is not set, the Back button is displayed as disabled. + // PSWIZB_DISABLEDFINISH Display a disabled Finish button. + // PSWIZB_FINISH Display an enabled Finish button. + // PSWIZB_NEXT Enable the Next button. If this flag is not set, the Next button is displayed as disabled. + inline void CPropertyPage::SetWizardButtons(DWORD flags) const + { + assert ( IsWindow() ); + PropSheet_SetWizButtons(::GetParent(*this), flags); + } + + inline UINT CALLBACK CPropertyPage::StaticPropSheetPageProc(HWND, UINT msg, LPPROPSHEETPAGE ppsp) + { + switch (msg) + { + case PSPCB_CREATE: + { + TLSData* pTLSData = GetApp()->GetTlsData(); + assert(pTLSData != nullptr); + if (pTLSData == nullptr) + { + // Thread Local Storage data isn't assigned. + return 0; + } + + // Store the CPropertyPage pointer in Thread Local Storage. + pTLSData->pWnd = reinterpret_cast(ppsp->lParam); + } + break; + } + + return TRUE; + } + + inline INT_PTR CALLBACK CPropertyPage::StaticDialogProc(HWND hDlg, UINT msg, WPARAM wparam, LPARAM lparam) + { + // Find matching CWnd pointer for this HWND. + CPropertyPage* pPage = static_cast(GetCWndPtr(hDlg)); + if (!pPage) + { + // matching CWnd pointer not found, so add it to HWNDMap now. + TLSData* pTLSData = GetApp()->GetTlsData(); + pPage = static_cast(pTLSData->pWnd); + + if (pPage) + { + // Set the wnd members and call DialogProc for this message. + pPage->m_wnd = hDlg; + pPage->AddToMap(); + } + } + + assert(pPage != nullptr); + if (pPage == nullptr) + { + // Got a message for a window that's not in the map. + return 0; + } + + return pPage->DialogProc(msg, wparam, lparam); + } + + + //////////////////////////////////////////// + // Definitions for the CPropertySheet class. + // + + inline CPropertySheet::CPropertySheet(UINT captionID, HWND parent /* = nullptr*/) + { + m_psh = {}; + SetTitle(LoadString(captionID)); + + m_psh.dwSize = sizeof(m_psh); + m_psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USECALLBACK; + m_psh.hwndParent = parent; + m_psh.hInstance = GetApp()->GetInstanceHandle(); + m_psh.pfnCallback = reinterpret_cast( + reinterpret_cast(CPropertySheet::Callback)); + } + + inline CPropertySheet::CPropertySheet(LPCTSTR caption /*= nullptr*/, + HWND parent /* = nullptr*/) + { + m_psh = {}; + SetTitle(caption); + m_psh.dwSize = sizeof(m_psh); + m_psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USECALLBACK; + m_psh.hwndParent = parent; + m_psh.hInstance = GetApp()->GetInstanceHandle(); + m_psh.pfnCallback = reinterpret_cast( + reinterpret_cast(CPropertySheet::Callback)); + } + + // Adds a Property Page to the Property Sheet. + // The framework assumes ownership of the CPropertyPage pointer provided, + // and deletes the CPropertyPage object when the PropertySheet is destroyed. + inline CPropertyPage* CPropertySheet::AddPage(CPropertyPage* pPage) + { + assert(pPage != nullptr); + return AddPage(PropertyPagePtr(pPage)); + } + + // Adds a Property Page to the Property Sheet. + // The framework assumes ownership of the CPropertyPage pointer provided, + // and deletes the CPropertyPage object when the PropertySheet is destroyed. + inline CPropertyPage* CPropertySheet::AddPage(PropertyPagePtr page) + { + CPropertyPage* pPage = page.get(); + assert(pPage != nullptr); + if (!pPage) + return nullptr; + + m_allPages.push_back(std::move(page)); + + if (*this) + { + // Property sheet already exists, so add page to it. + PROPSHEETPAGE psp = pPage->GetPSP(); + HPROPSHEETPAGE hpsp = ::CreatePropertySheetPage(&psp); + PropSheet_AddPage(*this, hpsp); + } + + m_psh.nPages = static_cast(m_allPages.size()); + + return pPage; + } + + // Builds the array of PROPSHEETPAGE. + inline void CPropertySheet::BuildPageArray() + { + m_allSheetPages.clear(); + for (const PropertyPagePtr& ptr : m_allPages) + m_allSheetPages.emplace_back(ptr->GetPSP()); + + PROPSHEETPAGE* pPSPArray = m_allSheetPages.data(); // Array of PROPSHEETPAGE + m_psh.ppsp = pPSPArray; + } + + // Perform initial processing of the property sheet messages. + inline void CALLBACK CPropertySheet::Callback(HWND wnd, UINT msg, LPARAM lparam) + { + switch(msg) + { + // Called before the property sheet is created. + // wnd = nullptr, and lparam points to dialog resource. + case PSCB_PRECREATE: + { + LPDLGTEMPLATE lpTemplate = reinterpret_cast(lparam); + + if (!(lpTemplate->style & WS_SYSMENU)) + { + lpTemplate->style |= WS_SYSMENU; + } + } + break; + + // Called when the property sheet is created. + case PSCB_INITIALIZED: + { + // Retrieve pointer to CWnd object from Thread Local Storage. + TLSData* pTLSData = GetApp()->GetTlsData(); + assert(pTLSData); + if (!pTLSData) return; + + CPropertySheet* w = static_cast(pTLSData->pWnd); + + assert(w != nullptr); + if (w != nullptr) + { + // Subclass the property sheet, so that messages are forwarded + // to CWnd::StaticWindowProc for handling in WndProc. + w->Attach(wnd); + } + } + break; + } + } + + // Creates a modeless Property Sheet. + // Refer to PropertySheet in the Windows API documentation for more information. + inline HWND CPropertySheet::Create(HWND parent /*= nullptr*/) + { + assert(!IsWindow()); // Only one window per CWnd instance allowed. + Cleanup(); + + if (parent) + { + m_psh.hwndParent = parent; + } + + BuildPageArray(); + PROPSHEETPAGE* pPSPArray = m_allSheetPages.data(); + m_psh.ppsp = pPSPArray; + + // Create a modeless Property Sheet. + m_psh.dwFlags &= ~PSH_WIZARD; + m_psh.dwFlags |= PSH_MODELESS; + HWND wnd = reinterpret_cast(CreatePropertySheet(&m_psh)); + if (wnd == nullptr) + throw CWinException(GetApp()->MsgWndPropertSheet()); + + return wnd; + } + + // Display either a modal or modeless property sheet, depending on the + // PROPSHEETHEADER flags. + // Refer to PropertySheet in the Windows API documentation for more information. + inline INT_PTR CPropertySheet::CreatePropertySheet(LPCPROPSHEETHEADER pPSH) + { + // Only one window per CWnd instance allowed + assert(!IsWindow()); + + INT_PTR result = 0; + m_wnd = nullptr; + + // Retrieve this thread's TLS data. + TLSData* pTLSData = GetApp()->GetTlsData(); + + // Store the 'this' pointer in Thread Local Storage. + pTLSData->pWnd = this; + + // Create the property sheet. + result = PropertySheet(pPSH); + + // Tidy up. + pTLSData->pWnd = nullptr; + + if (result == -1) + throw CWinException(GetApp()->MsgWndPropertSheet()); + + return result; + } + + // Removes the specified button. + inline void CPropertySheet::DestroyButton(int buttonID) + { + assert(IsWindow()); + + HWND button = ::GetDlgItem(*this, buttonID); + if (button != nullptr) + { + // Hide and disable the button. + ::ShowWindow(button, SW_HIDE); + ::EnableWindow(button, FALSE); + } + } + + // Called when a property sheet is destroyed. + // Note: To destroy a property sheet from within an application, post a + // WM_CLOSE message. + inline void CPropertySheet::Destroy() + { + CWnd::Destroy(); + m_allPages.clear(); + } + + // Create a modal property sheet. + // Refer to PropertySheet in the Windows API documentation for more information. + inline int CPropertySheet::DoModal() + { + assert(!IsWindow()); // Only one window per CWnd instance allowed. + Cleanup(); + + BuildPageArray(); + PROPSHEETPAGE* pPSPArray = m_allSheetPages.data(); + m_psh.ppsp = pPSPArray; + + // Create the Property Sheet. + m_psh.dwFlags &= ~PSH_MODELESS; + int nResult = static_cast(CreatePropertySheet(&m_psh)); + + m_allPages.clear(); + Cleanup(); + + return nResult; + } + + // Retrieves the property sheets active property page. + // Refer to PSM_GETCURRENTPAGEHWND in the Windows API documentation for more information. + inline CPropertyPage* CPropertySheet::GetActivePage() const + { + assert(IsWindow()); + + CPropertyPage* pPage = nullptr; + if (GetHwnd() != nullptr) + { + HWND hPage = reinterpret_cast(SendMessage(PSM_GETCURRENTPAGEHWND, 0, 0)); + pPage = static_cast(GetCWndPtr(hPage)); + } + + return pPage; + } + + // Returns the number of Property Pages in this Property Sheet. + inline int CPropertySheet::GetPageCount() const + { + assert(IsWindow()); + return static_cast(m_allPages.size()); + } + + // Returns the index of the specified property page. + inline int CPropertySheet::GetPageIndex(CPropertyPage* pPage) const + { + assert(IsWindow()); + int page = -1; + + for (int i = 0; i < GetPageCount(); i++) + { + size_t index = static_cast(i); + if (m_allPages[index].get() == pPage) + { + page = i; + break; + } + } + + return page; + } + + // Returns the handle to the Property Sheet's tab control. + // Refer to PSM_GETTABCONTROL in the Windows API documentation for more information. + inline HWND CPropertySheet::GetTabControl() const + { + assert(IsWindow()); + return reinterpret_cast(SendMessage(PSM_GETTABCONTROL, 0, 0)); + } + + // Returns TRUE of the property sheet is modeless. + inline BOOL CPropertySheet::IsModeless() const + { + return static_cast(m_psh.dwFlags & PSH_MODELESS); + } + + // Returns TRUE if this property sheet is a wizard. + inline BOOL CPropertySheet::IsWizard() const + { + return static_cast(m_psh.dwFlags & PSH_WIZARD); + } + + // Called in response to a DM_SETDEFID message. + // A DM_SETDEFID message is sent when a property page is selected. + // Override this to modify the property sheet's default ID. + inline LRESULT CPropertySheet::OnSetDefID(WPARAM wparam) + { + if (!IsWizard()) + { + // Change the default button to IDOK. + HWND ok = GetDlgItem(IDOK); + HWND cancel = GetDlgItem(IDCANCEL); + + if (::IsWindow(ok) && ::IsWindowVisible(ok) && ::IsWindowEnabled(ok)) + { + FinalWindowProc(DM_SETDEFID, IDOK, 0); + + ::SendMessage(cancel, BM_SETSTYLE, BS_PUSHBUTTON, TRUE); + return TRUE; + } + } + + return FinalWindowProc(DM_SETDEFID, wparam, 0); + } + + // Removes a Property Page from the Property Sheet. + inline void CPropertySheet::RemovePage(CPropertyPage* pPage) + { + assert(IsWindow()); + + int page = GetPageIndex(pPage); + WPARAM wparam = static_cast(page); + if (GetHwnd() != nullptr) + SendMessage(*this, PSM_REMOVEPAGE, wparam, 0); + + m_allPages.erase(m_allPages.begin() + page, m_allPages.begin() + page+1); + m_psh.nPages = static_cast(m_allPages.size()); + } + + // Override this function to filter mouse and keyboard messages prior to + // being passed to WndProc. + inline BOOL CPropertySheet::PreTranslateMessage(MSG& msg) + { + // Allow sheet to translate Ctrl+Tab, Shift+Ctrl+Tab, Ctrl+PageUp, and Ctrl+PageDown. + if (msg.message == WM_KEYDOWN && GetAsyncKeyState(VK_CONTROL) < 0 && + (msg.wParam == VK_TAB || msg.wParam == VK_PRIOR || msg.wParam == VK_NEXT)) + { + LPARAM lparam = reinterpret_cast(&msg); + if (SendMessage(PSM_ISDIALOGMESSAGE, 0, lparam)) + return TRUE; + } + + // Allow the dialog to translate keyboard input. + if (GetActivePage() && (msg.message >= WM_KEYFIRST) && (msg.message <= WM_KEYLAST)) + { + return GetActivePage()->PreTranslateMessage(msg); + } + + return CWnd::PreTranslateMessage(msg); + } + + // Activates the specified property page. + // Refer to PSM_SETCURSEL in the Windows API documentation for more information. + inline BOOL CPropertySheet::SetActivePage(int page) + { + assert(IsWindow()); + WPARAM wparam = static_cast(page); + return static_cast(SendMessage(*this, PSM_SETCURSEL, wparam, 0)); + } + + // Activates the specified property page. + inline BOOL CPropertySheet::SetActivePage(CPropertyPage* pPage) + { + assert(IsWindow()); + int page = GetPageIndex(pPage); + if ((page >= 0)) + return SetActivePage(page); + + return FALSE; + } + + // Sets the property sheet's icon. + inline void CPropertySheet::SetIcon(UINT iconID) + { + m_psh.pszIcon = MAKEINTRESOURCE(iconID); + m_psh.dwFlags |= PSH_USEICONID; + } + + // Sets the property sheet's title. + inline void CPropertySheet::SetTitle(LPCTSTR title) + { + if (title) + m_title = title; + else + m_title.Empty(); + + m_psh.pszCaption = m_title; + } + + // A Wizard is a form of property sheet that displays the pages in sequence. + // This function enables or disables Wizard mode for the property sheet. + inline void CPropertySheet::SetWizardMode(BOOL isWizard) + { + if (isWizard) + m_psh.dwFlags |= PSH_WIZARD; + else + m_psh.dwFlags &= ~PSH_WIZARD; + } + + // Provides default processing of the PropertySheet's messages. + inline LRESULT CPropertySheet::WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) + { + switch (msg) + { + case DM_SETDEFID: return OnSetDefID(wparam); + } + // Pass unhandled messages on for default processing. + return CWnd::WndProcDefault(msg, wparam, lparam); + } +} + +#endif // _WIN32XX_PROPERTYSHEET_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_rebar.h b/packages/media/cpp/packages/Win32xx/include/wxx_rebar.h new file mode 100644 index 00000000..212541d3 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_rebar.h @@ -0,0 +1,640 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +#ifndef _WIN32XX_REBAR_H_ +#define _WIN32XX_REBAR_H_ + +#include "wxx_wincore.h" +#include "wxx_themes.h" + + +namespace Win32xx +{ + + ///////////////////////////////////////////////////// + // CRebar manages a rebar control. Rebar controls act + // as containers for child windows such as toolbars. + class CReBar : public CWnd + { + public: + CReBar(); + virtual ~CReBar() override = default; + + // Operations + BOOL DeleteBand(int band) const; + int HitTest(RBHITTESTINFO& hitTestInfo) const; + HWND HitTest(POINT pt) const; + int IDToIndex(UINT bandID) const; + BOOL InsertBand(int band, REBARBANDINFO& bandInfo) const; + BOOL IsBandVisible(int band) const; + void MaximizeBand(UINT band, BOOL isIdeal = FALSE) const; + void MinimizeBand(UINT band) const; + BOOL MoveBand(UINT from, UINT to) const; + void MoveBandsLeft() const; + BOOL ResizeBand(int band, const CSize& sz) const; + BOOL ShowBand(int band, BOOL show) const; + BOOL ShowGripper(int band, BOOL show) const; + BOOL SizeToRect(RECT& rect) const; + + // Accessors and mutators + int GetBand(HWND wnd) const; + CRect GetBandBorders(int band) const; + int GetBandCount() const; + BOOL GetBandInfo(int band, REBARBANDINFO& bandInfo) const; + CRect GetBandRect(int band) const; + UINT GetBarHeight() const; + BOOL GetBarInfo(REBARINFO& rebarInfo) const; + HWND GetMenuBar() const {return m_menuBar;} + UINT GetRowCount() const; + int GetRowHeight(int row) const; + UINT GetSizeofRBBI() const; + HWND GetToolTips() const; + BOOL SetBandBitmap(int band, HBITMAP background) const; + BOOL SetBandColor(int band, COLORREF foreground, COLORREF background) const; + BOOL SetBandInfo(int band, REBARBANDINFO& bandInfo) const; + BOOL SetBarInfo(REBARINFO& rebarInfo) const; + void SetMenuBar(HWND menuBar) {m_menuBar = menuBar;} + void SetToolTips(HWND toolTip) const; + + protected: + // Overridables + virtual BOOL OnEraseBkgnd(CDC& dc) override; + virtual LRESULT OnLButtonDown(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnLButtonUp(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnMouseMove(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnTBWinPosChanging(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnToolBarResize(UINT msg, WPARAM wparam, LPARAM lparam); + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual void PreRegisterClass(WNDCLASS& wc) override; + + // Not intended to be overridden + LRESULT WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) override; + + private: + CReBar(const CReBar&) = delete; + CReBar& operator=(const CReBar&) = delete; + + BOOL m_isDragging; + HWND m_menuBar; + LPARAM m_oldParam; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + //////////////////////////////////// + // Definitions for the CReBar class. + // + + inline CReBar::CReBar() : m_isDragging(FALSE), m_menuBar(nullptr), m_oldParam(0) + { + } + + // Deletes a band from a rebar control. + // Refer to RB_DELETEBAND in the Windows API documentation for more information. + inline BOOL CReBar::DeleteBand(int band) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(band); + return static_cast(SendMessage(RB_DELETEBAND, wparam, 0)); + } + + // Returns the zero based band number for this window handle. + inline int CReBar::GetBand(HWND wnd) const + { + assert(IsWindow()); + + int result = -1; + if (wnd == nullptr) return result; + + for (int band = 0; band < GetBandCount(); ++band) + { + REBARBANDINFO rbbi = {}; + rbbi.cbSize = GetSizeofRBBI(); + rbbi.fMask = RBBIM_CHILD; + GetBandInfo(band, rbbi); + if (rbbi.hwndChild == wnd) + result = band; + } + + return result; + } + + // Retrieves the borders of a band. + // Refer to RB_GETBANDBORDERS in the Windows API documentation for more information. + inline CRect CReBar::GetBandBorders(int band) const + { + assert(IsWindow()); + + CRect rc; + WPARAM wparam = static_cast(band); + LPARAM lparam = reinterpret_cast(&rc); + SendMessage(RB_GETBANDBORDERS, wparam, lparam); + return rc; + } + + // Retrieves the count of bands currently in the rebar control. + // Refer to RB_GETBANDCOUNT in the Windows API documentation for more information. + inline int CReBar::GetBandCount() const + { + assert(IsWindow()); + return static_cast(SendMessage(RB_GETBANDCOUNT, 0, 0)); + } + + // Retrieves information about a specified band in a rebar control. + // Refer to RB_GETBANDINFO in the Windows API documentation for more information. + inline BOOL CReBar::GetBandInfo(int band, REBARBANDINFO& bandInfo) const + { + assert(IsWindow()); + assert(band >= 0); + + // REBARBANDINFO describes individual BAND characteristics. + bandInfo.cbSize = GetSizeofRBBI(); + WPARAM wparam = static_cast(band); + LPARAM lparam = reinterpret_cast(&bandInfo); + return static_cast(SendMessage(RB_GETBANDINFO, wparam, lparam)); + } + + // Retrieves the bounding rectangle for a given band in a rebar control. + // Refer to RB_GETRECT in the Windows API documentation for more information. + inline CRect CReBar::GetBandRect(int band) const + { + assert(IsWindow()); + CRect rc; + WPARAM wparam = static_cast(band); + LPARAM lparam = reinterpret_cast(&rc); + SendMessage(RB_GETRECT, wparam, lparam); + return rc; + } + + // Retrieves the height of the rebar control. + // Refer to RB_GETBARHEIGHT in the Windows API documentation for more information. + inline UINT CReBar::GetBarHeight() const + { + assert(IsWindow()); + return static_cast(SendMessage(RB_GETBARHEIGHT, 0, 0)); + } + + // Retrieves information about the rebar control and the image list it uses. + // Refer to RB_GETBARINFO in the Windows API documentation for more information. + inline BOOL CReBar::GetBarInfo(REBARINFO& rebarInfo) const + { + assert(IsWindow()); + + // REBARINFO describes overall rebar control characteristics + rebarInfo.cbSize = sizeof(rebarInfo); + LPARAM lparam = reinterpret_cast(&rebarInfo); + return static_cast(SendMessage(RB_GETBARINFO, 0, lparam)); + } + + // Retrieves the number of rows of bands in a rebar control. + // Refer to RB_GETROWCOUNT in the Windows API documentation for more information. + inline UINT CReBar::GetRowCount() const + { + assert(IsWindow()); + return static_cast(SendMessage(RB_GETROWCOUNT, 0, 0)); + } + + // Retrieves the height of a specified row in a rebar control. + // Refer to RB_GETROWHEIGHT in the Windows API documentation for more information. + inline int CReBar::GetRowHeight(int row) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(row); + return static_cast(SendMessage(RB_GETROWHEIGHT, wparam, 0)); + } + + // The size of the REBARBANDINFO struct changes according to _WIN32_WINNT. + // sizeof(REBARBANDINFO) can report an incorrect size for older Window versions, + // or newer Window version without XP themes enabled. + // Use this function to get a safe size for REBARBANDINFO. + // Refer to REBARBANDINFO in the Windows API documentation for more information. + inline UINT CReBar::GetSizeofRBBI() const + { + assert(IsWindow()); + UINT size = REBARBANDINFO_V6_SIZE; + return size; + } + + // Retrieves the handle to any ToolTip control associated with the rebar control. + // Refer to RB_GETTOOLTIPS in the Windows API documentation for more information. + inline HWND CReBar::GetToolTips() const + { + assert(IsWindow()); + return reinterpret_cast(SendMessage(RB_GETTOOLTIPS, 0, 0)); + } + + // Determines which portion of a rebar band is at a given point on the screen, + // if a rebar band exists at that point. + // Refer to RB_HITTEST in the Windows API documentation for more information. + inline int CReBar::HitTest(RBHITTESTINFO& hitTestInfo) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&hitTestInfo); + return static_cast(SendMessage(RB_HITTEST, 0, lparam)); + } + + // Return the child HWND at the given point. + inline HWND CReBar::HitTest(POINT pt) const + { + assert(IsWindow()); + + // Convert the point to client co-ordinates. + VERIFY(ScreenToClient(pt)); + + // Get the rebar band with the point. + RBHITTESTINFO rbhti = {}; + rbhti.pt = pt; + int iBand = HitTest(rbhti); + + if (iBand >= 0) + { + // Get the rebar band's wnd. + REBARBANDINFO rbbi = {}; + rbbi.cbSize = GetSizeofRBBI(); + rbbi.fMask = RBBIM_CHILD; + GetBandInfo(iBand, rbbi); + + return rbbi.hwndChild; + } + else + return 0; + } + + // Converts a band identifier to a band index in a rebar control. + // Refer to RB_IDTOINDEX in the Windows API documentation for more information. + inline int CReBar::IDToIndex(UINT bandID) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(bandID); + return static_cast(SendMessage(RB_IDTOINDEX, wparam, 0)); + } + + // Inserts a new band in a rebar control. + // Refer to RB_INSERTBAND in the Windows API documentation for more information. + inline BOOL CReBar::InsertBand(int band, REBARBANDINFO& bandInfo) const + { + assert(IsWindow()); + + bandInfo.cbSize = GetSizeofRBBI(); + WPARAM wparam = static_cast(band); + LPARAM lparam = reinterpret_cast(&bandInfo); + return static_cast(SendMessage(RB_INSERTBAND, wparam, lparam)); + } + + // Returns TRUE if the band is visible. + inline BOOL CReBar::IsBandVisible(int band) const + { + assert(IsWindow()); + + REBARBANDINFO rbbi = {}; + rbbi.cbSize = GetSizeofRBBI(); + rbbi.fMask = RBBIM_STYLE; + GetBandInfo(band, rbbi); + + return !(rbbi.fStyle & RBBS_HIDDEN); + } + + // Permit the parent window to handle the drawing of the rebar's background. + // Return TRUE to suppress default background drawing. + // Refer to UWM_DRAWRBBKGND in the Windows API documentation for more information. + inline BOOL CReBar::OnEraseBkgnd(CDC& dc) + { + WPARAM wparam = reinterpret_cast(&dc); + LPARAM lparam = reinterpret_cast(this); + return static_cast(SendMessage(::GetParent(*this), UWM_DRAWRBBKGND, wparam, lparam)); + } + + // Sets the CREATESTRUCT parameters prior to window creation. + inline void CReBar::PreCreate(CREATESTRUCT& cs) + { + cs.style = WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | + CCS_NODIVIDER | RBS_VARHEIGHT | RBS_BANDBORDERS ; + } + + // Set the window class + inline void CReBar::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = REBARCLASSNAME; + } + + // Resizes a band in a rebar control to either its ideal or largest size. + // Refer to RB_MAXIMIZEBAND in the Windows API documentation for more information. + inline void CReBar::MaximizeBand(UINT band, BOOL isIdeal /*= FALSE*/) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(band); + LPARAM lparam = static_cast(isIdeal); + SendMessage(RB_MAXIMIZEBAND, wparam, lparam); + } + + // Resizes a band in a rebar control to its smallest size. + // Refer to RB_MINIMIZEBAND in the Windows API documentation for more information. + inline void CReBar::MinimizeBand(UINT band) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(band); + SendMessage(RB_MINIMIZEBAND, wparam, 0); + } + + // Moves a band from one index to another. + // Refer to RB_MOVEBAND in the Windows API documentation for more information. + inline BOOL CReBar::MoveBand(UINT from, UINT to) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(from); + LPARAM lparam = static_cast(to); + return static_cast(SendMessage(RB_MOVEBAND, wparam, lparam)); + } + + // Repositions the bands so they are left justified. + inline void CReBar::MoveBandsLeft() const + { + assert(IsWindow()); + + int OldrcTop = -1; + for (int band = GetBandCount() -1; band >= 0; --band) + { + CRect rc = GetBandRect(band); + if (rc.top != OldrcTop) + { + // Maximize the last band on each row. + if (IsBandVisible(band)) + { + WPARAM wparam = static_cast(band); + SendMessage(RB_MAXIMIZEBAND, wparam, 0); + OldrcTop = rc.top; + } + } + } + } + + // Called when the left mouse button is pressed. + inline LRESULT CReBar::OnLButtonDown(UINT msg, WPARAM wparam, LPARAM lparam) + { + m_oldParam = lparam; // Store the x,y position + m_isDragging = TRUE; + + return FinalWindowProc(msg, wparam, lparam); + } + + // Called when the left button is released. + inline LRESULT CReBar::OnLButtonUp(UINT msg, WPARAM wparam, LPARAM lparam) + { + ReBarTheme* pTheme = reinterpret_cast( + GetParent().SendMessage(UWM_GETRBTHEME, 0, 0)); + + if (pTheme && pTheme->UseThemes && pTheme->LockMenuBand) + { + // Use move messages to limit the resizing of bands. + int y = GET_Y_LPARAM(lparam); + + if (y <= GetRowHeight(0)) + { + // Use x,y from WM_LBUTTONDOWN for WM_LBUTTONUP position. + lparam = m_oldParam; + } + } + m_isDragging = FALSE; + + return FinalWindowProc(msg, wparam, lparam); + } + + // Called when the mouse is moved over the window. + inline LRESULT CReBar::OnMouseMove(UINT msg, WPARAM wparam, LPARAM lparam) + { + if (m_isDragging) + { + ReBarTheme* pTheme = reinterpret_cast( + GetParent().SendMessage(UWM_GETRBTHEME, 0, 0)); + + if (pTheme && pTheme->UseThemes && pTheme->LockMenuBand) + { + // We want to lock the first row in place, but allow other bands to move! + // Use move messages to limit the resizing of bands. + int y = GET_Y_LPARAM(lparam); + + if (y <= GetRowHeight(0)) + return 0; // Throw this message away. + } + } + + return FinalWindowProc(msg, wparam, lparam); + } + + // Called when a child toolbar window is resized. + inline LRESULT CReBar::OnToolBarResize(UINT msg, WPARAM wparam, LPARAM lparam) + { + HWND toolBar = reinterpret_cast(wparam); + LPSIZE pToolBarSize = reinterpret_cast(lparam); + int band = GetBand(toolBar); + if (band != -1) + ResizeBand(band, *pToolBarSize); + + return FinalWindowProc(msg, wparam, lparam); + } + + // Called when a child toolbar window is resizing. + inline LRESULT CReBar::OnTBWinPosChanging(UINT, WPARAM, LPARAM) + { + // Adjust size for toolbars inside a rebar. + ReBarTheme* pTheme = reinterpret_cast( + GetParent().SendMessage(UWM_GETRBTHEME, 0, 0)); + + return (pTheme && pTheme->UseThemes && pTheme->ShortBands) ? TRUE : FALSE; + } + + // Sets a band's size. + inline BOOL CReBar::ResizeBand(int band, const CSize& size) const + { + assert(IsWindow()); + + REBARBANDINFO rbbi = {}; + rbbi.cbSize = GetSizeofRBBI(); + rbbi.fMask = RBBIM_CHILDSIZE | RBBIM_SIZE; + + UINT cx = static_cast(size.cx); + UINT cy = static_cast(size.cy); + GetBandInfo(band, rbbi); + rbbi.cx = cx; + rbbi.cxMinChild = cx; + rbbi.cyMinChild = cy; + rbbi.cyMaxChild = cy; + + return SetBandInfo(band, rbbi ); + } + + // Sets the band's bitmaps. + inline BOOL CReBar::SetBandBitmap(int band, HBITMAP background) const + { + assert(IsWindow()); + + REBARBANDINFO rbbi = {}; + rbbi.cbSize = GetSizeofRBBI(); + rbbi.fMask = RBBIM_STYLE; + GetBandInfo(band, rbbi); + rbbi.fMask |= RBBIM_BACKGROUND; + rbbi.hbmBack = background; + + WPARAM wparam = static_cast(band); + LPARAM lparam = reinterpret_cast(&rbbi); + return static_cast(SendMessage(RB_SETBANDINFO, wparam, lparam)); + } + + // Sets the band's color. + // Note: No effect with XP themes enabled + // No effect if a bitmap has been set + inline BOOL CReBar::SetBandColor(int band, COLORREF foreground, + COLORREF background) const + { + assert(IsWindow()); + + REBARBANDINFO rbbi = {}; + rbbi.cbSize = GetSizeofRBBI(); + rbbi.fMask = RBBIM_COLORS; + rbbi.clrFore = foreground; + rbbi.clrBack = background; + + WPARAM wparam = static_cast(band); + LPARAM lparam = reinterpret_cast(&rbbi); + return static_cast(SendMessage(RB_SETBANDINFO, wparam, lparam)); + } + + // Sets the characteristics of a rebar control. + // Refer to RB_SETBANDINFO in the Windows API documentation for more information. + inline BOOL CReBar::SetBandInfo(int band, REBARBANDINFO& bandInfo) const + { + assert(IsWindow()); + assert(band >= 0); + + bandInfo.cbSize = GetSizeofRBBI(); + WPARAM wparam = static_cast(band); + LPARAM lparam = reinterpret_cast(&bandInfo); + return static_cast(SendMessage(RB_SETBANDINFO, wparam, lparam)); + } + + // REBARINFO associates an image list with the rebar. + // A band will also need to set RBBIM_IMAGE. + // Refer to RB_SETBARINFO in the Windows API documentation for more information. + inline BOOL CReBar::SetBarInfo(REBARINFO& rebarInfo) const + { + assert(IsWindow()); + + rebarInfo.cbSize = sizeof(rebarInfo); + LPARAM lparam = reinterpret_cast(&rebarInfo); + return static_cast(SendMessage(RB_SETBARINFO, 0, lparam)); + } + + // Show or hide a band. + // Refer to RB_SHOWBAND in the Windows API documentation for more information. + inline BOOL CReBar::ShowBand(int band, BOOL show) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(band); + LPARAM lparam = static_cast(show); + return static_cast(SendMessage(RB_SHOWBAND, wparam, lparam)); + } + + // Show or hide the band's gripper. + inline BOOL CReBar::ShowGripper(int band, BOOL show) const + { + assert(IsWindow()); + + REBARBANDINFO rbbi = {}; + rbbi.cbSize = GetSizeofRBBI(); + rbbi.fMask = RBBIM_STYLE; + GetBandInfo(band, rbbi); + if (show) + { + rbbi.fStyle |= RBBS_GRIPPERALWAYS; + rbbi.fStyle &= ~RBBS_NOGRIPPER; + } + else + { + rbbi.fStyle &= ~RBBS_GRIPPERALWAYS; + rbbi.fStyle |= RBBS_NOGRIPPER; + } + + return SetBandInfo(band, rbbi); + } + + // Attempts to find the best layout of the bands for the given rectangle. + // The rebar bands will be arranged and wrapped as necessary to fit the rectangle. + // Refer to RB_SIZETORECT in the Windows API documentation for more information. + inline BOOL CReBar::SizeToRect(RECT& rect) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&rect); + return static_cast(SendMessage(RB_SIZETORECT, 0, lparam)); + } + + // Associates a ToolTip control with the rebar control. + // Refer to RB_SETTOOLTIPS in the Windows API documentation for more information. + inline void CReBar::SetToolTips(HWND toolTip) const + { + assert(IsWindow()); + WPARAM wparam = reinterpret_cast(toolTip); + SendMessage(RB_SETTOOLTIPS, wparam, 0); + } + + // Provides default processing of this window's messages. + inline LRESULT CReBar::WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) + { + + switch (msg) + { + case WM_MOUSEMOVE: return OnMouseMove(msg, wparam, lparam); + case WM_LBUTTONDOWN: return OnLButtonDown(msg, wparam, lparam); + case WM_LBUTTONUP: return OnLButtonUp(msg, wparam, lparam); + + // Messages defined by Win32++. + case UWM_TBRESIZE: return OnToolBarResize(msg, wparam, lparam); + case UWM_TBWINPOSCHANGING: return OnTBWinPosChanging(msg, wparam, lparam); + } + + // Pass unhandled messages on for default processing. + return CWnd::WndProcDefault(msg, wparam, lparam); + } + +} // namespace Win32xx + +#endif // _WIN32XX_REBAR_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_rect.h b/packages/media/cpp/packages/Win32xx/include/wxx_rect.h new file mode 100644 index 00000000..68842839 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_rect.h @@ -0,0 +1,230 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////// +// wxx_rect.h +// Definitions of the CSize, CPoint and CRect classes. + + +#ifndef _WIN32XX_RECT_H_ +#define _WIN32XX_RECT_H_ + + +namespace Win32xx +{ + // Forward declarations + class CPoint; + class CRect; + + + //////////////////////////////////////////////////////// + // This class can be used to replace the SIZE structure. + class CSize : public SIZE + { + public: + CSize() { cx = 0; cy = 0; } + CSize(int CX, int CY) { cx = CX; cy = CY; } + CSize(SIZE sz) { cx = sz.cx; cy = sz.cy; } + CSize(POINT pt) { cx = pt.x; cy = pt.y; } + CSize(DWORD dw) { cx = (short)LOWORD(dw); cy = (short)HIWORD(dw); } + void SetSize(int CX, int CY) { cx = CX; cy = CY; } + + // Operators + operator LPSIZE() { return this; } + bool operator==(CSize sz) const { return (cx == sz.cx && cy == sz.cy); } + bool operator!=(CSize sz) const { return (cx != sz.cx || cy != sz.cy); } + void operator+=(SIZE sz) { cx += sz.cx; cy += sz.cy; } + void operator-=(SIZE sz) { cx -= sz.cx; cy -= sz.cy; } + + // Operators returning CSize + CSize operator-() const { return CSize (-cx, -cy); } + CSize operator+(SIZE sz) const { return CSize (cx + sz.cx, cy + sz.cy); } + CSize operator-(SIZE sz) const { return CSize (cx - sz.cx, cy - sz.cy); } + + // Operators returning CPoint + CPoint operator+(POINT point) const; + CPoint operator-(POINT point) const; + + // Operators returning CRect + CRect operator+(LPCRECT prc) const; + CRect operator-(LPCRECT prc) const; + }; + + + ///////////////////////////////////////////////////////// + // This class can be used to replace the POINT structure. + class CPoint : public POINT + { + public: + CPoint() { x = 0; y = 0; } + CPoint(int X, int Y) { x = X; y = Y; } + CPoint(POINT pt) { x = pt.x ; y = pt.y; } + CPoint(POINTS pts) { x = pts.x; y = pts.y; } + CPoint(SIZE sz) { x = sz.cx; y = sz.cy; } + CPoint(LPARAM dwPos) { x = GET_X_LPARAM(dwPos); y = GET_Y_LPARAM(dwPos); } + + void Offset(int dx, int dy) { x += dx; y += dy; } + void Offset(POINT pt) { x += pt.x; y += pt.y; } + void Offset(SIZE sz) { x += sz.cx; y += sz.cy; } + void SetPoint(int X, int Y) { x = X; y = Y; } + + // Operators + operator LPPOINT() { return this; } + bool operator==(CPoint pt) const { return ((x == pt.x) && (y == pt.y)); } + bool operator!=(CPoint pt) const { return ((x != pt.x) || (y != pt.y)); } + void operator+=(SIZE sz) { x += sz.cx; y += sz.cy; } + void operator-=(SIZE sz) { x -= sz.cx; y -= sz.cy; } + void operator+=(POINT pt) { x += pt.x; y += pt.y; } + void operator-=(POINT pt) { x -= pt.x; y -= pt.y; } + + // Operators returning CPoint + CPoint operator-() const { return CPoint(-x, -y); } + CPoint operator+(SIZE sz) const { return CPoint(x + sz.cx, y + sz.cy); } + CPoint operator-(SIZE sz) const { return CPoint(x - sz.cx, y - sz.cy); } + CPoint operator+(POINT pt) const { return CPoint(x + pt.x, y + pt.y); } + CPoint operator-(POINT pt) const { return CPoint(x - pt.x, y - pt.y); } + + // Operators returning CRect + CRect operator+(LPCRECT prc) const; + CRect operator-(LPCRECT prc) const; + }; + + + //////////////////////////////////////////////////////// + // This class can be used to replace the RECT structure. + class CRect : public RECT + { + public: + CRect() { left = top = right = bottom = 0; } + CRect(int l, int t, int r, int b) { left = l; top = t; right = r; bottom = b; } + CRect(RECT rc) { left = rc.left; top = rc.top; right = rc.right; bottom = rc.bottom; } + CRect(POINT pt, SIZE sz) { right = (left = pt.x) + sz.cx; bottom = (top = pt.y) + sz.cy; } + CRect(POINT topLeft, POINT bottomRight) { left = topLeft.x; top = topLeft.y; right = bottomRight.x; bottom = bottomRight.y; } + + BOOL CopyRect(LPCRECT prc) { return ::CopyRect(this, prc); } + BOOL DeflateRect(int x, int y) { return ::InflateRect(this, -x, -y); } + BOOL DeflateRect(SIZE size) { return ::InflateRect(this, -size.cx, -size.cy); } + void DeflateRect(LPCRECT prc) { left += prc->left; top += prc->top; right -= prc->right; bottom -= prc->bottom; } + void DeflateRect(int l, int t, int r, int b){ left += l; top += t; right -= r; bottom -= b; } + BOOL EqualRect(LPRECT prc) const { return ::EqualRect(prc, this); } + BOOL InflateRect(int dx, int dy) { return ::InflateRect(this, dx, dy); } + BOOL InflateRect(SIZE sz) { return ::InflateRect(this, sz.cx, sz.cy); } + void InflateRect(LPCRECT prc) { left -= prc->left; top -= prc->top; right += prc->right; bottom += prc->bottom; } + void InflateRect(int l, int t, int r, int b){ left -= l; top -= t; right += r; bottom += b; } + BOOL IntersectRect(LPCRECT prc1, LPCRECT prc2) { return ::IntersectRect(this, prc1, prc2); } + BOOL IsRectEmpty() const { return ::IsRectEmpty(this);} + BOOL IsRectNull() const { return (left == 0 && right == 0 && top == 0 && bottom == 0); } + CRect MulDiv(int mult, int div) const { return CRect ((left * mult) / div, (top * mult) / div, + (right * mult) / div, (bottom * mult) / div); } + void NormalizeRect() { int temp; if (left > right) { temp = left; left = right; right = temp; } + if (top > bottom) { temp = top; top = bottom; bottom = temp; } } + BOOL OffsetRect(int dx, int dy) { return ::OffsetRect(this, dx, dy); } + BOOL OffsetRect(POINT pt) { return ::OffsetRect(this, pt.x, pt.y); } + BOOL OffsetRect(SIZE size) { return ::OffsetRect(this, size.cx, size.cy); } + BOOL PtInRect(POINT pt) const { return ::PtInRect(this, pt); } + BOOL SetRect(int l, int t, int r, int b) { return ::SetRect(this, l, t, r, b); } + BOOL SetRect(POINT topLeft, POINT bottomRight) { return ::SetRect(this, topLeft.x, topLeft.y, bottomRight.x, bottomRight.y); } + BOOL SetRectEmpty() { return ::SetRectEmpty(this); } + BOOL SubtractRect(LPCRECT prc1, LPCRECT prc2) { return ::SubtractRect(this, prc1, prc2); } + BOOL UnionRect(LPCRECT prc1, LPCRECT prc2) { return ::UnionRect(this, prc1, prc2); } + + // Reposition rectangle + void MoveToX (int x) { right = Width() + x; left = x; } + void MoveToY (int y) { bottom = Height() + y; top = y; } + void MoveToXY (int x, int y) { MoveToX(x); MoveToY(y); } + void MoveToXY (POINT pt) { MoveToX (pt.x); MoveToY (pt.y); } + + // Attributes + int Height() const { return bottom - top; } + int Width() const { return right - left; } + CSize Size() const { return CSize(Width(), Height()); } + CPoint CenterPoint() const { return CPoint((left + right) / 2, (top + bottom) / 2); } + CPoint TopLeft() const { return CPoint(left, top); } + CPoint BottomRight() const { return CPoint(right, bottom); } + + // operators + operator LPRECT() { return this; } + operator LPCRECT() const { return this; } + bool operator==(CRect rc) const { return (::EqualRect(this, &rc) != 0); } + bool operator!=(CRect rc) const { return (::EqualRect(this, &rc) == 0); } + void operator+=(POINT pt) { ::OffsetRect(this, pt.x, pt.y); } + void operator+=(SIZE size) { ::OffsetRect(this, size.cx, size.cy); } + void operator+=(LPCRECT prc) { ::InflateRect(this, prc->right - prc->left, prc->bottom - prc->top); } + void operator-=(LPCRECT prc) { ::InflateRect(this, prc->left - prc->right, prc->top - prc->bottom); } + void operator-=(POINT pt) { ::OffsetRect(this, -pt.x, -pt.y); } + void operator-=(SIZE sz) { ::OffsetRect(this, -sz.cx, -sz.cy); } + void operator&=(RECT rc) { ::IntersectRect(this, this, &rc); } + void operator|=(RECT rc) { ::UnionRect(this, this, &rc); } + + // Operators returning CRect + CRect operator+(POINT pt) const { CRect rc(*this); ::OffsetRect(&rc, pt.x, pt.y); return rc; } + CRect operator-(POINT pt) const { CRect rc(*this); ::OffsetRect(&rc, -pt.x, -pt.y); return rc; } + CRect operator+(SIZE sz) const { CRect rc(*this); ::OffsetRect(&rc, sz.cx, sz.cy); return rc; } + CRect operator-(SIZE sz) const { CRect rc(*this); ::OffsetRect(&rc, -sz.cx, -sz.cy); return rc; } + CRect operator+(LPRECT prc) const { CRect rc1(*this); rc1.InflateRect(prc); return rc1; } + CRect operator-(LPRECT prc) const { CRect rc1(*this); rc1.DeflateRect(prc); return rc1; } + CRect operator&(RECT rc) const { CRect rc1; ::IntersectRect(&rc1, this, &rc); return rc1; } + CRect operator|(RECT rc) const { CRect rc1; ::UnionRect(&rc1, this, &rc); return rc1; } + }; + + // CSize member function definitions + inline CPoint CSize::operator+(POINT pt) const { return CPoint(cx + pt.x, cy + pt.y); } + inline CPoint CSize::operator-(POINT pt) const { return CPoint(cx - pt.x, cy - pt.y); } + inline CRect CSize::operator+(LPCRECT prc) const { return CRect(*prc) + *this; } + inline CRect CSize::operator-(LPCRECT prc) const { return CRect(*prc) - *this; } + + // CPoint member function definitions + inline CRect CPoint::operator+(LPCRECT prc) const { return CRect(*prc) + *this; } + inline CRect CPoint::operator-(LPCRECT prc) const { return CRect(*prc) - *this; } + + + //////////////////// + // Global Functions. + // + + // Returns a CPoint holding the current cursor position. + inline CPoint GetCursorPos() + { + CPoint pt; + ::GetCursorPos(&pt); + return pt; + } + +} // namespace Win32xx + +#endif // _WIN32XX_RECT_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_regkey.h b/packages/media/cpp/packages/Win32xx/include/wxx_regkey.h new file mode 100644 index 00000000..49ea197d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_regkey.h @@ -0,0 +1,462 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////// +// wxx_regkey.h +// Declaration of the CRegKey class + +#ifndef _WIN32XX_REGKEY_H_ +#define _WIN32XX_REGKEY_H_ + +namespace Win32xx +{ + /////////////////////////////////////////////////////////// + // The CRegKey class manages access to the system registry. + // It provides a means of creating, querying, modifying and + // deleting registry entries. + class CRegKey + { + public: + CRegKey(); + CRegKey(HKEY key); + CRegKey(const CRegKey&); + virtual ~CRegKey(); + operator HKEY() const { return m_key; } + CRegKey& operator =(CRegKey& key); + + void Attach(HKEY key); + LONG Close(); + LONG Create(HKEY keyParent, LPCTSTR keyName, LPTSTR className = REG_NONE, + DWORD options = REG_OPTION_NON_VOLATILE, + REGSAM samDesired = KEY_READ | KEY_WRITE, + LPSECURITY_ATTRIBUTES secAttr = nullptr, + LPDWORD disposition = nullptr); + LONG DeleteSubKey(LPCTSTR subKey) const; + LONG DeleteValue(LPCTSTR subKey) const; + HKEY Detach(); + LONG EnumKey(DWORD index, LPTSTR name, LPDWORD nameLength, FILETIME* lastWriteTime = nullptr) const; + LONG Flush() const; + HKEY GetKey() const { return m_key; } + LONG NotifyChangeKeyValue(BOOL watchSubtree, DWORD notifyFilter, HANDLE event, BOOL isAsync = TRUE) const; + LONG Open(HKEY keyParent, LPCTSTR keyName, REGSAM samDesired = KEY_READ | KEY_WRITE); + LONG QueryBinaryValue(LPCTSTR valueName, void* value, ULONG* bytes) const; + LONG QueryBoolValue(LPCTSTR valueName, bool& value) const; + LONG QueryDWORDValue(LPCTSTR valueName, DWORD& value) const; + LONG QueryGUIDValue(LPCTSTR valueName, GUID& value) const; + LONG QueryMultiStringValue(LPCTSTR valueName, LPTSTR value, ULONG* chars) const; + LONG QueryQWORDValue(LPCTSTR valueName, ULONGLONG& value) const; + LONG QueryStringValue(LPCTSTR valueName, LPTSTR value, ULONG* chars) const; + LONG QueryValue(LPCTSTR valueName, DWORD* type, void* data, ULONG* bytes) const; + LONG RecurseDeleteKey(LPCTSTR keyName) const; + LONG SetBinaryValue(LPCTSTR valueName, const void* value, ULONG bytes) const; + LONG SetBoolValue(LPCTSTR valueName, bool& value) const; + LONG SetDWORDValue(LPCTSTR valueName, DWORD value) const; + LONG SetGUIDValue(LPCTSTR valueName, REFGUID value) const; + LONG SetKeySecurity(SECURITY_INFORMATION si, PSECURITY_DESCRIPTOR psd) const; + LONG SetMultiStringValue(LPCTSTR valueName, LPCTSTR value) const; + LONG SetQWORDValue(LPCTSTR valueName, ULONGLONG value) const; + LONG SetStringValue(LPCTSTR valueName, LPCTSTR value) const; + LONG SetValue(LPCTSTR valueName, DWORD type, const void* value, ULONG bytes) const; + + private: + LONG RecurseDeleteAllKeys(LPCTSTR keyName) const; + HKEY m_key; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + ///////////////////////////////////// + // Definitions for the CRegKey class. + // + + inline CRegKey::CRegKey() : m_key(nullptr) + { + } + + inline CRegKey::CRegKey(HKEY key) : m_key(nullptr) + { + Attach(key); + } + + inline CRegKey::CRegKey(const CRegKey& key) + { + m_key = key.m_key; + } + + inline CRegKey::~CRegKey() + { + Close(); + } + + inline CRegKey& CRegKey::operator =(CRegKey& key) + { + Close(); + Attach(key.m_key); + return *this; + } + + // Attaches a KEY handle to this CRegKey object. + inline void CRegKey::Attach(HKEY key) + { + assert(m_key == nullptr); + m_key = key; + } + + // Closes the registry key. + inline LONG CRegKey::Close() + { + LONG lRes = ERROR_SUCCESS; + + if (m_key != nullptr) + { + lRes = ::RegCloseKey(m_key); + m_key = nullptr; + } + + return lRes; + } + + // Creates the specified registry key. + inline LONG CRegKey::Create(HKEY keyParent, LPCTSTR keyName, LPTSTR className, DWORD options, + REGSAM samDesired, LPSECURITY_ATTRIBUTES secAttr, LPDWORD disposition) + { + HKEY key = nullptr; + LONG result = ::RegCreateKeyEx(keyParent, keyName, 0, className, options, samDesired, secAttr, &key, disposition); + + // RegCreateKeyEx opens existing keys, so close it now. + ::RegCloseKey(key); + + return result; + } + + // Removes the specified key from the registry. + inline LONG CRegKey::DeleteSubKey(LPCTSTR subKey) const + { + assert(m_key); + return ::RegDeleteKey(m_key, subKey); + } + + // Removes a named value from the specified registry key. + inline LONG CRegKey::DeleteValue(LPCTSTR subKey ) const + { + assert(m_key); + return ::RegDeleteValue(m_key, subKey); + } + + // Detaches the key handle from this CRegKey object. + inline HKEY CRegKey::Detach() + { + assert(m_key); + HKEY key = m_key; + m_key = nullptr; + return key; + } + + // Enumerates sub-keys of the specified open registry key. + inline LONG CRegKey::EnumKey(DWORD index, LPTSTR name, LPDWORD nameLength, FILETIME* lastWriteTime) const + { + assert(m_key); + return ::RegEnumKeyEx(m_key, index, name, nameLength, 0, 0, 0, lastWriteTime); + } + + // Writes all the attributes of the specified open registry key into the registry. + inline LONG CRegKey::Flush() const + { + assert(m_key); + return ::RegFlushKey(m_key); + } + + // Notifies the caller about changes to the attributes or contents of the registry key. + inline LONG CRegKey::NotifyChangeKeyValue(BOOL watchSubtree, DWORD notifyFilter, HANDLE event, BOOL isAsync) const + { + assert(m_key); + return ::RegNotifyChangeKeyValue(m_key, watchSubtree, notifyFilter, event, isAsync); + } + + // Opens the specified registry key and assigns it to this CRegKey object. + inline LONG CRegKey::Open(HKEY keyParent, LPCTSTR keyName, REGSAM samDesired) + { + assert(keyParent); + Close(); + return ::RegOpenKeyEx(keyParent, keyName, 0, samDesired, &m_key); + } + + // Retrieves the binary data for the specified value name. + inline LONG CRegKey::QueryBinaryValue(LPCTSTR valueName, void* value, ULONG* bytes) const + { + assert(m_key); + LONG result = ERROR_CANTREAD; + DWORD type = 0; + if (ERROR_SUCCESS == ::RegQueryValueEx(m_key, valueName, 0, &type, nullptr, nullptr)) + { + if (type == REG_BINARY) + result = ::RegQueryValueEx(m_key, valueName, 0, &type, static_cast(value), bytes); + } + + return result; + } + + // Retrieves the bool data for the specified value name. + inline LONG CRegKey::QueryBoolValue(LPCTSTR valueName, bool& value) const + { + assert(m_key); + ULONG boolSize = sizeof(bool); + return QueryBinaryValue(valueName, &value, &boolSize); + } + + // Retrieves the DWORD data for the specified value name. + inline LONG CRegKey::QueryDWORDValue(LPCTSTR valueName, DWORD& value) const + { + assert(m_key); + LONG result = ERROR_CANTREAD; + DWORD type = 0; + DWORD bytes = sizeof(DWORD); + if (ERROR_SUCCESS == ::RegQueryValueEx(m_key, valueName, 0, &type, nullptr, nullptr)) + { + if (type == REG_DWORD) + result = ::RegQueryValueEx(m_key, valueName, 0, &type, reinterpret_cast(&value), &bytes); + } + + return result; + } + + // Retrieves the GUID data for the specified value name. + inline LONG CRegKey::QueryGUIDValue(LPCTSTR valueName, GUID& value) const + { + assert(m_key); + + TCHAR szGUID[64]; + value = GUID_NULL; + ULONG count = 64; + LONG result = QueryStringValue(valueName, szGUID, &count); + + if (result == ERROR_SUCCESS) + { + HRESULT hr = ::CLSIDFromString(TtoOLE(szGUID), &value); + + if (FAILED(hr)) + result = ERROR_INVALID_DATA; + } + + return result; + } + + // Retrieves the multi-string data for the specified value name. + inline LONG CRegKey::QueryMultiStringValue(LPCTSTR valueName, LPTSTR value, ULONG* chars) const + { + assert(m_key); + LONG result = ERROR_CANTREAD; + DWORD type = 0; + if (ERROR_SUCCESS == ::RegQueryValueEx(m_key, valueName, 0, &type, nullptr, nullptr)) + { + if (type == REG_MULTI_SZ) + result = ::RegQueryValueEx(m_key, valueName, 0, &type, reinterpret_cast(value), chars); + } + + return result; + } + + // Retrieves the QWORD data for a specified value name. + inline LONG CRegKey::QueryQWORDValue(LPCTSTR valueName, ULONGLONG& value) const + { + assert(m_key); + DWORD bytes = sizeof(ULONGLONG); + LONG result = ERROR_CANTREAD; + DWORD type = 0; + if (ERROR_SUCCESS == ::RegQueryValueEx(m_key, valueName, 0, &type, nullptr, nullptr)) + { + if (type == REG_QWORD) + result = ::RegQueryValueEx(m_key, valueName, 0, &type, reinterpret_cast(&value), &bytes); + } + + return result; + } + + // Retrieves the string data for the specified value name. + inline LONG CRegKey::QueryStringValue(LPCTSTR valueName, LPTSTR value, ULONG* chars) const + { + assert(m_key); + LONG result = ERROR_CANTREAD; + DWORD type = 0; + if (ERROR_SUCCESS == ::RegQueryValueEx(m_key, valueName, 0, &type, nullptr, nullptr)) + { + if (type == REG_SZ) + result = ::RegQueryValueEx(m_key, valueName, 0, &type, reinterpret_cast(value), chars); + } + + return result; + } + + // Retrieves the data for the specified value name. + inline LONG CRegKey::QueryValue(LPCTSTR valueName, DWORD* type, void* data, ULONG* bytes) const + { + assert(m_key); + return ::RegQueryValueEx(m_key, valueName, 0, type, static_cast(data), bytes); + } + + // Private recursive function called by RecurseDeleteKey. + inline LONG CRegKey::RecurseDeleteAllKeys(LPCTSTR keyName) const + { + assert(m_key); + assert(keyName); + + CRegKey key; + LONG result = key.Open(m_key, keyName, KEY_READ | KEY_WRITE); + if (result != ERROR_SUCCESS) + return result; + + FILETIME time; + DWORD size = MAX_PATH; + TCHAR subKey[MAX_PATH]; + while (ERROR_SUCCESS == ::RegEnumKeyEx(key, 0, subKey, &size, nullptr, nullptr, nullptr, &time)) + { + result = key.RecurseDeleteAllKeys(subKey); + if (result != ERROR_SUCCESS) + return result; + size = MAX_PATH; + } + + key.Close(); + return DeleteSubKey(keyName); + } + + // Removes the specified key and any sub-keys from the registry. + inline LONG CRegKey::RecurseDeleteKey(LPCTSTR keyName) const + { + assert(m_key); + + CRegKey key; + LONG result = key.Open(m_key, keyName, KEY_READ | KEY_WRITE); + key.Close(); + RecurseDeleteAllKeys(keyName); + return result; + } + + // Sets the binary value of the registry key. + inline LONG CRegKey::SetBinaryValue(LPCTSTR valueName, const void* value, ULONG bytes) const + { + assert(m_key); + return ::RegSetValueEx(m_key, valueName, 0, REG_BINARY, static_cast(value), bytes); + } + + // Sets the bool value of the registry key. + inline LONG CRegKey::SetBoolValue(LPCTSTR valueName, bool& value) const + { + assert(m_key); + ULONG boolSize = sizeof(bool); + return SetBinaryValue(valueName, &value, boolSize); + } + + // Sets the DWORD value of the registry key. + inline LONG CRegKey::SetDWORDValue(LPCTSTR valueName, DWORD value) const + { + assert(m_key); + return ::RegSetValueEx(m_key, valueName, 0, REG_DWORD, reinterpret_cast(&value), sizeof(DWORD)); + } + + // Sets the GUID value of the registry key. + inline LONG CRegKey::SetGUIDValue(LPCTSTR valueName, REFGUID value) const + { + assert(m_key); + OLECHAR szGUID[64]; + if (::StringFromGUID2(value, szGUID, 64) == 0) + return ERROR_INSUFFICIENT_BUFFER; + else + return SetStringValue(valueName, OLEtoT(szGUID)); + } + + // Sets the security of the registry key. + inline LONG CRegKey::SetKeySecurity(SECURITY_INFORMATION si, PSECURITY_DESCRIPTOR psd) const + { + assert(m_key); + return ::RegSetKeySecurity(m_key, si, psd); + } + + // Sets the multistring value of the registry key. + // The value string should be double null terminated. + inline LONG CRegKey::SetMultiStringValue(LPCTSTR valueName, LPCTSTR value) const + { + assert(m_key); + assert(value); + + // pszValue contains one or more null terminated strings. + // Calculate the length of all strings including the terminating characters. + ULONG bytes = sizeof(TCHAR); + LPCTSTR temp = value; + int length = lstrlen(temp) +1; // +1 to include the terminating character + + while (length != 1) + { + temp += length; + bytes += length * sizeof(TCHAR); + length = lstrlen(temp) +1; + } + + return ::RegSetValueEx(m_key, valueName, 0, REG_MULTI_SZ, reinterpret_cast(value), bytes); + } + + // Sets the string value of the registry key. + inline LONG CRegKey::SetStringValue(LPCTSTR valueName, LPCTSTR value) const + { + assert(m_key); + return ::RegSetValueEx(m_key, valueName, 0, REG_SZ, reinterpret_cast(value), (lstrlen(value)+1)*sizeof(TCHAR)); + } + + // Sets the QWORD value of the registry key. + inline LONG CRegKey::SetQWORDValue(LPCTSTR valueName, ULONGLONG value) const + { + assert(m_key); + return ::RegSetValueEx(m_key, valueName, 0, REG_QWORD, reinterpret_cast(&value), sizeof(ULONGLONG) ); + } + + // Sets the value of the registry key. + inline LONG CRegKey::SetValue(LPCTSTR valueName, DWORD type, const void* value, ULONG bytes) const + { + assert(m_key); + return ::RegSetValueEx(m_key, valueName, 0, type, reinterpret_cast(value), bytes); + } + +} + + +#endif // defined _WIN32XX_REGKEY_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_ribbon.h b/packages/media/cpp/packages/Win32xx/include/wxx_ribbon.h new file mode 100644 index 00000000..7159d390 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_ribbon.h @@ -0,0 +1,596 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////// +// wxx_ribbon.h +// Declaration of the following classes: +// CRibbon, CRibbonFrameT, CRibbonFrame, CRibbonDockFrame +// CRibbonMDIFrame and CRibbonMDIDockFrame. +// + +#ifndef _WIN32XX_RIBBON_H_ +#define _WIN32XX_RIBBON_H_ + + +// Notes : +// 1) To compile code using the Ribbon UI you will need a Microsoft compiler. +// Visual Studio Community 2013 (or later) is recommended, but older +// Microsoft compilers can be used with the Windows 7 SDK. +// 2) The Ribbon UI only runs on Windows 7 or later operating systems.If the +// code is run on an earlier operating system, it reverts back to a menu +// and toolbar. + +#include // Contained within the Windows 7 SDK +#include + +#include "wxx_frame.h" +#include "wxx_dockframe.h" + +namespace Win32xx +{ + //////////////////////////////////////////////////////////// + // The CRibbon class is used to add the Ribbon to a window. + // The ribbon user interface typically replaces the menu and + // toolbar used by a frame window. + class CRibbon : public IUICommandHandler, public IUIApplication + { + public: + CRibbon(); + virtual ~CRibbon() = default; + + // IUIApplication methods + virtual STDMETHODIMP OnCreateUICommand(UINT32 nCmdID, __in UI_COMMANDTYPE typeID, + __deref_out IUICommandHandler** ppCommandHandler) override; + virtual STDMETHODIMP OnDestroyUICommand(UINT32 commandId, __in UI_COMMANDTYPE typeID, + __in_opt IUICommandHandler* commandHandler) override; + virtual STDMETHODIMP OnViewChanged(UINT32 viewId, __in UI_VIEWTYPE typeId, + __in IUnknown* pView, UI_VIEWVERB verb, INT uReasonCode) override; + + // IUICommandHandle methods + virtual STDMETHODIMP Execute(UINT32 nCmdID, UI_EXECUTIONVERB verb, + __in_opt const PROPERTYKEY* key, __in_opt const PROPVARIANT* value, + __in_opt IUISimplePropertySet* pCommandExecutionProperties) override; + virtual STDMETHODIMP UpdateProperty(UINT32 nCmdID, __in REFPROPERTYKEY key, + __in_opt const PROPVARIANT* currentValue, __out PROPVARIANT* newValue) override; + virtual STDMETHODIMP CreateRibbon(HWND wnd); + virtual STDMETHODIMP DestroyRibbon(); + + // IUnknown methods. + STDMETHODIMP_(ULONG) AddRef() override; + STDMETHODIMP_(ULONG) Release() override; + STDMETHODIMP QueryInterface(REFIID iid, void** ppObject) override; + + // Other + STDMETHODIMP_(IUIFramework*) GetRibbonFramework() const { return m_pRibbonFramework; } + STDMETHODIMP_(UINT32) GetRibbonHeight() const; + + private: + CRibbon(const CRibbon&) = delete; + CRibbon& operator=(const CRibbon&) = delete; + + IUIFramework* m_pRibbonFramework; + }; + + /////////////////////////////////////////////////// + // Declaration of the CRibbonFrameT class template. + // + + // The CRibbonFrameT is the base class for frames that support the Ribbon Framework. + // The T parameter can be either CFrame, CDockFrame, CMDIFrame or CMDIDockFrame. + template + class CRibbonFrameT : public T, public CRibbon + { + public: + // A nested class for the MRU item properties + class CRecentFiles : public IUISimplePropertySet + { + public: + CRecentFiles(PWSTR pFullPath); + virtual ~CRecentFiles() = default; + + // IUnknown methods. + STDMETHODIMP_(ULONG) AddRef() override; + STDMETHODIMP_(ULONG) Release() override; + STDMETHODIMP QueryInterface(REFIID iid, void** ppObject) override; + + // IUISimplePropertySet methods + STDMETHODIMP GetValue(__in REFPROPERTYKEY key, __out PROPVARIANT* value) override; + + private: + WCHAR m_displayName[MAX_PATH]; + WCHAR m_fullPath[MAX_PATH]; + }; + + using RecentFilesPtr = std::unique_ptr; + + CRibbonFrameT() = default; + virtual ~CRibbonFrameT() override = default; + + protected: + virtual CRect GetViewRect() const override; + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual void OnDestroy() override; + virtual STDMETHODIMP OnViewChanged(UINT32 viewId, UI_VIEWTYPE typeId, + IUnknown* pView, UI_VIEWVERB verb, INT32 reasonCode) override; + virtual HRESULT PopulateRibbonRecentItems(PROPVARIANT* value); + virtual void UpdateMRUMenu() override; + + private: + CRibbonFrameT(const CRibbonFrameT&) = delete; + CRibbonFrameT& operator=(const CRibbonFrameT&) = delete; + + std::vector m_recentFiles; + }; + + ///////////////////////////////////////////////// + // This class provides an SDI frame with a Ribbon + // Framework. + class CRibbonFrame : public CRibbonFrameT + { + public: + CRibbonFrame() = default; + virtual ~CRibbonFrame() override = default; + + private: + CRibbonFrame(const CRibbonFrame&) = delete; + CRibbonFrame& operator=(const CRibbonFrame&) = delete; + }; + + ///////////////////////////////////////////////////// + // CRibbonDockFrame manages a frame that supports the + // ribbon user interface and docking. + class CRibbonDockFrame : public CRibbonFrameT + { + public: + CRibbonDockFrame() = default; + virtual ~CRibbonDockFrame() override = default; + + private: + CRibbonDockFrame(const CRibbonDockFrame&) = delete; + CRibbonDockFrame& operator=(const CRibbonDockFrame&) = delete; + }; + + ///////////////////////////////////////////////////////////// + // CRibbonMDIFrame manages a frame that supports the Multiple + // Document Interface (MDI) and the Ribbon user interface. + class CRibbonMDIFrame : public CRibbonFrameT + { + public: + CRibbonMDIFrame() = default; + virtual ~CRibbonMDIFrame() override = default; + + private: + CRibbonMDIFrame(const CRibbonMDIFrame&) = delete; + CRibbonMDIFrame& operator=(const CRibbonMDIFrame&) = delete; + }; + + //////////////////////////////////////////////////////////////// + // CRibbonMDIDockFrame manages a frame that supports the + // Multiple Document Interface (MDI), the Ribbon user interface, + // and docking. + class CRibbonMDIDockFrame : public CRibbonFrameT + { + public: + CRibbonMDIDockFrame() = default; + virtual ~CRibbonMDIDockFrame() override = default; + + private: + CRibbonMDIDockFrame(const CRibbonMDIDockFrame&) = delete; + CRibbonMDIDockFrame& operator=(const CRibbonMDIDockFrame&) = delete; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + ///////////////////////////////////// + // Definitions for the CRibbon class. + // + + inline CRibbon::CRibbon() : m_pRibbonFramework(nullptr) + { + } + + + /////////////////////////////////// + // IUnknown method implementations. + + + inline STDMETHODIMP_(ULONG) CRibbon::AddRef() + { + // Automatic deletion is not required. + return 1; + } + + inline STDMETHODIMP_(ULONG) CRibbon::Release() + { + // Automatic deletion is not required. + return 1; + } + + // Responds to execute events on Commands bound to the Command handler. + inline STDMETHODIMP CRibbon::Execute(UINT32, UI_EXECUTIONVERB, + __in_opt const PROPERTYKEY*, __in_opt const PROPVARIANT*, + __in_opt IUISimplePropertySet*) + { + return E_NOTIMPL; + } + + inline STDMETHODIMP CRibbon::QueryInterface(REFIID iid, void** ppObject) + { + if (iid == __uuidof(IUnknown)) + { + *ppObject = static_cast(static_cast(this)); + } + else if (iid == __uuidof(IUICommandHandler)) + { + *ppObject = static_cast(this); + } + else if (iid == __uuidof(IUIApplication)) + { + *ppObject = static_cast(this); + } + else + { + *ppObject = nullptr; + return E_NOINTERFACE; + } + + return S_OK; + } + + + // Called by the Ribbon framework for each command specified in markup, + // to bind the Command to an IUICommandHandler. + inline STDMETHODIMP CRibbon::OnCreateUICommand(UINT32, + __in UI_COMMANDTYPE, __deref_out IUICommandHandler** ppCommandHandler) + { + // By default we use the single command handler provided as part of CRibbon. + // Override this function to account for multiple command handlers. + + return QueryInterface(IID_PPV_ARGS(ppCommandHandler)); + } + + // Called when the state of the Ribbon changes, for example, created, + // destroyed, or resized. + inline STDMETHODIMP CRibbon::OnViewChanged(UINT32, __in UI_VIEWTYPE, + __in IUnknown*, UI_VIEWVERB, INT) + { + return E_NOTIMPL; + } + + // Called by the Ribbon framework for each command at the time of ribbon + // destruction. + inline STDMETHODIMP CRibbon::OnDestroyUICommand(UINT32, __in UI_COMMANDTYPE, + __in_opt IUICommandHandler*) + { + return E_NOTIMPL; + } + + // Called by the Ribbon framework when a command property (PKEY) needs to + // be updated. + inline STDMETHODIMP CRibbon::UpdateProperty(UINT32, __in REFPROPERTYKEY, + __in_opt const PROPVARIANT*, __out PROPVARIANT*) + { + return E_NOTIMPL; + } + + // Creates the ribbon. + inline STDMETHODIMP CRibbon::CreateRibbon(HWND wnd) + { + HRESULT hr; + // Instantiate the Ribbon framework object. + if (SUCCEEDED(hr = ::CoCreateInstance(CLSID_UIRibbonFramework, nullptr, + CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&m_pRibbonFramework)))) + { + // Connect the host application to the Ribbon framework. + assert(m_pRibbonFramework); + if (SUCCEEDED(hr = m_pRibbonFramework->Initialize(wnd, this))) + { + // Load the binary markup. APPLICATION_RIBBON is the default + // name generated by uicc. + hr = m_pRibbonFramework->LoadUI(::GetModuleHandle(0), L"APPLICATION_RIBBON"); + } + } + + return hr; + } + + // Destroys the ribbon. + inline STDMETHODIMP CRibbon::DestroyRibbon() + { + HRESULT hr = S_OK; + if (m_pRibbonFramework) + { + hr = m_pRibbonFramework->Destroy(); + m_pRibbonFramework->Release(); + m_pRibbonFramework = nullptr; + } + + return hr; + } + + // Retrieves the height of the ribbon. + inline STDMETHODIMP_(UINT32) CRibbon::GetRibbonHeight() const + { + HRESULT result = E_FAIL; + IUIRibbon* pRibbon = nullptr; + UINT32 ribbonHeight = 0; + + if (GetRibbonFramework()) + { + result = GetRibbonFramework()->GetView(0, IID_PPV_ARGS(&pRibbon)); + if (SUCCEEDED(result)) + { + // Call to the framework to determine the desired height of the Ribbon. + result = pRibbon->GetHeight(&ribbonHeight); + pRibbon->Release(); + } + } + + return ribbonHeight; + } + + + //////////////////////////////////////////////////// + // Definitions for the CRibbonFrameT class template. + // + + // Get the frame's client area. + template + inline CRect CRibbonFrameT::GetViewRect() const + { + CRect clientRect = T::GetClientRect(); + + clientRect.top += GetRibbonHeight(); + + if (T::GetStatusBar().IsWindow() && T::GetStatusBar().IsWindowVisible()) + clientRect = T::ExcludeChildRect(clientRect, T::GetStatusBar()); + + if (T::GetReBar().IsWindow() && T::GetReBar().IsWindowVisible()) + clientRect = T::ExcludeChildRect(clientRect, T::GetReBar()); + else + if (T::GetToolBar().IsWindow() && T::GetToolBar().IsWindowVisible()) + clientRect = T::ExcludeChildRect(clientRect, T::GetToolBar()); + + return clientRect; + } + + // OnCreate is called automatically during window creation when a + // WM_CREATE message received. + // Tasks such as setting the icon, creating child windows, or anything + // associated with creating windows are normally performed here. + template + inline int CRibbonFrameT::OnCreate(CREATESTRUCT& cs) + { + if (GetWinVersion() >= 2601) // WinVersion >= Windows 7 + { + if (SUCCEEDED(CreateRibbon(*this))) + { + T::UseReBar(FALSE); // Don't use a ReBar. + T::UseToolBar(FALSE); // Don't use a ToolBar. + } + else + { + TRACE("\n*** WARNING Failed to create Ribbon. ***\n\n"); + DestroyRibbon(); + } + } + + T::OnCreate(cs); + if (GetRibbonFramework()) + { + T::SetMenu(nullptr); // Disable the window menu. + T::SetFrameMenu(0); + } + + return 0; + } + + // Called when the ribbon frame is destroyed. + template + inline void CRibbonFrameT::OnDestroy() + { + DestroyRibbon(); + T::OnDestroy(); + } + + // Called when the ribbon's view has changed. + template + inline STDMETHODIMP CRibbonFrameT::OnViewChanged(UINT32, + UI_VIEWTYPE typeId, IUIApplication::IUnknown*, UI_VIEWVERB verb, INT32) + { + HRESULT result = E_NOTIMPL; + + // Checks to see if the view that was changed was a Ribbon view. + if (UI_VIEWTYPE_RIBBON == typeId) + { + switch (verb) + { + case UI_VIEWVERB_CREATE: // The view was newly created. + case UI_VIEWVERB_DESTROY: // The view was destroyed. + result = S_OK; + break; + case UI_VIEWVERB_SIZE: // Ribbon size has changed. + T::RecalcLayout(); + break; + case UI_VIEWVERB_ERROR: + result = E_FAIL; + break; + } + } + + return result; + } + + // Populates the ribbon's recent items list. + template + inline HRESULT CRibbonFrameT::PopulateRibbonRecentItems(PROPVARIANT* pvarValue) + { + std::vector fileNames = T::GetMRUEntries(); + HRESULT result = E_FAIL; + SAFEARRAY* psa = SafeArrayCreateVector(VT_UNKNOWN, 0, (ULONG)fileNames.size()); + m_recentFiles.clear(); + + if (psa != nullptr) + { + LONG currentFile = 0; + + for (const CString& fileName : fileNames) + { + WCHAR curFileName[MAX_PATH] = {}; + StrCopyW(curFileName, TtoW(fileName), MAX_PATH); + + m_recentFiles.push_back(std::make_unique(curFileName)); + result = SafeArrayPutElement(psa, ¤tFile, + static_cast(m_recentFiles.back().get())); + ++currentFile; + } + + SAFEARRAYBOUND sab = {static_cast(currentFile), 0}; + SafeArrayRedim(psa, &sab); + result = UIInitPropertyFromIUnknownArray(UI_PKEY_RecentItems, psa, pvarValue); + + SafeArrayDestroy(psa); // Calls release for each element in the array. + } + + return result; + } + + // Updates the frame's MRU when the Ribbon Framework isn't used. + template + inline void CRibbonFrameT::UpdateMRUMenu() + { + // Update the MRU menu when the ribbon isn't used. + if (GetRibbonFramework() == nullptr) + T::UpdateMRUMenu(); + } + + + //////////////////////////////////////////////// + // Declaration of the nested CRecentFiles class. + // + template + inline CRibbonFrameT::CRecentFiles::CRecentFiles(PWSTR fullPath) + { + SHFILEINFOW sfi = {}; + DWORD_PTR ptr = 0; + m_fullPath[0] = L'\0'; + m_displayName[0] = L'\0'; + + StrCopyW(m_fullPath, fullPath, MAX_PATH); + ptr = ::SHGetFileInfoW(fullPath, FILE_ATTRIBUTE_NORMAL, &sfi, + sizeof(sfi), SHGFI_DISPLAYNAME | SHGFI_USEFILEATTRIBUTES); + + if (ptr != 0) + { + StrCopyW(m_displayName, sfi.szDisplayName, MAX_PATH); + } + else // Provide a reasonable fall back. + { + StrCopyW(m_displayName, m_fullPath, MAX_PATH); + } + + } + + template + inline STDMETHODIMP_(ULONG) CRibbonFrameT::CRecentFiles::AddRef() + { + // Automatic deletion is not required. + return 1; + } + + template + inline STDMETHODIMP_(ULONG) CRibbonFrameT::CRecentFiles::Release() + { + // Automatic deletion is not required. + return 1; + } + + template + inline STDMETHODIMP CRibbonFrameT::CRecentFiles::QueryInterface( + REFIID iid, void** ppObject) + { + if (!ppObject) + { + return E_POINTER; + } + + if (iid == __uuidof(IUnknown)) + { + *ppObject = static_cast(this); + } + else if (iid == __uuidof(IUISimplePropertySet)) + { + *ppObject = static_cast(this); + } + else + { + *ppObject = nullptr; + return E_NOINTERFACE; + } + + return S_OK; + } + + // IUISimplePropertySet methods. + template + inline STDMETHODIMP CRibbonFrameT::CRecentFiles::GetValue( + __in REFPROPERTYKEY key, __out PROPVARIANT *ppropvar) + { + HRESULT result = HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); + + if (key == UI_PKEY_Label) + { + result = UIInitPropertyFromString(key, m_displayName, ppropvar); + } + else if (key == UI_PKEY_LabelDescription) + { + result = UIInitPropertyFromString(key, m_displayName, ppropvar); + } + + return result; + } + + +} // namespace Win32xx + +#endif // _WIN32XX_RIBBON_H_ + diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_richedit.h b/packages/media/cpp/packages/Win32xx/include/wxx_richedit.h new file mode 100644 index 00000000..d53200bc --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_richedit.h @@ -0,0 +1,1029 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +/////////////////////////////////////// +// wxx_rich_edit.h +// Declaration of the CRichEdit class. + +#ifndef _WIN32XX_RICHEDIT_H_ +#define _WIN32XX_RICHEDIT_H_ + + +#include "wxx_wincore.h" +#include +#include + + +namespace Win32xx +{ + + //////////////////////////////////////////////////////////// + // CRichEdit manages a rich edit control. Rich Edit controls + // support plain text and rich text. Rich text can utilize + // several fonts in a single document. + class CRichEdit : public CWnd + { + public: + CRichEdit(); + virtual ~CRichEdit() override; + + void AppendText(LPCTSTR text) const; + BOOL CanPaste(UINT format = 0) const; + BOOL CanRedo() const; + BOOL CanUndo() const; + int CharFromPos(CPoint pt) const; + void Clear() const; + void Copy() const; + void Cut() const; + BOOL DisplayBand(RECT rc) const; + void EmptyUndoBuffer() const; + long FindText(DWORD flags, const FINDTEXTEX& findInfo) const; + DWORD FindWordBreak(UINT code, DWORD start) const; + long FormatRange(const FORMATRANGE& fr, BOOL display = TRUE) const; + long FormatRange(BOOL display = FALSE) const; + CPoint GetCharPos(long charIndex) const; + DWORD GetDefaultCharFormat(CHARFORMAT& format) const; + DWORD GetDefaultCharFormat(CHARFORMAT2& format) const; + long GetEventMask() const; + int GetFirstVisibleLine() const; + IRichEditOle* GetIRichEditOle() const; + long GetLimitText() const; + int GetLine(int index, LPTSTR buffer) const; + int GetLine(int index, LPTSTR buffer, int maxLength) const; + int GetLineCount() const; + BOOL GetModify() const; + UINT GetOptions() const; + DWORD GetParaFormat(PARAFORMAT& format) const; + DWORD GetParaFormat(PARAFORMAT2& format) const; + BOOL GetPunctuation(UINT type, PUNCTUATION& puncInfo) const; + void GetRect(RECT& rc) const; + CRect GetRect() const; + UNDONAMEID GetRedoName() const; + void GetSel(CHARRANGE& range) const; + void GetSel(long& startChar, long& endChar) const; + DWORD GetSelectionCharFormat(CHARFORMAT& cf) const; + DWORD GetSelectionCharFormat(CHARFORMAT2& cf) const; + WORD GetSelectionType() const; + long GetSelText(LPSTR buffer) const; + CString GetSelText() const; + long GetTextLength() const; + long GetTextLengthEx(DWORD flags, UINT codePage = -1) const; + UINT GetTextMode() const; + CString GetTextRange(int first, int last) const; + UNDONAMEID GetUndoName() const; + void HideSelection(BOOL hide, BOOL isPermanent) const; + void LimitText(long limit = 0) const; + long LineFromChar(long charIndex) const; + int LineIndex(int lineIndex = -1) const; + int LineLength(int charIndex = -1) const; + void LineScroll(int lines) const; + void Paste() const; + void PasteSpecial(UINT clipFormat, DWORD aspect = 0, HMETAFILE mf = nullptr) const; + CPoint PosFromChar(UINT fromChar) const; + BOOL Redo() const; + void ReplaceSel(LPCTSTR newText, BOOL canUndo = FALSE) const; + void RequestResize() const; + BOOL SetAutoURLDetect(BOOL enable = TRUE) const; + COLORREF SetBackgroundColor(BOOL isSysColor, COLORREF color) const; + BOOL SetDefaultCharFormat(CHARFORMAT format) const; + BOOL SetDefaultCharFormat(CHARFORMAT2 format) const; + DWORD SetEventMask(DWORD eventMask) const; + void SetModify(BOOL isModified = TRUE) const; + BOOL SetOLECallback(IRichEditOleCallback* pCallback) const; + void SetOptions(WORD options, DWORD flags) const; + BOOL SetParaFormat(PARAFORMAT pf) const; + BOOL SetParaFormat(PARAFORMAT2 pf) const; + BOOL SetPunctuation(UINT type, PUNCTUATION puncInfo) const; + BOOL SetReadOnly(BOOL isReadOnly = TRUE) const; + void SetRect(RECT rc) const; + void SetSel(long startChar, long endChar) const; + void SetSel(CHARRANGE cr) const; + BOOL SetSelectionCharFormat(CHARFORMAT cf) const; + BOOL SetSelectionCharFormat(CHARFORMAT2 cf) const; + BOOL SetTargetDevice(HDC dc, long lineWidth) const; + BOOL SetTextMode(UINT mode) const; + UINT SetUndoLimit(UINT limit) const; + BOOL SetWordCharFormat(CHARFORMAT format) const; + BOOL SetWordCharFormat(CHARFORMAT2 format) const; + void StopGroupTyping() const; + long StreamIn(int format, EDITSTREAM& stream) const; + long StreamOut(int format, EDITSTREAM& stream) const; + BOOL Undo() const; + + protected: + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual void PreRegisterClass(WNDCLASS& wc) override; + + private: + CRichEdit(const CRichEdit&) = delete; + CRichEdit& operator=(const CRichEdit&) = delete; + + HMODULE m_richedit; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + ////////////////////////////////////// + // Definitions of the CRichEdit class. + // + + inline CRichEdit::CRichEdit() + { + CString system; + ::GetSystemDirectory(system.GetBuffer(MAX_PATH), MAX_PATH); + system.ReleaseBuffer(); + + m_richedit = ::LoadLibrary(system + _T("\\Msftedit.dll")); + if (m_richedit == nullptr) + throw CNotSupportedException(GetApp()->MsgRichEditDll()); + } + + inline CRichEdit::~CRichEdit() + { + // Destroy the window before freeing the DLL. + if (IsWindow()) + ::DestroyWindow(*this); + + if (m_richedit) + ::FreeLibrary(m_richedit); + } + + // Set the default window styles. + inline void CRichEdit::PreCreate(CREATESTRUCT& cs) + { + cs.style = WS_CHILD | WS_VISIBLE | ES_MULTILINE; + } + + // Set the window class + inline void CRichEdit::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = _T("RICHEDIT50W"); + } + + // Adds text to the end of the document. + inline void CRichEdit::AppendText(LPCTSTR text) const + { + LRESULT position = SendMessage(WM_GETTEXTLENGTH, 0, 0); + WPARAM wparam = static_cast(position); + LPARAM lparam = static_cast(position); + SendMessage(EM_SETSEL, wparam, lparam); + lparam = reinterpret_cast(text); + SendMessage(EM_REPLACESEL, 0, lparam); + } + + // Determines whether a rich edit control can paste a specified clipboard format. + // Refer to EM_CANPASTE in the Windows API documentation for more information. + inline BOOL CRichEdit::CanPaste(UINT format) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(format); + return static_cast(SendMessage(EM_CANPASTE, wparam, 0)); + } + + // Determines whether there are any actions in the control redo queue. + // Refer to EM_CANREDO in the Windows API documentation for more information. + inline BOOL CRichEdit::CanRedo() const + { + assert(IsWindow()); + return static_cast(SendMessage(EM_CANREDO, 0, 0)); + } + + // Determines whether there are any actions in an edit control's undo queue. + // Refer to EM_CANUNDO in the Windows API documentation for more information. + inline BOOL CRichEdit::CanUndo() const + { + assert(IsWindow()); + return static_cast(SendMessage(EM_CANUNDO, 0, 0)); + } + + // Gets information about the character closest to a specified point in the + // client area of an edit control. + // Refer to EM_CHARFROMPOS in the Windows API documentation for more information. + inline int CRichEdit::CharFromPos(CPoint pt) const + { + assert(IsWindow()); + WPARAM wparam = reinterpret_cast(&pt); + return static_cast(SendMessage(EM_CHARFROMPOS, wparam, 0)); + } + + // Delete (clear) the current selection + // Refer to WM_CLEAR in the Windows API documentation for more information. + inline void CRichEdit::Clear() const + { + assert(IsWindow()); + SendMessage(WM_CLEAR, 0, 0); + } + + // Copy the current selection to the clipboard in CF_TEXT format. + // Refer to WM_COPY in the Windows API documentation for more information. + inline void CRichEdit::Copy() const + { + assert(IsWindow()); + SendMessage(WM_COPY, 0, 0); + } + + // Delete (cut) the current selection, if any, in the edit control and copy + // the deleted text to the clipboard in CF_TEXT format. + // Refer to WM_CUT in the Windows API documentation for more information. + inline void CRichEdit::Cut() const + { + assert(IsWindow()); + SendMessage(WM_CUT, 0, 0); + } + + // Displays a portion of the contents of a rich edit control, as previously + // formatted for a device using the EM_FORMATRANGE message. + // Refer to EM_DISPLAYBAND in the Windows API documentation for more information. + inline BOOL CRichEdit::DisplayBand(RECT rc) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&rc); + return static_cast(SendMessage(EM_DISPLAYBAND, 0, lparam)); + } + + // Resets the undo flag of the rich edit control. The undo flag is set + // whenever an operation within the edit control can be undone. + // Refer to EM_EMPTYUNDOBUFFER in the Windows API documentation for more information. + inline void CRichEdit::EmptyUndoBuffer() const + { + assert(IsWindow()); + SendMessage(EM_EMPTYUNDOBUFFER, 0, 0); + } + + // Finds text within the rich edit control. + // Refer to EM_FINDTEXTEX in the Windows API documentation for more information. + inline long CRichEdit::FindText(DWORD flags, const FINDTEXTEX& findInfo) const + { + assert(IsWindow()); + + #ifdef UNICODE + UINT em_findText = EM_FINDTEXTEXW; + #else + UINT em_findText = EM_FINDTEXTEX; + #endif + + WPARAM wparam = static_cast(flags); + LPARAM lparam = reinterpret_cast(&findInfo); + return static_cast(SendMessage(em_findText, wparam, lparam)); + } + + // Finds the next word break before or after the specified character position + // or retrieves information about the character at that position. + // Refer to EM_FINDWORDBREAK in the Windows API documentation for more information. + inline DWORD CRichEdit::FindWordBreak(UINT code, DWORD start) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(code); + LPARAM lparam = static_cast(start); + return static_cast(SendMessage(EM_FINDWORDBREAK, wparam, lparam)); + } + + // Formats a range of text in a rich edit control for a specific device (e.g. printer). + // Refer to EM_FORMATRANGE in the Windows API documentation for more information. + inline long CRichEdit::FormatRange(const FORMATRANGE& fr, BOOL display /* = TRUE */) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(display); + LPARAM lparam = reinterpret_cast(&fr); + return static_cast(SendMessage(EM_FORMATRANGE, wparam, lparam)); + } + + // Free format information cached by the control. + // Refer to EM_FORMATRANGE in the Windows API documentation for more information. + inline long CRichEdit::FormatRange(BOOL display /* = FALSE */) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(display); + return static_cast(SendMessage(EM_FORMATRANGE, wparam, 0)); + } + + // Retrieves the client area coordinates of a specified character. + // Refer to EM_POSFROMCHAR in the Windows API documentation for more information. + inline CPoint CRichEdit::GetCharPos(long charIndex) const + { + assert(IsWindow()); + CPoint pt; + WPARAM wparam = reinterpret_cast(&pt); + LPARAM lparam = static_cast(charIndex); + SendMessage(EM_POSFROMCHAR, wparam, lparam); + return pt; + } + + // Retrieves the current default character formatting attributes. + // Refer to EM_GETCHARFORMAT in the Windows API documentation for more information. + inline DWORD CRichEdit::GetDefaultCharFormat(CHARFORMAT& format) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&format); + return static_cast(SendMessage(EM_GETCHARFORMAT, SCF_DEFAULT, lparam)); + } + + // Retrieves the current default character formatting attributes. + // Refer to EM_GETCHARFORMAT in the Windows API documentation for more information. + inline DWORD CRichEdit::GetDefaultCharFormat(CHARFORMAT2& cf) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&cf); + return static_cast(SendMessage(EM_GETCHARFORMAT, SCF_DEFAULT, lparam)); + } + + // Retrieves the event mask. The event mask specifies which notification + // messages the control sends to its parent window. + // Refer to EM_GETEVENTMASK in the Windows API documentation for more information. + inline long CRichEdit::GetEventMask() const + { + assert(IsWindow()); + return static_cast(SendMessage(EM_GETEVENTMASK, 0, 0)); + } + + // Gets the zero-based index of the uppermost visible line. + // Refer to EM_GETFIRSTVISIBLELINE in the Windows API documentation for more information. + inline int CRichEdit::GetFirstVisibleLine() const + { + assert(IsWindow()); + return static_cast(SendMessage(EM_GETFIRSTVISIBLELINE, 0, 0)); + } + + // Retrieves an IRichEditOle object that a client can use to access the + // rich edit control's Component Object Model (COM) functionality. + // Refer to EM_GETOLEINTERFACE in the Windows API documentation for more information. + inline IRichEditOle* CRichEdit::GetIRichEditOle() const + { + assert(IsWindow()); + + IRichEditOle* pRichEditOle = nullptr; + LPARAM lparam = reinterpret_cast(pRichEditOle); + SendMessage(EM_GETOLEINTERFACE, 0, lparam); + return pRichEditOle; + } + + // Gets the current text limit for the edit control. + // Refer to EM_GETLIMITTEXT in the Windows API documentation for more information. + inline long CRichEdit::GetLimitText() const + { + assert(IsWindow()); + return static_cast(SendMessage(EM_GETLIMITTEXT, 0, 0)); + } + + // Copies a line of text from the rich edit control and places it in the + // specified buffer. + // The buffer parameter is a pointer to the buffer that receives a copy of + // the line. Before sending the message, set the first word of this buffer + // to the size, in TCHARs, of the buffer. The copied line does not contain + // a terminating null character. + // Refer to EM_GETLINE in the Windows API documentation for more information. + inline int CRichEdit::GetLine(int index, LPTSTR buffer) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + LPARAM lparam = reinterpret_cast(buffer); + return static_cast(SendMessage(EM_GETLINE, wparam, lparam)); + } + + // Copies a line of text from the rich edit control and places it in the + // specified buffer. The copied line does not contain a terminating null + // character. + // Refer to EM_GETLINE in the Windows API documentation for more information. + inline int CRichEdit::GetLine(int index, LPTSTR buffer, int maxLength) const + { + assert(IsWindow()); + *reinterpret_cast(buffer) = static_cast(maxLength); + WPARAM wparam = static_cast(index); + LPARAM lparam = reinterpret_cast(buffer); + return static_cast(SendMessage(EM_GETLINE, wparam, lparam)); + } + + // Gets the number of lines in a multi-line edit control. + // Refer to EM_GETLINECOUNT in the Windows API documentation for more information. + inline int CRichEdit::GetLineCount() const + { + assert(IsWindow()); + return static_cast(SendMessage(EM_GETLINECOUNT, 0, 0)); + } + + // Retrieves a flag than indicates whether the contents of the edit control + // have been modified. + // Refer to EM_GETMODIFY in the Windows API documentation for more information. + inline BOOL CRichEdit::GetModify() const + { + assert(IsWindow()); + return static_cast(SendMessage(EM_GETMODIFY, 0, 0)); + } + + // Retrieves the rich edit control options. + // Refer to EM_GETOPTIONS in the Windows API documentation for more information. + inline UINT CRichEdit::GetOptions() const + { + assert(IsWindow()); + return static_cast(SendMessage(EM_GETOPTIONS, 0, 0)); + } + + // Retrieves the paragraph formatting of the current selection. + // Refer to EM_GETPARAFORMAT in the Windows API documentation for more information. + inline DWORD CRichEdit::GetParaFormat(PARAFORMAT& format) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&format); + return static_cast(SendMessage(EM_GETPARAFORMAT, 0, lparam)); + } + + // Retrieves the paragraph formatting of the current selection. + // Refer to EM_GETPARAFORMAT in the Windows API documentation for more information. + inline DWORD CRichEdit::GetParaFormat(PARAFORMAT2& pf) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&pf); + return static_cast(SendMessage(EM_GETPARAFORMAT, 0, lparam)); + } + + // Retrieves the current punctuation characters for the rich edit control. + // This is available only in Asian-language versions of the operating system. + // Refer to EM_GETPUNCTUATION in the Windows API documentation for more information. + inline BOOL CRichEdit::GetPunctuation(UINT type, PUNCTUATION& puncInfo) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(type); + LPARAM lparam = reinterpret_cast(&puncInfo); + return static_cast(SendMessage(EM_GETPUNCTUATION, wparam, lparam)); + } + + // Retrieves the formatting rectangle. The formatting rectangle is the + // limiting rectangle into which text can be drawn. + // Refer to EM_GETRECT in the Windows API documentation for more information. + inline void CRichEdit::GetRect(RECT& rc) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&rc); + SendMessage(EM_GETRECT, 0, lparam); + } + + // Retrieves the formatting rectangle. The formatting rectangle is the + // limiting rectangle into which text can be drawn. + // Refer to EM_GETRECT in the Windows API documentation for more information. + inline CRect CRichEdit::GetRect() const + { + assert(IsWindow()); + CRect rc; + LPARAM lparam = reinterpret_cast(&rc); + SendMessage(EM_GETRECT, 0, lparam); + return rc; + } + + // Retrieves the type of the next action, if any, in the control's redo queue. + // Refer to EM_GETREDONAME in the Windows API documentation for more information. + inline UNDONAMEID CRichEdit::GetRedoName() const + { + assert(IsWindow()); + + return static_cast(SendMessage(EM_GETREDONAME, 0, 0)); + } + + // Retrieves the starting and ending character positions of the selection. + // Refer to EM_EXGETSEL in the Windows API documentation for more information. + inline void CRichEdit::GetSel(CHARRANGE& range) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&range); + SendMessage(EM_EXGETSEL, 0, lparam); + } + + // Gets the starting and ending positions of the current selection. + // Refer to EM_EXGETSEL in the Windows API documentation for more information. + inline void CRichEdit::GetSel(long& startChar, long& endChar) const + { + assert(IsWindow()); + CHARRANGE range = {}; + LPARAM lparam = reinterpret_cast(&range); + SendMessage(EM_EXGETSEL, 0, lparam); + startChar = range.cpMin; + endChar = range.cpMax; + } + + // Retrieves the character formatting attributes in the current selection. + // Refer to EM_GETCHARFORMAT in the Windows API documentation for more information. + inline DWORD CRichEdit::GetSelectionCharFormat(CHARFORMAT& format) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&format); + return static_cast(SendMessage(EM_GETCHARFORMAT, SCF_SELECTION, lparam)); + } + + // Retrieves the character formatting attributes in the current selection. + // Refer to EM_GETCHARFORMAT in the Windows API documentation for more information. + inline DWORD CRichEdit::GetSelectionCharFormat(CHARFORMAT2& format) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&format); + return static_cast(SendMessage(EM_GETCHARFORMAT, SCF_SELECTION, lparam)); + } + + // Retrieves the type of contents in the current selection. + // Refer to EM_SELECTIONTYPE in the Windows API documentation for more information. + inline WORD CRichEdit::GetSelectionType() const + { + assert(IsWindow()); + return static_cast(SendMessage(EM_SELECTIONTYPE, 0, 0)); + } + + // Gets the text of the current selection. + // Refer to EM_GETSELTEXT in the Windows API documentation for more information. + inline long CRichEdit::GetSelText(LPSTR buffer) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(buffer); + return static_cast(SendMessage(EM_GETSELTEXT, 0, lparam)); + } + + // Gets the text of the current selection. + // Refer to EM_GETSELTEXT in the Windows API documentation for more information. + inline CString CRichEdit::GetSelText() const + { + assert(IsWindow()); + + CHARRANGE cr = {}; + LPARAM lparam = reinterpret_cast(&cr); + SendMessage(EM_EXGETSEL, 0, lparam); + return GetTextRange(cr.cpMin, cr.cpMax); + } + + // Retrieves the length of the text, in characters. Does not include the + // terminating null character. + // Refer to WM_GETTEXTLENGTH in the Windows API documentation for more information. + inline long CRichEdit::GetTextLength() const + { + assert(IsWindow()); + return static_cast(SendMessage(WM_GETTEXTLENGTH, 0, 0)); + } + + // Returns the number of TCHARs in the rich edit control, depending on the + // flags specified. + // Refer to EM_GETTEXTLENGTHEX in the Windows API documentation for more information. + inline long CRichEdit::GetTextLengthEx(DWORD flags, UINT codePage /* = -1 */) const + { + assert(IsWindow()); + GETTEXTLENGTHEX gtle = {}; + gtle.flags = flags; + gtle.codepage = codePage; + + WPARAM wparam = reinterpret_cast(>le); + return static_cast(SendMessage(EM_GETTEXTLENGTHEX, wparam, 0)); + } + + // Retrieves the current text mode and undo level. + // Refer to EM_GETTEXTMODE in the Windows API documentation for more information. + inline UINT CRichEdit::GetTextMode() const + { + assert(IsWindow()); + return static_cast(SendMessage(EM_GETTEXTMODE, 0, 0)); + } + + // Retrieves the specified range of text. + // Refer to EM_GETTEXTRANGE in the Windows API documentation for more information. + inline CString CRichEdit::GetTextRange(int first, int last) const + { + assert(IsWindow()); + CHARRANGE range = {}; + range.cpMin = first; + range.cpMax = last; + int lastChar = (last == -1)? GetTextLength() : last; + + CString rangeString; + TEXTRANGE tr = {}; + tr.chrg = range; + tr.lpstrText = rangeString.GetBuffer(lastChar - first + 1); + LPARAM lparam = reinterpret_cast(&tr); + SendMessage(EM_GETTEXTRANGE, 0, lparam); + rangeString.ReleaseBuffer(); + + return rangeString; + } + + // Retrieves the type of the next undo action, if any. + // Refer to EM_GETREDONAME in the Windows API documentation for more information. + inline UNDONAMEID CRichEdit::GetUndoName() const + { + assert(IsWindow()); + return static_cast(SendMessage(EM_GETREDONAME, 0, 0)); + } + + // Shows or hides the current selection. + // Refer to EM_HIDESELECTION in the Windows API documentation for more information. + inline void CRichEdit::HideSelection(BOOL hide, BOOL isPermanent) const + { + assert(IsWindow()); + if (isPermanent) + { + SetOptions(ECOOP_SET, ECO_NOHIDESEL); + } + + WPARAM wparam = static_cast(hide); + SendMessage(EM_HIDESELECTION, wparam, 0); + } + + // Limits the amount of text a user can enter. + // Refer to EM_EXLIMITTEXT in the Windows API documentation for more information. + inline void CRichEdit::LimitText(long limit /* = 0 */) const + { + assert(IsWindow()); + LPARAM lparam = static_cast(limit); + SendMessage(EM_EXLIMITTEXT, 0, lparam); + } + + // Determines which line contains the given character. + // Refer to EM_EXLINEFROMCHAR in the Windows API documentation for more information. + inline long CRichEdit::LineFromChar(long charIndex) const + { + assert(IsWindow()); + LPARAM lparam = static_cast(charIndex); + return static_cast(SendMessage(EM_EXLINEFROMCHAR, 0, lparam)); + } + + // Retrieves the character index of a given line. + // index - Specifies the zero-based line number. + // A value of -1 specifies the current line number. + // Refer to EM_LINEINDEX in the Windows API documentation for more information. + inline int CRichEdit::LineIndex(int lineIndex /* = -1 */) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(lineIndex); + return static_cast(SendMessage(EM_LINEINDEX, wparam, 0)); + } + + // Retrieves the length of a given line containing the specified character. + // The charIndex parameter specifies the character index of a character in + // the line whose length is to be retrieved. This parameter can be -1. In + // this case, the message returns the number of unselected characters on + // lines containing selected characters. + // Refer to EM_LINELENGTH in the Windows API documentation for more information. + inline int CRichEdit::LineLength(int charIndex /* = -1 */) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(charIndex); + return static_cast(SendMessage(EM_LINELENGTH, wparam, 0)); + } + + // Scrolls the text. + // Refer to EM_LINESCROLL in the Windows API documentation for more information. + inline void CRichEdit::LineScroll(int lines) const + { + assert(IsWindow()); + LPARAM lparam = static_cast(lines); + SendMessage(EM_LINESCROLL, 0, lparam); + } + + // Inserts the contents of the Clipboard. + // Refer to WM_PASTE in the Windows API documentation for more information. + inline void CRichEdit::Paste() const + { + assert(IsWindow()); + SendMessage(WM_PASTE, 0, 0); + } + + // Inserts the contents of the Clipboard in the specified data format. + // Refer to EM_PASTESPECIAL in the Windows API documentation for more information. + inline void CRichEdit::PasteSpecial(UINT clipFormat, + DWORD aspect /* = nullptr */, HMETAFILE mf /* = nullptr */) const + { + assert(IsWindow()); + + REPASTESPECIAL rps = {}; + rps.dwAspect = aspect; + rps.dwParam = reinterpret_cast(mf); + WPARAM wparam = static_cast(clipFormat); + LPARAM lparam = reinterpret_cast(&rps); + SendMessage(EM_PASTESPECIAL, wparam, lparam); + } + + // Retrieves the client area coordinates of a specified character. + // Refer to EM_POSFROMCHAR in the Windows API documentation for more information. + inline CPoint CRichEdit::PosFromChar(UINT fromChar) const + { + assert(IsWindow()); + LPARAM lparam = static_cast(fromChar); + DWORD dwPos = static_cast(SendMessage(EM_POSFROMCHAR, 0, lparam)); + return CPoint(LOWORD(dwPos), HIWORD(dwPos)); + } + + // Redoes the next action in the control's redo queue. + // Refer to EM_REDO in the Windows API documentation for more information. + inline BOOL CRichEdit::Redo() const + { + assert(IsWindow()); + return static_cast(SendMessage(EM_REDO, 0, 0)); + } + + // Replaces the current selection with specified text. + // Refer to EM_REPLACESEL in the Windows API documentation for more information. + inline void CRichEdit::ReplaceSel(LPCTSTR newText, BOOL canUndo /* = FALSE */) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(canUndo); + LPARAM lparam = reinterpret_cast(newText); + SendMessage(EM_REPLACESEL, wparam, lparam); + } + + // Forces the sending of a request resize notifications. + // Refer to EM_REQUESTRESIZE in the Windows API documentation for more information. + inline void CRichEdit::RequestResize() const + { + assert(IsWindow()); + SendMessage(EM_REQUESTRESIZE, 0, 0); + } + + // Indicates if the auto URL detection is active. + // Refer to EM_AUTOURLDETECT in the Windows API documentation for more information. + inline BOOL CRichEdit::SetAutoURLDetect(BOOL enable /* = TRUE */) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(enable); + return static_cast(SendMessage(EM_AUTOURLDETECT, wparam, 0)); + } + + // Sets the background color. + // Refer to EM_SETBKGNDCOLOR in the Windows API documentation for more information. + inline COLORREF CRichEdit::SetBackgroundColor(BOOL isSysColor, COLORREF color) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(isSysColor); + LPARAM lparam = static_cast(color); + return static_cast(SendMessage(EM_SETBKGNDCOLOR, wparam, lparam)); + } + + // Sets the current default character formatting attributes. + // Refer to EM_SETCHARFORMAT in the Windows API documentation for more information. + inline BOOL CRichEdit::SetDefaultCharFormat(CHARFORMAT format) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&format); + return static_cast(SendMessage(EM_SETCHARFORMAT, 0, lparam)); + } + + // Sets the current default character formatting attributes. + // Refer to EM_SETCHARFORMAT in the Windows API documentation for more information. + inline BOOL CRichEdit::SetDefaultCharFormat(CHARFORMAT2 format) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&format); + return static_cast(SendMessage(EM_SETCHARFORMAT, 0, lparam)); + } + + // Sets the event mask. The event mask specifies which notification + // messages the control sends to its parent window. + // Refer to EM_SETEVENTMASK in the Windows API documentation for more information. + inline DWORD CRichEdit::SetEventMask(DWORD mask) const + { + assert(IsWindow()); + LPARAM lparam = static_cast(mask); + return static_cast(SendMessage(EM_SETEVENTMASK, 0, lparam)); + } + + // Sets or clears the modification flag. The modification flag indicates + // whether the text has been modified. + // Refer to EM_SETMODIFY in the Windows API documentation for more information. + inline void CRichEdit::SetModify(BOOL isModified /* = TRUE */) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(isModified); + SendMessage(EM_SETMODIFY, wparam, 0); + } + + // Sets the IRichEditOleCallback COM object. + // Refer to EM_SETOLECALLBACK in the Windows API documentation for more information. + inline BOOL CRichEdit::SetOLECallback(IRichEditOleCallback* pCallback) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(pCallback); + return static_cast(SendMessage(EM_SETOLECALLBACK, 0, lparam)); + } + + // Sets the options. + // Possible options values: ECOOP_SET, ECOOP_OR, ECOOP_AND, ECOOP_XOR + // Possible flags: ECO_AUTOWORDSELECTION, ECO_AUTOVSCROLL, ECO_AUTOHSCROLL, ECO_NOHIDESEL + // ECO_READONLY, ECO_WANTRETURN, ECO_SELECTIONBAR, ECO_VERTICAL + // Refer to EM_SETOPTIONS in the Windows API documentation for more information. + inline void CRichEdit::SetOptions(WORD options, DWORD flags) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(options); + LPARAM lparam = static_cast(flags); + SendMessage(EM_SETOPTIONS, wparam, lparam); + } + + // Sets the paragraph formatting attributes in the current selection. + // Refer to EM_SETPARAFORMAT in the Windows API documentation for more information. + inline BOOL CRichEdit::SetParaFormat(PARAFORMAT format) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&format); + return static_cast(SendMessage(EM_SETPARAFORMAT, 0, lparam)); + } + + // Sets the paragraph formatting attributes in the current selection. + // Refer to EM_SETPARAFORMAT in the Windows API documentation for more information. + inline BOOL CRichEdit::SetParaFormat(PARAFORMAT2 pf) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&pf); + return static_cast(SendMessage(EM_SETPARAFORMAT, 0, lparam)); + } + + // Sets the current punctuation characters for the rich edit control. + // This is available only in Asian-language versions of the operating system. + // Refer to EM_SETPUNCTUATION in the Windows API documentation for more information. + inline BOOL CRichEdit::SetPunctuation(UINT type, PUNCTUATION puncInfo) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(type); + LPARAM lparam = reinterpret_cast(&puncInfo); + return static_cast(SendMessage(EM_SETPUNCTUATION, wparam, lparam)); + } + + // Sets or removes the read-only style. + // Refer to EM_SETREADONLY in the Windows API documentation for more information. + inline BOOL CRichEdit::SetReadOnly(BOOL isReadOnly /* = TRUE*/) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(isReadOnly); + return static_cast(SendMessage(EM_SETREADONLY, wparam, 0)); + } + + // Sets the formatting rectangle. The formatting rectangle is the limiting + // rectangle into which the control draws the text. + // Refer to EM_SETRECT in the Windows API documentation for more information. + inline void CRichEdit::SetRect(RECT rc) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&rc); + SendMessage(EM_SETRECT, 0, lparam); + } + + // Selects a range of characters. + // Refer to EM_EXSETSEL in the Windows API documentation for more information. + inline void CRichEdit::SetSel(long startChar, long endChar) const + { + assert(IsWindow()); + + CHARRANGE cr = {}; + cr.cpMin = startChar; + cr.cpMax = endChar; + LPARAM lparam = reinterpret_cast(&cr); + SendMessage(EM_EXSETSEL, 0, lparam); + } + + // Selects a range of characters. + // Refer to EM_EXSETSEL in the Windows API documentation for more information. + inline void CRichEdit::SetSel(CHARRANGE range) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&range); + SendMessage(EM_EXSETSEL, 0, lparam); + } + + // Sets the character formatting attributes in the current selection. + // Refer to EM_SETCHARFORMAT in the Windows API documentation for more information. + inline BOOL CRichEdit::SetSelectionCharFormat(CHARFORMAT format) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&format); + return static_cast(SendMessage(EM_SETCHARFORMAT, SCF_SELECTION, lparam)); + } + + // Sets the character formatting attributes in the current selection. + // Refer to EM_SETCHARFORMAT in the Windows API documentation for more information. + inline BOOL CRichEdit::SetSelectionCharFormat(CHARFORMAT2 cf) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&cf); + return static_cast(SendMessage(EM_SETCHARFORMAT, SCF_SELECTION, lparam)); + } + + // Sets the target output device and line width used for "what you see is + // what you get" (WYSIWYG) formatting. + // Refer to EM_SETTARGETDEVICE in the Windows API documentation for more information. + inline BOOL CRichEdit::SetTargetDevice(HDC dc, long lineWidth) const + { + assert(IsWindow()); + WPARAM wparam = reinterpret_cast(dc); + LPARAM lparam = static_cast(lineWidth); + return static_cast(SendMessage(EM_SETTARGETDEVICE, wparam, lparam)); + } + + // Sets the text mode or undo level of the rich edit control. The message + // fails if the control contains text. + // Refer to EM_SETTEXTMODE in the Windows API documentation for more information. + inline BOOL CRichEdit::SetTextMode(UINT mode) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(mode); + return static_cast(SendMessage(EM_SETTEXTMODE, wparam, 0)); + } + + // Sets the maximum number of actions that can stored in the undo queue. + // This member function fails if the control contains text. + // Refer to EM_SETUNDOLIMIT in the Windows API documentation for more information. + inline UINT CRichEdit::SetUndoLimit(UINT limit) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(limit); + return static_cast(SendMessage(EM_SETUNDOLIMIT, wparam, 0)); + } + + // Sets the character formatting attributes in the current word. + // Refer to EM_SETCHARFORMAT in the Windows API documentation for more information. + inline BOOL CRichEdit::SetWordCharFormat(CHARFORMAT format) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&format); + return static_cast(SendMessage(EM_SETCHARFORMAT, (SCF_SELECTION | SCF_WORD), lparam)); + } + + // Sets the character formatting attributes in the current word. + // Refer to EM_SETCHARFORMAT in the Windows API documentation for more information. + inline BOOL CRichEdit::SetWordCharFormat(CHARFORMAT2 cf) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&cf); + return static_cast(SendMessage(EM_SETCHARFORMAT, (SCF_SELECTION | SCF_WORD), lparam)); + } + + // Stops the control from collecting additional typing actions into the + // current undo action. The control stores the next typing action, if any, + // into a new action in the undo queue. + // Refer to EM_STOPGROUPTYPING in the Windows API documentation for more information. + inline void CRichEdit::StopGroupTyping() const + { + assert(IsWindow()); + SendMessage(EM_STOPGROUPTYPING, 0, 0); + } + + // Replaces text with text from the specified input stream. + // Refer to EM_STREAMIN in the Windows API documentation for more information. + inline long CRichEdit::StreamIn(int format, EDITSTREAM& es) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(format); + LPARAM lparam = reinterpret_cast(&es); + return static_cast(SendMessage(EM_STREAMIN, wparam, lparam)); + } + + // Stores text into an output stream. + // Refer to EM_STREAMOUT in the Windows API documentation for more information. + inline long CRichEdit::StreamOut(int format, EDITSTREAM& es) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(format); + LPARAM lparam = reinterpret_cast(&es); + return static_cast(SendMessage(EM_STREAMOUT, wparam, lparam)); + } + + // Reverses the last editing operation. + // Refer to EM_UNDO in the Windows API documentation for more information. + inline BOOL CRichEdit::Undo() const + { + assert(IsWindow()); + return static_cast(SendMessage(EM_UNDO, 0, 0)); + } + +} + +#endif // _WIN32XX_RICHEDIT_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_scrollview.h b/packages/media/cpp/packages/Win32xx/include/wxx_scrollview.h new file mode 100644 index 00000000..3799f35b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_scrollview.h @@ -0,0 +1,578 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////// +// +// The CScrollView class adds scrolling to a view window. Inherit your +// view window from CScrollView, and use the SetScrollSizes function +// to set up the scrolling. Override OnDraw and perform the drawing to +// the window as usual. +// +// Use SetScrollSizes to specify the scrolling sizes. +// Use SetScollSizes(CSize(0,0)) to disable scrolling. +// +// The default scrolling background is white. Use the SetScrollBkgnd +// to set a different brush color. +// +///////////////////////////////////////////////////////// + + + +#ifndef _WIN32XX_SCROLLVIEW_H_ +#define _WIN32XX_SCROLLVIEW_H_ + +#include "wxx_appcore0.h" + + +namespace Win32xx +{ + + ////////////////////////////////////////////////////////////////////// + // The CScrollView class adds scrolling to a view window. Inherit your + // view window from CScrollView, and use the SetScrollSizes function + // to set up the scrolling. Override OnDraw and perform the drawing to + // the window as usual. + class CScrollView : public CWnd + { + public: + CScrollView(); + virtual ~CScrollView() override = default; + + CBrush GetScrollBkgnd() const { return m_bkgndBrush; } + CPoint GetScrollPosition() const { return m_currentPos; } + CSize GetLineScrollSize() const { return m_lineSize; } + CSize GetPageScrollSize() const { return m_pageSize; } + CSize GetTotalScrollSize() const { return m_totalSize; } + BOOL IsHScrollVisible() const { return (GetStyle() & WS_HSCROLL) != FALSE; } + BOOL IsVScrollVisible() const { return (GetStyle() & WS_VSCROLL) != FALSE; } + void SetScrollPosition(POINT pt); + void SetScrollSizes(CSize totalSize = CSize(0,0), + CSize pageSize = CSize(0,0), CSize lineSize = CSize(0,0)); + void SetScrollBkgnd(const CBrush& bkgndBrush) { m_bkgndBrush = bkgndBrush; } + + protected: + virtual void FillOutsideRect(CDC& dc, HBRUSH brush); + virtual BOOL OnEraseBkgnd(CDC& dc) override; + virtual LRESULT OnHScroll(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnKeyScroll(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnMouseWheel(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnPaint(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual LRESULT OnVScroll(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnWindowPosChanged(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnWindowPosChanging(UINT msg, WPARAM wparam, LPARAM lparam); + virtual void PreCreate(CREATESTRUCT& cs) override; + LRESULT WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) override; + + private: + CScrollView(const CScrollView&) = delete; + CScrollView& operator=(const CScrollView&) = delete; + void UpdateBars(); + + CPoint m_currentPos; + CSize m_totalSize; + CSize m_pageSize; + CSize m_lineSize; + CBrush m_bkgndBrush; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + ///////////////////////////////////////// + // Definitions for the CScrollView class. + // + + inline CScrollView::CScrollView() + { + m_bkgndBrush.CreateSolidBrush(RGB(255, 255, 255)); + } + + // Fills the area of the view that appears outside of the scrolling area. + // Can be used in OnEraseBkgnd to draw the background efficiently. + inline void CScrollView::FillOutsideRect(CDC& dc, HBRUSH brush) + { + // Get the window size in client area co-ordinates + CRect windowRect = GetWindowRect(); + VERIFY(ScreenToClient(windowRect)); + + // Fill the right side with the specified brush + CRect rcRight(m_totalSize.cx, 0, windowRect.right, windowRect.bottom); + dc.FillRect(rcRight, brush); + + // Fill the bottom side with the specified brush + CRect rcBottom(0, m_totalSize.cy, m_totalSize.cx, windowRect.bottom); + dc.FillRect(rcBottom, brush); + } + + // Called when the background for the window is erased. + inline BOOL CScrollView::OnEraseBkgnd(CDC&) + { + if (m_totalSize == CSize(0, 0)) + return FALSE; // Allow background erasure when the scroll bars are disabled. + else + return TRUE; // Prevent background erasure to reduce flicker. + } + + // Called when an event occurs in the horizontal scroll bar. + inline LRESULT CScrollView::OnHScroll(UINT, WPARAM wparam, LPARAM) + { + CPoint newPos = m_currentPos; + SCROLLINFO si = {}; + si.cbSize = sizeof(si); + si.fMask = SIF_TRACKPOS; + + switch (LOWORD(wparam)) + { + case SB_PAGELEFT: // User clicked the scroll bar shaft left of the scroll box. + newPos.x -= m_pageSize.cx; + break; + + case SB_PAGERIGHT: // User clicked the scroll bar shaft right of the scroll box. + newPos.x += m_pageSize.cx; + break; + + case SB_LINELEFT: // User clicked the left arrow. + newPos.x -= m_lineSize.cx; + break; + + case SB_LINERIGHT: // User clicked the right arrow. + newPos.x += m_lineSize.cx; + break; + + case SB_THUMBTRACK: // User dragging the scroll box. + // Retrieve 32 bit track position + GetScrollInfo(SB_HORZ, si); + newPos.x = si.nTrackPos; + break; + + default: + break; + } + + int maxPosX = m_totalSize.cx - GetClientRect().Width(); + int newPosX = newPos.x; + newPos.x = std::max(0, std::min(newPosX, maxPosX)); + + // Scroll the window + int deltaX = newPosX - m_currentPos.x; + ScrollWindowEx(-deltaX, 0, nullptr, nullptr, 0, nullptr, SW_INVALIDATE); + SetScrollPosition(newPos); + + return 0; + } + + // Called when a scroll key is pressed. + inline LRESULT CScrollView::OnKeyScroll(UINT, WPARAM wparam, LPARAM) + { + CPoint newPos = m_currentPos; + bool control = ((::GetKeyState(VK_CONTROL) & 0x8000) != 0); + + switch (wparam) + { + case VK_HOME: // HOME key + if (control) + newPos = CPoint(0, 0); // Scroll to the top. + else + newPos.x = 0; // Scroll to the left side. + break; + + case VK_END: // END key + if (control) + newPos = m_totalSize; // Scroll to the bottom. + else + newPos.x = m_totalSize.cx; // Scroll to the right side. + break; + + case VK_PRIOR: // PAGEUP key + newPos.y -= m_pageSize.cy; + break; + + case VK_NEXT: // PAGEDOWN key + newPos.y += m_pageSize.cy; + break; + + case VK_UP: // UPARROW key + newPos.y -= m_lineSize.cy; + break; + + case VK_LEFT: // LEFTARROW key + newPos.x -= m_lineSize.cx; + break; + + case VK_RIGHT: // RIGHTARROW key + newPos.x += m_lineSize.cx; + break; + + case VK_DOWN: // DOWNARROW key + newPos.y += m_lineSize.cy; + break; + + default: + break; + } + + if (newPos != m_currentPos) + { + int maxPosX = m_totalSize.cx - GetClientRect().Width(); + int maxPosY = m_totalSize.cy - GetClientRect().Height(); + int newPosX = newPos.x; + int newPosY = newPos.y; + newPos.x = std::max(0, std::min(newPosX, maxPosX)); + newPos.y = std::max(0, std::min(newPosY, maxPosY)); + + // Scroll the window. + int deltaX = newPos.x - m_currentPos.x; + int deltaY = newPos.y - m_currentPos.y; + ScrollWindowEx(-deltaX, -deltaY, nullptr, nullptr, 0, nullptr, SW_INVALIDATE); + SetScrollPosition(newPos); + } + + return 0; + } + + // Overrides OnPaint and call OnDraw with a memory DC. + inline LRESULT CScrollView::OnPaint(UINT msg, WPARAM wparam, LPARAM lparam) + { + + if (m_totalSize != CSize(0, 0)) + { + CPaintDC dc(*this); + CMemDC memDC(dc); + + // negative sizes are not allowed. + assert(m_totalSize.cx > 0); + assert(m_totalSize.cy > 0); + + // Create the compatible bitmap for the memory DC. + memDC.CreateCompatibleBitmap(GetDC(), m_totalSize.cx, m_totalSize.cy); + + // Set the background color. + CRect rcTotal(CPoint(0, 0), m_totalSize); + memDC.FillRect(rcTotal, m_bkgndBrush); + + // Call the overridden OnDraw function. + OnDraw(memDC); + + // Copy the modified memory DC to the window's DC with scrolling offsets. + dc.BitBlt(0, 0, m_totalSize.cx, m_totalSize.cy, memDC, m_currentPos.x, m_currentPos.y, SRCCOPY); + + // Set the area outside the scrolling area. + FillOutsideRect(dc, m_bkgndBrush); + + // No more drawing required. + return 0; + } + + // Do default OnPaint if m_sizeTotal is zero. + return CWnd::OnPaint(msg, wparam, lparam); + } + + // Called when the mouse wheel is rotated. + inline LRESULT CScrollView::OnMouseWheel(UINT, WPARAM wparam, LPARAM) + { + int WheelDelta = GET_WHEEL_DELTA_WPARAM(wparam); + int cyPos = ::MulDiv(WheelDelta, m_lineSize.cy, WHEEL_DELTA); + CPoint newPos = GetScrollPosition(); + newPos.y -= cyPos; + int newPosY = newPos.y; + int maxPosY = m_totalSize.cy - GetClientRect().Height(); + newPos.y = std::max(0, std::min(newPosY, maxPosY)); + + // Scroll the window. + int deltaY = newPos.y - m_currentPos.y; + ScrollWindowEx(0, -deltaY, nullptr, nullptr, 0, nullptr, SW_INVALIDATE); + SetScrollPosition(newPos); + + return 0; + } + + // Called when an event occurs in the vertical scroll bar. + inline LRESULT CScrollView::OnVScroll(UINT, WPARAM wparam, LPARAM) + { + CPoint newPos = m_currentPos; + SCROLLINFO si = {}; + si.cbSize = sizeof(si); + si.fMask = SIF_TRACKPOS; + + switch (LOWORD(wparam)) + { + case SB_PAGEUP: // User clicked the scroll bar shaft above the scroll box. + newPos.y -= m_pageSize.cy; + break; + + case SB_PAGEDOWN: // User clicked the scroll bar shaft below the scroll box. + newPos.y += m_pageSize.cy; + break; + + case SB_LINEUP: // User clicked the top arrow. + newPos.y -= m_lineSize.cy; + break; + + case SB_LINEDOWN: // User clicked the bottom arrow. + newPos.y += m_lineSize.cy; + break; + + case SB_THUMBTRACK: // User dragging the scroll box. + // Retrieve 32 bit track position. + GetScrollInfo(SB_VERT, si); + newPos.y = si.nTrackPos; + break; + + default: + break; + } + + int maxPosY = m_totalSize.cy - GetClientRect().Height(); + int newPosY = newPos.y; + newPos.y = std::max(0, std::min(newPosY, maxPosY)); + + // Scroll the window. + int deltaY = newPos.y - m_currentPos.y; + ScrollWindowEx(0, -deltaY, nullptr, nullptr, 0, nullptr, SW_INVALIDATE); + SetScrollPosition(newPos); + + return 0; + } + + // Called after a window's size has changed. + inline LRESULT CScrollView::OnWindowPosChanged(UINT msg, WPARAM wparam, LPARAM lparam) + { + UpdateBars(); + Invalidate(); + + return FinalWindowProc(msg, wparam, lparam); + } + + // Called before the window's size is changed. + inline LRESULT CScrollView::OnWindowPosChanging(UINT msg, WPARAM wparam, LPARAM lparam) + { + // We hide the scrollbars early in response to WM_WINDOWPOSCHANGING. + // If we did this in response to WM_WINDOWPOSCHANGED we could get + // unexpected results due to recursion. + + // Retrieve the future size of the window + LPWINDOWPOS pWinPos = reinterpret_cast(lparam); + assert(pWinPos); + if (!pWinPos) return 0; + + CRect rc(0, 0, pWinPos->cx, pWinPos->cy); + + // Possibly hide the horizontal scroll bar. + if (rc.Width() > m_totalSize.cx) + { + ShowScrollBar(SB_HORZ, FALSE); // Can resize the view. + } + + // Possibly hide the vertical scroll bar + if (rc.Height() > m_totalSize.cy) + { + ShowScrollBar(SB_VERT, FALSE); // Can resize the view. + } + + return FinalWindowProc(msg, wparam, lparam); + } + + inline void CScrollView::PreCreate(CREATESTRUCT& cs) + { + // Set the Window Class name. + cs.lpszClass = _T("ScrollView"); + + cs.style = WS_CHILD | WS_HSCROLL | WS_VSCROLL; + } + + // Sets the current scroll position. + inline void CScrollView::SetScrollPosition(POINT pt) + { + assert(pt.x >= 0 && pt.x <= m_totalSize.cx); + assert(pt.y >= 0 && pt.y <= m_totalSize.cy); + + m_currentPos = pt; + UpdateBars(); + } + + // Sets the various Scroll Size parameters. + // Note that a sizeTotal of CSize(0,0) turns scrolling off. + inline void CScrollView::SetScrollSizes(CSize totalSize, CSize pageSize, + CSize lineSize) + { + if (IsWindow()) + { + ShowScrollBar(SB_BOTH, FALSE); + Invalidate(); + } + + m_totalSize = totalSize; + m_pageSize = pageSize; + m_lineSize = lineSize; + + if (m_pageSize.cx == 0) + m_pageSize.cx = m_totalSize.cx / 10; + if (m_pageSize.cy == 0) + m_pageSize.cy = m_totalSize.cy / 10; + if (m_lineSize.cx == 0) + m_lineSize.cx = m_pageSize.cx / 10; + if (m_lineSize.cy == 0) + m_lineSize.cy = m_pageSize.cy / 10; + + m_currentPos = CPoint(0, 0); + + UpdateBars(); + } + + // Updates the display state of the scrollbars and the scrollbar positions. + // Also scrolls display view as required by window resizing. + // Note: This function can be called recursively. + inline void CScrollView::UpdateBars() + { + // Acknowledgement: + // A special thanks to Robert C. Tausworthe for his contribution to the + // scrollbar logic used here. + if (IsWindow()) + { + if (m_totalSize == CSize(0, 0)) + { + ShowScrollBar(SB_BOTH, FALSE); + m_currentPos = CPoint(0, 0); + } + else + { + DWORD exStyle = GetExStyle(); + CRect totalRect(0, 0, m_totalSize.cx, m_totalSize.cy); + AdjustWindowRectEx(&totalRect, 0, FALSE, exStyle); + + // CRect of view, size affected by scroll bars. + CRect clientRect = GetClientRect(); + AdjustWindowRectEx(&clientRect, 0, FALSE, exStyle); + + // CRect of view, unaffected by scroll bars. + CRect viewRect = GetWindowRect(); + + SCROLLINFO si = {}; + si.cbSize = sizeof(si); + si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS; + si.nMin = 0; + + bool isHBAlwaysOn = (totalRect.Width() > viewRect.Width()); // Horizontal Bar always on. + bool isVBAlwaysOn = (totalRect.Height() > viewRect.Height()); // Vertical Bar always on. + + // Horizontal Bars are always shown if the total width is + // greater than the window's width. They are also shown if the + // vertical bar is shown, and the total width is greater than + // the client width. Client width = window width - scrollbar width. + if (isHBAlwaysOn || ((totalRect.Width() > clientRect.Width()) && isVBAlwaysOn)) + { + si.nMax = totalRect.Width(); + si.nPage = static_cast(clientRect.Width()); + si.nPos = m_currentPos.x; + SetScrollInfo(SB_HORZ, si, TRUE); + ShowScrollBar(SB_HORZ, TRUE); + } + else + { + m_currentPos.x = 0; + ShowScrollBar(SB_HORZ, FALSE); + } + + // Vertical Bars are always shown if the total height is + // greater than the window's height. They are also shown if the + // horizontal bar is shown, and the total height is greater than + // the client height. Client height = window height - scrollbar width. + if (isVBAlwaysOn || ((totalRect.Height() > clientRect.Height()) && isHBAlwaysOn)) + { + si.nMax = totalRect.Height(); + si.nPage = static_cast(clientRect.Height()); + si.nPos = m_currentPos.y; + SetScrollInfo(SB_VERT, si, TRUE); + ShowScrollBar(SB_VERT, TRUE); + } + else + { + m_currentPos.y = 0; + ShowScrollBar(SB_VERT, FALSE); + } + + // Perform any additional scrolling required by window resizing. + int cxScroll = ::GetSystemMetrics(SM_CXVSCROLL) * GetWindowDpi( + *this) / GetWindowDpi(HWND_DESKTOP); + int cyScroll = ::GetSystemMetrics(SM_CYHSCROLL) * GetWindowDpi( + *this) / GetWindowDpi(HWND_DESKTOP); + + cxScroll = IsVScrollVisible() ? cxScroll : 0; + cyScroll = IsHScrollVisible() ? cyScroll : 0; + int currentPosX = m_currentPos.x; + int currentPosY = m_currentPos.y; + int xNewPos = std::min(currentPosX, totalRect.Width() - + viewRect.Width() + cxScroll); + xNewPos = std::max(xNewPos, 0); + int xDelta = xNewPos - m_currentPos.x; + int yNewPos = std::min(currentPosY, totalRect.Height() - + viewRect.Height() + cyScroll); + yNewPos = std::max(yNewPos, 0); + int yDelta = yNewPos - m_currentPos.y; + ScrollWindowEx(-xDelta, -yDelta, nullptr, nullptr, 0, nullptr, SW_INVALIDATE); + + m_currentPos.x = xNewPos; + m_currentPos.y = yNewPos; + } + } + } + + // Default message handling. + inline LRESULT CScrollView::WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) + { + switch (msg) + { + case WM_HSCROLL: return OnHScroll(msg, wparam, lparam); + case WM_KEYDOWN: return OnKeyScroll(msg, wparam, lparam); + case WM_MOUSEWHEEL: return OnMouseWheel(msg, wparam, lparam); + case WM_PAINT: return OnPaint(msg, wparam, lparam); + case WM_VSCROLL: return OnVScroll(msg, wparam, lparam); + case WM_WINDOWPOSCHANGED: return OnWindowPosChanged(msg, wparam, lparam); + case WM_WINDOWPOSCHANGING: return OnWindowPosChanging(msg, wparam, lparam); + } + + // Pass unhandled messages on for default processing. + return CWnd::WndProcDefault(msg, wparam, lparam); + } +} + +#endif // _WIN32XX_SCROLLVIEW_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_setup.h b/packages/media/cpp/packages/Win32xx/include/wxx_setup.h new file mode 100644 index 00000000..1daa632b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_setup.h @@ -0,0 +1,371 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////// +// This file defines the set of version macros for windows +// and includes the header files required by Win32++. It +// also defines CObject and many of the global functions +// used by Win32++. + + +#ifndef _WIN32XX_SETUP_H_ +#define _WIN32XX_SETUP_H_ + +// Include the C++ headers. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Set the windows version macros. These must be defined before including +// windows.h. These values are suitable for Windows 10 and Windows 11. +#define WINVER 0x0A00 +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0A00 +#undef _WIN32_IE +#define _WIN32_IE 0x0A00 +#undef NTDDI_VERSION +#define NTDDI_VERSION 0x0A000000 + +// Allow std::min and std::max. Must be defined before including windows.h. +#ifndef NOMINMAX +#define NOMINMAX +#endif + +// Include the Windows API headers. +#include // Must include before windows.h. +#include +#include + +// Hide warning generated by shlobj.h in VS2015. +#if defined (_MSC_VER) +#pragma warning( push ) +#pragma warning( disable : 4091 ) +#endif +#include +#if defined (_MSC_VER) +#pragma warning( pop ) +#endif + +// Automatically include the Win32xx namespace. +// define NO_USING_NAMESPACE to skip this step. +namespace Win32xx {} +#ifndef NO_USING_NAMESPACE +using namespace Win32xx; +#endif + +// Define our own MIN and MAX macros. +// This avoids inconsistencies with MinGW and other compilers, and +// avoids conflicts between typical min/max macros and std::min/std::max +// Warning: These macros are now deprecated. Use std::min and std::max instead. +#define MAX(a,b) (((a) > (b)) ? (a) : (b)) +#define MIN(a,b) (((a) < (b)) ? (a) : (b)) + +// Version macro +#define _WIN32XX_VER 0x0A21 // Win32++ version 10.2.1 + +// Define the TRACE Macro. +// In debug mode, TRACE send text to the debug/output pane, or an external +// debugger. In release mode, TRACE is ignored. +#ifndef TRACE + #ifdef NDEBUG + #define TRACE(str) (void(0)) + #else + #define TRACE(str) Trace(str) + #endif +#endif + +// Define the VERIFY macro +// In debug mode, VERIFY asserts if the expression evaluates to zero. +// In release mode, VERIFY evaluates the expression, but doesn't assert. +#ifndef VERIFY + #ifdef NDEBUG + #define VERIFY(f) ((void)(f)) + #else + #define VERIFY(f) assert(f) + #endif +#endif + +// Define useful macros from windowsx.h. +#ifndef GET_X_LPARAM + #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) +#endif +#ifndef GET_Y_LPARAM + #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp)) +#endif + +namespace Win32xx +{ + class CArchive; + + //////////////////////////////////////////////////////////////////// + // The CObject class provides support for serialization by CArchive. + // Any class that uses CArchive to serialize data can inherit from + // CObject. + + class CObject + { + public: + CObject() = default; + virtual ~CObject() = default; + + virtual void Serialize(CArchive& /*ar*/) + { + // Override Serialize in the class inherited from CObject like this. + + // if (ar.IsStoring()) + // { + // // Store a member variable in the archive + // ar << m_someValue; + // } + // else + // { + // // Load a member variable from the archive + // ar >> m_someValue; + // } + } + }; + + // tString is a TCHAR std::string. + // tStringStream is a TCHAR std::stringstream. + using tString = std::basic_string; + using tStringStream = std::basic_stringstream; + + //////////////////// + // Global Functions. + // + + // Retrieves the window version + // Return values and window versions: + // 2501 Windows XP + // 2502 Windows Server 2003 + // 2600 Windows Vista and Windows Server 2008 + // 2601 Windows 7 and Windows Server 2008 r2 + // 2602 Windows 8 and Windows Server 2012 + // 2603 Windows 8.1 and Windows Server 2012 r2 + // 3000 Windows 10 or Windows 11 + inline int GetWinVersion() + { + // Declare a pointer to the RtlGetVersion function. + using RTLGETVERSION = void (WINAPI*)(PRTL_OSVERSIONINFOW); + + HMODULE module = ::GetModuleHandle(_T("ntdll.dll")); + RTL_OSVERSIONINFOW osvi = {}; + if (module) + { + RTLGETVERSION pfn = reinterpret_cast( + reinterpret_cast(::GetProcAddress( + module, "RtlGetVersion"))); + + if (pfn != nullptr) + { + osvi.dwOSVersionInfoSize = sizeof(osvi); + pfn(&osvi); + } + } + + DWORD platform = osvi.dwPlatformId; + DWORD majorVer = osvi.dwMajorVersion; + DWORD minorVer = osvi.dwMinorVersion; + + DWORD result = 1000 * platform + 100 * majorVer + minorVer; + return static_cast(result); + } + + // Returns a NONCLIENTMETRICS struct filled from the system parameters. + // Refer to NONCLIENTMETRICS in the Windows API documentation for more information. + inline NONCLIENTMETRICS GetNonClientMetrics() + { + NONCLIENTMETRICS ncm = {}; + ncm.cbSize = sizeof(ncm); + + // If OS version less than Vista, adjust size to correct value. + if (GetWinVersion() < 2600) + ncm.cbSize = CCSIZEOF_STRUCT(NONCLIENTMETRICS, lfMessageFont); + + VERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0)); + + return ncm; + } + + // Reports the state of the left mouse button. + // Refer to GetAsyncKeyState in the Windows API documentation for more information. + inline BOOL IsLeftButtonDown() + { + SHORT state; + if (::GetSystemMetrics(SM_SWAPBUTTON)) + // Mouse buttons are swapped. + state = ::GetAsyncKeyState(VK_RBUTTON); + else + // Mouse buttons are not swapped. + state = ::GetAsyncKeyState(VK_LBUTTON); + + // Returns true if the left mouse button is down. + return (state & 0x8000); + } + + // Returns TRUE if XP themes are being used. + inline BOOL IsXPThemed() + { + BOOL isXPThemed = FALSE; + HMODULE comctl32 = ::GetModuleHandle(_T("comctl32.dll")); + if (comctl32) + { + // Retrieve a pointer to the DllGetVersion function. + using PDLLGETVERSION = HRESULT(WINAPI*)(DLLVERSIONINFO*); + PDLLGETVERSION pDllGetVersion = reinterpret_cast( + reinterpret_cast(::GetProcAddress(comctl32, "DllGetVersion"))); + + if (pDllGetVersion) + { + // Call the DllGetVersion function from comctl32.dll. + DLLVERSIONINFO dvi = {}; + dvi.cbSize = sizeof dvi; + if (pDllGetVersion(&dvi) == NOERROR) + { + // Test if comctl32.dll is version 6.0 or later. + if (dvi.dwMajorVersion >= 6) + isXPThemed = TRUE; + } + } + } + + return isXPThemed; + } + + // Loads the common controls using InitCommonControlsEx. + // Refer to InitCommonControlsEx in the Windows API documentation for more information. + inline void LoadCommonControls() + { + // Load the full set of common controls. + INITCOMMONCONTROLSEX initStruct = {}; + initStruct.dwSize = sizeof(initStruct); + initStruct.dwICC = ICC_WIN95_CLASSES | ICC_DATE_CLASSES | + ICC_INTERNET_CLASSES | ICC_NATIVEFNTCTL_CLASS | + ICC_PAGESCROLLER_CLASS | ICC_USEREX_CLASSES; + + // Call InitCommonControlsEx. + VERIFY(::InitCommonControlsEx(&initStruct)); + + // Add the SysLink control. + // Requires ComCtl32.dll version 6 and requires a manifest. + if (IsXPThemed()) + { + initStruct.dwICC = ICC_LINK_CLASS; + VERIFY(::InitCommonControlsEx(&initStruct)); + } + } + + // The following functions perform string copies. A string of characters is + // copied from the src array to the dst array. + // The dst_size parameter specifies the number characters to be copied. + // The dst array filled by these functions is always null terminated. + // Null or zero arguments cause an assert. + + // Copies an ANSI string from src to dst. + inline void StrCopyA(char* dst, const char* src, size_t dst_size) + { + assert(dst != nullptr); + assert(src != nullptr); + assert(dst_size != 0); + + if (dst && src && dst_size != 0) + { + size_t index; + + // Copy each character. + for (index = 0; index < dst_size - 1; ++index) + { + dst[index] = src[index]; + if (src[index] == '\0') + break; + } + + // Add null termination if required. + if (dst[index] != '\0') + dst[dst_size - 1] = '\0'; + } + } + + // Copies a wide string from src to dst. + inline void StrCopyW(wchar_t* dst, const wchar_t* src, size_t dst_size) + { + assert(dst != nullptr); + assert(src != nullptr); + assert(dst_size != 0); + + if (dst && src && dst_size != 0) + { + size_t index; + + // Copy each character. + for (index = 0; index < dst_size - 1; ++index) + { + dst[index] = src[index]; + if (src[index] == L'\0') + break; + } + + // Add null termination if required. + if (dst[index] != L'\0') + dst[dst_size - 1] = L'\0'; + } + } + + // Copies a TCHAR string from src to dst. + inline void StrCopy(TCHAR* dst, const TCHAR* src, size_t dst_size) + { +#ifdef UNICODE + StrCopyW(dst, src, dst_size); +#else + StrCopyA(dst, src, dst_size); +#endif + } + +} + +#endif // _WIN32XX_SETUP_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_socket.h b/packages/media/cpp/packages/Win32xx/include/wxx_socket.h new file mode 100644 index 00000000..b663d01b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_socket.h @@ -0,0 +1,721 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// wxx_socket.h +// Declaration of the CSocket class +// +// The CSocket class represents a network socket. It can be used to create +// an event socket. +// +// Event Sockets +// These sockets use StartEvents to monitor network events. A separate thread +// is created for each event socket. After StartEvents is called, CSocket +// monitors the socket and responds automatically to network events. +// Inherit from CSocket and override the following functions to respond +// to network events: OnAccept; OnAddresListChange; OnDisconnect; OnConnect; +// OnOutOfBand; OnQualityOfService; OnReceive; OnRoutingChange; OnSend. + +// When using event sockets, users of this class should be aware that functions +// like OnReceive, OnAccept, etc. are called on a different thread from the one +// CSocket is instantiated on. The thread for these functions needs to respond +// quickly to other network events, so it shouldn't be delayed. It also doesn't +// run a message loop, so it can't be used to create windows. For these reasons +// it might be best to use PostMessage in response to these functions in a +// windows environment. +// Refer to GetEventSelect in the Windows API documentation for more +// information on using event sockets. +// Refer to the NetClient and NetServer samples for an example of how to use +// this class to create event sockets for a TCP/UDP client & server. + +// To compile programs with CSocket, link with ws2_32.lib. This class uses +// Winsock version 2, and supports Windows 98 and above. Windows 95 systems +// will need to install the "Windows Sockets 2.0 for Windows 95". + +// For a TCP server using event sockets, inherit a class from CSocket +// and override OnAccept, OnDisconnect and OnReceive. Create one instance +// of this class and use it as a listening socket. The purpose of the +// listening socket is to detect connections from clients and accept them. +// For the listening socket, we do the following: +// 1) Create the socket. +// 2) Bind an IP address to the socket. +// 3) Listen on the socket for incoming connection requests. +// 4) Use StartEvents to receive notification of network events. +// 5) Override OnAccept to accept requests on a newly created data CSocket object. +// 6) Create a new data socket for each client connection accepted. +// 7) The server socket uses the 'accept' function to accept an incoming connection +// from this new data socket. + +// The purpose of the data socket is to send data to, and receive data from the +// client. There will be one data socket for each client accepted by the server. +// To use it we do the following: +// * To receive data from the client, override OnReceive and use Receive. +// * To send data to use Send. +// * OnDisconnect can be used to detect when the client is disconnected. + +// For a TCP client, inherit from CSocket and override OnReceive and OnDisconnect. +// Create an instance of this inherited class, and perform the following steps: +// 1) Create the socket. +// 2) Connect to the server. +// 3) Use StartEvents to receive notification of network events. +// We are now ready to send and receive data from the server. +// * Use Send to send data to the server. +// * Override OnReceive and use Receive to receive data from the server +// * OnDisconnect can be used to detect when the client is disconnected from the +// server. + +// Notes regarding IPv6 support +// * IPv6 is supported on Windows Vista and above. Windows XP with SP2 provides +// "experimental" support, which can be enabled by entering "ipv6 install" +// at a command prompt. +// * IsIPV6Supported returns false if for Windows XP. +// + + +#ifndef _WIN32XX_SOCKET_H_ +#define _WIN32XX_SOCKET_H_ + +// CSocket requires features from the Win32++ framework. +#include "wxx_wincore.h" +#include "wxx_thread.h" +#include "wxx_mutex.h" + +#include + + +namespace Win32xx +{ + const int THREAD_TIMEOUT = 100; + + ///////////////////////////////////////////////////////////// + // CSocket manages a network socket. It can be used to create + // network connections, and pass data over those connections. + class CSocket + { + public: + CSocket(); + virtual ~CSocket(); + + // Operations + void Accept(CSocket& rClientSock, struct sockaddr* addr, int* addrlen) const; + int Bind(LPCTSTR addr, UINT port) const; + int Bind(const struct sockaddr* name, int namelen) const; + int Connect(LPCTSTR addr, UINT port) const; + int Connect(const struct sockaddr* name, int namelen) const; + bool Create( int family, int type, int protocol = IPPROTO_IP); + void Disconnect(); + CString GetErrorString() const; + int ioCtlSocket(long cmd, u_long* argp) const; + bool IsIPV6Supported() const; + int Listen(int backlog = SOMAXCONN) const; + int Receive(char* buf, int len, int flags) const; + int ReceiveFrom(char* buf, int len, int flags, struct sockaddr* from, int* fromlen) const; + int Send(const char* buf, int len, int flags) const; + int SendTo(const char* send, int len, int flags, LPCTSTR addr, UINT port) const; + int SendTo(const char* buf, int len, int flags, const struct sockaddr* to, int tolen) const; + void StartEvents(); + void StopEvents(); + + // Accessors and mutators + int GetPeerName(struct sockaddr* name, int* namelen) const; + int GetSockName(struct sockaddr* name, int* namelen) const; + SOCKET& GetSocket() { return m_socket; } + int GetSockOpt(int level, int optname, char* optval, int* optlen) const; + int SetSockOpt(int level, int optname, const char* optval, int optlen) const; + + // Override these functions to monitor events + virtual void OnAccept() {} + virtual void OnAddresListChange() {} + virtual void OnDisconnect() {} + virtual void OnConnect() {} + virtual void OnOutOfBand() {} + virtual void OnQualityOfService() {} + virtual void OnReceive() {} + virtual void OnRoutingChange() {} + virtual void OnSend() {} + + // Allow CSocket to be used as a SOCKET + operator SOCKET() const {return m_socket;} + + private: + CSocket(const CSocket&) = delete; + CSocket& operator=(const CSocket&) = delete; + static UINT WINAPI EventThread(LPVOID pThis); + + SOCKET m_socket; + HMODULE m_ws2_32; + WorkThreadPtr m_threadPtr; // Smart pointer to the worker thread for the events. + CEvent m_stopRequest; // A manual reset event to signal the event thread should stop. + }; +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + //////////////////////////////////// + // Definitions of the CSocket class. + // + + inline CSocket::CSocket() : m_socket(INVALID_SOCKET), m_stopRequest(FALSE, TRUE) + { + // Initialize the Windows Socket services. + WSADATA wsaData; + + if (::WSAStartup(MAKEWORD(2,2), &wsaData) != 0) + throw CNotSupportedException(GetApp()->MsgSocWSAStartup()); + + m_ws2_32 = ::GetModuleHandle(_T("ws2_32.dll")); + if (m_ws2_32 == nullptr) + throw CNotSupportedException(GetApp()->MsgSocWS2Dll()); + + m_threadPtr = std::make_unique(EventThread, this); + } + + inline CSocket::~CSocket() + { + ::shutdown(m_socket, SD_BOTH); + // Ask the event thread to stop. + m_stopRequest.SetEvent(); + + // Wait for the event thread to stop. + while (WAIT_TIMEOUT == ::WaitForSingleObject(*m_threadPtr, THREAD_TIMEOUT * 10)) + { + // Waiting for the event thread to signal the m_stopped event. + + // Note: An excessive delay in processing any of the notification functions + // can cause us to get here. + TRACE("*** Error: Event Thread won't die ***\n"); + } + + m_stopRequest.ResetEvent(); + + ::closesocket(m_socket); + m_socket = INVALID_SOCKET; + + if (m_stopRequest.GetHandle()) + ::CloseHandle(m_stopRequest); + + // Terminate the Windows Socket services. + ::WSACleanup(); + } + + // The accept function permits an incoming connection attempt on the socket. + // Refer to accept in the Windows API documentation for additional information. + inline void CSocket::Accept(CSocket& rClientSock, struct sockaddr* addr, int* addrlen) const + { + rClientSock.m_socket = ::accept(m_socket, addr, addrlen); + if (INVALID_SOCKET == rClientSock.GetSocket()) + TRACE("Accept failed\n"); + } + + // The bind function associates a local address with the socket. + // Refer to bind in the Windows API documentation for additional information. + inline int CSocket::Bind(LPCTSTR addr, UINT port) const + { + int result = 0; + + if (IsIPV6Supported()) + { + ADDRINFOT hints = {}; + hints.ai_flags = AI_NUMERICHOST | AI_PASSIVE; + ADDRINFOT *AddrInfo; + CString portName; + portName.Format(_T("%u"), port); + + result = ::GetAddrInfo(addr, portName, &hints, &AddrInfo); + if (result != 0) + { + TRACE("GetAddrInfo failed\n"); + return result; + } + + // Bind the IP address to the listening socket. + result = ::bind( m_socket, AddrInfo->ai_addr, static_cast(AddrInfo->ai_addrlen) ); + if (result == SOCKET_ERROR ) + { + TRACE("Bind failed\n"); + return result; + } + + // Free the address information allocated by GetAddrInfo. + ::FreeAddrInfo(AddrInfo); + } + else + { + sockaddr_in clientService = {}; + IN_ADDR ipv4_addr = {}; + inet_pton(AF_INET, TtoA(addr), &ipv4_addr); + clientService.sin_family = AF_INET; + clientService.sin_addr = ipv4_addr; + clientService.sin_port = htons( static_cast(port) ); + + result = ::bind( m_socket, reinterpret_cast( &clientService), sizeof(clientService) ); + if (result != 0) + TRACE("Bind failed\n"); + } + + return result; + } + + // The bind function associates a local address with the socket. + // Refer to bind in the Windows API documentation for additional information. + inline int CSocket::Bind(const struct sockaddr* name, int namelen) const + { + int result = ::bind (m_socket, name, namelen); + if (result != 0) + TRACE("Bind failed\n"); + return result; + } + + // The Connect function establishes a connection to the socket. + // Refer to connect in the Windows API documentation for additional information. + inline int CSocket::Connect(LPCTSTR addr, UINT port) const + { + int result = 0; + + if (IsIPV6Supported()) + { + ADDRINFOT hints = {}; + hints.ai_flags = AI_NUMERICHOST | AI_PASSIVE; + ADDRINFOT *AddrInfo; + + CString portName; + portName.Format(_T("%u"), port); + result = ::GetAddrInfo(addr, portName, &hints, &AddrInfo); + if (result != 0) + { + TRACE("getaddrinfo failed\n"); + return SOCKET_ERROR; + } + + // Bind the IP address to the listening socket. + result = Connect( AddrInfo->ai_addr, static_cast(AddrInfo->ai_addrlen) ); + if (result == SOCKET_ERROR ) + { + TRACE("Connect failed\n"); + return result; + } + + // Free the address information allocated by GetAddrInfo. + ::FreeAddrInfo(AddrInfo); + } + else + { + sockaddr_in clientService = {}; + IN_ADDR ipv4_addr = {}; + inet_pton(AF_INET, TtoA(addr), &ipv4_addr); + clientService.sin_family = AF_INET; + clientService.sin_addr = ipv4_addr; + clientService.sin_port = htons( static_cast(port) ); + + result = ::connect( m_socket, reinterpret_cast( &clientService ), sizeof(clientService) ); + if (result != 0) + TRACE("Connect failed\n"); + } + + return result; + } + + // The Connect function establishes a connection to the socket. + // Refer to connect in the Windows API documentation for additional information. + inline int CSocket::Connect(const struct sockaddr* name, int namelen) const + { + int result = ::connect( m_socket, name, namelen ); + if (result != 0) + TRACE("Connect failed\n"); + + return result; + } + + // Creates the socket + // Valid parameter values: + // family: AF_INET or AF_INET6 + // type: SOCK_DGRAM, SOCK_SEQPACKET, SOCK_STREAM, SOCK_RAW + // protocol: IPPROTO_IP, IPPROTO_TCP, IPPROTO_UDP, IPPROTO_RAW, IPPROTO_ICMP, IPPROTO_ICMPV6 + // + // Refer to socket in the Windows API documentation for additional information. + inline bool CSocket::Create( int family, int type, int protocol /*= IPPROTO_IP*/) + { + m_socket = socket(family, type, protocol); + if (m_socket == INVALID_SOCKET) + { + TRACE("Failed to create socket\n"); + return FALSE; + } + + return TRUE; + } + + // Shuts down the socket. + inline void CSocket::Disconnect() + { + ::shutdown(m_socket, SD_BOTH); + StopEvents(); + + ::closesocket(m_socket); + m_socket = INVALID_SOCKET; + } + + // Responds to network events. + // These are the possible network event notifications: + // FD_READ Notification of readiness for reading. + // FD_WRITE Notification of readiness for writing. + // FD_OOB Notification of the arrival of Out Of Band data. + // FD_ACCEPT Notification of incoming connections. + // FD_CONNECT Notification of completed connection or multipoint join operation. + // FD_CLOSE Notification of socket closure. + // FD_QOS Notification of socket Quality Of Service changes + // FD_ROUTING_INTERFACE_CHANGE Notification of routing interface changes for the specified destination. + // FD_ADDRESS_LIST_CHANGE Notification of local address list changes for the address family of the socket. + inline UINT WINAPI CSocket::EventThread(LPVOID pThis) + { + WSANETWORKEVENTS networkEvents; + CSocket* pSocket = reinterpret_cast(pThis); + CEvent& stopRequestEvent = pSocket->m_stopRequest; + SOCKET& clientSocket = pSocket->m_socket; + + WSAEVENT allEvents[2] = {}; + allEvents[0] = ::WSACreateEvent(); + allEvents[1] = stopRequestEvent.GetHandle(); + long events = FD_READ | FD_WRITE | FD_OOB | FD_ACCEPT | FD_CONNECT | FD_CLOSE; + events |= FD_QOS | FD_ROUTING_INTERFACE_CHANGE | FD_ADDRESS_LIST_CHANGE; + + // Associate the network events with the client socket. + if ( SOCKET_ERROR == WSAEventSelect(clientSocket, allEvents[0], events)) + { + TRACE("Error in Event Select\n"); + ::WSACloseEvent(allEvents[0]); + return 0; + } + + // Loop until the stop event is set. + for (;;) // infinite loop + { + // Wait for a network event, or a request to stop + DWORD result = ::WSAWaitForMultipleEvents(2, allEvents, FALSE, WSA_INFINITE, FALSE); + + // Check event for stop thread + if (result - WSA_WAIT_EVENT_0 == 1) + { + ::WSACloseEvent(allEvents[0]); + return 0; + } + + if (result == WSA_WAIT_FAILED) + { + TRACE("WSAWaitForMultipleEvents failed\n"); + ::WSACloseEvent(allEvents[0]); + return 0; + } + + // Proceed if a network event occurred + if (result != WSA_WAIT_TIMEOUT) + { + + if ( SOCKET_ERROR == ::WSAEnumNetworkEvents(clientSocket, allEvents[0], &networkEvents) ) + { + TRACE("WSAEnumNetworkEvents failed\n"); + ::WSACloseEvent(allEvents[0]); + return 0; + } + + if (networkEvents.lNetworkEvents & FD_ACCEPT) + pSocket->OnAccept(); + + if (networkEvents.lNetworkEvents & FD_READ) + pSocket->OnReceive(); + + if (networkEvents.lNetworkEvents & FD_WRITE) + pSocket->OnSend(); + + if (networkEvents.lNetworkEvents & FD_OOB) + pSocket->OnOutOfBand(); + + if (networkEvents.lNetworkEvents & FD_QOS) + pSocket->OnQualityOfService(); + + if (networkEvents.lNetworkEvents & FD_CONNECT) + pSocket->OnConnect(); + + if (networkEvents.lNetworkEvents & FD_ROUTING_INTERFACE_CHANGE) + pSocket->OnRoutingChange(); + + if (networkEvents.lNetworkEvents & FD_ADDRESS_LIST_CHANGE) + pSocket->OnAddresListChange(); + + if (networkEvents.lNetworkEvents & FD_CLOSE) + { + ::shutdown(clientSocket, SD_BOTH); + ::closesocket(clientSocket); + pSocket->OnDisconnect(); + ::WSACloseEvent(allEvents[0]); + return 0; + } + } + } + } + + // Returns a string containing the most recent network error. + // Refer to WSAGetLastError in the Windows API documentation for additional information. + inline CString CSocket::GetErrorString() const + { + DWORD errorCode = static_cast(WSAGetLastError()); + LPTSTR message = nullptr; + CString errorMessage; + + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_MAX_WIDTH_MASK, + nullptr, errorCode, 0, reinterpret_cast(&message), 1024, nullptr); + + if (message) + { + errorMessage = message; + ::LocalFree(message); + } + + return errorMessage; + } + + // Retrieves the name of the peer to which the socket is connected. + // Refer to getpeername in the Windows API documentation for additional information. + inline int CSocket::GetPeerName(struct sockaddr* name, int* namelen) const + { + int result = ::getpeername(m_socket, name, namelen); + if (result != 0) + TRACE("GetPeerName failed\n"); + + return result; + } + + // Retrieves the local name for the socket. + // Refer to getsockname in the Windows API documentation for additional information. + inline int CSocket::GetSockName(struct sockaddr* name, int* namelen) const + { + int result = ::getsockname(m_socket, name, namelen); + if (result != 0) + TRACE("GetSockName Failed\n"); + + return result; + } + + // Retrieves the socket option. + // Refer to getsockopt in the Windows API documentation for additional information. + inline int CSocket::GetSockOpt(int level, int optname, char* optval, int* optlen) const + { + int result = ::getsockopt(m_socket, level, optname, optval, optlen); + if (result != 0) + TRACE("GetSockOpt Failed\n"); + + return result; + } + + // Controls the I/O mode of the socket. + // Refer to ioctlsocket in the Windows API documentation for additional information. + inline int CSocket::ioCtlSocket(long cmd, u_long* argp) const + { + int result = ::ioctlsocket(m_socket, cmd, argp); + if (result != 0) + TRACE("ioCtlSocket Failed\n"); + + return result; + } + + // Returns true if this system supports IP version 6. + inline bool CSocket::IsIPV6Supported() const + { + bool isIPV6Supported = FALSE; + + if (GetWinVersion() >= 2600) + isIPV6Supported = TRUE; + + return isIPV6Supported; + } + + // Places the socket in a state in which it is listening for an incoming connection. + // Refer to listen in the Windows API documentation for additional information. + inline int CSocket::Listen(int backlog /*= SOMAXCONN*/) const + { + int result = ::listen(m_socket, backlog); + if (result != 0) + TRACE("Listen Failed\n"); + + return result; + } + + // Receives data from the connected or bound socket. + // Refer to recv in the Windows API documentation for additional information. + inline int CSocket::Receive(char* buf, int len, int flags) const + { + int result = ::recv(m_socket, buf, len, flags); + if (SOCKET_ERROR == result) + TRACE(_T("Receive failed\n")); + return result; + } + + // Receives a datagram and stores the source address. + // Refer to recvfrom in the Windows API documentation for additional information. + inline int CSocket::ReceiveFrom(char* buf, int len, int flags, struct sockaddr* from, int* fromlen) const + { + int result = ::recvfrom(m_socket, buf, len, flags, from, fromlen); + if (SOCKET_ERROR == result) + TRACE(_T("ReceiveFrom failed\n")); + return result; + } + + // Sends data on the connected socket. + // Refer to send in the Windows API documentation for additional information. + inline int CSocket::Send(const char* buf, int len, int flags) const + { + int result = ::send(m_socket, buf, len, flags); + if (SOCKET_ERROR == result) + if (WSAGetLastError() != WSAEWOULDBLOCK) + TRACE(_T("Send failed\n")); + return result; + } + + // Sends data to a specific destination. + // Refer to sendto in the Windows API documentation for additional information. + inline int CSocket::SendTo(const char* buf, int len, int flags, const struct sockaddr* to, int tolen) const + { + int result = ::sendto(m_socket, buf, len, flags, to, tolen); + if (SOCKET_ERROR == result) + { + if (WSAGetLastError() != WSAEWOULDBLOCK) + TRACE(_T("SendTo failed\n")); + } + + return result; + } + + // Sends data to a specific destination. + // Refer to sendto in the Windows API documentation for additional information. + inline int CSocket::SendTo(const char* send, int len, int flags, LPCTSTR addr, UINT port) const + { + int result = 0; + + if (IsIPV6Supported()) + { + ADDRINFOT hints = {}; + hints.ai_flags = AI_NUMERICHOST | AI_PASSIVE; + ADDRINFOT *addrInfo; + CString portName; + portName.Format(_T("%u"), port); + + result = ::GetAddrInfo(addr, portName, &hints, &addrInfo); + if (result != 0) + { + TRACE("GetAddrInfo failed\n"); + return SOCKET_ERROR; + } + + result = ::sendto(m_socket, send, len, flags, addrInfo->ai_addr, static_cast(addrInfo->ai_addrlen) ); + if (result == SOCKET_ERROR ) + { + if (WSAGetLastError() != WSAEWOULDBLOCK) + { + TRACE("SendTo failed\n"); + return result; + } + } + + // Free the address information allocated by GetAddrInfo. + ::FreeAddrInfo(addrInfo); + } + else + { + sockaddr_in clientService = {}; + IN_ADDR ipv4_addr = {}; + inet_pton(AF_INET, TtoA(addr), &ipv4_addr); + clientService.sin_family = AF_INET; + clientService.sin_addr = ipv4_addr; + clientService.sin_port = htons( static_cast(port) ); + + result = ::sendto( m_socket, send, len, flags, reinterpret_cast( &clientService ), sizeof(clientService) ); + if (SOCKET_ERROR != result) + { + if (WSAGetLastError() != WSAEWOULDBLOCK) + TRACE("SendTo failed\n"); + } + + } + + return result; + } + + // Sets the socket option. + // Refer to setsockopt in the Windows API documentation for additional information. + inline int CSocket::SetSockOpt(int level, int optname, const char* optval, int optlen) const + { + int result = ::setsockopt(m_socket, level, optname, optval, optlen); + if (result != 0) + TRACE("SetSockOpt failed\n"); + + return result; + } + + // This function starts the thread that monitors the socket for events. + inline void CSocket::StartEvents() + { + StopEvents(); // Ensure the thread isn't already running. + + m_threadPtr->CreateThread(); + } + + // Terminates the event thread gracefully (if possible). + inline void CSocket::StopEvents() + { + // Ask the event thread to stop + m_stopRequest.SetEvent(); + + // Wait for the event thread to stop. + while (WAIT_TIMEOUT == ::WaitForSingleObject(*m_threadPtr, THREAD_TIMEOUT * 10)) + { + // Waiting for the event thread to signal the m_stopped event. + + // Note: An excessive delay in processing any of the notification functions + // can cause us to get here. + TRACE("*** Error: Event Thread won't die ***\n"); + } + + m_stopRequest.ResetEvent(); + } +} + +#endif // _WIN32XX_SOCKET_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_statusbar.h b/packages/media/cpp/packages/Win32xx/include/wxx_statusbar.h new file mode 100644 index 00000000..bed7be0b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_statusbar.h @@ -0,0 +1,272 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +#ifndef _WIN32XX_STATUSBAR_H_ +#define _WIN32XX_STATUSBAR_H_ + +#include "wxx_wincore.h" + +namespace Win32xx +{ + ////////////////////////////////////////////////////////////////// + // CStatusBar manages a status bar control. A status bar is a + // horizontal window at the bottom of a parent window in which + // an application can display various kinds of status information. + class CStatusBar : public CWnd + { + public: + CStatusBar() = default; + virtual ~CStatusBar() override = default; + + // Overridables + virtual BOOL OnEraseBkgnd(CDC& dc) override; + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual void PreRegisterClass(WNDCLASS& wc) override; + + // Accessors and mutators + int GetParts() const; + CRect GetPartRect(int part) const; + CString GetPartText(int part) const; + BOOL IsSimple() const; + BOOL SetPartText(int part, LPCTSTR text, UINT style = 0) const; + BOOL SetPartWidth(int part, int width) const; + HICON GetPartIcon(int part) const; + BOOL SetPartIcon(int part, HICON icon) const; + + // Operations + BOOL CreateParts(int parts, const int paneWidths[]) const; + void SetSimple(BOOL isSimple = TRUE) const; + + private: + CStatusBar(const CStatusBar&) = delete; + CStatusBar& operator=(const CStatusBar&) = delete; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + //////////////////////////////////////// + // Definitions for the CStatusBar class. + // + + // Sets the number of parts in a status window and the coordinate of the + // right edge of each part. If an element of iPaneWidths is -1, the right + // edge of the corresponding part extends to the border of the window. + // Refer to SB_SETPARTS in the Windows API documentation for more information. + inline BOOL CStatusBar::CreateParts(int parts, const int paneWidths[]) const + { + assert(IsWindow()); + assert(parts <= 256); + + WPARAM wparam = static_cast(parts); + LPARAM lparam = reinterpret_cast(paneWidths); + return static_cast(SendMessage(SB_SETPARTS, wparam, lparam)); + } + + // Retrieves a count of the parts in the status bar. + // Refer to SB_GETPARTS in the Windows API documentation for more information. + inline int CStatusBar::GetParts() const + { + assert(IsWindow()); + return static_cast(SendMessage(SB_GETPARTS, 0, 0)); + } + + // Retrieves the icon for a part in the status bar. + // Refer to SB_GETICON in the Windows API documentation for more information. + inline HICON CStatusBar::GetPartIcon(int part) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(part); + return reinterpret_cast(SendMessage(SB_GETICON, wparam, 0)); + } + + // Retrieves the bounding rectangle of a part in the status bar. + // Refer to SB_GETRECT in the Windows API documentation for more information. + inline CRect CStatusBar::GetPartRect(int part) const + { + assert(IsWindow()); + + CRect rc; + WPARAM wparam = static_cast(part); + LPARAM lparam = reinterpret_cast(&rc); + SendMessage(SB_GETRECT, wparam, lparam); + return rc; + } + + // Retrieves the text from a part in the status bar. + // Refer to SB_GETTEXT in the Windows API documentation for more information. + inline CString CStatusBar::GetPartText(int part) const + { + assert(IsWindow()); + CString PaneText; + + // Get size of Text array + WPARAM wparam = static_cast(part); + int chars = LOWORD (SendMessage(SB_GETTEXTLENGTH, wparam, 0)); + CString str; + + LPARAM lparam = reinterpret_cast(str.GetBuffer(chars)); + SendMessage(SB_GETTEXT, wparam, lparam); + str.ReleaseBuffer(); + return str; + } + + // Checks the status bar control to determine if it is in simple mode. + // Refer to SB_ISSIMPLE in the Windows API documentation for more information. + inline BOOL CStatusBar::IsSimple() const + { + assert(IsWindow()); + return static_cast(SendMessage(SB_ISSIMPLE, 0, 0)); + } + + // Called when the background needs erasing. + inline BOOL CStatusBar::OnEraseBkgnd(CDC& dc) + { + // Permit the parent window to handle the drawing of the StatusBar's + // background. Return TRUE to suppress default background drawing. + return static_cast(GetParent().SendMessage(UWM_DRAWSBBKGND, + reinterpret_cast(&dc), reinterpret_cast(this))); + } + + // Called by Create to set the window creation parameters. + inline void CStatusBar::PreCreate(CREATESTRUCT& cs) + { + cs.style |= WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | CCS_BOTTOM; + + // Add the gripper style if the parent window is resizable. + HWND parent = cs.hwndParent; + DWORD dwParentStyle = static_cast(::GetWindowLongPtr(parent, GWL_STYLE)); + if (dwParentStyle & WS_THICKFRAME) + { + cs.style |= SBARS_SIZEGRIP; + } + } + + // Called by Create to set the window class parameters. + inline void CStatusBar::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = STATUSCLASSNAME; + } + + // Set the text in a status bar part. + // The Style parameter can be a combinations of ... + //0 The text is drawn with a border to appear lower than the plane of the window. + //SBT_NOBORDERS The text is drawn without borders. + //SBT_OWNERDRAW The text is drawn by the parent window. + //SBT_POPOUT The text is drawn with a border to appear higher than the plane of the window. + //SBT_RTLREADING The text will be displayed in the opposite direction to the text in the parent window. + // Refer to SB_SETTEXT in the Windows API documentation for more information. + inline BOOL CStatusBar::SetPartText(int part, LPCTSTR text, UINT style) const + { + assert(IsWindow()); + + BOOL result = FALSE; + if (static_cast(SendMessage(SB_GETPARTS, 0, 0) >= part)) + { + WPARAM wparam = static_cast(part | style); + LPARAM lparam = reinterpret_cast(text); + result = static_cast(SendMessage(SB_SETTEXT, wparam, lparam)); + } + + return result; + } + + // Sets the icon for a part in the status bar. + // Refer to SB_SETICON in the Windows API documentation for more information. + inline BOOL CStatusBar::SetPartIcon(int part, HICON icon) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(part); + LPARAM lparam = reinterpret_cast(icon); + return static_cast(SendMessage(SB_SETICON, wparam, lparam)); + } + + // Changes the width of an existing pane, or creates a new pane with the + // specified width. A width of -1 for the last part sets the width to the + // border of the window. + // Refer to SB_SETPARTS in the Windows API documentation for more information. + inline BOOL CStatusBar::SetPartWidth(int part, int width) const + { + assert(IsWindow()); + assert(part >= 0 && part <= 255); + + // Fill the oldWidths vector with the current width of the StatusBar + // parts. + size_t oldCount = static_cast(SendMessage(SB_GETPARTS, 0, 0)); + std::vector oldWidths(oldCount, 0); + SendMessage(SB_GETPARTS, static_cast(oldCount), + reinterpret_cast(oldWidths.data())); + + // Fill the newWidths vector with the new width of the StatusBar parts. + size_t newCount = std::max(static_cast(part) +1, oldCount); + std::vector newWidths(newCount, 0); + newWidths.insert(newWidths.begin(), oldWidths.begin(), oldWidths.end()); + int* pNewWidthsArray = newWidths.data(); + + if (part == 0) + pNewWidthsArray[part] = width; + else + { + if (width >= 0) + pNewWidthsArray[part] = pNewWidthsArray[part -1] + width; + else + pNewWidthsArray[part] = -1; + } + + // Set the StatusBar parts with our new parts count and part widths. + return static_cast(SendMessage(SB_SETPARTS, static_cast(newCount), + reinterpret_cast(pNewWidthsArray))); + } + + // Specifies whether a status window displays simple text or displays all + // window parts set by a previous SB_SETPARTS message. + // Refer to SB_SIMPLE in the Windows API documentation for more information. + inline void CStatusBar::SetSimple(BOOL isSimple /* = TRUE*/) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(isSimple); + SendMessage(SB_SIMPLE, wparam, 0); + } + +} // namespace Win32xx + +#endif // _WIN32XX_STATUSBAR_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_stdcontrols.h b/packages/media/cpp/packages/Win32xx/include/wxx_stdcontrols.h new file mode 100644 index 00000000..44f30af4 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_stdcontrols.h @@ -0,0 +1,1416 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////// +// wxx_stdcontrols.h +// Declaration of the CButton, CEdit, CListBox and CStatic classes + +// The Button, Edit, ListBox and Static controls are often referred to +// as "standard controls". These set of older controls were originally +// developed for Win16 operating systems (Windows 3.1 and 3.11). They use an +// older form of notification, and send their notifications via a WM_COMMAND +// message. Newer controls send their notifications via a WM_NOTIFY message. + + +#ifndef _WIN32XX_STDCONTROLS_H_ +#define _WIN32XX_STDCONTROLS_H_ + +#include "wxx_wincore.h" + + +namespace Win32xx +{ + + //////////////////////////////////////////////////////////////////// + // The CButton class provides the functionality of a button control. + // A button is a control the user can click to provide input to an + // application. + class CButton : public CWnd + { + public: + CButton() = default; + virtual ~CButton() = default; + + // Accessors and mutators + HBITMAP GetBitmap() const; + UINT GetButtonStyle() const; + int GetCheck() const; + HCURSOR GetCursor() const; + HICON GetIcon() const; + UINT GetState() const; + HBITMAP SetBitmap(HBITMAP bitmap) const; + void SetButtonStyle(DWORD style, BOOL redraw) const; + void SetCheck(int checkState) const; + HCURSOR SetCursor(HCURSOR cursor) const; + HICON SetIcon(HICON icon) const; + void SetState(UINT state) const; + + protected: + // Overridables + virtual void PreRegisterClass(WNDCLASS& wc); + + private: + CButton(const CButton&) = delete; + CButton& operator=(const CButton&) = delete; + }; + + + /////////////////////////////////////////////////////////////////// + // CEdit manages an edit control. An edit control is a rectangular + // control window typically used in a dialog box to permit the user + // to enter and edit text by typing on the keyboard. + class CEdit : public CWnd + { + public: + // Construction + CEdit() = default; + virtual ~CEdit() override = default; + + // Attributes + void AppendText(LPCTSTR text) const; + BOOL CanUndo() const; + int CharFromPos(CPoint pt) const; + int GetFirstVisibleLine() const; + HLOCAL GetHandle() const; + UINT GetLimitText() const; + int GetLine(int index, LPTSTR buffer) const; + int GetLine(int index, LPTSTR buffer, int maxLength) const; + int GetLineCount() const; + DWORD GetMargins() const; + BOOL GetModify() const; + TCHAR GetPasswordChar() const; + void GetRect(RECT& rc) const; + CRect GetRect() const; + void GetSel(int& startChar, int& endChar) const; + DWORD GetSel() const; + long GetTextLength() const; + CPoint PosFromChar(UINT index) const; + void SetHandle(HLOCAL buffer) const; + void SetLimitText(UINT max) const; + void SetMargins(UINT left, UINT right) const; + void SetModify(BOOL isModified = TRUE) const; + + // Operations + void EmptyUndoBuffer() const; + BOOL FmtLines(BOOL addEOL) const; + void LimitText(int limit = 0) const; + int LineFromChar(int index = -1) const; + int LineIndex(int line = -1) const; + int LineLength(int line = -1) const; + void LineScroll(int lines, int chars = 0) const; + void ReplaceSel(LPCTSTR newText, BOOL canUndo) const; + void SetPasswordChar(TCHAR ch) const; + BOOL SetReadOnly(BOOL isReadOnly = TRUE) const; + void SetRect(RECT rc) const; + void SetRectNP(RECT rc) const; + void SetSel(DWORD selection, BOOL isScrolled = TRUE) const; + void SetSel(int startChar, int endChar, BOOL isScrolled = TRUE) const; + BOOL SetTabStops(int tabStops, LPINT pTabStopsArray) const; + BOOL SetTabStops() const; + BOOL SetTabStops(int cxEachStop) const; + + //Clipboard Operations + void Clear() const; + void Copy() const; + void Cut() const; + void Paste() const; + void Undo() const; + + protected: + // Overridables + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual void PreRegisterClass(WNDCLASS& wc) override; + + private: + CEdit(const CEdit&) = delete; + CEdit& operator=(const CEdit&) = delete; + }; + + + //////////////////////////////////////////////////////////// + // CListBox manages a list box control. List boxes display a + // list from which a user can select one or more items. + class CListBox : public CWnd + { + public: + CListBox() = default; + virtual ~CListBox() override = default; + + // Virtual functions + virtual int CompareItem(LPCOMPAREITEMSTRUCT pCompareItemStruct); + + // General Operations + int GetCount() const; + int GetHorizontalExtent() const; + DWORD GetItemData(int index) const; + void* GetItemDataPtr(int index) const; + int GetItemHeight(int index) const; + int GetItemRect(int index, RECT& rc) const; + CRect GetItemRect(int index) const; + LCID GetLocale() const; + int GetSel(int index) const; + int GetText(int index, LPTSTR buffer) const; + int GetTextLen(int index) const; + int GetTopIndex() const; + UINT ItemFromPoint(CPoint pt, BOOL& isOutside ) const; + void SetColumnWidth(int cxWidth) const; + void SetHorizontalExtent(int cxExtent) const; + int SetItemData(int index, DWORD itemData) const; + int SetItemDataPtr(int index, void* pData) const; + int SetItemHeight(int index, UINT cyItemHeight) const; + LCID SetLocale(LCID newLocale) const; + BOOL SetTabStops(int tabStops, LPINT pTabStopsArray) const; + void SetTabStops() const; + BOOL SetTabStops(int cxEachStop) const; + int SetTopIndex(int index) const; + + // Single-Selection Operations + int GetCurSel() const; + int SetCurSel(int select) const; + + // Multiple-Selection Operations + int GetAnchorIndex() const; + int GetCaretIndex() const; + int GetSelCount() const; + int GetSelItems(int maxItems, LPINT pItemArray) const; + int SelItemRange(BOOL isSelected, int firstItem, int lastItem) const; + void SetAnchorIndex(int index) const; + int SetCaretIndex(int index, BOOL partialScroll) const; + int SetSel(int index, BOOL isSelected) const; + + // String Operations + int AddString(LPCTSTR string) const; + int DeleteString(UINT index) const; + int Dir(UINT attr, LPCTSTR wildCard) const; + int FindString(int startAfter, LPCTSTR string) const; + int FindStringExact(int indexStart, LPCTSTR findString) const; + int InsertString(int index, LPCTSTR string) const; + void ResetContent() const; + int SelectString(int startAfter, LPCTSTR string) const; + + protected: + // Overridables + virtual LRESULT OnMessageReflect(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual void PreRegisterClass(WNDCLASS& wc) override; + + private: + CListBox(const CListBox&) = delete; + CListBox& operator=(const CListBox&) = delete; + }; + + + /////////////////////////////////////////////////////////// + // CStatic manages a static control. Applications often use + // static controls to label other controls or to separate a + // group of controls. + class CStatic : public CWnd + { + public: + CStatic() = default; + virtual ~CStatic() override = default; + + // Operations + HBITMAP GetBitmap() const; + HCURSOR GetCursor() const; + HENHMETAFILE GetEnhMetaFile() const; + HICON GetIcon() const; + HBITMAP SetBitmap(HBITMAP bitmap) const; + HCURSOR SetCursor(HCURSOR cursor) const; + HENHMETAFILE SetEnhMetaFile(HENHMETAFILE metaFile) const; + HICON SetIcon(HICON icon) const; + + protected: + // Overridables + virtual void PreRegisterClass(WNDCLASS& wc) override; + + private: + CStatic(const CStatic&) = delete; + CStatic& operator=(const CStatic&) = delete; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + ///////////////////////////////////// + // Definitions for the CButton class. + // + + // Returns the handle to the bitmap associated with the button. + // Refer to BM_GETIMAGE in the Windows API documentation for more information. + inline HBITMAP CButton::GetBitmap() const + { + assert(IsWindow()); + return reinterpret_cast(SendMessage(BM_GETIMAGE, IMAGE_BITMAP, 0)); + } + + // Returns the style of the button. Possible styles are: + // BS_3STATE, BS_AUTO3STATE, BS_AUTOCHECKBOX, BS_AUTORADIOBUTTON, + // BS_CHECKBOX, BS_DEFPUSHBUTTON, BS_GROUPBOX, BS_LEFTEXT, BS_OWNERDRAW, + // BS_BITMAP, BS_BOTTOM, BS_CENTER, BS_ICON, BS_FLAT, BS_MULTILINE, + // BS_PUSHLIKE, BS_RIGHT, BS_RIGHTBUTTON, BS_TEXT, BS_TOP, BS_TYHPEMASK, + // BS_VCENTER. + inline UINT CButton::GetButtonStyle() const + { + assert(IsWindow()); + return static_cast(GetStyle() & 0xFFFF); + } + + // Returns the check state of the button. The possible states are: + // BST_CHECKED Button is checked. + // BST_INDETERMINATE Button is grayed. + // BST_UNCHECKED Button is cleared. + // Refer to BM_GETCHECK in the Windows API documentation for more information. + inline int CButton::GetCheck() const + { + assert(IsWindow()); + return static_cast(SendMessage(BM_GETCHECK, 0, 0)); + } + + // Returns the handle to the cursor associated with the button. + // Refer to BM_GETIMAGE in the Windows API documentation for more information. + inline HCURSOR CButton::GetCursor() const + { + assert(IsWindow()); + return reinterpret_cast(SendMessage(BM_GETIMAGE, IMAGE_CURSOR, 0)); + } + + // Returns the handle to the icon associated with the button. + // Refer to BM_GETIMAGE in the Windows API documentation for more information. + inline HICON CButton::GetIcon() const + { + assert(IsWindow()); + return reinterpret_cast(SendMessage(BM_GETIMAGE, IMAGE_ICON, 0)); + } + + // Returns the state of the button. Possible states are: + // BST_CHECKED + // BST_FOCUS + // BST_INDETERMINATE + // BST_PUSHED + // BST_UNCHECKED + // Refer to BM_GETSTATE in the Windows API documentation for more information. + inline UINT CButton::GetState() const + { + assert(IsWindow()); + return static_cast(SendMessage(BM_GETSTATE, 0, 0)); + } + + // Sets the window class. + inline void CButton::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = _T("Button"); + } + + // sets the bitmap associated with the button. + // Refer to BM_SETIMAGE in the Windows API documentation for more information. + inline HBITMAP CButton::SetBitmap(HBITMAP bitmap) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(bitmap); + return reinterpret_cast(SendMessage(BM_SETIMAGE, IMAGE_BITMAP, lparam)); + } + + // Sets the button style. Possible styles are: + // BS_3STATE, BS_AUTO3STATE, BS_AUTOCHECKBOX, BS_AUTORADIOBUTTON, + // BS_CHECKBOX, BS_DEFPUSHBUTTON, BS_GROUPBOX, BS_LEFTEXT, BS_OWNERDRAW, + // BS_BITMAP, BS_BOTTOM, BS_CENTER, BS_ICON, BS_FLAT, BS_MULTILINE, + // BS_PUSHLIKE, BS_RIGHT, BS_RIGHTBUTTON, BS_TEXT, BS_TOP, BS_TYHPEMASK, + // BS_VCENTER. + // Refer to BM_SETSTYLE in the Windows API documentation for more information. + inline void CButton::SetButtonStyle(DWORD style, BOOL redraw) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(style); + LPARAM lparam = static_cast(redraw); + SendMessage(BM_SETSTYLE, wparam, lparam); + } + + // Sets the button check state. The possible states are: + // BST_CHECKED Button is checked. + // BST_INDETERMINATE Button is grayed. + // BST_UNCHECKED Button is cleared. + // Refer to BM_SETCHECK in the Windows API documentation for more information. + inline void CButton::SetCheck(int checkState) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(checkState); + SendMessage(BM_SETCHECK, wparam, 0); + } + + // Sets the cursor associated with the button. + // Refer to BM_SETIMAGE in the Windows API documentation for more information. + inline HCURSOR CButton::SetCursor(HCURSOR cursor) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(cursor); + return reinterpret_cast(SendMessage(BM_SETIMAGE, IMAGE_CURSOR, lparam)); + } + + // Sets the icon associated with the button. + // Refer to BM_SETIMAGE in the Windows API documentation for more information. + inline HICON CButton::SetIcon(HICON icon) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(icon); + return reinterpret_cast(SendMessage( BM_SETIMAGE, IMAGE_ICON, lparam)); + } + + // Sets the state of the button. Possible states are: + // BST_CHECKED + // BST_FOCUS + // BST_INDETERMINATE + // BST_PUSHED + // BST_UNCHECKED + // Refer to BM_SETSTATE in the Windows API documentation for more information. + inline void CButton::SetState(UINT state) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(state); + SendMessage(BM_SETSTATE, wparam, 0); + } + + + /////////////////////////////////// + // Definitions for the CEdit class. + // + + // Adds text to the end of the document. + inline void CEdit::AppendText(LPCTSTR text) const + { + LRESULT position = SendMessage(WM_GETTEXTLENGTH, 0, 0); + WPARAM wparam = static_cast(position); + LPARAM lparam = static_cast(position); + SendMessage(EM_SETSEL, wparam, lparam); + lparam = reinterpret_cast(text); + SendMessage(EM_REPLACESEL, 0, lparam); + } + + // Returns TRUE if the edit control operation can be undone. + // Refer to EM_CANUNDO in the Windows API documentation for more information. + inline BOOL CEdit::CanUndo() const + { + assert(IsWindow()); + return static_cast(SendMessage(EM_CANUNDO, 0, 0)); + } + + // Returns the character index and line index of the character nearest the + // specified point. + // Refer to EM_CHARFROMPOS in the Windows API documentation for more information. + inline int CEdit::CharFromPos(CPoint pt) const + { + assert(IsWindow()); + return static_cast(SendMessage(EM_CHARFROMPOS, 0, MAKELPARAM(pt.x, pt.y))); + } + + // Clears the current selection, if any, in an edit control. + // Refer to WM_CLEAR in the Windows API documentation for more information. + inline void CEdit::Clear() const + { + assert(IsWindow()); + SendMessage(WM_CLEAR, 0, 0); + } + + // Copies text to the clipboard unless the style is ES_PASSWORD, in which + // case the message returns zero. + // Refer to WM_COPY in the Windows API documentation for more information. + inline void CEdit::Copy() const + { + assert(IsWindow()); + SendMessage(WM_COPY, 0, 0); + } + + // Cuts the selection to the clipboard, or deletes the character to the + // left of the cursor if there is no selection. + // Refer to WM_CUT in the Windows API documentation for more information. + inline void CEdit::Cut() const + { + assert(IsWindow()); + SendMessage(WM_CUT, 0, 0); + } + + // Returns the zero-based index of the first visible character in a + // single-line edit control or the zero-based index of the uppermost + // visible line in a multi-line edit control. + // Refer to EM_GETFIRSTVISIBLELINE in the Windows API documentation for more information. + inline int CEdit::GetFirstVisibleLine() const + { + assert(IsWindow()); + return static_cast(SendMessage(EM_GETFIRSTVISIBLELINE, 0, 0)); + } + + // Returns a handle identifying the buffer containing the multi-line edit + // control's text. + // It is not processed by single-line edit controls. + // Refer to EM_GETHANDLE in the Windows API documentation for more information. + inline HLOCAL CEdit::GetHandle() const + { + assert(IsWindow()); + return reinterpret_cast(SendMessage(EM_GETHANDLE, 0, 0)); + } + + // Returns the current text limit, in characters. + // Refer to EM_GETLIMITTEXT in the Windows API documentation for more information. + inline UINT CEdit::GetLimitText() const + { + assert(IsWindow()); + return static_cast(SendMessage(EM_GETLIMITTEXT, 0, 0)); + } + + // Copies characters to a buffer and returns the number of characters copied. + // Set the first word of buffer to the size of the buffer in TCHARs. + // The copied line does not contain a terminating null character. + // Refer to EM_GETLINE in the Windows API documentation for more information. + inline int CEdit::GetLine(int index, LPTSTR buffer) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + LPARAM lparam = reinterpret_cast(buffer); + return static_cast(SendMessage(EM_GETLINE, wparam, lparam)); + } + + // Copies characters to a buffer and returns the number of characters copied. + // The copied line does not contain a terminating null character + // Refer to EM_GETLINE in the Windows API documentation for more information. + inline int CEdit::GetLine(int index, LPTSTR buffer, int maxLength) const + { + assert(IsWindow()); + + // set the first word of this buffer to the size, in TCHARs, of the buffer. + *reinterpret_cast(buffer) = static_cast(maxLength); + WPARAM wparam = static_cast(index); + LPARAM lparam = reinterpret_cast(buffer); + return static_cast(SendMessage(EM_GETLINE, wparam, lparam)); + } + + // Returns the number of lines in the edit control. + // Refer to EM_GETLINECOUNT in the Windows API documentation for more information. + inline int CEdit::GetLineCount() const + { + assert(IsWindow()); + return static_cast(SendMessage(EM_GETLINECOUNT, 0, 0)); + } + + // Returns the widths of the left and right margins. + // Refer to EM_GETMARGINS in the Windows API documentation for more information. + inline DWORD CEdit::GetMargins() const + { + assert(IsWindow()); + return static_cast(SendMessage(EM_GETMARGINS, 0, 0)); + } + + // Returns a flag indicating whether the content of an edit control has + // been modified. + // Refer to EM_GETMODIFY in the Windows API documentation for more information. + inline BOOL CEdit::GetModify() const + { + assert(IsWindow()); + return static_cast(SendMessage(EM_GETMODIFY, 0, 0)); + } + + // Returns the character that edit controls use in conjunction with the + // ES_PASSWORD style. + // Refer to EM_GETPASSWORDCHAR in the Windows API documentation for more information. + inline TCHAR CEdit::GetPasswordChar() const + { + assert(IsWindow()); + return static_cast(SendMessage(EM_GETPASSWORDCHAR, 0, 0)); + } + + // Returns the coordinates of the formatting rectangle in an edit control. + // Refer to EM_GETRECT in the Windows API documentation for more information. + inline void CEdit::GetRect(RECT& rc) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&rc); + SendMessage(EM_GETRECT, 0, lparam); + } + + // Returns the coordinates of the formatting rectangle in an edit control. + // Refer to EM_GETRECT in the Windows API documentation for more information. + inline CRect CEdit::GetRect() const + { + assert(IsWindow()); + CRect rc; + LPARAM lparam = reinterpret_cast(&rc); + SendMessage(EM_GETRECT, 0, lparam); + return rc; + } + + // Retrieves the starting and ending character positions of the current + // selection in the edit control. + // Refer to EM_GETSEL in the Windows API documentation for more information. + inline void CEdit::GetSel(int& startChar, int& endChar) const + { + assert(IsWindow()); + WPARAM wparam = reinterpret_cast(&startChar); + LPARAM lparam = reinterpret_cast(&endChar); + SendMessage(EM_GETSEL, wparam, lparam); + } + + // Retrieves the starting and ending character positions of the current + // selection in the edit control. + // Refer to EM_GETSEL in the Windows API documentation for more information. + inline DWORD CEdit::GetSel() const + { + assert(IsWindow()); + return static_cast(SendMessage(EM_GETSEL, 0, 0)); + } + + // Retrieves the length of the text, in characters. Does not include the + // terminating null character. + // Refer to WM_GETTEXTLENGTH in the Windows API documentation for more information. + inline long CEdit::GetTextLength() const + { + assert(IsWindow()); + return static_cast(SendMessage(WM_GETTEXTLENGTH, 0, 0)); + } + + // Empties the undo buffer. The CanUndo function will now return FALSE. + // Refer to EM_EMPTYUNDOBUFFER in the Windows API documentation for more information. + inline void CEdit::EmptyUndoBuffer() const + { + assert(IsWindow()); + SendMessage(EM_EMPTYUNDOBUFFER, 0, 0); + } + + // Adds or removes soft line-break characters (two carriage returns and a + // line feed) to the ends of wrapped lines in a multi-line edit control. + // It is not processed by single-line edit controls. + // Refer to EM_FMTLINES in the Windows API documentation for more information. + inline BOOL CEdit::FmtLines(BOOL addEOL) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(addEOL); + return static_cast(SendMessage(EM_FMTLINES, wparam, 0)); + } + + // Sets the text limit of an edit control. The text limit is the maximum + // amount of text, in TCHARs, that the user can type into the edit control. + // Refer to EM_LIMITTEXT in the Windows API documentation for more information. + inline void CEdit::LimitText(int limit) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(limit); + SendMessage(EM_LIMITTEXT, wparam, 0); + } + + // Returns the zero-based number of the line in a multi-line edit control + // that contains a specified character index. + // This message is the reverse of LineIndex function. + // Refer to EM_LINEFROMCHAR in the Windows API documentation for more information. + inline int CEdit::LineFromChar(int index) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + return static_cast(SendMessage(EM_LINEFROMCHAR, wparam, 0)); + } + + // Returns the character of a line in a multi-line edit control. + // This message is the reverse of the LineFromChar function. + // Refer to EM_LINEINDEX in the Windows API documentation for more information. + inline int CEdit::LineIndex(int line) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(line); + return static_cast(SendMessage(EM_LINEINDEX, wparam, 0)); + } + + // Returns the length, in characters, of a single-line edit control. In a + // multi-line edit control, returns the length, in characters, of a + // specified line. + // Refer to EM_LINELENGTH in the Windows API documentation for more information. + inline int CEdit::LineLength(int line) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(line); + return static_cast(SendMessage(EM_LINELENGTH, wparam, 0)); + } + + // Scrolls the text vertically in a single-line edit control or + // horizontally in a multi-line edit control. + // Refer to EM_LINESCROLL in the Windows API documentation for more information. + inline void CEdit::LineScroll(int lines, int chars) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(chars); + LPARAM lparam = static_cast(lines); + SendMessage(EM_LINESCROLL, wparam, lparam); + } + + // Pastes text from the clipboard into the edit control window at the caret + // position. + // Refer to WM_PASTE in the Windows API documentation for more information. + inline void CEdit::Paste() const + { + assert(IsWindow()); + SendMessage(WM_PASTE, 0, 0); + } + + // Returns the client coordinates of the specified character. + // Refer to EM_POSFROMCHAR in the Windows API documentation for more information. + inline CPoint CEdit::PosFromChar(UINT index) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + return static_cast(SendMessage(EM_POSFROMCHAR, wparam, 0)); + } + + // Set the default window styles. + inline void CEdit::PreCreate(CREATESTRUCT& cs) + { + cs.style = WS_CHILD | WS_VISIBLE | ES_MULTILINE; + } + + // Set the window class. + inline void CEdit::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = _T("Edit"); + } + + // Replaces the current selection with the text in an application-supplied + // buffer, sends the parent window EN_UPDATE and EN_CHANGE messages, and + // updates the undo buffer. + // Refer to EM_REPLACESEL in the Windows API documentation for more information. + inline void CEdit::ReplaceSel(LPCTSTR newText, BOOL canUndo) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(canUndo); + LPARAM lparam = reinterpret_cast(newText); + SendMessage(EM_REPLACESEL, wparam, lparam); + } + + // Sets a handle to the memory used as a text buffer, empties the undo + // buffer, resets the scroll positions to zero, and redraws the window. + // Refer to EM_SETHANDLE in the Windows API documentation for more information. + inline void CEdit::SetHandle(HLOCAL buffer) const + { + assert(IsWindow()); + WPARAM wparam = reinterpret_cast(buffer); + SendMessage(EM_SETHANDLE, wparam, 0); + } + + // Sets the maximum number of characters the user may enter in the edit + // control. + // Refer to EM_SETLIMITTEXT in the Windows API documentation for more information. + inline void CEdit::SetLimitText(UINT max) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(max); + SendMessage(EM_SETLIMITTEXT, wparam, 0); + } + + // Sets the widths of the left and right margins, and redraws the edit + // control to reflect the new margins. + // Refer to EM_SETMARGINS in the Windows API documentation for more information. + inline void CEdit::SetMargins(UINT left, UINT right) const + { + assert(IsWindow()); + LPARAM lparam = static_cast(MAKELONG(left, right)); + SendMessage(EM_SETMARGINS, (EC_LEFTMARGIN | EC_RIGHTMARGIN), lparam); + } + + // Sets or clears the modification flag to indicate whether the edit + // control has been modified. + // Refer to EM_SETMODIFY in the Windows API documentation for more information. + inline void CEdit::SetModify(BOOL isModified) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(isModified); + SendMessage(EM_SETMODIFY, wparam, 0); + } + + // Defines the character that edit controls use in conjunction with the + // ES_PASSWORD style. + // Refer to EM_SETPASSWORDCHAR in the Windows API documentation for more information. + inline void CEdit::SetPasswordChar(TCHAR ch) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(ch); + SendMessage(EM_SETPASSWORDCHAR, wparam, 0); + } + + // Sets or removes the read-only style (ES_READONLY) in an edit control. + // Refer to EM_SETREADONLY in the Windows API documentation for more information. + inline BOOL CEdit::SetReadOnly(BOOL isReadOnly) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(isReadOnly); + return static_cast(SendMessage(EM_SETREADONLY, wparam, 0)); + } + + // Sets the formatting rectangle for the multi-line edit control and + // redraws the window. + // Refer to EM_SETRECT in the Windows API documentation for more information. + inline void CEdit::SetRect(RECT rc) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&rc); + SendMessage(EM_SETRECT, 0, lparam); + } + + // Sets the formatting rectangle for the multi-line edit control but does + // not redraw the window. + // Refer to EM_SETRECTNP in the Windows API documentation for more information. + inline void CEdit::SetRectNP(RECT rc) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&rc); + SendMessage(EM_SETRECTNP, 0, lparam); + } + + // Selects a range of characters in the edit control by setting the + //starting and ending positions to be selected. + // Refer to EM_SETSEL in the Windows API documentation for more information. + inline void CEdit::SetSel(DWORD selection, BOOL isScrolled) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(LOWORD(selection)); + LPARAM lparam = static_cast(HIWORD(selection)); + SendMessage(EM_SETSEL, wparam, lparam); + if (isScrolled) + SendMessage(EM_SCROLLCARET, 0, 0); + } + + // Selects a range of characters in the edit control by setting the + // starting and ending positions to be selected. + // Refer to EM_SETSEL in the Windows API documentation for more information. + inline void CEdit::SetSel(int startChar, int endChar, BOOL isScrolled) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(startChar); + LPARAM lparam = static_cast(endChar); + SendMessage(EM_SETSEL, wparam, lparam); + if (isScrolled) + SendMessage(EM_SCROLLCARET, 0, 0); + } + + // Sets tab-stop positions in the multi-line edit control. + // Refer to EM_SETTABSTOPS in the Windows API documentation for more information. + inline BOOL CEdit::SetTabStops(int tabStops, LPINT pTabStopsArray) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(tabStops); + LPARAM lparam = reinterpret_cast(pTabStopsArray); + return static_cast(SendMessage(EM_SETTABSTOPS, wparam, lparam)); + } + + // Sets tab-stop positions in the multi-line edit control. + // Refer to EM_SETTABSTOPS in the Windows API documentation for more information. + inline BOOL CEdit::SetTabStops() const + { + assert(IsWindow()); + return static_cast(SendMessage(EM_SETTABSTOPS, 0, 0)); + } + + // Sets tab-stop positions in the multi-line edit control. + // Refer to EM_SETTABSTOPS in the Windows API documentation for more information. + inline BOOL CEdit::SetTabStops(int cxEachStop) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(1); + LPARAM lparam = reinterpret_cast(&cxEachStop); + return static_cast(SendMessage(EM_SETTABSTOPS, wparam, lparam)); + } + + // Removes any text that was just inserted or inserts any deleted + // characters and sets the selection to the inserted text. + // Refer to EM_UNDO in the Windows API documentation for more information. + inline void CEdit::Undo() const + { + assert(IsWindow()); + SendMessage(EM_UNDO, 0, 0); + } + + + ////////////////////////////////////// + // Definitions for the CListbox class. + // + + // Adds a string to a list box and returns its index. + // Refer to LB_ADDSTRING in the Windows API documentation for more information. + inline int CListBox::AddString(LPCTSTR string) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(string); + return static_cast(SendMessage(LB_ADDSTRING, 0, lparam)); + } + + // Called by in response to the WM_COMPAREITEM message to determine the + // relative position of a new item in a sorted owner-draw list box. + // Override this function in an owner-drawn List-Box to specify the sort + // order when items are added using AddString. + inline int CListBox::CompareItem(LPCOMPAREITEMSTRUCT) + { + // The return value indicates the relative position of the two items. + // It may be any of the values shown in the following table. + // + // Value Meaning + // -1 Item 1 precedes item 2 in the sorted order. + // 0 Items 1 and 2 are equivalent in the sorted order. + // 1 Item 1 follows item 2 in the sorted order. + + return 0; + } + + // Removes a string from a list box and returns the number of strings + // remaining in the list. + // Refer to LB_DELETESTRING in the Windows API documentation for more information. + inline int CListBox::DeleteString(UINT index) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + return static_cast(SendMessage(LB_DELETESTRING, wparam, 0)); + } + + // Adds a list of filenames to a list box and returns the index of the last + // filename added. + // Refer to LB_DIR in the Windows API documentation for more information. + inline int CListBox::Dir(UINT attr, LPCTSTR wildCard) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(attr); + LPARAM lparam = reinterpret_cast(wildCard); + return static_cast(SendMessage(LB_DIR, wparam, lparam)); + } + + // Returns the index of the first string in the list box that begins with a + // specified string. + // Refer to LB_FINDSTRING in the Windows API documentation for more information. + inline int CListBox::FindString(int startAfter, LPCTSTR string) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(startAfter); + LPARAM lparam = reinterpret_cast(string); + return static_cast(SendMessage(LB_FINDSTRING, wparam, lparam)); + } + + // Returns the index of the string in the list box that is equal to a + // specified string. + // Refer to LB_FINDSTRINGEXACT in the Windows API documentation for more information. + inline int CListBox::FindStringExact(int indexStart, LPCTSTR findString) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(indexStart); + LPARAM lparam = reinterpret_cast(findString); + return static_cast(SendMessage(LB_FINDSTRINGEXACT, wparam, lparam)); + } + + // Inserts a string at a specified index in a list box. + // Refer to LB_INSERTSTRING in the Windows API documentation for more information. + inline int CListBox::InsertString(int index, LPCTSTR string) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + LPARAM lparam = reinterpret_cast(string); + return static_cast(SendMessage(LB_INSERTSTRING, wparam, lparam)); + } + + // Returns the index of the item that the mouse last selected. + // Refer to LB_GETANCHORINDEX in the Windows API documentation for more information. + inline int CListBox::GetAnchorIndex() const + { + assert(IsWindow()); + return static_cast(SendMessage(LB_GETANCHORINDEX, 0, 0)); + } + + // Returns the index of the item that has the focus rectangle. + // Refer to LB_GETCARETINDEX in the Windows API documentation for more information. + inline int CListBox::GetCaretIndex() const + { + assert(IsWindow()); + return static_cast(SendMessage(LB_GETCARETINDEX, 0, 0)); + } + + // Returns the number of items in the list box. + // Refer to LB_GETCOUNT in the Windows API documentation for more information. + inline int CListBox::GetCount() const + { + assert(IsWindow()); + return static_cast(SendMessage(LB_GETCOUNT, 0, 0)); + } + + // Returns the index of the currently selected item. + // Refer to LB_GETCURSEL in the Windows API documentation for more information. + inline int CListBox::GetCurSel() const + { + assert(IsWindow()); + return static_cast(SendMessage(LB_GETCURSEL, 0, 0)); + } + + // Returns the scrollable width, in pixels, of a list box. + // Refer to LB_GETHORIZONTALEXTENT in the Windows API documentation for more information. + inline int CListBox::GetHorizontalExtent() const + { + assert(IsWindow()); + return static_cast(SendMessage(LB_GETHORIZONTALEXTENT, 0, 0)); + } + + // Returns the value associated with the specified item. + // Refer to LB_GETITEMDATA in the Windows API documentation for more information. + inline DWORD CListBox::GetItemData(int index) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + return static_cast(SendMessage(LB_GETITEMDATA, wparam, 0)); + } + + // Returns the value associated with the specified item. + // Refer to LB_GETITEMDATA in the Windows API documentation for more information. + inline void* CListBox::GetItemDataPtr(int index) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + return reinterpret_cast(SendMessage(LB_GETITEMDATA, wparam, 0)); + } + + // Returns the height, in pixels, of an item in a list box. + // Refer to LB_GETITEMHEIGHT in the Windows API documentation for more information. + inline int CListBox::GetItemHeight(int index) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + return static_cast(SendMessage(LB_GETITEMHEIGHT, wparam, 0)); + } + + // Retrieves the client coordinates of the specified list box item. + // Refer to LB_GETITEMRECT in the Windows API documentation for more information. + inline int CListBox::GetItemRect(int index, RECT& rc) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + LPARAM lparam = reinterpret_cast(&rc); + return static_cast(SendMessage(LB_GETITEMRECT, wparam, lparam)); + } + + // Retrieves the client coordinates of the specified list box item. + // Refer to LB_GETITEMRECT in the Windows API documentation for more information. + inline CRect CListBox::GetItemRect(int index) const + { + assert(IsWindow()); + CRect rc; + WPARAM wparam = static_cast(index); + LPARAM lparam = reinterpret_cast(&rc); + SendMessage(LB_GETITEMRECT, wparam, lparam); + return rc; + } + + // Retrieves the locale of the list box. The high-order word contains the + // country/region code and the low-order word contains the language + // identifier. + // Refer to LB_GETLOCALE in the Windows API documentation for more information. + inline LCID CListBox::GetLocale() const + { + assert(IsWindow()); + return static_cast(SendMessage(LB_GETLOCALE, 0, 0)); + } + + // Returns the selection state of a list box item. + // Refer to LB_GETSEL in the Windows API documentation for more information. + inline int CListBox::GetSel(int index) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + return static_cast(SendMessage(LB_GETSEL, wparam, 0)); + } + + // Returns the number of selected items in a multiple-selection list box. + // Refer to LB_GETSELCOUNT in the Windows API documentation for more information. + inline int CListBox::GetSelCount() const + { + assert(IsWindow()); + return static_cast(SendMessage(LB_GETSELCOUNT, 0, 0)); + } + + // Creates an array of the indexes of all selected items in a + // multiple-selection list box and returns the total number of selected + // items. + // Refer to LB_GETSELITEMS in the Windows API documentation for more information. + inline int CListBox::GetSelItems(int maxItems, LPINT pIndexArray) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(maxItems); + LPARAM lparam = reinterpret_cast(pIndexArray); + return static_cast(SendMessage(LB_GETSELITEMS, wparam, lparam)); + } + + // Retrieves the string associated with a specified item and the length + // of the string. + // Refer to LB_GETTEXT in the Windows API documentation for more information. + inline int CListBox::GetText(int index, LPTSTR buffer) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + LPARAM lparam = reinterpret_cast(buffer); + return static_cast(SendMessage(LB_GETTEXT, wparam, lparam)); + } + + // Returns the length, in characters, of the string associated with a + // specified item. + // Refer to LB_GETTEXTLEN in the Windows API documentation for more information. + inline int CListBox::GetTextLen(int index) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + return static_cast(SendMessage( LB_GETTEXTLEN, wparam, 0)); + } + + // Returns the index of the first visible item in a list box. + // Refer to LB_GETTOPINDEX in the Windows API documentation for more information. + inline int CListBox::GetTopIndex() const + { + assert(IsWindow()); + return static_cast(SendMessage(LB_GETTOPINDEX, 0, 0)); + } + + // Retrieves the zero-based index of the item nearest the specified point + // in a list box. + // Refer to LB_ITEMFROMPOINT in the Windows API documentation for more information. + inline UINT CListBox::ItemFromPoint(CPoint pt, BOOL& isOutside) const + { + assert(IsWindow()); + DWORD result = static_cast(SendMessage(LB_ITEMFROMPOINT, 0, MAKELPARAM(pt.x, pt.y))); + isOutside = !!HIWORD(result); + return LOWORD(result); + } + + // Handle messages reflected back from the parent window. + // Override this function in your derived class to handle these special + // messages: + // WM_COMMAND, WM_CTLCOLORBTN, WM_CTLCOLOREDIT, WM_CTLCOLORDLG, + // WM_CTLCOLORLISTBOX, WM_CTLCOLORSCROLLBAR, WM_CTLCOLORSTATIC, + // WM_CHARTOITEM, WM_VKEYTOITEM, WM_HSCROLL, WM_VSCROLL, WM_DRAWITEM, + // WM_MEASUREITEM, WM_DELETEITEM, WM_COMPAREITEM, WM_PARENTNOTIFY. + inline LRESULT CListBox::OnMessageReflect(UINT msg, WPARAM, LPARAM lparam) + { + switch (msg) + { + case WM_COMPAREITEM: + { + LPCOMPAREITEMSTRUCT pCompareItemStruct = reinterpret_cast< + LPCOMPAREITEMSTRUCT>(lparam); + return CompareItem(pCompareItemStruct); + } + } + + return 0; // Allow other messages to be handled elsewhere. + } + + // Set the window class. + inline void CListBox::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = _T("ListBox"); + } + + // Removes all items from a list box. + // Refer to LB_RESETCONTENT in the Windows API documentation for more information. + inline void CListBox::ResetContent() const + { + assert(IsWindow()); + SendMessage(LB_RESETCONTENT, 0, 0); + } + + // Selects the first string it finds that matches a specified prefix. + // Refer to LB_SELECTSTRING in the Windows API documentation for more information. + inline int CListBox::SelectString(int startAfter, LPCTSTR string) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(startAfter); + LPARAM lparam = reinterpret_cast(string); + return static_cast(SendMessage(LB_SELECTSTRING, wparam, lparam)); + } + + // Selects a specified range of items in a list box. + // Refer to LB_SELITEMRANGEEX in the Windows API documentation for more information. + inline int CListBox::SelItemRange(BOOL isSelected, int firstItem, int lastItem) const + { + assert(IsWindow()); + + if (isSelected) + { + WPARAM wparam = static_cast(firstItem); + LPARAM lparam = static_cast(lastItem); + return static_cast(SendMessage(LB_SELITEMRANGEEX, wparam, lparam)); + } + else + { + WPARAM wparam = static_cast(lastItem); + LPARAM lparam = static_cast(firstItem); + return static_cast(SendMessage(LB_SELITEMRANGEEX, wparam, lparam)); + } + } + + // Sets the item that the mouse last selected to a specified item. + // Refer to LB_SETANCHORINDEX in the Windows API documentation for more information. + inline void CListBox::SetAnchorIndex(int index) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + SendMessage(LB_SETANCHORINDEX, wparam, 0); + } + + // Sets the focus rectangle to a specified list box item. + // Refer to LB_SETCARETINDEX in the Windows API documentation for more information. + inline int CListBox::SetCaretIndex(int index, BOOL partialScroll) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + LPARAM lparam = static_cast(MAKELONG(partialScroll, 0)); + return static_cast(SendMessage(LB_SETCARETINDEX, wparam, lparam)); + } + + // Sets the width, in pixels, of all columns in a list box. + // Refer to LB_SETCOLUMNWIDTH in the Windows API documentation for more information. + inline void CListBox::SetColumnWidth(int cxWidth) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(cxWidth); + SendMessage(LB_SETCOLUMNWIDTH, wparam, 0); + } + + // Selects a specified list box item. + // Refer to LB_SETCURSEL in the Windows API documentation for more information. + inline int CListBox::SetCurSel(int select) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(select); + return static_cast(SendMessage(LB_SETCURSEL, wparam, 0)); + } + + // Sets the scrollable width, in pixels, of a list box. + // Refer to LB_SETHORIZONTALEXTENT in the Windows API documentation for more information. + inline void CListBox::SetHorizontalExtent(int cxExtent) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(cxExtent); + SendMessage(LB_SETHORIZONTALEXTENT, wparam, 0); + } + + // Associates a value with a list box item. + // Refer to LB_SETITEMDATA in the Windows API documentation for more information. + inline int CListBox::SetItemData(int index, DWORD itemData) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + LPARAM lparam = static_cast(itemData); + return static_cast(SendMessage(LB_SETITEMDATA, wparam, lparam)); + } + + // Associates a value with a list box item. + // Refer to LB_SETITEMDATA in the Windows API documentation for more information. + inline int CListBox::SetItemDataPtr(int index, void* pData) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + LPARAM lparam = reinterpret_cast(pData); + return static_cast(SendMessage(LB_SETITEMDATA, wparam, lparam)); + } + + // Sets the height, in pixels, of an item or items in a list box. + // Refer to LB_SETITEMHEIGHT in the Windows API documentation for more information. + inline int CListBox::SetItemHeight(int index, UINT cyItemHeight) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + LPARAM lparam = static_cast(MAKELONG(cyItemHeight, 0)); + return static_cast(SendMessage(LB_SETITEMHEIGHT, wparam, lparam)); + } + + // Sets the locale of a list box and returns the previous locale identifier. + // Refer to LB_SETLOCALE in the Windows API documentation for more information. + inline LCID CListBox::SetLocale(LCID newLocale) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(newLocale); + return static_cast(SendMessage(LB_SETLOCALE, wparam, 0)); + } + + // Selects an item in a multiple-selection list box. + // Refer to LB_SETSEL in the Windows API documentation for more information. + inline int CListBox::SetSel(int index, BOOL isSelected) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(isSelected); + LPARAM lparam = static_cast(index); + return static_cast(SendMessage(LB_SETSEL, wparam, lparam)); + } + + // Sets the tab stops to those specified in a specified array. + // Refer to LB_SETTABSTOPS in the Windows API documentation for more information. + inline BOOL CListBox::SetTabStops(int tabStops, LPINT pTabStopsArray) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(tabStops); + LPARAM lparam = reinterpret_cast(pTabStopsArray); + return static_cast(SendMessage(LB_SETTABSTOPS, wparam, lparam)); + } + + // Sets the tab stops to those specified in a specified array. + // Refer to LB_SETTABSTOPS in the Windows API documentation for more information. + inline void CListBox::SetTabStops() const + { + assert(IsWindow()); + SendMessage(LB_SETTABSTOPS, 0, 0); + } + + inline BOOL CListBox::SetTabStops(int cxEachStop) const + // Sets the tab stops to those specified in a specified array. + // Refer to LB_SETTABSTOPS in the Windows API documentation for more information. + { + assert(IsWindow()); + WPARAM wparam = static_cast(1); + LPARAM lparam = reinterpret_cast(&cxEachStop); + return static_cast(SendMessage(LB_SETTABSTOPS, wparam, lparam)); + } + + // Scrolls the list box so the specified item is at the top of the visible range. + // Refer to LB_SETTOPINDEX in the Windows API documentation for more information. + inline int CListBox::SetTopIndex(int index) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + return static_cast(SendMessage(LB_SETTOPINDEX, wparam, 0)); + } + + + //////////////////////////////////////// + // Definitions for the CStatic class + // + + // Returns the handle to the bitmap for the static control set by + // CStatic::SetBitmap. + // Refer to STM_GETIMAGE in the Windows API documentation for more information. + inline HBITMAP CStatic::GetBitmap() const + { + assert(IsWindow()); + return reinterpret_cast(SendMessage(STM_GETIMAGE, IMAGE_BITMAP, 0)); + } + + // Returns the handle to the cursor for the static control set by + // CStatic::SetCursor. + // Refer to STM_GETIMAGE in the Windows API documentation for more information. + inline HCURSOR CStatic::GetCursor() const + { + assert(IsWindow()); + return reinterpret_cast(SendMessage(STM_GETIMAGE, IMAGE_CURSOR, 0)); + } + + // Returns the handle to the enhanced meta-file for the static control set + // by CStatic::SetEnhMetaFile. + // Refer to STM_GETIMAGE in the Windows API documentation for more information. + inline HENHMETAFILE CStatic::GetEnhMetaFile() const + { + assert(IsWindow()); + return reinterpret_cast(SendMessage(STM_GETIMAGE, + IMAGE_ENHMETAFILE, 0)); + } + + // Returns the handle to the icon for the static control set by + // CStatic::SetIcon. + // Refer to STM_GETIMAGE in the Windows API documentation for more information. + inline HICON CStatic::GetIcon() const + { + assert(IsWindow()); + return reinterpret_cast(SendMessage(STM_GETIMAGE, IMAGE_ICON, 0)); + } + + // Set the window class. + inline void CStatic::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = _T("Static"); + } + + // Associates a new bitmap with the static control. + // The bitmap will be drawn in the upper-left corner, and the static + // control will be resized to the size of the bitmap. + // This function requires the SS_BITMAP style. + // Refer to STM_SETIMAGE in the Windows API documentation for more information. + inline HBITMAP CStatic::SetBitmap(HBITMAP bitmap) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(bitmap); + return reinterpret_cast(SendMessage(STM_SETIMAGE, + IMAGE_BITMAP, lparam)); + } + + // Associates a new cursor image with the static control. + // The cursor will be drawn in the upper-left corner and the static + // control will be resized to the size of the cursor. + // This function requires the SS_ICON style + // Refer to STM_SETIMAGE in the Windows API documentation for more information. + inline HCURSOR CStatic::SetCursor(HCURSOR cursor) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(cursor); + return reinterpret_cast(SendMessage(STM_SETIMAGE, + IMAGE_CURSOR, lparam)); + } + + // Associates a new enhanced metafile image with the static control. + // The enhanced metafile will be drawn in the upper-left corner and the + // static control will be resized to the size of the enhanced metafile. + // This function requires the SS_ENHMETAFILE style. + // Refer to STM_SETIMAGE in the Windows API documentation for more information. + inline HENHMETAFILE CStatic::SetEnhMetaFile(HENHMETAFILE metaFile) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(metaFile); + return reinterpret_cast(SendMessage(STM_SETIMAGE, + IMAGE_ENHMETAFILE, lparam)); + } + + // Associates a new icon image with the static control. + // The icon will be drawn in the upper-left corner and the static + // control will be resized to the size of the icon. + // This function requires the SS_ICON style + // Refer to STM_SETIMAGE in the Windows API documentation for more information. + inline HICON CStatic::SetIcon(HICON icon) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(icon); + return reinterpret_cast(SendMessage(STM_SETIMAGE, IMAGE_ICON, + lparam)); + } + +} + +#endif // _WIN32XX_STDCONTROLS_H_ + diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_tab.h b/packages/media/cpp/packages/Win32xx/include/wxx_tab.h new file mode 100644 index 00000000..b3976a2e --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_tab.h @@ -0,0 +1,2290 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +//////////////////////////////////////////////// +// wxx_tab.h +// Declaration of the CTab and CMDITab classes. + +#ifndef _WIN32XX_TAB_H_ +#define _WIN32XX_TAB_H_ + +#include "wxx_wincore.h" +#include "wxx_dialog.h" +#include "wxx_regkey.h" +#include "default_resource.h" + +namespace Win32xx +{ + + // This struct holds the information for each tab page. + struct TabPageInfo + { + CString tabText; // The tab's text + HICON tabIcon; // The tab's icon + int tabImage; // index of this tab's image + int tabID; // identifier for this tab (used by TabbedMDI) + CWnd* pView; // pointer to the view window + TabPageInfo() : tabIcon(nullptr), tabImage(0), tabID(0), pView(nullptr) {} // constructor + }; + + struct TABNMHDR + { + NMHDR hdr; + int page; + }; + + + ////////////////////////////////////////////////////////////// + // CTab manages a tab control. A tab control is analogous to + // the dividers in a notebook or the labels in a file cabinet. + // By using a tab control, an application can define multiple + // pages for the same area of a window or dialog box. + class CTab : public CWnd + { + protected: + // Declaration of the CSelectDialog class, a nested class of CTab. + // It creates the dialog to choose which tab to activate. + // It is used when the tab control has 9 or more tabs. + class CSelectDialog : public CDialog + { + public: + CSelectDialog(LPCDLGTEMPLATE pDlgTemplate); + virtual ~CSelectDialog() override = default; + void AddItem(LPCTSTR string); + + protected: + virtual BOOL OnInitDialog() override; + virtual void OnOK() override; + virtual void OnCancel() override { EndDialog(-2); } + + private: + CSelectDialog(const CSelectDialog&) = delete; + CSelectDialog& operator=(const CSelectDialog&) = delete; + + std::vector m_items; + static constexpr UINT IDC_LIST = 122; + }; + + public: + CTab(); + virtual ~CTab() override = default; + virtual CWnd* AddTabPage(CWnd* pView, LPCTSTR tabText, HICON icon, int tabID); + virtual CWnd* AddTabPage(CWnd* pView, LPCTSTR tabText, UINT iconID, int tabID = 0); + virtual CWnd* AddTabPage(CWnd* pView, LPCTSTR tabText); + virtual CWnd* AddTabPage(WndPtr view, LPCTSTR tabText, HICON icon, int tabID); + virtual CWnd* AddTabPage(WndPtr view, LPCTSTR tabText, UINT iconID, int tabID = 0); + virtual CWnd* AddTabPage(WndPtr view, LPCTSTR tabText); + virtual void SelectPage(int page); + virtual void RecalcLayout(); + virtual void RemoveTabPage(int page); + virtual void SetTabsFontSize(int fontSize = 9); + virtual void SetTabsIconSize(int iconSize = 16); + virtual void SwapTabs(int tab1, int tab2); + virtual void UpdateTabs(); + + // Accessors + CWnd* GetActiveView() const { return m_pActiveView; } + const std::vector& GetAllTabs() const { return m_allTabPageInfo; } + CRect GetCloseRect() const; + CMenu GetListMenu(); + CRect GetListRect() const; + SIZE GetMaxTabSize() const; + CImageList& GetImages() { return m_images; } + BOOL GetShowButtons() const { return m_isShowingButtons; } + BOOL GetTabsAtTop() const; + CFont GetTabFont() const { return m_tabFont; } + int GetTabHeight() const; + int GetTabImageID(int tab) const; + int GetTabIndex(CWnd* pWnd) const; + TabPageInfo GetTabPageInfo(int tab) const; + CString GetTabText(int tab) const; + int GetTextHeight() const; + + // Mutators + void SetBlankPageColor(COLORREF color) { m_blankPageColor = color; } + void SetFixedWidth(BOOL isEnabled); + void SetListDialog(LPCDLGTEMPLATE pDlgTemplate) { m_pDlgTemplate = pDlgTemplate; } + void SetOwnerDraw(BOOL isEnabled); + void SetShowButtons(BOOL show); + void SetTabFont(HFONT font); + void SetTabIcon(int tab, UINT iconID); + void SetTabIcon(int tab, HICON icon); + void SetTabsAtTop(BOOL isAtTop); + void SetTabText(int tab, LPCTSTR text); + + // State functions + void ShowListDialog(); + void ShowListMenu(); + + // Wrappers for Win32 Macros + void AdjustRect(BOOL isLarger, RECT* prc) const; + BOOL DeleteAllItems() const; + BOOL DeleteItem(int tab) const; + void DeselectAll(UINT excludeFocus) const; + int GetCurFocus() const; + int GetCurSel() const; + DWORD GetExtendedStyle() const; + CImageList GetImageList() const; + BOOL GetItem(int tab, LPTCITEM pTabInfo) const; + int GetItemCount() const; + BOOL GetItemRect(int tab, RECT& rc) const; + CRect GetItemRect(int tab) const; + int GetRowCount() const; + HWND GetToolTips() const; + BOOL HighlightItem(int tabID, WORD highlight) const; + int HitTest(TCHITTESTINFO& hitInfo) const; + int InsertItem(int tab, const LPTCITEM pTabInfo) const; + void RemoveImage(int image) const; + void SetCurFocus(int tab) const; + int SetCurSel(int tab) const; + DWORD SetExtendedStyle(DWORD exStyle) const; + CImageList SetImageList(HIMAGELIST newImages); + BOOL SetItem(int tab, LPTCITEM pTabInfo) const; + BOOL SetItemExtra(int cb) const; + DWORD SetItemSize(int cx, int cy) const; + int SetMinTabWidth(int cx) const; + void SetPadding(int cx, int cy) const; + void SetToolTips(HWND toolTip) const; + + protected: + virtual void DrawCloseButton(CDC& dc); + virtual void DrawListButton(CDC& dc); + virtual void DrawTabs(CDC& dc); + virtual void DrawTabBorders(CDC& dc, RECT& rc); + virtual void OnAttach() override; + virtual void OnDestroy() override; + virtual BOOL OnEraseBkgnd(CDC&) override { return TRUE;} + virtual LRESULT OnEraseBkgnd(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnLButtonDblClk(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnLButtonDown(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnLButtonUp(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnMouseLeave(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnMouseMove(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnKillFocus(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnPaint(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual LRESULT OnNCHitTest(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnNotifyReflect(WPARAM wparam, LPARAM lparam) override; + virtual LRESULT OnSetFocus(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnTCNSelChange(LPNMHDR pNMHDR); + virtual LRESULT OnDpiChangedAfterParent(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnWindowPosChanged(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnWindowPosChanging(UINT msg, WPARAM wparam, LPARAM lparam); + virtual void NotifyChanged(); + virtual void NotifyDragged(); + virtual BOOL NotifyTabClosing(int page); + virtual void Paint(); + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual void PreRegisterClass(WNDCLASS& wc) override; + virtual void SetTabSize(); + + // Not intended to be overridden + LRESULT WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) override; + + private: + CTab(const CTab&) = delete; + CTab& operator=(const CTab&) = delete; + + void ShowActiveView(CWnd* pView); + void UpdateImageList(); + + std::vector m_allTabPageInfo; + std::vector m_tabViews; + CFont m_tabFont; // Font used for tab text with owner draw. + CImageList m_images; // Image-list for the tab control. + LPCDLGTEMPLATE m_pDlgTemplate; // Dialog template for the list dialog. + CWnd* m_pActiveView; + CPoint m_oldMousePos; + CMenu m_listMenu; + BOOL m_isShowingButtons; // Show or hide the close and list button. + BOOL m_isTracking; + BOOL m_isClosePressed; + BOOL m_isListPressed; + BOOL m_isListMenuActive; + COLORREF m_blankPageColor; + }; + + //////////////////////////////////////////////////////////////////// + // The CTabbedMDI class combines many of the features of a MDI Frame + // and a tab control. Each MDI child is displayed as a separate tab + // page. + class CTabbedMDI : public CWnd + { + public: + CTabbedMDI(); + virtual ~CTabbedMDI() override = default; + + virtual CWnd* AddMDIChild(CWnd* pView, LPCTSTR tabText, int mdiChildID = 0); + virtual CWnd* AddMDIChild(WndPtr view, LPCTSTR tabText, int mdiChildID = 0); + virtual void CloseActiveMDI(); + virtual void CloseAllMDIChildren(); + virtual void CloseMDIChild(int tab); + virtual HWND Create(HWND hWndParent) override; + virtual BOOL LoadRegistrySettings(LPCTSTR keyName); + virtual BOOL SaveRegistrySettings(LPCTSTR keyName); + virtual void ShowListDialog() { GetTab().ShowListDialog(); } + + // Accessors and mutators + CWnd* GetActiveMDIChild() const; + int GetActiveMDITab() const; + CWnd* GetMDIChild(int tab) const; + int GetMDIChildCount() const; + int GetMDIChildID(int tab) const; + LPCTSTR GetMDIChildTitle(int tab) const; + CMenu GetListMenu() const { return GetTab().GetListMenu(); } + CTab& GetTab() const { return *m_pTab; } + void SetActiveMDIChild(CWnd* pWnd) const; + void SetActiveMDITab(int tab) const; + void SetTab(CTab& tab) { m_pTab = &tab; } + + protected: + virtual WndPtr NewMDIChildFromID(int mdiChildID); + virtual void OnAttach() override; + virtual void OnDestroy() override; + virtual LRESULT OnNotify(WPARAM wparam, LPARAM lparam) override; + virtual LRESULT OnSetFocus(UINT, WPARAM, LPARAM); + virtual BOOL OnTabClose(int tab); + virtual LRESULT OnWindowPosChanged(UINT msg, WPARAM wparam, LPARAM lparam); + virtual void RecalcLayout(); + + // Not intended to be overwritten + LRESULT WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) override; + + private: + CTabbedMDI(const CTabbedMDI&) = delete; + CTabbedMDI& operator=(const CTabbedMDI&) = delete; + + CTab m_tab; + CTab* m_pTab; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + ////////////////////////////////////////////////////////////// + // Definitions for the CSelectDialog class nested within CTab. + // + + inline CTab::CSelectDialog::CSelectDialog(LPCDLGTEMPLATE pDlgTemplate) : + CDialog(pDlgTemplate) + { + } + + inline BOOL CTab::CSelectDialog::OnInitDialog() + { + for (UINT u = 0; u < m_items.size(); ++u) + { + LPARAM text = reinterpret_cast(m_items[u].c_str()); + SendDlgItemMessage(IDC_LIST, LB_ADDSTRING, 0, text); + } + + return true; + } + + inline void CTab::CSelectDialog::AddItem(LPCTSTR string) + { + m_items.push_back(string); + } + + inline void CTab::CSelectDialog::OnOK() + { + int select = static_cast(SendDlgItemMessage(IDC_LIST, LB_GETCURSEL, 0, 0)); + if (select != LB_ERR) + EndDialog(select); + else + EndDialog(-2); + } + + + ////////////////////////////////// + // Definitions for the CTab class. + // + + inline CTab::CTab() : m_pActiveView(nullptr), m_isShowingButtons(FALSE), m_isTracking(FALSE), + m_isClosePressed(FALSE), m_isListPressed(FALSE), m_isListMenuActive(FALSE) + { + /* + 103 DIALOGEX 0, 0, 208, 202 + STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU + EXSTYLE WS_EX_APPWINDOW + CAPTION "Select Tab" + LANGUAGE LANG_NEUTRAL, 0x1 + FONT 8, "MS Shell Dlg" + { + CONTROL "", 122, LISTBOX, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 16, 16, 176, 163 , WS_EX_STATICEDGE + CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 39, 183, 49, 14 + CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 119, 183, 50, 14 + } + */ + + // Dialog template for the dialog definition shown above. + static const unsigned char dlgTemplate[] = + { + 0x01,0x00,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0xc8,0x00,0xc8,0x90,0x03, + 0x00,0x00,0x00,0x00,0x00,0xd0,0x00,0xca,0x00,0x00,0x00,0x00,0x00,0x53,0x00,0x65, + 0x00,0x6c,0x00,0x65,0x00,0x63,0x00,0x74,0x00,0x20,0x00,0x54,0x00,0x61,0x00,0x62, + 0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x01,0x4d,0x00,0x53,0x00,0x20,0x00,0x53, + 0x00,0x68,0x00,0x65,0x00,0x6c,0x00,0x6c,0x00,0x20,0x00,0x44,0x00,0x6c,0x00,0x67, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x01,0x01,0x21,0x50,0x10, + 0x00,0x10,0x00,0xb0,0x00,0xa3,0x00,0x7a,0x00,0x00,0x00,0xff,0xff,0x83,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x50,0x27, + 0x00,0xb7,0x00,0x31,0x00,0x0e,0x00,0x02,0x00,0x00,0x00,0xff,0xff,0x80,0x00,0x43, + 0x00,0x61,0x00,0x6e,0x00,0x63,0x00,0x65,0x00,0x6c,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x50,0x77,0x00,0xb7,0x00,0x32, + 0x00,0x0e,0x00,0x01,0x00,0x00,0x00,0xff,0xff,0x80,0x00,0x4f,0x00,0x4b,0x00,0x00, + 0x00,0x00,0x00 + }; + + m_blankPageColor = GetSysColor(COLOR_BTNFACE); + SetListDialog(reinterpret_cast(dlgTemplate)); + } + + // Adds a tab along with the specified view window. + // The framework assumes ownership of the CWnd pointer provided, + // and deletes the CWnd object when the tab is removed or destroyed. + // Returns a pointer to the view window that was supplied. + // Use RemoveTabPage to remove the tab and page added in this manner. + inline CWnd* CTab::AddTabPage(CWnd* pView, LPCTSTR tabText, HICON icon, int tabID) + { + assert(pView); + return AddTabPage(WndPtr(pView), tabText, icon, tabID); + } + + // Adds a tab along with the specified view window. + // The framework assumes ownership of the CWnd pointer provided, + // and deletes the CWnd object when the tab is removed or destroyed. + // Use RemoveTabPage to remove the tab and page added in this manner. + inline CWnd* CTab::AddTabPage(CWnd* pView, LPCTSTR tabText, UINT iconID, int tabID /* = 0*/) + { + HICON icon = static_cast(GetApp()->LoadImage(iconID, IMAGE_ICON, 0, 0, LR_SHARED)); + return AddTabPage(pView, tabText, icon, tabID); + } + + // Adds a tab along with the specified view window. + // The framework assumes ownership of the CWnd pointer provided, + // and deletes the CWnd object when the tab is removed or destroyed. + // Use RemoveTabPage to remove the tab and page added in this manner. + inline CWnd* CTab::AddTabPage(CWnd* pView, LPCTSTR tabText) + { + return AddTabPage(pView, tabText, reinterpret_cast(0), 0); + } + + // Adds a tab along with the specified view window. + // The framework assumes ownership of the WndPtr provided, + // and deletes the CWnd object when the tab is removed or destroyed. + // Returns a pointer to the view window that was supplied. + // Use RemoveTabPage to remove the tab and page added in this manner. + inline CWnd* CTab::AddTabPage(WndPtr view, LPCTSTR tabText, HICON icon, int tabID) + { + assert(IsWindow()); + CWnd* pView = view.get(); + assert(pView); + assert(lstrlen(tabText) < WXX_MAX_STRING_SIZE); + if (pView == nullptr) + return nullptr; + + // Set the TabPageInfo. + TabPageInfo tpi; + tpi.pView = pView; + tpi.tabIcon = icon; + tpi.tabID = tabID; + tpi.tabText = tabText; + if (icon != nullptr) + tpi.tabImage = GetImages().Add(icon); + else + tpi.tabImage = -1; + + int page = static_cast(m_allTabPageInfo.size()); + m_allTabPageInfo.push_back(tpi); + m_tabViews.push_back(std::move(view)); + + // Add the tab to the tab control. + TCITEM tie = {}; + tie.mask = TCIF_TEXT | TCIF_IMAGE; + tie.iImage = tpi.tabImage; + tie.pszText = const_cast(tpi.tabText.c_str()); + InsertItem(page, &tie); + SetTabSize(); + SelectPage(page); + + return pView; + } + + // Adds a tab along with the specified view window. + // The framework assumes ownership of the WndPtr provided, + // and deletes the CWnd object when the tab is removed or destroyed. + // Use RemoveTabPage to remove the tab and page added in this manner. + inline CWnd* CTab::AddTabPage(WndPtr view, LPCTSTR tabText, UINT iconID, int tabID /* = 0 */) + { + HICON icon = static_cast(GetApp()->LoadImage(iconID, IMAGE_ICON, 0, 0, LR_SHARED)); + return AddTabPage(std::move(view), tabText, icon, tabID); + } + + // Adds a tab along with the specified view window. + // The framework assumes ownership of the WndPtr provided, + // and deletes the CWnd object when the tab is removed or destroyed. + // Use RemoveTabPage to remove the tab and page added in this manner. + inline CWnd* CTab::AddTabPage(WndPtr view, LPCTSTR tabText) + { + return AddTabPage(std::move(view), tabText, reinterpret_cast(0), 0); + } + + // Draws the close button + inline void CTab::DrawCloseButton(CDC& dc) + { + if (!m_isShowingButtons) return; + if (!GetActiveView()) return; + if (!(GetStyle() & TCS_FIXEDWIDTH)) return; + if (!(GetStyle() & TCS_OWNERDRAWFIXED)) return; + + // Determine the close button's drawing position relative to the window. + CRect rcClose = GetCloseRect(); + + CPoint pt = GetCursorPos(); + VERIFY(ScreenToClient(pt)); + UINT state = rcClose.PtInRect(pt)? m_isClosePressed? 2U: 1U: 0U; + + // Draw the outer highlight for the close button. + if (!IsRectEmpty(&rcClose)) + { + // Use the Marlett font to draw special characters. + CFont marlett; + marlett.CreatePointFont(100, _T("Marlett")); + dc.SetBkMode(TRANSPARENT); + LOGFONT lf = DpiScaleLogfont(marlett.GetLogFont(), 10); + dc.CreateFontIndirect(lf); + + COLORREF grey(RGB(232, 228, 220)); + COLORREF black(RGB(0, 0, 0)); + COLORREF white(RGB(255, 255, 255)); + + switch (state) + { + case 0: + { + // Draw a grey box for the normal button using two special characters. + dc.SetTextColor(grey); + dc.TextOut(rcClose.left, rcClose.top, _T("\x63"), 1); + dc.TextOut(rcClose.left, rcClose.top, _T("\x64"), 1); + } + break; + + case 1: + { + // Draw popped up button, black on right and bottom. + dc.SetTextColor(white); + dc.TextOut(rcClose.left, rcClose.top, _T("\x63"), 1); + dc.SetTextColor(black); + dc.TextOut(rcClose.left, rcClose.top, _T("\x64"), 1); + } + break; + + case 2: + { + // Draw popped up button, black on right and bottom. + dc.SetTextColor(black); + dc.TextOut(rcClose.left, rcClose.top, _T("\x63"), 1); + dc.SetTextColor(white); + dc.TextOut(rcClose.left, rcClose.top, _T("\x64"), 1); + } + break; + + } + + // Draw the close button (a Marlett "r" looks like "X"). + dc.SetTextColor(RGB(0, 0, 0)); + dc.TextOut(rcClose.left, rcClose.top, _T("\x72"), 1); + } + } + + // Draws the list button. + inline void CTab::DrawListButton(CDC& dc) + { + if (!m_isShowingButtons) return; + if (!GetActiveView()) return; + if (!(GetStyle() & TCS_FIXEDWIDTH)) return; + if (!(GetStyle() & TCS_OWNERDRAWFIXED)) return; + + // Determine the list button's drawing position relative to the window. + CRect rcList = GetListRect(); + + CPoint pt = GetCursorPos(); + VERIFY(ScreenToClient(pt)); + UINT uState = rcList.PtInRect(pt)? 1U: 0U; + if (m_isListMenuActive) uState = 2; + + // Draw the outer highlight for the list button. + if (!IsRectEmpty(&rcList)) + { + // Use the Marlett font to draw special characters. + CFont marlett; + marlett.CreatePointFont(100, _T("Marlett")); + dc.SetBkMode(TRANSPARENT); + LOGFONT lf = DpiScaleLogfont(marlett.GetLogFont(), 10); + dc.CreateFontIndirect(lf); + + COLORREF grey(RGB(232, 228, 220)); + COLORREF black(RGB(0, 0, 0)); + COLORREF white(RGB(255, 255, 255)); + + switch (uState) + { + case 0: + { + // Draw a grey box for the normal button using two special characters. + dc.SetTextColor(grey); + dc.TextOut(rcList.left, rcList.top, _T("\x63"), 1); + dc.TextOut(rcList.left, rcList.top, _T("\x64"), 1); + } + break; + + case 1: + { + // Draw popped up button, black on right and bottom. + dc.SetTextColor(white); + dc.TextOut(rcList.left, rcList.top, _T("\x63"), 1); + dc.SetTextColor(black); + dc.TextOut(rcList.left, rcList.top, _T("\x64"), 1); + } + break; + + case 2: + { + // Draw pressed button, black on left and top. + dc.SetTextColor(black); + dc.TextOut(rcList.left, rcList.top, _T("\x63"), 1); + dc.SetTextColor(white); + dc.TextOut(rcList.left, rcList.top, _T("\x64"), 1); + } + break; + + } + + if (GetWinVersion() >= 3000) // Windows 10 or later. + rcList.OffsetRect(1, -1); + + // Draw the down arrow button. + dc.SetTextColor(black); + dc.TextOut(rcList.left, rcList.top, _T("\x75"), 1); + } + } + + // Draw the tabs. + inline void CTab::DrawTabs(CDC& dc) + { + // Draw the tab buttons: + for (int i = 0; i < GetItemCount(); ++i) + { + CRect rcItem; + GetItemRect(i, rcItem); + if (!rcItem.IsRectEmpty()) + { + if (i == GetCurSel()) + { + dc.CreateSolidBrush(RGB(248,248,248)); + dc.SetBkColor(RGB(248,248,248)); + } + else + { + dc.CreateSolidBrush(RGB(200,200,200)); + dc.SetBkColor(RGB(200,200,200)); + } + + dc.CreatePen(PS_SOLID, 1, RGB(160, 160, 160)); + dc.RoundRect(rcItem.left, rcItem.top, rcItem.right +1, rcItem.bottom, 6, 6); + + CSize szImage = GetImages().GetIconSize(); + int padding = DpiScaleInt(4); + + if (rcItem.Width() >= szImage.cx + 2 * padding) + { + CString str = GetTabText(i); + int image = GetTabImageID(i); + int yOffset = (rcItem.Height() - szImage.cy)/2; + + // Draw the icon. + int drawleft = rcItem.left + padding; + int drawtop = rcItem.top + yOffset; + GetImages().Draw(dc, image, CPoint(drawleft, drawtop), ILD_NORMAL); + + // Calculate the size of the text. + CRect rcText = rcItem; + if (image >= 0) + rcText.left += szImage.cx + padding; + + rcText.left += padding; + + // Draw the text. + dc.SelectObject(m_tabFont); + dc.DrawText(str, -1, rcText, DT_LEFT | DT_VCENTER | + DT_SINGLELINE | DT_END_ELLIPSIS | DT_NOPREFIX); + } + } + } + } + + // Draw the tab borders. + inline void CTab::DrawTabBorders(CDC& dc, RECT& rc) + { + bool isBottomTab = (GetStyle() & TCS_BOTTOM) != 0; + + // Draw a lighter rectangle touching the tab buttons. + CRect rcItem; + int gap = 3; + GetItemRect(0, rcItem); + int left = rcItem.left; + int right = rc.right; + int top = rc.bottom; + int bottom = top + gap; + + if (!isBottomTab) + { + int rcTop = rc.top; + bottom = std::max(rcTop, GetTabHeight() + gap + 1); + top = bottom - gap; + } + + dc.CreateSolidBrush(RGB(248, 248, 248)); + dc.CreatePen(PS_SOLID, 1, RGB(248, 248, 248)); + if (!rcItem.IsRectEmpty()) + { + dc.Rectangle(left, top, right, bottom); + + // Draw a darker line below the rectangle. + dc.CreatePen(PS_SOLID, 1, RGB(160, 160, 160)); + if (isBottomTab) + { + dc.MoveTo(left-1, bottom); + dc.LineTo(right-1, bottom); + } + else + { + dc.MoveTo(left-1, top-1); + dc.LineTo(right-1, top-1); + } + + // Draw a lighter line over the darker line for the selected tab. + dc.CreatePen(PS_SOLID, 1, RGB(248, 248, 248)); + GetItemRect(GetCurSel(), rcItem); + OffsetRect(&rcItem, 0, 1); + + if (isBottomTab) + { + dc.MoveTo(rcItem.left, bottom); + dc.LineTo(rcItem.right, bottom); + } + else + { + dc.MoveTo(rcItem.left, top-1); + dc.LineTo(rcItem.right, top-1); + } + } + } + + // Returns the dimensions of the bounding rectangle of the close button. + inline CRect CTab::GetCloseRect() const + { + CRect rc; + if (GetShowButtons()) + { + rc = GetClientRect(); + int gap = DpiScaleInt(1); + int cx = GetSystemMetrics(SM_CXSMICON) * GetWindowDpi(*this) / GetWindowDpi(HWND_DESKTOP); + int cy = GetSystemMetrics(SM_CXSMICON) * GetWindowDpi(*this) / GetWindowDpi(HWND_DESKTOP); + rc.right -= gap; + rc.left = rc.right - cx; + + if (GetTabsAtTop()) + { + rc.top = (GetTabHeight() - cy) / 2; + rc.bottom = rc.top + cy; + } + else + { + rc.bottom = rc.bottom - (GetTabHeight() - cy) / 2; + rc.top = rc.bottom - cy; + } + + if (GetExStyle() & WS_EX_LAYOUTRTL) + { + rc.left = rc.left + gap; + rc.right = rc.left + cx; + } + } + + return rc; + } + + // Updates and returns the list menu. + inline CMenu CTab::GetListMenu() + { + if (!IsMenu(m_listMenu)) + m_listMenu.CreatePopupMenu(); + + // Remove any current menu items. + while (m_listMenu.GetMenuItemCount() > 0) + { + m_listMenu.RemoveMenu(0, MF_BYPOSITION); + } + + // Add the menu items. + for (size_t i = 0; i < std::min(GetAllTabs().size(), size_t(9)); ++i) + { + CString menuString; + CString tabText = GetAllTabs()[i].tabText; + menuString.Format(_T("&%d %s"), i+1, tabText.c_str()); + m_listMenu.AppendMenu(MF_STRING, IDW_FIRSTCHILD + UINT_PTR(i), menuString); + } + if (GetAllTabs().size() >= 10) + m_listMenu.AppendMenu(MF_STRING, IDW_FIRSTCHILD +9, _T("More Tabs")); + + // Add a checkmark to the menu. + UINT selected = static_cast(GetCurSel()); + if (selected < 9) + m_listMenu.CheckMenuItem(selected, MF_BYPOSITION|MF_CHECKED); + + return m_listMenu; + } + + // Returns the dimensions of the bounding rectangle of the list button. + inline CRect CTab::GetListRect() const + { + CRect rcList; + if (GetShowButtons()) + { + CRect rcClose = GetCloseRect(); + rcList = rcClose; + rcList.OffsetRect(-(rcClose.Width() + DpiScaleInt(2)), 0); + rcList.InflateRect(-1, 0); + } + return rcList; + } + + // Returns the size of the largest tab. + inline SIZE CTab::GetMaxTabSize() const + { + CSize Size; + + for (int i = 0; i < GetItemCount(); ++i) + { + CClientDC dcClient(*this); + dcClient.SelectObject(m_tabFont); + CString str; + TCITEM tcItem = {}; + tcItem.mask = TCIF_TEXT |TCIF_IMAGE; + tcItem.cchTextMax = WXX_MAX_STRING_SIZE; + tcItem.pszText = str.GetBuffer(WXX_MAX_STRING_SIZE); + GetItem(i, &tcItem); + str.ReleaseBuffer(); + CSize TempSize = dcClient.GetTextExtentPoint32(str, lstrlen(str)); + + int imageSize = 0; + int padding = DpiScaleInt(10); + if (tcItem.iImage >= 0) + { + imageSize = m_images.GetIconSize().cx; + } + + TempSize.cx += imageSize + padding; + + if (TempSize.cx > Size.cx) + Size = TempSize; + } + + return Size; + } + + // Returns TRUE if the control's tabs are placed at the top. + inline BOOL CTab::GetTabsAtTop() const + { + DWORD style = GetStyle(); + return (!(style & TCS_BOTTOM)); + } + + // Retrieves the height of the text. + inline int CTab::GetTextHeight() const + { + CClientDC dcClient(*this); + dcClient.SelectObject(m_tabFont); + CSize szText = dcClient.GetTextExtentPoint32(_T("Text"), lstrlen(_T("Text"))); + return szText.cy; + } + + // Retrieves the tab height calculated from the icon height and text height. + inline int CTab::GetTabHeight() const + { + int heightGap = DpiScaleInt(5); + int iconSizeX = m_images.GetIconSize().cx; + return std::max(iconSizeX, GetTextHeight()) + heightGap; + } + + // Returns the index of the tab given its view window. + inline int CTab::GetTabIndex(CWnd* pWnd) const + { + assert(pWnd); + + for (size_t i = 0; i < m_allTabPageInfo.size(); ++i) + { + if (m_allTabPageInfo[i].pView == pWnd) + return static_cast(i); + } + + return -1; + } + + // Returns the tab page info struct for the specified tab. + inline TabPageInfo CTab::GetTabPageInfo(int tab) const + { + size_t tabIndex = static_cast(tab); + assert (tabIndex < m_allTabPageInfo.size()); + return m_allTabPageInfo[tabIndex]; + } + + // Returns the image ID for the specified tab. + inline int CTab::GetTabImageID(int tab) const + { + size_t tabIndex = static_cast(tab); + assert (tabIndex < m_allTabPageInfo.size()); + return m_allTabPageInfo[tabIndex].tabImage; + } + + // Returns the text for the specified tab. + inline CString CTab::GetTabText(int tab) const + { + size_t tabIndex = static_cast(tab); + assert (tabIndex < m_allTabPageInfo.size()); + return m_allTabPageInfo[tabIndex].tabText; + } + + // Sends a UMN_TABCHANGED notification. + inline void CTab::NotifyChanged() + { + NMHDR nmhdr = {}; + nmhdr.hwndFrom = *this; + nmhdr.code = UMN_TABCHANGED; + LPARAM lparam = reinterpret_cast(&nmhdr); + + if (GetParent().IsWindow()) + GetParent().SendMessage(WM_NOTIFY, 0, lparam); + } + + // Sends a UWN_TABDRAGGED notification. + inline void CTab::NotifyDragged() + { + NMHDR nmhdr = {}; + nmhdr.hwndFrom = *this; + nmhdr.code = UWN_TABDRAGGED; + LPARAM lparam = reinterpret_cast(&nmhdr); + GetParent().SendMessage(WM_NOTIFY, 0, lparam); + } + + // Sends a UWN_TABCLOSE notification. + inline BOOL CTab::NotifyTabClosing(int page) + { + UINT controlID = GetDlgCtrlID(); + TABNMHDR tabNMHDR = {}; + tabNMHDR.hdr.code = UWN_TABCLOSE; + tabNMHDR.hdr.hwndFrom = *this; + tabNMHDR.hdr.idFrom = controlID; + tabNMHDR.page = page; + WPARAM wparam = static_cast(controlID); + LPARAM lparam = reinterpret_cast(&tabNMHDR); + + // The default return value is zero. + return static_cast(GetParent().SendMessage(WM_NOTIFY, wparam, lparam)); + } + + // Called when this object is attached to a tab control. + inline void CTab::OnAttach() + { + UpdateTabs(); + } + + // Called when the background is erased. + inline LRESULT CTab::OnEraseBkgnd(UINT msg, WPARAM wparam, LPARAM lparam) + { + if (GetStyle() & TCS_OWNERDRAWFIXED) + return 0; + + return FinalWindowProc(msg, wparam, lparam); + } + + // Called when the left mouse button is pressed. + inline LRESULT CTab::OnLButtonDown(UINT msg, WPARAM wparam, LPARAM lparam) + { + CPoint pt(GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); + + if (GetCloseRect().PtInRect(pt)) + { + m_isClosePressed = TRUE; + SetCapture(); + CClientDC dc(*this); + DrawCloseButton(dc); + } + else + m_isClosePressed = FALSE; + + if (GetListRect().PtInRect(pt)) + { + ShowListMenu(); + } + + return FinalWindowProc(msg, wparam, lparam); + } + + // Called when the left mouse button is released. + inline LRESULT CTab::OnLButtonUp(UINT msg, WPARAM wparam, LPARAM lparam) + { + ReleaseCapture(); + CPoint pt(GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); + if (m_isClosePressed && GetCloseRect().PtInRect(pt)) + { + int page = GetCurSel(); + + // Send a notification to parent asking if its OK to close the tab. + if (!NotifyTabClosing(page)) + { + RemoveTabPage(page); + if (page > 0) + SelectPage(page -1); + + if (GetActiveView()) + GetActiveView()->RedrawWindow(); + } + } + + m_isClosePressed = FALSE; + + return FinalWindowProc(msg, wparam, lparam); + } + + // Called when the mouse moves outside of the window. + inline LRESULT CTab::OnMouseLeave(UINT msg, WPARAM wparam, LPARAM lparam) + { + CClientDC dc(*this); + DrawCloseButton(dc); + DrawListButton(dc); + + m_isTracking = FALSE; + + return FinalWindowProc(msg, wparam, lparam); + } + + // Called when the mouse is moved. + inline LRESULT CTab::OnMouseMove(UINT msg, WPARAM wparam, LPARAM lparam) + { + CPoint pt; + pt.x = GET_X_LPARAM(lparam); + pt.y = GET_Y_LPARAM(lparam); + + if (!m_isListMenuActive && m_isListPressed) + { + m_isListPressed = FALSE; + } + + if (!m_isTracking) + { + TRACKMOUSEEVENT TrackMouseEventStruct = {}; + TrackMouseEventStruct.cbSize = sizeof(TrackMouseEventStruct); + TrackMouseEventStruct.dwFlags = TME_LEAVE; + TrackMouseEventStruct.hwndTrack = *this; + _TrackMouseEvent(&TrackMouseEventStruct); + m_isTracking = TRUE; + } + + // Skip if mouse hasn't moved. + if ((pt.x != m_oldMousePos.x) || (pt.y != m_oldMousePos.y)) + { + if (IsLeftButtonDown()) + NotifyDragged(); + } + + m_oldMousePos.x = pt.x; + m_oldMousePos.y = pt.y; + + CClientDC dc(*this); + DrawCloseButton(dc); + DrawListButton(dc); + + return FinalWindowProc(msg, wparam, lparam); + } + + // Perform a hit test on the non-client area. + inline LRESULT CTab::OnNCHitTest(UINT msg, WPARAM wparam, LPARAM lparam) + { + // Ensure we have an arrow cursor when the tab has no view window. + if (GetAllTabs().size() == 0) + SetCursor(LoadCursor(0, IDC_ARROW)); + + // Cause WM_LBUTTONUP and WM_LBUTTONDOWN messages to be sent for buttons. + CPoint pt(GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); + VERIFY(ScreenToClient(pt)); + if (GetCloseRect().PtInRect(pt)) return HTCLIENT; + if (GetListRect().PtInRect(pt)) return HTCLIENT; + + return CWnd::WndProcDefault(msg, wparam, lparam); + } + + // Handle the notifications we send. + inline LRESULT CTab::OnNotifyReflect(WPARAM, LPARAM lparam) + { + LPNMHDR pHeader = reinterpret_cast(lparam); + switch (pHeader->code) + { + case TCN_SELCHANGE: return OnTCNSelChange(pHeader); + } + + return 0; + } + + // Called when a different tab is selected. + inline LRESULT CTab::OnTCNSelChange(LPNMHDR) + { + // Display the newly selected tab page. + int page = GetCurSel(); + ShowActiveView(m_allTabPageInfo[static_cast(page)].pView); + + return 0; + } + + // Called when this tab control loses focus. + inline LRESULT CTab::OnKillFocus(UINT msg, WPARAM wparam, LPARAM lparam) + { + m_isClosePressed = FALSE; + return FinalWindowProc(msg, wparam, lparam); + } + + // Called when the left mouse button is double clicked. + inline LRESULT CTab::OnLButtonDblClk(UINT msg, WPARAM wparam, LPARAM lparam) + { + return OnLButtonDown(msg, wparam, lparam); + } + + // Called when this control needs to be painted. + inline LRESULT CTab::OnPaint(UINT msg, WPARAM wparam, LPARAM lparam) + { + if (GetStyle() & TCS_OWNERDRAWFIXED) + { + // Remove all pending paint requests. + PAINTSTRUCT ps; + ::BeginPaint(*this, &ps); + ::EndPaint(*this, &ps); + + // Now call our local Paint. + Paint(); + return 0; + } + + return FinalWindowProc(msg, wparam, lparam); + } + + // Called when this control acquires keyboard focus. + inline LRESULT CTab::OnSetFocus(UINT msg, WPARAM wparam, LPARAM lparam) + { + // Prevent the tab control from grabbing focus when we have a view. + if (GetActiveView() && !m_isClosePressed) + { + GetActiveView()->SetFocus(); + } + + return FinalWindowProc(msg, wparam, lparam); + } + + // Called when a window is destroyed. + inline void CTab::OnDestroy() + { + // Remove any current pages. + int pages = static_cast(m_allTabPageInfo.size()); + for (int i = pages - 1; i >= 0; i--) + { + RemoveTabPage(i); + } + } + + // Called in response to a WM_DPICHANGED_AFTERPARENT message that is sent + // to child windows after a DPI change. A WM_DPICHANGED_AFTERPARENT is only + // received when the application is DPI_AWARENESS_PER_MONITOR_AWARE. + inline LRESULT CTab::OnDpiChangedAfterParent(UINT, WPARAM, LPARAM) + { + UpdateTabs(); + + return 0; + } + + // Called after the tab control is resized. + inline LRESULT CTab::OnWindowPosChanged(UINT msg, WPARAM wparam, LPARAM lparam) + { + RecalcLayout(); + return FinalWindowProc(msg, wparam, lparam); + } + + // Called while the tab control is being resized. + inline LRESULT CTab::OnWindowPosChanging(UINT msg, WPARAM wparam, LPARAM lparam) + { + // A little hack to reduce tab flicker. + if (IsWindowVisible() && (GetStyle() & TCS_OWNERDRAWFIXED)) + { + LPWINDOWPOS pWinPos = reinterpret_cast(lparam); + pWinPos->flags |= SWP_NOREDRAW; + + // Do a manual paint when OnDraw isn't called. + if (GetWindowRect().Height() < GetTabHeight()) + Paint(); + } + + return FinalWindowProc(msg, wparam, lparam); + } + + // Paint the control manually. + // Microsoft's drawing for a tab control has quite a bit of flicker on some + // of its operating systems, so we do our own. + // We use double buffering and regions to eliminate flicker. + inline void CTab::Paint() + { + bool isRTL = FALSE; + isRTL = ((GetExStyle() & WS_EX_LAYOUTRTL)) != 0; + + // Create the memory DC and bitmap. + CClientDC dcView(*this); + CMemDC memDC(dcView); + CRect rcClient = GetClientRect(); + memDC.CreateCompatibleBitmap(dcView, rcClient.Width(), rcClient.Height()); + + if (GetItemCount() == 0) + { + // No tabs, so simply display a gray background and exit. + dcView.SolidFill(m_blankPageColor, rcClient); + return; + } + + // Create a clipping region. Its the overall tab window's region, + // less the region belonging to the individual tab view's client area. + CRgn rgnSrc1; + rgnSrc1.CreateRectRgnIndirect(rcClient); + CRect rcTab = GetClientRect(); + AdjustRect(FALSE, &rcTab); + if (rcTab.Height() < 0) + rcTab.top = rcTab.bottom; + if (rcTab.Width() < 0) + rcTab.left = rcTab.right; + + int offset = isRTL ? -1 : 0; // Required for RTL layout. + CRgn rgnSrc2; + rgnSrc2.CreateRectRgn(rcTab.left, rcTab.top, rcTab.right + offset, rcTab.bottom); + CRgn rgnClip; + rgnClip.CreateRectRgn(0, 0, 0, 0); + rgnClip.CombineRgn(rgnSrc1, rgnSrc2, RGN_DIFF); + + // Use the region in the memory DC to paint the gray background. + memDC.SelectClipRgn(rgnClip); + memDC.CreateSolidBrush( GetSysColor(COLOR_BTNFACE) ); + memDC.PaintRgn(rgnClip); + + // Draw the tab buttons on the memory DC: + DrawTabs(memDC); + + // Draw buttons and tab borders. + DrawCloseButton(memDC); + DrawListButton(memDC); + DrawTabBorders(memDC, rcTab); + + // Now copy from our memory DC to the window DC. + dcView.SelectClipRgn(rgnClip); + + if (isRTL) + { + // BitBlt offset bitmap copies by one for Right-To-Left layout. + dcView.BitBlt(0, 0, 1, rcClient.Height(), memDC, 1, 0, SRCCOPY); + dcView.BitBlt(1, 0, rcClient.Width(), rcClient.Height(), memDC, 1, 0, SRCCOPY); + } + else + dcView.BitBlt(0, 0, rcClient.Width(), rcClient.Height(), memDC, 0, 0, SRCCOPY); + } + + // Set the window style before it is created. + inline void CTab::PreCreate(CREATESTRUCT &cs) + { + // For Tabs on the bottom, add the TCS_BOTTOM style. + cs.style = WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE; + } + + // Set the window class. + inline void CTab::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = WC_TABCONTROL; + } + + // Repositions the child windows of the tab control. + inline void CTab::RecalcLayout() + { + if (IsWindow()) + { + SetTabSize(); + + if (GetActiveView()) + { + // Position the View over the tab control's display area. + CRect rc = GetClientRect(); + MapWindowPoints(GetParent(), rc); + AdjustRect(FALSE, &rc); + VERIFY(GetActiveView()->SetWindowPos(HWND_TOP, rc, SWP_SHOWWINDOW)); + } + + RedrawWindow(RDW_INVALIDATE | RDW_NOCHILDREN); + } + } + + // Removes a tab and its view page. + inline void CTab::RemoveTabPage(int page) + { + if ((page < 0) || (page > static_cast(m_allTabPageInfo.size() -1))) + return; + + // Remove the tab. + DeleteItem(page); + + // Remove the TapPageInfo entry. + auto itTPI = m_allTabPageInfo.begin() + page; + CWnd* pView = (*itTPI).pView; + int image = (*itTPI).tabImage; + if (image >= 0) + RemoveImage(image); + + if (pView == m_pActiveView) + m_pActiveView = 0; + + (*itTPI).pView->Destroy(); + m_allTabPageInfo.erase(itTPI); + + for (auto itView = m_tabViews.begin(); itView != m_tabViews.end(); ++itView) + { + if ((*itView).get() == pView) + { + m_tabViews.erase(itView); + break; + } + } + + if (IsWindow()) + { + if (m_allTabPageInfo.size() > 0) + { + SetTabSize(); + SelectPage(0); + } + else + ShowActiveView(nullptr); + + NotifyChanged(); + } + } + + // Selects the tab and the view page. + inline void CTab::SelectPage(int page) + { + if ((page >= 0) && (page < GetItemCount())) + { + if (page != GetCurSel()) + SetCurSel(page); + + ShowActiveView(m_allTabPageInfo[static_cast(page)].pView); + } + } + + // Enable or disable fixed-with tabs. + // When fixed-width is enabled, all tabs have the same width. + inline void CTab::SetFixedWidth(BOOL isEnabled) + { + DWORD style = GetStyle(); + style = isEnabled ? style | TCS_FIXEDWIDTH : style & ~TCS_FIXEDWIDTH; + SetStyle(style); + UpdateImageList(); + RecalcLayout(); + } + + // Enable or disable owner-draw. + // When owner-draw is enabled, the tabs are drawn by Paint(). + // Note: Setting owner-draw also sets fixed-width. + inline void CTab::SetOwnerDraw(BOOL isEnabled) + { + DWORD style = GetStyle(); + style = isEnabled ? style | TCS_OWNERDRAWFIXED | TCS_FIXEDWIDTH : style & ~TCS_OWNERDRAWFIXED; + SetStyle(style); + UpdateImageList(); + RecalcLayout(); + } + + // Allows the list and close buttons to be shown or hidden. + inline void CTab::SetShowButtons(BOOL show) + { + m_isShowingButtons = show; + RecalcLayout(); + } + + // Sets the font used by the tabs and adjusts the tab height to match. + inline void CTab::SetTabFont(HFONT font) + { + m_tabFont = font; + + // Set the font used without owner draw. + SetFont(font); + } + + // Changes or sets the tab's icon. + inline void CTab::SetTabIcon(int tab, UINT iconID) + { + HICON icon = static_cast(GetApp()->LoadImage(iconID, IMAGE_ICON, 0, 0, LR_SHARED)); + SetTabIcon(tab, icon); + } + + // Changes or sets the tab's icon. + inline void CTab::SetTabIcon(int tab, HICON icon) + { + assert (GetItemCount() > tab); + TCITEM tci = {}; + tci.mask = TCIF_IMAGE; + GetItem(tab, &tci); + if (tci.iImage >= 0) + { + GetImages().Replace(tab, icon); + } + else + { + int image = GetImages().Add(icon); + tci.iImage = image; + SetItem(tab, &tci); + m_allTabPageInfo[static_cast(tab)].tabImage = image; + } + + m_allTabPageInfo[static_cast(tab)].tabIcon = icon; + SetTabSize(); + } + + // Positions the tabs at the top or bottom of the control. + inline void CTab::SetTabsAtTop(BOOL isAtTop) + { + DWORD style = GetStyle(); + + if (isAtTop) + style &= ~TCS_BOTTOM; + else + style |= TCS_BOTTOM; + + SetStyle(style); + RecalcLayout(); + } + + // Sets the width and height of tabs in a fixed-width or owner-drawn tab control. + inline void CTab::SetTabSize() + { + if (GetItemCount() > 0) + { + DWORD style = GetStyle(); + if (style & TCS_OWNERDRAWFIXED) + { + CRect rc = GetClientRect(); + AdjustRect(FALSE, &rc); + int padding = DpiScaleInt(2); + if (m_isShowingButtons) + padding = GetCloseRect().Width() + GetListRect().Width() + DpiScaleInt(4); + + int maxTabSizeX = GetMaxTabSize().cx; + int itemWidth = std::min(maxTabSizeX, (rc.Width() - padding) / GetItemCount()); + itemWidth = std::max(itemWidth, 0); + SetItemSize(itemWidth, GetTabHeight()); + NotifyChanged(); + } + else + { + int itemWidth = GetMaxTabSize().cx; + SetItemSize(itemWidth, GetTabHeight()); + NotifyChanged(); + } + } + } + + // Allows the text to be changed on an existing tab. + inline void CTab::SetTabText(int tab, LPCTSTR text) + { + size_t tabIndex = static_cast(tab); + if (tabIndex < GetAllTabs().size()) + { + TCITEM Item = {}; + Item.mask = TCIF_TEXT; + Item.pszText = const_cast(text); + + if (SetItem(tab, &Item)) + m_allTabPageInfo[tabIndex].tabText = text; + + SetTabSize(); + } + } + + // Sets or changes the view window displayed within the tab page. + inline void CTab::ShowActiveView(CWnd* pView) + { + if (pView != m_pActiveView) + { + // Hide the old view. + if (m_pActiveView && (m_pActiveView->IsWindow())) + m_pActiveView->ShowWindow(SW_HIDE); + + // Assign the view window. + m_pActiveView = pView; + + if (m_pActiveView && *this) + { + if (!m_pActiveView->IsWindow()) + { + // The tab control is already created, so create the new view too. + m_pActiveView->Create( GetParent() ); + } + + // Position the view window over the tab control's display area + CRect rc = GetClientRect(); + AdjustRect(FALSE, &rc); + MapWindowPoints(GetParent(), rc); + VERIFY(m_pActiveView->SetWindowPos(HWND_TOP, rc, SWP_SHOWWINDOW)); + m_pActiveView->SetFocus(); + } + } + } + + // Displays the list of windows in a popup menu. + inline void CTab::ShowListMenu() + { + if (!m_isListPressed) + { + m_isListPressed = TRUE; + + CPoint pt(GetListRect().left, GetListRect().top + GetTabHeight()); + VERIFY(ClientToScreen(pt)); + + // Choosing the frame's CWnd for the menu's messages will automatically theme the popup menu. + int page = 0; + m_isListMenuActive = TRUE; + page = GetListMenu().TrackPopupMenuEx(TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RETURNCMD, pt.x, pt.y, GetAncestor(), nullptr) - IDW_FIRSTCHILD; + if ((page >= 0) && (page < 9)) SelectPage(page); + if (page == 9) ShowListDialog(); + m_isListMenuActive = FALSE; + } + + CClientDC dc(*this); + DrawListButton(dc); + } + + // Definition of a dialog template that displays a List Box. + inline void CTab::ShowListDialog() + { + // Display the modal dialog. The dialog is defined in the dialog template rather + // than in the resource script (rc) file. + CSelectDialog SelectDialog(m_pDlgTemplate); + for (UINT u = 0; u < GetAllTabs().size(); ++u) + { + SelectDialog.AddItem(GetAllTabs()[u].tabText); + } + + int selected = static_cast(SelectDialog.DoModal(*this)); + if (selected >= 0) + SelectPage(selected); + } + + // Swaps the two specified tabs. + inline void CTab::SwapTabs(int tab1, int tab2) + { + int allTabs = static_cast(GetAllTabs().size()); + if ((tab1 < allTabs) && (tab2 < allTabs) && (tab1 != tab2)) + { + TabPageInfo t1 = GetTabPageInfo(tab1); + TabPageInfo t2 = GetTabPageInfo(tab2); + int length = 30; + + TCITEM item1 = {}; + item1.mask = TCIF_IMAGE | TCIF_PARAM | TCIF_RTLREADING | TCIF_STATE | TCIF_TEXT; + item1.cchTextMax = length; + item1.pszText = const_cast(t1.tabText.c_str()); + GetItem(tab1, &item1); + + TCITEM item2 = {}; + item2.mask = TCIF_IMAGE | TCIF_PARAM | TCIF_RTLREADING | TCIF_STATE | TCIF_TEXT; + item2.cchTextMax = length; + item2.pszText = const_cast(t2.tabText.c_str()); + GetItem(tab2, &item2); + + SetItem(tab1, &item2); + SetItem(tab2, &item1); + m_allTabPageInfo[static_cast(tab1)] = t2; + m_allTabPageInfo[static_cast(tab2)] = t1; + } + } + + // Sets the tabs font size, adjusted for the window's DPI. + inline void CTab::SetTabsFontSize(int fontSize) + { + // Set the font used in the tabs. + CFont font; + NONCLIENTMETRICS info = GetNonClientMetrics(); + int dpi = GetWindowDpi(*this); + LOGFONT lf = info.lfStatusFont; + lf.lfHeight = -MulDiv(fontSize, dpi, POINTS_PER_INCH); + font.CreateFontIndirect(lf); + SetTabFont(font); + RecalcLayout(); + } + + // Sets the tabs icon size, adjusted for the window's DPI. + inline void CTab::SetTabsIconSize(int iconSize) + { + int iconHeight = DpiScaleInt(iconSize); + iconHeight = iconHeight - iconHeight % 8; + + const std::vector& v = GetAllTabs(); + GetImages().Create(iconHeight, iconHeight, ILC_MASK | ILC_COLOR32, 0, 0); + for (size_t i = 0; i < v.size(); ++i) + { + // Set the icons for the container parent. + GetImages().Add(v[i].tabIcon); + } + + // Assign the ImageList. + UpdateImageList(); + + RecalcLayout(); + } + + // Assigns or removes tab control's image list as required. + inline void CTab::UpdateImageList() + { + DWORD style = GetStyle(); + if (style & TCS_FIXEDWIDTH && style & TCS_OWNERDRAWFIXED) + // Remove the image list to allow very narrow tabs. + SetImageList(0); + else + SetImageList(m_images); + } + + // Updates the font and icons in the tabs. + // Called when the dpi changes. + inline void CTab::UpdateTabs() + { + SetTabsFontSize(); + SetTabsIconSize(); + } + + // Provides the default message handling for the tab control. + inline LRESULT CTab::WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) + { + switch(msg) + { + case WM_PAINT: return OnPaint(msg, wparam, lparam); + case WM_ERASEBKGND: return OnEraseBkgnd(msg, wparam, lparam); + case WM_KILLFOCUS: return OnKillFocus(msg, wparam, lparam); + case WM_LBUTTONDBLCLK: return OnLButtonDblClk(msg, wparam, lparam); + case WM_LBUTTONDOWN: return OnLButtonDown(msg, wparam, lparam); + case WM_LBUTTONUP: return OnLButtonUp(msg, wparam, lparam); + case WM_MOUSEMOVE: return OnMouseMove(msg, wparam, lparam); + case WM_MOUSELEAVE: return OnMouseLeave(msg, wparam, lparam); + case WM_NCHITTEST: return OnNCHitTest(msg, wparam, lparam); + case WM_SETFOCUS: return OnSetFocus(msg, wparam, lparam); + case WM_WINDOWPOSCHANGED: return OnWindowPosChanged(msg, wparam, lparam); + case WM_WINDOWPOSCHANGING: return OnWindowPosChanging(msg, wparam, lparam); + case WM_DPICHANGED_AFTERPARENT: return OnDpiChangedAfterParent(msg, wparam, lparam); + } + + // Pass unhandled messages on for default processing. + return CWnd::WndProcDefault(msg, wparam, lparam); + } + + // Wrappers for Win32 Macros. + + // Calculates a tab control's display area given a window rectangle, or calculates + // the window rectangle that would correspond to a specified display area. + // Refer to TCM_ADJUSTRECT in the Windows API documentation for more information. + inline void CTab::AdjustRect(BOOL isLarger, RECT *prc) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(isLarger); + LPARAM lparam = reinterpret_cast(prc); + SendMessage(TCM_ADJUSTRECT, wparam, lparam); + } + + // Removes all items from a tab control. Use this function to remove tabs added by InsertItem. + // Refer to TabCtrl_DeleteAllItems in the Windows API documentation for more information. + inline BOOL CTab::DeleteAllItems() const + { + assert(IsWindow()); + return TabCtrl_DeleteAllItems(*this); + } + + // Removes an tab from a tab control. + // Note: Use this function to remove a tab added by InsertItem. + // Use RemoveTabPage to remove a tab and page added by AddTabPage. + // Refer to TabCtrl_DeleteItem in the Windows API documentation for more information. + inline BOOL CTab::DeleteItem(int tab) const + { + assert(IsWindow()); + return TabCtrl_DeleteItem(*this, tab); + } + + // Resets items in a tab control, clearing any that were set to the TCIS_BUTTONPRESSED state. + // Refer to TabCtrl_DeselectAll in the Windows API documentation for more information. + inline void CTab::DeselectAll(UINT excludeFocus) const + { + assert(IsWindow()); + TabCtrl_DeselectAll(*this, excludeFocus); + } + + // Returns the index of the tab that has the focus in a tab control. + // Refer to TabCtrl_GetCurFocus in the Windows API documentation for more information. + inline int CTab::GetCurFocus() const + { + assert(IsWindow()); + return TabCtrl_GetCurFocus(*this); + } + + // Determines the currently selected tab in a tab control. + // Refer to TabCtrl_GetCurSel in the Windows API documentation for more information. + inline int CTab::GetCurSel() const + { + assert(IsWindow()); + return TabCtrl_GetCurSel(*this); + } + + // Retrieves the extended styles that are currently in use for the tab control. + // Refer to TabCtrl_GetExtendedStyle in the Windows API documentation for more information. + inline DWORD CTab::GetExtendedStyle() const + { + assert(IsWindow()); + return TabCtrl_GetExtendedStyle(*this); + } + + // Retrieves the image list associated with a tab control. + // Refer to TabCtrl_GetImageList in the Windows API documentation for more information. + inline CImageList CTab::GetImageList() const + { + assert(IsWindow()); + HIMAGELIST images = TabCtrl_GetImageList(*this); + return CImageList(images); + } + + // Retrieves information about a tab in a tab control. + // Refer to TabCtrl_GetItem in the Windows API documentation for more information. + inline BOOL CTab::GetItem(int tab, LPTCITEM pItemInfo) const + { + assert(IsWindow()); + return TabCtrl_GetItem(*this, tab, pItemInfo); + } + + // Retrieves the number of tabs in the tab control. + // Refer to TabCtrl_GetItemCount in the Windows API documentation for more information. + inline int CTab::GetItemCount() const + { + assert(IsWindow()); + return TabCtrl_GetItemCount(*this); + } + + // Retrieves the bounding rectangle for a tab in a tab control. + // Refer to TabCtrl_GetItemRect in the Windows API documentation for more information. + inline BOOL CTab::GetItemRect(int tab, RECT& rc) const + { + assert(IsWindow()); + return TabCtrl_GetItemRect(*this, tab, &rc); + } + + // Retrieves the bounding rectangle for a tab in a tab control. + // Refer to TabCtrl_GetItemRect in the Windows API documentation for more information. + inline CRect CTab::GetItemRect(int tab) const + { + assert(IsWindow()); + CRect rc; + TabCtrl_GetItemRect(*this, tab, &rc); + return rc; + } + + // Retrieves the current number of rows of tabs in a tab control. + // Refer to TabCtrl_GetRowCount in the Windows API documentation for more information. + inline int CTab::GetRowCount() const + { + assert(IsWindow()); + return TabCtrl_GetRowCount(*this); + } + + // Retrieves a handle to the ToolTip control associated with a tab control. + // Refer to TabCtrl_GetToolTips in the Windows API documentation for more information. + inline HWND CTab::GetToolTips() const + { + assert(IsWindow()); + return TabCtrl_GetToolTips(*this); + } + + // Sets the highlight state of a tab item. + // Refer to TabCtrl_HighlightItem in the Windows API documentation for more information. + inline BOOL CTab::HighlightItem(int tabID, WORD highlight) const + { + assert(IsWindow()); + return TabCtrl_HighlightItem(*this, tabID, highlight); + } + + // Determines which tab, if any, is at a specified screen position. + // Refer to TabCtrl_HitTest in the Windows API documentation for more information. + inline int CTab::HitTest(TCHITTESTINFO& hitInfo) const + { + assert(IsWindow()); + return TabCtrl_HitTest(*this, &hitInfo); + } + + // Inserts a new tab in a tab control. Use this to add a tab without a tab page. + // Refer to TabCtrl_InsertItem in the Windows API documentation for more information. + inline int CTab::InsertItem(int tab, const LPTCITEM pItemInfo) const + { + assert(IsWindow()); + assert(pItemInfo); + return TabCtrl_InsertItem(*this, tab, pItemInfo); + } + + // Removes an image from a tab control's image list. + // Refer to TabCtrl_RemoveImage in the Windows API documentation for more information. + inline void CTab::RemoveImage(int image) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(image); + TabCtrl_RemoveImage(*this, wparam); + } + + // Sets the focus to a specified tab in a tab control. + // Refer to TabCtrl_SetCurFocus in the Windows API documentation for more information. + inline void CTab::SetCurFocus(int tab) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(tab); + TabCtrl_SetCurFocus(*this, wparam); + } + + // Selects a tab in a tab control. + // Refer to TabCtrl_SetCurSel in the Windows API documentation for more information. + inline int CTab::SetCurSel(int tab) const + { + assert(IsWindow()); + return TabCtrl_SetCurSel(*this, tab); + } + + // Sets the extended styles that the tab control will use. + // Refer to TabCtrl_SetExtendedStyle in the Windows API documentation for more information. + inline DWORD CTab::SetExtendedStyle(DWORD dwExStyle) const + { + assert(IsWindow()); + LPARAM lparam = static_cast(dwExStyle); + return TabCtrl_SetExtendedStyle(*this, lparam); + } + + // Assigns an image list to a tab control. + // Refer to TabCtrl_SetImageList in the Windows API documentation for more information. + inline CImageList CTab::SetImageList(HIMAGELIST newImages) + { + assert(IsWindow()); + HIMAGELIST images = TabCtrl_SetImageList( *this, newImages); + if (newImages != 0) + m_images = newImages; + return images; + } + + // Sets some or all of a tab's attributes. + // Refer to TabCtrl_SetItem in the Windows API documentation for more information. + inline BOOL CTab::SetItem(int tab, LPTCITEM pTabInfo) const + { + assert(IsWindow()); + assert(pTabInfo); + return TabCtrl_SetItem(*this, tab, pTabInfo); + } + + // Sets the number of bytes per tab reserved for application-defined data in a tab control. + // Refer to TabCtrl_SetItemExtra in the Windows API documentation for more information. + inline BOOL CTab::SetItemExtra(int cb) const + { + assert(IsWindow()); + return TabCtrl_SetItemExtra(*this, cb); + } + + // Sets the width and height of tabs in a fixed-width or owner-drawn tab control. + // Refer to TabCtrl_SetItemSize in the Windows API documentation for more information. + inline DWORD CTab::SetItemSize(int cx, int cy) const + { + assert(IsWindow()); + return TabCtrl_SetItemSize(*this, cx, cy); + } + + // Sets the minimum width of items in a tab control. + // Refer to TabCtrl_SetMinTabWidth in the Windows API documentation for more information. + inline int CTab::SetMinTabWidth(int cx) const + { + assert(IsWindow()); + return TabCtrl_SetMinTabWidth(*this, cx); + } + + // Sets the amount of space (padding) around each tab's icon and label in a tab control. + // Refer to TabCtrl_SetPadding in the Windows API documentation for more information. + inline void CTab::SetPadding(int cx, int cy) const + { + assert(IsWindow()); + TabCtrl_SetPadding(*this, cx, cy); + } + + // Assigns a ToolTip control to a tab control. + // Refer to TabCtrl_SetToolTips in the Windows API documentation for more information. + inline void CTab::SetToolTips(HWND toolTip) const + { + assert(IsWindow()); + TabCtrl_SetToolTips(*this, toolTip); + } + + //////////////////////////////////////// + // Definitions for the CTabbedMDI class. + + inline CTabbedMDI::CTabbedMDI() + { + SetTab(m_tab); + } + + // Adds a MDI tab, given a pointer to the view window, and the tab's text. + // The framework assumes ownership of the CWnd pointer provided, and deletes + // the CWnd object when the window is destroyed. + inline CWnd* CTabbedMDI::AddMDIChild(CWnd* pView, LPCTSTR tabText, int mdiChildID) + { + assert(pView); // Cannot add null CWnd*. + assert(lstrlen(tabText) < WXX_MAX_STRING_SIZE); + + return AddMDIChild(WndPtr(pView), tabText, mdiChildID); + } + + // Adds a MDI tab, given a pointer to the view window, and the tab's text. + // The framework assumes ownership of the CWnd pointer provided, and deletes + // the CWnd object when the window is destroyed. + inline CWnd* CTabbedMDI::AddMDIChild(WndPtr view, LPCTSTR tabText, int mdiChildID) + { + CWnd* pView = view.get(); + assert(pView); // Cannot add null CWnd*. + assert(lstrlen(tabText) < WXX_MAX_STRING_SIZE); + + GetTab().AddTabPage(std::move(view), tabText, 0U, mdiChildID); + + // Fake a WM_MOUSEACTIVATE to propagate focus change to dockers. + if (IsWindow()) + { + WPARAM wparam = reinterpret_cast(GetAncestor().GetHwnd()); + LPARAM lparam = MAKELPARAM(HTCLIENT, WM_LBUTTONDOWN); + GetParent().SendMessage(WM_MOUSEACTIVATE, wparam, lparam); + } + + return pView; + } + + // Closes the active MDI child. + inline void CTabbedMDI::CloseActiveMDI() + { + int tab = GetTab().GetCurSel(); + if (tab >= 0) + GetTab().RemoveTabPage(tab); + + RecalcLayout(); + } + + // Closes all MDI children. + inline void CTabbedMDI::CloseAllMDIChildren() + { + while (GetMDIChildCount() > 0) + { + GetTab().RemoveTabPage(0); + } + } + + // Closes the specified MDI child. + inline void CTabbedMDI::CloseMDIChild(int tab) + { + GetTab().RemoveTabPage(tab); + + if (GetActiveMDIChild()) + GetActiveMDIChild()->RedrawWindow(); + } + + // Creates the TabbedMDI window. + inline HWND CTabbedMDI::Create(HWND parent /* = 0*/) + { + CLIENTCREATESTRUCT clientcreate = {}; + clientcreate.hWindowMenu = *this; + clientcreate.idFirstChild = IDW_FIRSTCHILD ; + DWORD style = WS_CHILD | WS_VISIBLE | MDIS_ALLCHILDSTYLES | WS_CLIPCHILDREN; + + // Create the MDICLIENT view window. + if (!CreateEx(0, _T("MDICLIENT"), _T(""), + style, 0, 0, 0, 0, parent, nullptr, (PSTR) &clientcreate)) + throw CWinException(GetApp()->MsgWndCreate()); + + return *this; + } + + // Retrieves a pointer to the active MDI child. + inline CWnd* CTabbedMDI::GetActiveMDIChild() const + { + CWnd* pView = nullptr; + int tab = GetTab().GetCurSel(); + if (tab >= 0) + { + TabPageInfo tbi = GetTab().GetTabPageInfo(tab); + pView = tbi.pView; + } + + return pView; + } + + // Retrieves the index of the active MDI child. + inline int CTabbedMDI::GetActiveMDITab() const + { + return GetTab().GetCurSel(); + } + + // Retrieves a pointer to the specified MDI child. + inline CWnd* CTabbedMDI::GetMDIChild(int tab) const + { + assert(tab >= 0); + assert(tab < GetMDIChildCount()); + return GetTab().GetTabPageInfo(tab).pView; + } + + // Returns the count of MDI children. + inline int CTabbedMDI::GetMDIChildCount() const + { + return static_cast( GetTab().GetAllTabs().size() ); + } + + // Retrieves the ID of the specified MDI child. + inline int CTabbedMDI::GetMDIChildID(int tab) const + { + assert(tab >= 0); + assert(tab < GetMDIChildCount()); + return GetTab().GetTabPageInfo(tab).tabID; + } + + // Retrieves the title of the specified MDI child. + inline LPCTSTR CTabbedMDI::GetMDIChildTitle(int tab) const + { + assert(tab >= 0); + assert(tab < GetMDIChildCount()); + return GetTab().GetTabPageInfo(tab).tabText; + } + + // Load the MDI children layout from the registry. + inline BOOL CTabbedMDI::LoadRegistrySettings(LPCTSTR keyName) + { + BOOL isLoaded = FALSE; + + if (keyName) + { + const CString mdiKeyName = _T("Software\\") + CString(keyName) + _T("\\MDI Children"); + CRegKey mdiChildKey; + if (ERROR_SUCCESS == mdiChildKey.Open(HKEY_CURRENT_USER, mdiKeyName)) + { + DWORD dwTabID; + int i = 0; + CString tabKeyName; + CString TabText; + tabKeyName.Format(_T("ID%d"), i); + + // Fill the DockList vector from the registry. + while (ERROR_SUCCESS == mdiChildKey.QueryDWORDValue(tabKeyName, dwTabID)) + { + tabKeyName.Format(_T("Text%d"), i); + DWORD dwBufferSize = 0; + if (ERROR_SUCCESS == mdiChildKey.QueryStringValue(tabKeyName, 0, &dwBufferSize)) + { + int bufferSize = static_cast(dwBufferSize); + mdiChildKey.QueryStringValue(tabKeyName, TabText.GetBuffer(bufferSize), &dwBufferSize); + TabText.ReleaseBuffer(); + } + + int tabID = static_cast(dwTabID); + WndPtr child = NewMDIChildFromID(tabID); + if (child.get()) + { + AddMDIChild(std::move(child), TabText, tabID); + i++; + tabKeyName.Format(_T("ID%d"), i); + isLoaded = TRUE; + } + else + { + TRACE("Failed to get TabbedMDI info from registry"); + isLoaded = FALSE; + break; + } + } + + if (isLoaded) + { + // Load Active MDI Tab from the registry. + tabKeyName = _T("Active MDI Tab"); + DWORD tab; + if (ERROR_SUCCESS == mdiChildKey.QueryDWORDValue(tabKeyName, tab)) + SetActiveMDITab(static_cast(tab)); + else + SetActiveMDITab(0); + } + } + } + + if (!isLoaded) + CloseAllMDIChildren(); + + return isLoaded; + } + + // Override this function to create new MDI children from IDs. + inline WndPtr CTabbedMDI::NewMDIChildFromID(int /* mdiChildID */) + { + // Override this function to create new MDI children from IDs as shown below + WndPtr view; + /* switch(mdiChildID) + { + case ID_SIMPLE: + view = std::make_unique(); + break; + case ID_RECT: + view = std::make_unique(); + break; + default: + TRACE("Unknown MDI child ID\n"); + break; + } */ + + return view; + } + + // Called when the TabbeMDI window is created. (The HWND is attached to CTabbedMDI). + inline void CTabbedMDI::OnAttach() + { + GetTab().Create(*this); + GetTab().SetShowButtons(TRUE); + GetTab().SetFixedWidth(TRUE); + GetTab().SetOwnerDraw(TRUE); + } + + // Called when the TabbeMDI window is destroyed. + inline void CTabbedMDI::OnDestroy() + { + CloseAllMDIChildren(); + } + + // Handles notifications. + inline LRESULT CTabbedMDI::OnNotify(WPARAM, LPARAM lparam) + { + LPNMHDR pHeader = reinterpret_cast(lparam); + assert(pHeader); + if (pHeader != nullptr) + { + + switch(pHeader->code) + { + + case UMN_TABCHANGED: + RecalcLayout(); + break; + + case UWN_TABDRAGGED: + { + CPoint pt = GetCursorPos(); + VERIFY(GetTab().ScreenToClient(pt)); + + TCHITTESTINFO info = {}; + info.pt = pt; + int tab = GetTab().HitTest(info); + if (tab >= 0) + { + if (tab != GetActiveMDITab()) + { + GetTab().SwapTabs(tab, GetActiveMDITab()); + SetActiveMDITab(tab); + } + } + + break; + } + + case UWN_TABCLOSE: + { + TABNMHDR* pTabNMHDR = reinterpret_cast(pHeader); + return !OnTabClose(pTabNMHDR->page); + } + + } // switch(pnmhdr->code) + + } // if (pHeader == nullptr) + + return 0; + } + + // Override this function to determine what happens when a tab is about to close. + // Return TRUE to allow the tab to close, or FALSE to prevent the tab closing. + inline BOOL CTabbedMDI::OnTabClose(int) + { + // Allow the tab to be close + return TRUE; + } + + // Called when the tabbedMDI window is resized. + inline LRESULT CTabbedMDI::OnWindowPosChanged(UINT msg, WPARAM wparam, LPARAM lparam) + { + RecalcLayout(); + return FinalWindowProc(msg, wparam, lparam); + } + + // Repositions the child windows. + inline void CTabbedMDI::RecalcLayout() + { + if (GetTab().IsWindow()) + { + CRect rcClient = GetClientRect(); + GetTab().SetWindowPos(HWND_TOP, rcClient, SWP_SHOWWINDOW); + } + } + + // Saves the MDI children layout in the registry. + inline BOOL CTabbedMDI::SaveRegistrySettings(LPCTSTR keyName) + { + if (keyName) + { + const CString appKeyName = _T("Software\\") + CString(keyName); + const CString mdiChildrenName = _T("MDI Children"); + try + { + CRegKey appKey; + if (ERROR_SUCCESS != appKey.Create(HKEY_CURRENT_USER, appKeyName)) + throw CUserException(); + if (ERROR_SUCCESS != appKey.Open(HKEY_CURRENT_USER, appKeyName)) + throw CUserException(); + + appKey.DeleteSubKey(mdiChildrenName); + CRegKey mdiChildKey; + if (ERROR_SUCCESS != mdiChildKey.Create(appKey, mdiChildrenName)) + throw CUserException(); + if (ERROR_SUCCESS != mdiChildKey.Open(appKey, mdiChildrenName)) + throw CUserException(); + + for (int i = 0; i < GetMDIChildCount(); ++i) + { + CString tabKeyName; + TabPageInfo pdi = GetTab().GetTabPageInfo(i); + + tabKeyName.Format(_T("ID%d"), i); + DWORD tabID = static_cast(pdi.tabID); + if (ERROR_SUCCESS != mdiChildKey.SetDWORDValue(tabKeyName, tabID)) + throw CUserException(); + + tabKeyName.Format(_T("Text%d"), i); + CString TabText = GetTab().GetTabPageInfo(i).tabText; + if (ERROR_SUCCESS != mdiChildKey.SetStringValue(tabKeyName, TabText)) + throw CUserException(); + } + + // Add Active Tab to the registry. + CString tabKeyName = _T("Active MDI Tab"); + DWORD tab = static_cast(GetActiveMDITab()); + if (ERROR_SUCCESS != mdiChildKey.SetDWORDValue(tabKeyName, tab)) + throw CUserException(); + } + catch (const CUserException&) + { + TRACE("*** Failed to save TabbedMDI settings in registry. ***\n"); + + // Roll back the registry changes by deleting the subkeys. + CRegKey appKey; + if (ERROR_SUCCESS == appKey.Open(HKEY_CURRENT_USER, appKeyName)) + { + appKey.DeleteSubKey(mdiChildrenName); + } + + return FALSE; + } + } + + return TRUE; + } + + // Makes the specified MDI child active. + inline void CTabbedMDI::SetActiveMDIChild(CWnd* pWnd) const + { + assert(pWnd); + int page = GetTab().GetTabIndex(pWnd); + if (page >= 0) + GetTab().SelectPage(page); + } + + // Makes the specified MDI child active. + inline void CTabbedMDI::SetActiveMDITab(int tab) const + { + assert(IsWindow()); + assert(GetTab().IsWindow()); + GetTab().SelectPage(tab); + } + + // Called when the CTabbedMDI window acquires keyboard focus. + inline LRESULT CTabbedMDI::OnSetFocus(UINT, WPARAM, LPARAM) + { + if (GetActiveMDIChild() && GetActiveMDIChild()->IsWindow()) + GetActiveMDIChild()->SetFocus(); + + return 0; + } + + // Provides default handling for the window's messages. + inline LRESULT CTabbedMDI::WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) + { + switch(msg) + { + case WM_SETFOCUS: return OnSetFocus(msg, wparam, lparam); + case WM_WINDOWPOSCHANGED: return OnWindowPosChanged(msg, wparam, lparam); + case UWM_GETCTABBEDMDI: return reinterpret_cast(this); + } + + return CWnd::WndProcDefault(msg, wparam, lparam); + } + +} // namespace Win32xx + +#endif // _WIN32XX_TAB_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_taskdialog.h b/packages/media/cpp/packages/Win32xx/include/wxx_taskdialog.h new file mode 100644 index 00000000..69f32560 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_taskdialog.h @@ -0,0 +1,851 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////// +// wxx_taskdialog.h +// Declaration of the CTaskDialog class + +// A task dialog is a dialog box that can be used to display information +// and receive simple input from the user. Like a message box, it is +// formatted by the operating system according to parameters you set. +// However, a task dialog has many more features than a message box. + +// NOTES: +// Task dialogs are only supported on Windows Vista and above. +// Task dialogs require XP themes enabled (use version 6 of Common Controls) +// Task dialogs are always modal. +// Task dialogs require Unicode. There is no ANSI version of the TaskDialogIndirect function. + + +#ifndef _WIN32XX_TASKDIALOG_H_ +#define _WIN32XX_TASKDIALOG_H_ + +#include "wxx_wincore.h" + +namespace Win32xx +{ + + ////////////////////////////////////////////////////////////////// + // CTaskDialog manages a task dialog. A task dialog is similar to, + // while much more flexible than, a basic message box. + class CTaskDialog : public CWnd + { + public: + CTaskDialog(); + virtual ~CTaskDialog() override = default; + + void AddCommandControl(int buttonID, LPCWSTR caption); + void AddRadioButton(int radioButtonID, LPCWSTR caption); + void AddRadioButtonGroup(int firstRadioButtonID, int lastRadioButtonID); + void ClickButton(int buttonID) const; + void ClickRadioButton(int radioButtonID) const; + HRESULT DoModal(HWND parent = nullptr); + void ElevateButton(int buttonID, BOOL isElevated) const; + void EnableButton(int buttonID, BOOL isEnabled) const; + void EnableRadioButton(int buttonID, BOOL isEnabled) const; + TASKDIALOGCONFIG GetConfig() const; + TASKDIALOG_FLAGS GetOptions() const; + int GetSelectedButtonID() const; + int GetSelectedRadioButtonID() const; + BOOL GetVerificationCheckboxState() const; + static BOOL IsSupported(); + void NavigateTo(CTaskDialog& taskDialog) const; + void SetCommonButtons(TASKDIALOG_COMMON_BUTTON_FLAGS commonButtons); + void SetContent(LPCWSTR content); + void SetDefaultButton(int buttonID); + void SetDefaultRadioButton(int radioButtonID); + void SetDialogWidth(UINT width = 0); + void SetExpansionArea(LPCWSTR expandedInfo, + LPCWSTR expandedLabel = L"", LPCWSTR collapsedLabel = L""); + void SetFooterIcon(HICON icon); + void SetFooterIcon(LPCWSTR footerIcon); + void SetFooterText(LPCWSTR text); + void SetMainIcon(HICON icon); + void SetMainIcon(LPCWSTR mainIcon); + void SetMainInstruction(LPCWSTR mainInstruction); + void SetOptions(TASKDIALOG_FLAGS flags); + void SetProgressBarMarquee(BOOL isEnabled = TRUE, int marqueeSpeed = 0) const; + void SetProgressBarPosition(int progressPos) const; + void SetProgressBarRange(int minRange, int maxRange) const; + void SetProgressBarState(int newState = PBST_NORMAL) const; + void SetVerificationCheckbox(BOOL isChecked) const; + void SetVerificationCheckboxText(LPCWSTR verificationText); + void SetWindowTitle(LPCWSTR windowTitle); + void UpdateElementText(TASKDIALOG_ELEMENTS element, LPCWSTR newText) const; + + protected: + // Override these functions as required + virtual BOOL OnTDButtonClicked(int buttonID); + virtual void OnTDConstructed(); + virtual void OnTDCreated(); + virtual void OnTDDestroyed(); + virtual void OnTDExpandButtonClicked(BOOL isExpanded); + virtual void OnTDHelp(); + virtual void OnTDHyperlinkClicked(LPCWSTR hyperLink); + virtual void OnTDNavigatePage(); + virtual BOOL OnTDRadioButtonClicked(int radioButtonID); + virtual BOOL OnTDTimer(DWORD tickCount); + virtual void OnTDVerificationCheckboxClicked(BOOL isChecked); + virtual LRESULT TaskDialogProc(UINT msg, WPARAM wparam, LPARAM lparam); + + // Not intended to be overwritten + LRESULT TaskDialogProcDefault(UINT msg, WPARAM wparam, LPARAM lparam); + + private: + struct TaskButton + { + TaskButton(int id, LPCWSTR text); // Constructor + int buttonID; + CStringW buttonText; + }; + + using CWnd::WndProc; // Make WndProc private + CTaskDialog(const CTaskDialog&) = delete; + CTaskDialog& operator=(const CTaskDialog&) = delete; + + CStringW FillString(LPCWSTR text); + static HRESULT CALLBACK StaticTaskDialogProc(HWND wnd, + UINT notification, WPARAM wparam, LPARAM lparam, LONG_PTR refData); + + std::vector m_buttons; + std::vector m_radioButtons; + + CStringW m_collapsedControlText; + CStringW m_content; + CStringW m_expandedControlText; + CStringW m_expandedInformation; + CStringW m_footer; + CStringW m_mainInstruction; + CStringW m_verificationText; + CStringW m_windowTitle; + + TASKDIALOGCONFIG m_tc; + int m_selectedButtonID; + int m_selectedRadioButtonID; + BOOL m_verificationCheckboxState; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + /////////////////// + // Global function. + // + + // This function creates a TaskDialog that simulates a simple MessageBox. + // The iconType can be formed from MAKEINTRESOURCE, or one of: + // TD_WARNING_ICON; TD_ERROR_ICON; TD_INFORMATION_ICON; TD_SHIELD_ICON. + // TaskDialogs support per monitor DPI aware version 2, but a MessageBox + // currently does not. TaskDialogs are not supported on Windows XP. + inline void TaskDialogBox(HWND wnd, LPCWSTR text, LPCWSTR caption, + LPWSTR iconType = TD_INFORMATION_ICON) + { + CTaskDialog taskDialog; + taskDialog.SetContent(text); + taskDialog.SetWindowTitle(caption); + taskDialog.SetMainIcon(iconType); + taskDialog.DoModal(wnd); + } + + ///////////////////////////////////////// + // Definitions for the CTaskDialog class. + // + + inline CTaskDialog::CTaskDialog() : m_selectedButtonID(0), + m_selectedRadioButtonID(0), m_verificationCheckboxState(FALSE) + { + m_tc = {}; + m_tc.cbSize = sizeof(m_tc); + m_tc.pfCallback = CTaskDialog::StaticTaskDialogProc; + } + + // Adds a command control or push button to the task dialog. + inline void CTaskDialog::AddCommandControl(int buttonID, LPCWSTR caption) + { + assert (GetHwnd() == nullptr); + + TaskButton tb(buttonID, caption); + m_buttons.push_back(tb); + } + + // Adds a radio button to the task dialog. + inline void CTaskDialog::AddRadioButton(int radioButtonID, LPCWSTR caption) + { + assert (GetHwnd() == nullptr); + + TaskButton tb(radioButtonID, caption); + m_radioButtons.push_back(tb); + } + + // Adds a range of radio buttons to the task dialog. + // Assumes the resource ID of the button and it's string match. + inline void CTaskDialog::AddRadioButtonGroup(int firstRadioButtonID, + int lastRadioButtonID) + { + assert (GetHwnd() == nullptr); + assert(firstRadioButtonID > 0); + assert(lastRadioButtonID > firstRadioButtonID); + + for (int id = firstRadioButtonID; id <= lastRadioButtonID; ++id) + { + TaskButton tb(id, MAKEINTRESOURCEW(id)); + m_radioButtons.push_back(tb); + } + } + + // Simulates the action of a button click in the task dialog. + // Refer to TDM_CLICK_BUTTON in the Windows API documentation for more information. + inline void CTaskDialog::ClickButton(int buttonID) const + { + assert(GetHwnd()); + SendMessage(TDM_CLICK_BUTTON, static_cast(buttonID), 0); + } + + // Simulates the action of a radio button click in the TaskDialog. + // Refer to TDM_CLICK_RADIO_BUTTON in the Windows API documentation for more information. + inline void CTaskDialog::ClickRadioButton(int radioButtonID) const + { + assert(GetHwnd()); + WPARAM wparam = static_cast(radioButtonID); + SendMessage(TDM_CLICK_RADIO_BUTTON, wparam, 0); + } + + // Creates and displays the task dialog. + // Refer to TaskDialogIndirect in the Windows API documentation for more information. + inline HRESULT CTaskDialog::DoModal(HWND parent /* = nullptr */) + { + assert (GetHwnd() == nullptr); + m_selectedButtonID = 0; + m_selectedRadioButtonID = 0; + m_verificationCheckboxState = FALSE; + + // Build a vector of button info. This will be used later as an array. + std::vector buttons; + for (const TaskButton& button : m_buttons) + { + TASKDIALOG_BUTTON tb = {}; + tb.nButtonID = button.buttonID; + tb.pszButtonText = button.buttonText; + buttons.push_back(tb); + } + + // Build a vector of radio button info. This will be used later as an array. + std::vector radioButtons; + for (const TaskButton& button : m_radioButtons) + { + TASKDIALOG_BUTTON tb = {}; + tb.nButtonID = button.buttonID; + tb.pszButtonText = button.buttonText; + radioButtons.push_back(tb); + } + + m_wnd = nullptr; + + // Fill the TASKDIALOGCONFIG struct. + m_tc.cbSize = sizeof(m_tc); + m_tc.pButtons = buttons.empty()? nullptr : buttons.data(); + m_tc.cButtons = static_cast(buttons.size()); + m_tc.pRadioButtons = radioButtons.empty()? nullptr : radioButtons.data(); + m_tc.cRadioButtons = static_cast(radioButtons.size()); + m_tc.hwndParent = parent; + + // Retrieve this thread's TLS data + TLSData* pTLSData = GetApp()->GetTlsData(); + + // Store the CWnd pointer in thread local storage. + pTLSData->pWnd = this; + + // Create the task dialog. + HRESULT result = ::TaskDialogIndirect(&m_tc, &m_selectedButtonID, + &m_selectedRadioButtonID, &m_verificationCheckboxState); + + pTLSData->pWnd = nullptr; + Cleanup(); + + if (result != S_OK) + { + // Throw an exception to indicate task dialog creation failure. + throw CWinException(GetApp()->MsgTaskDialog()); + } + + return result; + } + + // Adds a shield icon to indicate that the button's action requires + // elevated privileges. + // Refer to TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE in the Windows API documentation for more information. + inline void CTaskDialog::ElevateButton(int buttonID, BOOL isElevated) const + { + assert(GetHwnd()); + WPARAM wparam = static_cast(buttonID); + LPARAM lparam = static_cast(isElevated); + SendMessage(TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE, wparam, lparam); + } + + // Enables or disables a push button in the TaskDialog. + // Refer to TDM_ENABLE_BUTTON in the Windows API documentation for more information. + inline void CTaskDialog::EnableButton(int buttonID, BOOL isEnabled) const + { + assert(GetHwnd()); + WPARAM wparam = static_cast(buttonID); + LPARAM lparam = static_cast(isEnabled); + SendMessage(TDM_ENABLE_BUTTON, wparam, lparam); + } + + // Enables or disables a radio button in the TaskDialog. + // Refer to TDM_ENABLE_RADIO_BUTTON in the Windows API documentation for more information. + inline void CTaskDialog::EnableRadioButton(int radioButtonID, BOOL isEnabled) const + { + assert(GetHwnd()); + WPARAM wparam = static_cast(radioButtonID); + LPARAM lparam = static_cast(isEnabled); + SendMessage(TDM_ENABLE_RADIO_BUTTON, wparam, lparam); + } + + // Fills a CString from a string resource or a text string. + inline CStringW CTaskDialog::FillString(LPCWSTR text) + { + CStringW str; + if (IS_INTRESOURCE(text)) // support MAKEINTRESOURCE + { + UINT textID = static_cast(reinterpret_cast(text)); + str.LoadString(textID); + } + else + str = text; + + return str; + } + + // Returns the TASKDIALOGCONFIG structure for the task dialog. + inline TASKDIALOGCONFIG CTaskDialog::GetConfig() const + { + return m_tc; + } + + // Returns the task dialog's options. These are a combination of: + // TDF_ENABLE_HYPERLINKS, TDF_USE_HICON_MAIN, TDF_USE_HICON_FOOTER, + // TDF_ALLOW_DIALOG_CANCELLATION, TDF_USE_COMMAND_LINKS, + // TDF_USE_COMMAND_LINKS_NO_ICON, TDF_EXPAND_FOOTER_AREA, + // TDF_EXPANDED_BY_DEFAULT, TDF_VERIFICATION_FLAG_CHECKED, + // TDF_SHOW_PROGRESS_BAR, TDF_SHOW_MARQUEE_PROGRESS_BAR, + // TDF_CALLBACK_TIMER, TDF_POSITION_RELATIVE_TO_WINDOW, + // TDF_RTL_LAYOUT, TDF_NO_DEFAULT_RADIO_BUTTON, TDF_CAN_BE_MINIMIZED. + inline TASKDIALOG_FLAGS CTaskDialog::GetOptions() const + { + return m_tc.dwFlags; + } + + // Returns the ID of the selected button. + inline int CTaskDialog::GetSelectedButtonID() const + { + assert (GetHwnd() == nullptr); + return m_selectedButtonID; + } + + // Returns the ID of the selected radio button. + inline int CTaskDialog::GetSelectedRadioButtonID() const + { + assert (GetHwnd() == nullptr); + return m_selectedRadioButtonID; + } + + // Returns the state of the verification check box. + inline BOOL CTaskDialog::GetVerificationCheckboxState() const + { + assert (GetHwnd() == nullptr); + return m_verificationCheckboxState; + } + + // Returns TRUE if task dialogs are supported by this operating system. + inline BOOL CTaskDialog::IsSupported() + { + // Returns TRUE for Vista and later. + return GetWinVersion() >= 2600; + } + + // Replaces the information displayed by the task dialog. + // Refer to TDM_NAVIGATE_PAGE in the Windows API documentation for more information. + inline void CTaskDialog::NavigateTo(CTaskDialog& taskDialog) const + { + assert(GetHwnd()); + TASKDIALOGCONFIG tc = taskDialog.GetConfig(); + SendMessage(TDM_NAVIGATE_PAGE, 0, reinterpret_cast(&tc)); + } + + // Called when the user selects a button or command link. + inline BOOL CTaskDialog::OnTDButtonClicked(int) + { + // Return TRUE to prevent the task dialog from closing. + return FALSE; + } + + // Called when the task dialog is constructed, before it is displayed. + inline void CTaskDialog::OnTDConstructed() + { + } + + // Called when the task dialog is displayed. + inline void CTaskDialog::OnTDCreated() + { + } + + // Called when the task dialog is destroyed. + inline void CTaskDialog::OnTDDestroyed() + { + } + + // Called when the expand button is clicked. + inline void CTaskDialog::OnTDExpandButtonClicked(BOOL) + { + } + + // Called when the user presses F1 on the keyboard. + inline void CTaskDialog::OnTDHelp() + { + } + + // Called when the user clicks on a hyperlink. + inline void CTaskDialog::OnTDHyperlinkClicked(LPCWSTR) + { + } + + // Called when a navigation has occurred. + inline void CTaskDialog::OnTDNavigatePage() + { + } + + // Called when the user selects a radio button. + inline BOOL CTaskDialog::OnTDRadioButtonClicked(int) + { + return TRUE; + } + + // Called approximately every 200 milliseconds when the TDF_CALLBACK_TIMER + // flag is set. + inline BOOL CTaskDialog::OnTDTimer(DWORD) + { + // Return TRUE to reset the tick count. + return FALSE; + } + + // Called when the user clicks the task dialog verification check box. + inline void CTaskDialog::OnTDVerificationCheckboxClicked(BOOL) + { + } + + // The commonButtons parameter can be a combination of: + // TDCBF_OK_BUTTON OK button + // TDCBF_YES_BUTTON Yes button + // TDCBF_NO_BUTTON No button + // TDCBF_CANCEL_BUTTON Cancel button + // TDCBF_RETRY_BUTTON Retry button + // TDCBF_CLOSE_BUTTON Close button + inline void CTaskDialog::SetCommonButtons(TASKDIALOG_COMMON_BUTTON_FLAGS commonButtons) + { + assert (GetHwnd() == nullptr); + m_tc.dwCommonButtons = commonButtons; + } + + // Sets the task dialog's primary content. + // Refer to TDM_SET_ELEMENT_TEXT in the Windows API documentation for more information. + inline void CTaskDialog::SetContent(LPCWSTR content) + { + m_content = FillString(content); + m_tc.pszContent = m_content; + WPARAM wparam = static_cast(TDE_CONTENT); + LPARAM lparam = reinterpret_cast(m_content.c_str()); + + if (IsWindow()) + SendMessage(TDM_SET_ELEMENT_TEXT, wparam, lparam); + } + + // Sets the task dialog's default button. + // Can be either a button ID or one of the common buttons. + inline void CTaskDialog::SetDefaultButton(int buttonID) + { + assert (GetHwnd() == nullptr); + m_tc.nDefaultButton = buttonID; + } + + // Sets the default radio button. + inline void CTaskDialog::SetDefaultRadioButton(int radioButtonID) + { + assert (GetHwnd() == nullptr); + m_tc.nDefaultRadioButton = radioButtonID; + } + + // The width of the task dialog's client area. If 0, the + // task dialog manager will calculate the ideal width. + inline void CTaskDialog::SetDialogWidth(UINT width /*= 0*/) + { + assert (GetHwnd() == nullptr); + m_tc.cxWidth = width; + } + + // Sets the text in the expandable area of the task dialog. + // Refer to TDM_SET_ELEMENT_TEXT in the Windows API documentation for more information. + inline void CTaskDialog::SetExpansionArea(LPCWSTR expandedInfo, + LPCWSTR expandedLabel, LPCWSTR collapsedLabel) + { + m_expandedInformation = FillString(expandedInfo); + m_tc.pszExpandedInformation = m_expandedInformation; + + m_expandedControlText = FillString(expandedLabel); + m_tc.pszExpandedControlText = m_expandedControlText; + + m_collapsedControlText = FillString(collapsedLabel); + m_tc.pszCollapsedControlText = m_collapsedControlText; + WPARAM wparam = static_cast(TDE_EXPANDED_INFORMATION); + LPARAM lparam = reinterpret_cast(m_expandedInformation.c_str()); + + if (IsWindow()) + SendMessage(TDM_SET_ELEMENT_TEXT, wparam, lparam); + } + + // Sets the icon that will be displayed in the task dialog's footer. + // Refer to TDM_UPDATE_ICON in the Windows API documentation for more information. + inline void CTaskDialog::SetFooterIcon(HICON footerIcon) + { + m_tc.hFooterIcon = footerIcon; + WPARAM wparam = static_cast(TDIE_ICON_FOOTER); + LPARAM lparam = reinterpret_cast(footerIcon); + SetOptions(GetOptions() | TDF_USE_HICON_FOOTER); + + if (IsWindow()) + SendMessage(TDM_UPDATE_ICON, wparam, lparam); + } + + // Sets the icon that will be displayed in the task dialog's footer. + // Possible icons: + // TD_ERROR_ICON A stop-sign icon appears in the task dialog. + // TD_WARNING_ICON An exclamation-point icon appears in the task dialog. + // TD_INFORMATION_ICON An icon consisting of a lowercase letter i in a circle appears in the task dialog. + // TD_SHIELD_ICON A shield icon appears in the task dialog. + // or a value passed via MAKEINTRESOURCE + // Refer to TDM_UPDATE_ICON in the Windows API documentation for more information. + inline void CTaskDialog::SetFooterIcon(LPCWSTR footerIcon) + { + m_tc.pszFooterIcon = const_cast(footerIcon); + WPARAM wparam = static_cast(TDIE_ICON_FOOTER); + LPARAM lparam = reinterpret_cast(footerIcon); + TASKDIALOG_FLAGS flags = GetOptions(); + SetOptions(flags &= ~TDF_USE_HICON_FOOTER); + + if (IsWindow()) + SendMessage(TDM_UPDATE_ICON, wparam, lparam); + } + + // Sets the text that will be displayed in the task dialog's footer. + // Refer to TDM_SET_ELEMENT_TEXT in the Windows API documentation for more information. + inline void CTaskDialog::SetFooterText(LPCWSTR footer) + { + m_footer = FillString(footer); + m_tc.pszFooter = m_footer; + WPARAM wparam = static_cast(TDE_FOOTER); + LPARAM lparam = reinterpret_cast(m_footer.c_str()); + + if (IsWindow()) + SendMessage(TDM_SET_ELEMENT_TEXT, wparam, lparam); + } + + // Sets task dialog's main icon. + // Refer to TDM_UPDATE_ICON in the Windows API documentation for more information. + inline void CTaskDialog::SetMainIcon(HICON mainIcon) + { + m_tc.hMainIcon = mainIcon; + WPARAM wparam = static_cast(TDIE_ICON_MAIN); + LPARAM lparam = reinterpret_cast(mainIcon); + SetOptions(GetOptions() | TDF_USE_HICON_MAIN); + + if (IsWindow()) + SendMessage(TDM_UPDATE_ICON, wparam, lparam); + } + + // Sets task dialog's main icon. + // Possible icons: + // TD_ERROR_ICON A stop-sign icon appears in the task dialog. + // TD_WARNING_ICON An exclamation-point icon appears in the task dialog. + // TD_INFORMATION_ICON An icon consisting of a lowercase letter i in a circle appears in the task dialog. + // TD_SHIELD_ICON A shield icon appears in the task dialog. + // Refer to TDM_UPDATE_ICON in the Windows API documentation for more information. + inline void CTaskDialog::SetMainIcon(LPCWSTR mainIcon) + { + m_tc.pszMainIcon = const_cast(mainIcon); + WPARAM wparam = static_cast(TDIE_ICON_MAIN); + LPARAM lparam = reinterpret_cast(mainIcon); + TASKDIALOG_FLAGS flags = GetOptions(); + SetOptions(flags &= ~TDF_USE_HICON_MAIN); + + if (IsWindow()) + SendMessage(TDM_UPDATE_ICON, wparam, lparam); + } + + // Sets the task dialog's main instruction text. + // Refer to TDM_SET_ELEMENT_TEXT in the Windows API documentation for more information. + inline void CTaskDialog::SetMainInstruction(LPCWSTR mainInstruction) + { + m_mainInstruction = FillString(mainInstruction); + m_tc.pszMainInstruction = m_mainInstruction; + WPARAM wparam = static_cast(TDE_FOOTER); + LPARAM lparam = reinterpret_cast(m_mainInstruction.c_str()); + + if (IsWindow()) + SendMessage(TDM_SET_ELEMENT_TEXT, wparam, lparam); + } + + // Sets the task dialog's options. These are a combination of: + // TDF_ENABLE_HYPERLINKS, TDF_USE_HICON_MAIN, TDF_USE_HICON_FOOTER, + // TDF_ALLOW_DIALOG_CANCELLATION, TDF_USE_COMMAND_LINKS, + // TDF_USE_COMMAND_LINKS_NO_ICON, TDF_EXPAND_FOOTER_AREA, + // TDF_EXPANDED_BY_DEFAULT, TDF_VERIFICATION_FLAG_CHECKED, + // TDF_SHOW_PROGRESS_BAR, TDF_SHOW_MARQUEE_PROGRESS_BAR, + // TDF_CALLBACK_TIMER, TDF_POSITION_RELATIVE_TO_WINDOW, TDF_RTL_LAYOUT, + // TDF_NO_DEFAULT_RADIO_BUTTON, TDF_CAN_BE_MINIMIZED. + inline void CTaskDialog::SetOptions(TASKDIALOG_FLAGS flags) + { + assert (GetHwnd() == nullptr); + m_tc.dwFlags = flags; + } + + // Starts and stops the marquee display of the progress bar, and sets the + // speed of the marquee. + // Refer to TDM_SET_PROGRESS_BAR_MARQUEE in the Windows API documentation for more information. + inline void CTaskDialog::SetProgressBarMarquee(BOOL isEnabled /* = TRUE*/, + int marqueeSpeed /* = 0*/) const + { + assert(GetHwnd()); + WPARAM wparam = static_cast(isEnabled); + LPARAM lparam = static_cast(marqueeSpeed); + SendMessage(TDM_SET_PROGRESS_BAR_MARQUEE, wparam, lparam); + } + + // Sets the current position for a progress bar. + // Refer to TDM_SET_PROGRESS_BAR_POS in the Windows API documentation for more information. + inline void CTaskDialog::SetProgressBarPosition(int progressPos) const + { + assert(GetHwnd()); + WPARAM wparam = static_cast(progressPos); + SendMessage(TDM_SET_PROGRESS_BAR_POS, wparam, 0); + } + + // Sets the minimum and maximum values for the hosted progress bar. + // Refer to TDM_SET_PROGRESS_BAR_RANGE in the Windows API documentation for more information. + inline void CTaskDialog::SetProgressBarRange(int minRange, int maxRange) const + { + assert(GetHwnd()); + SendMessage(TDM_SET_PROGRESS_BAR_RANGE, 0, MAKELPARAM(minRange, maxRange)); + } + + // Sets the current state of the progress bar. Possible states are: + // PBST_NORMAL, PBST_PAUSE, PBST_ERROR. + // Refer to TDM_SET_PROGRESS_BAR_STATE in the Windows API documentation for more information. + inline void CTaskDialog::SetProgressBarState(int newState /* = PBST_NORMAL*/) const + { + assert(GetHwnd()); + WPARAM wparam = static_cast(newState); + SendMessage(TDM_SET_PROGRESS_BAR_STATE, wparam, 0); + } + + // Simulates a click on the verification checkbox of the task dialog, if it exists. + // Refer to TDM_CLICK_VERIFICATION in the Windows API documentation for more information. + inline void CTaskDialog::SetVerificationCheckbox(BOOL isChecked) const + { + assert(GetHwnd()); + WPARAM wparam = static_cast(isChecked); + LPARAM lparam = static_cast(isChecked); + SendMessage(TDM_CLICK_VERIFICATION, wparam, lparam); + } + + // Sets the text for the verification check box. + inline void CTaskDialog::SetVerificationCheckboxText(LPCWSTR verificationText) + { + assert (GetHwnd() == nullptr); + m_verificationText = FillString(verificationText); + m_tc.pszVerificationText = m_verificationText; + } + + // Sets the task dialog's window title. + inline void CTaskDialog::SetWindowTitle(LPCWSTR windowTitle) + { + assert (GetHwnd() == nullptr); + m_windowTitle = FillString(windowTitle); + m_tc.pszWindowTitle = m_windowTitle; + } + + // TaskDialogs direct their messages here. + inline HRESULT CALLBACK CTaskDialog::StaticTaskDialogProc(HWND wnd, + UINT notification, WPARAM wparam, LPARAM lparam, LONG_PTR) + { + CTaskDialog* t = static_cast(GetCWndPtr(wnd)); + if (t == nullptr) + { + // The CTaskDialog pointer wasn't found in the map, so add it now. + + // Retrieve the pointer to the TLS Data. + TLSData* pTLSData = GetApp()->GetTlsData(); + assert(pTLSData); + if (pTLSData) + { + // Retrieve pointer to CTaskDialog object from Thread Local Storage TLS. + t = static_cast(pTLSData->pWnd); + assert(t); + pTLSData->pWnd = nullptr; + + if (t != nullptr) + { + // Store the CTaskDialog pointer in the HWND map. + t->m_wnd = wnd; + t->AddToMap(); + } + } + } + + assert(t != nullptr); + if (t == nullptr) + { + // Got a message for a window that's not in the map. + return 0; + } + + return static_cast(t->TaskDialogProc(notification, wparam, lparam)); + + } // LRESULT CALLBACK StaticTaskDialogProc(...) + + // Provides default handling of task dialog's messages. + inline LRESULT CTaskDialog::TaskDialogProcDefault(UINT msg, WPARAM wparam, + LPARAM lparam) + { + int button = static_cast(wparam); + BOOL isClicked = static_cast(wparam); + LPCWSTR hyperLink = reinterpret_cast(lparam); + DWORD milliseconds = static_cast(wparam); + switch(msg) + { + case TDN_BUTTON_CLICKED: + return OnTDButtonClicked(button); + + case TDN_CREATED: + OnTDCreated(); + break; + case TDN_DESTROYED: + OnTDDestroyed(); + break; + case TDN_DIALOG_CONSTRUCTED: + OnTDConstructed(); + break; + case TDN_EXPANDO_BUTTON_CLICKED: + OnTDExpandButtonClicked(isClicked); + break; + case TDN_HELP: + OnTDHelp(); + break; + case TDN_HYPERLINK_CLICKED: + OnTDHyperlinkClicked(hyperLink); + break; + case TDN_NAVIGATED: + OnTDNavigatePage(); + break; + case TDN_RADIO_BUTTON_CLICKED: + OnTDRadioButtonClicked(button); + break; + case TDN_TIMER: + return OnTDTimer(milliseconds); + + case TDN_VERIFICATION_CLICKED: + OnTDVerificationCheckboxClicked(isClicked); + break; + } + + return S_OK; + } + + // Override this function modify how the task dialog's messages are handled. + inline LRESULT CTaskDialog::TaskDialogProc(UINT msg, WPARAM wparam, LPARAM lparam) + { + // A typical function might look like this: + + // switch (msg) + // { + // case MESSAGE1: // Some Windows API message + // OnMessage1(); // A user defined function + // break; // Also do default processing + // case MESSAGE2: + // OnMessage2(); + // return x; // Don't do default processing, but instead return + // // a value recommended by the Windows API documentation + // } + + // Always pass unhandled messages on to TaskDialogProcDefault + return TaskDialogProcDefault(msg, wparam, lparam); + } + + // Updates a text element on the TaskDialog after it is created. The size + // of the TaskDialog is not adjusted to accommodate the new text. + // Possible element values are: + // TDE_CONTENT, TDE_EXPANDED_INFORMATION, TDE_FOOTER, TDE_MAIN_INSTRUCTION. + // Refer to TDM_UPDATE_ELEMENT_TEXT in the Windows API documentation for more information. + inline void CTaskDialog::UpdateElementText(TASKDIALOG_ELEMENTS element, + LPCWSTR newText) const + { + assert(GetHwnd()); + WPARAM wparam = static_cast(element); + LPARAM lparam = reinterpret_cast(newText); + SendMessage(TDM_UPDATE_ELEMENT_TEXT, wparam, lparam); + } + + // Constructor for the nested TaskButton struct. + inline CTaskDialog::TaskButton::TaskButton(int id, LPCWSTR text) : buttonID(id) + { + if (IS_INTRESOURCE(text)) // support MAKEINTRESOURCE + { + UINT textID = static_cast(reinterpret_cast(text)); + buttonText.LoadString(textID); + } + else + buttonText = text; + } + +} + + +#endif // _WIN32XX_TASKDIALOG_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_textconv.h b/packages/media/cpp/packages/Win32xx/include/wxx_textconv.h new file mode 100644 index 00000000..3b6a495b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_textconv.h @@ -0,0 +1,282 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +////////////////////////////////////////////////// +// wxx_textconv.h +// Definitions of the CAtoA, CAtoW, CWtoA, CWtoW, +// CAtoBSTR and CWtoBSTR classes + +#ifndef _WIN32XX_TEXTCONV_H_ +#define _WIN32XX_TEXTCONV_H_ + +#include + +namespace Win32xx +{ + //////////////////////////////////////////////////////// + // Classes and functions (typedefs) for text conversions + // + // This section defines the following text conversions: + // AtoBSTR ANSI to BSTR + // AtoOLE ANSI to OLE + // AtoT ANSI to TCHAR + // AtoW ANSI to WCHAR + // OLEtoA OLE to ANSI + // OLEtoT OLE to TCHAR + // OLEtoW OLE to WCHAR + // TtoA TCHAR to ANSI + // TtoBSTR TCHAR to BSTR + // TtoOLE TCHAR to OLE + // TtoW TCHAR to WCHAR + // WtoA WCHAR to ANSI + // WtoBSTR WCHAR to BSTR + // WtoOLE WCHAR to OLE + // WtoT WCHAR to TCHAR + + // About different character and string types: + // ------------------------------------------ + // char (or CHAR) character types are ANSI (8 bits). + // wchar_t (or WCHAR) character types are Unicode (16 bits). + // TCHAR characters are Unicode if the _UNICODE macro is defined, otherwise they are ANSI. + // BSTR (Basic String) is a type of string used in Visual Basic and COM programming. + // OLE is the same as WCHAR. It is used in Visual Basic and COM programming. + + + // Forward declarations of our classes. They are defined later. + class CAtoA; + class CAtoW; + class CWtoA; + class CWtoW; + class CAtoBSTR; + class CWtoBSTR; + + // using declarations for the well known text conversions + using AtoW = CAtoW; + using WtoA = CWtoA; + using WtoBSTR = CWtoBSTR; + using AtoBSTR = CAtoBSTR; + using BSTRtoA = CWtoA; + using BSTRtoW = CWtoW; + +#ifdef UNICODE + using AtoT = CAtoW; + using TtoA = CWtoA; + using TtoW = CWtoW; + using WtoT = CWtoW; + using TtoBSTR = CWtoBSTR; + using BSTRtoT = BSTRtoW; +#else + using AtoT = CAtoA; + using TtoA = CAtoA; + using TtoW = CAtoW; + using WtoT = CWtoA; + using TtoBSTR = CAtoBSTR; + using BSTRtoT = BSTRtoA; +#endif + + using AtoOLE = AtoW; + using TtoOLE = TtoW; + using WtoOLE = CWtoW; + using OLEtoA = WtoA; + using OLEtoT = WtoT; + using OLEtoW = CWtoW; + + class CAtoW + { + public: + CAtoW(LPCSTR str, UINT codePage = CP_ACP, int charCount = -1); + ~CAtoW(); + operator LPCWSTR() { return m_str? &m_wideArray[0] : nullptr; } + operator LPOLESTR() { return m_str? reinterpret_cast(&m_wideArray[0]) : nullptr; } + LPCWSTR c_str() { return m_str ? &m_wideArray[0] : nullptr; } + + private: + CAtoW(const CAtoW&) = delete; + CAtoW& operator= (const CAtoW&) = delete; + std::vector m_wideArray; + LPCSTR m_str; + }; + + class CWtoA + { + public: + CWtoA(LPCWSTR str, UINT codePage = CP_ACP, int charCount = -1); + ~CWtoA(); + operator LPCSTR() { return m_str? &m_ansiArray[0] : nullptr; } + LPCSTR c_str() { return m_str ? &m_ansiArray[0] : nullptr; } + + private: + CWtoA(const CWtoA&) = delete; + CWtoA& operator= (const CWtoA&) = delete; + std::vector m_ansiArray; + LPCWSTR m_str; + }; + + class CWtoW + { + public: + CWtoW(LPCWSTR pWStr, UINT codePage = CP_ACP, int charCount = -1); + operator LPCWSTR() { return m_str; } + operator LPOLESTR() { return const_cast(m_str); } + LPCWSTR c_str() const { return m_str; } + + private: + CWtoW(const CWtoW&) = delete; + CWtoW& operator= (const CWtoW&) = delete; + + LPCWSTR m_str; + }; + + class CAtoA + { + public: + CAtoA(LPCSTR str, UINT codePage = CP_ACP, int charCount = -1); + operator LPCSTR() { return m_str; } + LPCSTR c_str() const { return m_str; } + + private: + CAtoA(const CAtoA&) = delete; + CAtoA& operator= (const CAtoA&) = delete; + + LPCSTR m_str; + }; + + class CWtoBSTR + { + public: + CWtoBSTR(LPCWSTR pWStr) { m_bstrString = ::SysAllocString(pWStr); } + ~CWtoBSTR() { ::SysFreeString(m_bstrString); } + operator BSTR() { return m_bstrString;} + + private: + CWtoBSTR(const CWtoBSTR&) = delete; + CWtoBSTR& operator= (const CWtoBSTR&) = delete; + BSTR m_bstrString; + }; + + class CAtoBSTR + { + public: + CAtoBSTR(LPCSTR str) { m_bstrString = ::SysAllocString(AtoW(str)); } + ~CAtoBSTR() { ::SysFreeString(m_bstrString); } + operator BSTR() { return m_bstrString;} + + private: + CAtoBSTR(const CAtoBSTR&) = delete; + CAtoBSTR& operator= (const CAtoBSTR&) = delete; + BSTR m_bstrString; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + inline CAtoW::CAtoW(LPCSTR str, UINT codePage /*= CP_ACP*/, int charCount /*= -1*/) : m_str(str) + { + // Resize the vector and assign null WCHAR to each element. + int charSize = static_cast(sizeof(CHAR)); + int charBytes = (charCount == -1) ? -1 : charSize * charCount; + int length = MultiByteToWideChar(codePage, 0, str, charBytes, nullptr, 0) + 1; + m_wideArray.assign(static_cast(length), L'\0'); + + // Fill our vector with the converted WCHAR array. + MultiByteToWideChar(codePage, 0, str, charBytes, &m_wideArray[0], length); + } + + inline CAtoW::~CAtoW() + { + // Clear the array. + std::fill(m_wideArray.begin(), m_wideArray.end(), L'\0'); + } + + // Usage: + // CWtoA ansiString(L"Some Text"); + // CWtoA utf8String(L"Some Text", CP_UTF8); + // + // or + // SetWindowTextA( WtoA(L"Some Text") ); The ANSI version of SetWindowText + inline CWtoA::CWtoA(LPCWSTR str, UINT codePage /*= CP_ACP*/, int charCount /*= -1*/) : m_str(str) + { + // Resize the vector and assign null char to each element + int charSize = static_cast(sizeof(WCHAR)); + int charBytes = (charCount == -1) ? -1 : charSize * charCount; + int length = WideCharToMultiByte(codePage, 0, str, charBytes, nullptr, 0, nullptr, nullptr) + 1; + m_ansiArray.assign(static_cast(length), '\0'); + + // Fill our vector with the converted char array + WideCharToMultiByte(codePage, 0, str, charCount, &m_ansiArray[0], length, nullptr, nullptr); + } + + inline CWtoA::~CWtoA() + { + // Clear the array. + std::fill(m_ansiArray.begin(), m_ansiArray.end(), '\0'); + } + + inline CWtoW::CWtoW(LPCWSTR str, UINT /*codePage = CP_ACP*/, int /*charCount = -1*/) : m_str(str) + { + } + + inline CAtoA::CAtoA(LPCSTR str, UINT /*codePage = CP_ACP*/, int /*charCount = -1*/) : m_str(str) + { + } + + + //////////////////// + // Global Functions. + // + + // Trace sends a string to the debug/output pane, or an external debugger. + inline void Trace(LPCSTR str) + { + OutputDebugString(AtoT(str)); + } + + // Trace sends a string to the debug/output pane, or an external debugger. + inline void Trace(LPCWSTR str) + { + OutputDebugString(WtoT(str)); + } + + +} // namespace Win32xx + +#endif // _WIN32XX_TEXTCONV_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_themes.h b/packages/media/cpp/packages/Win32xx/include/wxx_themes.h new file mode 100644 index 00000000..3d70999e --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_themes.h @@ -0,0 +1,133 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////// +// wxx_themes.h +// Declaration of the following structs: +// MenuTheme, ReBarTheme, StatusBarTheme and ToolBarTheme + + +#ifndef _WIN32XX_THEMES_H_ +#define _WIN32XX_THEMES_H_ + + +namespace Win32xx +{ + + ///////////////////////////////////////// + // Declarations of structures for themes. + // + + // Defines the theme colors for the MenuBar and popup menus. + // The popup menu colors are replaced by the Aero theme if available (Vista and above) + struct MenuTheme + { + BOOL UseThemes; // TRUE if themes are used + COLORREF clrHot1; // Color 1 for menu bar. Color of selected menu item + COLORREF clrHot2; // Color 2 for menu bar. Color of checkbox background + COLORREF clrPressed1; // Color 1 for pressed menu bar and side bar + COLORREF clrPressed2; // Color 2 for pressed menu bar and side bar + COLORREF clrOutline; // Color for border outline + COLORREF clrText; // Color for the menu bar text + }; + + + // Defines the theme colors and options for the ReBar + struct ReBarTheme + { + BOOL UseThemes; // TRUE if themes are used + COLORREF clrBkgnd1; // Color 1 for rebar background + COLORREF clrBkgnd2; // Color 2 for rebar background + COLORREF clrBand1; // Color 1 for rebar band background. Use 0 if not required + COLORREF clrBand2; // Color 2 for rebar band background. Use 0 if not required + BOOL FlatStyle; // Bands are rendered with flat rather than raised style + BOOL BandsLeft; // Position bands left on rearrange + BOOL LockMenuBand; // Lock MenuBar's band in dedicated top row, without gripper + BOOL RoundBorders; // Use rounded band borders + BOOL ShortBands; // Allows bands to be shorter than maximum available width + BOOL UseLines; // Displays horizontal lines between bands + }; + + + // Defines the theme colors and options for the StatusBar + struct StatusBarTheme + { + BOOL UseThemes; // TRUE if themes are used + COLORREF clrBkgnd1; // Color 1 for statusbar background + COLORREF clrBkgnd2; // Color 2 for statusbar background + COLORREF clrText; // Text Color + }; + + + // Defines the theme colors for the ToolBar + struct ToolBarTheme + { + BOOL UseThemes; // TRUE if themes are used + COLORREF clrHot1; // Color 1 for hot button + COLORREF clrHot2; // Color 2 for hot button + COLORREF clrPressed1; // Color 1 for pressed button + COLORREF clrPressed2; // Color 2 for pressed button + COLORREF clrOutline; // Color for border outline + }; + + // Returns TRUE if Aero themes are being used. + inline BOOL IsAeroThemed() + { + BOOL isAeroThemed = FALSE; + HMODULE module = ::GetModuleHandle(_T("uxtheme.dll")); + if (module != nullptr) + { + // Declare pointers to IsCompositionActive function. + FARPROC pIsCompositionActive = ::GetProcAddress(module, "IsCompositionActive"); + + if (pIsCompositionActive) + { + if (pIsCompositionActive()) + { + isAeroThemed = TRUE; + } + } + } + + return isAeroThemed; + } + +} // namespace Win32xx + +#endif // _WIN32XX_THEMES_H_ + diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_thread.h b/packages/media/cpp/packages/Win32xx/include/wxx_thread.h new file mode 100644 index 00000000..45d2e077 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_thread.h @@ -0,0 +1,296 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +#ifndef _WIN32XX_THREAD_H_ +#define _WIN32XX_THREAD_H_ + +namespace Win32xx +{ + using PTHREADPROC = UINT (WINAPI*)(LPVOID); + + //////////////////////////////////////////////////// + // CThreadT is the class template used by CWinThread + // and CWorkThread. + template + class CThreadT : public T + { + public: + CThreadT(); + CThreadT(PTHREADPROC pThreadProc, LPVOID pParam); + virtual ~CThreadT() override; + + // Operations + HANDLE CreateThread(unsigned initflag = 0, unsigned stack_size = 0, + LPSECURITY_ATTRIBUTES pSecurityAttributes = nullptr); + HANDLE GetThread() const; + UINT GetThreadID() const; + int GetThreadPriority() const; + BOOL IsRunning() const { return (WaitForSingleObject(m_thread, 0) == WAIT_TIMEOUT); } + BOOL PostThreadMessage(UINT message, WPARAM wparam, LPARAM lparam) const; + DWORD ResumeThread() const; + BOOL SetThreadPriority(int priority) const; + DWORD SuspendThread() const; + operator HANDLE () const { return GetThread(); } + + private: + CThreadT(const CThreadT&) = delete; + CThreadT& operator=(const CThreadT&) = delete; + + PTHREADPROC m_pThreadProc; // Thread callback function. + LPVOID m_pThreadParams; // Thread parameter. + HANDLE m_thread; // Handle of this thread. + UINT m_threadID; // ID of this thread. + }; + + using WorkThread = CThreadT; + using WinThread = CThreadT; + + + ////////////////////////////////////////////////////////////// + // CWorkThread manages a worker thread. Use the constructor to + // specify the thread's callback procedure and an optional + // parameter. + class CWorkThread : public WorkThread + { + public: + CWorkThread(PTHREADPROC pThreadProc, LPVOID pParam) + : WorkThread(pThreadProc, pParam) {} + virtual ~CWorkThread() override = default; + + private: + CWorkThread(const CWorkThread&) = delete; + CWorkThread& operator=(const CWorkThread&) = delete; + }; + + + ///////////////////////////////////////////////////////////// + // CWinThread manages a thread that is capable of supporting + // windows. It runs a message loop. + class CWinThread : public WinThread + { + public: + CWinThread() : WinThread(StaticThreadProc, this) {} + virtual ~CWinThread() override; + + private: + CWinThread(const CWinThread&) = delete; + CWinThread& operator=(const CWinThread&) = delete; + + static UINT WINAPI StaticThreadProc(LPVOID pCThread); + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + /////////////////////////////////////////////// + // Definitions for the CThreadT class template. + // + + // CThreadT constructor. + template + inline CThreadT::CThreadT() : m_pThreadProc(0), m_pThreadParams(0), + m_thread(0), m_threadID(0) + { + } + + // CThreadT constructor. + template + inline CThreadT::CThreadT(PTHREADPROC pThreadProc, LPVOID pParam) : + m_pThreadProc(0), m_pThreadParams(0), m_thread(0), m_threadID(0) + { + m_pThreadProc = pThreadProc; + m_pThreadParams = pParam; + } + + // CThreadT destructor. + template + inline CThreadT::~CThreadT() + { + if (m_thread) + { + // A thread's state is set to signalled when the thread terminates. + // If your thread is still running at this point, you have a bug. + if (IsRunning()) + { + TRACE("*** Warning *** Ending CWinThread before ending its thread\n"); + } + + // Close the thread's handle. + ::CloseHandle(m_thread); + } + } + + // Creates a new thread + // Valid argument values: + // initflag Either CREATE_SUSPENDED or 0. + // stack_size Either the stack size or 0. + // pSecurityAttributes Either a pointer to SECURITY_ATTRIBUTES or 0. + // Refer to CreateThread in the Windows API documentation for more information. + template + inline HANDLE CThreadT::CreateThread(unsigned initflag /* = 0*/, + unsigned stack_size /* = 0*/, + LPSECURITY_ATTRIBUTES pSecurityAttributes /* = nullptr*/) + { + // Reusing the CWinThread. + if (m_thread) + { + assert(!IsRunning()); + ::CloseHandle(m_thread); + } + + m_thread = reinterpret_cast(::_beginthreadex( + pSecurityAttributes, stack_size, m_pThreadProc, + m_pThreadParams, initflag, &m_threadID)); + + if (m_thread == nullptr) + throw CWinException(GetApp()->MsgAppThread()); + + return m_thread; + } + + // Retrieves the handle of this thread. + template + inline HANDLE CThreadT::GetThread() const + { + return m_thread; + } + + // Retrieves the thread's ID. + template + inline UINT CThreadT::GetThreadID() const + { + assert(m_thread); + return m_threadID; + } + + // Retrieves this thread's priority. + // Refer to GetThreadPriority in the Windows API documentation for more information. + template + inline int CThreadT::GetThreadPriority() const + { + assert(m_thread); + return ::GetThreadPriority(m_thread); + } + + // Posts a message to the thread. The message will reach the MessageLoop, but + // will not call a CWnd's WndProc. + // Refer to PostThreadMessage in the Windows API documentation for more information. + template + inline BOOL CThreadT::PostThreadMessage(UINT msg, WPARAM wparam, LPARAM lparam) const + { + assert(m_thread); + return ::PostThreadMessage(GetThreadID(), msg, wparam, lparam); + } + + // Resumes a thread that has been suspended, or created with the CREATE_SUSPENDED flag. + // Refer to ResumeThread in the Windows API documentation for more information. + template + inline DWORD CThreadT::ResumeThread() const + { + assert(m_thread); + return ::ResumeThread(m_thread); + } + + // Sets the priority of this thread. The priority parameter can be: + // THREAD_PRIORITY_IDLE, THREAD_PRIORITY_LOWEST, THREAD_PRIORITY_BELOW_NORMAL, + // THREAD_PRIORITY_NORMAL, THREAD_PRIORITY_ABOVE_NORMAL, THREAD_PRIORITY_HIGHEST, + // THREAD_PRIORITY_TIME_CRITICAL or other values permitted by the + // SetThreadPriority Windows API function. + // Refer to SetThreadPriority in the Windows API documentation for more information. + template + inline BOOL CThreadT::SetThreadPriority(int priority) const + { + assert(m_thread); + return ::SetThreadPriority(m_thread, priority); + } + + // Suspends this thread. Use ResumeThread to resume the thread. + // Refer to SuspendThread in the Windows API documentation for more information. + template + inline DWORD CThreadT::SuspendThread() const + { + assert(m_thread); + return ::SuspendThread(m_thread); + } + + + //////////////////////////////////////// + // Definitions for the CWinThread class. + // + + inline CWinThread::~CWinThread() + { + if (GetThread() != nullptr) + { + // Post a WM_QUIT to safely end the thread. + PostThreadMessage(WM_QUIT, 0, 0); + } + + // Wait up to 1 second for the thread to end. + ::WaitForSingleObject(*this, 1000); + } + + // When the GUI thread starts, it runs this function. + inline UINT WINAPI CWinThread::StaticThreadProc(LPVOID pCThread) + { + // Get the pointer for this CWinThread object. + CWinThread* pThread = static_cast(pCThread); + assert(pThread != nullptr); + + if (pThread != nullptr) + { + // Set the thread's TLS Data. + GetApp()->SetTlsData(); + + // Run the thread's message loop if InitInstance returns TRUE. + if (pThread->InitInstance()) + { + return static_cast(pThread->MessageLoop()); + } + } + + return 0; + } + +} + +#endif // _WIN32XX_THREAD_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_time.h b/packages/media/cpp/packages/Win32xx/include/wxx_time.h new file mode 100644 index 00000000..d3e16941 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_time.h @@ -0,0 +1,973 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////// +// Acknowledgement: +// +// The original author of CTime and CTimeSpan is: +// +// Robert C. Tausworthe +// email: robert.c.tausworthe@ieee.org +// +//////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////// +// +// Declaration of the CTime class. +// +//////////////////////////////////////////////////////// + +#ifndef _WIN32XX_TIME_H_ +#define _WIN32XX_TIME_H_ + +#include "wxx_wincore.h" +#include + + +// The CTime class is based internally on the time_t data type, which is +// measured in seconds past the January 1, 00:00:00 1970 UTC epoch. Thus, +// any given time_t instant is strictly a UTC epoch, which may then be +// rendered, using standard C library functions, as either a UTC or local +// time. Local instants may further appear as standard or daylight times. +// Thus, the base epoch on a system in the PST zone will be displayed as +// December 31, 1969 16:00:00. Any attempt to construct or evaluate a date +// before this epoch will assert or be in error. Even though the time_t +// type is implemented (in MinGW, anyway) as a signed integer type, +// negative values are not allowed. + +// On systems where time_t is defined as a 32-bit integer, there is an +// upper date limit of January 18, 19:14:07, 2038. This issue can affect +// code compiled with Visual Studio 2003. Visual Studio 2005 and later +// defines time_t as a 64 bit integer. + +// Windows also has other time types that also interface with the CTime +// type. These are FILETIME, SYSTEMTIME, and MS-DOS date and time, each +// of which are described in the MSDN API documentation. Basically: + +// FILETIME is a structure containing a 64-bit value representing the +// number of 100-nanosecond intervals since January 1, 1601 UTC. + +// SYSTEMTIME is a structure representing a date and time using individual +// values for the month, day, year, weekday, hour, minute, second, and +// millisecond. This is not useful in itself, but must be translated into +// a FILETIME or time_t. + +// MS-DOS date and time are two 16-bit words packed with day, month, year +// and second, minute, hour fields. The format may be found in the MSDN +// Library article on DosDateTimeToFileTime(). + + +namespace Win32xx +{ + // Forward declaration. + class CTimeSpan; + + + //////////////////////////////////////////////////////// + // The CTime class represents an absolute time and date. + class CTime + { + public: + // Constructors. + CTime(); + CTime(const CTime& t); + CTime(time_t t); + CTime(tm atm); + CTime(int year, int month, int day, int hour, int min, int sec, + int isDST = -1); + CTime(WORD dosDate, WORD dosTime, int isDST = -1); + CTime(SYSTEMTIME st, int isDST = -1); + CTime(FILETIME ft, int isDST = -1); + + // CString conversion. + CString Format(LPCTSTR format) const; + CString Format(UINT formatID) const; + CString FormatGmt(LPCTSTR format) const; + CString FormatGmt(UINT formatID) const; + + // Method members. + bool GetAsFileTime(FILETIME& ft) const; + bool GetAsSystemTime(SYSTEMTIME& st) const; + int GetDay(bool local = true) const; + int GetDayOfWeek(bool local = true) const; + int GetDayOfYear(bool local = true) const; + tm* GetGmtTm(tm* ptm) const; + int GetHour(bool local = true) const; + tm* GetLocalTm(tm* ptm) const; + int GetMinute(bool local = true) const; + int GetMonth(bool local = true) const; + int GetSecond(bool local = true) const; + int GetYear(bool local = true) const; + time_t GetTime() const; + + // Assignment operators. + CTime& operator=(const CTime& time); + CTime& operator=(time_t t); + + // Computational operators. + CTime& operator+=(const CTimeSpan& ts); + CTime& operator-=(const CTimeSpan& ts); + const CTimeSpan operator-(const CTime& time) const; + const CTime operator-(const CTimeSpan& ts) const; + const CTime operator+(const CTimeSpan& ts) const; + bool operator==(const CTime& time) const; + bool operator!=(const CTime& time) const; + bool operator<(const CTime& time) const; + bool operator>(const CTime& time) const; + bool operator<=(const CTime& time) const; + bool operator>=(const CTime& time) const; + + operator time_t() const { return m_time; } + + // Static methods + static CTime GetCurrentTime(); + + private: + // Private data members. + time_t m_time; + }; + + + //////////////////////////////////////////////////////////// + // The CTimeSpan class defines the data type for differences + // between two CTime values, measured in seconds of time. + class CTimeSpan + { + // Global friends. + friend class CTime; + + public: + // Constructors. + CTimeSpan(); + CTimeSpan(time_t ts); + CTimeSpan(long days, int hours, int mins, int secs); + CTimeSpan(const CTimeSpan& ts); + + // CString conversion. + CString Format(LPCTSTR format) const; + CString Format(UINT formatID) const; + + // Methods to extract items. + LONGLONG GetDays() const; + LONGLONG GetTotalHours() const; + int GetHours() const; + LONGLONG GetTotalMinutes() const; + int GetMinutes() const; + LONGLONG GetTotalSeconds() const; + int GetSeconds() const; + + // Assignment operators. + CTimeSpan& operator=(const CTimeSpan& ts); + CTimeSpan& operator=(time_t t); + + // Computational operators. + const CTimeSpan operator-() const; + const CTimeSpan operator-(CTimeSpan& ts) const; + const CTimeSpan operator+(CTimeSpan& ts) const; + CTimeSpan& operator+=(CTimeSpan& ts); + CTimeSpan& operator-=(CTimeSpan& ts); + bool operator==(const CTimeSpan& ts) const; + bool operator!=(const CTimeSpan& ts) const; + bool operator<(const CTimeSpan& ts) const; + bool operator>(const CTimeSpan& ts) const; + bool operator<=(const CTimeSpan& ts) const; + bool operator>=(const CTimeSpan& ts) const; + + operator time_t() const { return m_timespan; } + + private: + // Private data members. + time_t m_timespan; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + ///////////////////////////////////////////////// + // Global functions within the Win32xx namespace. + // + + // Calls either ::gmtime or ::gmtime_s, depending on the compiler. + // The value of atm is updated and its pointer is returned if successful. + // Returns nullptr on failure. + inline tm* GMTime(tm& atm, time_t t) + { + tm* ptm = &atm; + +#if (defined(__BORLANDC__) && !defined(__MINGW64__)) + // For older Embarcadero compilers. + if (::gmtime_s(&t, &atm) == 0) + ptm = nullptr; +#else + if (::gmtime_s(&atm, &t) != 0) + ptm = nullptr; +#endif + + if (ptm == nullptr) + throw CNotSupportedException(GetApp()->MsgTimeValid()); + + // Note: ptm points to atm (not a local variable) or nullptr. + return ptm; + } + + // Calls either ::localtime or ::localtime_s depending on the compiler. + // The value of atm is updated and its pointer is returned if successful. + // Returns nullptr on failure. + inline tm* LocalTime(tm& atm, time_t t) + { + tm* ptm = &atm; + +#if (defined(__BORLANDC__) && !defined(__MINGW64__)) + // For older Embarcadero compilers. + if (::localtime_s(&t, &atm) == 0) + ptm = nullptr; +#else + if (::localtime_s(&atm, &t) != 0) + ptm = nullptr; +#endif + + if (ptm == nullptr) + throw CNotSupportedException(GetApp()->MsgTimeValid()); + + // Note: ptm points to atm (not a local variable) or nullptr. + return ptm; + } + + // Returns the time_t t corresponding to the date given in atm as a UTC time. + inline time_t UTCtime(tm* atm) + { + // Compute the local time from atm. + assert(atm != nullptr); + time_t t0 = ::mktime(atm); + assert(t0 != -1); + tm tm0; + tm* ptm0 = GMTime(tm0, t0); + + time_t t1 = ::mktime(ptm0); + assert(t1 != -1); + time_t zt = t0 - t1; + t0 += zt; + + assert(GMTime(tm0, t0)); + return t0; + } + + // Writes the time t into the archive file. + // Throw an exception on failure. + inline CArchive& operator<<(CArchive& ar, CTime& t) + { + ar.Write(&t, sizeof(t)); + return ar; + } + + // Reads a CTime from the archive and stores it in t. + // Throws an exception on failure. + inline CArchive& operator>>(CArchive& ar, CTime& t) + { + ar.Read(&t, sizeof(t)); + return ar; + } + + // Writes the time span object ts into the archive file. + // Throws an exception if an error occurs. + inline CArchive& operator<<(CArchive& ar, CTimeSpan& ts) + { + ar.Write(&ts, sizeof(ts)); + return ar; + } + + // Reads a CTimeSpan object from the archive and store it in ts. + // Throws an exception if an error occurs. + inline CArchive& operator>>(CArchive& ar, CTimeSpan& ts) + { + ar.Read(&ts, sizeof(ts)); + return ar; + } + + + /////////////////////////////////// + // Definitions for the CTime class. + // + + // Constructs an CTime object initialized to the Jan 1, 1970 00:00:00 epoch. + inline CTime::CTime() : m_time(0) + { + } + + // Constructs a CTime object from another (valid) CTime object t. + inline CTime::CTime(const CTime& t) + { + m_time = t.m_time; + } + + // Constructs a CTime object from the time_t value t, or assert if t is invalid. + inline CTime::CTime(time_t t) + { + tm atm; + VERIFY(GMTime(atm, t)); + m_time = t; + } + + // Constructs a CTime object from the time_tm atm, or assert if atm is invalid. + inline CTime::CTime(tm atm) + { + // Compute the object time_t. + m_time = ::mktime(&atm); + + // Check for acceptable range. + assert(m_time != -1); + } + + // Constructs a CTime object from local time elements. Each element is + // constrained to lie within the following UTC ranges: + // year 1970-2038 (on 32-bit systems) + // month 1-12 + // day 1-31 + // hour, min, sec no constraint + inline CTime::CTime(int year, int month, int day, int hour, int min, + int sec, int isDST /* = -1*/) + { + // Validate parameters w.r.t. ranges. + assert(1 <= day && day <= 31); + assert(1 <= month && month <= 12); + assert(year >= 1969); // Last few hours of 1969 might be a valid local time. + + // Fill out a time_tm with the calendar date. + tm atm = {sec, min, hour, day, month - 1, year - 1900, 0, 0, isDST}; + + // Compute the object time_t. + m_time = ::mktime(&atm); + assert(m_time != -1); + } + + // Constructs a CTime object from the MS-DOS dosDate and dosTime values. + inline CTime::CTime(WORD dosDate, WORD dosTime, int isDST /* = -1 */) + { + FILETIME ft; + VERIFY( ::DosDateTimeToFileTime(dosDate, dosTime, &ft) ); + CTime t(ft, isDST); + m_time = t.m_time; + } + + // Constructs a CTime object from a SYSTEMTIME structure st. + inline CTime::CTime(SYSTEMTIME st, int isDST /* = -1 */) + { + CTime t(st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, + st.wSecond, isDST); // Asserts if invalid. + + m_time = t.m_time; + } + + // Constructs a CTime object from a (UTC) FILETIME structure ft. + inline CTime::CTime(FILETIME ft, int isDST /* = -1 */) + { + // Convert ft (a UTC time) to local time. + FILETIME localTime; + VERIFY( ::FileTimeToLocalFileTime(&ft, &localTime) ); + + // Convert localTime to a SYSTEMTIME structure. + SYSTEMTIME st; + VERIFY( ::FileTimeToSystemTime(&localTime, &st) ); + + // Convert the system time to a CTime. + CTime t(st, isDST); // Asserts if invalid. + m_time = t.m_time; + } + + // Returns a CString that contains formatted time. The format parameter + // is a formatting string similar to the printf formatting string. + // The valid format directives are + // %D - number of days + // %H - hour (0-23) + // %M - minute (0-59) + // %S - seconds (0-59) + inline CString CTime::Format(LPCTSTR format) const + { + tm atm; + tm* ptm = GetLocalTm(&atm); + CString formatString; + + assert(ptm != nullptr); + if (ptm != nullptr) + { + const size_t bufferSize = 128; + VERIFY((::_tcsftime(formatString.GetBuffer(bufferSize), bufferSize, + format, &atm)) != 0); + + formatString.ReleaseBuffer(); + } + + return formatString; + } + + // Returns a CString that contains formatted time. The FormatID parameter + // specifies a resource containing the formatting string which is similar + // to the printf formatting string. The valid format directives are + // %D - number of days + // %H - hour (0-23) + // %M - minute (0-59) + // %S - seconds (0-59) + inline CString CTime::Format(UINT formatID) const + { + CString strFormat; + strFormat.LoadString(formatID); + return Format(strFormat); + } + + // Returns a CString that contains formatted time as a UTC time. The format + // parameter is a formatting string similar to the printf formatting string. + inline CString CTime::FormatGmt(LPCTSTR format) const + { + CString fmt0 = format; + fmt0.Replace(_T("%Z"), _T("Coordinated Universal Time")); + fmt0.Replace(_T("%z"), _T("UTC")); + + tm atm; + tm* ptm = GetGmtTm(&atm); + CString formatString; + + assert(ptm != nullptr); + if (ptm != nullptr) + { + const size_t bufferSize = 128; + VERIFY(::_tcsftime(formatString.GetBuffer(bufferSize), bufferSize, + fmt0.c_str(), ptm) != 0); + + formatString.ReleaseBuffer(); + } + + return formatString; + } + + // Returns a CString that contains formatted time as a UTC time. The + // formatID parameter specifies a resource containing the formatting string + // which is similar to the printf formatting string. + inline CString CTime::FormatGmt(UINT formatID) const + { + CString strFormat; + strFormat.LoadString(formatID); + return FormatGmt(strFormat); + } + + // Converts this CTime object into a FILETIME structure and stores it in + // the specified variable. Returns true if successful. + inline bool CTime::GetAsFileTime(FILETIME& ft) const + { + bool rval = false; + tm atm; + tm* ptm = GetGmtTm(&atm); + assert(ptm != nullptr); + + if (ptm) + { + SYSTEMTIME st = {static_cast(1900 + ptm->tm_year), + static_cast(1 + ptm->tm_mon), static_cast(ptm->tm_wday), + static_cast(ptm->tm_mday), static_cast(ptm->tm_hour), + static_cast(ptm->tm_min), static_cast(ptm->tm_sec), 0}; + SystemTimeToFileTime(&st, &ft); + rval = true; + } + + return rval; + } + + // Converts this CTime object into a SYSTEMTIME structure and stores it + // in the specified variable. Returns true if successful. + inline bool CTime::GetAsSystemTime(SYSTEMTIME& st) const + { + bool rval = false; + tm atm; + tm* ptm = GetLocalTm(&atm); + assert(ptm != nullptr); + + if (ptm) + { + st.wYear = static_cast(1900 + ptm->tm_year); + st.wMonth = static_cast(1 + ptm->tm_mon); + st.wDayOfWeek = static_cast(ptm->tm_wday); + st.wDay = static_cast(ptm->tm_mday); + st.wHour = static_cast(ptm->tm_hour); + st.wMinute = static_cast(ptm->tm_min); + st.wSecond = static_cast(ptm->tm_sec); + st.wMilliseconds = 0; + rval = true; + } + + return rval; + } + + // Returns a pointer to a tm struct that contains a decomposition of the + // CTime object expressed in UTC. Returns nullptr on failure. The supplied + // ptm cannot be nullptr. + inline tm* CTime::GetGmtTm(tm* ptm) const + { + assert (ptm != nullptr); // nullptr argument not supported. + + ptm = GMTime(*ptm, m_time); + return ptm; + } + + // Returns a pointer to a tm struct that contains a decomposition of the + // CTime object expressed in the local time base. Returns nullptr on failure. + // The supplied ptm cannot be nullptr. + inline tm* CTime::GetLocalTm(tm* ptm) const + { + assert(ptm != nullptr); // nullptr argument not supported. + + ptm = LocalTime(*ptm, m_time); + return ptm; + } + + // Returns the time represented by this CTime object as a time_t value. + inline time_t CTime::GetTime() const + { + return m_time; + } + + // Returns the year represented by this CTime object, local (true) or UTC (false). + inline int CTime::GetYear(bool local /* = true */) const + { + tm atm; + tm* ptm = (local ? GetLocalTm(&atm) : GetGmtTm(&atm)); + return 1900 + ptm->tm_year; + } + + // Returns the month of the year represented by this CTime object in the + // range 1 through 12, local (true) or UTC (false). + inline int CTime::GetMonth(bool local /* = true */) const + { + tm atm; + tm* ptm = (local ? GetLocalTm(&atm) : GetGmtTm(&atm)); + return ptm->tm_mon + 1; + } + + // Returns the day of the month represented by this CTime object in the + // range 1 through 31, local (true) or UTC (false). + inline int CTime::GetDay(bool local /* = true */) const + { + tm atm; + tm* ptm = (local ? GetLocalTm(&atm) : GetGmtTm(&atm)); + return ptm->tm_mday ; + } + + // Returns the hour of the day represented by this CTime object in the + // range 0 through 23, local (true) or UTC (false). + inline int CTime::GetHour(bool local /* = true */) const + { + tm atm; + tm* ptm = (local ? GetLocalTm(&atm) : GetGmtTm(&atm)); + return ptm->tm_hour; + } + + // Returns the minute of the hour represented by this CTime object in the + // range 0 through 59, local (true) or UTC (false). + inline int CTime::GetMinute(bool local /* = true */) const + { + tm atm; + tm* ptm = (local ? GetLocalTm(&atm) : GetGmtTm(&atm)); + return ptm->tm_min; + } + + // Returns the second of the minute represented by this CTime object in the + // range 0 through 59, local (true) or UTC (false). + inline int CTime::GetSecond(bool local /* = true */) const + { + tm atm; + tm* ptm = (local ? GetLocalTm(&atm) : GetGmtTm(&atm)); + return ptm->tm_sec; + } + + // Returns the day of the week represented by this CTime object in the + // range 1 through 7, local (true) or UTC (false). + inline int CTime::GetDayOfWeek(bool local /* = true */) const + { + tm atm; + tm* ptm = (local ? GetLocalTm(&atm) : GetGmtTm(&atm)); + return ptm->tm_wday + 1; + } + + // Returns the day of the year represented by this CTime object in the + // range 1 to 366, local (true) or UTC (false). + inline int CTime::GetDayOfYear(bool local /* = true */) const + { + tm atm; + tm* ptm = (local ? GetLocalTm(&atm) : GetGmtTm(&atm)); + return ptm->tm_yday + 1; + } + + // Assigns the specified value to this CTime object. + inline CTime& CTime::operator=(const CTime& t) + { + // Self assignment is safe. + m_time = t.m_time; + return *this; + } + + // Assigns the time_t value to this CTime object. + inline CTime& CTime::operator=(time_t t) + { + // Self assignment is safe. + tm atm; + m_time = t; + VERIFY(GMTime(atm, m_time)); // Verify m_time is valid. + // Self assignment is safe. + + return *this; + } + + // Returns the time span between the specified time and this CTime object. + inline const CTimeSpan CTime::operator-(const CTime& time) const + { + return CTimeSpan(m_time - time.m_time); + } + + // Returns the subtraction the specified time span from this CTime object. + inline const CTime CTime::operator-(const CTimeSpan& ts) const + { + return CTime(m_time - ts.m_timespan); + } + + // Returns the addition of the specified time span to this CTime object. + inline const CTime CTime::operator+(const CTimeSpan& ts) const + { + return CTime(m_time + ts.m_timespan); + } + + // Increments this CTime object by the specified time span. + inline CTime& CTime::operator+=(const CTimeSpan& ts) + { + m_time += ts.m_timespan; + tm atm; + VERIFY(GMTime(atm, m_time)); // Verify m_time is valid. + return *this; + } + + // Decrements this CTime object by the specified time span. + inline CTime& CTime::operator-=(const CTimeSpan& ts) + { + m_time -= ts.m_timespan; + tm atm; + VERIFY(GMTime(atm, m_time)); // Verify m_time is valid. + return *this; + } + + // Returns true if the times represented by this CTime object and the + // specified CTime are equal. + inline bool CTime::operator==(const CTime& t) const + { + return m_time == t.m_time; + } + + // Returns true if the times represented by this CTime object and the + // specified CTime are not equal. + inline bool CTime::operator!=(const CTime& t) const + { + return m_time != t.m_time; + } + + // Returns true if the time represented by this CTime object is less + // than the one represented by the specified CTime. + inline bool CTime::operator<(const CTime& t) const + { + return m_time < t.m_time; + } + + // Returns true if the time represented by this CTime object is greater + // than the one represented by the specified CTime. + inline bool CTime::operator>(const CTime& t) const + { + return m_time > t.m_time; + } + + // Returns true if the time represented by this CTime object is less + // than or equal to the one represented by the specified CTime. + inline bool CTime::operator<=(const CTime& time) const + { + return m_time <= time.m_time; + } + + // Returns true if the time represented by this CTime object is greater + // than or equal to the one represented by the specified CTime. + inline bool CTime::operator>=(const CTime& time) const + { + return m_time >= time.m_time; + } + + // Static function. Returns a CTime object that represents the current time. + inline CTime CTime::GetCurrentTime() + { + return CTime(::time(nullptr)); + } + + + /////////////////////////////////////// + // Definitions for the CTimeSpan class. + // + + inline CTimeSpan::CTimeSpan() + { + m_timespan = 0; + } + + inline CTimeSpan::CTimeSpan(time_t ts) + { + m_timespan = ts; + } + + // Contructs a CTimeSpan. Valid parameter ranges: + // lDays 0-24,855 (approximately) + // nHours 0-23 + // nMins 0-59 + // nSecs 0-59 + inline CTimeSpan::CTimeSpan(long days, int hours, int mins, int secs) + { + time_t sec_per_day = 86400; + time_t sec_per_hour = 3600; + time_t sec_per_min = 60; + m_timespan = days * sec_per_day + hours * sec_per_hour + + mins * sec_per_min + secs; + } + + inline CTimeSpan::CTimeSpan(const CTimeSpan& ts) + { + m_timespan = ts.m_timespan; + } + + // Returns a rendering of this CTimeSpan object in CString form using the + // format as the template. The valid format directives are + // %D - number of days + // %H - hour (0-23) + // %M - minute (0-59) + // %S - seconds (0-59) + inline CString CTimeSpan::Format(LPCTSTR format) const + { + CString fmt0 = format; + CString insert; + + while (fmt0.Find(_T("%D")) != -1) // number of days + { + insert.Format(_T("%ld"), GetDays()); + fmt0.Replace(_T("%D"), insert); + } + while (fmt0.Find(_T("%H")) != -1) // hours (00 - 23) + { + insert.Format(_T("%02d"), GetHours()); + fmt0.Replace(_T("%H"), insert); + } + while (fmt0.Find(_T("%M")) != -1) // minutes (00 - 59) + { + insert.Format(_T("%02d"), GetMinutes()); + fmt0.Replace(_T("%M"), insert); + } + while (fmt0.Find(_T("%S")) != -1) // seconds (00 - 59) + { + insert.Format(_T("%02d"), GetSeconds()); + fmt0.Replace(_T("%S"), insert); + } + return fmt0; + } + + // Returns a rendering of this CTimeSpan object in CString form using the + // string resource having the formatID identifier as the template. The + // valid format directives are + // %D - number of days + // %H - hour (0-23) + // %M - minute (0-59) + // %S - seconds (0-59) + inline CString CTimeSpan::Format(UINT formatID) const + { + CString strFormat; + VERIFY(strFormat.LoadString(formatID)); + return Format(strFormat); + } + + // Returns the number of complete days in this CTimeSpan. + inline LONGLONG CTimeSpan::GetDays() const + { + int sec_per_day = 86400; + return m_timespan / sec_per_day; + } + + // Returns the total number of complete hours in this CTimeSpan. + inline LONGLONG CTimeSpan::GetTotalHours() const + { + int sec_per_hour = 3600; + return m_timespan / sec_per_hour; + } + + // Returns the total number of complete minutes in this CTimeSpan. + inline LONGLONG CTimeSpan::GetTotalMinutes() const + { + int sec_per_min = 60; + return m_timespan / sec_per_min; + } + + // Returns the total number of complete seconds in this CTimeSpan. + inline LONGLONG CTimeSpan::GetTotalSeconds() const + { + return m_timespan; + } + + // Return the number of hours in the day component of this time + // span (-23 through 23). + inline int CTimeSpan::GetHours() const + { + int sec_per_hour = 3600; + int hours_per_day = 24; + return static_cast((m_timespan / sec_per_hour) % hours_per_day); + } + + // Returns the number of minutes in the hour component of this time + // span (-59 through 59). + inline int CTimeSpan::GetMinutes() const + { + int sec_per_min = 60; + return static_cast((m_timespan / sec_per_min) % sec_per_min); + } + + // Returns the number of seconds in the minute component of this time + // span (-59 through 59). + inline int CTimeSpan::GetSeconds() const + { + int sec_per_min = 60; + return static_cast(m_timespan % sec_per_min); + } + + // Assigns the specified value to this CTimeSpan object. + inline CTimeSpan& CTimeSpan::operator=(const CTimeSpan& ts) + { + // Self assignment is safe. + m_timespan = ts.m_timespan; + return *this; + } + + // Assigns the specified value to the CTimeSpan object. + inline CTimeSpan& CTimeSpan::operator=(time_t t) + { + // Self assignment is safe. + tm atm; + m_timespan = t; + VERIFY(GMTime(atm, m_timespan)); // Verify m_timespan is valid. + return *this; + } + + // Returns the negated value of this CTimeSpan object. + inline const CTimeSpan CTimeSpan::operator-() const + { + return CTimeSpan(-m_timespan); + } + + // Returns the result of subtracting the specified value + // from this CTimeSpan object. + inline const CTimeSpan CTimeSpan::operator-(CTimeSpan& ts) const + { + return CTimeSpan(m_timespan - ts.m_timespan); + } + + // Returns the result of adding the specified value to this + // CTimeSpan object. + inline const CTimeSpan CTimeSpan::operator+(CTimeSpan& ts) const + { + return CTimeSpan(m_timespan + ts.m_timespan); + } + + // Increases this CTimeObject object by the specified value. + inline CTimeSpan& CTimeSpan::operator+=(CTimeSpan& ts) + { + m_timespan += ts.m_timespan; + tm atm; + VERIFY(GMTime(atm, m_timespan)); // Verify m_timespan is valid. + return *this; + } + + // Decreases this CTimeSpan object by the specified value. + inline CTimeSpan& CTimeSpan::operator-=(CTimeSpan& ts) + { + m_timespan -= ts.m_timespan; + tm atm; + VERIFY(GMTime(atm, m_timespan)); // Verify m_timespan is valid. + return *this; + } + + // Returns true specified value equals this CTimeSpan object. + inline bool CTimeSpan::operator==(const CTimeSpan& ts) const + { + return m_timespan == ts.m_timespan; + } + + // Returns true if the specified value is not equal to this CTimeSpan object. + inline bool CTimeSpan::operator!=(const CTimeSpan& ts) const + { + return m_timespan != ts.m_timespan; + } + + // Returns true if the specified value is less than this CTimeSpan object. + inline bool CTimeSpan::operator<(const CTimeSpan& ts) const + { + return m_timespan < ts.m_timespan; + } + + // Returns true if the specified value is greater than this CTimeSpan object. + inline bool CTimeSpan::operator>(const CTimeSpan& ts) const + { + return m_timespan > ts.m_timespan; + } + + // Returns true if the specified value is less than or equal to this + // CTimeSpan object. + inline bool CTimeSpan::operator<=(const CTimeSpan& ts) const + { + return m_timespan <= ts.m_timespan; + } + + // Returns true if the specified value is greater than or equal to this + // CTimeSpan object. + inline bool CTimeSpan::operator>=(const CTimeSpan& ts) const + { + return m_timespan >= ts.m_timespan; + } + + +} // namespace Win32XX + + +#endif // _WIN32XX_TIME_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_toolbar.h b/packages/media/cpp/packages/Win32xx/include/wxx_toolbar.h new file mode 100644 index 00000000..ee80944a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_toolbar.h @@ -0,0 +1,1091 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +#ifndef _WIN32XX_TOOLBAR_H_ +#define _WIN32XX_TOOLBAR_H_ + +#include "wxx_wincore.h" + + +namespace Win32xx +{ + + //////////////////////////////////////////////// + // The CToolBar class provides the functionality + // a toolbar control. + class CToolBar : public CWnd + { + public: + CToolBar(); + virtual ~CToolBar() override = default; + + // Operations + virtual BOOL AddButton(UINT buttonID, BOOL isEnabled = TRUE, int image = -1); + virtual void Destroy() override; + virtual BOOL SetButtonText(UINT buttonID, LPCTSTR text); + + // Wrappers for Win32 API functions + BOOL AddButtons(UINT buttonCount, LPTBBUTTON pButtonInfoArray) const; + int AddString(UINT stringID) const; + int AddStrings(LPCTSTR strings) const; + void Autosize() const; + void CheckButton(UINT buttonID, BOOL isChecked) const; + int CommandToIndex(UINT buttonID) const; + void Customize() const; + BOOL DeleteButton(int index) const; + BOOL DisableButton(UINT buttonID) const; + BOOL EnableButton(UINT buttonID, BOOL isEnabled = TRUE) const; + BOOL GetButton(int index, TBBUTTON& buttonInfo) const; + int GetButtonCount() const; + CSize GetButtonSize() const; + UINT GetButtonState(UINT buttonID) const; + BYTE GetButtonStyle(UINT buttonID) const; + CString GetButtonText(UINT buttonID) const; + UINT GetCommandID(int index) const; + CImageList GetDisabledImageList() const; + DWORD GetExtendedStyle() const; + CImageList GetHotImageList() const; + int GetHotItem() const; + CImageList GetImageList() const; + CRect GetItemRect(int index) const; + CSize GetMaxSize() const; + CSize GetPadding() const; + CRect GetRect(UINT buttonID) const; + int GetRows() const; + int GetTextRows() const; + HWND GetToolTips() const; + BOOL HasText() const; + BOOL HideButton(UINT buttonID, BOOL show) const; + int HitTest(POINT pt) const; + int HitTest() const; + BOOL Indeterminate(UINT buttonID, BOOL isIndeterminate) const; + BOOL InsertButton(int index, const TBBUTTON& buttonInfo) const; + BOOL IsButtonHidden(UINT buttonID) const; + BOOL IsButtonHighlighted(UINT buttonID) const; + BOOL IsButtonIndeterminate(UINT buttonID) const; + BOOL IsButtonPressed(UINT buttonID) const; + int MapAccelerator(TCHAR accelChar) const; + BOOL MarkButton(UINT buttonID, BOOL highlight = TRUE ) const; + BOOL MoveButton(UINT oldPos, UINT newPos) const; + BOOL PressButton(UINT buttonID, BOOL press) const; + void SaveRestore(BOOL save, TBSAVEPARAMS* pSaveInfo) const; + BOOL SetBitmapSize(int cx, int cy) const; + void SetButtonInfo(UINT buttonID, UINT buttonNewID, int image, + BYTE style = 0, BYTE state = 0) const; + BOOL SetButtonInfo(UINT buttonID, const TBBUTTONINFO& tbbi) const; + BOOL SetButtonSize(int cx, int cy) const; + BOOL SetButtonState(UINT buttonID, UINT state) const; + BOOL SetButtonStyle(UINT buttonID, BYTE style) const; + BOOL SetButtonWidth(UINT buttonID, int width) const; + BOOL SetCommandID(int index, UINT buttonID) const; + CImageList SetDisableImageList(HIMAGELIST disabledImages); + DWORD SetDrawTextFlags(DWORD mask, DWORD flags) const; + DWORD SetExtendedStyle(DWORD exStyle) const; + CImageList SetHotImageList(HIMAGELIST hotImages); + int SetHotItem(int index) const; + CImageList SetImageList(HIMAGELIST normalImages); + BOOL SetIndent(int indent) const; + BOOL SetMaxTextRows(int maxRows) const; + BOOL SetPadding(int cx, int cy) const; + void SetToolTips(HWND toolTip) const; + + protected: + // Overridables + virtual void OnAttach() override; + virtual LRESULT OnWindowPosChanging(UINT msg, WPARAM wparam, LPARAM lparam); + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual void PreRegisterClass(WNDCLASS& wc) override; + + // Not intended to be overridden + LRESULT WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) override; + + private: + using CWnd::GetMenu; // Make GetMenu private + using CWnd::SetMenu; // Make SetMenu private + + CToolBar(const CToolBar&) = delete; + CToolBar& operator=(const CToolBar&) = delete; + + std::map m_stringMap; // A map of strings used in SetButtonText. + + CImageList m_normalImages; // Image-list for normal buttons. + CImageList m_hotImages; // Image-list for hot buttons. + CImageList m_disabledImages; // Image-list for disabled buttons. + + }; // class CToolBar + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + ////////////////////////////////////// + // Definitions for the CToolBar class. + // + + inline CToolBar::CToolBar() + { + } + + // Adds a single button to the Toolbar. It provides a convenient + // alternative to AddButtons. A resource ID of 0 is a separator. + // image is the index of the image in the ImageList. + // The default is -1 in which case the image based on the button's position + // is chosen. + // Refer to TB_ADDBUTTONS in the Windows API documentation for more information. + inline BOOL CToolBar::AddButton(UINT id, BOOL isEnabled /* = TRUE */, + int image /* = -1 */) + { + assert(IsWindow()); + + // Count toolbar buttons with Command IDs. + int nImages = 0; + + if (image == -1) + { + // choose the image based on the number of buttons already used. + for (int i = 0; i < GetButtonCount(); ++i) + { + if (GetCommandID(i) > 0) + nImages++; + } + } + else + { + nImages = image; + } + + // TBBUTTON structure for each button in the toolbar. + TBBUTTON tbb = {}; + + if (id == 0) + { + tbb.fsStyle = BTNS_SEP; + } + else + { + tbb.iBitmap = nImages; + tbb.idCommand = static_cast(id); + tbb.fsState = isEnabled? TBSTATE_ENABLED : 0U; + tbb.fsStyle = BTNS_BUTTON; + } + + // Add the button to the toolbar. + return AddButtons(1, &tbb); + } + + // Adds one or more buttons to a ToolBar. pButtonInfoArray is a pointer to + // an array of TBBUTTON. + // Refer to TB_ADDBUTTONS in the Windows API documentation for more information. + inline BOOL CToolBar::AddButtons(UINT buttonCount, LPTBBUTTON pButtonInfoArray) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(buttonCount); + LPARAM lparam = reinterpret_cast(pButtonInfoArray); + return static_cast(SendMessage(TB_ADDBUTTONS, wparam, lparam)); + } + + // Adds a new string, passed as a resource ID, to the ToolBar's internal + // list of strings. + // Refer to TB_ADDSTRING in the Windows API documentation for more information. + inline int CToolBar::AddString(UINT stringID) const + { + assert(IsWindow()); + HANDLE resource = GetApp()->GetResourceHandle(); + WPARAM wparam = reinterpret_cast(resource); + LPARAM lparam = static_cast(stringID); + return static_cast(SendMessage(TB_ADDSTRING, wparam, lparam)); + } + + // Adds a new string or strings to the list of strings available for a + // ToolBar control. Strings in the buffer must be separated by a null + // character. The last string must have two null terminators. + // Refer to TB_ADDSTRING in the Windows API documentation for more information. + inline int CToolBar::AddStrings(LPCTSTR strings) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(strings); + return static_cast(SendMessage(TB_ADDSTRING, 0, lparam)); + } + + // Causes a ToolBar to be resized. + // Refer to TB_AUTOSIZE in the Windows API documentation for more information. + inline void CToolBar::Autosize() const + { + assert(IsWindow()); + SendMessage(TB_AUTOSIZE, 0, 0); + } + + // Checks or unchecks the specified button in a ToolBar. + // When a button is checked, it is displayed in the pressed state. + // Refer to TB_CHECKBUTTON in the Windows API documentation for more information. + inline void CToolBar::CheckButton(UINT buttonID, BOOL isChecked) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(buttonID); + SendMessage(TB_CHECKBUTTON, wparam, MAKELONG(isChecked, 0)); + } + + // Retrieves the zero-based index for the button associated with the + // specified command identifier. + // Refer to TB_COMMANDTOINDEX in the Windows API documentation for more information. + inline int CToolBar::CommandToIndex(UINT buttonID) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(buttonID); + + // Returns -1 on fail. + return static_cast(SendMessage(TB_COMMANDTOINDEX, wparam, 0)); + } + + // Displays the Customize Toolbar dialog box. The parent must handle the + // TBN_QUERYINSERT and TBN_QUERYDELETE notifications for the Customize + // Toolbar dialog box to appear. + // Requires the CCS_ADJUSTABLE style to be set when the toolbar is created. + // Refer to TB_CUSTOMIZE in the Windows API documentation for more information. + inline void CToolBar::Customize() const + { + assert(IsWindow()); + SendMessage(TB_CUSTOMIZE, 0, 0); + } + + // Deletes a button from the ToolBar. + // index is the Zero-based index of the button to delete. + // Refer to TB_DELETEBUTTON in the Windows API documentation for more information. + inline BOOL CToolBar::DeleteButton(int index) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + return static_cast(SendMessage(TB_DELETEBUTTON, wparam, 0)); + } + + // Destroys the toolbar. + inline void CToolBar::Destroy() + { + CWnd::Destroy(); + m_stringMap.clear(); + } + + // Disables the specified button in a ToolBar. + // An example of buttonID would be IDM_FILE_OPEN. + // Refer to TB_ENABLEBUTTON in the Windows API documentation for more information. + inline BOOL CToolBar::DisableButton(UINT buttonID) const + { + assert(IsWindow()); + return EnableButton(buttonID, FALSE); + } + + // Enables the specified button in a ToolBar. + // Refer to TB_ENABLEBUTTON in the Windows API documentation for more information. + inline BOOL CToolBar::EnableButton(UINT buttonID, BOOL isEnabled) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(buttonID); + return static_cast(SendMessage(TB_ENABLEBUTTON, wparam, MAKELONG(isEnabled, 0))); + } + + // Receives the TBBUTTON structure information from the specified button. + // Refer to TB_GETBUTTON in the Windows API documentation for more information. + inline BOOL CToolBar::GetButton(int index, TBBUTTON& buttonInfo) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + LPARAM lparam = reinterpret_cast(&buttonInfo); + return static_cast(SendMessage(TB_GETBUTTON, wparam, lparam)); + } + + // Retrieves a count of the buttons currently in the ToolBar. + // Refer to TB_BUTTONCOUNT in the Windows API documentation for more information. + inline int CToolBar::GetButtonCount() const + { + assert(IsWindow()); + return static_cast(SendMessage(TB_BUTTONCOUNT, 0, 0)); + } + + // Retrieves the current width and height of ToolBar buttons, in pixels. + // Returns a DWORD value that contains the width and height values in the + // low word and high word, respectively. + // Refer to TB_GETBUTTONSIZE in the Windows API documentation for more information. + inline CSize CToolBar::GetButtonSize() const + { + assert(IsWindow()); + DWORD size = static_cast(SendMessage(TB_GETBUTTONSIZE, 0, 0)); + return CSize(size); + } + + // Retrieves the state of an individual button + // TBSTATE_CHECKED The button has the TBSTYLE_CHECK style and is being clicked. + // TBSTATE_ELLIPSES The button's text is cut off and an ellipsis is displayed. + // TBSTATE_ENABLED The button accepts user input. A button that doesn't have this state is grayed. + // TBSTATE_HIDDEN The button is not visible and cannot receive user input. + // TBSTATE_INDETERMINATE The button is grayed. + // TBSTATE_MARKED The button is marked. The interpretation of a marked item is dependent upon the application. + // TBSTATE_PRESSED The button is being clicked. + // TBSTATE_WRAP The button is followed by a line break. + // Refer to TB_GETSTATE in the Windows API documentation for more information. + inline UINT CToolBar::GetButtonState(UINT buttonID) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(buttonID); + return static_cast(SendMessage(TB_GETSTATE, wparam, 0)); + } + + // Retrieves the the style of the ToolBar control. The following button styles are supported: + // BTNS_BUTTON Standard push button (default) + // BTNS_SEP Separator + // BTNS_CHECK Auto check-box button + // BTNS_GROUP Marks the start of a group of buttons + // BTNS_CHECKGROUP Marks the start of a group of check-box buttons + // BTNS_DROPDOWN Creates a drop-down list button + // BTNS_AUTOSIZE The button's width will be calculated based on the text of the button, not on the size of the image + // BTNS_NOPREFIX The button text will not have an accelerator prefix associated with it + // Refer to TB_GETBUTTON in the Windows API documentation for more information. + inline BYTE CToolBar::GetButtonStyle(UINT buttonID) const + { + assert(IsWindow()); + + int index = CommandToIndex(buttonID); + TBBUTTON tbb = {}; + GetButton(index, tbb); + + return tbb.fsStyle; + } + + // Retrieves the display text of a button on a ToolBar. + // Refer to TB_GETBUTTONTEXT in the Windows API documentation for more information. + inline CString CToolBar::GetButtonText(UINT buttonID) const + { + assert(IsWindow()); + + WPARAM wparam = static_cast(buttonID); + int length = static_cast(SendMessage(TB_GETBUTTONTEXT, wparam, 0)); + CString str; + if (length > 0) + { + LPTSTR szStr = str.GetBuffer(length); + LPARAM lparam = reinterpret_cast(szStr); + SendMessage(TB_GETBUTTONTEXT, wparam, lparam); + str.ReleaseBuffer(); + } + + return str; + } + + // Retrieves information about the specified button in a ToolBar. + // Refer to TB_GETBUTTON in the Windows API documentation for more information. + inline UINT CToolBar::GetCommandID(int index) const + { + assert(IsWindow()); + TBBUTTON tbb = {}; + GetButton(index, tbb); + + // returns zero if failed + return static_cast(tbb.idCommand); + } + + // Retrieves the image list that a ToolBar control uses to display inactive + // buttons. + // Refer to TB_GETDISABLEDIMAGELIST in the Windows API documentation for more information. + inline CImageList CToolBar::GetDisabledImageList() const + { + assert(IsWindow()); + HIMAGELIST images = reinterpret_cast(SendMessage(TB_GETDISABLEDIMAGELIST, 0, 0)); + return CImageList(images); + } + + // Retrieves the he extended styles currently in use for the toolbar control. + // Possible extended styles: TBSTYLE_EX_DRAWDDARROWS, + // TBSTYLE_EX_HIDECLIPPEDBUTTONS, TBSTYLE_EX_DOUBLEBUFFER and + // TBSTYLE_EX_MIXEDBUTTONS. + // Refer to TB_GETEXTENDEDSTYLE in the Windows API documentation for more information. + inline DWORD CToolBar::GetExtendedStyle() const + { + assert(IsWindow()); + return static_cast(SendMessage(TB_GETEXTENDEDSTYLE, 0, 0)); + } + + // Retrieves the image list that a ToolBar control uses to display hot + // buttons. + // Refer to TB_GETHOTIMAGELIST in the Windows API documentation for more information. + inline CImageList CToolBar::GetHotImageList() const + { + assert(IsWindow()); + HIMAGELIST images = reinterpret_cast(SendMessage(TB_GETHOTIMAGELIST, 0, 0)); + return CImageList(images); + } + + // Retrieves the index of the hot item in a ToolBar, or -1 if no hot item + // is set. + // Refer to TB_GETHOTITEM in the Windows API documentation for more information. + inline int CToolBar::GetHotItem() const + { + assert(IsWindow()); + return static_cast(SendMessage(TB_GETHOTITEM, 0, 0)); + } + + // Retrieves the image list that a ToolBar control uses to display buttons + // in their default state. + // Refer to TB_GETIMAGELIST in the Windows API documentation for more information. + inline CImageList CToolBar::GetImageList() const + { + assert(IsWindow()); + HIMAGELIST images = reinterpret_cast(SendMessage(TB_GETIMAGELIST, 0, 0)); + return CImageList(images); + } + + // Retrieves the bounding rectangle of a button in a ToolBar. + // Refer to TB_GETITEMRECT in the Windows API documentation for more information. + inline CRect CToolBar::GetItemRect(int index) const + { + assert(IsWindow()); + CRect rc; + WPARAM wparam = static_cast(index); + LPARAM lparam = reinterpret_cast(&rc); + SendMessage(TB_GETITEMRECT, wparam, lparam); + + return rc; + } + + // Retrieves the total size of all of the visible buttons and separators in + // the ToolBar. + // Refer to TB_GETMAXSIZE in the Windows API documentation for more information. + inline CSize CToolBar::GetMaxSize() const + { + assert(IsWindow()); + CSize sz; + LPARAM lparam = reinterpret_cast(&sz); + SendMessage(TB_GETMAXSIZE, 0, lparam); + + // This fixes a Windows bug calculating the size when TBSTYLE_DROPDOWN + // is used. + int cxMaxSize = 0; + int cyMaxSize = 0; + for (int i= 0 ; i < GetButtonCount(); ++i) + { + CRect itemRect = GetItemRect(i); + cxMaxSize += itemRect.Width(); + cyMaxSize += itemRect.Height(); + } + + if (GetStyle() & CCS_VERT) + sz.cy = cyMaxSize; + else + sz.cx = cxMaxSize; + + return sz; + } + + // Returns a DWORD value that contains the horizontal padding in the low + // word and the vertical padding in the high word, in pixels. + // Refer to TB_GETPADDING in the Windows API documentation for more information. + inline CSize CToolBar::GetPadding() const + { + assert(IsWindow()); + DWORD padding = static_cast(SendMessage(TB_GETPADDING, 0, 0)); + return CSize(padding); + } + + // Retrieves the bounding rectangle for a specified ToolBar button. + // Refer to TB_GETRECT in the Windows API documentation for more information. + inline CRect CToolBar::GetRect(UINT buttonID) const + { + assert(IsWindow()); + CRect rc; + WPARAM wparam = static_cast(buttonID); + LPARAM lparam = reinterpret_cast(&rc); + SendMessage(TB_GETRECT, wparam, lparam); + return rc; + } + + // Retrieves the number of rows of buttons in a ToolBar with the + // TBSTYLE_WRAPABLE style. + // Refer to TB_GETROWS in the Windows API documentation for more information. + inline int CToolBar::GetRows() const + { + assert(IsWindow()); + return static_cast(SendMessage(TB_GETROWS, 0, 0)); + } + + // Retrieves the maximum number of text rows that can be displayed on a + // ToolBar button. + // Refer to TB_GETTEXTROWS in the Windows API documentation for more information. + inline int CToolBar::GetTextRows() const + { + assert(IsWindow()); + return static_cast(SendMessage(TB_GETTEXTROWS, 0, 0)); + } + + // Retrieves the handle to the ToolTip control, if any, associated with + // the ToolBar. + // Refer to TB_GETTOOLTIPS in the Windows API documentation for more information. + inline HWND CToolBar::GetToolTips() const + { + assert(IsWindow()); + return reinterpret_cast(SendMessage(TB_GETTOOLTIPS, 0, 0)); + } + + // Returns TRUE if any button has text. + // Refer to TB_GETBUTTONTEXT in the Windows API documentation for more information. + inline BOOL CToolBar::HasText() const + { + assert(IsWindow()); + BOOL result = FALSE; + + for (int i = 0 ; i < GetButtonCount(); ++i) + { + WPARAM wparam = static_cast(GetCommandID(i)); + if (SendMessage(TB_GETBUTTONTEXT, wparam, 0) != -1) + result = TRUE; + } + + // return TRUE if any button has text + return result; + } + + // Hides or shows the specified button in a ToolBar. + // Refer to TB_HIDEBUTTON in the Windows API documentation for more information. + inline BOOL CToolBar::HideButton(UINT buttonID, BOOL show) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(buttonID); + return static_cast(SendMessage(TB_HIDEBUTTON, wparam, MAKELONG (show, 0))); + } + + // Returns the button that's positioned under the cursor. + // Refer to TB_HITTEST in the Windows API documentation for more information. + inline int CToolBar::HitTest() const + { + assert(IsWindow()); + CPoint pos = GetCursorPos(); + VERIFY(ScreenToClient(pos)); + + return HitTest(pos); + } + + // Returns the button that's positioned at the specified point. + // Refer to TB_HITTEST in the Windows API documentation for more information. + inline int CToolBar::HitTest(POINT pt) const + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(&pt); + return static_cast(SendMessage(TB_HITTEST, 0, lparam)); + } + + // Sets or clears the indeterminate state of the specified button in a + // toolbar. + // Refer to TB_INDETERMINATE in the Windows API documentation for more information. + inline BOOL CToolBar::Indeterminate(UINT buttonID, BOOL isIndeterminate) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(buttonID); + return static_cast(SendMessage(TB_INDETERMINATE, wparam, MAKELONG (isIndeterminate, 0))); + } + + // Inserts a button to the left of the specified button index. + // Refer to TB_INSERTBUTTON in the Windows API documentation for more information. + inline BOOL CToolBar::InsertButton(int index, const TBBUTTON& buttonInfo) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + LPARAM lparam = reinterpret_cast(&buttonInfo); + return static_cast(SendMessage(TB_INSERTBUTTON, wparam, lparam)); + } + + // Determines whether the specified button in a ToolBar is hidden. + // Refer to TB_ISBUTTONHIDDEN in the Windows API documentation for more information. + inline BOOL CToolBar::IsButtonHidden(UINT buttonID) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(buttonID); + return static_cast(SendMessage(TB_ISBUTTONHIDDEN, wparam, 0)); + } + + // Checks the highlight state of a ToolBar button. + // Refer to TB_ISBUTTONHIGHLIGHTED in the Windows API documentation for more information. + inline BOOL CToolBar::IsButtonHighlighted(UINT buttonID) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(buttonID); + return static_cast(SendMessage(TB_ISBUTTONHIGHLIGHTED, wparam, 0)); + } + + // Determines whether the specified button in a ToolBar is indeterminate. + // Refer to TB_ISBUTTONINDETERMINATE in the Windows API documentation for more information. + inline BOOL CToolBar::IsButtonIndeterminate(UINT buttonID) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(buttonID); + return static_cast(SendMessage(TB_ISBUTTONINDETERMINATE, wparam, 0)); + } + + // Determines whether the specified button in a ToolBar is pressed. + // Refer to TB_ISBUTTONPRESSED in the Windows API documentation for more information. + inline BOOL CToolBar::IsButtonPressed(UINT buttonID) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(buttonID); + return static_cast(SendMessage(TB_ISBUTTONPRESSED, wparam, 0)); + } + + // Determines the ID of the button that corresponds to the specified + // accelerator character. + // Refer to TB_MAPACCELERATOR in the Windows API documentation for more information. + inline int CToolBar::MapAccelerator(TCHAR accelChar) const + { + assert(IsWindow()); + int idButton = -1; + WPARAM wparam = static_cast(accelChar); + LPARAM lparam = reinterpret_cast(&idButton); + if (!SendMessage(TB_MAPACCELERATOR, wparam, lparam)) + idButton = -1; + + return idButton; + } + + // Sets the highlight state of a given button in a ToolBar control. + // Refer to TB_MARKBUTTON in the Windows API documentation for more information. + inline BOOL CToolBar::MarkButton(UINT buttonID, BOOL highlight /*= TRUE*/ ) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(buttonID); + LPARAM lparam = static_cast(highlight); + return static_cast(SendMessage(TB_MARKBUTTON, wparam, lparam)); + } + + // Moves a button from one index to another. + // Refer to TB_MOVEBUTTON in the Windows API documentation for more information. + inline BOOL CToolBar::MoveButton(UINT oldPos, UINT newPos) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(oldPos); + LPARAM lparam = static_cast(newPos); + return static_cast(SendMessage(TB_MOVEBUTTON, wparam, lparam)); + } + + // Called when the toolbar window is created and attached to this object. + inline void CToolBar::OnAttach() + { + WPARAM wparam = static_cast(sizeof(TBBUTTON)); + + // We must send this message before sending the TB_ADDBITMAP or + // TB_ADDBUTTONS message. + SendMessage(TB_BUTTONSTRUCTSIZE, wparam, 0); + + // Allows buttons to have a separate drop-down arrow. + // Note: TBN_DROPDOWN notification is sent by a ToolBar control, + // when the user clicks a drop-down button. + SendMessage(TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DRAWDDARROWS); + } + + // Called when the toolbar is resized. + inline LRESULT CToolBar::OnWindowPosChanging(UINT msg, WPARAM wparam, LPARAM lparam) + { + // Used by ReBar controls to adjust ToolBar window size + if ( GetParent().SendMessage(UWM_TBWINPOSCHANGING, reinterpret_cast< + WPARAM>(GetHwnd()), lparam) ) + { + LPWINDOWPOS pWinPos = reinterpret_cast(lparam); + pWinPos->cx = GetMaxSize().cx; + pWinPos->cy = GetMaxSize().cy; + } + + return FinalWindowProc(msg, wparam, lparam); + } + + // Sets the CREATESTRUCT parameters prior to window creation. + inline void CToolBar::PreCreate(CREATESTRUCT& cs) + { + cs.style = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | + TBSTYLE_TOOLTIPS | TBSTYLE_FLAT; + } + + // Sets the window class. + inline void CToolBar::PreRegisterClass(WNDCLASS& wc) + { + wc.lpszClassName = TOOLBARCLASSNAME; + } + + // Presses or releases the specified button in a ToolBar. + // Refer to TB_PRESSBUTTON in the Windows API documentation for more information. + inline BOOL CToolBar::PressButton(UINT buttonID, BOOL press) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(buttonID); + return static_cast(SendMessage(TB_PRESSBUTTON, wparam, MAKELONG(press, 0))); + } + + // Saves or restores the toolbar state in the registry. Parameter values: + // save If this parameter is TRUE, the information is saved, otherwise it is restored. + // pSaveInfo Pointer to a TBSAVEPARAMS structure that specifies the registry key, subkey, + // and value name for the toolbar state information. + // Refer to TB_SAVERESTORE in the Windows API documentation for more information. + inline void CToolBar::SaveRestore(BOOL save, TBSAVEPARAMS* pSaveInfo) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(save); + LPARAM lparam = reinterpret_cast(pSaveInfo); + SendMessage(TB_SAVERESTORE, wparam, lparam); + } + + // Sets the size of the bitmapped images to be added to a ToolBar. + // Needs to be used when the image size is not the default 16 x 15. + // Call this function before using AddBitmap or ReplaceBitmap. + // Refer to TB_SETBITMAPSIZE in the Windows API documentation for more information. + inline BOOL CToolBar::SetBitmapSize(int cx, int cy) const + { + assert(IsWindow()); + return static_cast(SendMessage(TB_SETBITMAPSIZE, 0, MAKELONG(cx, cy))); + } + + // Sets the size of the buttons to be added to a ToolBar. + // This function should generally be called after adding buttons. + // Refer to TB_SETBUTTONSIZE in the Windows API documentation for more information. + inline BOOL CToolBar::SetButtonSize(int cx, int cy) const + { + assert(IsWindow()); + return static_cast(SendMessage(TB_SETBUTTONSIZE, 0, MAKELONG(cx, cy))); + } + + // Use this to change a button's Command ID. It can also be used to change + // a button's image. + // Refer to TB_SETBUTTONINFO in the Windows API documentation for more information. + inline void CToolBar::SetButtonInfo(UINT buttonID, UINT buttonNewID, + int image, BYTE style /* = 0 */, BYTE state /* = 0 */) const + { + // Retrieve existing state and style + TBBUTTON tb = {}; + int index = CommandToIndex(buttonID); + BOOL result = GetButton(index, tb); + assert(result); + + if (result) + { + TBBUTTONINFO tbbi = {}; + tbbi.cbSize = sizeof(tbbi); + tbbi.dwMask = TBIF_COMMAND | TBIF_IMAGE | TBIF_STYLE | TBIF_STATE; + tbbi.idCommand = static_cast(buttonNewID); + tbbi.iImage = image; + tbbi.fsStyle = style ? style : tb.fsStyle; + tbbi.fsState = state ? state : tb.fsState; + + SetButtonInfo(buttonID, tbbi); + } + } + + inline BOOL CToolBar::SetButtonInfo(UINT buttonID, const TBBUTTONINFO& tbbi) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(buttonID); + LPARAM lparam = reinterpret_cast(&tbbi); + return static_cast(SendMessage(TB_SETBUTTONINFO, wparam, lparam)); + } + + // Set the state of an individual button + // TBSTATE_CHECKED The button has the TBSTYLE_CHECK style and is being clicked. + // TBSTATE_ELLIPSES The button's text is cut off and an ellipsis is displayed. + // TBSTATE_ENABLED The button accepts user input. A button that + // doesn't have this state is grayed. + // TBSTATE_HIDDEN The button is not visible and cannot receive user input. + // TBSTATE_INDETERMINATE The button is grayed. + // TBSTATE_MARKED The button is marked. The interpretation of a + // marked item is dependent upon the application. + // TBSTATE_PRESSED The button is being clicked. + // TBSTATE_WRAP The button is followed by a line break. + // Refer to TB_SETSTATE in the Windows API documentation for more information. + inline BOOL CToolBar::SetButtonState(UINT buttonID, UINT state) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(buttonID); + return static_cast(SendMessage(TB_SETSTATE, wparam, MAKELONG (state, 0))); + } + + // The the style of the ToolBar control. The following button styles are supported: + // BTNS_BUTTON Standard push button (default) + // BTNS_SEP Separator + // BTNS_CHECK Auto check-box button + // BTNS_GROUP Marks the start of a group of buttons + // BTNS_CHECKGROUP Marks the start of a group of check-box buttons + // BTNS_DROPDOWN Creates a drop-down list button + // BTNS_AUTOSIZE The button's width will be calculated based on the + // text of the button, not on the size of the image + // BTNS_NOPREFIX The button text will not have an accelerator prefix associated with it. + // Refer to TB_SETBUTTONINFO in the Windows API documentation for more information. + inline BOOL CToolBar::SetButtonStyle(UINT buttonID, BYTE style) const + { + assert(IsWindow()); + + TBBUTTONINFO tbbi = {}; + tbbi.cbSize = sizeof(tbbi); + tbbi.dwMask = TBIF_STYLE; + tbbi.fsStyle = style; + + return SetButtonInfo(buttonID, tbbi); + } + + // Sets the button's text using AddString. The AddString approach always sets + // the button size correctly, whereas the SetButtonInfo alternative doesn't. + // Refer to TB_ADDSTRING in the Windows API documentation for more information. + inline BOOL CToolBar::SetButtonText(UINT buttonID, LPCTSTR text) + { + assert(IsWindow()); + int index = CommandToIndex(buttonID); + assert(index != -1); + + BOOL succeeded = FALSE; + CString string = text; + int stringIndex; + + // Check to see if the string is already added. + auto m = m_stringMap.find(string); + if (m_stringMap.end() == m) + { + CString str; + if (m_stringMap.size() == 0) + { + // Place a blank string first in the string table, in case some + // buttons don't have text. + + str = _T(" "); + str += _T('\0'); // Double-null terminate. + AddStrings(str); + } + + // No index for this string exists, so create it now. + str = text; + str += _T('\0'); // Double-null terminate. + + stringIndex = AddStrings(str); + if (stringIndex != -1) + { + // Save the string its index in our map. + m_stringMap.emplace(std::make_pair(string, stringIndex)); + + succeeded = TRUE; + } + } + else + { + // String found, use the index from our map. + stringIndex = m->second; + succeeded = TRUE; + } + + if (succeeded) + { + TBBUTTON tbb = {}; + succeeded = GetButton(index, tbb); + tbb.iString = stringIndex; + + // Turn off ToolBar drawing. + SetRedraw(FALSE); + + // Replace the button to resize it to fit the text. + succeeded = succeeded ? DeleteButton(index) : FALSE; + succeeded = succeeded ? InsertButton(index, tbb) : FALSE; + + // Ensure the button now includes some text rows. + if (SendMessage(TB_GETTEXTROWS, 0, 0) == 0) + SendMessage(TB_SETMAXTEXTROWS, static_cast(1), 0); + + // Turn on ToolBar drawing. + SetRedraw(TRUE); + } + // Redraw button. + CRect r = GetItemRect(index); + InvalidateRect(r, TRUE); + + return succeeded; + } + + // Sets the button width. + // Adjust the width of a toolbar button after it is created. + // This is useful when replacing a button with a ComboBox or other control. + // Refer to TB_SETBUTTONINFO in the Windows API documentation for more information. + inline BOOL CToolBar::SetButtonWidth(UINT buttonID, int width) const + { + assert(IsWindow()); + + TBBUTTONINFO tbbi = {}; + tbbi.cbSize = sizeof(tbbi); + tbbi.dwMask = TBIF_SIZE; + tbbi.cx = static_cast(width); + BOOL result = SetButtonInfo(buttonID, tbbi); + + // Send a changed message to the parent (used by the ReBar) + SIZE maxSize = GetMaxSize(); + WPARAM wparam = reinterpret_cast(GetHwnd()); + LPARAM lparam = reinterpret_cast(&maxSize); + GetParent().SendMessage(UWM_TBRESIZE, wparam, lparam); + + return result; + } + + // Sets the command identifier of a ToolBar button. + // Refer to TB_SETCMDID in the Windows API documentation for more information. + inline BOOL CToolBar::SetCommandID(int index, UINT buttonID) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + LPARAM lparam = static_cast(buttonID); + return static_cast(SendMessage(TB_SETCMDID, wparam, lparam)); + } + + // Sets the ImageList that the ToolBar control will use to display disabled + // buttons. + // Refer to TB_SETDISABLEDIMAGELIST in the Windows API documentation for more information. + inline CImageList CToolBar::SetDisableImageList(HIMAGELIST disabledImages) + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(disabledImages); + CImageList images = reinterpret_cast(SendMessage( + TB_SETDISABLEDIMAGELIST, 0, lparam)); + + m_disabledImages = disabledImages; + return images; + } + + // Sets the text drawing flags for the ToolBar. + // Refer to TB_SETDRAWTEXTFLAGS in the Windows API documentation for more information. + inline DWORD CToolBar::SetDrawTextFlags(DWORD mask, DWORD flags) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(mask); + LPARAM lparam = static_cast(flags); + return static_cast(SendMessage(TB_SETDRAWTEXTFLAGS, wparam, lparam)); + } + + // Sets the text drawing flags for the ToolBar. + // Extended styles include: TBSTYLE_EX_DRAWDDARROWS, + // TBSTYLE_EX_HIDECLIPPEDBUTTONS, TBSTYLE_EX_DOUBLEBUFFER and + // TBSTYLE_EX_MIXEDBUTTONS. + // Refer to TB_SETEXTENDEDSTYLE in the Windows API documentation for more information. + inline DWORD CToolBar::SetExtendedStyle(DWORD exStyle) const + { + assert(IsWindow()); + LPARAM lparam = static_cast(exStyle); + return static_cast(SendMessage(TB_SETEXTENDEDSTYLE, 0, lparam)); + } + + // Sets the image list that the ToolBar control will use to display hot buttons. + // Refer to TB_SETHOTIMAGELIST in the Windows API documentation for more information. + inline CImageList CToolBar::SetHotImageList(HIMAGELIST hotImages) + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(hotImages); + CImageList images = reinterpret_cast(SendMessage(TB_SETHOTIMAGELIST, 0, lparam)); + m_hotImages = hotImages; + return images; + } + + // Sets the hot item in a ToolBar. + // Refer to TB_SETHOTITEM in the Windows API documentation for more information. + inline int CToolBar::SetHotItem(int index) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(index); + return static_cast(SendMessage(TB_SETHOTITEM, wparam, 0)); + } + + // Sets the image list that the ToolBar will use to display buttons that + // are in their default state. + // Refer to TB_SETIMAGELIST in the Windows API documentation for more information. + inline CImageList CToolBar::SetImageList(HIMAGELIST normalImages) + { + assert(IsWindow()); + LPARAM lparam = reinterpret_cast(normalImages); + CImageList images = reinterpret_cast(SendMessage( + TB_SETIMAGELIST, 0, lparam)); + + m_normalImages = normalImages; + return images; + } + + // Sets the indentation for the first button in a ToolBar control. + // Refer to TB_SETINDENT in the Windows API documentation for more information. + inline BOOL CToolBar::SetIndent(int indent) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(indent); + return static_cast(SendMessage(TB_SETINDENT, wparam, 0)); + } + + // Sets the maximum number of text rows displayed on a ToolBar button. + // Refer to TB_SETMAXTEXTROWS in the Windows API documentation for more information. + inline BOOL CToolBar::SetMaxTextRows(int maxRows) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(maxRows); + return static_cast(SendMessage(TB_SETMAXTEXTROWS, wparam, 0)); + } + + // Sets the padding for a ToolBar control. + // Refer to TB_SETPADDING in the Windows API documentation for more information. + inline BOOL CToolBar::SetPadding(int cx, int cy) const + { + assert(IsWindow()); + return static_cast(SendMessage(TB_SETPADDING, 0, MAKELONG(cx, cy))); + } + + // Associates a ToolTip control with a ToolBar. This should be done before + // adding any buttons to the ToolBar. + // Refer to TB_SETTOOLTIPS in the Windows API documentation for more information. + inline void CToolBar::SetToolTips(HWND toolTip) const + { + assert(IsWindow()); + WPARAM wparam = reinterpret_cast(toolTip); + SendMessage(TB_SETTOOLTIPS, wparam, 0); + } + + // Provides default processing of the toolbar's messages. + inline LRESULT CToolBar::WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) + { + switch (msg) + { + case WM_WINDOWPOSCHANGING: return OnWindowPosChanging(msg, wparam, lparam); + case UWM_GETCTOOLBAR: return reinterpret_cast(this); + } + + // Pass unhandled messages on for default processing. + return CWnd::WndProcDefault(msg, wparam, lparam); + } + +} // namespace Win32xx + +#endif // _WIN32XX_TOOLBAR_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_treeview.h b/packages/media/cpp/packages/Win32xx/include/wxx_treeview.h new file mode 100644 index 00000000..618d0f0c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_treeview.h @@ -0,0 +1,802 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + + +#ifndef _WIN32XX_TREEVIEW_H_ +#define _WIN32XX_TREEVIEW_H_ + +#include "wxx_wincore.h" + + +// Disable macros from Windowsx.h +#undef GetNextSibling +#undef GetPrevSibling + +namespace Win32xx +{ + /////////////////////////////////////////////////////////////// + // CTreeView manages a tree view control. A tree-view control + // is a window that displays a hierarchical list of items, + // such as the headings in a document, the entries in an index, + // or the files and directories on a disk. + class CTreeView : public CWnd + { + public: + CTreeView() = default; + virtual ~CTreeView() override = default; + virtual void PreRegisterClass(WNDCLASS& wc) override; + + // Accessors and mutators + COLORREF GetBkColor() const; + HTREEITEM GetChild(HTREEITEM item) const; + UINT GetCount() const; + HTREEITEM GetDropHiLightItem() const; + HWND GetEditControl() const; + HTREEITEM GetFirstVisible() const; + CImageList GetImageList(int imageType) const; + UINT GetIndent() const; + COLORREF GetInsertMarkColor() const; + BOOL GetItem(TVITEM& itemInfo) const; + DWORD_PTR GetItemData(HTREEITEM item) const; + int GetItemHeight() const; + BOOL GetItemImage(HTREEITEM item, int& image, int& selectedImage ) const; + BOOL GetItemRect(HTREEITEM item, RECT& rc, BOOL isTextOnly) const; + CRect GetItemRect(HTREEITEM item, BOOL isTextOnly) const; + CString GetItemText(HTREEITEM item, int textMax = 260) const; + HTREEITEM GetLastVisible() const; + HTREEITEM GetNextItem(HTREEITEM item, UINT code) const; + HTREEITEM GetNextSibling(HTREEITEM item) const; + HTREEITEM GetNextVisible(HTREEITEM item) const; + HTREEITEM GetParentItem(HTREEITEM item) const; + HTREEITEM GetPrevSibling(HTREEITEM item) const; + HTREEITEM GetPrevVisible(HTREEITEM item) const; + HTREEITEM GetRootItem() const; + int GetScrollTime() const; + HTREEITEM GetSelection() const; + COLORREF GetTextColor() const; + HWND GetToolTips() const; + UINT GetVisibleCount() const; + BOOL ItemHasChildren(HTREEITEM item) const; + COLORREF SetBkColor(COLORREF color) const; + CImageList SetImageList(HIMAGELIST images, int type = TVSIL_NORMAL); + void SetIndent(int indent) const; + BOOL SetInsertMark(HTREEITEM item, BOOL after = TRUE) const; + COLORREF SetInsertMarkColor(COLORREF color) const; + BOOL SetItem(TVITEM& itemInfo) const; + BOOL SetItem(HTREEITEM item, UINT mask, LPCTSTR text, int image, + int selectedImage, UINT state, UINT stateMask, LPARAM lparam) const; + BOOL SetItemData(HTREEITEM item, DWORD_PTR data) const; + int SetItemHeight(SHORT cy) const; + BOOL SetItemImage(HTREEITEM item, int image, int selectedImage) const; + BOOL SetItemText(HTREEITEM item, LPCTSTR text) const; + UINT SetScrollTime(UINT scrollTime) const; + COLORREF SetTextColor(COLORREF color) const; + HWND SetToolTips(HWND toolTip) const; + + // Operations + CImageList CreateDragImage(HTREEITEM item) const; + BOOL DeleteAllItems() const; + BOOL DeleteItem(HTREEITEM item) const; + HWND EditLabel(HTREEITEM item) const; + BOOL EndEditLabelNow(BOOL cancel) const; + BOOL EnsureVisible(HTREEITEM item) const; + BOOL Expand(HTREEITEM hItem, UINT code) const; + HTREEITEM HitTest(TVHITTESTINFO& hitInfo) const; + HTREEITEM InsertItem(TVINSERTSTRUCT& insertInfo) const; + HTREEITEM InsertItem(UINT mask, LPCTSTR text, int image, + int selectedImage, UINT state, UINT stateMask, LPARAM lparam, + HTREEITEM parent, HTREEITEM insertAfter) const; + HTREEITEM InsertItem(LPCTSTR text, HTREEITEM parent = TVI_ROOT, + HTREEITEM insertAfter = TVI_LAST) const; + HTREEITEM InsertItem(LPCTSTR text, int image, int selectedImage, + HTREEITEM parent = TVI_ROOT, HTREEITEM insertAfter = TVI_LAST) const; + BOOL Select(HTREEITEM item, UINT flag) const; + BOOL SelectDropTarget(HTREEITEM item) const; + BOOL SelectItem(HTREEITEM item) const; + BOOL SelectSetFirstVisible(HTREEITEM item) const; + BOOL SortChildren(HTREEITEM item, BOOL recurse) const; + BOOL SortChildrenCB(TVSORTCB* pSortFn, BOOL recurse) const; + + private: + CTreeView(const CTreeView&) = delete; + CTreeView& operator=(const CTreeView&) = delete; + + CImageList m_normalImages; + CImageList m_stateImages; + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + /////////////////////////////////////// + // Definitions for the CTreeView class. + // + + // Creates a dragging bitmap for the specified item in a tree-view control. + // It also creates an image list for the bitmap and adds the bitmap to the + // image list. + // Refer to TreeView_CreateDragImage in the Windows API documentation for more information. + inline CImageList CTreeView::CreateDragImage(HTREEITEM item) const + { + assert(IsWindow()); + CImageList images; + images.CreateDragImage(*this, item); + return images; + } + + // Deletes all items from a tree-view control. + // Refer to TreeView_DeleteAllItems in the Windows API documentation for more information. + inline BOOL CTreeView::DeleteAllItems() const + { + assert(IsWindow()); + return TreeView_DeleteAllItems(*this); + } + + // Removes an item and all its children from a tree-view control. + // Refer to TreeView_DeleteItem in the Windows API documentation for more information. + inline BOOL CTreeView::DeleteItem(HTREEITEM item) const + { + assert(IsWindow()); + return TreeView_DeleteItem(*this, item); + } + + // Begins in-place editing of the specified item's text, replacing the text + // of the item with a single-line edit control containing the text. + // The specified item is implicitly selected and focused. + // Refer to TreeView_EditLabel in the Windows API documentation for more information. + inline HWND CTreeView::EditLabel(HTREEITEM item) const + { + assert(IsWindow()); + return TreeView_EditLabel(*this, item); + } + + // Ends the editing of a tree-view item's label. + // Refer to TreeView_EndEditLabelNow in the Windows API documentation for more information. + inline BOOL CTreeView::EndEditLabelNow(BOOL cancel) const + { + assert(IsWindow()); + return TreeView_EndEditLabelNow(*this, cancel); + } + + // Ensures that a tree-view item is visible, expanding the parent item or + // scrolling the tree-view control, if necessary. + // Refer to TreeView_EnsureVisible in the Windows API documentation for more information. + inline BOOL CTreeView::EnsureVisible(HTREEITEM item) const + { + assert(IsWindow()); + return TreeView_EnsureVisible(*this, item); + } + + // The TreeView_Expand macro expands or collapses the list of child items + // associated with the specified parent item, if any. + // Refer to TreeView_Expand in the Windows API documentation for more information. + inline BOOL CTreeView::Expand(HTREEITEM item, UINT code) const + { + assert(IsWindow()); + return TreeView_Expand(*this, item, code); + } + + // Retrieves the current background color of the control. + // Refer to TreeView_GetBkColor in the Windows API documentation for more information. + inline COLORREF CTreeView::GetBkColor() const + { + assert(IsWindow()); + return TreeView_GetBkColor( *this ); + } + + // Retrieves the first child item of the specified tree-view item. + // Refer to TreeView_GetChild in the Windows API documentation for more information. + inline HTREEITEM CTreeView::GetChild(HTREEITEM item) const + { + assert(IsWindow()); + return TreeView_GetChild(*this, item); + } + + // Retrieves a count of the items in a tree-view control. + // Refer to TreeView_GetCount in the Windows API documentation for more information. + inline UINT CTreeView::GetCount() const + { + assert(IsWindow()); + return TreeView_GetCount( *this ); + } + + // Retrieves the tree-view item that is the target of a drag-and-drop + // operation. + // Refer to TreeView_GetDropHilight in the Windows API documentation for more information. + inline HTREEITEM CTreeView::GetDropHiLightItem() const + { + assert(IsWindow()); + return TreeView_GetDropHilight(*this); + } + + // Retrieves the handle to the edit control being used to edit a tree-view + // item's text. + // Refer to TreeView_GetEditControl in the Windows API documentation for more information. + inline HWND CTreeView::GetEditControl() const + { + assert(IsWindow()); + return TreeView_GetEditControl(*this); + } + + // Retrieves the first visible item in a tree-view control window. + // Refer to TreeView_GetFirstVisible in the Windows API documentation for more information. + inline HTREEITEM CTreeView::GetFirstVisible() const + { + assert(IsWindow()); + return TreeView_GetFirstVisible(*this); + } + + // Retrieves the handle to the normal or state image list associated with + // a tree-view control. + // Refer to TreeView_GetImageList in the Windows API documentation for more information. + inline CImageList CTreeView::GetImageList(int imageType) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(imageType); + HIMAGELIST images = TreeView_GetImageList( *this, wparam); + return CImageList(images); + } + + // Retrieves the amount, in pixels, that child items are indented relative + // to their parent items. + // Refer to TreeView_GetIndent in the Windows API documentation for more information. + inline UINT CTreeView::GetIndent() const + { + assert(IsWindow()); + return TreeView_GetIndent( *this ); + } + + // Retrieves the color used to draw the insertion mark for the tree view. + // Refer to TreeView_GetInsertMarkColor in the Windows API documentation for more information. + inline COLORREF CTreeView::GetInsertMarkColor() const + { + assert(IsWindow()); + return TreeView_GetInsertMarkColor( *this ); + } + + // Retrieves some or all of a tree-view item's attributes. + // Refer to TreeView_GetItem in the Windows API documentation for more information. + inline BOOL CTreeView::GetItem(TVITEM& itemInfo) const + { + assert(IsWindow()); + return TreeView_GetItem( *this, &itemInfo ); + } + + // Retrieves a tree-view item's application data. + // Refer to TreeView_GetItem in the Windows API documentation for more information. + inline DWORD_PTR CTreeView::GetItemData(HTREEITEM item) const + { + assert(IsWindow()); + + TVITEM tvi = {}; + tvi.mask = TVIF_PARAM; + tvi.hItem = item; + SendMessage(TVM_GETITEM, 0, reinterpret_cast(&tvi)); + return static_cast(tvi.lParam); + } + + // Retrieves the current height of the tree-view item. + // Refer to TreeView_GetItemHeight in the Windows API documentation for more information. + inline int CTreeView::GetItemHeight() const + { + assert(IsWindow()); + return TreeView_GetItemHeight( *this ); + } + + // Retrieves the index of the tree-view item's image and selected image. + // Refer to TreeView_GetItem in the Windows API documentation for more information. + inline BOOL CTreeView::GetItemImage(HTREEITEM item, int& image, int& selectedImage ) const + { + assert(IsWindow()); + + TVITEM tvi = {}; + tvi.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE; + tvi.hItem = item; + BOOL result = TreeView_GetItem( *this, &tvi ); + image = tvi.iImage; + selectedImage = tvi.iSelectedImage; + return result; + } + + // Retrieves the bounding rectangle for a tree-view item and indicates + // whether the item is visible. + // Refer to TreeView_GetItemRect in the Windows API documentation for more information. + inline BOOL CTreeView::GetItemRect(HTREEITEM item, RECT& rc, BOOL isTextOnly) const + { + assert(IsWindow()); + + // As per the Microsoft's recommendation for handling TVM_GETITEMRECT. + *reinterpret_cast(&rc) = item; + WPARAM wparam = static_cast(isTextOnly); + LPARAM lparam = reinterpret_cast(&rc); + return static_cast(SendMessage(TVM_GETITEMRECT, wparam, lparam)); + } + + // Retrieves the bounding rectangle for a tree-view item and indicates + // whether the item is visible. + // Refer to TreeView_GetItemRect in the Windows API documentation for more information. + inline CRect CTreeView::GetItemRect(HTREEITEM item, BOOL isTextOnly) const + { + assert(IsWindow()); + CRect rc; + + // As per the Microsoft's recommendation for handling TVM_GETITEMRECT. + *reinterpret_cast(&rc) = item; + WPARAM wparam = static_cast(isTextOnly); + LPARAM lparam = reinterpret_cast(&rc); + SendMessage(TVM_GETITEMRECT, wparam, lparam); + return rc; + } + + // Retrieves the text for a tree-view item. + // Note: Although the tree-view control allows any length string to be stored + // as item text, only the first 260 characters are displayed. + // Refer to TVM_GETITEM in the Windows API documentation for more information. + inline CString CTreeView::GetItemText(HTREEITEM item, int textMax /* = 260 */) const + { + assert(IsWindow()); + + CString str; + if (textMax > 0) + { + TVITEM tvi = {}; + tvi.hItem = item; + tvi.mask = TVIF_TEXT; + tvi.cchTextMax = textMax; + tvi.pszText = str.GetBuffer(textMax); + SendMessage(TVM_GETITEM, 0, reinterpret_cast(&tvi)); + str.ReleaseBuffer(); + } + return str; + } + + // Retrieves the last expanded item in a tree-view control. + // This does not retrieve the last item visible in the tree-view window. + // Refer to TreeView_GetLastVisible in the Windows API documentation for more information. + inline HTREEITEM CTreeView::GetLastVisible() const + { + assert(IsWindow()); + return TreeView_GetLastVisible(*this); + } + + // Retrieves the tree-view item that bears the specified relationship to a + // specified item. + // Refer to TreeView_GetNextItem in the Windows API documentation for more information. + inline HTREEITEM CTreeView::GetNextItem(HTREEITEM item, UINT code) const + { + assert(IsWindow()); + return TreeView_GetNextItem( *this, item, code); + } + + // Retrieves the next sibling item of a specified item in a tree-view + // control. + // Refer to TreeView_GetNextSibling in the Windows API documentation for more information. + inline HTREEITEM CTreeView::GetNextSibling(HTREEITEM item) const + { + assert(IsWindow()); + return TreeView_GetNextSibling(*this, item); + } + + // Retrieves the next visible item that follows a specified item in a + // tree-view control. + // Refer to TreeView_GetNextVisible in the Windows API documentation for more information. + inline HTREEITEM CTreeView::GetNextVisible(HTREEITEM item) const + { + assert(IsWindow()); + return TreeView_GetNextVisible(*this, item); + } + + // Retrieves the parent item of the specified tree-view item. + // Refer to TreeView_GetParent in the Windows API documentation for more information. + inline HTREEITEM CTreeView::GetParentItem(HTREEITEM item) const + { + assert(IsWindow()); + return TreeView_GetParent(*this, item); + } + + // Retrieves the previous sibling item of a specified item in a tree-view + // control. + // Refer to TreeView_GetPrevSibling in the Windows API documentation for more information. + inline HTREEITEM CTreeView::GetPrevSibling(HTREEITEM item) const + { + assert(IsWindow()); + return TreeView_GetPrevSibling(*this, item); + } + + // Retrieves the first visible item that precedes a specified item in a + // tree-view control. + // Refer to TreeView_GetPrevVisible in the Windows API documentation for more information. + inline HTREEITEM CTreeView::GetPrevVisible(HTREEITEM item) const + { + assert(IsWindow()); + return TreeView_GetPrevVisible(*this, item); + } + + // Retrieves the topmost or very first item of the tree-view control. + // Refer to TreeView_GetRoot in the Windows API documentation for more information. + inline HTREEITEM CTreeView::GetRootItem() const + { + assert(IsWindow()); + return TreeView_GetRoot(*this); + } + + // Retrieves the maximum scroll time for the tree-view control. + // Refer to TreeView_GetScrollTime in the Windows API documentation for more information. + inline int CTreeView::GetScrollTime() const + { + assert(IsWindow()); + return static_cast(TreeView_GetScrollTime( *this )); + } + + // Retrieves the currently selected item in a tree-view control. + // Refer to TreeView_GetSelection in the Windows API documentation for more information. + inline HTREEITEM CTreeView::GetSelection() const + { + assert(IsWindow()); + return TreeView_GetSelection(*this); + } + + // Retrieves the current text color of the control. + // Refer to TreeView_GetTextColor in the Windows API documentation for more information. + inline COLORREF CTreeView::GetTextColor() const + { + assert(IsWindow()); + return TreeView_GetTextColor( *this ); + } + + // Retrieves the handle to the child ToolTip control used by a tree-view + // control. + // Refer to TreeView_GetToolTips in the Windows API documentation for more information. + inline HWND CTreeView::GetToolTips() const + { + assert(IsWindow()); + return TreeView_GetToolTips(*this); + } + + // Obtains the number of items that can be fully visible in the client + // window of a tree-view control. + // Refer to TreeView_GetVisibleCount in the Windows API documentation for more information. + inline UINT CTreeView::GetVisibleCount() const + { + assert(IsWindow()); + return TreeView_GetVisibleCount( *this ); + } + + // Determines the location of the specified point relative to the client + // area of a tree-view control. + // Refer to TreeView_HitTest in the Windows API documentation for more information. + inline HTREEITEM CTreeView::HitTest(TVHITTESTINFO& hitInfo) const + { + assert(IsWindow()); + return TreeView_HitTest(*this, &hitInfo); + } + + // Inserts a new item in a tree-view control. + // Refer to TreeView_InsertItem in the Windows API documentation for more information. + inline HTREEITEM CTreeView::InsertItem(TVINSERTSTRUCT& insertInfo) const + { + assert(IsWindow()); + return TreeView_InsertItem(*this, &insertInfo); + } + + // Inserts a new item in a tree-view control. + // Refer to TreeView_InsertItem in the Windows API documentation for more information. + inline HTREEITEM CTreeView::InsertItem(UINT mask, LPCTSTR text, int image, + int selectedImage, UINT state, UINT stateMask, LPARAM lparam, + HTREEITEM parent, HTREEITEM insertAfter) const + { + TVITEM tvi = {}; + tvi.mask = mask; + tvi.iImage = image; + tvi.iSelectedImage = selectedImage; + tvi.state = state; + tvi.stateMask = stateMask; + tvi.lParam = lparam; + tvi.pszText = const_cast(text); + + TVINSERTSTRUCT tvis = {}; + tvis.hParent = parent; + tvis.hInsertAfter = insertAfter; + tvis.item = tvi; + + return InsertItem(tvis); + } + + // Inserts a new item in a tree-view control. + // Refer to TreeView_InsertItem in the Windows API documentation for more information. + inline HTREEITEM CTreeView::InsertItem(LPCTSTR text, HTREEITEM parent, + HTREEITEM insertAfter) const + { + TVITEM tvi = {}; + tvi.mask = TVIF_TEXT; + tvi.pszText = const_cast(text); + + TVINSERTSTRUCT tvis = {}; + tvis.hParent = parent; + tvis.hInsertAfter = insertAfter; + tvis.item = tvi; + + return InsertItem(tvis); + } + + // Inserts a new item in a tree-view control. + // Refer to TreeView_InsertItem in the Windows API documentation for more information. + inline HTREEITEM CTreeView::InsertItem(LPCTSTR text, int image, int selectedImage, + HTREEITEM parent, HTREEITEM insertAfter) const + { + TVITEM tvi = {}; + tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; + tvi.iImage = image; + tvi.iSelectedImage = selectedImage; + tvi.pszText = const_cast(text); + + TVINSERTSTRUCT tvis = {}; + tvis.hParent = parent; + tvis.hInsertAfter = insertAfter; + tvis.item = tvi; + + return InsertItem(tvis); + } + + // Returns true of the tree-view item has one or more children. + // Refer to TreeView_GetChild in the Windows API documentation for more information. + inline BOOL CTreeView::ItemHasChildren(HTREEITEM item) const + { + assert(IsWindow()); + + if (TreeView_GetChild( *this, item)) + return TRUE; + + return FALSE; + } + + inline void CTreeView::PreRegisterClass(WNDCLASS& wc) + { + // Set the Window Class + wc.lpszClassName = WC_TREEVIEW; + } + + // Selects the specified tree-view item, scrolls the item into view, or redraws + // the item in the style used to indicate the target of a drag-and-drop operation. + // Refer to TreeView_Select in the Windows API documentation for more information. + inline BOOL CTreeView::Select(HTREEITEM item, UINT flag) const + { + assert(IsWindow()); + return TreeView_Select(*this, item, flag); + } + + // Redraws a specified tree-view control item in the style used to indicate the + // target of a drag-and-drop operation. + // Refer to TreeView_SelectDropTarget in the Windows API documentation for more information. + inline BOOL CTreeView::SelectDropTarget(HTREEITEM item) const + { + assert(IsWindow()); + return TreeView_SelectDropTarget(*this, item); + } + + // Selects the specified tree-view item. + // Refer to TreeView_SelectItem in the Windows API documentation for more information. + inline BOOL CTreeView::SelectItem(HTREEITEM item) const + { + assert(IsWindow()); + return TreeView_SelectItem(*this, item); + } + + // Scrolls the tree-view control vertically to ensure that the specified item is visible. + // If possible, the specified item becomes the first visible item at the top of the control's window. + // Refer to TreeView_SelectSetFirstVisible in the Windows API documentation for more information. + inline BOOL CTreeView::SelectSetFirstVisible(HTREEITEM item) const + { + assert(IsWindow()); + return TreeView_SelectSetFirstVisible(*this, item); + } + + // Sorts the child items of the specified parent item in a tree-view control. + // Refer to TreeView_SortChildren in the Windows API documentation for more information. + inline BOOL CTreeView::SortChildren(HTREEITEM item, BOOL recurse) const + { + assert(IsWindow()); + return TreeView_SortChildren(*this, item, recurse); + } + + // Sorts tree-view items using an application-defined callback function that compares the items. + // Refer to TreeView_SortChildrenCB in the Windows API documentation for more information. + inline BOOL CTreeView::SortChildrenCB(TVSORTCB* pSortFn, BOOL recurse) const + { + assert(IsWindow()); + return TreeView_SortChildrenCB(*this, pSortFn, recurse); + } + + // Sets the background color of the control. + // Refer to TreeView_SetBkColor in the Windows API documentation for more information. + inline COLORREF CTreeView::SetBkColor(COLORREF color) const + { + assert(IsWindow()); + return TreeView_SetBkColor( *this, color); + } + + // Sets the normal or state image list for a tree-view control + // and redraws the control using the new images. + // Refer to TreeView_SetImageList in the Windows API documentation for more information. + inline CImageList CTreeView::SetImageList(HIMAGELIST images, int type /*= TVSIL_NORMAL*/) + { + assert(IsWindow()); + WPARAM wparam = static_cast(type); + CImageList oldImages = TreeView_SetImageList( *this, images, wparam); + if (type == TVSIL_STATE) + m_stateImages = images; + else + m_normalImages = images; + + return oldImages; + } + + // Sets the width of indentation for a tree-view control + // and redraws the control to reflect the new width. + // Refer to TreeView_SetIndent in the Windows API documentation for more information. + inline void CTreeView::SetIndent(int indent) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(indent); + SendMessage(TVM_SETINDENT, wparam, 0); + } + + // Sets the insertion mark in a tree-view control. + // Refer to TreeView_SetInsertMark in the Windows API documentation for more information. + inline BOOL CTreeView::SetInsertMark(HTREEITEM item, BOOL after/* = TRUE*/) const + { + assert(IsWindow()); + return TreeView_SetInsertMark( *this, item, after ); + } + + // Sets the color used to draw the insertion mark for the tree view. + // Refer to TreeView_SetInsertMarkColor in the Windows API documentation for more information. + inline COLORREF CTreeView::SetInsertMarkColor(COLORREF color) const + { + assert(IsWindow()); + return TreeView_SetInsertMarkColor( *this, color ); + } + + // Sets some or all of a tree-view item's attributes. + // Refer to TreeView_SetItem in the Windows API documentation for more information. + inline BOOL CTreeView::SetItem(TVITEM& item) const + { + assert(IsWindow()); + return TreeView_SetItem( *this, &item); + } + + // Sets some or all of a tree-view item's attributes. + // Refer to TreeView_SetItem in the Windows API documentation for more information. + inline BOOL CTreeView::SetItem(HTREEITEM item, UINT mask, LPCTSTR text, + int image, int selectedImage, UINT state, UINT stateMask, LPARAM lparam) const + { + assert(IsWindow()); + + TVITEM tvi = {}; + tvi.hItem = item; + tvi.mask = mask; + tvi.pszText = const_cast(text); + tvi.iImage = image; + tvi.iSelectedImage = selectedImage; + tvi.state = state; + tvi.stateMask = stateMask; + tvi.lParam = lparam; + return TreeView_SetItem( *this, &tvi ); + } + + // Sets the tree-view item's application data. + // Refer to TreeView_SetItem in the Windows API documentation for more information. + inline BOOL CTreeView::SetItemData(HTREEITEM item, DWORD_PTR data) const + { + assert(IsWindow()); + + TVITEM tvi = {}; + tvi.hItem = item; + tvi.mask = TVIF_PARAM; + tvi.lParam = static_cast(data); + return TreeView_SetItem( *this, &tvi ); + } + + // Sets the height of all the tree-view items. + // Refer to TreeView_SetItemHeight in the Windows API documentation for more information. + inline int CTreeView::SetItemHeight(SHORT cy) const + { + assert(IsWindow()); + return TreeView_SetItemHeight( *this, cy ); + } + + // Sets the tree-view item's application image. + // Refer to TreeView_SetItem in the Windows API documentation for more information. + inline BOOL CTreeView::SetItemImage(HTREEITEM item, int image, int selectedImage) const + { + assert(IsWindow()); + + TVITEM tvi = {}; + tvi.hItem = item; + tvi.iImage = image; + tvi.iSelectedImage = selectedImage; + tvi.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE; + return TreeView_SetItem(*this, &tvi ); + } + + // Sets the tree-view item's application text. + // Refer to TreeView_SetItem in the Windows API documentation for more information. + inline BOOL CTreeView::SetItemText(HTREEITEM item, LPCTSTR text) const + { + assert(IsWindow()); + + TVITEM tvi = {}; + tvi.hItem = item; + tvi.pszText = const_cast(text); + tvi.mask = TVIF_TEXT; + return TreeView_SetItem(*this, &tvi ); + } + + // Sets the maximum scroll time for the tree-view control. + // Refer to TreeView_SetScrollTime in the Windows API documentation for more information. + inline UINT CTreeView::SetScrollTime(UINT scrollTime) const + { + assert(IsWindow()); + return TreeView_SetScrollTime( *this, scrollTime ); + } + + // Sets the text color of the control. + // Refer to TreeView_SetTextColor in the Windows API documentation for more information. + inline COLORREF CTreeView::SetTextColor(COLORREF color) const + { + assert(IsWindow()); + return TreeView_SetTextColor( *this, color ); + } + + // Sets a tree-view control's child ToolTip control. + // Refer to TreeView_SetToolTips in the Windows API documentation for more information. + inline HWND CTreeView::SetToolTips(HWND toolTip) const + { + assert(IsWindow()); + return TreeView_SetToolTips(*this, toolTip); + } + + +} // namespace Win32xx + +#endif // _WIN32XX_TREEVIEW_H_ + diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_webbrowser.h b/packages/media/cpp/packages/Win32xx/include/wxx_webbrowser.h new file mode 100644 index 00000000..ad43c232 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_webbrowser.h @@ -0,0 +1,1320 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + +#ifndef _WIN32XX_WEBBROWSER_H_ +#define _WIN32XX_WEBBROWSER_H_ + +#include "wxx_appcore0.h" +#include +#include + + +namespace Win32xx +{ + /////////////////////////////////////////////////////////////////////// + // This class implements a COM container that hosts an ActiveX control, + // such as internet explorer. + class CAXHost : public IOleInPlaceFrame, public IOleClientSite, + public IOleInPlaceSite, public IOleControlSite, public IDispatch + { + public: + CAXHost(); + virtual ~CAXHost(); + + // CAXHost methods + virtual STDMETHODIMP Activate(); + virtual STDMETHODIMP CreateControl(BSTR clsidName, void** ppUnk); + virtual STDMETHODIMP CreateControl(REFCLSID clsid, void** ppUnk); + virtual STDMETHODIMP Remove(); + virtual STDMETHODIMP SetParent(HWND hWndParent); + virtual STDMETHODIMP SetLocation(int x, int y, int width, int height); + virtual STDMETHODIMP SetVisible(BOOL isVisible); + + // IDispatch Methods + virtual STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR** names, + unsigned int namesCount, LCID lcid, DISPID* pID) override; + virtual STDMETHODIMP GetTypeInfo(unsigned int itinfo, LCID lcid, ITypeInfo** pptinfo) override; + virtual STDMETHODIMP GetTypeInfoCount(unsigned int* pctinfo) override; + virtual STDMETHODIMP Invoke(DISPID dispID, REFIID riid, LCID lcid, WORD flags, + DISPPARAMS* pParams, VARIANT* result, EXCEPINFO* pExecInfo, + unsigned int* pArgErr) override; + + // IOleClientSite Methods + virtual STDMETHODIMP GetContainer(LPOLECONTAINER* ppContainer) override; + virtual STDMETHODIMP GetMoniker(DWORD assign, DWORD whichMoniker, LPMONIKER* ppMk) override; + virtual STDMETHODIMP OnShowWindow(BOOL show) override; + virtual STDMETHODIMP RequestNewObjectLayout() override; + virtual STDMETHODIMP SaveObject() override; + virtual STDMETHODIMP ShowObject() override; + + // IOleControlSite Methods + virtual STDMETHODIMP GetExtendedControl(IDispatch** ppDisp) override; + virtual STDMETHODIMP LockInPlaceActive(BOOL lock) override; + virtual STDMETHODIMP OnControlInfoChanged() override; + virtual STDMETHODIMP OnFocus(BOOL gotFocus) override; + virtual STDMETHODIMP ShowPropertyFrame() override; + virtual STDMETHODIMP TransformCoords(POINTL* pHimetric, POINTF* pContainer, DWORD flags) override; + virtual STDMETHODIMP TranslateAccelerator(LPMSG pMsg, DWORD modifiers) override; + + // IOleInPlaceFrame Methods + virtual STDMETHODIMP EnableModeless(BOOL enable) override; + virtual STDMETHODIMP InsertMenus(HMENU shared, LPOLEMENUGROUPWIDTHS pMenuWidths) override; + virtual STDMETHODIMP RemoveMenus(HMENU shared) override; + virtual STDMETHODIMP SetMenu(HMENU shared, HOLEMENU holemenu, HWND activeObject) override; + virtual STDMETHODIMP SetStatusText(LPCOLESTR pStatusText) override; + virtual STDMETHODIMP TranslateAccelerator(LPMSG pMsg, WORD id) override; + + // IOleInPlaceSite Methods + virtual STDMETHODIMP CanInPlaceActivate() override; + virtual STDMETHODIMP DeactivateAndUndo() override; + virtual STDMETHODIMP DiscardUndoState() override; + virtual STDMETHODIMP GetWindowContext(IOleInPlaceFrame** ppFrame, + IOleInPlaceUIWindow** ppDoc, LPRECT pRect, LPRECT pClipRect, + LPOLEINPLACEFRAMEINFO pFrameInfo) override; + virtual STDMETHODIMP OnInPlaceActivate() override; + virtual STDMETHODIMP OnInPlaceDeactivate() override; + virtual STDMETHODIMP OnPosRectChange(LPCRECT pRect) override; + virtual STDMETHODIMP OnUIActivate() override; + virtual STDMETHODIMP OnUIDeactivate(BOOL undoable) override; + virtual STDMETHODIMP Scroll(SIZE scrollExtent) override; + + // IOleInPlaceUIWindow Methods + virtual STDMETHODIMP GetBorder(LPRECT pBorderRect) override; + virtual STDMETHODIMP RequestBorderSpace(LPCBORDERWIDTHS pBorderWidths) override; + virtual STDMETHODIMP SetBorderSpace(LPCBORDERWIDTHS pBorderWidths) override; + virtual STDMETHODIMP SetActiveObject(IOleInPlaceActiveObject* pActiveObject, + LPCOLESTR pObjName) override; + + // IOleWindow Methods + virtual STDMETHODIMP ContextSensitiveHelp(BOOL enterMode) override; + virtual STDMETHODIMP GetWindow(HWND* pHwnd) override; + + // IUnknown Methods + virtual STDMETHODIMP_(ULONG) AddRef() override; + virtual STDMETHODIMP QueryInterface(REFIID riid, void** ppObject) override; + virtual STDMETHODIMP_(ULONG) Release() override; + + private: + HWND m_hwnd; // window handle of the container + IUnknown* m_pUnk; // IUnknown of contained object + CRect m_controlRect; // size of control + }; + + + //////////////////////////////////////////////////////// + // This class provides the functionality of a WebBrower, + // using the IWebBrower2 interface. + class CWebBrowser : public CWnd + { + public: + CWebBrowser(); + virtual ~CWebBrowser() override; + + // Accessors + virtual CAXHost* GetAXHost() { return &m_axHost; } + + LPDISPATCH GetApplication() const; + BOOL GetBusy() const; + LPDISPATCH GetContainer() const; + LPDISPATCH GetDocument() const; + BOOL GetFullScreen() const; + long GetHeight() const; + IWebBrowser2* GetIWebBrowser2() const { return m_pIWebBrowser2; } + long GetLeft() const; + CString GetLocationName() const; + CString GetLocationURL() const; + BOOL GetOffline() const; + LPDISPATCH GetParent() const; + VARIANT GetProperty(LPCTSTR propertyName) const; + READYSTATE GetReadyState() const; + BOOL GetRegisterAsBrowser() const; + BOOL GetTheaterMode() const; + long GetTop() const; + BOOL GetTopLevelContainer() const; + CString GetType() const; + BOOL GetVisible() const; + long GetWidth() const; + HRESULT SetFullScreen(BOOL isFullScreen) const; + HRESULT SetHeight(long height) const; + HRESULT SetLeft(long leftEdge) const; + HRESULT SetOffline(BOOL isOffline) const; + HRESULT SetRegisterAsBrowser(BOOL isBrowser) const; + HRESULT SetTheaterMode(BOOL isTheaterMode) const; + HRESULT SetTop(long topEdge) const; + HRESULT SetVisible(BOOL isVisible) const; + HRESULT SetWidth(long width) const; + + // Operations + HRESULT AddWebBrowserControl(); + HRESULT ExecWB(OLECMDID cmdID, OLECMDEXECOPT cmdExecOpt, VARIANT* pIn, VARIANT* pOut) const; + HRESULT GoBack() const; + HRESULT GoForward() const; + HRESULT GoHome() const; + HRESULT GoSearch() const; + HRESULT Navigate(LPCTSTR URL, DWORD flags = 0, LPCTSTR targetFrameName = nullptr, + LPCTSTR headers = nullptr, LPVOID pPostData = nullptr, DWORD postDataLen = 0) const; + HRESULT Navigate2(LPITEMIDLIST pIDL, DWORD flags = 0, LPCTSTR targetFrameName = nullptr) const; + HRESULT Navigate2(LPCTSTR URL, DWORD flags = 0, LPCTSTR targetFrameName = nullptr, + LPCTSTR headers = nullptr, LPVOID pPostData = nullptr, DWORD postDataLen = 0) const; + HRESULT PutProperty(LPCTSTR propertyName, const VARIANT& value) const; + HRESULT PutProperty(LPCTSTR propertyName, double value) const; + HRESULT PutProperty(LPCTSTR propertyName, long value) const; + HRESULT PutProperty(LPCTSTR propertyName, LPCTSTR value) const; + HRESULT PutProperty(LPCTSTR propertyName, short value) const; + HRESULT Refresh() const; + HRESULT Refresh2(int evel) const; + HRESULT Stop() const; + + protected: + // Override these as required + virtual void OnAttach() override; + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual void OnDestroy() override; + virtual void OnSize(int width, int height); + virtual void PreCreate(CREATESTRUCT& cs) override; + + // Not intended to be overridden + LRESULT WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) override; + + private: + CWebBrowser(const CWebBrowser&) = delete; + CWebBrowser& operator=(const CWebBrowser&) = delete; + + UINT GetPidlLength(LPITEMIDLIST pidl) const; + CAXHost m_axHost; // The ActiveX host. + IWebBrowser2* m_pIWebBrowser2; // Interface to the ActiveX web browser control. + }; + +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +namespace Win32xx +{ + + ///////////////////////////////////// + // Definitions for the CAXHost class. + // + + inline CAXHost::CAXHost() : m_hwnd(nullptr), m_pUnk(nullptr) + { + } + + inline CAXHost::~CAXHost() + { + if (m_pUnk) + m_pUnk->Release(); + } + + // Activates the hosted control, along with any of its UI tools. + inline STDMETHODIMP CAXHost::Activate() + { + HRESULT hr = E_FAIL; + if (m_pUnk) + { + IOleObject* pObject = nullptr; + VERIFY(SUCCEEDED(hr = m_pUnk->QueryInterface(IID_IOleObject, + reinterpret_cast(&pObject)))); + + if (pObject) + { + VERIFY(SUCCEEDED(hr = pObject->DoVerb(OLEIVERB_UIACTIVATE, + nullptr, this, 0, m_hwnd, &m_controlRect))); + + pObject->Release(); + } + } + + return hr; + } + + // Creates the hosted control using its CLSID name, and adds it to the + // CAXHost container. + inline STDMETHODIMP CAXHost::CreateControl(BSTR clsidName, void** ppUnk) + { + CLSID clsid; + HRESULT hr; + VERIFY(SUCCEEDED(hr = CLSIDFromString(clsidName, &clsid))); + VERIFY(SUCCEEDED(hr = CreateControl(clsid, ppUnk))); + + return hr; + } + + // Creates the hosted control using its CLSID, and adds it to the + // CAXHost container. + inline STDMETHODIMP CAXHost::CreateControl(REFCLSID clsid, void** ppUnk) + { + HRESULT hr = E_FAIL; + + VERIFY(SUCCEEDED(hr = CoCreateInstance(clsid, nullptr, + CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER, IID_IUnknown, ppUnk))); + m_pUnk = reinterpret_cast(*ppUnk); + if (m_pUnk) + { + IOleObject* pObject = nullptr; + VERIFY(SUCCEEDED(hr = m_pUnk->QueryInterface(IID_IOleObject, + reinterpret_cast(&pObject)))); + if (pObject) + { + VERIFY(SUCCEEDED(hr = pObject->SetClientSite(this))); + pObject->Release(); + + IPersistStreamInit* ppsi = nullptr; + VERIFY(SUCCEEDED(hr = m_pUnk->QueryInterface( + IID_IPersistStreamInit, reinterpret_cast(&ppsi)))); + if (ppsi) + { + VERIFY(SUCCEEDED(hr = ppsi->InitNew())); + ppsi->Release(); + } + } + } + + return hr; + } + + // Sets CAXHost's reference count. + inline STDMETHODIMP_(ULONG) CAXHost::AddRef() + { + // Automatic deletion is not required. + return 1; + } + + // Determines whether or not the container can activate the object in place. + inline STDMETHODIMP CAXHost::CanInPlaceActivate() + { + return S_OK; + } + + // Determines whether context-sensitive help mode should be entered during + // an in-place activation session. + inline STDMETHODIMP CAXHost::ContextSensitiveHelp(BOOL) + { + return E_NOTIMPL; + } + + // Causes the container to end the in-place session, deactivate the object, + // and revert to its own saved undo state. + inline STDMETHODIMP CAXHost::DeactivateAndUndo() + { + return E_NOTIMPL; + } + + // Tells the container that the object no longer has any undo state and that + // the container should not call IOleInPlaceObject::ReActivateAndUndo. + inline STDMETHODIMP CAXHost::DiscardUndoState() + { + return E_NOTIMPL; + } + + // Enables or disables a frame's modeless dialog boxes. + inline STDMETHODIMP CAXHost::EnableModeless(BOOL) + { + return E_NOTIMPL; + } + + // Returns a RECT structure in which the object can put toolbars + // and similar controls while active in place. + inline STDMETHODIMP CAXHost::GetBorder(LPRECT) + { + return E_NOTIMPL; + } + + // Returns a pointer to the container's IOleContainer interface. + inline STDMETHODIMP CAXHost::GetContainer(LPOLECONTAINER*) + { + return E_NOINTERFACE; + } + + // Requests an IDispatch pointer to the extended control that + // the container uses to wrap the real control. + // Call Release on this pointer when it is no longer required. + inline STDMETHODIMP CAXHost::GetExtendedControl(IDispatch** ppDisp) + { + if (ppDisp == nullptr) + return E_INVALIDARG; + + *ppDisp = static_cast(this); + (*ppDisp)->AddRef(); + + return S_OK; + } + + // Maps a single member and an optional set of argument names to + // a corresponding set of integer DISPIDs, that can be used on + // subsequent calls to IDispatch::Invoke. + inline STDMETHODIMP CAXHost::GetIDsOfNames(REFIID, OLECHAR**, unsigned int, + LCID, DISPID* pID) + { + *pID = DISPID_UNKNOWN; + return DISP_E_UNKNOWNNAME; + } + + // Retrieves an embedded object's moniker, that the caller + // can use to link to the object. + inline STDMETHODIMP CAXHost::GetMoniker(DWORD, DWORD, LPMONIKER*) + { + return E_NOTIMPL; + } + + // Retrieves the type information for an object, that can then + // be used to get the type information for the IDispatch interface. + inline STDMETHODIMP CAXHost::GetTypeInfo(unsigned int, LCID, ITypeInfo**) + { + return E_NOTIMPL; + } + + // Retrieves the number of type information interfaces that the IDispatch + // an object provides (either 0 or 1). + inline STDMETHODIMP CAXHost::GetTypeInfoCount(unsigned int*) + { + return E_NOTIMPL; + } + + // Returns the window handle assigned to the CAXHost container. + inline STDMETHODIMP CAXHost::GetWindow(HWND* pHwnd) + { + if (!IsWindow(m_hwnd)) + return S_FALSE; + + *pHwnd = m_hwnd; + return S_OK; + } + + // Enables the in - place object to retrieve the window interfaces that + // form the window object hierarchy, and the position in the parent + // window where the object's in-place activation window should be placed. + // Call Release on ppFrame when it is no longer required. + inline STDMETHODIMP CAXHost::GetWindowContext (IOleInPlaceFrame** ppFrame, + IOleInPlaceUIWindow** ppIIPUIWin, LPRECT pRect, LPRECT pClipRect, + LPOLEINPLACEFRAMEINFO pFrameInfo) + { + *ppFrame = (IOleInPlaceFrame*)this; + *ppIIPUIWin = nullptr; + + RECT rect; + VERIFY(::GetClientRect(m_hwnd, &rect)); + pRect->left = 0; + pRect->top = 0; + pRect->right = rect.right; + pRect->bottom = rect.bottom; + + CopyRect(pClipRect, pRect); + + pFrameInfo->cb = sizeof(OLEINPLACEFRAMEINFO); + pFrameInfo->fMDIApp = FALSE; + pFrameInfo->hwndFrame = m_hwnd; + pFrameInfo->haccel = 0; + pFrameInfo->cAccelEntries = 0; + + (*ppFrame)->AddRef(); + return S_OK; + } + + // Allows the container to insert its menu groups into the composite menu + // to be used during the in-place session. + inline STDMETHODIMP CAXHost::InsertMenus(HMENU, LPOLEMENUGROUPWIDTHS) + { + return E_NOTIMPL; + } + + // Provides access to properties and methods exposed by the container. + inline STDMETHODIMP CAXHost::Invoke(DISPID, REFIID, LCID, + WORD, DISPPARAMS*, VARIANT*, EXCEPINFO*, unsigned int*) + { + return DISP_E_MEMBERNOTFOUND; + } + + // Indicates whether or not a control should remain in-place active. + inline STDMETHODIMP CAXHost::LockInPlaceActive(BOOL) + { + return E_NOTIMPL; + } + + // Informs the container that the control's CONTROLINFO structure + // has changed and that the container should call the control's + // IOleControl::GetControlInfo for an update. + inline STDMETHODIMP CAXHost::OnControlInfoChanged() + { + return E_NOTIMPL; + } + + // Indicates whether the control managed by this control site has + // gained or lost the focus, according to the fGotFocus parameter. + inline STDMETHODIMP CAXHost::OnFocus(BOOL) + { + return E_NOTIMPL; + } + + // Notifies the container that one of its objects is being activated + // in place. + inline STDMETHODIMP CAXHost::OnInPlaceActivate() + { + return S_OK; + } + + // Notifies the container that the object is no longer active in place. + inline STDMETHODIMP CAXHost::OnInPlaceDeactivate() + { + return S_OK; + } + + // Indicates the object's extents have changed. + inline STDMETHODIMP CAXHost::OnPosRectChange(LPCRECT) + { + return S_OK; + } + + // Notifies a container when an embedded object's window is + // about to become visible or invisible. + inline STDMETHODIMP CAXHost::OnShowWindow(BOOL) + { + return S_OK; + } + + // Notifies the container that the object is about to be activated + // in place and that the object is going to replace the container's + // main menu with an in-place composite menu. + inline STDMETHODIMP CAXHost::OnUIActivate() + { + return S_OK; + } + + // Notifies the container on deactivation that it should reinstall + // its user interface and take focus, and whether or not the object + // has an undoable state. + inline STDMETHODIMP CAXHost::OnUIDeactivate(BOOL) + { + return E_NOTIMPL; + } + + // Returns a pointer to the specified interface on an object. + // Call Release on this pointer when it is no longer required. + inline STDMETHODIMP CAXHost::QueryInterface(REFIID riid, void** ppObject) + { + if (!ppObject) + return E_POINTER; + + if (IsEqualIID(riid, IID_IOleInPlaceFrame)) + *ppObject = static_cast(this); + else if (IsEqualIID(riid, IID_IOleInPlaceSite)) + *ppObject = static_cast(this); + else if (IsEqualIID(riid, IID_IOleClientSite)) + *ppObject = static_cast(this); + else if (IsEqualIID(riid, IID_IOleControlSite)) + *ppObject = static_cast(this); + else if (IsEqualIID(riid, IID_IDispatch)) + *ppObject = static_cast(this); + else if (IsEqualIID(riid, IID_IUnknown)) + *ppObject = static_cast(static_cast(this)); + else + { + *ppObject = nullptr; + return E_NOINTERFACE; + } + + AddRef(); + return S_OK; + } + + // Sets CAXHost's reference count. + inline STDMETHODIMP_(ULONG) CAXHost::Release() + { + // Automatic deletion is not required. + return 1; + } + + // Removes the hosted control from the CAXHost container. + inline STDMETHODIMP CAXHost::Remove() + { + HRESULT hr = E_FAIL; + + if (m_pUnk) + { + IOleInPlaceObject* pipo = nullptr; + VERIFY(SUCCEEDED(hr = m_pUnk->QueryInterface(IID_IOleInPlaceObject, + reinterpret_cast(&pipo)))); + + if (pipo) + { + VERIFY(SUCCEEDED(hr = pipo->UIDeactivate())); + VERIFY(SUCCEEDED(hr = pipo->InPlaceDeactivate())); + pipo->Release(); + } + + IOleObject* pObject = nullptr; + VERIFY(SUCCEEDED(hr = m_pUnk->QueryInterface(IID_IOleObject, + reinterpret_cast(&pObject)))); + + if (pObject) + { + VERIFY(SUCCEEDED(hr = pObject->Close(OLECLOSE_NOSAVE))); + VERIFY(SUCCEEDED(hr = pObject->SetClientSite(nullptr))); + pObject->Release(); + } + } + + return hr; + } + + // Gives the container a chance to remove its menu elements from the + // in-place composite menu. + inline STDMETHODIMP CAXHost::RemoveMenus(HMENU) + { + return E_NOTIMPL; + } + + // Determines if there is available space for tools to be installed around + // the object's window frame while the object is active in place. + inline STDMETHODIMP CAXHost::RequestBorderSpace(LPCBORDERWIDTHS) + { + return E_NOTIMPL; + } + + // Asks container to allocate more or less space for displaying an + // embedded object. + inline STDMETHODIMP CAXHost::RequestNewObjectLayout() + { + return E_NOTIMPL; + } + + // Saves the object associated with the client site. + inline STDMETHODIMP CAXHost::SaveObject() + { + return E_NOTIMPL; + } + + // Tells the container to scroll the view of the object by a specified + // number of pixels. + inline STDMETHODIMP CAXHost::Scroll(SIZE) + { + return E_NOTIMPL; + } + + // Provides a direct channel of communication between the object and each + // of the frame and document windows. + inline STDMETHODIMP CAXHost::SetActiveObject(IOleInPlaceActiveObject*, LPCOLESTR) + { + return E_NOTIMPL; + } + + // Allocates space for the border requested in the call to + // IOleInPlaceUIWindow::RequestBorderSpace. + inline STDMETHODIMP CAXHost::SetBorderSpace(LPCBORDERWIDTHS) + { + return E_NOTIMPL; + } + + // Displays the specified portion of the hosted control. + inline STDMETHODIMP CAXHost::SetLocation(int x, int y, int width, int height) + { + m_controlRect.SetRect(x, y, x + width, y + height); + + HRESULT hr = E_FAIL; + if (m_pUnk) + { + IOleInPlaceObject* pipo = nullptr; + VERIFY(SUCCEEDED(hr = m_pUnk->QueryInterface(IID_IOleInPlaceObject, + reinterpret_cast(&pipo)))); + + if (pipo) + { + VERIFY(SUCCEEDED(hr = pipo->SetObjectRects(&m_controlRect, &m_controlRect))); + pipo->Release(); + } + } + + return hr; + } + + // Installs the composite menu in the window frame containing the object + // being activated in place. + inline STDMETHODIMP CAXHost::SetMenu(HMENU, HOLEMENU, HWND) + { + return E_NOTIMPL; + } + + // Assigns the specified window handle to the CAXHost container. + inline STDMETHODIMP CAXHost::SetParent(HWND hWndParent) + { + m_hwnd = hWndParent; + return S_OK; + } + + // Sets and displays status text about the in-place object in the + // container's frame window status line. + inline STDMETHODIMP CAXHost::SetStatusText(LPCOLESTR pStatusText) + { + if (pStatusText == nullptr) + return E_POINTER; + + return S_OK; + } + + // Shows or hides the hosted control. + inline STDMETHODIMP CAXHost::SetVisible(BOOL isVisible) + { + HRESULT hr = E_FAIL; + if (m_pUnk) + { + IOleObject* pObject = nullptr; + VERIFY(SUCCEEDED(hr = m_pUnk->QueryInterface(IID_IOleObject, + reinterpret_cast(&pObject)))); + + if (pObject) + { + if (isVisible) + { + VERIFY(SUCCEEDED(hr = pObject->DoVerb( + OLEIVERB_INPLACEACTIVATE, nullptr, this, 0, m_hwnd, + &m_controlRect))); + VERIFY(SUCCEEDED(hr = pObject->DoVerb(OLEIVERB_SHOW, + nullptr, this, 0, m_hwnd, &m_controlRect))); + } + else + VERIFY(SUCCEEDED(hr = pObject->DoVerb(OLEIVERB_HIDE, + nullptr, this, 0, m_hwnd, nullptr))); + + pObject->Release(); + } + } + + return hr; + } + + // Tells the container to position the object so it is visible to the user. + // This method ensures that the container itself is visible and not + // minimized. + inline STDMETHODIMP CAXHost::ShowObject() + { + return S_OK; + } + + // Instructs a container to display a property sheet for the control + // embedded in this site. + inline STDMETHODIMP CAXHost::ShowPropertyFrame() + { + return E_NOTIMPL; + } + + // Converts between a POINTL structure expressed in HIMETRIC units + // (as is standard in OLE) and a POINTF structure expressed in units + // specified by the container. + inline STDMETHODIMP CAXHost::TransformCoords(POINTL*, POINTF*, DWORD) + { + return E_NOTIMPL; + } + + // Translates accelerator keystrokes intended for the container's frame + // while an object is active in place. + inline STDMETHODIMP CAXHost::TranslateAccelerator(LPMSG, WORD) + { + return S_OK; + } + + // Instructs the control site to process the keystroke described in + // pMsg modified by the flags in modifiers. + inline STDMETHODIMP CAXHost::TranslateAccelerator(LPMSG, DWORD) + { + return S_FALSE; + } + + + ///////////////////////////////////////// + // Definitions for the CWebBrowser class. + // + + inline CWebBrowser::CWebBrowser() : m_pIWebBrowser2(0) + { + } + + inline CWebBrowser::~CWebBrowser() + { + if (m_pIWebBrowser2) + m_pIWebBrowser2->Release(); + } + + // Adds the IWebBrowser interface to the ActiveX host. + // Refer to IID_IWebBrowser2 in the Windows API documentation for more information. + inline HRESULT CWebBrowser::AddWebBrowserControl() + { + IUnknown* pUnk = nullptr; + VERIFY(SUCCEEDED(GetAXHost()->CreateControl(CLSID_WebBrowser, (void**)&pUnk))); + VERIFY(SUCCEEDED(GetAXHost()->SetParent(*this))); + VERIFY(SUCCEEDED(GetAXHost()->SetVisible(TRUE))); + VERIFY(SUCCEEDED(GetAXHost()->Activate())); + + HRESULT hr = E_FAIL; + if (pUnk) + { + // Store the pointer to the WebBrowser control + VERIFY(SUCCEEDED(hr = pUnk->QueryInterface(IID_IWebBrowser2, + reinterpret_cast(&m_pIWebBrowser2)))); + + // Navigate to an empty page + VERIFY(SUCCEEDED(hr = Navigate(_T("about:blank")))); + } + + return hr; + } + + // Called when the WebBrowser window's HWND is attached this object. + inline void CWebBrowser::OnAttach() + { + if (m_pIWebBrowser2 == nullptr) + VERIFY(SUCCEEDED(AddWebBrowserControl())); + } + + // Called when the web browser window is created. + inline int CWebBrowser::OnCreate(CREATESTRUCT&) + { + VERIFY(SUCCEEDED(AddWebBrowserControl())); + return 0; + } + + // Called when the window is destroyed. + inline void CWebBrowser::OnDestroy() + { + VERIFY(SUCCEEDED(m_pIWebBrowser2->Stop())); + VERIFY(SUCCEEDED(GetAXHost()->Remove())); + } + + // Called when the window is resized. + inline void CWebBrowser::OnSize(int width, int height) + { + // position the container + VERIFY(SUCCEEDED(GetAXHost()->SetLocation(0, 0, width, height))); + } + + // Set the CREATESTURCT parameters before the window is created. + inline void CWebBrowser::PreCreate(CREATESTRUCT& cs) + { + CWnd::PreCreate(cs); + cs.style |= WS_CLIPCHILDREN; + } + + // Provides default message processing for the web browser window. + inline LRESULT CWebBrowser::WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) + { + switch (msg) + { + case WM_SIZE: + OnSize(LOWORD(lparam), HIWORD(lparam)); + break; + } + + return CWnd::WndProcDefault(msg, wparam, lparam); + } + + ////////////////////////////////////////////////// + // Wrappers for the IWebBrowser2 interface + + // Retrieves a pointer to the IDispatch interface for the the application + // that is hosting the WebBrowser Control. + inline LPDISPATCH CWebBrowser::GetApplication() const + { + LPDISPATCH pDispatch = nullptr; + GetIWebBrowser2()->get_Application(&pDispatch); + return pDispatch; + } + + // Retrieves a value that indicates whether the object is engaged in a + // navigation or downloading operation. + inline BOOL CWebBrowser::GetBusy() const + { + VARIANT_BOOL isBusy = VARIANT_FALSE; + GetIWebBrowser2()->get_Busy(&isBusy); + return static_cast(isBusy); + } + + // Retrieves a pointer to the IDispatch interface to a container. This + // property returns the same pointer as GetParent. + inline LPDISPATCH CWebBrowser::GetContainer() const + { + LPDISPATCH pDispatch = nullptr; + GetIWebBrowser2()->get_Container(&pDispatch); + return pDispatch; + } + + // Retrieves a pointer to the IDispatch interface of the active document + // object. Call QueryInterface on the IDispatch received from this property + // get the Component Object Model (COM) interfaces IHTMLDocument, + // IHTMLDocument2, and IHTMLDocument3. + inline LPDISPATCH CWebBrowser::GetDocument() const + { + LPDISPATCH Value = nullptr; + GetIWebBrowser2()->get_Document(&Value); + return Value; + } + + // Retrieves a value that indicates whether Internet Explorer is in + // full-screen mode or normal window mode. + inline BOOL CWebBrowser::GetFullScreen() const + { + VARIANT_BOOL value = VARIANT_FALSE; + GetIWebBrowser2()->get_FullScreen(&value); + return static_cast(value); + } + + // Retrieves the height of the object. + inline long CWebBrowser::GetHeight() const + { + long height = 0; + GetIWebBrowser2()->get_Height(&height); + return height; + } + + // Retrieves the coordinate of the left edge of the object. + inline long CWebBrowser::GetLeft() const + { + long left = 0; + GetIWebBrowser2()->get_Left(&left); + return left; + } + + // Retrieves the path or title of the resource that is currently displayed. + inline CString CWebBrowser::GetLocationName() const + { + BSTR bstr; + GetIWebBrowser2()->get_LocationName(&bstr); + CString str(bstr); + SysFreeString(bstr); + return str; + } + + // Retrieves the URL of the resource that is currently displayed. + inline CString CWebBrowser::GetLocationURL() const + { + BSTR bstr; + GetIWebBrowser2()->get_LocationURL(&bstr); + CString str(bstr); + SysFreeString(bstr); + return str; + } + + // Retrieves a value that indicates whether the object is operating in + // offline mode. + inline BOOL CWebBrowser::GetOffline() const + { + VARIANT_BOOL isOffLine = VARIANT_FALSE; + GetIWebBrowser2()->get_Offline(&isOffLine); + return static_cast(isOffLine); + } + + // Retrieves a pointer to the IDispatch interface of the object that is the + // container of the WebBrowser control. If the WebBrowser control is in a + // frame, this method returns the automation interface of the document + // object in the containing window. Otherwise, it delegates to the + // top-level control, if there is one. + inline LPDISPATCH CWebBrowser::GetParent() const + { + LPDISPATCH pDispatch = nullptr; + GetIWebBrowser2()->get_Parent(&pDispatch); + return pDispatch; + } + + // Retrieves the accumulated length of the ITEMIDLIST. + inline UINT CWebBrowser::GetPidlLength(LPITEMIDLIST pidl) const + { + assert(pidl); + UINT cbPidl = sizeof(pidl->mkid.cb); + while (pidl && pidl->mkid.cb) + { + cbPidl += pidl->mkid.cb; + + // Walk to next item + BYTE* ptr = reinterpret_cast(pidl); + ptr += pidl->mkid.cb; + pidl = reinterpret_cast(ptr); + } + + return cbPidl; + } + + // Retrieves the ready state of the object. + inline READYSTATE CWebBrowser::GetReadyState() const + { + READYSTATE rs = READYSTATE_UNINITIALIZED; + GetIWebBrowser2()->get_ReadyState(&rs); + return rs; + } + + // Retrieves a value that indicates whether the object is registered as a + // top-level browser window. + inline BOOL CWebBrowser::GetRegisterAsBrowser() const + { + VARIANT_BOOL isTopLevel = VARIANT_FALSE; + GetIWebBrowser2()->get_RegisterAsBrowser(&isTopLevel); + return static_cast(isTopLevel); + } + + // Retrieves the theater mode state of the object. + inline BOOL CWebBrowser::GetTheaterMode() const + { + VARIANT_BOOL isTheater = VARIANT_FALSE; + GetIWebBrowser2()->get_TheaterMode(&isTheater); + return static_cast(isTheater); + } + + // Retrieves the coordinate of the top edge of the object. + inline long CWebBrowser::GetTop() const + { + long top; + GetIWebBrowser2()->get_Top(&top); + return top; + } + + //Returns TRUE if the object is a top-level container. + inline BOOL CWebBrowser::GetTopLevelContainer() const + { + VARIANT_BOOL isTop = VARIANT_FALSE; + GetIWebBrowser2()->get_TopLevelContainer(&isTop); + return static_cast(isTop); + } + + // Retrieves the user type name of the contained document object. + inline CString CWebBrowser::GetType() const + { + BSTR bstr; + GetIWebBrowser2()->get_Type(&bstr); + CString str(bstr); + SysFreeString(bstr); + return str; + } + + // Retrieves a value that indicates whether the object is visible or + // hidden. + inline BOOL CWebBrowser::GetVisible() const + { + VARIANT_BOOL isVisible = VARIANT_FALSE; + GetIWebBrowser2()->get_Visible(&isVisible); + return static_cast(isVisible); + } + + // Retrieves the width of the object. + inline long CWebBrowser::GetWidth() const + { + long width = 0; + GetIWebBrowser2()->get_Width(&width); + return width; + } + + // Sets a value that indicates whether Internet Explorer is in + // full-screen mode or normal window mode. + inline HRESULT CWebBrowser::SetFullScreen(BOOL isFullScreen) const + { + VARIANT_BOOL isFS = isFullScreen ? VARIANT_TRUE : VARIANT_FALSE; + return GetIWebBrowser2()->put_FullScreen(isFS); + } + + // Sets the height of the object. + inline HRESULT CWebBrowser::SetHeight(long height) const + { + return GetIWebBrowser2()->put_Height(height); + } + + // Sets the coordinate of the left edge of the object. + inline HRESULT CWebBrowser::SetLeft(long leftEdge) const + { + return GetIWebBrowser2()->put_Left(leftEdge); + } + + // Sets a value that indicates whether the object is operating in offline + // mode. + inline HRESULT CWebBrowser::SetOffline(BOOL isOffline) const + { + VARIANT_BOOL isOL = isOffline ? VARIANT_TRUE : VARIANT_FALSE; + return GetIWebBrowser2()->put_Offline(isOL); + } + + // Sets a value that indicates whether the object is registered as a + // top-level browser window. + inline HRESULT CWebBrowser::SetRegisterAsBrowser(BOOL isBrowser) const + { + VARIANT_BOOL isB = isBrowser ? VARIANT_TRUE : VARIANT_FALSE; + return GetIWebBrowser2()->put_RegisterAsBrowser(isB); + } + + // Sets the theatre mode state of the object. + inline HRESULT CWebBrowser::SetTheaterMode(BOOL isTheaterMode) const + { + VARIANT_BOOL isTM = isTheaterMode ? VARIANT_TRUE : VARIANT_FALSE; + return GetIWebBrowser2()->put_TheaterMode(isTM); + } + + // Sets the coordinate of the top edge of the object. + inline HRESULT CWebBrowser::SetTop(long topEdge) const + { + return GetIWebBrowser2()->put_Top(topEdge); + } + + // Sets a value that indicates whether the object is visible or hidden. + inline HRESULT CWebBrowser::SetVisible(BOOL isVisible) const + { + VARIANT_BOOL isV = isVisible ? VARIANT_TRUE : VARIANT_FALSE; + return GetIWebBrowser2()->put_Visible(isV); + } + + // Sets the width of the object. + inline HRESULT CWebBrowser::SetWidth(long width) const + { + return GetIWebBrowser2()->put_Width(width); + } + + // Executes a command using the IOleCommandTarget interface. + inline HRESULT CWebBrowser::ExecWB(OLECMDID cmdID, OLECMDEXECOPT cmdExecOpt, + VARIANT* in, VARIANT* out) const + { + return GetIWebBrowser2()->ExecWB(cmdID, cmdExecOpt, in, out); + } + + // Gets the value associated with the specified property name. + inline VARIANT CWebBrowser::GetProperty( LPCTSTR propertyName ) const + { + VARIANT v; + GetIWebBrowser2()->GetProperty( TtoBSTR(propertyName), &v ); + return v; + } + + // Navigates backward one item in the history list. + inline HRESULT CWebBrowser::GoBack() const + { + return GetIWebBrowser2()->GoBack(); + } + + // Navigates forward one item in the history list. + inline HRESULT CWebBrowser::GoForward() const + { + return GetIWebBrowser2()->GoForward(); + } + + // Navigates to the current home or start page. + inline HRESULT CWebBrowser::GoHome() const + { + return GetIWebBrowser2()->GoHome(); + } + + // Navigates to the current search page. + inline HRESULT CWebBrowser::GoSearch() const + { + return GetIWebBrowser2()->GoSearch(); + } + + // Navigates to a resource identified by a URL or to a file identified by a + // full path. + inline HRESULT CWebBrowser::Navigate(LPCTSTR URL, DWORD flags /*= 0*/, + LPCTSTR targetFrameName /*= nullptr*/, LPCTSTR headers /*= nullptr*/, + LPVOID pPostData /*= nullptr*/, DWORD postDataLen /*= 0*/) const + { + VARIANT flagsVariant = {}; + flagsVariant.vt = VT_I4; + flagsVariant.lVal = static_cast(flags); + + VARIANT targetVariant = {}; + targetVariant.vt = VT_BSTR; + targetVariant.bstrVal = SysAllocString(TtoW(targetFrameName)); + + SAFEARRAY* psa = SafeArrayCreateVector(VT_UI1, 0, postDataLen); + CopyMemory(psa->pvData, pPostData, postDataLen); + VARIANT dataVariant = {}; + dataVariant.vt = VT_ARRAY|VT_UI1; + dataVariant.parray = psa; + + VARIANT headersVariant = {}; + headersVariant.vt = VT_BSTR; + headersVariant.bstrVal = SysAllocString(TtoW(headers)); + BSTR url = SysAllocString(TtoW(URL)); + HRESULT hr = E_FAIL; + if (url) + hr = GetIWebBrowser2()->Navigate(url, &flagsVariant, &targetVariant, &dataVariant, &headersVariant); + + VariantClear(&flagsVariant); + VariantClear(&targetVariant); + VariantClear(&dataVariant); + VariantClear(&headersVariant); + SysFreeString(url); + + return hr; + } + + // Navigates the browser to a location specified by a pointer to an item + // identifier list (PIDL) for an entity in the Microsoft Windows Shell + // namespace. + inline HRESULT CWebBrowser::Navigate2(LPITEMIDLIST pIDL, DWORD flags /*= 0*/, + LPCTSTR targetFrameName /*= nullptr*/) const + { + UINT cb = GetPidlLength(pIDL); + LPSAFEARRAY pSA = SafeArrayCreateVector(VT_UI1, 0, cb); + VARIANT pidlVariant = {}; + pidlVariant.vt = VT_ARRAY|VT_UI1; + pidlVariant.parray = pSA; + CopyMemory(pSA->pvData, pIDL, cb); + + VARIANT flagsVariant = {}; + flagsVariant.vt = VT_I4; + flagsVariant.lVal = static_cast(flags); + + VARIANT targetVariant = {}; + targetVariant.vt = VT_BSTR; + targetVariant.bstrVal = SysAllocString(TtoW(targetFrameName)); + + HRESULT hr = GetIWebBrowser2()->Navigate2(&pidlVariant, &flagsVariant, &targetVariant, 0, 0); + + VariantClear(&pidlVariant); + VariantClear(&flagsVariant); + VariantClear(&targetVariant); + + return hr; + } + + // Navigates the browser to a location that is expressed as a URL. + inline HRESULT CWebBrowser::Navigate2(LPCTSTR URL, DWORD flags /*= 0*/, + LPCTSTR targetFrameName /*= nullptr*/, LPCTSTR headers /*= nullptr*/, + LPVOID pPostData /*= nullptr*/, DWORD postDataLen /*= 0*/) const + { + VARIANT urlVariant = {}; + urlVariant.vt = VT_BSTR; + urlVariant.bstrVal = SysAllocString(TtoW(URL)); + + VARIANT flagsVariant = {}; + flagsVariant.vt = VT_I4; + flagsVariant.lVal = static_cast(flags); + + VARIANT TargetVariant = {}; + TargetVariant.vt = VT_BSTR; + TargetVariant.bstrVal = SysAllocString(TtoW(targetFrameName)); + + // Store the pidl in a SafeArray, and assign the SafeArray to a VARIANT + SAFEARRAY* psa = SafeArrayCreateVector(VT_UI1, 0, postDataLen); + CopyMemory(psa->pvData, pPostData, postDataLen); + VARIANT dataVariant = {}; + dataVariant.vt = VT_ARRAY|VT_UI1; + dataVariant.parray = psa; + + VARIANT headersVariant = {}; + headersVariant.vt = VT_BSTR; + headersVariant.bstrVal = SysAllocString(TtoW(headers)); + + HRESULT hr = GetIWebBrowser2()->Navigate2(&urlVariant, &flagsVariant, + &TargetVariant, &dataVariant, &headersVariant); + + VariantClear(&urlVariant); + VariantClear(&flagsVariant); + VariantClear(&TargetVariant); + VariantClear(&dataVariant); + VariantClear(&headersVariant); + + return hr; + } + + // Sets the value of a property associated with the object. + inline HRESULT CWebBrowser::PutProperty(LPCTSTR propertyName, const VARIANT& value) const + { + return GetIWebBrowser2()->PutProperty(TtoBSTR(propertyName), value); + } + + // Sets the value of a property associated with the object. + inline HRESULT CWebBrowser::PutProperty(LPCTSTR propertyName, double value) const + { + VARIANT v = {}; + v.vt = VT_I4; + v.dblVal = value; + HRESULT hr = GetIWebBrowser2()->PutProperty(TtoBSTR(propertyName), v); + VariantClear(&v); + return hr; + } + + // Sets the value of a property associated with the object. + inline HRESULT CWebBrowser::PutProperty(LPCTSTR propertyName, long value) const + { + VARIANT v = {}; + v.vt = VT_I4; + v.lVal= value; + HRESULT hr = GetIWebBrowser2()->PutProperty(TtoBSTR(propertyName), v); + VariantClear(&v); + return hr; + } + + // Sets the value of a property associated with the object. + inline HRESULT CWebBrowser::PutProperty(LPCTSTR propertyName, LPCTSTR value) const + { + VARIANT v = {}; + v.vt = VT_BSTR; + v.bstrVal= SysAllocString(TtoW(value)); + HRESULT hr = GetIWebBrowser2()->PutProperty(TtoBSTR(propertyName), v); + VariantClear(&v); + return hr; + } + + // Sets the value of a property associated with the object. + inline HRESULT CWebBrowser::PutProperty(LPCTSTR propertyName, short value) const + { + VARIANT v = {}; + v.vt = VT_I4; + v.iVal = value; + HRESULT hr = GetIWebBrowser2()->PutProperty(TtoBSTR(propertyName), v); + VariantClear(&v); + return hr; + } + + // Reloads the file that is currently displayed in the object. + inline HRESULT CWebBrowser::Refresh() const + { + return GetIWebBrowser2()->Refresh(); + } + + // Reloads the file that is currently displayed with the specified refresh level. + inline HRESULT CWebBrowser::Refresh2(int level) const + { + VARIANT v = {}; + v.vt = VT_I4; + v.intVal = level; + HRESULT hr = GetIWebBrowser2()->Refresh2(&v); + VariantClear(&v); + return hr; + } + + // Cancels a pending navigation or download, and stops dynamic page elements, + // such as background sounds and animations. + inline HRESULT CWebBrowser::Stop() const + { + return GetIWebBrowser2()->Stop(); + } + +} + +#endif // _WIN32XX_WEBBROWSER_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_wincore.h b/packages/media/cpp/packages/Win32xx/include/wxx_wincore.h new file mode 100644 index 00000000..9d34ead9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_wincore.h @@ -0,0 +1,2657 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////// +// wxx_wincore.h +// This file contains the definition of the CWnd class. +// Including this file adds all the code necessary to +// start Win32++ and create simple windows. +// +// Refer to the following example code. +// + + +// Example code +/* + +/////////////////////////////////// +// main.cpp + +// To configure your project: +// 1) Add Win32++'s include directory to the project's additional include directories for C/C++ +// 2) Add Win32++'s include directory to the project's additional include directories for Resources + +#include "wxx_wincore.h" + +// A class that inherits from CWnd. It is used to create the window. +class CView : public CWnd +{ +public: + CView() {} + virtual ~CView() {} + virtual void OnDestroy() { PostQuitMessage(0); } // Ends the program +}; + + +int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR, int) +{ + // Start Win32++ + CWinApp theApp; + + // Create our view window + CView myWin; + myWin.Create(); + + // Run the application's message loop + return theApp.Run(); +} + +*/ + + +#ifndef _WIN32XX_WINCORE_H_ +#define _WIN32XX_WINCORE_H_ + + +// Include the necessary Win32++ header files. +#include "wxx_appcore.h" +#include "wxx_wincore0.h" +#include "wxx_gdi.h" +#include "wxx_imagelist.h" +#include "wxx_menu.h" +#include "wxx_ddx.h" + + +namespace Win32xx +{ + + //////////////////// + // Global Functions. + // + + // Returns the path to the AppData folder. Returns the MyDocuments + // folder on failure. + inline CString GetAppDataPath() + { + CString appData; + + CString system; + ::GetSystemDirectory(system.GetBuffer(MAX_PATH), MAX_PATH); + system.ReleaseBuffer(); + + // Call the SHGetFolderPath function to retrieve the AppData folder. + SHGetFolderPath(nullptr, CSIDL_APPDATA | CSIDL_FLAG_CREATE, nullptr, 0, appData.GetBuffer(MAX_PATH)); + appData.ReleaseBuffer(); + + // If we can't get the AppData folder, get the MyDocuments folder instead. + if (appData.IsEmpty()) + { + // Call the SHGetSpecialFolderPath function to retrieve the MyDocuments folder. + SHGetSpecialFolderPath(nullptr, appData.GetBuffer(MAX_PATH), CSIDL_PERSONAL, TRUE); + appData.ReleaseBuffer(); + } + + return appData; + } + + // Retrieves the command line arguments and stores them in a vector of CString. + // Similar to CommandLineToArgvW, but supports all versions of Windows, + // supports ANSI and Unicode, and doesn't require the user to use LocalFree. + inline std::vector GetCommandLineArgs() + { + std::vector commandLineArgs; + CString commandLine = GetCommandLine(); + int index = 0; + int endPos = 0; + + while (index < commandLine.GetLength()) + { + // Is the argument quoted? + bool isQuoted = (commandLine[index] == _T('\"')); + + if (isQuoted) + { + // Find the terminating token (quote followed by space). + endPos = commandLine.Find(_T("\" "), index); + if (endPos == -1) endPos = commandLine.GetLength() - 1; + + // Store the argument in the CStringT vector without the quotes. + CString s; + if (endPos - index < 2) + s = _T("\"\""); // "" For a single quote or double quote argument. + else + s = commandLine.Mid(index + 1, endPos - index - 1); + + commandLineArgs.push_back(s); + index = endPos + 2; + } + else + { + // Find the terminating token (space character). + endPos = commandLine.Find(_T(' '), index); + if (endPos == -1) endPos = commandLine.GetLength(); + + // Store the argument in the CStringT vector. + CString s = commandLine.Mid(index, endPos - index); + commandLineArgs.push_back(s); + index = endPos + 1; + } + + // Skip excess space characters. + while (index < commandLine.GetLength() && commandLine[index] == _T(' ')) + index++; + } + + // CommandLineArgs is a vector of CStringT. + return commandLineArgs; + } + + // Retrieves the DPI of the window if the specified handle is a valid + // window, or the DPI of the desktop window otherwise. + // Use GetWindowDpi(HWND_DESKTOP) to retrieve the DPI of the desktop window. + inline int GetWindowDpi(HWND wnd) + { + // Retrieve desktop's dpi as a fallback. + CClientDC desktopDC(HWND_DESKTOP); + int dpi = GetDeviceCaps(desktopDC, LOGPIXELSX); + + // Retrieve the window's dpi if we can. + using PGETDPIFORWINDOW = UINT (WINAPI*)(HWND); + HMODULE user = ::GetModuleHandle(_T("user32.dll")); + if (user && ::IsWindow(wnd)) + { + PGETDPIFORWINDOW pGetDpiForWindow = reinterpret_cast( + reinterpret_cast(::GetProcAddress(user, "GetDpiForWindow"))); + + if (pGetDpiForWindow != nullptr) + { + dpi = static_cast(pGetDpiForWindow(wnd)); + } + } + + return dpi; + } + + // Scales the specified bitmap up by the specified scale factor. + // Bitmap sizes can usually be multiplied by an integer value without + // losing visual quality. Returns a Device Independent Bitmap (DIB). + inline CBitmap ScaleUpBitmap(const CBitmap& bitmap, int scale) + { + assert(bitmap.GetHandle() != nullptr); + assert(scale != 0); + + // Select the bitmap into a memory DC. + CMemDC imageDC(nullptr); + imageDC.SelectObject(bitmap); + + // Create and select a DIB using CreateDIBSection. + CMemDC newImageDC(nullptr); + BITMAP bm = bitmap.GetBitmapData(); + bm.bmWidth = bm.bmWidth * scale; + bm.bmHeight = bm.bmHeight * scale; + CBitmapInfoPtr pbmi(bm); + newImageDC.CreateDIBSection(newImageDC, pbmi, DIB_RGB_COLORS, nullptr, + nullptr, 0); + + // Copy the color table from the vertical to the horizontal DIB. + if (bm.bmBitsPixel <= 8) + { + UINT numColors = 1U << bm.bmBitsPixel; + std::vector colors(numColors); + RGBQUAD* colorTable = colors.data(); + ::GetDIBColorTable(imageDC, 0, numColors, colorTable); + ::SetDIBColorTable(newImageDC, 0, numColors, colorTable); + } + + // Resize the bitmap to the new image size. + CSize szImage = bitmap.GetSize(); + newImageDC.StretchBlt(0, 0, bm.bmWidth, bm.bmHeight, imageDC, 0, 0, + szImage.cx, szImage.cy, SRCCOPY); + + return newImageDC.DetachBitmap(); + } + + + ////////////////////////////////// + // Definitions for the CWnd class. + // + + inline CWnd::CWnd() : m_wnd(nullptr), m_prevWindowProc(nullptr) + { + // Note: m_wnd is set in CWnd::CreateEx(...). + } + + // A private constructor, used internally. + inline CWnd::CWnd(HWND wnd) : m_wnd(wnd), m_prevWindowProc(nullptr) + { + } + + // Creates a copy of this CWnd without adding its pointer to the map. + // GetCWndPtr on this object will return nullptr. + inline CWnd::CWnd(const CWnd& rhs) + { + m_wnd = rhs.m_wnd; + m_prevWindowProc = rhs.m_prevWindowProc; + } + + // Assigns a copy of this CWnd without adding its pointer to the map. + // GetCWndPtr on this object will return nullptr. + inline CWnd& CWnd::operator=(const CWnd& rhs) + { + // This CWnd must not own a managed window. + for (auto it = GetApp()->m_mapHWND.begin(); it != GetApp()->m_mapHWND.end(); ++it) + { + assert(this != it->second); + } + + m_wnd = rhs.m_wnd; + m_prevWindowProc = rhs.m_prevWindowProc; + return *this; + } + + // Destructor + inline CWnd::~CWnd() + { + if (IsAppRunning()) // Is the CWinApp object still valid? + { + // Only destroy windows managed by C++. + if (GetCWndPtr(*this) == this) + { + if (IsWindow()) + ::DestroyWindow(*this); + } + + GetApp()->RemoveCWndFromMap(this); + } + } + + // Store the window handle and CWnd pointer in the HWND map. + inline void CWnd::AddToMap() + { + GetApp()->AddCWndToMap(*this, this); + } + + // Attaches a CWnd object to an existing window and calls the OnAttach virtual function. + inline BOOL CWnd::Attach(HWND wnd) + { + assert( ::IsWindow(wnd) ); + assert( !IsWindow() ); + + Subclass(wnd); // Set the window's callback to CWnd::StaticWindowProc. + + OnAttach(); + + // Post a message to trigger a call of OnInitialUpdate. + PostMessage(UWM_WINDOWCREATED); + + return TRUE; + } + + // Attaches a CWnd object to a dialog item. + inline BOOL CWnd::AttachDlgItem(UINT id, HWND parent) + { + assert(::IsWindow(parent)); + + HWND wnd = ::GetDlgItem(parent, static_cast(id)); + return Attach(wnd); + } + + // Positions the window over the center of its parent. + inline void CWnd::CenterWindow() const + { + assert(IsWindow()); + + CRect rc = GetWindowRect(); + CRect parentRect; + CRect desktopRect; + + // Get screen dimensions excluding task bar. + VERIFY(::SystemParametersInfo(SPI_GETWORKAREA, 0, &desktopRect, 0)); + + // Get the parent window dimensions (parent could be the desktop). + if (GetParent().GetHwnd() != nullptr) + parentRect = GetParent().GetWindowRect(); + else + parentRect = desktopRect; + + HMONITOR hActiveMonitor = MonitorFromWindow(*this, MONITOR_DEFAULTTONEAREST); + MONITORINFO mi = {}; + mi.cbSize = sizeof(mi); + + if (::GetMonitorInfo(hActiveMonitor, &mi)) + { + desktopRect = mi.rcWork; + if (GetParent().GetHwnd() == nullptr) + parentRect = mi.rcWork; + } + + // Calculate point to center the dialog over the portion of parent window on this monitor. + parentRect.IntersectRect(parentRect, desktopRect); + int x = parentRect.left + (parentRect.Width() - rc.Width())/2; + int y = parentRect.top + (parentRect.Height() - rc.Height())/2; + + // Keep the dialog wholly on the monitor display + x = (x < desktopRect.left)? desktopRect.left : x; + x = (x > desktopRect.right - rc.Width())? desktopRect.right - rc.Width() : x; + y = (y < desktopRect.top) ? desktopRect.top: y; + y = (y > desktopRect.bottom - rc.Height())? desktopRect.bottom - rc.Height() : y; + + VERIFY(SetWindowPos(HWND_TOP, x, y, 0, 0, SWP_NOSIZE)); + } + + // Returns the CWnd to its default state. + inline void CWnd::Cleanup() + { + GetApp()->RemoveCWndFromMap(this); + m_wnd = nullptr; + m_prevWindowProc = nullptr; + } + + // Creates the window with default parameters. The PreRegisterClass and + // PreCreate functions are called when the Create function is used. + // Override PreRegisterClass to register a new window class for the + // window, otherwise a default window class is used. + // Override PreCreate to specify the CREATESTRUCT parameters, otherwise + // default parameters are used. + // A failure to create a window throws an exception. + inline HWND CWnd::Create(HWND parent /* = nullptr */) + { + WNDCLASS wc = {}; + + // Allow the WNDCLASS parameters to be modified. + PreRegisterClass(wc); + + // Register the window class if the class name is specified. + if (wc.lpszClassName) + VERIFY(RegisterClass(wc)); + + // Set the CREATESTUCT parameters to reasonable defaults. + CREATESTRUCT cs = {}; + LONG dwOverlappedStyle = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU + | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX; + cs.style = WS_VISIBLE | ((parent)? WS_CHILD : dwOverlappedStyle ); + cs.hwndParent = parent; + + if (parent == nullptr) + { + cs.x = CW_USEDEFAULT; + cs.cx = CW_USEDEFAULT; + cs.y = CW_USEDEFAULT; + cs.cy = CW_USEDEFAULT; + } + + // Allow the CREATESTRUCT parameters to be modified. + PreCreate(cs); + + // Prefer the classname specified in PreRegisterClass over the one + // specified in PreCreate. The class name will default to "Win32++ Window" + // if neither PreRegisterClass nor PreCreate specify a class name. + LPCTSTR className = wc.lpszClassName ? wc.lpszClassName : cs.lpszClass; + + DWORD style = static_cast(cs.style & ~WS_VISIBLE); + HWND wnd; + + // Create the window. + wnd = CreateEx(cs.dwExStyle, className, cs.lpszName, style, cs.x, cs.y, + cs.cx, cs.cy, cs.hwndParent, cs.hMenu, cs.lpCreateParams); + + // Show the window maximized, minimized, or normal. + if (cs.style & WS_VISIBLE) + { + if (cs.style & WS_MAXIMIZE) + ShowWindow(SW_MAXIMIZE); + else if (cs.style & WS_MINIMIZE) + ShowWindow(SW_MINIMIZE); + else + ShowWindow(); + } + + return wnd; + } + + // Creates the window by specifying each parameter. The lpszClassName must + // be a predefined class name or registered with RegisterClass. A failure + // to create a window throws an exception. + inline HWND CWnd::CreateEx(DWORD exStyle, LPCTSTR className, + LPCTSTR windowName, DWORD style, RECT rc, HWND parent, UINT id, + LPVOID lparam /*= nullptr*/) + { + int x = rc.left; + int y = rc.top; + int cx = rc.right - rc.left; + int cy = rc.bottom - rc.top; + + INT_PTR idMenu = static_cast(id); + HMENU menu = parent ? reinterpret_cast(idMenu) : + ::LoadMenu(GetApp()->GetResourceHandle(), MAKEINTRESOURCE(id)); + + return CreateEx(exStyle, className, windowName, style, x, y, cx, cy, + parent, menu, lparam); + } + + // Creates the window by specifying each parameter. The lpszClassName must + // be a predefined class name or registered with RegisterClass. A failure + // to create a window throws an exception. + inline HWND CWnd::CreateEx(DWORD exStyle, LPCTSTR className, + LPCTSTR windowName, DWORD style, int x, int y, int width, int height, + HWND parent, HMENU idOrMenu, LPVOID lparam /*= nullptr*/) + { + assert( !IsWindow() ); // Only one window per CWnd instance allowed. + Cleanup(); + + // Ensure a window class is registered. + CString classString; + if (className == nullptr || className[0] == _T('\0')) + classString = _T("Win32++ Window"); + else + classString = className; + + WNDCLASS wc = {}; + wc.lpszClassName = classString; + wc.hbrBackground = static_cast(::GetStockObject(WHITE_BRUSH)); + wc.hCursor = ::LoadCursor(nullptr, IDC_ARROW); + + // Register the window class (if not already registered). + VERIFY(RegisterClass(wc)); + + // Retrieve this thread's TLS data. + TLSData* pTLSData = GetApp()->GetTlsData(); + + // Store the CWnd pointer in thread local storage. + pTLSData->pWnd = this; + m_wnd = nullptr; + + // Create the window. + HWND wnd = ::CreateWindowEx(exStyle, classString, windowName, style, x, + y, width, height, parent, idOrMenu, GetApp()->GetInstanceHandle(), + lparam); + + // Tidy up + pTLSData->pWnd = nullptr; + + if (wnd == nullptr) + { + // Throw an exception when window creation fails. + throw CWinException(GetApp()->MsgWndCreate()); + } + + // Automatically subclass predefined window class types. + if (className) + { + VERIFY(::GetClassInfo(GetApp()->GetInstanceHandle(), className, &wc)); + if (wc.lpfnWndProc != GetApp()->m_callback) + { + Subclass(wnd); + + // Override this to perform tasks after the window is attached. + OnAttach(); + } + } + + // Post a message to trigger a call of OnInitialUpdate. + PostMessage(UWM_WINDOWCREATED); + + return wnd; + } + + // Destroys the window and returns the CWnd back to its default state, + // ready for reuse. + inline void CWnd::Destroy() + { + if (GetCWndPtr(*this) == this) + { + if (IsWindow()) + ::DestroyWindow(*this); + } + + // Return the CWnd to its default state. + Cleanup(); + } + + // Reverse an Attach or AttachDlgItem. + inline HWND CWnd::Detach() + { + assert(m_prevWindowProc); // Only previously attached CWnds can be detached. + + if (IsWindow()) + SetWindowLongPtr(GWLP_WNDPROC, reinterpret_cast(m_prevWindowProc)); + + HWND wnd = GetHwnd(); + GetApp()->RemoveCWndFromMap(this); + m_wnd = nullptr; + m_prevWindowProc = nullptr; + + return wnd; + } + + // This function performs dialog data exchange and dialog data + // validation using DDX and DDV functions. Typically this is done for + // controls in a dialogs, but controls in any window support DDX and DDV. + // Never call this function directly. It is called by the UpdateData() + // member function. Call UpdateData() to write data into, or retrieve + // validated data from the controls. Override this method in the dialog + // or other window that utilize the DDX/DDV functions. + inline void CWnd::DoDataExchange(CDataExchange&) + { + // Any dialog or window using DDX/DDV for its controls should + // override of this member, and put calls to the DDX and DDV functions + // there. For example: + + // connect to edit box holding int and specify limits. + // dx.DDX_Text(IDC_EDIT_UINT, m_iUINT); + // dx.DDV_MinMaxUInt( m_iUINT, 10, 10000); + + // connect to edit box holding double and specify limits. + // dx.DDX_Text(IDC_EDIT_DOUBLE, m_double); + // dx.DDV_MinMaxDouble( m_double, -10.0, 100000.); + // + // connect to rich edit box holding a string and specify length. + // dx.DDX_Text(IDC_EDIT_RICHEDIT, m_richEdit); + // dx.DDV_MaxChars( m_richEdit, 25); // limit length + // + // connect to slider control and specify limits. + // dx.DDX_Slider(IDC_SLIDER, m_slider); + // dx.DDV_MinMaxSlider( m_slider, 0, 1000); + // + // connect to progress bar. + // dx.DDX_Progress(IDC_PROGRESSBAR, m_progress); + // + // connect to bar to scroll bar. + // dx.DDX_Scroll( IDC_SCROLLBAR, m_scrollBar); + // + // connect to radio boxes. + // dx.DDX_Radio( IDC_RADIO_A, m_radioA); + // + // connect to check boxes. + // dx.DDX_Check(IDC_CHECK_A, m_checkA); + // dx.DDX_Check(IDC_CHECK_B, m_checkB); + // dx.DDX_Check(IDC_CHECK_C, m_checkC); + } + + // Scales the specified font to the Dots Per Inch (DPI) scaling + // reported by GetWindowDpi. + inline CFont CWnd::DpiScaleFont(const CFont& font, int pointSize) const + { + int dpi = GetWindowDpi(*this); + LOGFONT logfont = font.GetLogFont(); + logfont.lfHeight = -MulDiv(pointSize, dpi, POINTS_PER_INCH); + CFont dpiFont(logfont); + + return dpiFont; + } + + // Scales the specified int to the Dots Per Inch (DPI) scaling + // reported by GetWindowDpi. + inline int CWnd::DpiScaleInt(int value) const + { + int dpi = GetWindowDpi(*this); + int dpiValue = MulDiv(value, dpi, USER_DEFAULT_SCREEN_DPI); + + return dpiValue; + } + + // Scales the specified logfont to the Dots Per Inch (DPI) scaling + // reported by GetWindowDpi. + inline LOGFONT CWnd::DpiScaleLogfont(LOGFONT logfont, int pointSize) const + { + int dpi = GetWindowDpi(*this); + logfont.lfHeight = -MulDiv(pointSize, dpi, POINTS_PER_INCH); + + return logfont; + } + + // Scales the specified rect to the Dots Per Inch (DPI) scaling + // reported by GetWindowDpi. + inline CRect CWnd::DpiScaleRect(RECT rc) const + { + int dpi = GetWindowDpi(*this); + int left = MulDiv(rc.left, dpi, USER_DEFAULT_SCREEN_DPI); + int top = MulDiv(rc.top, dpi, USER_DEFAULT_SCREEN_DPI); + int bottom = MulDiv(rc.bottom, dpi, USER_DEFAULT_SCREEN_DPI); + int right = MulDiv(rc.right, dpi, USER_DEFAULT_SCREEN_DPI); + + return CRect(left, top, right, bottom); + } + + // Scales up the specified bitmap to the Dots Per Inch (DPI) scaling + // reported by GetWindowDpi. + inline CBitmap CWnd::DpiScaleUpBitmap(const CBitmap& bitmap) const + { + int dpi = GetWindowDpi(*this); + int scale = std::max(1, dpi / USER_DEFAULT_SCREEN_DPI); + + return ScaleUpBitmap(bitmap, scale); + } + + // Pass messages on to the appropriate default window procedure. + // CMDIChild and CMDIFrame override this function. + inline LRESULT CWnd::FinalWindowProc(UINT msg, WPARAM wparam, LPARAM lparam) + { + if (m_prevWindowProc) + return ::CallWindowProc(m_prevWindowProc, *this, msg, wparam, lparam); + else + return ::DefWindowProc(*this, msg, wparam, lparam); + } + + // The GetAncestor function retrieves the ancestor (root parent) + // of the window. + inline CWnd CWnd::GetAncestor(UINT flags /*= GA_ROOTOWNER*/) const + { + assert(IsWindow()); + return CWnd(::GetAncestor(*this, flags)); + } + + // Retrieves the class name of this object's window. + inline CString CWnd::GetClassName() const + { + assert(IsWindow()); + + CString str; + VERIFY(::GetClassName(*this, str.GetBuffer(WXX_MAX_STRING_SIZE), WXX_MAX_STRING_SIZE)); + str.ReleaseBuffer(); + return str; + } + + // Retrieves the pointer to the CWnd associated with the specified HWND. + // Returns nullptr if a CWnd object doesn't already exist for this HWND. + inline CWnd* CWnd::GetCWndPtr(HWND wnd) + { + return wnd ? GetApp()->GetCWndFromMap(wnd) : nullptr; + } + + // Retrieves the title or text associated with a control in a dialog box. + inline CString CWnd::GetDlgItemText(UINT dlgItemID) const + { + assert(IsWindow()); + + int dlgItem = static_cast(dlgItemID); + + // Returns text length NOT including the null character. + int length = ::GetWindowTextLength(::GetDlgItem(*this, dlgItem)); + CString str; + if (length > 0) + { + VERIFY(::GetDlgItemText(*this, dlgItem, str.GetBuffer(length + 1), length + 1)); + str.ReleaseBuffer(); + } + return str; + } + + // Retrieves the text of the window's title bar. + inline CString CWnd::GetWindowText() const + { + assert(IsWindow()); + + CString str; + str.GetWindowText(*this); + return str; + } + + // A function used internally to call OnMessageReflect. Don't call or + // override this function. + inline LRESULT CWnd::MessageReflect(UINT msg, WPARAM wparam, LPARAM lparam) const + { + HWND wnd = nullptr; + switch (msg) + { + case WM_COMMAND: + case WM_CTLCOLORBTN: + case WM_CTLCOLOREDIT: + case WM_CTLCOLORDLG: + case WM_CTLCOLORLISTBOX: + case WM_CTLCOLORSCROLLBAR: + case WM_CTLCOLORSTATIC: + case WM_CHARTOITEM: + case WM_VKEYTOITEM: + case WM_HSCROLL: + case WM_VSCROLL: + wnd = reinterpret_cast(lparam); + break; + + case WM_DRAWITEM: + case WM_MEASUREITEM: + case WM_DELETEITEM: + case WM_COMPAREITEM: + wnd = GetDlgItem(static_cast(wparam)); + break; + + case WM_PARENTNOTIFY: + switch(LOWORD(wparam)) + { + case WM_CREATE: + case WM_DESTROY: + wnd = reinterpret_cast(lparam); + break; + } + } + + CWnd* pWnd = GetApp()->GetCWndFromMap(wnd); + + if (pWnd != nullptr) + return pWnd->OnMessageReflect(msg, wparam, lparam); + + return 0; + } + + // This function is called when a window is attached to the CWnd. + // Override it to automatically perform tasks when the window is attached. + // Note: Window controls are attached. + inline void CWnd::OnAttach() + { + } + + // Called in response to WM_CLOSE, before the window is destroyed. + // Override this function to suppress destroying the window. + // WM_CLOSE is sent by SendMessage(WM_CLOSE, 0, 0) or by clicking X + // in the top right corner. + // Child windows don't receive WM_CLOSE unless they are closed using + // the Close function. + inline void CWnd::OnClose() + { + Destroy(); + } + + // Called when the user interacts with the menu or toolbar. + inline BOOL CWnd::OnCommand(WPARAM, LPARAM) + { + + // Override this to handle WM_COMMAND messages, for example: + + // UINT id = LOWORD(wparam); + // switch (id) + // { + // case IDM_FILE_NEW: + // OnFileNew(); + // TRUE; // return TRUE for handled commands + // } + + // Return FALSE for unhandled commands. + return FALSE; + } + + // Called during window creation. Override this functions to perform tasks + // such as creating child windows. + inline int CWnd::OnCreate(CREATESTRUCT&) + { + // This function is called when a WM_CREATE message is received + // Override it to automatically perform tasks during window creation. + // Return 0 to continue creating the window. + + // Note: Window controls don't call OnCreate. They are sublcassed (attached) + // after their window is created. + + return 0; + } + + // This function is called when a window is destroyed. + // Override it to do additional tasks, such as ending the application + // with PostQuitMessage. + inline void CWnd::OnDestroy() + { + } + + // Called when part of the client area of the window needs to be drawn. + // Override this function in your derived class to perform drawing tasks. + inline void CWnd::OnDraw(CDC&) + { + } + + // Called when the background of the window's client area needs to be erased. + // Override this function in your derived class to perform drawing tasks. + // Return Value: Return FALSE to also permit default erasure of the background + // Return TRUE to prevent default erasure of the background + inline BOOL CWnd::OnEraseBkgnd(CDC&) + { + return FALSE; + } + + // This function is called automatically once the window is created + // Override it in your derived class to automatically perform tasks + // after window creation. + inline void CWnd::OnInitialUpdate() + { + } + + // Called when menu items are about to be displayed. Override this function to + // enable/disable the menu item, or add/remove the check box or radio button + // to menu items. + inline void CWnd::OnMenuUpdate(UINT) + { + // Override this function to modify the behavior of menu items, + // such as adding or removing checkmarks. + } + + // This function processes those special messages sent by some older controls, + // and reflects them back to the originating CWnd object. + // Override this function in your derived class to handle these special messages: + // WM_COMMAND, WM_CTLCOLORBTN, WM_CTLCOLOREDIT, WM_CTLCOLORDLG, WM_CTLCOLORLISTBOX, + // WM_CTLCOLORSCROLLBAR, WM_CTLCOLORSTATIC, WM_CHARTOITEM, WM_VKEYTOITEM, + // WM_HSCROLL, WM_VSCROLL, WM_DRAWITEM, WM_MEASUREITEM, WM_DELETEITEM, + // WM_COMPAREITEM, WM_PARENTNOTIFY. + // + // Note: The WM_DRAWITEM, WM_MEASUREITEM, WM_DELETEITEM and WM_COMPAREITEM + // messages require the window to have a control ID in order to be reflected. + // Use SetWindowLongPtr(GWLP_ID, id) to set a control ID if required. + inline LRESULT CWnd::OnMessageReflect(UINT, WPARAM, LPARAM) + { + // This function processes those special messages (see above) sent + // by some older controls, and reflects them back to the originating CWnd object. + // Override this function in your derived class to handle these special messages. + + // Your overriding function should look like this ... + + // switch (msg) + // { + // Handle your reflected messages here. + // } + + // Return 0 for unhandled messages. + return 0; + } + + // Processes notification (WM_NOTIFY) messages from a child window. + inline LRESULT CWnd::OnNotify(WPARAM, LPARAM) + { + // You can use either OnNotifyReflect or OnNotify to handle notifications + // Override OnNotifyReflect to handle notifications in the CWnd class that + // generated the notification. OR + // Override OnNotify to handle notifications in the PARENT of the CWnd class + // that generated the notification. + + // Your overriding function should look like this ... + + // LPNMHDR pHeader = reinterpret_cast(lparam); + // switch (pHeader->code) + // { + // Handle your notifications from the CHILD window here + // Return the value recommended by the Windows API documentation. + // For many notifications, the return value doesn't matter, but for some it does. + // } + + // Return 0 for unhandled notifications. + // The framework will call SetWindowLongPtr(DWLP_MSGRESULT, result) for dialogs. + return 0; + } + + // Processes the notification (WM_NOTIFY) messages in the child window that originated them. + inline LRESULT CWnd::OnNotifyReflect(WPARAM, LPARAM) + { + // Override OnNotifyReflect to handle notifications in the CWnd class that + // generated the notification. + + // Your overriding function should look like this ... + + // LPNMHDR pHeader = reinterpret_cast(lparam); + // switch (pHeader->code) + // { + // Handle your notifications from this window here + // Return the value recommended by the Windows API documentation. + // } + + // Return 0 for unhandled notifications. + // The framework will call SetWindowLongPtr(DWLP_MSGRESULT, result) for dialogs. + return 0; + } + + // Called when the window paints its client area. + inline LRESULT CWnd::OnPaint(UINT msg, WPARAM wparam, LPARAM lparam) + { + // Window controls and other subclassed windows are expected to do their own + // drawing, so we don't call OnDraw for those. + + // Note: CustomDraw or OwnerDraw are normally used to modify the drawing of + // controls, but overriding OnPaint is also an option. + + if (!m_prevWindowProc) + { + if (::GetUpdateRect(*this, nullptr, FALSE)) + { + CPaintDC dc(*this); + OnDraw(dc); + } + else + // RedrawWindow can require repainting without an update rect. + { + CClientDC dc(*this); + OnDraw(dc); + } + + // No more drawing required. + return 0; + } + + // Allow window controls to do their default drawing. + return FinalWindowProc(msg, wparam, lparam); + } + + // Called by CWnd::Create to set some window creation parameters. + // Note: The lpszClass parameter is ignored. The class name must be + // assigned in the PreRegisterClass function if required. + inline void CWnd::PreCreate(CREATESTRUCT&) + { + // Override this function to set the CREATESTRUCT values prior to window creation. + // Here we set the initial values for the following: + // window styles (WS_VISABLE, WS_CHILD, WS_WS_MAXIMIZEBOX etc.) + // window extended styles + // window position + // window menu + // window name (caption) + } + + // Called by CWnd::Create to set some window class parameters. + // Used to set the window type (ClassName) and for setting the background + // brush and cursor. + // Note: The lpszClassName parameter must be assigned for this function + // to take effect. + inline void CWnd::PreRegisterClass(WNDCLASS&) + { + // Override this function to set the WNDCLASS values prior to window creation. + // for example, for a ToolBar, we use this: + // wc.lpszClassName = TOOLBARCLASSNAME; + + // ADDITIONAL NOTES: + // 1) The lpszClassName must be set for this function to take effect. + // 2) No other defaults are set, so the following settings might prove useful + // wc.hCursor = ::LoadCursor(nullptr, IDC_ARROW); + // wc.hbrBackground = static_cast(::GetStockObject(WHITE_BRUSH)); + // wc.icon = ::LoadIcon(nullptr, IDI_APPLICATION); + // 3) The styles that can be set here are WNDCLASS styles. These are a different + // set of styles to those set by CREATESTRUCT (used in PreCreate). + // 4) To set a small icon for the window, use SetIconSmall. + } + + // Override this function if your class requires input messages to be + // translated before normal processing. Functions which translate messages + // include TranslateAccelerator, TranslateMDISysAccel and IsDialogMessage. + // Return TRUE if the message is translated. + inline BOOL CWnd::PreTranslateMessage(MSG&) + { + return FALSE; + } + + // A private function used by the CreateEx function to register a window + // class prior to window creation. + inline BOOL CWnd::RegisterClass(WNDCLASS& wc) + { + assert((wc.lpszClassName != nullptr) && (lstrlen(wc.lpszClassName) <= WXX_MAX_STRING_SIZE)); + + // Check to see if this classname is already registered. + WNDCLASS wcTest = {}; + BOOL done = FALSE; + + if (::GetClassInfo(GetApp()->GetInstanceHandle(), wc.lpszClassName, &wcTest)) + { + wc = wcTest; + done = TRUE; + } + else + { + // Set defaults. + wc.hInstance = GetApp()->GetInstanceHandle(); + wc.lpfnWndProc = CWnd::StaticWindowProc; + + // Register the WNDCLASS structure. + done = ::RegisterClass(&wc); + } + + return done; + } + + // Sets the large icon associated with the window. + inline HICON CWnd::SetIconLarge(UINT iconID) + { + assert(IsWindow()); + + // Large icon sizes + int cxIcon = ::GetSystemMetrics(SM_CXICON) * GetWindowDpi(*this) / GetWindowDpi(HWND_DESKTOP); + int cyIcon = ::GetSystemMetrics(SM_CYICON) * GetWindowDpi(*this) / GetWindowDpi(HWND_DESKTOP); + + HICON icon = reinterpret_cast(GetApp()->LoadImage(iconID, IMAGE_ICON, cxIcon, cyIcon, LR_SHARED)); + + if (icon != nullptr) + SendMessage (WM_SETICON, WPARAM (ICON_BIG), LPARAM (icon)); + else + TRACE("**WARNING** SetIconLarge Failed\n"); + + return icon; + } + + // Sets the small icon associated with the window. + inline HICON CWnd::SetIconSmall(UINT iconID) + { + assert(IsWindow()); + + // Small icon sizes + int cxIcon = ::GetSystemMetrics(SM_CXSMICON) * GetWindowDpi(*this) / GetWindowDpi(HWND_DESKTOP); + int cyIcon = ::GetSystemMetrics(SM_CYSMICON) * GetWindowDpi(*this) / GetWindowDpi(HWND_DESKTOP); + + HICON icon = reinterpret_cast(GetApp()->LoadImage(iconID, IMAGE_ICON, cxIcon, cyIcon, LR_SHARED)); + + if (icon != nullptr) + SendMessage (WM_SETICON, WPARAM (ICON_SMALL), LPARAM (icon)); + else + TRACE("**WARNING** SetIconSmall Failed\n"); + + return icon; + } + + // All CWnd windows direct their messages here. This function redirects the message + // to the CWnd's WndProc function. + inline LRESULT CALLBACK CWnd::StaticWindowProc(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam) + { + CWnd* w = GetApp()->GetCWndFromMap(wnd); + if (w == nullptr) + { + // The CWnd pointer wasn't found in the map, so add it now. + + // Retrieve the pointer to the TLS Data. + TLSData* pTLSData = GetApp()->GetTlsData(); + if (pTLSData) + { + // Retrieve pointer to CWnd object from Thread Local Storage TLS. + w = pTLSData->pWnd; + if (w) + { + pTLSData->pWnd = nullptr; + + // Store the CWnd pointer in the HWND map. + w->m_wnd = wnd; + w->AddToMap(); + } + } + } + + assert(w != nullptr); + if (w == nullptr) + { + // Got a message for a window that's not in the map. + return 0; + } + + return w->WndProc(msg, wparam, lparam); + + } // LRESULT CALLBACK StaticWindowProc(...) + + // A private function used by CreateEx, Attach and AttachDlgItem. + inline void CWnd::Subclass(HWND wnd) + { + assert(::IsWindow(wnd)); + + // Store the CWnd pointer in the HWND map. + m_wnd = wnd; + AddToMap(); + + // Store the old window procedure. + LONG_PTR pWndProc = reinterpret_cast(CWnd::StaticWindowProc); + LONG_PTR pRes = ::SetWindowLongPtr(wnd, GWLP_WNDPROC, pWndProc); + m_prevWindowProc = reinterpret_cast(pRes); + } + + // Dialog Data Exchange support. Call this function to retrieve values from + // (retrieveAndValidate is TRUE) or assign values to (retrieveAndValidate + // is FALSE) a set of controls appearing in DDX/DDV statements in an + // override of the DoDataExchange() member method. + // + // Returns TRUE if the operation is successful, or FALSE otherwise. If + // called when retrieveValidate is TRUE, success means the data has + // been validated. + inline BOOL CWnd::UpdateData(CDataExchange& dx, BOOL retrieveAndValidate) + { + // A critical section ensures threads update the data separately. + CThreadLock lock(GetApp()->m_appLock); + + // Must not update data before the window is created. + assert(IsWindow()); + + dx.Init(*this, retrieveAndValidate); + + BOOL ok = FALSE; // Remains FALSE if DoDataExchange throws a CUserException. + try + { + DoDataExchange(dx); + if (dx.GetLastControl() != 0 && dx.GetLastEditControl() != nullptr) + { + // select all characters in the edit control + ::SetFocus(dx.GetLastEditControl()); + ::SendMessage(dx.GetLastEditControl(), EM_SETSEL, 0, -1); + } + ok = TRUE; // DoDataExchage completed successfully. + } + catch(const CUserException& e) + { + // Validation has failed. Call the Fail to display the error. + dx.Fail( e.GetText() ); + } + + return ok; + } + + // Processes this window's message. Override this function in your class + // derived from CWnd to handle window messages. + inline LRESULT CWnd::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) + { + // A typical function might look like this: + + // switch (msg) + // { + // case MESSAGE1: return OnMessage1(); + // case MESSAGE2: return OnMessage2(); + // } + + // The message functions should return a value recommended by the + // Windows API documentation. + // Alternatively, return FinalWindowProc to continue with default processing. + + // Always pass unhandled messages on to WndProcDefault + return WndProcDefault(msg, wparam, lparam); + } + + // Provides default processing for this window's messages. + // All WndProc functions should pass unhandled window messages to this function. + inline LRESULT CWnd::WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam) + { + LRESULT result = 0; + if (UWM_WINDOWCREATED == msg) + { + OnInitialUpdate(); + return 0; + } + + switch (msg) + { + case WM_CLOSE: + { + OnClose(); + return 0; + } + case WM_COMMAND: + { + // Reflect this message if it's from a control. + CWnd* pWnd = GetCWndPtr(reinterpret_cast(lparam)); + if (pWnd != nullptr) + result = pWnd->OnCommand(wparam, lparam); + + // Handle user commands. + if (result == 0) + result = OnCommand(wparam, lparam); + + if (result != 0) return 0; + } + break; // Note: Some MDI commands require default processing. + case WM_CREATE: + { + LPCREATESTRUCT pcs = reinterpret_cast(lparam); + if (pcs == nullptr) + throw CWinException(GetApp()->MsgWndCreate()); + + return OnCreate(*pcs); + } + case WM_DESTROY: + OnDestroy(); + break; // Note: Some controls require default processing. + case WM_INITMENUPOPUP: + { + // Call OnMenuUpdate for each menu item. + CMenu menu = reinterpret_cast(wparam); + for (int i = 0; i < menu.GetMenuItemCount(); ++i) + { + UINT menuItem = menu.GetMenuItemID(i); + OnMenuUpdate(menuItem); + } + return 0; + } + case WM_NOTIFY: + { + // Do notification reflection if message came from a child window. + // Restricting OnNotifyReflect to child windows avoids double handling. + LPNMHDR pHeader = reinterpret_cast(lparam); + HWND from = pHeader->hwndFrom; + CWnd* pWndFrom = GetApp()->GetCWndFromMap(from); + + if (pWndFrom != nullptr) + if (::GetParent(from) == m_wnd) + result = pWndFrom->OnNotifyReflect(wparam, lparam); + + // Handle user notifications. + if (result == 0) result = OnNotify(wparam, lparam); + if (result != 0) return result; + break; + } + + case WM_PAINT: + { + // OnPaint calls OnDraw when appropriate. + OnPaint(msg, wparam, lparam); + return 0; + } + case WM_ERASEBKGND: + { + CDC dc(reinterpret_cast(wparam)); + BOOL preventErasure; + + preventErasure = OnEraseBkgnd(dc); + if (preventErasure) return TRUE; + break; + } + + // A set of messages to be reflected back to the control that generated them. + case WM_CTLCOLORBTN: + case WM_CTLCOLOREDIT: + case WM_CTLCOLORDLG: + case WM_CTLCOLORLISTBOX: + case WM_CTLCOLORSCROLLBAR: + case WM_CTLCOLORSTATIC: + case WM_DRAWITEM: + case WM_MEASUREITEM: + case WM_DELETEITEM: + case WM_COMPAREITEM: + case WM_CHARTOITEM: + case WM_VKEYTOITEM: + case WM_HSCROLL: + case WM_VSCROLL: + case WM_PARENTNOTIFY: + { + result = MessageReflect(msg, wparam, lparam); + if (result != 0) return result; // Message processed so return. + break; // Do default processing when message not already processed. + } + + case UWM_GETCWND: + { + assert(this == GetCWndPtr(m_wnd)); + return reinterpret_cast(this); + } + + } // switch (msg) + + // Now hand all messages to the default procedure. + return FinalWindowProc(msg, wparam, lparam); + + } // LRESULT CWnd::WindowProc(...) + + + // + // Wrappers for Win32 API functions + // + + // The BeginPaint function prepares the specified window for painting and + // fills a PAINTSTRUCT structure with information about the painting. + // Consider using CPaintDC instead. + // Refer to BeginPaint in the Windows API documentation for more information. + inline HDC CWnd::BeginPaint(PAINTSTRUCT& ps) const + { + assert(IsWindow()); + return ::BeginPaint(*this, &ps); + } + + // The BringWindowToTop function brings the specified window to the top + // of the Z order. If the window is a top-level window, it is activated. + // Refer to BringWindowToTop in the Windows API documentation for more information. + inline BOOL CWnd::BringWindowToTop() const + { + assert(IsWindow()); + return ::BringWindowToTop(*this); + } + + // Passes message information to the specified window procedure. + // Refer to CallWindowProc in the Windows API documentation for more information. + inline LRESULT CWnd::CallWindowProc(WNDPROC pPrevWndFunc, UINT msg, + WPARAM wparam, LPARAM lparam) const + { + assert(IsWindow()); + return ::CallWindowProc(pPrevWndFunc, *this, msg, wparam, lparam); + } + + // The CheckDlgButton function changes the check state of a button control. + // Refer to CheckDlgButton in the Windows API documentation for more information. + inline BOOL CWnd::CheckDlgButton(UINT buttonID, UINT check) const + { + assert(IsWindow()); + return ::CheckDlgButton(*this, static_cast(buttonID), check); + } + + // The CheckRadioButton function adds a check mark to (checks) a specified + // radio button in a group and removes a check mark from (clears) all + // other radio buttons in the group. + // Refer to CheckRadioButton in the Windows API documentation for more information. + inline BOOL CWnd::CheckRadioButton(UINT firstButtonID, UINT lastButtonID, + UINT checkButtonID) const + { + assert(IsWindow()); + return ::CheckRadioButton(*this, static_cast(firstButtonID), + static_cast(lastButtonID), static_cast(checkButtonID)); + } + + // Determines which, if any, of the child windows belonging to a parent + // window contains the specified point. The search is restricted to + // immediate child windows. + // Grandchildren, and deeper descendant windows are not searched. + // Refer to ChildWindowFromPoint in the Windows API documentation for more information. + inline CWnd CWnd::ChildWindowFromPoint(POINT point) const + { + assert(IsWindow()); + return CWnd(::ChildWindowFromPoint(*this, point)); + } + + // The ClientToScreen function converts the client-area coordinates of a + // specified point to screen coordinates. + // Refer to ClientToScreen in the Windows API documentation for more information. + inline BOOL CWnd::ClientToScreen(POINT& point) const + { + assert(IsWindow()); + return ::ClientToScreen(*this, &point); + } + + // The ClientToScreen function converts the client-area coordinates of a + // specified RECT to screen coordinates. + // Refer to MapWindowPoints in the Windows API documentation for more information. + inline BOOL CWnd::ClientToScreen(RECT& rect) const + { + assert(IsWindow()); + return static_cast(::MapWindowPoints(*this, HWND_DESKTOP, + reinterpret_cast(&rect), 2)); + } + + // The Close function issues a close requests to the window. The OnClose + // function is called in response to this function. The default + // implementation of OnClose destroys the window. + // Override OnClose to perform tasks in addition to or instead of + // destroying the window. + // Refer to the WM_CLOSE message in the Windows API documentation for more information. + inline void CWnd::Close() const + { + assert(IsWindow()); + PostMessage(WM_CLOSE); + } + + // The CloseWindow function minimizes (but does not destroy) the window. + // To destroy a window, an application can use the Destroy function. + // Refer to CloseWindow in the Windows API documentation for more information. + inline BOOL CWnd::CloseWindow() const + { + assert(IsWindow()); + return ::CloseWindow(*this); + } + + // The DeferWindowPos function updates the specified multiple window + // position structure for the window. + // The insertAfter can one of: HWND_BOTTOM, HWND_NOTOPMOST, HWND_TOP, or + // HWND_TOPMOST. + // Refer to DeferWindowPos in the Windows API documentation for more information. + inline HDWP CWnd::DeferWindowPos(HDWP winPosInfo, HWND insertAfter, int x, + int y, int cx, int cy, UINT flags) const + { + assert(IsWindow()); + return ::DeferWindowPos(winPosInfo, *this, insertAfter, x, y, cx, cy, flags); + } + + // The DeferWindowPos function updates the specified multiple window + // position structure for the window. + // The insertAfter can one of: HWND_BOTTOM, HWND_NOTOPMOST, HWND_TOP, or + // HWND_TOPMOST. + // Refer to DeferWindowPos in the Windows API documentation for more information. + inline HDWP CWnd::DeferWindowPos(HDWP winPosInfo, HWND insertAfter, + RECT rect, UINT flags) const + { + assert(IsWindow()); + return ::DeferWindowPos(winPosInfo, *this, insertAfter, rect.left, + rect.top, rect.right - rect.left, rect.bottom - rect.top, flags); + } + + // This function provides default processing for any window messages that + // an application does not process. + // Refer to DefWindowProc in the Windows API documentation for more information. + inline LRESULT CWnd::DefWindowProc(UINT msg, WPARAM wparam, LPARAM lparam) const + { + assert(IsWindow()); + return ::DefWindowProc(*this, msg, wparam, lparam); + } + + // The DlgDirList function replaces the contents of a list box with the + // names of the subdirectories and files in a specified directory. You can + // filter the list of names by specifying a set of file attributes. + // Refer to DlgDirList in the Windows API documentation for more information. + inline int CWnd::DlgDirList(LPTSTR pathSpec, UINT listBoxID, + UINT staticPathID, UINT fileType) const + { + assert(IsWindow()); + return ::DlgDirList(*this, pathSpec, static_cast(listBoxID), + static_cast(staticPathID), fileType); + } + + // The DlgDirListComboBox function replaces the contents of a combo box + // with the names of the subdirectories and files in a specified directory. + // You can filter the list of names by specifying a set of file attributes + // in a specified directory. You can filter the list of names by specifying + // a set of file attributes. + // Refer to DlgDirListComboBox in the Windows API documentation for more information. + inline int CWnd::DlgDirListComboBox(LPTSTR pathSpec, UINT comboBoxID, + UINT staticPathID, UINT fileType) const + { + assert(IsWindow()); + return ::DlgDirListComboBox(*this, pathSpec, static_cast(comboBoxID), + static_cast(staticPathID), fileType); + } + + // The DlgDirSelectEx function retrieves the current selection from a + // single-selection list box. It assumes that the list box has been filled + // by the DlgDirList function and that the selection is a drive letter, + // filename, or directory name. + // Refer to DlgDirSelectEx in the Windows API documentation for more information. + inline BOOL CWnd::DlgDirSelectEx(LPTSTR string, int count, UINT listBoxID) const + { + assert(IsWindow()); + return ::DlgDirSelectEx(*this, string, count, static_cast(listBoxID)); + } + + // The DlgDirSelectComboBoxEx function retrieves the current selection from + // a combo box filled by using the DlgDirListComboBox function. The + // selection is interpreted as a drive letter, a file, or a directory name. + // Refer to DlgDirSelectComboBoxEx in the Windows API documentation for more information. + inline BOOL CWnd::DlgDirSelectComboBoxEx(LPTSTR string, int count, UINT comboBoxID) const + { + assert(IsWindow()); + return ::DlgDirSelectComboBoxEx(*this, string, count, static_cast(comboBoxID)); + } + + // The DrawAnimatedRects function draws a wire-frame rectangle and animates + // it to indicate the opening of an icon or the minimizing or maximizing of + // a window. + // Refer to DrawAnimatedRects in the Windows API documentation for more information. + inline BOOL CWnd::DrawAnimatedRects(UINT aniID, RECT from, RECT to) const + { + assert(IsWindow()); + return ::DrawAnimatedRects(*this, static_cast(aniID), &from, &to); + } + + // The DrawCaption function draws a window caption. + // Refer to DrawCaption in the Windows API documentation for more information. + inline BOOL CWnd::DrawCaption(HDC dc, RECT rect, UINT flags) const + { + assert(IsWindow()); + return ::DrawCaption(*this, dc, &rect, flags); + } + + // The DrawMenuBar function redraws the menu bar of the specified window. + // If the menu bar changes after the system has created the window, this + // function must be called to draw the changed menu bar. + // Refer to DrawMenuBar in the Windows API documentation for more information. + inline BOOL CWnd::DrawMenuBar() const + { + assert(IsWindow()); + return ::DrawMenuBar(*this); + } + + // The EnableScrollBar function enables or disables one or both scroll bar + // arrows. + // Refer to EnableScrollBar in the Windows API documentation for more information. + inline BOOL CWnd::EnableScrollBar(UINT flags, UINT arrows) const + { + assert(IsWindow()); + return ::EnableScrollBar(*this, flags, arrows); + } + + // The EnableWindow function enables or disables mouse and + // keyboard input to the window. + // Refer to EnableWindow in the Windows API documentation for more information. + inline BOOL CWnd::EnableWindow(BOOL enable /*= TRUE*/) const + { + assert(IsWindow()); + return ::EnableWindow(*this, enable); + } + + // The EndPaint function marks the end of painting in the specified window. + // This function is required for each call to the BeginPaint function, + // but only after painting is complete. + // Refer to EndPaint in the Windows API documentation for more information. + inline BOOL CWnd::EndPaint(PAINTSTRUCT& ps) const + { + assert(IsWindow()); + return ::EndPaint(*this, &ps); + } + + // The GetActiveWindow function retrieves the active window attached to the + // calling thread's message queue. + // Refer to GetActiveWindow in the Windows API documentation for more information. + inline CWnd CWnd::GetActiveWindow() const + { + return CWnd(::GetActiveWindow() ); + } + + // The GetCapture function retrieves the window (if any) that has captured the mouse. + // Refer to GetCapture in the Windows API documentation for more information. + inline CWnd CWnd::GetCapture() const + { + return CWnd( ::GetCapture() ); + } + + // The GetClassLongPtr function retrieves the specified value from the + // WNDCLASSEX structure associated with the window. + // Possible index values: GCL_CBCLSEXTRA, GCL_CBWNDEXTRA, GCLP_ HBRBACKGROUND, + // GCLP_HCURSOR, GCLP_HICON, GCLP_HICONSM, GCLP_HMODULE, GCLP_MENUNAME, + // GCL_STYLE, GCLP_WNDPROC. + // Refer to GetClassLongPtr in the Windows API documentation for more information. + inline ULONG_PTR CWnd::GetClassLongPtr(int index) const + { + assert(IsWindow()); + return ::GetClassLongPtr(*this, index); + } + + // The GetClientRect function retrieves the coordinates of a window's + // client area. The client coordinates specify the upper-left and + // lower-right corners of the client area. Because client coordinates are + // relative to the upper-left corner of a window's client area, the + // coordinates of the upper-left corner are (0,0). + // Refer to GetClientRect in the Windows API documentation for more information. + inline CRect CWnd::GetClientRect() const + { + assert(IsWindow()); + CRect rc; + VERIFY(::GetClientRect(*this, &rc)); + return rc; + } + + // The GetDC function retrieves the display device context (DC) + // for the client area of the window. Use like this: + // CDC dc = GetDC; + // Refer to GetDC in the Windows API documentation for more information. + inline CClientDC CWnd::GetDC() const + { + assert(IsWindow()); + return CClientDC(*this); + } + + // The GetDCEx function retrieves a display device context (DC) for the + // client area or entire area of a window. Use like this: + // CDC dc = GetDCEx(clip, flags); + // Refer to GetDCEx in the Windows API documentation for more information. + inline CClientDCEx CWnd::GetDCEx(HRGN clip, DWORD flags) const + { + assert(IsWindow()); + return CClientDCEx(*this, clip, flags); + } + + // The GetDesktopWindow function retrieves the desktop window. + // Refer to GetDesktopWindow in the Windows API documentation for more information. + inline CWnd CWnd::GetDesktopWindow() const + { + return CWnd( ::GetDesktopWindow() ); + } + + // Retrieves the control ID value for any child window. + // Refer to GetDlgCtrlID in the Windows API documentation for more information. + inline UINT CWnd::GetDlgCtrlID() const + { + assert(IsWindow()); + return static_cast(::GetDlgCtrlID(*this)); + } + + // The GetDlgItem function retrieves a handle to a control in the dialog box. + // Refer to GetDlgItem in the Windows API documentation for more information. + inline CWnd CWnd::GetDlgItem(UINT dlgItemID) const + { + assert(IsWindow()); + return CWnd( ::GetDlgItem(*this, static_cast(dlgItemID)) ); + } + + // The GetDlgItemInt function translates the text of a specified control in + // a dialog box into an integer value. + // Refer to GetDlgItemInt in the Windows API documentation for more information. + inline UINT CWnd::GetDlgItemInt(UINT dlgItemID, BOOL& isTranslated, BOOL isSigned) const + { + assert(IsWindow()); + return ::GetDlgItemInt(*this, static_cast(dlgItemID), &isTranslated, isSigned); + } + + // The GetDlgItemInt function translates the text of a specified control in + // a dialog box into an integer value. + // Refer to GetDlgItemInt in the Windows API documentation for more information. + inline UINT CWnd::GetDlgItemInt(UINT dlgItemID, BOOL isSigned) const + { + assert(IsWindow()); + return ::GetDlgItemInt(*this, static_cast(dlgItemID), nullptr, isSigned); + } + + // Retrieves the window's extended window style. + // Refer to GetWindowLongPtr in the Windows API documentation for more information. + inline DWORD CWnd::GetExStyle() const + { + assert(IsWindow()); + return static_cast(GetWindowLongPtr(GWL_EXSTYLE)); + } + + // The GetFocus function retrieves the window that has the keyboard focus, if the window + // is attached to the calling thread's message queue. + // Refer to GetFocus in the Windows API documentation for more information. + inline CWnd CWnd::GetFocus() const + { + return CWnd( ::GetFocus() ); + } + + // Retrieves the font with which the window is currently drawing its text. + // Refer to WM_GETFONT in the Windows API documentation for more information. + inline CFont CWnd::GetFont() const + { + assert(IsWindow()); + HFONT font = (HFONT)SendMessage(WM_GETFONT, 0, 0); + return CFont(font); + } + + // Retrieves a handle to the large or small icon associated with a window. + // Refer to WM_GETICON in the Windows API documentation for more information. + inline HICON CWnd::GetIcon(BOOL isBigIcon) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(isBigIcon); + return reinterpret_cast(SendMessage(WM_GETICON, wparam, 0)); + } + + // The GetLastActivePopup function determines which pop-up window owned + // by the specified window was most recently active. + // Refer to GetLastActivePopup in the Windows API documentation for more information. + inline CWnd CWnd::GetLastActivePopup() const + { + assert(IsWindow()); + return CWnd(::GetLastActivePopup(*this)); + } + + // The GetMenu function retrieves a handle to the menu assigned to the window. + // The menu handle will be zero if the window doesn't have a menu. + // Refer to GetMenu in the Windows API documentation for more information. + inline CMenu CWnd::GetMenu() const + { + assert(IsWindow()); + return CMenu(::GetMenu(*this)); + } + + // The GetNextDlgGroupItem function retrieves the first control in a group of + // controls that precedes (or follows) the specified control in a dialog box. + // Refer to GetNextDlgGroupItem in the Windows API documentation for more information. + inline CWnd CWnd::GetNextDlgGroupItem(HWND control, BOOL isPrevious) const + { + assert(IsWindow()); + return CWnd(::GetNextDlgGroupItem(*this, control, isPrevious)); + } + + // The GetNextDlgTabItem function retrieves the first control that has the + // WS_TABSTOP style that precedes (or follows) the specified control. + // Refer to GetNextDlgTabItem in the Windows API documentation for more information. + inline CWnd CWnd::GetNextDlgTabItem(HWND control, BOOL isPrevious) const + { + assert(IsWindow()); + return CWnd(::GetNextDlgTabItem(*this, control, isPrevious)); + } + + // The GetParent function retrieves the specified window's parent or owner. + // Refer to GetParent in the Windows API documentation for more information. + inline CWnd CWnd::GetParent() const + { + assert(IsWindow()); + return CWnd(::GetParent(*this)); + } + + // The GetScrollInfo function retrieves the parameters of a scroll bar, + // including the minimum and maximum scrolling positions, the page size, + // and the position of the scroll box (thumb). + // Refer to GetScrollInfo in the Windows API documentation for more information. + inline BOOL CWnd::GetScrollInfo(int barType, SCROLLINFO& si) const + { + assert(IsWindow()); + return ::GetScrollInfo(*this, barType, &si); + } + + // The GetScrollPos function retrieves the current position of the scroll box + // (thumb) in the specified scroll bar. + // Refer to GetScrollPos in the Windows API documentation for more information. + inline int CWnd::GetScrollPos(int bar) const + { + assert(IsWindow()); + return ::GetScrollPos(*this, bar); + } + + // The GetScrollRange function retrieves the current minimum and maximum scroll box + // (thumb) positions for the specified scroll bar. + // Refer to GetScrollRange in the Windows API documentation for more information. + inline BOOL CWnd::GetScrollRange(int bar, int& minPos, int& maxPos) const + { + assert(IsWindow()); + return ::GetScrollRange(*this, bar, &minPos, &maxPos); + } + + // Retrieves the window's window style. + // Refer to GetWindowLongPtr in the Windows API documentation for more information. + inline DWORD CWnd::GetStyle() const + { + assert(IsWindow()); + return static_cast(GetWindowLongPtr(GWL_STYLE)); + } + + + // The GetSystemMenu function allows the application to access the window + // menu (AKA system menu). If this parameter is TRUE, GetSystemMenu resets + // the window menu back to the default state. + // Refer to GetSystemMenu in the Windows API documentation for more information. + inline CMenu CWnd::GetSystemMenu(BOOL revertToDefault) const + { + assert(IsWindow()); + if (revertToDefault) + { + // Detach any currently attached CMenu before the menu is destroyed. + CMenu menu(::GetSystemMenu(*this, FALSE)); + menu.Detach(); + + // Reset the window menu back to the default state. + ::GetSystemMenu(*this, revertToDefault); + } + + return CMenu(::GetSystemMenu(*this, FALSE)); + } + + + // The GetTopWindow function examines the Z order of the child windows + // associated with the parent window and retrieves a handle to the child + // window at the top of the Z order. + // Refer to GetTopWindow in the Windows API documentation for more information. + inline CWnd CWnd::GetTopWindow() const + { + assert(IsWindow()); + return CWnd(::GetTopWindow(*this)); + } + + // The GetWindowPlacement function retrieves the show state and the restored, + // minimized, and maximized positions of the window. + // Refer to GetWindowPlacement in the Windows API documentation for more information. + inline BOOL CWnd::GetWindowPlacement(WINDOWPLACEMENT& wp) const + { + assert(IsWindow()); + return ::GetWindowPlacement(*this, &wp); + } + + // The GetUpdateRect function retrieves the coordinates of the smallest rectangle + // that completely encloses the update region of the specified window. + // Refer to GetUpdateRect in the Windows API documentation for more information. + inline CRect CWnd::GetUpdateRect(BOOL erase) const + { + assert(IsWindow()); + CRect rc; + ::GetUpdateRect(*this, &rc, erase); + return rc; + } + + // The GetUpdateRgn function retrieves the update region of a window by copying + // it into the specified region. + // Refer to GetUpdateRgn in the Windows API documentation for more information. + inline int CWnd::GetUpdateRgn(HRGN rgn, BOOL erase) const + { + assert(IsWindow()); + return ::GetUpdateRgn(*this, rgn, erase); + } + + // The GetWindow function retrieves a window that has the specified + // relationship (Z-Order or owner) to the specified window. + // Possible cmd values: GW_CHILD, GW_ENABLEDPOPUP, GW_HWNDFIRST, GW_HWNDLAST, + // GW_HWNDNEXT, GW_HWNDPREV, GW_OWNER. + // Refer to GetWindow in the Windows API documentation for more information. + inline CWnd CWnd::GetWindow(UINT cmd) const + { + assert(IsWindow()); + return CWnd( ::GetWindow(*this, cmd) ); + } + + // The GetWindowDC function retrieves the device context (DC) for the entire + // window, including title bar, menus, and scroll bars. Use like this: + // CDC dc = GetWindowDC(); + // Refer to GetWindowDC in the Windows API documentation for more information. + inline CWindowDC CWnd::GetWindowDC() const + { + assert(IsWindow()); + return CWindowDC(*this); + } + + // The GetWindowLongPtr function retrieves information about the window. + // Possible index values: GWL_EXSTYLE, GWL_STYLE, GWLP_WNDPROC, GWLP_HINSTANCE + // GWLP_HWNDPARENT, GWLP_ID, GWLP_USERDATA. + // Additional index values for dialogs: DWLP_DLGPROC, DWLP_MSGRESULT, DWLP_USER. + // Refer to GetWindowLongPtr in the Windows API documentation for more information. + inline LONG_PTR CWnd::GetWindowLongPtr(int index) const + { + assert(IsWindow()); + return ::GetWindowLongPtr(*this, index); + } + + // retrieves the dimensions of the bounding rectangle of the window. + // The dimensions are given in screen coordinates that are relative to the + // upper-left corner of the screen. + // Refer to GetWindowRect in the Windows API documentation for more information. + inline CRect CWnd::GetWindowRect() const + { + assert(IsWindow()); + CRect rc; + VERIFY(::GetWindowRect(*this, &rc)); + return rc; + } + + // The GetWindowTextLength function retrieves the length, in characters, of + // the specified window's title bar text (if the window has a title bar). + // Refer to GetWindowTextLength in the Windows API documentation for more information. + inline int CWnd::GetWindowTextLength() const + { + assert(IsWindow()); + return ::GetWindowTextLength(*this); + } + + // The HiliteMenuItem function highlights or removes the highlighting from + // an item in a menu bar. + // Refer to HiliteMenuItem in the Windows API documentation for more information. + inline BOOL CWnd::HiliteMenuItem(HMENU menu, UINT itemID, UINT hilite) const + { + assert(IsWindow()); + return ::HiliteMenuItem(*this, menu, itemID, hilite); + } + + // The Invalidate function adds the entire client area to the window's + // update region. The update region represents the portion of the window's + // client area that must be redrawn. + // Refer to InvalidateRect in the Windows API documentation for more information. + inline void CWnd::Invalidate(BOOL erase /*= TRUE*/) const + { + assert(IsWindow()); + VERIFY(::InvalidateRect(*this, nullptr, erase)); + } + + // The InvalidateRect function adds a rectangle to the window's update region. + // The update region represents the portion of the window's client area that + // must be redrawn. + // Refer to InvalidateRect in the Windows API documentation for more information. + inline BOOL CWnd::InvalidateRect(RECT rect, BOOL erase /*= TRUE*/) const + { + assert(IsWindow()); + return ::InvalidateRect(*this, &rect, erase); + } + + // The InvalidateRect function adds a rectangle to the window's update region. + // The entire window's client area is redrawn when no rectangle is specified. + // Refer to InvalidateRect in the Windows API documentation for more information. + inline BOOL CWnd::InvalidateRect(BOOL erase /*= TRUE*/) const + { + assert(IsWindow()); + return ::InvalidateRect(*this, nullptr, erase); + } + + // The InvalidateRgn function invalidates the client area within the specified region + // by adding it to the current update region of a window. The invalidated region, + // along with all other areas in the update region, is marked for painting when the + // next WM_PAINT message occurs. + // Refer to InvalidateRgn in the Windows API documentation for more information. + inline BOOL CWnd::InvalidateRgn(HRGN rgn, BOOL erase /*= TRUE*/) const + { + assert(IsWindow()); + return ::InvalidateRgn(*this, rgn, erase); + } + + // The IsChild function tests whether a window is a child window or descendant window + // of a parent window's CWnd. + // Refer to IsChild in the Windows API documentation for more information. + inline BOOL CWnd::IsChild(HWND child) const + { + assert(IsWindow()); + return ::IsChild(*this, child); + } + + // The IsDialogMessage function determines whether a message is intended + // for the specified dialog box and, if it is, processes the message. + // Refer to IsDialogMessage in the Windows API documentation for more information. + inline BOOL CWnd::IsDialogMessage(MSG& msg) const + { + assert(IsWindow()); + return ::IsDialogMessage(*this, &msg); + } + + // The IsDlgButtonChecked function determines whether a button control has + // a check mark next to it or whether a three-state button control is + // grayed, checked, or neither. + // + // The return value from a button created with the BS_AUTOCHECKBOX, + // BS_AUTORADIOBUTTON, BS_AUTO3STATE, BS_CHECKBOX, BS_RADIOBUTTON, or + // BS_3STATE style can be one of the following: + // BST_CHECKED Button is checked. + // BST_INDETERMINATE Button is grayed, indicating an indeterminate state + // (applies only if the button has the BS_3STATE or BS_AUTO3STATE style). + // BST_UNCHECKED Button is cleared. + // + // If the button has any other style, the return value is zero. + // Refer to IsDlgButtonChecked in the Windows API documentation for more information. + inline UINT CWnd::IsDlgButtonChecked(UINT buttonID) const + { + assert(IsWindow()); + return ::IsDlgButtonChecked(*this, static_cast(buttonID)); + } + + // The IsWindowEnabled function determines whether the window is enabled + // for mouse and keyboard input. + // Refer to IsWindowEnabled in the Windows API documentation for more information. + inline BOOL CWnd::IsWindowEnabled() const + { + assert(IsWindow()); + return ::IsWindowEnabled(*this); + } + + // The IsIconic function determines whether the window is minimized (iconic). + // Refer to IsIconic in the Windows API documentation for more information. + inline BOOL CWnd::IsIconic() const + { + assert(IsWindow()); + return ::IsIconic(*this); + } + + // The IsWindow function determines whether the window exists. + // Refer to IsWindow in the Windows API documentation for more information. + inline BOOL CWnd::IsWindow() const + { + return ::IsWindow(*this); + } + + // The IsWindowVisible function retrieves the visibility state of the window. + // Refer to IsWindowVisible in the Windows API documentation for more information. + inline BOOL CWnd::IsWindowVisible() const + { + // Microsoft's IsWindowVisible is buggy, so we do it like this + assert(IsWindow()); + return (GetStyle() & WS_VISIBLE) != 0; + } + + // The IsZoomed function determines whether the window is maximized. + // Refer to IsZoomed in the Windows API documentation for more information. + inline BOOL CWnd::IsZoomed() const + { + assert(IsWindow()); + return ::IsZoomed(*this); + } + + // Destroys the specified timer. + // Refer to KillTimer in the Windows API documentation for more information. + inline BOOL CWnd::KillTimer(UINT_PTR eventID) const + { + assert(IsWindow()); + return ::KillTimer(*this, eventID); + } + + // Disables drawing in the window. Only one window can be locked at a time. + // Use UnLockWindowUpdate to re-enable drawing in the window. + // Refer to LockWindowUpdate in the Windows API documentation for more information. + inline BOOL CWnd::LockWindowUpdate() const + { + assert(IsWindow()); + return ::LockWindowUpdate(*this); + } + + // The MapWindowPoints function converts (maps) a set of points from a + // coordinate space relative to one window to a coordinate space relative + // to another window. + // Refer to MapWindowPoints in the Windows API documentation for more information. + inline int CWnd::MapWindowPoints(HWND to, POINT& point) const + { + assert(IsWindow()); + return ::MapWindowPoints(*this, to, &point, 1); + } + + // The MapWindowPoints function converts (maps) a set of points from a + // coordinate space relative to one window to a coordinate space relative + // to another window. + // Refer to MapWindowPoints in the Windows API documentation for more information. + inline int CWnd::MapWindowPoints(HWND to, RECT& rect) const + { + assert(IsWindow()); + return ::MapWindowPoints(*this, to, reinterpret_cast(&rect), 2); + } + + // The MapWindowPoints function converts (maps) a set of points from a + // coordinate space relative to one window to a coordinate space relative + // to another window. + // Refer to MapWindowPoints in the Windows API documentation for more information. + inline int CWnd::MapWindowPoints(HWND to, LPPOINT pointsArray, UINT count) const + { + assert(IsWindow()); + return ::MapWindowPoints(*this, to, reinterpret_cast(pointsArray), count); + } + + // The MessageBox function creates, displays, and operates a message box. + // Possible combinations of type values include: MB_OK, MB_HELP, MB_OKCANCEL, + // MB_RETRYCANCEL, MB_YESNO, MB_YESNOCANCEL, MB_ICONEXCLAMATION, MB_ICONWARNING, + // MB_ICONERROR (+ many others). + // Refer to MessageBox in the Windows API documentation for more information. + inline int CWnd::MessageBox(LPCTSTR text, LPCTSTR caption, UINT type) const + { + assert(IsWindow()); + return ::MessageBox(*this, text, caption, type); + } + + // The MoveWindow function changes the position and dimensions of the window. + // Refer to MoveWindow in the Windows API documentation for more information. + inline BOOL CWnd::MoveWindow(int x, int y, int width, int height, BOOL repaint /* = TRUE*/) const + { + assert(IsWindow()); + return ::MoveWindow(*this, x, y, width, height, repaint = TRUE); + } + + // The MoveWindow function changes the position and dimensions of the window. + // Refer to MoveWindow in the Windows API documentation for more information. + inline BOOL CWnd::MoveWindow(RECT rect, BOOL repaint /* = TRUE*/) const + { + assert(IsWindow()); + return ::MoveWindow(*this, rect.left, rect.top, rect.right - rect.left, + rect.bottom - rect.top, repaint); + } + + // The PostMessage function places (posts) a message in the message queue + // associated with the thread that created the window and returns without + // waiting for the thread to process the message. + // Refer to PostMessage in the Windows API documentation for more information. + inline BOOL CWnd::PostMessage(UINT msg, WPARAM wparam /*= 0*/, LPARAM lparam /*= 0*/) const + { + assert(IsWindow()); + return ::PostMessage(*this, msg, wparam, lparam); + } + + // The OpenIcon function restores a minimized (iconic) window to its previous + // size and position. + // Refer to OpenIcon in the Windows API documentation for more information. + inline BOOL CWnd::OpenIcon() const + { + assert(IsWindow()); + return ::OpenIcon(*this); + } + + // The PostMessage function places (posts) a message in the message queue + // associated with the thread that created the window and returns without + // waiting for the thread to process the message. + // Refer to PostMessage in the Windows API documentation for more information. + inline BOOL CWnd::PostMessage(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam) const + { + // Required by by some macros + assert(IsWindow()); + return ::PostMessage(wnd, msg, wparam, lparam); + } + + // Requests that the window draw itself in the specified device context, + // most commonly in a printer device context. + // Refer to WM_PRINT in the Windows API documentation for more information. + inline void CWnd::Print(HDC dc, DWORD flags) const + { + assert(IsWindow()); + WPARAM wparam = reinterpret_cast(dc); + LPARAM lparam = static_cast(flags); + SendMessage(*this, WM_PRINT, wparam, lparam); + } + + // The RedrawWindow function updates the specified rectangle in a window's + // client area. + // Refer to RedrawWindow in the Windows API documentation for more information. + inline BOOL CWnd::RedrawWindow(RECT updateRect, UINT flags) const + { + assert(IsWindow()); + return ::RedrawWindow(*this, &updateRect, nullptr, flags); + } + + // The RedrawWindow function updates the specified region in a window's + // client area. + // Refer to RedrawWindow in the Windows API documentation for more information. + inline BOOL CWnd::RedrawWindow(HRGN rgn, UINT flags) const + { + assert(IsWindow()); + return ::RedrawWindow(*this, nullptr, rgn, flags); + } + + // The RedrawWindow function updates the entire window's client area. + // Refer to RedrawWindow in the Windows API documentation for more information. + inline BOOL CWnd::RedrawWindow(UINT flags) const + { + assert(IsWindow()); + return ::RedrawWindow(*this, nullptr, nullptr, flags); + } + + // The ReleaseDC function releases a device context (DC), freeing it for use + // by other applications. + // Refer to ReleaseDC in the Windows API documentation for more information. + inline int CWnd::ReleaseDC(HDC dc) const + { + assert(IsWindow()); + return ::ReleaseDC(*this, dc); + } + + // The ScreenToClient function converts the screen coordinates of + // a specified point on the screen to client-area coordinates. + // Refer to ScreenToClient in the Windows API documentation for more information. + inline BOOL CWnd::ScreenToClient(POINT& point) const + { + assert(IsWindow()); + return ::ScreenToClient(*this, &point); + } + + // The ScreenToClient function converts the screen coordinates of + // a specified RECT on the screen to client-area coordinates. + // Refer to ScreenToClient in the Windows API documentation for more information. + inline BOOL CWnd::ScreenToClient(RECT& rect) const + { + assert(IsWindow()); + return static_cast(::MapWindowPoints(HWND_DESKTOP, *this, + reinterpret_cast(&rect), 2)); + } + + // The ScrollWindow function scrolls the contents of the window's client area. + // scrollRect specifies the portion of the client area to be scrolled. + // pClipRect points to the clipping rectangle to scroll. Only bits inside + // this rectangle are scrolled. + // If prcClip is nullptr, no clipping is performed on the scroll rectangle. + // Refer to ScrollWindow in the Windows API documentation for more information. + inline BOOL CWnd::ScrollWindow(int xAmount, int yAmount, RECT scrollRect, LPCRECT pClipRect) const + { + assert(IsWindow()); + return ::ScrollWindow(*this, xAmount, yAmount, &scrollRect, pClipRect); + } + + // The ScrollWindow function scrolls the contents of the window's client area. + // The entire client area is scrolled. + // pClipRect points to the clipping rectangle to scroll. Only bits inside this + // rectangle are scrolled. + // If pClipRect is nullptr, no clipping is performed on the scroll rectangle. + // Refer to ScrollWindow in the Windows API documentation for more information. + inline BOOL CWnd::ScrollWindow(int xAmount, int yAmount, LPCRECT pClipRect) const + { + assert(IsWindow()); + return ::ScrollWindow(*this, xAmount, yAmount, nullptr, pClipRect); + } + + // The ScrollWindow function scrolls the contents of the window's client area. + // pScrollRect: Pointer to a RECT structure that specifies the portion of the + // client area to be scrolled. + // If this parameter is nullptr, the entire client area is scrolled. + // pClipRect: Pointer to a RECT structure that contains the coordinates of + // the clipping rectangle. + // Only device bits within the clipping rectangle are affected. + // This parameter may be nullptr. + // update: Handle to the region that is modified to hold the region + // invalidated by scrolling. + // This parameter may be 0. + // pUpdateRect: Pointer to a RECT structure that receives the boundaries of + // the rectangle invalidated by scrolling. + // This parameter may be nullptr. + // flags: Specifies flags that control scrolling.This parameter can be + // one of the following values. + // SW_ERASE: Erases the newly invalidated region when specified + // with the SW_INVALIDATE flag. + // SW_INVALIDATE: Invalidates the region identified by the update + // parameter after scrolling. + // SW_SCROLLCHILDREN: Scrolls all child windows that intersect the + // rectangle pointed to by the prcScroll parameter. + // SW_SMOOTHSCROLL: Scrolls using smooth scrolling. + // Refer to ScrollWindowEx in the Windows API documentation for more information. + inline int CWnd::ScrollWindowEx(int dx, int dy, LPCRECT pScrollRect, LPCRECT pClipRect, + HRGN update, LPRECT pUpdateRect, UINT flags) const + { + assert(IsWindow()); + return ::ScrollWindowEx(*this, dx, dy, pScrollRect, pClipRect, update, + pUpdateRect, flags); + } + + // The SendDlgItemMessage function sends a message to the specified control + // in a dialog box. + // Refer to SendDlgItemMessage in the Windows API documentation for more information. + inline LRESULT CWnd::SendDlgItemMessage(UINT dlgItemID, UINT msg, + WPARAM wparam, LPARAM lparam) const + { + assert(IsWindow()); + return ::SendDlgItemMessage(*this, static_cast(dlgItemID), + msg, wparam, lparam); + } + + // The SendMessage function sends the specified message to a window or windows. + // It calls the window procedure for the window and does not return until the + // window procedure has processed the message. + // Refer to SendMessage in the Windows API documentation for more information. + inline LRESULT CWnd::SendMessage(UINT msg, WPARAM wparam /*= 0*/, + LPARAM lparam /*= 0*/) const + { + assert(IsWindow()); + return ::SendMessage(*this, msg, wparam, lparam); + } + + // The SendMessage function sends the specified message to a window or windows. + // It calls the window procedure for the window and does not return until the + // window procedure has processed the message. + // Refer to SendMessage in the Windows API documentation for more information. + inline LRESULT CWnd::SendMessage(HWND wnd, UINT msg, WPARAM wparam, + LPARAM lparam) const + { + // Required by by some macros + assert(IsWindow()); + return ::SendMessage(wnd, msg, wparam, lparam); + } + + // The SendNotifyMessage function sends the specified message to a window + // or windows. If the window was created by the calling thread, SendNotifyMessage + // calls the window procedure for the window and does not return until the + // window procedure has processed the message. If the window was created by + // a different thread, SendNotifyMessage passes the message to the window + // procedure and returns immediately; it does not wait for the window procedure + // to finish processing the message. + // Refer to SendNotifyMessage in the Windows API documentation for more information. + inline BOOL CWnd::SendNotifyMessage(UINT msg, WPARAM wparam, LPARAM lparam) const + { + assert(IsWindow()); + return ::SendNotifyMessage(*this, msg, wparam, lparam); + } + + // The SetActiveWindow function activates the window, but + // not if the application is in the background. + // Refer to SetActiveWindow in the Windows API documentation for more information. + inline HWND CWnd::SetActiveWindow() const + { + assert(IsWindow()); + return ::SetActiveWindow(*this); + } + + // The SetCapture function sets the mouse capture to the window. + // SetCapture captures mouse input either when the mouse is over the capturing + // window, or when the mouse button was pressed while the mouse was over the + // capturing window and the button is still down. + // Refer to SetCapture in the Windows API documentation for more information. + inline HWND CWnd::SetCapture() const + { + assert(IsWindow()); + return ::SetCapture(*this); + } + + // The SetClassLongPtr function replaces the specified value at the + // specified offset in the extra class memory or the WNDCLASSEX structure + // for the class to which the window belongs. Possible index values: + // GCL_CBCLSEXTRA, GCL_CBWNDEXTRA, GCLP_ HBRBACKGROUND, GCLP_HCURSOR, + // GCLP_HICON, GCLP_HICONSM, GCLP_HMODULE, GCLP_MENUNAME, GCL_STYLE, + // GCLP_WNDPROC. + // Refer to SetClassLongPtr in the Windows API documentation for more information. + inline ULONG_PTR CWnd::SetClassLongPtr(int index, LONG_PTR newLong) const + { + assert(IsWindow()); + return ::SetClassLongPtr(*this, index, newLong); + } + + // Assigns an id to the window. Note that only child windows can have an ID + // assigned. + // Refer to SetClassLongPtr in the Windows API documentation for more information. + inline LONG_PTR CWnd::SetDlgCtrlID(UINT id) const + { + assert(IsWindow()); + return SetWindowLongPtr(GWLP_ID, id); + } + + // The SetDlgItemInt function sets the text of a control in a dialog box to + // the string representation of a specified integer value. + // Refer to SetDlgItemInt in the Windows API documentation for more information. + inline BOOL CWnd::SetDlgItemInt(UINT dlgItemID, UINT value, BOOL isSigned) const + { + assert(IsWindow()); + return ::SetDlgItemInt(*this, static_cast(dlgItemID), value, isSigned); + } + + // The SetDlgItemText function sets the title or text of a control in a dialog box. + // Refer to SetDlgItemText in the Windows API documentation for more information. + inline BOOL CWnd::SetDlgItemText(UINT dlgItemID, LPCTSTR string) const + { + assert(IsWindow()); + return ::SetDlgItemText(*this, static_cast(dlgItemID), string); + } + + // Assigns a new windows extended style to the window. + // Refer to SetWindowLongPtr in the Windows API documentation for more information. + inline void CWnd::SetExStyle(DWORD exStyle) const + { + assert(IsWindow()); + ::SetWindowLongPtr(*this, GWL_EXSTYLE, static_cast(exStyle)); + } + + // The SetFocus function sets the keyboard focus to the window. + // Refer to SetFocus in the Windows API documentation for more information. + inline HWND CWnd::SetFocus() const + { + assert(IsWindow()); + return ::SetFocus(*this); + } + + // Specifies the font that the window will use when drawing text. + // Refer to WM_SETFONT in the Windows API documentation for more information. + inline void CWnd::SetFont(HFONT font, BOOL redraw /* = TRUE*/) const + { + assert(IsWindow()); + WPARAM wparam = reinterpret_cast(font); + LPARAM lparam = static_cast(redraw); + SendMessage(WM_SETFONT, wparam, lparam); + } + + // The SetForegroundWindow function puts the thread that created the window + // into the foreground and activates the window. + // Refer to SetForegroundWindow in the Windows API documentation for more information. + inline BOOL CWnd::SetForegroundWindow() const + { + assert(IsWindow()); + return ::SetForegroundWindow(*this); + } + + // Associates a new large or small icon with a window. + // Refer to WM_SETICON in the Windows API documentation for more information. + inline HICON CWnd::SetIcon(HICON icon, BOOL isBigIcon) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(isBigIcon); + LPARAM lparam = reinterpret_cast(icon); + return reinterpret_cast(SendMessage(WM_SETICON, wparam, lparam)); + } + + // The SetMenu function assigns a menu to the specified window. + // A menu of 0 removes the menu. + // Refer to SetMenu in the Windows API documentation for more information. + inline BOOL CWnd::SetMenu(HMENU menu) const + { + assert(IsWindow()); + return ::SetMenu(*this, menu); + } + + // The SetParent function changes the parent window of the child window. + // Refer to SetParent in the Windows API documentation for more information. + inline HWND CWnd::SetParent(HWND parent) const + { + assert(IsWindow()); + return ::SetParent(*this, parent); + } + + // This function allows changes in that window to be redrawn or prevents + // changes in that window from being redrawn. + // Refer to WM_SETREDRAW in the Windows API documentation for more information. + inline BOOL CWnd::SetRedraw(BOOL redraw /*= TRUE*/) const + { + assert(IsWindow()); + WPARAM wparam = static_cast(redraw); + return static_cast(::SendMessage(*this, WM_SETREDRAW, wparam, 0)); + } + + // The SetScrollInfo function sets the parameters of a scroll bar, including + // the minimum and maximum scrolling positions, the page size, and the + // position of the scroll box (thumb). + // Refer to SetScrollInfo in the Windows API documentation for more information. + inline int CWnd::SetScrollInfo(int barType, const SCROLLINFO& si, BOOL redraw) const + { + assert(IsWindow()); + return ::SetScrollInfo(*this, barType, &si, redraw); + } + + // The SetScrollPos function sets the position of the scroll box (thumb) in + // the specified scroll bar. + // Refer to SetScrollPos in the Windows API documentation for more information. + inline int CWnd::SetScrollPos(int barType, int pos, BOOL redraw) const + { + assert(IsWindow()); + return ::SetScrollPos(*this, barType, pos, redraw); + } + + // The SetScrollRange function sets the minimum and maximum scroll box + // positions for the scroll bar. + // Refer to SetScrollRange in the Windows API documentation for more information. + inline BOOL CWnd::SetScrollRange(int barType, int minPos, int maxPos, BOOL redraw) const + { + assert(IsWindow()); + return ::SetScrollRange(*this, barType, minPos, maxPos, redraw); + } + + // Assigns a new windows style to the window. + // Refer to SetWindowLongPtr in the Windows API documentation for more information. + inline void CWnd::SetStyle(DWORD style) const + { + assert(IsWindow()); + ::SetWindowLongPtr(*this, GWL_STYLE, static_cast(style)); + } + + // Creates a timer with the specified time-out value. + // Refer to SetTimer in the Windows API documentation for more information. + inline UINT_PTR CWnd::SetTimer(UINT_PTR eventID, UINT elapse, TIMERPROC pTimerFunc) const + { + assert(IsWindow()); + return ::SetTimer(*this, eventID, elapse, pTimerFunc); + } + + // The SetWindowLongPtr function changes an attribute of the window. + // Possible index values: GWL_EXSTYLE, GWL_STYLE, GWLP_WNDPROC, GWLP_HINSTANCE + // GWLP_HWNDPARENT, GWLP_ID, GWLP_USERDATA. + // Additional index values for dialogs: DWLP_DLGPROC, DWLP_MSGRESULT, DWLP_USER. + // Refer to SetWindowLongPtr in the Windows API documentation for more information. + inline LONG_PTR CWnd::SetWindowLongPtr(int index, LONG_PTR newLong) const + { + assert(IsWindow()); + return ::SetWindowLongPtr(*this, index, newLong); + } + + // The SetWindowPlacement function sets the show state and the restored, minimized, + // and maximized positions of the window. + // Refer to SetWindowPlacement in the Windows API documentation for more information. + inline BOOL CWnd::SetWindowPlacement(const WINDOWPLACEMENT& wndpl) const + { + assert(IsWindow()); + return ::SetWindowPlacement(*this, &wndpl); + } + + // The SetWindowPos function changes the size, position, and Z order of a + // child, pop-up, or top-level window. + // The insertAfter can one of: HWND_TOP, HWND_TOPMOST, HWND_BOTTOM, or + // HWND_NOTOPMOST. + // Refer to SetWindowPos in the Windows API documentation for more information. + inline BOOL CWnd::SetWindowPos(HWND insertAfter, int x, int y, int cx, int cy, UINT flags) const + { + assert(IsWindow()); + return ::SetWindowPos(*this, insertAfter, x, y, cx, cy, flags); + } + + // The SetWindowPos function changes the size, position, and Z order of a + // child, pop-up, or top-level window. + // The insertAfter can one of: HWND_TOP, HWND_TOPMOST, HWND_BOTTOM, or + // HWND_NOTOPMOST. + // Refer to SetWindowPos in the Windows API documentation for more information. + inline BOOL CWnd::SetWindowPos(HWND insertAfter, RECT rect, UINT flags) const + { + assert(IsWindow()); + return ::SetWindowPos(*this, insertAfter, rect.left, rect.top, rect.right - rect.left, + rect.bottom - rect.top, flags); + } + + // The SetWindowRgn function sets the window region of the window. + // The window region determines the area within the window where the system + // permits drawing. The window now owns the region so it is detached from rgn. + // Refer to SetWindowRgn in the Windows API documentation for more information. + inline int CWnd::SetWindowRgn(HRGN rgn, BOOL redraw /*= TRUE*/) const + { + assert(IsWindow()); + int iResult = ::SetWindowRgn(*this, rgn, redraw); + if (rgn != nullptr) + { + if (iResult != 0) + { + CRgn region(rgn); + region.Detach(); // The system owns the region now. + } + } + + return iResult; + } + + // The SetWindowText function changes the text of the window's title bar + // (if it has one). + // Refer to SetWindowText in the Windows API documentation for more information. + inline BOOL CWnd::SetWindowText(LPCTSTR text) const + { + assert(IsWindow()); + return ::SetWindowText(*this, text); + } + + // Set the XP Theme for a window. + // Examples: + // SetWindowTheme(nullptr, nullptr); // Reverts the window's XP theme back to default. + // SetWindowTheme(L" ", L" "); // Disables XP theme for the window. + // Refer to SetWindowTheme in the Windows API documentation for more information. + inline HRESULT CWnd::SetWindowTheme(LPCWSTR subAppName, LPCWSTR subIdList) const + { + HRESULT result = E_NOTIMPL; + HMODULE theme = ::GetModuleHandle(_T("uxtheme.dll")); + if (theme != nullptr) + { + using SETWINDOWTHEME = HRESULT (WINAPI*)(HWND, LPCWSTR, LPCWSTR); + SETWINDOWTHEME pfn = reinterpret_cast( + reinterpret_cast(::GetProcAddress(theme, "SetWindowTheme"))); + + result = pfn(*this, subAppName, subIdList); + } + + return result; + } + + // The ShowOwnedPopups function shows or hides all pop-up windows owned by the specified window. + // Refer to ShowOwnedPopups in the Windows API documentation for more information. + inline BOOL CWnd::ShowOwnedPopups(BOOL show) const + { + assert(IsWindow()); + return ::ShowOwnedPopups(*this, show); + } + + // The ShowScrollBar function shows or hides the specified scroll bar. + // Refer to ShowScrollBar in the Windows API documentation for more information. + inline BOOL CWnd::ShowScrollBar(int bar, BOOL show) const + { + assert(IsWindow()); + return ::ShowScrollBar(*this, bar, show); + } + + // The ShowWindow function sets the window's show state. + // Refer to ShowWindow in the Windows API documentation for more information. + inline BOOL CWnd::ShowWindow(int showCmd /*= SW_SHOWNORMAL*/) const + { + assert(IsWindow()); + return ::ShowWindow(*this, showCmd); + } + + // The ShowWindowAsync function sets the show state of a window created by + // a different thread. + // Refer to ShowWindowAsync in the Windows API documentation for more information. + inline BOOL CWnd::ShowWindowAsync(int showCmd) const + { + assert(IsWindow()); + return ::ShowWindowAsync(*this, showCmd); + } + + // The UpdateWindow function updates the client area of the window by + // sending a WM_PAINT message to the window if the window's update region + // is not empty. If the update region is empty, no message is sent. + // Refer to UpdateWindow in the Windows API documentation for more information. + inline BOOL CWnd::UpdateWindow() const + { + assert(IsWindow()); + return ::UpdateWindow(*this); + } + + // Enables drawing in the window. Only one window can be locked at a time. + // Use LockWindowUpdate to disable drawing in the window. + // Refer to LockWindowUpdate in the Windows API documentation for more information. + inline BOOL CWnd::UnlockWindowUpdate() const + { + assert(IsWindow()); + return ::LockWindowUpdate(0); + } + + // The ValidateRect function validates the client area within a rectangle by + // removing the rectangle from the update region of the window. + // Refer to ValidateRect in the Windows API documentation for more information. + inline BOOL CWnd::ValidateRect(RECT rect) const + { + assert(IsWindow()); + return ::ValidateRect(*this, &rect); + } + + // The ValidateRect function validates the entire client area of the window. + // Refer to ValidateRect in the Windows API documentation for more information. + inline BOOL CWnd::ValidateRect() const + { + assert(IsWindow()); + return ::ValidateRect(*this, nullptr); + } + + // The ValidateRgn function validates the client area within a region by + // removing the region from the current update region of the window. + // Refer to ValidateRgn in the Windows API documentation for more information. + inline BOOL CWnd::ValidateRgn(HRGN rgn) const + { + assert(IsWindow()); + return ::ValidateRgn(*this, rgn); + } + + // The WindowFromDC function returns a handle to the window associated + // with the specified display device context (DC). + // Refer to WindowFromDC in the Windows API documentation for more information. + inline CWnd CWnd::WindowFromDC(HDC dc) const + { + return CWnd(::WindowFromDC(dc)); + } + + // Retrieves the window that contains the specified point (in screen coordinates). + // Refer to WindowFromPoint in the Windows API documentation for more information. + inline CWnd CWnd::WindowFromPoint(POINT point) const + { + return CWnd(::WindowFromPoint(point)); + } + + + #ifndef WIN32_LEAN_AND_MEAN + + // Registers whether a window accepts dropped files. + // Refer to DragAcceptFiles in the Windows API documentation for more information. + inline void CWnd::DragAcceptFiles(BOOL accept) const + { + assert(IsWindow()); + ::DragAcceptFiles(*this, accept); + } + + #endif + + +} + +#endif // _WIN32XX_WINCORE_H_ diff --git a/packages/media/cpp/packages/Win32xx/include/wxx_wincore0.h b/packages/media/cpp/packages/Win32xx/include/wxx_wincore0.h new file mode 100644 index 00000000..b0db1a9a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/include/wxx_wincore0.h @@ -0,0 +1,368 @@ +// Win32++ Version 10.2.1 +// Release Date: TBA +// +// David Nash +// email: dnash@bigpond.net.au +// url: https://sourceforge.net/projects/win32-framework +// https://github.com/DavidNash2024/Win32xx +// +// +// Copyright (c) 2005-2026 David Nash +// +// Permission is hereby granted, free of charge, to +// any person obtaining a copy of this software and +// associated documentation files (the "Software"), +// to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, +// merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom +// the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +// OR OTHER DEALINGS IN THE SOFTWARE. +// +//////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////// +// wxx_wincore0.h +// This file contains the declaration of the CWnd class. +// + +#ifndef _WIN32XX_WINCORE0_H_ +#define _WIN32XX_WINCORE0_H_ + +#include "wxx_appcore0.h" +#include "wxx_rect.h" + +#define POINTS_PER_INCH 72 + +#ifndef WM_DPICHANGED + #define WM_DPICHANGED 0x02E0 +#endif + +#ifndef WM_DPICHANGED_BEFOREPARENT + #define WM_DPICHANGED_BEFOREPARENT 0x02E2 +#endif + +#ifndef WM_DPICHANGED_AFTERPARENT + #define WM_DPICHANGED_AFTERPARENT 0x02E3 +#endif + +#ifndef WM_GETDPISCALEDSIZE + #define WM_GETDPISCALEDSIZE 0x02E4 +#endif + +// Messages defined by Win32++ +// WM_APP range: 0x8000 through 0xBFFF +// Note: The numbers defined for window messages don't always need to be unique. View windows defined by users for example, +// could use other user defined messages with the same number as those below without issue. +#define UWM_DOCKACTIVATE (WM_APP + 0x3F02) // Message - posted to dock ancestor when a docker is activated. +#define UWM_DOCKDESTROYED (WM_APP + 0x3F03) // Message - posted when docker is destroyed. +#define UWM_DRAWRBBKGND (WM_APP + 0x3F04) // Message - sent by rebar to parent to perform background drawing. Return TRUE if handled. +#define UWM_DRAWSBBKGND (WM_APP + 0x3F05) // Message - sent by statusbar to parent to perform background drawing. Return TRUE if handled. +#define UWM_GETCDIALOG (WM_APP + 0x3F06) // Message - returns a pointer to this CWnd if it inherits from CDialog. +#define UWM_GETCDOCKCONTAINER (WM_APP + 0x3F07) // Message - returns a pointer to this CWnd if it inherits from CDockContainer. +#define UWM_GETCDOCKER (WM_APP + 0x3F08) // Message - returns a pointer to this CWnd if it inherits from CDocker. +#define UWM_GETCFRAMET (WM_APP + 0x3F09) // Message - returns a pointer to this CWnd if it inherits from CFrameT. +#define UWM_GETCMENUBAR (WM_APP + 0x3F0A) // Message - returns a pointer to this CWnd if it inherits from CMenuBar. +#define UWM_GETCMDIFRAMET (WM_APP + 0x3F0B) // Message - returns a pointer to this CWnd if it inherits from CMDIFrameT. +#define UWM_GETCTABBEDMDI (WM_APP + 0x3F0C) // Message - returns a pointer to this CWnd if it inherits from CTabbedMDI. +#define UWM_GETCTOOLBAR (WM_APP + 0x3F0D) // Message - returns a pointer to this CWnd if it inherits from CToolBar. +#define UWM_GETCWND (WM_APP + 0x3F0E) // Message - returns a pointer to this CWnd. +#define UWM_GETFRAMEVIEW (WM_APP + 0x3F0F) // Message - returns the HWND of the frame's view window. Used by CMenuBar. +#define UWM_GETMBTHEME (WM_APP + 0x3F10) // Message - returns a pointer to MenuBarTheme. +#define UWM_GETRBTHEME (WM_APP + 0x3F11) // Message - returns a pointer to ReBarTheme. +#define UWM_GETSBTHEME (WM_APP + 0x3F12) // Message - returns a pointer to StatusBarTheme. +#define UWM_GETTBTHEME (WM_APP + 0x3F13) // Message - returns a pointer to ToolBarTheme. +#define UWM_MDIACTIVATED (WM_APP + 0x3F14) // Message - sent by MDI child to MDIFrame when it is activated. +#define UWM_MDIDESTROYED (WM_APP + 0x3F15) // Message - sent by MDI client when a MDI child is destroyed. +#define UWM_MDIGETACTIVE (WM_APP + 0x3F16) // Message - sent by MDI client when the state of a MDI child is queried. +#define UWM_POPUPMENU (WM_APP + 0x3F17) // Message - creates the menubar popup menu. +#define UWM_TBRESIZE (WM_APP + 0x3F18) // Message - sent by toolbar to parent. Used by the rebar. +#define UWM_TBWINPOSCHANGING (WM_APP + 0x3F19) // Message - sent to parent. Toolbar is resizing. + +// Dock and tab messages. +#define UWN_BARSTART (WM_APP + 0x3F20) // Notification - sent by CDocker when the docker bar selected for move. +#define UWN_BARMOVE (WM_APP + 0x3F21) // Notification - sent by CDocker when the docker bar is moved. +#define UWN_BAREND (WM_APP + 0x3F22) // Notification - sent by CDocker when moving the docker bar has ended. +#define UWN_DOCKSTART (WM_APP + 0x3F23) // Notification - sent by CDocker when it's about to start undocking. +#define UWN_DOCKMOVE (WM_APP + 0x3F24) // Notification - sent by CDocker when the undocked docker is being moved. +#define UWN_DOCKEND (WM_APP + 0x3F25) // Notification - sent by CDocker when the docker has been docked. +#define UMN_TABCHANGED (WM_APP + 0x3F26) // Notification - sent by CTab when the tab size or position changed. +#define UWN_TABDRAGGED (WM_APP + 0x3F27) // Notification - sent by CTab when the tab is being dragged. +#define UWN_TABCLOSE (WM_APP + 0x3F28) // Notification - sent by CTab when a tab is about to be closed. +#define UWN_UNDOCKED (WM_APP + 0x3F29) // Notification - sent by docker when undocked. + +// Print preview messages. +#define UWM_PREVIEWCLOSE (WM_APP + 0x3F2A) // Message - sent by CPrintPreview when the 'Close' button is pressed. +#define UWM_PREVIEWPRINT (WM_APP + 0x3F2B) // Message - sent by CPrintPreview when the 'Print Now' button is pressed. +#define UWM_PREVIEWSETUP (WM_APP + 0x3F2C) // Message - sent by CPrintPreview when the 'Print Setup' is button pressed. + + +namespace Win32xx +{ + + ////////////////////////////////////////// + // Registered messages defined by Win32++. + const UINT UWM_WINDOWCREATED = ::RegisterWindowMessage(_T("UWM_WINDOWCREATED")); // Posted when a window is created or attached. + + //////////////////////////////////////////////////////////////// + // The CWnd class manages a generic window. Other classes + // which provide the functionality of more specialized windows, + // inherit from CWnd. These include dialogs and window controls. + class CWnd : public CObject + { + friend class CColorDialog; + friend class CCommonDialog; + friend class CDialog; + friend class CFileDialog; + friend class CFolderDialog; + friend class CFontDialog; + friend class CMDIChild; + friend class CMessagePump; + friend class CPageSetupDialog; + friend class CPrintDialog; + friend class CPrintDialogEx; + friend class CPropertyPage; + friend class CPropertySheet; + friend class CTaskDialog; + friend class CWinApp; + friend class CWinThread; + + public: + CWnd(); // Constructor + CWnd(const CWnd& rhs); // Copy constructor + CWnd& operator=(const CWnd& rhs); // Assignment operator + virtual ~CWnd(); // Destructor + + // These virtual functions can be overridden. + virtual BOOL Attach(HWND wnd); + virtual BOOL AttachDlgItem(UINT id, HWND parent); + virtual void CenterWindow() const; + virtual HWND Create(HWND parent = nullptr); + virtual HWND CreateEx(DWORD exStyle, LPCTSTR className, LPCTSTR windowName, + DWORD style, int x, int y, int width, int height, HWND parent, + HMENU idOrMenu, LPVOID lparam = nullptr); + virtual HWND CreateEx(DWORD exStyle, LPCTSTR className, LPCTSTR windowName, + DWORD style, RECT rectc, HWND parent, UINT id, LPVOID lparam = nullptr); + virtual void Destroy(); + virtual HWND Detach(); + static CWnd* GetCWndPtr(HWND wnd); + virtual HICON SetIconLarge(UINT iconID); + virtual HICON SetIconSmall(UINT iconID); + + // For Data Exchange + virtual void DoDataExchange(CDataExchange& dx); + virtual BOOL UpdateData(CDataExchange& dx, BOOL retrieveAndValidate); + + // Accessors + HWND GetHwnd() const { return m_wnd; } + WNDPROC GetPrevWindowProc() const { return m_prevWindowProc; } + + // Wrappers for Win32 API functions. + // These functions aren't virtual, and shouldn't be overridden. + HDC BeginPaint(PAINTSTRUCT& ps) const; + BOOL BringWindowToTop() const; + LRESULT CallWindowProc(WNDPROC pPrevWndFunc, UINT msg, WPARAM wparam, LPARAM lparam) const; + BOOL CheckDlgButton(UINT buttonID, UINT check) const; + BOOL CheckRadioButton(UINT firstButtonID, UINT lastButtonID, UINT checkButtonID) const; + CWnd ChildWindowFromPoint(POINT point) const; + BOOL ClientToScreen(POINT& point) const; + BOOL ClientToScreen(RECT& rect) const; + void Close() const; + BOOL CloseWindow() const; + HDWP DeferWindowPos(HDWP winPosInfo, HWND insertAfter, int x, int y, int cx, int cy, UINT flags) const; + HDWP DeferWindowPos(HDWP winPosInfo, HWND insertAfter, RECT rect, UINT flags) const; + LRESULT DefWindowProc(UINT msg, WPARAM wparam, LPARAM lparam) const; + int DlgDirList(LPTSTR pathSpec, UINT listBoxID, UINT staticPathID, UINT fileType) const; + int DlgDirListComboBox(LPTSTR pathSpec, UINT comboBoxID, UINT staticPathID, UINT filetype) const; + BOOL DlgDirSelectEx(LPTSTR string, int count, UINT listBoxID) const; + BOOL DlgDirSelectComboBoxEx(LPTSTR string, int count, UINT comboBoxID) const; + CFont DpiScaleFont(const CFont& font, int pointSize) const; + int DpiScaleInt(int value) const; + LOGFONT DpiScaleLogfont(LOGFONT logfont, int pointSize) const; + CRect DpiScaleRect(RECT rc) const; + CBitmap DpiScaleUpBitmap(const CBitmap& bitmap) const; + BOOL DrawAnimatedRects(UINT aniID, RECT from, RECT to) const; + BOOL DrawCaption(HDC dc, RECT rect, UINT flags) const; + BOOL DrawMenuBar() const; + BOOL EnableScrollBar(UINT flags, UINT arrows) const; + BOOL EnableWindow(BOOL Enable = TRUE) const; + BOOL EndPaint(PAINTSTRUCT& ps) const; + CWnd GetActiveWindow() const; + CWnd GetAncestor(UINT flag = 3 /*= GA_ROOTOWNER*/) const; + CWnd GetCapture() const; + ULONG_PTR GetClassLongPtr(int index) const; + CString GetClassName() const; + CRect GetClientRect() const; + CClientDC GetDC() const; + CClientDCEx GetDCEx(HRGN clip, DWORD flags) const; + CWnd GetDesktopWindow() const; + UINT GetDlgCtrlID() const; + CWnd GetDlgItem(UINT dlgItemID) const; + UINT GetDlgItemInt(UINT dlgItemID, BOOL& isTranslated, BOOL isSigned) const; + UINT GetDlgItemInt(UINT dlgItemID, BOOL isSigned) const; + CString GetDlgItemText(UINT dlgItemID) const; + DWORD GetExStyle() const; + CWnd GetFocus() const; + CFont GetFont() const; + HICON GetIcon(BOOL isBigIcon) const; + CWnd GetLastActivePopup() const; + CMenu GetMenu() const; + CWnd GetNextDlgGroupItem(HWND control, BOOL isPrevious) const; + CWnd GetNextDlgTabItem(HWND control, BOOL isPrevious) const; + CWnd GetParent() const; + BOOL GetScrollInfo(int barType, SCROLLINFO& si) const; + int GetScrollPos(int barType) const; + BOOL GetScrollRange(int barType, int& minPos, int& maxPos) const; + DWORD GetStyle() const; + CMenu GetSystemMenu(BOOL revertToDefault = FALSE) const; + CWnd GetTopWindow() const; + CRect GetUpdateRect(BOOL erase) const; + int GetUpdateRgn(HRGN rgn, BOOL erase) const; + CWnd GetWindow(UINT cmd) const; + CWindowDC GetWindowDC() const; + LONG_PTR GetWindowLongPtr(int index) const; + BOOL GetWindowPlacement(WINDOWPLACEMENT& wp) const; + CRect GetWindowRect() const; + CString GetWindowText() const; + int GetWindowTextLength() const; + BOOL HiliteMenuItem(HMENU menu, UINT itemID, UINT hilite) const; + void Invalidate(BOOL erase = TRUE) const; + BOOL InvalidateRect(RECT rect, BOOL erase = TRUE) const; + BOOL InvalidateRect(BOOL erase = TRUE) const; + BOOL InvalidateRgn(HRGN rgn, BOOL erase = TRUE) const; + BOOL IsChild(HWND child) const; + BOOL IsDialogMessage(MSG& msg) const; + UINT IsDlgButtonChecked(UINT buttonID) const; + BOOL IsIconic() const; + BOOL IsWindow() const; + BOOL IsWindowEnabled() const; + BOOL IsWindowVisible() const; + BOOL IsZoomed() const; + BOOL KillTimer(UINT_PTR eventID) const; + BOOL LockWindowUpdate() const; + int MapWindowPoints(HWND to, POINT& point) const; + int MapWindowPoints(HWND to, RECT& rect) const; + int MapWindowPoints(HWND to, LPPOINT pointsArray, UINT count) const; + int MessageBox(LPCTSTR text, LPCTSTR caption, UINT type) const; + BOOL MoveWindow(int x, int y, int width, int height, BOOL repaint = TRUE) const; + BOOL MoveWindow(RECT rect, BOOL repaint = TRUE) const; + BOOL OpenIcon() const; + BOOL PostMessage(UINT msg, WPARAM wparam = 0, LPARAM lparam = 0) const; + BOOL PostMessage(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam) const; + void Print(HDC dc, DWORD flags) const; + BOOL RedrawWindow(RECT updateRect, UINT flags = RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_ALLCHILDREN) const; + BOOL RedrawWindow(HRGN rgn, UINT flags = RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_ALLCHILDREN) const; + BOOL RedrawWindow(UINT flags = RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_ALLCHILDREN) const; + int ReleaseDC(HDC dc) const; + BOOL ScreenToClient(POINT& point) const; + BOOL ScreenToClient(RECT& rect) const; + BOOL ScrollWindow(int xAmount, int yAmount, RECT scrollRect, LPCRECT pClipRect = nullptr) const; + BOOL ScrollWindow(int xAmount, int yAmount, LPCRECT pClipRect = nullptr) const; + int ScrollWindowEx(int dx, int dy, LPCRECT pScrollRect, LPCRECT pClipRect, + HRGN updateRgn, LPRECT updateRect, UINT flags) const; + LRESULT SendDlgItemMessage(UINT dlgItemID, UINT msg, WPARAM wparam, LPARAM lparam) const; + LRESULT SendMessage(UINT msg, WPARAM wparam = 0, LPARAM lparam = 0) const; + LRESULT SendMessage(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam) const; + BOOL SendNotifyMessage(UINT msg, WPARAM wparam, LPARAM lparam) const; + HWND SetActiveWindow() const; + HWND SetCapture() const; + ULONG_PTR SetClassLongPtr(int index, LONG_PTR newLong) const; + LONG_PTR SetDlgCtrlID(UINT id) const; + BOOL SetDlgItemInt(UINT dlgItemID, UINT value, BOOL isSigned) const; + BOOL SetDlgItemText(UINT dlgItemID, LPCTSTR string) const; + void SetExStyle(DWORD exStyle) const; + HWND SetFocus() const; + void SetFont(HFONT font, BOOL redraw = TRUE) const; + BOOL SetForegroundWindow() const; + HICON SetIcon(HICON icon, BOOL isBigIcon) const; + BOOL SetMenu(HMENU menu) const; + HWND SetParent(HWND parent) const; + BOOL SetRedraw(BOOL redraw = TRUE) const; + int SetScrollInfo(int barType, const SCROLLINFO& si, BOOL redraw) const; + int SetScrollPos(int barType, int pos, BOOL redraw) const; + BOOL SetScrollRange(int barType, int minPos, int maxPos, BOOL redraw) const; + void SetStyle(DWORD style) const; + UINT_PTR SetTimer(UINT_PTR eventID, UINT elapse, TIMERPROC pTimerFunc) const; + LONG_PTR SetWindowLongPtr(int index, LONG_PTR newLong) const; + BOOL SetWindowPlacement(const WINDOWPLACEMENT& wndpl) const; + BOOL SetWindowPos(HWND insertAfter, int x, int y, int cx, int cy, UINT flags) const; + BOOL SetWindowPos(HWND insertAfter, RECT rect, UINT flags) const; + int SetWindowRgn(HRGN rgn, BOOL redraw = TRUE) const; + BOOL SetWindowText(LPCTSTR text) const; + HRESULT SetWindowTheme(LPCWSTR subAppName, LPCWSTR subIdList) const; + BOOL ShowOwnedPopups(BOOL show) const; + BOOL ShowScrollBar(int barType, BOOL show) const; + BOOL ShowWindow(int showCmd = SW_SHOWNORMAL) const; + BOOL ShowWindowAsync(int showCmd) const; + BOOL UnlockWindowUpdate() const; + BOOL UpdateWindow() const; + BOOL ValidateRect(RECT rect) const; + BOOL ValidateRect() const; + BOOL ValidateRgn(HRGN rgn) const; + CWnd WindowFromDC(HDC dc) const; + CWnd WindowFromPoint(POINT point) const; + + #ifndef WIN32_LEAN_AND_MEAN + void DragAcceptFiles(BOOL accept) const; + #endif + + operator HWND() const { return GetHwnd(); } + + protected: + // Override these functions as required. + virtual LRESULT FinalWindowProc(UINT msg, WPARAM wparam, LPARAM lparam); + virtual void OnAttach(); + virtual BOOL OnCommand(WPARAM wparam, LPARAM lparam); + virtual void OnClose(); + virtual int OnCreate(CREATESTRUCT& cs); + virtual void OnDestroy(); + virtual void OnDraw(CDC& dc); + virtual BOOL OnEraseBkgnd(CDC& dc); + virtual void OnInitialUpdate(); + virtual void OnMenuUpdate(UINT id); + virtual LRESULT OnMessageReflect(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnNotify(WPARAM wparam, LPARAM lparam); + virtual LRESULT OnNotifyReflect(WPARAM wparam, LPARAM lparam); + virtual LRESULT OnPaint(UINT msg, WPARAM wparam, LPARAM lparam); + virtual void PreCreate(CREATESTRUCT& cs); + virtual void PreRegisterClass(WNDCLASS& wc); + virtual BOOL PreTranslateMessage(MSG& msg); + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam); + + // Not intended to be overridden. + virtual LRESULT WndProcDefault(UINT msg, WPARAM wparam, LPARAM lparam); + + private: + CWnd(HWND wnd); // Private constructor used internally. + + static LRESULT CALLBACK StaticWindowProc(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam); + + void AddToMap(); + void Cleanup(); + LRESULT MessageReflect(UINT msg, WPARAM wparam, LPARAM lparam) const; + BOOL RegisterClass(WNDCLASS& wc); + void Subclass(HWND wnd); + + HWND m_wnd; // Handle to this object's window. + WNDPROC m_prevWindowProc; // The old window procedure. + }; // class CWnd + +} // namespace Win32xx + +#endif // _WIN32XX_WINCORE0_H_ + diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation.cbp b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation.cbp new file mode 100644 index 00000000..f868c838 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation.cbp @@ -0,0 +1,139 @@ + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation.cbproj b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation.cbproj new file mode 100644 index 00000000..822a8993 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation.cbproj @@ -0,0 +1,1524 @@ + + + {39461456-1040-43CB-9B40-5962EF847BB0} + 20.1 + None + True + Release + Win64x + 1048579 + Application + Animation + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + JPHNE + .\Embarcadero\$(Platform)\$(Config) + .\Embarcadero\$(Platform)\$(Config) + false + true + true + $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + CppGuiApplication + System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + true + <_TCHARMapping>wchar_t + Animation + ..\..\..\include\;..\src\;$(IncludePath) + ..\..\..\include\;..\src\;$(ILINK_LibraryPath) + 3081 + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + $(BDSINCLUDE)\windows\sdk;$(BRCC_IncludePath) + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + ..\src\stdafx.h + none + + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + false + true + false + true + _DEBUG;$(Defines) + false + None + DEBUG + true + true + true + true + Full + true + true + true + true + true + $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) + $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + + + PerMonitorV2 + false + $(BDSLIB)\$(PLATFORM)$(CC_SUFFIX)\debug;$(ILINK_LibraryPath) + true + 1033 + false + + + PerMonitorV2 + true + 1033 + + + PerMonitorV2 + true + 1033 + + + NDEBUG;$(Defines) + None + + + PerMonitorV2 + false + true + 1033 + + + PerMonitorV2 + true + 1033 + <_TCHARMapping>wchar_t + + + PerMonitorV2 + true + 1033 + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + + + + 10 + + + 11 + + + 12 + + + 13 + + + 14 + + + 15 + + + 16 + + + 17 + + + 18 + + + 19 + + + 20 + + + 21 + + + 22 + + + 23 + + + 24 + + + 25 + + + 26 + + + 27 + + + 28 + + + 29 + + + 30 + + + 31 + + + 32 + + + 33 + + + 34 + + + 35 + + + 36 + + + 37 + + + 38 + + + 39 + + + 40 + + + 41 + + + 42 + + + 43 + + + 44 + + + 45 + + + 46 + + + 47 + + + 48 + + + 49 + + + 51 + + + 52 + + + 53 + + + 54 + + + 55 + + + 56 + + + 57 + + + 58 + + + 59 + + + 60 + + + 61 + + + 62 + + + 63 + + + 64 + + + 0 + + + 1 + + + 2 + + + 3 + + + 4 + + + 5 + + +
Resource.res
+ 6 +
+ + 7 + + + 8 + true + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + +
+ + CPlusPlusBuilder.Personality.12 + CppGuiApplication + + + + False + True + True + False + + + Embarcadero C++Builder Office 2000 Servers Package + Embarcadero C++Builder Office XP Servers Package + + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + Assets\ + Logo150x150.png + true + + + + + Assets\ + Logo44x44.png + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + Animation.exe + true + + + + + Animation.exe + true + + + + + Animation.exe + true + + + + + Animation.exe + true + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 64 + + + classes + 64 + + + + + res\xml + 1 + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\mips + 1 + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-v21 + 1 + + + res\values-v21 + 1 + + + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + Contents + 1 + + + Contents + 1 + + + Contents + 1 + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + library\lib\armeabi-v7a + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen + 64 + + + ..\$(PROJECTNAME).launchscreen + 64 + + + + + 1 + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + + + + + + + + + + + + + True + True + True + + + 12 + + + + +
diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2015.sln b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2015.sln new file mode 100644 index 00000000..b6302575 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2015.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Animation", "Animation_2015.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2015.vcxproj b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2015.vcxproj new file mode 100644 index 00000000..308f2364 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2015.vcxproj @@ -0,0 +1,247 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Animation + Animation + + + + Application + Unicode + v140_xp + + + Application + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + + + + + + + + + + + + + + + + + true + false + + + true + false + + + false + false + + + false + false + + + + Use + Level4 + true + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2015.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2015.vcxproj.filters new file mode 100644 index 00000000..f78b675d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2015.vcxproj.filters @@ -0,0 +1,215 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + {86790b47-d32f-41a7-b741-89ee90d64b6d} + + + {e15d7f75-acf5-492f-ba57-b883f91cfdc5} + + + {1dcddfe4-dd07-43c5-a6d4-b6a46f049287} + + + {cbba403a-bc76-477a-b285-e00b59b0a45a} + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2019.sln b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2019.sln new file mode 100644 index 00000000..19807e10 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2019.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Animation", "Animation_2019.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8F27C3E8-30FC-4307-BE5D-3D1AF1EBE903} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2019.vcxproj b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2019.vcxproj new file mode 100644 index 00000000..5fbf37a9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2019.vcxproj @@ -0,0 +1,224 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Animation + Animation + + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2019.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2019.vcxproj.filters new file mode 100644 index 00000000..0b29be90 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2019.vcxproj.filters @@ -0,0 +1,215 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + {6530be12-8452-4fd0-989b-565a3648e77c} + + + {1d220c7f-50b2-42d1-a1d2-bf0111287938} + + + {5e868567-21f8-4688-97ae-127b25f60045} + + + {e6745c74-3daa-4b90-9b87-3af78f411dc9} + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2022.sln b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2022.sln new file mode 100644 index 00000000..04f6c31b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2022.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Animation", "Animation_2022.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {78E4F6E0-ABE6-417E-B199-DF25F6254DE1} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2022.vcxproj b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2022.vcxproj new file mode 100644 index 00000000..e56d3d40 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2022.vcxproj @@ -0,0 +1,235 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Animation + Animation + 10.0 + + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2022.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2022.vcxproj.filters new file mode 100644 index 00000000..0b29be90 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2022.vcxproj.filters @@ -0,0 +1,215 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + {6530be12-8452-4fd0-989b-565a3648e77c} + + + {1d220c7f-50b2-42d1-a1d2-bf0111287938} + + + {5e868567-21f8-4688-97ae-127b25f60045} + + + {e6745c74-3daa-4b90-9b87-3af78f411dc9} + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2026.slnx b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2026.slnx new file mode 100644 index 00000000..a14adb39 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2026.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2026.vcxproj b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2026.vcxproj new file mode 100644 index 00000000..1c8f3a7d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2026.vcxproj @@ -0,0 +1,235 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Animation + Animation + 10.0 + + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2026.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2026.vcxproj.filters new file mode 100644 index 00000000..0a10c356 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_2026.vcxproj.filters @@ -0,0 +1,215 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + {6530be12-8452-4fd0-989b-565a3648e77c} + + + {1d220c7f-50b2-42d1-a1d2-bf0111287938} + + + {5e868567-21f8-4688-97ae-127b25f60045} + + + {e6745c74-3daa-4b90-9b87-3af78f411dc9} + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_DEBUG.dev b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_DEBUG.dev new file mode 100644 index 00000000..5f830dde --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_DEBUG.dev @@ -0,0 +1,141 @@ +[Project] +FileName=Animation_DEBUG.dev +Name=Animation +UnitCount=9 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=Animation_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D _DEBUG_@@_-D UNICODE_@@_-D _UNICODE_@@__@@__@@__@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Debug +ObjectOutput=.\Dev-C++\Debug +OverrideOutput=1 +OverrideOutputName=Animation.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=4 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[Unit1] +FileName=..\src\DialogApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\DialogApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\MyDialog.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\MyDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\Resource.rc +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit8] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_RELEASE.dev b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_RELEASE.dev new file mode 100644 index 00000000..887e172d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/ProjectFiles/Animation_RELEASE.dev @@ -0,0 +1,141 @@ +[Project] +FileName=Animation_RELEASE.dev +Name=Animation +UnitCount=9 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=Animation_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-DNDEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-s_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Release +ObjectOutput=.\Dev-C++\Release +OverrideOutput=1 +OverrideOutputName=Animation.exe +HostApplication= +Folders=Header,Resource,Source +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=3 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[Unit1] +FileName=..\src\DialogApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\DialogApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\MyDialog.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\MyDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\Resource.rc +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit8] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/Animation/Readme.txt new file mode 100644 index 00000000..c343b002 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/Readme.txt @@ -0,0 +1,21 @@ +Animation Sample +================ +This program demonstrates how to display an animation control in a dialog. + + +Features demonstrated in this example +===================================== +* Using a dialog as an application +* Using CDialog to display a dialog defined in a resource script (resource.rc) +* Using an avi file as a resource (in resource.rc) +* Using an animation control to play a simple avi file. + + +About Dialogs +============= +Dialog applications are easy to create, provided we have access to a resource +editor to build the resource script file for us (often called resource.rc). +Commercial compilers usually include a resource editor for this purpose, but +many free compilers don't. A resource editor is included with Microsoft's +Visual Studio Studio Community. + diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/src/DialogApp.cpp b/packages/media/cpp/packages/Win32xx/samples/Animation/src/DialogApp.cpp new file mode 100644 index 00000000..1fadc115 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/src/DialogApp.cpp @@ -0,0 +1,28 @@ +///////////////////////////// +// DialogApp.cpp +// + +#include "stdafx.h" +#include "DialogApp.h" +#include "resource.h" + +////////////////////////////////// +// CDialogApp function definitions +// + +// Constructor. +CDialogApp::CDialogApp() : m_myDialog(IDD_DIALOG1) +{ +} + +// Called when the application starts. +BOOL CDialogApp::InitInstance() +{ + // Display the modal dialog. + m_myDialog.DoModal(); + + return TRUE; +} + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/src/DialogApp.h b/packages/media/cpp/packages/Win32xx/samples/Animation/src/DialogApp.h new file mode 100644 index 00000000..5cb16dd4 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/src/DialogApp.h @@ -0,0 +1,31 @@ +///////////////////////////// +// DialogApp.h +// + +#ifndef DIALOGAPP_H +#define DIALOGAPP_H + +#include "MyDialog.h" + +///////////////////////////////////////////////////////////////// +// CDialogApp manages the application. It initializes the Win32++ +// framework when it is constructed, and creates the main dialog +// when it runs. +class CDialogApp : public CWinApp +{ +public: + CDialogApp(); + virtual ~CDialogApp() override = default; + +protected: + virtual BOOL InitInstance() override; + +private: + CDialogApp(const CDialogApp&) = delete; + CDialogApp& operator=(const CDialogApp&) = delete; + + CMyDialog m_myDialog; +}; + + +#endif // define DIALOGAPP_H diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/src/MyDialog.cpp b/packages/media/cpp/packages/Win32xx/samples/Animation/src/MyDialog.cpp new file mode 100644 index 00000000..fd9ae7c3 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/src/MyDialog.cpp @@ -0,0 +1,78 @@ +///////////////////////////// +// MyDialog.cpp +// + +#include "stdafx.h" +#include "MyDialog.h" +#include "resource.h" + +///////////////////////////////// +// CMyDialog function definitions +// + +// Constructor +CMyDialog::CMyDialog(UINT resID) : CDialog(resID) +{ +} + +// Called when the dialog window is destroyed. +void CMyDialog::OnDestroy() +{ + // End the application + ::PostQuitMessage(0); +} + +// Handles the dialog's window messages. +INT_PTR CMyDialog::DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // switch (msg) + // { + // Additional messages to be handled go here + // } + + // Pass unhandled messages on to parent DialogProc + return DialogProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + +// Called before the dialog is displayed. +BOOL CMyDialog::OnInitDialog() +{ + // Set the Icon + SetIconLarge(IDW_MAIN); + SetIconSmall(IDW_MAIN); + + // Attach the animation control to our CAnimation member variable. + AttachItem(IDC_ANIMATE1, m_animation); + + // Play the animation. + m_animation.Open(MAKEINTRESOURCE(IDA_UPLOAD_AVI)); + m_animation.Play(0, -1, -1); + + return TRUE; +} + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/src/MyDialog.h b/packages/media/cpp/packages/Win32xx/samples/Animation/src/MyDialog.h new file mode 100644 index 00000000..3507d096 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/src/MyDialog.h @@ -0,0 +1,29 @@ +///////////////////////////// +// MyDialog.h +// + +#ifndef MYDIALOG_H +#define MYDIALOG_H + + +/////////////////////////////////////////////////// +// CMyDialog manages the application's main dialog. +class CMyDialog : public CDialog +{ +public: + CMyDialog(UINT resID); + virtual ~CMyDialog() override = default; + +protected: + virtual void OnDestroy() override; + virtual BOOL OnInitDialog() override; + virtual INT_PTR DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CMyDialog(const CMyDialog&) = delete; + CMyDialog& operator=(const CMyDialog&) = delete; + + CAnimation m_animation; +}; + +#endif //MYDIALOG_H diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/src/Resource.rc b/packages/media/cpp/packages/Win32xx/samples/Animation/src/Resource.rc new file mode 100644 index 00000000..11317df7 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/src/Resource.rc @@ -0,0 +1,121 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "../src/res/SystemDPI.manifest" + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDW_MAIN ICON "../src/res/Play.ico" + + +///////////////////////////////////////////////////////////////////////////// +// +// AVI +// + +IDA_UPLOAD_AVI AVI "../src/res/upload.avi" + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_DIALOG1 DIALOGEX 0, 0, 230, 100 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_APPWINDOW +CAPTION "Animation Dialog" +FONT 8, "MS Shell Dlg", 0, 0 +BEGIN + CONTROL "",IDC_ANIMATE1,"SysAnimate32", WS_TABSTOP | ACS_TRANSPARENT,20,20,180,60 +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_DIALOG1, DIALOG + BEGIN + END +END +#endif // APSTUDIO_INVOKED + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/src/StdAfx.cpp b/packages/media/cpp/packages/Win32xx/samples/Animation/src/StdAfx.cpp new file mode 100644 index 00000000..8957144d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/src/StdAfx.cpp @@ -0,0 +1,16 @@ +///////////////////////////// +// StdAfx.cpp +// + +// This file is used for precompiled hearders. Precompiled headers allow +// programs to be recompiled more quickly + +// To use precompiled headers, do the following: +// 1) Add the set of rarely changed headers to stdafx.h +// 2) Include stdafx.h in each cpp file. It must be included first. +// 3) Add stdafx.cpp to your project. +// 4) Turn on precompiled hearders in the project + + +#include "stdafx.h" + diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/src/main.cpp b/packages/media/cpp/packages/Win32xx/samples/Animation/src/main.cpp new file mode 100644 index 00000000..363df57b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/src/main.cpp @@ -0,0 +1,41 @@ +///////////////////////////// +// main.cpp +// + +#include "stdafx.h" +#include "DialogApp.h" + +int wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPWSTR, _In_ int) +{ + try + { + // Start Win32++. + CDialogApp theApp; + + // Run the application. + return theApp.Run(); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return -1; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/src/res/Play.ico b/packages/media/cpp/packages/Win32xx/samples/Animation/src/res/Play.ico new file mode 100644 index 00000000..8dbdd34d Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Animation/src/res/Play.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/src/res/SystemDPI.manifest b/packages/media/cpp/packages/Win32xx/samples/Animation/src/res/SystemDPI.manifest new file mode 100644 index 00000000..d0d8ef77 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/src/res/SystemDPI.manifest @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/src/res/upload.avi b/packages/media/cpp/packages/Win32xx/samples/Animation/src/res/upload.avi new file mode 100644 index 00000000..7e47b24b Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Animation/src/res/upload.avi differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/src/resource.h b/packages/media/cpp/packages/Win32xx/samples/Animation/src/resource.h new file mode 100644 index 00000000..6908b81a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/src/resource.h @@ -0,0 +1,28 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Resource.rc +// + +// include the Resource IDs defined by Win32++ +#include "default_resource.h" + +//Resource IDs for the dialog, AVI resource, and AVI control +#define IDD_DIALOG1 121 +#define IDA_UPLOAD_AVI 122 +#define IDC_ANIMATE1 130 + + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 130 +#endif +#endif + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Animation/src/stdafx.h b/packages/media/cpp/packages/Win32xx/samples/Animation/src/stdafx.h new file mode 100644 index 00000000..08450116 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Animation/src/stdafx.h @@ -0,0 +1,90 @@ +///////////////////////////// +// StdAfx.h +// + +// This file is used for precompiled headers. +// Rarely modified header files should be included. +// Based on code provided by Lynn Allan. + + +#ifndef STDAFX_H +#define STDAFX_H + + +// Predefinitions for windows.h go here +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +// Specify Win32xx specific predefinitions here +//#define NO_USING_NAMESPACE // Don't use Win32xx namespace + +// Rarely modified header files should be included here +#include // Add support for std::vector +#include // Add support for std::map +#include // Add support for std::string +#include // Add support for stringstream +#include // Add support for the assert macro +#include // Add support for C style printf, sprintf, etc. +#include // Add support for C style character conversions atoi etc. +#include // Add support for C style TCHARs. + +// Add the Win32++ library +#include // Add CWinApp +#include // Add CArchive +#include // Add CAnimation, CComboBox, CComboBoxEx, CDateTime, CHeader, CHotKey, CIPAddress, CProgressBar, CSpinButton, CScrollBar, CSlider, CToolTip +#include // Add CCriticalSection, CThreadLock +#include // Add CString, CStringA, CStringW +#include // Add CDataExchange +#include // Add CDialog, CResizer +#include // Add CDockFrame, CMDIDockFrame +#include // Add CDocker, CDockContainer +#include // Add CException, CFileException, CNotSupportedException, CResourceException, CUserException, CWinException +#include // Add CFile +#include // Add CFileFind +#include // Add CFolderDialog +#include // Add CFrame +#include // Add CDC, CGDIObject, CBitmap, CBrush, CFont, CPalatte, CPen, CRgn +#include // Add CHGlobal +#include // Add CImageList +#include // Add CListView +#include // Add CMDIChild, CMDIFrame, CDockMDIFrame +#include // Add CMenu +#include // Add CMenuBar +#include // Add CMetaFile, CEnhMetaFile +#include // Add CEvent, CMutex, CSemaphore +#include // Add CPropertyPage, CPropertySheet +#include // Add CRebar +#include // Add CPoint, CRect, CSize +#include // Add CRegKey +#include // Add CRichEdit +#include // Add CScrollView +#include // Adds macros, windows header files, and CObject +#include // Add CSocket +#include // Add CStatusBar +#include // Add CButton, CEdit, CListBox +#include // Add CTab, CTabbedMDI +#include // Add AtoT, AtoW, TtoA, TtoW, WtoA, WtoT etc. +#include // Add MenuTheme, ReBarTheme, StatusBarTheme, ToolBarTheme +#include // Add CWinThread +#include // Add CTime +#include // Add CToolBar +#include // Add CTreeView +#include // Add CWebBrowser, CAXHost +#include // Add CWnd + +// WIN32_LEAN_AND_MEAN can't be used with these +#ifndef WIN32_LEAN_AND_MEAN + #include // Add CCommonDialog, CColorDialog, CFileDialog, CFindReplace, CFontDialog + #include // Add CFolderDialogEx + #include // Add CPrintPreview + #include // Add CPageSetupDialog, CPrintDialog + #include // Add CPrintDialogEx + #include // Add CTaskDialog + + // Visual Studio + #if defined (_MSC_VER) + #include // Add CRibbon, CRibbonFrame + #endif + +#endif // define WIN32_LEAN_AND_MEAN + +#endif // define STDAFX_H diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser.cbp b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser.cbp new file mode 100644 index 00000000..5593ab2b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser.cbp @@ -0,0 +1,143 @@ + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser.cbproj b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser.cbproj new file mode 100644 index 00000000..2c310c8f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser.cbproj @@ -0,0 +1,1541 @@ + + + {39461456-1040-43CB-9B40-5962EF847BB0} + 20.1 + None + True + Release + Win64x + 1048579 + Application + Browser + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + JPHNE + .\Embarcadero\$(Platform)\$(Config) + .\Embarcadero\$(Platform)\$(Config) + false + true + true + $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + CppGuiApplication + System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + true + <_TCHARMapping>wchar_t + Browser + ..\..\..\include\;..\src\;$(IncludePath) + ..\..\..\include\;..\src\;$(ILINK_LibraryPath) + 3081 + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + $(BDSINCLUDE)\windows\sdk;$(BRCC_IncludePath) + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + ..\src\stdafx.h + <_TCHARMapping>wchar_t + none + + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + false + true + false + true + _DEBUG;$(Defines) + false + None + DEBUG + true + true + true + true + Full + true + true + true + true + true + $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) + $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + + + PerMonitorV2 + false + $(BDSLIB)\$(PLATFORM)$(CC_SUFFIX)\debug;$(ILINK_LibraryPath) + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + <_TCHARMapping>wchar_t + + + PerMonitorV2 + <_TCHARMapping>wchar_t + true + 1033 + (None) + + + NDEBUG;$(Defines) + None + + + PerMonitorV2 + false + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + <_TCHARMapping>wchar_t + + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 68 + + + 0 + + + 1 + + + 2 + + + 3 + + + 4 + + + 5 + + + 6 + + + 7 + + + 8 + + + 9 + + +
Resource.res
+ 10 +
+ + 11 + + + 12 + true + + + 14 + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + +
+ + CPlusPlusBuilder.Personality.12 + CppGuiApplication + + + + False + True + True + False + + + Embarcadero C++Builder Office 2000 Servers Package + Embarcadero C++Builder Office XP Servers Package + + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + Assets\ + Logo150x150.png + true + + + + + Assets\ + Logo44x44.png + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + Browser.exe + true + + + + + Browser.exe + true + + + + + NewProject.exe + true + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 64 + + + classes + 64 + + + + + res\xml + 1 + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\mips + 1 + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-v21 + 1 + + + res\values-v21 + 1 + + + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + Contents + 1 + + + Contents + 1 + + + Contents + 1 + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + library\lib\armeabi-v7a + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen + 64 + + + ..\$(PROJECTNAME).launchscreen + 64 + + + + + 1 + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + + + + + + + + + + + + + True + True + True + + + 12 + + + + +
diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2015.sln b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2015.sln new file mode 100644 index 00000000..ebab8d84 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2015.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Browser", "Browser_2015.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2015.vcxproj b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2015.vcxproj new file mode 100644 index 00000000..19d33502 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2015.vcxproj @@ -0,0 +1,251 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Browser + Browser + + + + Application + Unicode + v140_xp + + + Application + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + + + + + + + + + + + + + + + + + false + + + false + + + false + false + + + false + false + + + + Use + Level4 + true + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2015.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2015.vcxproj.filters new file mode 100644 index 00000000..05ef4a5b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2015.vcxproj.filters @@ -0,0 +1,233 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + + + {29139989-069b-42da-9eef-8055c7c67817} + + + {2e888c36-7e49-4749-a3d0-21a75f63e498} + + + {c9391bd9-5cd2-430b-977d-45924ed801d4} + + + {b09bff25-b2c7-4c51-8891-e1b05903851c} + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2019.sln b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2019.sln new file mode 100644 index 00000000..b2a223ae --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2019.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Browser", "Browser_2019.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5FF873AE-A462-4C9B-99EE-279901F7113F} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2019.vcxproj b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2019.vcxproj new file mode 100644 index 00000000..52667bf6 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2019.vcxproj @@ -0,0 +1,232 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Browser + Browser + + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2019.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2019.vcxproj.filters new file mode 100644 index 00000000..d22348ff --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2019.vcxproj.filters @@ -0,0 +1,233 @@ + + + + + {e24f7ded-8d10-4476-b412-e786a4ecbad3} + + + {07d768b8-60f6-41b7-8aa7-670a44c43755} + + + {8aeaea51-10d0-4300-9cfb-e1410cea2023} + + + {b9552b50-d45e-45cf-ad00-db4c6ff4a424} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2022.sln b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2022.sln new file mode 100644 index 00000000..cbde9de9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2022.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Browser", "Browser_2022.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {22FEE62C-D276-41A3-9F8C-CF4A1ABD3073} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2022.vcxproj b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2022.vcxproj new file mode 100644 index 00000000..1ed94d70 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2022.vcxproj @@ -0,0 +1,255 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Browser + Browser + 10.0 + + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2022.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2022.vcxproj.filters new file mode 100644 index 00000000..b28aebd9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2022.vcxproj.filters @@ -0,0 +1,247 @@ + + + + + {e24f7ded-8d10-4476-b412-e786a4ecbad3} + + + {07d768b8-60f6-41b7-8aa7-670a44c43755} + + + {8aeaea51-10d0-4300-9cfb-e1410cea2023} + + + {b9552b50-d45e-45cf-ad00-db4c6ff4a424} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + + + Resource Files + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2026.slnx b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2026.slnx new file mode 100644 index 00000000..7b542d89 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2026.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2026.vcxproj b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2026.vcxproj new file mode 100644 index 00000000..d0a55154 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2026.vcxproj @@ -0,0 +1,255 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Browser + Browser + 10.0 + + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2026.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2026.vcxproj.filters new file mode 100644 index 00000000..cc009c34 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_2026.vcxproj.filters @@ -0,0 +1,247 @@ + + + + + {e24f7ded-8d10-4476-b412-e786a4ecbad3} + + + {07d768b8-60f6-41b7-8aa7-670a44c43755} + + + {8aeaea51-10d0-4300-9cfb-e1410cea2023} + + + {b9552b50-d45e-45cf-ad00-db4c6ff4a424} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + + + Resource Files + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_DEBUG.dev b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_DEBUG.dev new file mode 100644 index 00000000..0742c956 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_DEBUG.dev @@ -0,0 +1,192 @@ +[Project] +FileName=Browser_DEBUG.dev +Name=Browser +UnitCount=13 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=Browser_DEBUG_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D _DEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@__@@__@@__@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lws2_32_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Debug +ObjectOutput=.\Dev-C++\Debug +OverrideOutput=1 +OverrideOutputName=Browser.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=4 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit1] +FileName=..\src\BrowserApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\BrowserApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\EventSink.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\Mainfrm.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\Mainfrm.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit8] +FileName=..\src\MyCombo.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\MyCombo.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\EventSink.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit10] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit11] +FileName=..\src\Resource.rc +CompileCpp=1 +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit12] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit13] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit14] +FileName=MyCombo.h +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_RELEASE.dev b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_RELEASE.dev new file mode 100644 index 00000000..5074db79 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/ProjectFiles/Browser_RELEASE.dev @@ -0,0 +1,192 @@ +[Project] +FileName=Browser_RELEASE.dev +Name=Browser +UnitCount=14 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=Browser_RELEASE_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D NDEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@__@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lws2_32_@@_-s_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Release +ObjectOutput=.\Dev-C++\Release +OverrideOutput=1 +OverrideOutputName=Browser.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=3 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit2] +FileName=..\src\BrowserApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\EventSink.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\Mainfrm.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\Mainfrm.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit8] +FileName=..\src\MyCombo.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\MyCombo.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit1] +FileName=..\src\BrowserApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\EventSink.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit10] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit11] +FileName=..\src\Resource.rc +CompileCpp=1 +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit12] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit13] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit14] +FileName=..\src\AboutDialog.h +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/Browser/Readme.txt new file mode 100644 index 00000000..239504c0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/Readme.txt @@ -0,0 +1,31 @@ +Browser Example +=============== +This example demonstrates how to use CWebBrowser as a view window for a frame. +It also demonstrates how to implement an EventSink to allow the WebBrowser +to provide notifications of web browsing events. + +The Rebar control includes a ComboBoxEx control which allows URLs to be +entered for web browsing. + +This program support print and print preview. + +Features demonstrated in this example +===================================== +* Use of CFrame to display the window frame. +* Use of CWebBrowser as a view window for the frame. +* Use of an event sink to get notification of browser events. +* Use of 32bit bitmaps for the toolbar. +* Use of hot and disabled image lists for the toolbar. +* Adding icons for popup menu items. +* Use of a ComboBoxEx control in the rebar. +* Printing the contents of a WebBrowser. +* Print preview the contents of a WebBrowser. + +Note: +The CWebBrowser used in this sample uses the IWebBrowser2 interface. The IWebBrowser2 +provides access to the same features as used by the Microsoft's Internet Explorer. +Support for Internet Explorer ended on June 15, 2022, so this sample might not render +web pages properly. + +Consider using using the EdgeBrowser and EdgeBrowserEx samples to display modern +web pages instead. diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/src/AboutDialog.h b/packages/media/cpp/packages/Win32xx/samples/Browser/src/AboutDialog.h new file mode 100644 index 00000000..71e4364d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/src/AboutDialog.h @@ -0,0 +1,31 @@ +///////////////////////////////////////////// +// AboutDialog.h + +#ifndef _ABOUTDIALOG_H_ +#define _ABOUTDIALOG_H_ + +#include "resource.h" + +//////////////////////////////////////////////////////// +// CAboutDialog manages the dialog which displays +// information about this program. +class CAboutDialog : public CDialog +{ +public: + CAboutDialog() : CDialog(IDW_ABOUT) {} + virtual BOOL OnInitDialog() override + { + // Set the Win32++ version string. + UINT ver = _WIN32XX_VER; + CString Win32xxVersion; + Win32xxVersion << "Win32++ Version " << ver / 0x100 << "." << + (ver % 0x100) / 0x10 << "." << (ver % 0x10); + + SetDlgItemText(IDC_STATIC1, Win32xxVersion); + SetDlgItemText(IDC_STATIC2, L"by David Nash"); + + return TRUE; + } +}; + +#endif // _ABOUTDIALOG_H_ diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/src/BrowserApp.cpp b/packages/media/cpp/packages/Win32xx/samples/Browser/src/BrowserApp.cpp new file mode 100644 index 00000000..b68b1927 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/src/BrowserApp.cpp @@ -0,0 +1,19 @@ +///////////////////////////// +// BrowserApp.cpp +// + +#include "stdafx.h" +#include "BrowserApp.h" + +/////////////////////////////////// +// CBrowserApp function definitions +// + +// This function is called automatically when the application starts. +BOOL CBrowserApp::InitInstance() +{ + // Create the Frame + m_frame.Create(); // throws a CWinException on failure + + return TRUE; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/src/BrowserApp.h b/packages/media/cpp/packages/Win32xx/samples/Browser/src/BrowserApp.h new file mode 100644 index 00000000..66095328 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/src/BrowserApp.h @@ -0,0 +1,30 @@ +///////////////////////////// +// BrowserApp.h +// + +#ifndef BROWSERAPP_H +#define BROWSERAPP_H + +#include "Mainfrm.h" + +////////////////////////////////////////////////////////////////// +// CBrowserApp manages the application. It initializes the Win32++ +// framework when it is constructed, and creates the main frame +// window when it runs. +class CBrowserApp : public CWinApp +{ +public: + CBrowserApp() = default; + virtual ~CBrowserApp() override = default; + +protected: + virtual BOOL InitInstance() override; + +private: + CBrowserApp(const CBrowserApp&) = delete; + CBrowserApp& operator=(const CBrowserApp&) = delete; + CMainFrame m_frame; +}; + + +#endif // BROWSERAPP_H diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/src/EventSink.cpp b/packages/media/cpp/packages/Win32xx/samples/Browser/src/EventSink.cpp new file mode 100644 index 00000000..2e0f174b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/src/EventSink.cpp @@ -0,0 +1,114 @@ +///////////////////////////// +// EventSink.cpp +// + +#include "stdafx.h" +#include "EventSink.h" +#include "UserMessages.h" + +////////////////////////////////// +// CEventSink function definitions +// + +// Not implemented. Increments a reference count. +STDMETHODIMP_(ULONG) CEventSink::AddRef() +{ + // Always 1. Automatic deletion isn't required. + return 1; +} + +// Assigns a pointer to ppvObject for the specified interface. +STDMETHODIMP CEventSink::QueryInterface(REFIID riid, void** ppvObject) +{ + if (!ppvObject) + return E_POINTER; + + if (IsEqualIID(riid, IID_IDispatch)) + *ppvObject = static_cast(this); + else if (IsEqualIID(riid, IID_IUnknown)) + *ppvObject = static_cast(this); + else + { + *ppvObject = nullptr; + return E_NOINTERFACE; + } + + return S_OK; +} + +// Not implemented. Retrieves an array of DISPID. +STDMETHODIMP CEventSink::GetIDsOfNames(REFIID, OLECHAR**, unsigned int, LCID, DISPID* rgdispid) +{ + if (rgdispid != nullptr) + *rgdispid = DISPID_UNKNOWN; + + return DISP_E_UNKNOWNNAME; +} + +// Not implemented. Retrieves the type information for an object. +STDMETHODIMP CEventSink::GetTypeInfo(unsigned int, LCID, ITypeInfo**) +{ + return E_NOTIMPL; +} + +// Not implemented. Retrieves the number of type information interfaces that an object provides. +STDMETHODIMP CEventSink::GetTypeInfoCount(unsigned int*) +{ + return E_NOTIMPL; +} + +// Sends a window message to the frame when a browser event occurs. +STDMETHODIMP CEventSink::Invoke(DISPID dispid, REFIID, LCID, WORD, DISPPARAMS* pDispParams, VARIANT*, EXCEPINFO*, unsigned int*) +{ + if (!pDispParams) + return E_INVALIDARG; + + HWND frame = GetApp()->GetMainWnd(); + + switch (dispid) + { + case DISPID_BEFORENAVIGATE2: + ::SendMessage(frame, UWM_BEFORENAVIGATE, (WPARAM)pDispParams, 0); + break; + case DISPID_COMMANDSTATECHANGE: + ::SendMessage(frame, UWM_COMMANDSTATECHANGE, (WPARAM)pDispParams, 0); + break; + case DISPID_DOCUMENTCOMPLETE: + ::SendMessage(frame, UWM_DOCUMENTCOMPLETE, (WPARAM)pDispParams, 0); + break; + case DISPID_DOWNLOADBEGIN: + ::SendMessage(frame, UWM_DOWNLOADBEGIN, (WPARAM)pDispParams, 0); + break; + case DISPID_DOWNLOADCOMPLETE: + ::SendMessage(frame, UWM_DOWNLOADCOMPLETE, (WPARAM)pDispParams, 0); + break; + case DISPID_NAVIGATECOMPLETE2: + ::SendMessage(frame, UWM_NAVIGATECOMPLETE2, (WPARAM)pDispParams, 0); + break; + case DISPID_PROGRESSCHANGE: + ::SendMessage(frame, UWM_PROGRESSCHANGE, (WPARAM)pDispParams, 0); + break; + case DISPID_PROPERTYCHANGE: + ::SendMessage(frame, UWM_PROPERTYCHANGE, (WPARAM)pDispParams, 0); + break; + case DISPID_STATUSTEXTCHANGE: + ::SendMessage(frame, UWM_STATUSTEXTCHANGE, (WPARAM)pDispParams, 0); + break; + case DISPID_NEWWINDOW2: + ::SendMessage(frame, UWM_NEWWINDOW2, (WPARAM)pDispParams, 0); + break; + case DISPID_TITLECHANGE: + ::SendMessage(frame, UWM_TITLECHANGE, (WPARAM)pDispParams, 0); + break; + } + + return S_OK; +} + +// Not implemented. Decrements a reference count. +STDMETHODIMP_(ULONG) CEventSink::Release() +{ + // Always 1. Automatic deletion isn't required. + return 1; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/src/EventSink.h b/packages/media/cpp/packages/Win32xx/samples/Browser/src/EventSink.h new file mode 100644 index 00000000..752c30d5 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/src/EventSink.h @@ -0,0 +1,50 @@ +///////////////////////////// +// EventSink.h +// + +#ifndef EVENTSINK_H +#define EVENTSINK_H + +#include "exdispid.h" + +// Some possible IDispatch events +// The following can also be found in exdispid.h (except MinGW) +#define DISPID_STATUSTEXTCHANGE 102 +#define DISPID_DOWNLOADCOMPLETE 104 +#define DISPID_COMMANDSTATECHANGE 105 +#define DISPID_DOWNLOADBEGIN 106 +#define DISPID_PROGRESSCHANGE 108 +#define DISPID_PROPERTYCHANGE 112 +#define DISPID_TITLECHANGE 113 +#define DISPID_BEFORENAVIGATE2 250 +#define DISPID_NEWWINDOW2 251 +#define DISPID_NAVIGATECOMPLETE2 252 +#define DISPID_DOCUMENTCOMPLETE 259 + + +///////////////////////////////////////////////////////////////// +// CEventSink implements the event sink for our browser. An Event +// Sink provides a mechanism to respond to events triggered by an +// ActiveX control. The ActiveX browser is the event source, and +// CEventSink is the event sink. +class CEventSink : public IDispatch +{ +public: + CEventSink() = default; + virtual ~CEventSink() = default; + + // IUnknown Methods + virtual STDMETHODIMP QueryInterface(REFIID riid, void** ppvObject) override; + virtual STDMETHODIMP_(ULONG) AddRef() override; + virtual STDMETHODIMP_(ULONG) Release() override; + + // IDispatch Methods + virtual STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR** rgszNames, unsigned int cNames, + LCID lcid, DISPID* rgdispid) override; + virtual STDMETHODIMP GetTypeInfo(unsigned int itinfo, LCID lcid, ITypeInfo** pptinfo) override; + virtual STDMETHODIMP GetTypeInfoCount(unsigned int* pctinfo) override; + virtual STDMETHODIMP Invoke(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, + DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexecinfo, unsigned int* puArgErr) override; +}; + +#endif // EVENTSINK_H diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/src/Mainfrm.cpp b/packages/media/cpp/packages/Win32xx/samples/Browser/src/Mainfrm.cpp new file mode 100644 index 00000000..39552faf --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/src/Mainfrm.cpp @@ -0,0 +1,653 @@ +///////////////////////////// +// Mainfrm.cpp +// + +#include "stdafx.h" +#include "Mainfrm.h" +#include "resource.h" +#include "UserMessages.h" + +constexpr COLORREF black = RGB(0, 0, 0); +constexpr COLORREF white = RGB(255, 255, 255); +constexpr COLORREF lightgray = RGB(192, 192, 192); +constexpr COLORREF magenta = RGB(255, 0, 255); + +/////////////////////////////////////// +// Definitions for the CMainFrame class +// + +// Constructor +CMainFrame::CMainFrame() : m_eventCookie(0) +{ +} + +// Adds a ComboBoxEx control to the rebar. +void CMainFrame::AddComboBoxBand() +{ + // Create the ComboboxEx window. + m_combo.Create(GetReBar()); + + int padding = 2; + int height = m_combo.GetWindowRect().Height() + DpiScaleInt(padding); + + // Put the window in a new rebar band. + REBARBANDINFO rbbi{}; + rbbi.cbSize = sizeof(rbbi); + rbbi.fMask = RBBIM_COLORS | RBBIM_CHILDSIZE | RBBIM_STYLE | RBBIM_CHILD | RBBIM_TEXT; + rbbi.cyMinChild = height; + rbbi.cyMaxChild = height; + rbbi.cxMinChild = 200; + rbbi.fStyle = RBBS_BREAK | RBBS_VARIABLEHEIGHT | RBBS_GRIPPERALWAYS; + rbbi.clrFore = GetSysColor(COLOR_BTNTEXT); + rbbi.clrBack = GetReBarTheme().clrBand1; + rbbi.hwndChild = m_combo.GetHwnd(); + rbbi.lpText = const_cast(L"Address"); + + GetReBar().InsertBand(-1, rbbi); +} + +// Connect to the event sink. +void CMainFrame::ConnectEvents() +{ + IConnectionPoint* pcp = nullptr; + pcp = GetConnectionPoint(DIID_DWebBrowserEvents2); + if (pcp) + { + VERIFY(SUCCEEDED(pcp->Advise(&m_eventSink, &m_eventCookie))); + pcp->Release(); + } +} + +HWND CMainFrame::Create(HWND parent) +{ + // Set m_view as the view window of the frame. + SetView(m_browser); + + // Set the registry key name, and load the initial window position. + // Use a registry key name like "CompanyName\\Application". + LoadRegistrySettings(L"Win32++\\Browser Sample"); + + return CFrame::Create(parent); +} + +// Disconnect from the event sink. +void CMainFrame::DisconnectEvents() +{ + IConnectionPoint* pcp = nullptr; + pcp = GetConnectionPoint(DIID_DWebBrowserEvents2); + if (pcp) + { + VERIFY(SUCCEEDED(pcp->Unadvise(m_eventCookie))); + pcp->Release(); + } +} + +// Retrieve pointer to IConnectionPoint. +// Call Release on this pointer when it is no longer required. +IConnectionPoint* CMainFrame::GetConnectionPoint(REFIID riid) const +{ + IConnectionPoint* pcp = nullptr; + IUnknown* pUnk = nullptr; + GetIWebBrowser2()->QueryInterface(IID_IUnknown, (void**)&pUnk); + if (pUnk) + { + IConnectionPointContainer* pcpc = nullptr; + VERIFY(SUCCEEDED(pUnk->QueryInterface(IID_IConnectionPointContainer, (void**)&pcpc))); + if (pcpc) + { + VERIFY(SUCCEEDED(pcpc->FindConnectionPoint(riid, &pcp))); + pcpc->Release(); + } + + pUnk->Release(); + } + + return pcp; +} + +// Go to the previous web page. +BOOL CMainFrame::OnBack() +{ + m_browser.GoBack(); + return TRUE; +} + +// Called before navigation occurs on either a window or frameset element. +void CMainFrame::OnBeforeNavigate2(DISPPARAMS*) +{ +} + +// Called when the enabled state of a command changes. +void CMainFrame::OnCommandStateChange(DISPPARAMS* pDispParams) +{ + CToolBar& TB = GetToolBar(); + + if ((pDispParams) && (pDispParams->cArgs == 2)) + { + BOOL isEnabled = pDispParams->rgvarg[0].boolVal; + LONG command = pDispParams->rgvarg[1].lVal; + { + // Update the Forward and Back buttons. + switch (command) + { + case CSC_NAVIGATEFORWARD: + isEnabled ? TB.EnableButton(IDM_FORWARD) : TB.DisableButton(IDM_FORWARD); + break; + case CSC_NAVIGATEBACK: + isEnabled ? TB.EnableButton(IDM_BACK) : TB.DisableButton(IDM_BACK); + break; + } + } + } +} + +// Called before the frame is destroyed. +void CMainFrame::OnClose() +{ + m_browser.Stop(); + DisconnectEvents(); + + // Call the base class function. + CFrame::OnClose(); +} + +// Respond to menu, toolbar or accelerator key input. +BOOL CMainFrame::OnCommand(WPARAM wparam, LPARAM lparam) +{ + UINT id = LOWORD(wparam); + switch (id) + { + case IDM_BACK: return OnBack(); + case IDM_EDIT_CUT: return OnEditCut(); + case IDM_EDIT_COPY: return OnEditCopy(); + case IDM_EDIT_PASTE: return OnEditPaste(); + case IDM_EDIT_DELETE: return OnEditDelete(); + case IDM_FILE_EXIT: return OnFileExit(); + case IDM_FORWARD: return OnForward(); + case IDM_HELP_ABOUT: return OnHelp(); + case IDM_HOME: return OnHome(); + case IDM_FILE_PRINT: return OnPrint(); + case IDM_FILE_PREVIEW: return OnPrintPreview(); + case IDM_REFRESH: return OnRefresh(); + case IDM_STOP: return OnStop(); + case IDW_VIEW_STATUSBAR: return OnViewStatusBar(); + case IDW_VIEW_TOOLBAR: return OnViewToolBar(); + } + + // Handle notification WM_COMMAND from ComboboxEx. + if (reinterpret_cast(lparam) == m_combo.GetHwnd()) + { + switch (HIWORD(wparam)) + { + case CBN_SELCHANGE: // User made selection from list. + { + // Get text from edit box + CString str = m_combo.GetWindowText(); + + // Navigate to web page + m_browser.Navigate(str); + + // Set focus to web page + LONG_PTR hWeb; + GetIWebBrowser2()->get_HWND(&hWeb); + ::SetFocus(reinterpret_cast(hWeb)); + } + return TRUE; + } + } + + return FALSE; +} + +// Called during the window's creation. +int CMainFrame::OnCreate(CREATESTRUCT& cs) +{ + // OnCreate controls the way the frame is created. + // Overriding CFrame::OnCreate is optional. + + // A menu is added if the IDW_MAIN menu resource is defined. + // Frames have all options enabled by default. + // Use the following functions to disable options. + + // UseIndicatorStatus(FALSE); // Don't show keyboard indicators in the StatusBar. + // UseMenuStatus(FALSE); // Don't show menu descriptions in the StatusBar. + // UseOwnerDrawnMenu(FALSE); // Don't use owner draw for popup menu items. + // UseReBar(FALSE); // Don't use a ReBar. + // UseStatusBar(FALSE); // Don't use a StatusBar. + // UseThemes(FALSE); // Don't use themes. + // UseToolBar(FALSE); // Don't use a ToolBar. + + // Call the base function + CFrame::OnCreate(cs); + + ConnectEvents(); + + return 0; +} + +// Called when a document has been completely loaded and initialized. +void CMainFrame::OnDocumentComplete(DISPPARAMS*) +{ + SetStatusText(L"Done"); +} + +// Called when a navigation operation is beginning. +void CMainFrame::OnDownloadBegin(DISPPARAMS*) +{ +} + +// Called when a navigation operation finishes, is halted, or fails. +void CMainFrame::OnDownloadComplete(DISPPARAMS*) +{ +} + +// Deletes the selected text. +// Called in response to the menu or accelerator key. +BOOL CMainFrame::OnEditCut() +{ + if (GetFocus() == GetCBEdit()->GetHwnd()) + GetCBEdit()->Cut(); + else + m_browser.ExecWB( OLECMDID_CUT, OLECMDEXECOPT_DODEFAULT, nullptr, nullptr ); + + return TRUE; +} + +// Copies the selected text to the clip board. +// Called in response to the menu or accelerator key. +BOOL CMainFrame::OnEditCopy() +{ + if (GetFocus() == GetCBEdit()->GetHwnd()) + GetCBEdit()->Copy(); + else + m_browser.ExecWB( OLECMDID_COPY, OLECMDEXECOPT_DODEFAULT, nullptr, nullptr ); + + return TRUE; +} + +// Pastes text from the clip board. +// Called in response to the menu or accelerator key. +BOOL CMainFrame::OnEditPaste() +{ + if (GetFocus() == GetCBEdit()->GetHwnd()) + GetCBEdit()->Paste(); + else + m_browser.ExecWB( OLECMDID_PASTE, OLECMDEXECOPT_DODEFAULT, nullptr, nullptr ); + + return TRUE; +} + +// Deletes the selected text or the next character. +// Called in response to the menu or accelerator key. +BOOL CMainFrame::OnEditDelete() +{ + if (GetFocus() == GetCBEdit()->GetHwnd()) + GetCBEdit()->Clear(); + else + m_browser.ExecWB( OLECMDID_DELETE, OLECMDEXECOPT_DODEFAULT, nullptr, nullptr ); + + return TRUE; +} + +// Issue a close request to the frame +BOOL CMainFrame::OnFileExit() +{ + Close(); + return TRUE; +} + +// Go to the next web page. +BOOL CMainFrame::OnForward() +{ + m_browser.GoForward(); + return TRUE; +} + +// Display the help about dialog. +BOOL CMainFrame::OnHelp() +{ + // Ensure only one dialog displayed even for multiple hits of the F1 button. + if (!m_aboutDialog.IsWindow()) + { + m_aboutDialog.DoModal(*this); + } + + return TRUE; +} + +// Limit the minimum size of the window. +LRESULT CMainFrame::OnGetMinMaxInfo(UINT msg, WPARAM wparam, LPARAM lparam) +{ + LPMINMAXINFO lpMMI = (LPMINMAXINFO)lparam; + const CSize minimumSize(600, 400); + lpMMI->ptMinTrackSize.x = DpiScaleInt(minimumSize.cx); + lpMMI->ptMinTrackSize.y = DpiScaleInt(minimumSize.cy); + return FinalWindowProc(msg, wparam, lparam); +} + +// Load the browser's home page. +BOOL CMainFrame::OnHome() +{ + m_browser.GoHome(); + return TRUE; +} + +// Called after the frame window is created. +void CMainFrame::OnInitialUpdate() +{ + // The frame is now created. + // Place any additional startup code here. + + // Suppress Java script errors. + GetIWebBrowser2()->put_Silent(VARIANT_TRUE); + + // Load the web page. + m_browser.Navigate2(L"www.google.com"); +} + +// Called when navigation completes on either a window or frameset element. +void CMainFrame::OnNavigateComplete2(DISPPARAMS* pDispParams) +{ + CString str = "Navigate Complete"; + + if (pDispParams->rgvarg[0].vt == (VT_BYREF | VT_VARIANT)) + { + VARIANT url = *pDispParams->rgvarg[0].pvarVal; + url.vt = VT_BSTR; + + str += url.bstrVal; + str += '\n'; + TRACE(str); + VariantClear(&url); + } + + str = m_browser.GetLocationURL(); + + // Update the URL in the ComboboxEx edit box. + m_combo.SetWindowText(CString(str)); +} + +// Called when a new window is to be created. +void CMainFrame::OnNewWindow2(DISPPARAMS*) +{ + TRACE("NewWindow2\n"); +} + +// Called when the frame receives a notification (WM_NOTIFY). +LRESULT CMainFrame::OnNotify(WPARAM wparam, LPARAM lparam) +{ + LPNMHDR pHeader = reinterpret_cast(lparam); + + if (pHeader != 0 && pHeader->hwndFrom == m_combo) + { + switch (pHeader->code) + { + case CBEN_ENDEDIT: + { + PNMCBEENDEDIT pEndEdit = reinterpret_cast(pHeader); + switch (pEndEdit->iWhy) + { + case CBENF_RETURN: // User hit return in edit box + { + // Get text from edit box + CString str = m_combo.GetWindowText(); + + // Insert text into the list box. + COMBOBOXEXITEM item = {}; + item.mask = CBEIF_TEXT; + item.pszText = const_cast(str.c_str()); + m_combo.InsertItem(item); + + // Navigate to the web page + m_browser.Navigate(str); + return FALSE; + } + } + } + } + } + + return CFrame::OnNotify(wparam, lparam); +} + +// Displays the web page as it would look when printed. +BOOL CMainFrame::OnPrintPreview() +{ + m_browser.ExecWB(OLECMDID_PRINTPREVIEW, OLECMDEXECOPT_DODEFAULT, nullptr, nullptr); + return TRUE; +} + +// Prints the web page to the default printer. +BOOL CMainFrame::OnPrint() +{ + SAFEARRAYBOUND psabBounds[1]; + SAFEARRAY* psaHeadFoot; + long rgIndices; + + VARIANT vHeadStr = {}; + VARIANT vFootStr = {}; + VARIANT vArg = {}; + + try + { + // Initialize header and footer parameters to send to ExecWB(). + psabBounds[0].lLbound = 0; + psabBounds[0].cElements = 3; + psaHeadFoot = SafeArrayCreate(VT_VARIANT, 1, psabBounds); + if (nullptr == psaHeadFoot) + throw std::bad_alloc(); + + VariantInit(&vHeadStr); + VariantInit(&vFootStr); + + // Argument 1: Header + vHeadStr.vt = VT_BSTR; + vHeadStr.bstrVal = SysAllocString(L"This is my header string."); + if (vHeadStr.bstrVal == nullptr) + throw std::bad_alloc(); + + rgIndices = 0; + if (SUCCEEDED(SafeArrayPutElement(psaHeadFoot, &rgIndices, static_cast(&vHeadStr)))) + { + // Argument 2: Footer + vFootStr.vt = VT_BSTR; + vFootStr.bstrVal = SysAllocString(L"This is my footer string."); + if (vFootStr.bstrVal == nullptr) + throw std::bad_alloc(); + + rgIndices = 1; + if (SUCCEEDED(SafeArrayPutElement(psaHeadFoot, &rgIndices, static_cast(&vFootStr)))) + { + // Issue the print command + VariantInit(&vArg); + vArg.vt = VT_ARRAY | VT_BYREF; + vArg.parray = psaHeadFoot; + if (FAILED(m_browser.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, &vArg, nullptr))) + throw CUserException(L"Print Failed"); + } + } + + // Calls SysFreeString on each element. + SafeArrayDestroy(psaHeadFoot); + } + catch (...) + { + if (psaHeadFoot) + SafeArrayDestroy(psaHeadFoot); + } + + return TRUE; +} + +// Called when the progress of a download operation is updated on the object. +void CMainFrame::OnProgressChange(DISPPARAMS* pDispParams) +{ + CString str; + + if (pDispParams->cArgs != 0) + { + if (pDispParams->cArgs > 1 && pDispParams->rgvarg[1].vt == VT_I4) + { + int progress = pDispParams->rgvarg[1].lVal; + str << "Progress = " << progress; + } + + if (pDispParams->rgvarg[0].vt == VT_I4) + { + int progressMax = pDispParams->rgvarg[0].lVal; + str << ", ProgressMax = " << progressMax; + } + + str << '\n'; + TRACE(str); + } +} + +// Called when the IWebBrowser2::PutProperty method of the object changes the +// value of a property. +void CMainFrame::OnPropertyChange(DISPPARAMS* pDispParams) +{ + CString str; + if (pDispParams->cArgs > 0 && pDispParams->rgvarg[0].vt == VT_BSTR) + { + str += "Property Change:"; + str += pDispParams->rgvarg[0].bstrVal; + } + + str += '\n'; + TRACE(str); +} + +// Reload the current web page. +BOOL CMainFrame::OnRefresh() +{ + m_browser.Refresh(); + return TRUE; +} + +// Called when the status bar text of the object has changed. +void CMainFrame::OnStatusTextChange(DISPPARAMS* pDispParams) +{ + CString statusText = pDispParams->rgvarg->bstrVal; + + if (statusText != L"") + SetStatusText(statusText); + else + SetStatusText(L"Done"); +} + +// Stop loading the current web page. +BOOL CMainFrame::OnStop() +{ + m_browser.Stop(); + return TRUE; +} + +// Called when the title of a document in the object becomes available +// or changes. +void CMainFrame::OnTitleChange(DISPPARAMS* pDispParams) +{ + TRACE("TitleChange: \n"); + CString str; + + if ((pDispParams->cArgs > 0) && (pDispParams->rgvarg[0].vt == VT_BSTR)) + { + str = pDispParams->rgvarg[0].bstrVal; + str += " - Win32++ Browser"; + TRACE(str + "\n"); + } + else + str = LoadString(IDW_MAIN); + + SetWindowText(str); +} + +// Add menu icons from the IDW_MAIN bitmap resource. +void CMainFrame::SetupMenuIcons() +{ + std::vector iconData; // a vector of Resource IDs + + // Load the Resource IDs for popup menu items. + iconData.push_back(IDM_FILE_NEW); + iconData.push_back(IDM_FILE_OPEN); + iconData.push_back(IDM_FILE_SAVE); + iconData.push_back(IDM_EDIT_CUT); + iconData.push_back(IDM_EDIT_COPY); + iconData.push_back(IDM_EDIT_PASTE); + iconData.push_back(IDM_FILE_PRINT); + iconData.push_back(IDM_HELP_ABOUT); + + if (GetMenuIconHeight() >= 24) + AddMenuIcons(iconData, lightgray, IDB_MENUICONS24, 0); + else + AddMenuIcons(iconData, lightgray, IDB_MENUICONS16, 0); +} + +// Set the Resource IDs for the toolbar buttons. +void CMainFrame::SetupToolBar() +{ + AddToolBarButton(IDM_BACK); + AddToolBarButton(IDM_FORWARD); + AddToolBarButton(0); // Separator + AddToolBarButton(IDM_REFRESH); + AddToolBarButton(IDM_STOP); + AddToolBarButton(0); // Separator + AddToolBarButton(IDM_HOME); + + // Load the 32bit bitmaps if we can, otherwise load 24bit ones. + CBitmap bm(IDB_TOOLBAR32_NORM); + if (bm.GetHandle()) + SetToolBarImages(black, IDB_TOOLBAR32_NORM, IDB_TOOLBAR32_HOT, IDB_TOOLBAR32_DIS); + else + SetToolBarImages(magenta, IDB_TOOLBAR24_NORM, IDB_TOOLBAR24_HOT, IDB_TOOLBAR24_DIS); + + // Add the ComboBoxEx control. + AddComboBoxBand(); +} + +// Process frame's window messages. +LRESULT CMainFrame::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case UWM_BEFORENAVIGATE: OnBeforeNavigate2((DISPPARAMS*)wparam); break; + case UWM_COMMANDSTATECHANGE: OnCommandStateChange((DISPPARAMS*)wparam); break; + case UWM_DOCUMENTCOMPLETE: OnDocumentComplete((DISPPARAMS*)wparam); break; + case UWM_DOWNLOADBEGIN: OnDownloadBegin((DISPPARAMS*)wparam); break; + case UWM_NAVIGATECOMPLETE2: OnNavigateComplete2((DISPPARAMS*)wparam); break; + case UWM_NEWWINDOW2: OnNewWindow2((DISPPARAMS*)wparam); break; + case UWM_PROGRESSCHANGE: OnProgressChange((DISPPARAMS*)wparam); break; + case UWM_PROPERTYCHANGE: OnPropertyChange((DISPPARAMS*)wparam); break; + case UWM_STATUSTEXTCHANGE: OnStatusTextChange((DISPPARAMS*)wparam); break; + case UWM_TITLECHANGE: OnTitleChange((DISPPARAMS*)wparam); break; + case WM_GETMINMAXINFO: return OnGetMinMaxInfo(msg, wparam, lparam); + } + + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/src/Mainfrm.h b/packages/media/cpp/packages/Win32xx/samples/Browser/src/Mainfrm.h new file mode 100644 index 00000000..f5a7f4cb --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/src/Mainfrm.h @@ -0,0 +1,86 @@ +///////////////////////////// +// Mainfrm.h +// + +#ifndef MAINFRM_H +#define MAINFRM_H + +#include "MyCombo.h" +#include "EventSink.h" +#include "AboutDialog.h" + + +/////////////////////////////////////////////////////////// +// CMainFrame manages the application's main window. +// The main window is a frame that has a menubar, toolbar, +// statusbar and view window. +class CMainFrame : public CFrame +{ +public: + CMainFrame(); + virtual ~CMainFrame() override = default; + virtual HWND Create(HWND parent = nullptr) override; + IWebBrowser2* GetIWebBrowser2() const { return m_browser.GetIWebBrowser2(); } + const CEdit* GetCBEdit() const { return m_combo.GetCBEdit(); } + +protected: + virtual void OnClose() override; + virtual BOOL OnCommand(WPARAM wparam, LPARAM lparam) override; + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual BOOL OnHelp() override; + virtual void OnInitialUpdate() override; + virtual LRESULT OnNotify(WPARAM wparam, LPARAM lparam) override; + virtual void SetupMenuIcons() override; + virtual void SetupToolBar() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CMainFrame(const CMainFrame&) = delete; + CMainFrame& operator=(const CMainFrame&) = delete; + + void AddComboBoxBand(); + void ConnectEvents(); + void DisconnectEvents(); + IConnectionPoint* GetConnectionPoint(REFIID riid) const; + + // Command Handlers + BOOL OnBack(); + BOOL OnFileExit(); + BOOL OnEditCut(); + BOOL OnEditCopy(); + BOOL OnEditPaste(); + BOOL OnEditDelete(); + BOOL OnForward(); + BOOL OnHome(); + BOOL OnPrint(); + BOOL OnPrintPreview(); + BOOL OnRefresh(); + BOOL OnStop(); + + // Message handlers + LRESULT OnGetMinMaxInfo(UINT msg, WPARAM wparam, LPARAM lparam); + + // User defined message handlers + void OnBeforeNavigate2(DISPPARAMS* pDispParams); + void OnCommandStateChange(DISPPARAMS* pDispParams); + void OnDocumentComplete(DISPPARAMS* pDispParams); + void OnDownloadBegin(DISPPARAMS* pDispParams); + void OnDownloadComplete(DISPPARAMS* pDispParams); + void OnNavigateComplete2(DISPPARAMS* pDispParams); + void OnNewWindow2(DISPPARAMS* pDispParams); + void OnProgressChange(DISPPARAMS* pDispParams); + void OnPropertyChange(DISPPARAMS* pDispParams); + void OnStatusTextChange(DISPPARAMS* pDispParams); + void OnTitleChange(DISPPARAMS* pDispParams); + + // Member variables + CAboutDialog m_aboutDialog; // Help About dialog. + CWebBrowser m_browser; // Win32++'s web browser defined in wxx_webbrowser.h + CMyCombo m_combo; // ComboBoxEx control used in the toolbar. + CEventSink m_eventSink; // Routes event notifications from IWebBrowser. + DWORD m_eventCookie; // Token that uniquely identifies this connection. +}; + + +#endif //MAINFRM_H + diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/src/MyCombo.cpp b/packages/media/cpp/packages/Win32xx/samples/Browser/src/MyCombo.cpp new file mode 100644 index 00000000..e1794d53 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/src/MyCombo.cpp @@ -0,0 +1,26 @@ +///////////////////////////// +// ComboBoxEx.cpp +// + +#include "stdafx.h" +#include "MyCombo.h" +#include "resource.h" + +//////////////////////////////////// +// Definitions of the CMyCombo class +// + +// Called when the window handle (HWND) is attached to CMyCombo. +void CMyCombo::OnAttach() +{ + m_edit.Attach(GetEditCtrl()); +} + +// Set the CREATESTRUCT parameters before the window is created. +void CMyCombo::PreCreate(CREATESTRUCT& cs) +{ + cs.style = WS_VISIBLE | WS_CHILD | CBS_DROPDOWN | WS_CLIPCHILDREN; + cs.cy = 100; // required to display list + cs.hMenu = (HMENU)IDC_COMBOBOXEX; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/src/MyCombo.h b/packages/media/cpp/packages/Win32xx/samples/Browser/src/MyCombo.h new file mode 100644 index 00000000..3d2169c3 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/src/MyCombo.h @@ -0,0 +1,30 @@ +///////////////////////////// +// MyCombo.h +// + +#ifndef MYCOMBO_H +#define MYCOMBO_H + +////////////////////////////////////////////////////// +// CMyCombo manages the ComboBoxEx control used by the +// main frame to hold the web address. +class CMyCombo : public CComboBoxEx +{ +public: + CMyCombo() = default; + virtual ~CMyCombo() override = default; + const CEdit* GetCBEdit() const { return &m_edit; } + +protected: + virtual void OnAttach() override; + virtual void PreCreate(CREATESTRUCT& cs) override; + +private: + CMyCombo(const CMyCombo&) = delete; + CMyCombo& operator=(const CMyCombo&) = delete; + + CEdit m_edit; +}; + + +#endif diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/src/Resource.rc b/packages/media/cpp/packages/Win32xx/samples/Browser/src/Resource.rc new file mode 100644 index 00000000..70a5401c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/src/Resource.rc @@ -0,0 +1,254 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "../src/res/SystemDPI.manifest" + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDW_MAIN MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "New\tCtrl+N", IDM_FILE_NEW, GRAYED + MENUITEM "&Open...\tCtrl+O", IDM_FILE_OPEN, GRAYED + MENUITEM "&Save\tCtrl+S", IDM_FILE_SAVE, GRAYED + MENUITEM "Save &As...", IDM_FILE_SAVEAS, GRAYED + MENUITEM SEPARATOR + MENUITEM "Print Preview", IDM_FILE_PREVIEW + MENUITEM "&Print...\tCtrl+P", IDM_FILE_PRINT + MENUITEM SEPARATOR + MENUITEM "E&xit\tAlt+F4", IDM_FILE_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "Undo\tCtrl+Z", IDM_EDIT_UNDO + MENUITEM "Redo\tCtrl+Y", IDM_EDIT_REDO + MENUITEM SEPARATOR + MENUITEM "Cut\tCtrl+X", IDM_EDIT_CUT + MENUITEM "Copy\tCtrl+C", IDM_EDIT_COPY + MENUITEM "Paste\tCtrl+V", IDM_EDIT_PASTE + MENUITEM "Delete\tDel", IDM_EDIT_DELETE + END + POPUP "&View" + BEGIN + MENUITEM "&Tool Bar", IDW_VIEW_TOOLBAR, CHECKED + MENUITEM "&Status Bar", IDW_VIEW_STATUSBAR, CHECKED + END + POPUP "&Help" + BEGIN + MENUITEM "&About\tF1", IDM_HELP_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDW_MAIN ICON "../src/res/Globe.ico" + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_MENUICONS16 BITMAP "../src/res/MenuIcons16.bmp" +IDB_MENUICONS24 BITMAP "../src/res/MenuIcons24.bmp" +IDB_TOOLBAR24_NORM BITMAP "../src/res/Internet24_n.bmp" +IDB_TOOLBAR24_HOT BITMAP "../src/res/Internet24_h.bmp" +IDB_TOOLBAR24_DIS BITMAP "../src/res/Internet24_d.bmp" +IDB_TOOLBAR32_NORM BITMAP "../src/res/Browser_n.bmp" +IDB_TOOLBAR32_HOT BITMAP "../src/res/Browser_h.bmp" +IDB_TOOLBAR32_DIS BITMAP "../src/res/Browser_d.bmp" + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDW_ABOUT DIALOGEX 0, 0, 186, 109 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "MS Shell Dlg", 400, 0 +BEGIN + DEFPUSHBUTTON "OK",IDOK,68,60,50,14 + CTEXT "Win32++ Internet Browser",IDC_STATIC,43,22,99,8 + ICON IDW_MAIN,0,4,4,20,20 + CTEXT "",IDC_STATIC1,53,32,80,8 + CTEXT "",IDC_STATIC2,53,42,80,8 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDW_MAIN ACCELERATORS +BEGIN + "N", IDM_FILE_NEW, VIRTKEY, CONTROL, NOINVERT + "O", IDM_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT + "P", IDM_FILE_PRINT, VIRTKEY, CONTROL, NOINVERT + "S", IDM_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT + "C", IDM_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + "X", IDM_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT + "V", IDM_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT + "Z", IDM_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT + "Y", IDM_EDIT_REDO, VIRTKEY, CONTROL, NOINVERT +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDW_ABOUT, DIALOG + BEGIN + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDW_MAIN "Win32++ Internet Browser" + IDW_VIEW_TOOLBAR "Show or hide the tool bar" + IDW_VIEW_STATUSBAR "Show or hide the status bar" + IDW_READY "Ready" + IDW_INDICATOR_CAPS "CAP" + IDW_INDICATOR_NUM "NUM" +END + +STRINGTABLE +BEGIN + IDW_INDICATOR_SCRL "SCRL" +END + +STRINGTABLE +BEGIN + IDM_FILE_NEW "Create a New Document" + IDM_FILE_OPEN "Open Existing Document" + IDM_FILE_SAVE "Save the Document" + IDM_FILE_SAVEAS "Save the Document with a new name" + IDM_FILE_PRINT "Print the Document" +END + +STRINGTABLE +BEGIN + IDM_FILE_EXIT "End the Program" + IDM_EDIT_UNDO "Undo the last action" + IDM_EDIT_REDO "Redo the previously undone action" + IDM_EDIT_CUT "Cut the Selected Contents to the Clipboard" + IDM_EDIT_COPY "Copy the Selected Contents to the Clipboard" + IDM_EDIT_PASTE "Paste the Clipboard Contents to the Document" + IDM_EDIT_DELETE "Erase the selected Contents" + IDM_HELP_ABOUT "Display Information about this program" + IDM_BACK "Go back one page" + IDM_FORWARD "Go forward one page" + IDM_REFRESH "Reload current page" +END + +STRINGTABLE +BEGIN + IDM_STOP "Stop loading this page" + IDM_HOME "Load home page" +END + +STRINGTABLE +BEGIN + SC_CLOSE "Close the Window" + SC_MAXIMIZE "Maximize the Window" + SC_MINIMIZE "Minimize the Window" + SC_MOVE "Move the Window" + SC_NEXTWINDOW "Select Next Window" + SC_PREVWINDOW "Select Previous Window" + SC_RESTORE "Restore the Window" + SC_SIZE "Resize the Window" +END + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/src/StdAfx.cpp b/packages/media/cpp/packages/Win32xx/samples/Browser/src/StdAfx.cpp new file mode 100644 index 00000000..8957144d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/src/StdAfx.cpp @@ -0,0 +1,16 @@ +///////////////////////////// +// StdAfx.cpp +// + +// This file is used for precompiled hearders. Precompiled headers allow +// programs to be recompiled more quickly + +// To use precompiled headers, do the following: +// 1) Add the set of rarely changed headers to stdafx.h +// 2) Include stdafx.h in each cpp file. It must be included first. +// 3) Add stdafx.cpp to your project. +// 4) Turn on precompiled hearders in the project + + +#include "stdafx.h" + diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/src/UserMessages.h b/packages/media/cpp/packages/Win32xx/samples/Browser/src/UserMessages.h new file mode 100644 index 00000000..ac446abf --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/src/UserMessages.h @@ -0,0 +1,23 @@ +///////////////////////////// +// UserMessages.h +// + +#ifndef _USER_MESSAGES_H_ +#define _USER_MESSAGES_H_ + + +// User defined messages used in this application. +#define UWM_BEFORENAVIGATE (WM_APP + 0x0001) +#define UWM_COMMANDSTATECHANGE (WM_APP + 0x0002) +#define UWM_DOCUMENTCOMPLETE (WM_APP + 0x0003) +#define UWM_DOWNLOADBEGIN (WM_APP + 0x0004) +#define UWM_DOWNLOADCOMPLETE (WM_APP + 0x0005) +#define UWM_NAVIGATECOMPLETE2 (WM_APP + 0x0006) +#define UWM_NEWWINDOW2 (WM_APP + 0x0007) +#define UWM_PROGRESSCHANGE (WM_APP + 0x0008) +#define UWM_PROPERTYCHANGE (WM_APP + 0x0009) +#define UWM_STATUSTEXTCHANGE (WM_APP + 0x000A) +#define UWM_TITLECHANGE (WM_APP + 0x000B) + + +#endif // _USER_MESSAGES_H_ diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/src/main.cpp b/packages/media/cpp/packages/Win32xx/samples/Browser/src/main.cpp new file mode 100644 index 00000000..27adc60b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/src/main.cpp @@ -0,0 +1,45 @@ +///////////////////////////// +// main.cpp +// + +#include "stdafx.h" +#include "BrowserApp.h" + +int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPWSTR, _In_ int) +{ + try + { + // Start Win32++. + CBrowserApp theApp; + + // Run the application. + return theApp.Run(); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return -1; +} + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/Browser_d.bmp b/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/Browser_d.bmp new file mode 100644 index 00000000..efc8bf70 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/Browser_d.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/Browser_h.bmp b/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/Browser_h.bmp new file mode 100644 index 00000000..bb343291 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/Browser_h.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/Browser_n.bmp b/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/Browser_n.bmp new file mode 100644 index 00000000..f1e9cbeb Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/Browser_n.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/Globe.ico b/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/Globe.ico new file mode 100644 index 00000000..3b192884 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/Globe.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/Internet24_d.bmp b/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/Internet24_d.bmp new file mode 100644 index 00000000..0238a3c2 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/Internet24_d.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/Internet24_h.bmp b/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/Internet24_h.bmp new file mode 100644 index 00000000..e873de8a Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/Internet24_h.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/Internet24_n.bmp b/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/Internet24_n.bmp new file mode 100644 index 00000000..12c1b32e Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/Internet24_n.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/MenuIcons16.bmp b/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/MenuIcons16.bmp new file mode 100644 index 00000000..cbfa5623 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/MenuIcons16.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/MenuIcons24.bmp b/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/MenuIcons24.bmp new file mode 100644 index 00000000..b7012406 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/MenuIcons24.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/SystemDPI.manifest b/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/SystemDPI.manifest new file mode 100644 index 00000000..09299d09 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/src/res/SystemDPI.manifest @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/src/resource.h b/packages/media/cpp/packages/Win32xx/samples/Browser/src/resource.h new file mode 100644 index 00000000..e1a3294a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/src/resource.h @@ -0,0 +1,63 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Resource.rc +// + +// include the Resource IDs defined by Win32++ +#include "default_resource.h" + + +//Resource IDs for menu items and ToolBar items +#define IDM_FILE_NEW 121 +#define IDM_FILE_OPEN 122 +#define IDM_FILE_SAVE 123 +#define IDM_FILE_SAVEAS 124 +#define IDM_FILE_PREVIEW 125 +#define IDM_FILE_PRINT 126 +#define IDM_FILE_CLOSE 127 +#define IDM_FILE_EXIT 128 +#define IDM_EDIT_UNDO 130 +#define IDM_EDIT_REDO 131 +#define IDM_EDIT_CUT 132 +#define IDM_EDIT_COPY 133 +#define IDM_EDIT_PASTE 134 +#define IDM_EDIT_DELETE 135 +#define IDM_HELP_ABOUT 140 + +#define IDM_BACK 141 +#define IDM_FORWARD 142 +#define IDM_REFRESH 143 +#define IDM_STOP 144 +#define IDM_HOME 145 + +#define IDB_TOOLBAR24_NORM 150 +#define IDB_TOOLBAR24_HOT 151 +#define IDB_TOOLBAR24_DIS 152 +#define IDB_TOOLBAR32_NORM 153 +#define IDB_TOOLBAR32_HOT 154 +#define IDB_TOOLBAR32_DIS 155 +#define IDB_MENUICONS16 156 +#define IDB_MENUICONS24 157 + +#define IDC_COMBOBOXEX 160 + +#define IDC_STATIC1 180 +#define IDC_STATIC2 181 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 149 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 150 +#endif +#endif + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Browser/src/stdafx.h b/packages/media/cpp/packages/Win32xx/samples/Browser/src/stdafx.h new file mode 100644 index 00000000..08450116 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Browser/src/stdafx.h @@ -0,0 +1,90 @@ +///////////////////////////// +// StdAfx.h +// + +// This file is used for precompiled headers. +// Rarely modified header files should be included. +// Based on code provided by Lynn Allan. + + +#ifndef STDAFX_H +#define STDAFX_H + + +// Predefinitions for windows.h go here +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +// Specify Win32xx specific predefinitions here +//#define NO_USING_NAMESPACE // Don't use Win32xx namespace + +// Rarely modified header files should be included here +#include // Add support for std::vector +#include // Add support for std::map +#include // Add support for std::string +#include // Add support for stringstream +#include // Add support for the assert macro +#include // Add support for C style printf, sprintf, etc. +#include // Add support for C style character conversions atoi etc. +#include // Add support for C style TCHARs. + +// Add the Win32++ library +#include // Add CWinApp +#include // Add CArchive +#include // Add CAnimation, CComboBox, CComboBoxEx, CDateTime, CHeader, CHotKey, CIPAddress, CProgressBar, CSpinButton, CScrollBar, CSlider, CToolTip +#include // Add CCriticalSection, CThreadLock +#include // Add CString, CStringA, CStringW +#include // Add CDataExchange +#include // Add CDialog, CResizer +#include // Add CDockFrame, CMDIDockFrame +#include // Add CDocker, CDockContainer +#include // Add CException, CFileException, CNotSupportedException, CResourceException, CUserException, CWinException +#include // Add CFile +#include // Add CFileFind +#include // Add CFolderDialog +#include // Add CFrame +#include // Add CDC, CGDIObject, CBitmap, CBrush, CFont, CPalatte, CPen, CRgn +#include // Add CHGlobal +#include // Add CImageList +#include // Add CListView +#include // Add CMDIChild, CMDIFrame, CDockMDIFrame +#include // Add CMenu +#include // Add CMenuBar +#include // Add CMetaFile, CEnhMetaFile +#include // Add CEvent, CMutex, CSemaphore +#include // Add CPropertyPage, CPropertySheet +#include // Add CRebar +#include // Add CPoint, CRect, CSize +#include // Add CRegKey +#include // Add CRichEdit +#include // Add CScrollView +#include // Adds macros, windows header files, and CObject +#include // Add CSocket +#include // Add CStatusBar +#include // Add CButton, CEdit, CListBox +#include // Add CTab, CTabbedMDI +#include // Add AtoT, AtoW, TtoA, TtoW, WtoA, WtoT etc. +#include // Add MenuTheme, ReBarTheme, StatusBarTheme, ToolBarTheme +#include // Add CWinThread +#include // Add CTime +#include // Add CToolBar +#include // Add CTreeView +#include // Add CWebBrowser, CAXHost +#include // Add CWnd + +// WIN32_LEAN_AND_MEAN can't be used with these +#ifndef WIN32_LEAN_AND_MEAN + #include // Add CCommonDialog, CColorDialog, CFileDialog, CFindReplace, CFontDialog + #include // Add CFolderDialogEx + #include // Add CPrintPreview + #include // Add CPageSetupDialog, CPrintDialog + #include // Add CPrintDialogEx + #include // Add CTaskDialog + + // Visual Studio + #if defined (_MSC_VER) + #include // Add CRibbon, CRibbonFrame + #endif + +#endif // define WIN32_LEAN_AND_MEAN + +#endif // define STDAFX_H diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2015.sln b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2015.sln new file mode 100644 index 00000000..0709c7ba --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2015.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BrowserATL", "BrowserATL_2015.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2015.vcxproj b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2015.vcxproj new file mode 100644 index 00000000..10d4b7f4 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2015.vcxproj @@ -0,0 +1,253 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Browser + BrowserATL + + + + Application + Unicode + v140_xp + + + Application + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + + + + + + + + + + + + + + + + + false + + + false + + + false + false + + + false + false + + + + Use + Level4 + true + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2015.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2015.vcxproj.filters new file mode 100644 index 00000000..4e394cfe --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2015.vcxproj.filters @@ -0,0 +1,239 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + + + {29139989-069b-42da-9eef-8055c7c67817} + + + {2e888c36-7e49-4749-a3d0-21a75f63e498} + + + {c9391bd9-5cd2-430b-977d-45924ed801d4} + + + {b09bff25-b2c7-4c51-8891-e1b05903851c} + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2019.sln b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2019.sln new file mode 100644 index 00000000..8c2ccdd6 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2019.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BrowserATL", "BrowserATL_2019.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5FF873AE-A462-4C9B-99EE-279901F7113F} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2019.vcxproj b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2019.vcxproj new file mode 100644 index 00000000..45392c08 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2019.vcxproj @@ -0,0 +1,236 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Browser + BrowserATL + + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2019.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2019.vcxproj.filters new file mode 100644 index 00000000..33f70d95 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2019.vcxproj.filters @@ -0,0 +1,239 @@ + + + + + {e24f7ded-8d10-4476-b412-e786a4ecbad3} + + + {07d768b8-60f6-41b7-8aa7-670a44c43755} + + + {8aeaea51-10d0-4300-9cfb-e1410cea2023} + + + {b9552b50-d45e-45cf-ad00-db4c6ff4a424} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2022.sln b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2022.sln new file mode 100644 index 00000000..c97288f1 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2022.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BrowserATL", "BrowserATL_2022.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4AB35DD0-8A29-411E-AE7B-8FE6491DF8AE} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2022.vcxproj b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2022.vcxproj new file mode 100644 index 00000000..31cf497b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2022.vcxproj @@ -0,0 +1,243 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Browser + BrowserATL + 10.0 + + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2022.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2022.vcxproj.filters new file mode 100644 index 00000000..33f70d95 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2022.vcxproj.filters @@ -0,0 +1,239 @@ + + + + + {e24f7ded-8d10-4476-b412-e786a4ecbad3} + + + {07d768b8-60f6-41b7-8aa7-670a44c43755} + + + {8aeaea51-10d0-4300-9cfb-e1410cea2023} + + + {b9552b50-d45e-45cf-ad00-db4c6ff4a424} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2026.slnx b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2026.slnx new file mode 100644 index 00000000..7ca53504 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2026.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2026.vcxproj b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2026.vcxproj new file mode 100644 index 00000000..5e1152ec --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2026.vcxproj @@ -0,0 +1,243 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Browser + BrowserATL + 10.0 + + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2026.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2026.vcxproj.filters new file mode 100644 index 00000000..ffcc8cfd --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/ProjectFiles/BrowserATL_2026.vcxproj.filters @@ -0,0 +1,239 @@ + + + + + {e24f7ded-8d10-4476-b412-e786a4ecbad3} + + + {07d768b8-60f6-41b7-8aa7-670a44c43755} + + + {8aeaea51-10d0-4300-9cfb-e1410cea2023} + + + {b9552b50-d45e-45cf-ad00-db4c6ff4a424} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/Readme.txt new file mode 100644 index 00000000..fe7b7efb --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/Readme.txt @@ -0,0 +1,35 @@ +Browser Example +=============== +This example demonstrates how to incorporate the use of ATL into a +Win32++ application. Here we use ATL to to create a web browser. We also +use ATL to create an event sink using IDispatch to respond to browser events. + +The Active Template Library (ATL) is a set of template-based C++ classes +developed by Microsoft. It simplifies the programming of Component Object Model +(COM) objects. + +ATL is provided for free with the later Microsoft compilers. It is an optional +component of the Visual Studio Community compiler which can be added using its +installer. The code in this sample requires ATL version 10 (VS2010) or later. + +ATL greatly simplifies the use of COM in our code. I recommend using it if you +are developing your code using COM with a Microsoft compiler. ATL is only +supported on Microsoft compilers though. It is not provided with MinGW or +modern Embacardero C++ compilers. + + +Features demonstrated in this sample +==================================== +* Use of a ComboBoxEx control within the frame's rebar. +* Use of Active Template Library (ATL) to incorporate ActiveX components. +* Use of the IWebBrowser2 interface to render a web page. +* Use of IDispatch to create an event sink for IWebBrowser2 events. + +Note: +This sample uses the IWebBrowser2 interface to display web pages. The IWebBrowser2 +provides access to the same features as used by the Microsoft's Internet Explorer. +Support for Internet Explorer ended on June 15, 2022, so this sample might not render +web pages properly. + +Consider using using the EdgeBrowser and EdgeBrowserEx samples to display modern +web pages instead. diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/AboutDialog.h b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/AboutDialog.h new file mode 100644 index 00000000..71e4364d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/AboutDialog.h @@ -0,0 +1,31 @@ +///////////////////////////////////////////// +// AboutDialog.h + +#ifndef _ABOUTDIALOG_H_ +#define _ABOUTDIALOG_H_ + +#include "resource.h" + +//////////////////////////////////////////////////////// +// CAboutDialog manages the dialog which displays +// information about this program. +class CAboutDialog : public CDialog +{ +public: + CAboutDialog() : CDialog(IDW_ABOUT) {} + virtual BOOL OnInitDialog() override + { + // Set the Win32++ version string. + UINT ver = _WIN32XX_VER; + CString Win32xxVersion; + Win32xxVersion << "Win32++ Version " << ver / 0x100 << "." << + (ver % 0x100) / 0x10 << "." << (ver % 0x10); + + SetDlgItemText(IDC_STATIC1, Win32xxVersion); + SetDlgItemText(IDC_STATIC2, L"by David Nash"); + + return TRUE; + } +}; + +#endif // _ABOUTDIALOG_H_ diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/BrowserApp.cpp b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/BrowserApp.cpp new file mode 100644 index 00000000..2c15bf91 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/BrowserApp.cpp @@ -0,0 +1,19 @@ +///////////////////////////// +// BrowserApp.cpp +// + +#include "stdafx.h" +#include "BrowserApp.h" + +/////////////////////////////////// +// CBrowserApp function definitions +// + +// This function is called when the application starts. +BOOL CBrowserApp::InitInstance() +{ + // Create the Frame + m_frame.Create(); // throws a CWinException on failure + + return TRUE; +} \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/BrowserApp.h b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/BrowserApp.h new file mode 100644 index 00000000..e9ee3ea4 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/BrowserApp.h @@ -0,0 +1,31 @@ +///////////////////////////// +// BrowserApp.h +// + +#ifndef BROWSERAPP_H +#define BROWSERAPP_H + +#include "Mainfrm.h" + +////////////////////////////////////////////////////////////////// +// CBrowserApp manages the application. It initializes the Win32++ +// framework when it is constructed, and creates the main frame +// window when it runs. +class CBrowserApp : public CWinApp +{ +public: + CBrowserApp() = default; + virtual ~CBrowserApp() override = default; + +protected: + virtual BOOL InitInstance() override; + +private: + CBrowserApp(const CBrowserApp&) = delete; + CBrowserApp& operator=(const CBrowserApp&) = delete; + + CMainFrame m_frame; +}; + + +#endif // define BROWSERAPP_H diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/DispatchSink.cpp b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/DispatchSink.cpp new file mode 100644 index 00000000..0d05dde5 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/DispatchSink.cpp @@ -0,0 +1,61 @@ +///////////////////////////// +// DispatchSink.cpp +// + +#include "stdafx.h" +#include "DispatchSink.h" +#include "BrowserApp.h" +#include "UserMessages.h" + +///////////////////////////////////// +// CDispatchSink function definitions +// + +// Sends a window message to the frame when a browser event occurs. +STDMETHODIMP CDispatchSink::Invoke(DISPID dispidMember, REFIID, LCID, WORD, + DISPPARAMS* pDispParams, VARIANT*, EXCEPINFO*, UINT*) +{ + if (!pDispParams) + return E_INVALIDARG; + + HWND frame = GetApp()->GetMainWnd(); + + switch (dispidMember) + { + case DISPID_BEFORENAVIGATE2: + ::SendMessage(frame, UWM_BEFORENAVIGATE2, (WPARAM)pDispParams, 0); + break; + case DISPID_COMMANDSTATECHANGE: + ::SendMessage(frame, UWM_COMMANDSTATECHANGE, (WPARAM)pDispParams, 0); + break; + case DISPID_DOCUMENTCOMPLETE: + ::SendMessage(frame, UWM_DOCUMENTCOMPLETE, (WPARAM)pDispParams, 0); + break; + case DISPID_DOWNLOADBEGIN: + ::SendMessage(frame, UWM_DOWNLOADBEGIN, (WPARAM)pDispParams, 0); + break; + case DISPID_DOWNLOADCOMPLETE: + ::SendMessage(frame, UWM_DOWNLOADCOMPLETE, (WPARAM)pDispParams, 0); + break; + case DISPID_NAVIGATECOMPLETE2: + ::SendMessage(frame, UWM_NAVIGATECOMPLETE2, (WPARAM)pDispParams, 0); + break; + case DISPID_PROGRESSCHANGE: + ::SendMessage(frame, UWM_PROGRESSCHANGE, (WPARAM)pDispParams, 0); + break; + case DISPID_PROPERTYCHANGE: + ::SendMessage(frame, UWM_PROPERTYCHANGE, (WPARAM)pDispParams, 0); + break; + case DISPID_STATUSTEXTCHANGE: + ::SendMessage(frame, UWM_STATUSTEXTCHANGE, (WPARAM)pDispParams, 0); + break; + case DISPID_NEWWINDOW2: + ::SendMessage(frame, UWM_NEWWINDOW2, (WPARAM)pDispParams, 0); + break; + case DISPID_TITLECHANGE: + ::SendMessage(frame, UWM_TITLECHANGE, (WPARAM)pDispParams, 0); + break; + } + + return S_OK; +} \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/DispatchSink.h b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/DispatchSink.h new file mode 100644 index 00000000..72174da1 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/DispatchSink.h @@ -0,0 +1,48 @@ +///////////////////////////// +// DispatchSink.h +// + +#ifndef __DISPATCHSINK_H__ +#define __DISPATCHSINK_H__ + + +#include // ATL support +#include // ATL COM support +#include // ATL ActiveX support +#include // ATL IDispatchID helper +#include // ATL WebBrowser2 helper + + +//////////////////////////////////////////////////// +// Creates an ATL class for IDispatch. This is used +// to sink events from IWebbrowser2 via invoke. +class ATL_NO_VTABLE CDispatchSink: public IDispatch, + public CComObjectRootEx +{ +public: +BEGIN_COM_MAP(CDispatchSink) + COM_INTERFACE_ENTRY(IDispatch) + COM_INTERFACE_ENTRY_IID(DIID_DWebBrowserEvents2, IDispatch) +END_COM_MAP() + // Process events from the web browser. + virtual HRESULT __stdcall Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, + DISPPARAMS* pdispparams, VARIANT* pvarResult, + EXCEPINFO* pexcepinfo, UINT* puArgErr); + + // These must be present, even though they are not implemented. + virtual HRESULT __stdcall GetTypeInfoCount(UINT*) + { + return E_NOTIMPL; + } + virtual HRESULT __stdcall GetTypeInfo(UINT, LCID, ITypeInfo**) + { + return E_NOTIMPL; + } + virtual HRESULT __stdcall GetIDsOfNames(REFIID, LPOLESTR*, UINT, + LCID, DISPID*) + { + return E_NOTIMPL; + } +}; + +#endif // __DISPATCHSINK_H__ diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/Mainfrm.cpp b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/Mainfrm.cpp new file mode 100644 index 00000000..9963b9e0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/Mainfrm.cpp @@ -0,0 +1,580 @@ +#include "stdafx.h" +#include "resource.h" +#include "Mainfrm.h" +#include "UserMessages.h" + +constexpr COLORREF lightgray = RGB(192, 192, 192); +constexpr COLORREF magenta = RGB(255, 0, 255); + +////////////////////////////////// +// CMainFrame function definitions +// + +// Adds a ComboBoxEx control to the rebar. +void CMainFrame::AddComboBoxBand() +{ + // Create the ComboboxEx window. + m_combo.Create(GetReBar()); + + int padding = 2; + int height = m_combo.GetWindowRect().Height() + DpiScaleInt(padding); + + // Put the window in a new rebar band. + REBARBANDINFO rbbi{}; + rbbi.cbSize = sizeof(REBARBANDINFO); + rbbi.fMask = RBBIM_COLORS | RBBIM_CHILDSIZE | RBBIM_STYLE | RBBIM_CHILD | RBBIM_TEXT; + rbbi.cyMinChild = height; + rbbi.cyMaxChild = height; + rbbi.cxMinChild = 200; + rbbi.fStyle = RBBS_BREAK | RBBS_VARIABLEHEIGHT | RBBS_GRIPPERALWAYS; + rbbi.clrFore = GetSysColor(COLOR_BTNTEXT); + rbbi.clrBack = GetReBarTheme().clrBand1; + rbbi.hwndChild = m_combo.GetHwnd(); + rbbi.lpText = (LPWSTR)L"Address"; + + GetReBar().InsertBand(-1, rbbi); +} + +HWND CMainFrame::Create(HWND parent) +{ + // Set m_view as the view window of the frame. + SetView(m_view); + + // Set the registry key name, and load the initial window position. + // Use a registry key name like "CompanyName\\Application". + LoadRegistrySettings(L"Win32++\\Browser ATL Sample"); + + return CFrame::Create(parent); +} + +// Go to the previous web page. +BOOL CMainFrame::OnBack() +{ + GetBrowser()->GoBack(); + return TRUE; +} + +// Called before navigation occurs on either a window or frameset element. +void CMainFrame::OnBeforeNavigate2(DISPPARAMS*) +{ +} + +// Called when the enabled state of a command changes. +void CMainFrame::OnCommandStateChange(DISPPARAMS* pDispParams) +{ + CToolBar& TB = GetToolBar(); + + if ((pDispParams) && (pDispParams->cArgs == 2)) + { + BOOL isEnabled = pDispParams->rgvarg[0].boolVal; + LONG command = pDispParams->rgvarg[1].lVal; + { + // Update the Forward and Back buttons. + switch (command) + { + case CSC_NAVIGATEFORWARD: + isEnabled ? TB.EnableButton(IDM_FORWARD) : TB.DisableButton(IDM_FORWARD); + break; + case CSC_NAVIGATEBACK: + isEnabled ? TB.EnableButton(IDM_BACK) : TB.DisableButton(IDM_BACK); + break; + } + } + } +} + +// Respond to menu, toolbar or accelerator key input. +BOOL CMainFrame::OnCommand(WPARAM wparam, LPARAM lparam) +{ + UINT id = LOWORD(wparam); + switch (id) + { + case IDM_BACK: return OnBack(); + case IDM_EDIT_CUT: return OnEditCut(); + case IDM_EDIT_COPY: return OnEditCopy(); + case IDM_EDIT_PASTE: return OnEditPaste(); + case IDM_EDIT_DELETE: return OnEditDelete(); + case IDM_FILE_EXIT: return OnFileExit(); + case IDM_FORWARD: return OnForward(); + case IDM_HELP_ABOUT: return OnHelp(); + case IDM_HOME: return OnHome(); + case IDM_FILE_PRINT: return OnPrint(); + case IDM_FILE_PREVIEW: return OnPrintPreview(); + case IDM_REFRESH: return OnRefresh(); + case IDM_STOP: return OnStop(); + case IDW_VIEW_STATUSBAR: return OnViewStatusBar(); + case IDW_VIEW_TOOLBAR: return OnViewToolBar(); + } + + // Handle notification WM_COMMAND from ComboboxEx. + if(reinterpret_cast(lparam) == m_combo.GetHwnd()) + { + switch(HIWORD(wparam)) + { + case CBN_SELCHANGE: // User made selection from list. + { + // Get text from the combo edit box + CString str = m_combo.GetWindowText(); + + // Navigate to web page + m_view.Navigate(str); + + // Set focus to web page + LONG_PTR hWeb; + GetBrowser()->get_HWND(&hWeb); + ::SetFocus(reinterpret_cast(hWeb)); + } + return TRUE; + } + } + + return FALSE; +} + +// Called during the window's creation. +int CMainFrame::OnCreate(CREATESTRUCT& cs) +{ + // OnCreate controls the way the frame is created. + // Overriding CFrame::OnCreate is optional. + + // A menu is added if the IDW_MAIN menu resource is defined. + // Frames have all options enabled by default. + // Use the following functions to disable options. + + // UseIndicatorStatus(FALSE); // Don't show keyboard indicators in the StatusBar. + // UseMenuStatus(FALSE); // Don't show menu descriptions in the StatusBar. + // UseOwnerDrawnMenu(FALSE); // Don't use owner draw for popup menu items. + // UseReBar(FALSE); // Don't use a ReBar. + // UseStatusBar(FALSE); // Don't use a StatusBar. + // UseThemes(FALSE); // Don't use themes. + // UseToolBar(FALSE); // Don't use a ToolBar. + + // Call the base function + return CFrame::OnCreate(cs); +} + +// Called when a document has been completely loaded and initialized. +void CMainFrame::OnDocumentComplete(DISPPARAMS*) +{ + SetStatusText(L"Done"); +} + +// Called when a navigation operation is beginning. +void CMainFrame::OnDownloadBegin(DISPPARAMS*) +{ +} + +// Called when a navigation operation finishes, is halted, or fails. +void CMainFrame::OnDownloadComplete(DISPPARAMS*) +{ +} + +// Deletes the selected text. +// Called in response to the menu or accelerator key. +BOOL CMainFrame::OnEditCut() +{ + if (GetFocus() == GetCBEdit()->GetHwnd()) + GetCBEdit()->Cut(); + else + GetBrowser()->ExecWB(OLECMDID_CUT, OLECMDEXECOPT_DODEFAULT, nullptr, nullptr); + + return TRUE; +} + +// Copies the selected text to the clip board. +// Called in response to the menu or accelerator key. +BOOL CMainFrame::OnEditCopy() +{ + if (GetFocus() == GetCBEdit()->GetHwnd()) + GetCBEdit()->Copy(); + else + GetBrowser()->ExecWB(OLECMDID_COPY, OLECMDEXECOPT_DODEFAULT, nullptr, nullptr); + + return TRUE; +} + +// Pastes text from the clip board. +// Called in response to the menu or accelerator key. +BOOL CMainFrame::OnEditPaste() +{ + if (GetFocus() == GetCBEdit()->GetHwnd()) + GetCBEdit()->Paste(); + else + GetBrowser()->ExecWB(OLECMDID_PASTE, OLECMDEXECOPT_DODEFAULT, nullptr, nullptr); + + return TRUE; +} + +// Deletes the selected text or the next character. +// Called in response to the menu or accelerator key. +BOOL CMainFrame::OnEditDelete() +{ + if (GetFocus() == GetCBEdit()->GetHwnd()) + GetCBEdit()->Clear(); + else + GetBrowser()->ExecWB(OLECMDID_DELETE, OLECMDEXECOPT_DODEFAULT, nullptr, nullptr); + + return TRUE; +} + +// Issue a close request to the frame. +BOOL CMainFrame::OnFileExit() +{ + Close(); + return TRUE; +} + +// Go to the next web page. +BOOL CMainFrame::OnForward() +{ + GetBrowser()->GoForward(); + return TRUE; +} + +// Limit the minimum size of the window. +LRESULT CMainFrame::OnGetMinMaxInfo(UINT msg, WPARAM wparam, LPARAM lparam) +{ + LPMINMAXINFO lpMMI = (LPMINMAXINFO)lparam; + const CSize minimumSize(600, 400); + lpMMI->ptMinTrackSize.x = DpiScaleInt(minimumSize.cx); + lpMMI->ptMinTrackSize.y = DpiScaleInt(minimumSize.cy); + return FinalWindowProc(msg, wparam, lparam); +} + +// Display the help about dialog. +BOOL CMainFrame::OnHelp() +{ + // Ensure only one dialog displayed even for multiple hits of the F1 button. + if (!m_aboutDialog.IsWindow()) + { + m_aboutDialog.DoModal(*this); + } + + return TRUE; +} + +// Load the browser's home page. +BOOL CMainFrame::OnHome() +{ + GetBrowser()->GoHome(); + return TRUE; +} + +// Called after the frame window is created. +void CMainFrame::OnInitialUpdate() +{ + // The frame is now created. + // Place any additional startup code here. + + // Suppress Java script errors. + GetBrowser()->put_Silent(VARIANT_TRUE); + + // Load the web page. + m_view.Navigate(L"www.google.com"); +} + +// Called when navigation completes on either a window or frameset element. + +void CMainFrame::OnNavigateComplete2(DISPPARAMS* pDispParams) +{ + if (pDispParams->rgvarg[0].vt == (VT_BYREF|VT_VARIANT)) + { + CComVariant vtURL(*pDispParams->rgvarg[0].pvarVal); + vtURL.ChangeType(VT_BSTR); + + CString str = L"NavigateComplete2: "; + str += vtURL.bstrVal; + str += L"\n"; + TRACE(str); + } + + BSTR url; + if (SUCCEEDED(GetBrowser()->get_LocationURL(&url))) + { + // Update the URL in the ComboboxEx edit box. + m_combo.SetWindowText(CString(url)); + } + SysFreeString(url); +} + +// Called when a new window is to be created. +void CMainFrame::OnNewWindow2(DISPPARAMS*) +{ + TRACE("NewWindow2\n"); +} + +// Called when the frame receives a notification (WM_NOTIFY). +LRESULT CMainFrame::OnNotify(WPARAM wparam, LPARAM lparam) +{ + LPNMHDR pHeader = reinterpret_cast(lparam); + if (pHeader != 0 && pHeader->hwndFrom == m_combo) + { + switch ((pHeader)->code) + { + case CBEN_ENDEDIT: // operation concluded in the combo edit box + { + PNMCBEENDEDIT pEndEdit = reinterpret_cast(pHeader); + switch (pEndEdit->iWhy) + { + case CBENF_RETURN: // return hit in the combo edit box + { + // Get text from combo edit box + CString str = m_combo.GetWindowText(); + + // Insert text into the combo list box. + COMBOBOXEXITEM item = {}; + item.mask = CBEIF_TEXT; + item.pszText = (LPWSTR)str.c_str(); + m_combo.InsertItem(item); + + // Navigate to the web page + m_view.Navigate(str); + + return FALSE; + } + } + } + } + } + + return CFrame::OnNotify(wparam, lparam); +} + +// Displays the web page as it would look when printed. +BOOL CMainFrame::OnPrintPreview() +{ + GetBrowser()->ExecWB(OLECMDID_PRINTPREVIEW, OLECMDEXECOPT_DODEFAULT, nullptr, nullptr); + + return TRUE; +} + +// Prints the web page to the default printer. +BOOL CMainFrame::OnPrint() +{ + SAFEARRAYBOUND psabBounds[1]; + SAFEARRAY* psaHeadFoot; + long rgIndices; + + VARIANT vHeadStr = {}; + VARIANT vFootStr = {}; + VARIANT vArg = {}; + + try + { + // Initialize header and footer parameters to send to ExecWB(). + psabBounds[0].lLbound = 0; + psabBounds[0].cElements = 3; + psaHeadFoot = SafeArrayCreate(VT_VARIANT, 1, psabBounds); + if (nullptr == psaHeadFoot) + throw std::bad_alloc(); + + VariantInit(&vHeadStr); + VariantInit(&vFootStr); + + // Argument 1: Header + vHeadStr.vt = VT_BSTR; + vHeadStr.bstrVal = SysAllocString(L"This is my header string."); + if (vHeadStr.bstrVal == nullptr) + throw std::bad_alloc(); + + rgIndices = 0; + if (SUCCEEDED(SafeArrayPutElement(psaHeadFoot, &rgIndices, static_cast(&vHeadStr)))) + { + // Argument 2: Footer + vFootStr.vt = VT_BSTR; + vFootStr.bstrVal = SysAllocString(L"This is my footer string."); + if (vFootStr.bstrVal == nullptr) + throw std::bad_alloc(); + + rgIndices = 1; + if (SUCCEEDED(SafeArrayPutElement(psaHeadFoot, &rgIndices, static_cast(&vFootStr)))) + { + // Issue the print command + VariantInit(&vArg); + vArg.vt = VT_ARRAY | VT_BYREF; + vArg.parray = psaHeadFoot; + if (FAILED(GetBrowser()->ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, &vArg, nullptr))) + throw CUserException(L"Print Failed"); + } + } + + // Calls SysFreeString on each element. + SafeArrayDestroy(psaHeadFoot); + } + catch (...) + { + if (psaHeadFoot) + SafeArrayDestroy(psaHeadFoot); + } + + return TRUE; +} + +// Called when the progress of a download operation is updated on the object. +void CMainFrame::OnProgressChange(DISPPARAMS* pDispParams) +{ + CString str; + + if (pDispParams->cArgs != 0) + { + if (pDispParams->cArgs > 1 && pDispParams->rgvarg[1].vt == VT_I4) + { + int progress = pDispParams->rgvarg[1].lVal; + str << L"Progress = " << progress; + } + + if (pDispParams->rgvarg[0].vt == VT_I4) + { + int progressMax = pDispParams->rgvarg[0].lVal; + str << L", ProgressMax = " << progressMax; + } + + str << L"\n"; + TRACE(str); + } +} + +// Called when the IWebBrowser2::PutProperty method of the object changes the +// value of a property. +void CMainFrame::OnPropertyChange(DISPPARAMS* pDispParams) +{ + CString str; + if (pDispParams->cArgs > 0 && pDispParams->rgvarg[0].vt == VT_BSTR) + { + str += L"Property Change:"; + str += pDispParams->rgvarg[0].bstrVal; + } + + str += L"\n"; + TRACE(str); +} + +// Reload the current web page. +BOOL CMainFrame::OnRefresh() +{ + GetBrowser()->Refresh(); + return TRUE; +} + +// Called when the status bar text of the object has changed. +void CMainFrame::OnStatusTextChange(DISPPARAMS* pDispParams) +{ + CString statusText = pDispParams->rgvarg->bstrVal; + + if (statusText != L"") + SetStatusText(statusText); + else + SetStatusText(L"Done"); +} + +// Stop loading the current web page. +BOOL CMainFrame::OnStop() +{ + GetBrowser()->Stop(); + return TRUE; +} + +// Called when the title of a document in the object becomes available +// or changes. +void CMainFrame::OnTitleChange(DISPPARAMS* pDispParams) +{ + TRACE(L"TitleChange: \n"); + CString str; + + if (pDispParams->cArgs > 0 && pDispParams->rgvarg[0].vt == VT_BSTR) + { + str = pDispParams->rgvarg[0].bstrVal; + str += L" - Win32++ ATL Browser"; + TRACE(str); + } + else + str = LoadString(IDW_MAIN); + + SetWindowText(str); +} + +// Add menu icons from the IDW_MAIN bitmap resource. +void CMainFrame::SetupMenuIcons() +{ + std::vector iconData; // a vector of Resource IDs + + // Load the Resource IDs for popup menu items. + iconData.push_back(IDM_FILE_NEW); + iconData.push_back(IDM_FILE_OPEN); + iconData.push_back(IDM_FILE_SAVE); + iconData.push_back(IDM_EDIT_CUT); + iconData.push_back(IDM_EDIT_COPY); + iconData.push_back(IDM_EDIT_PASTE); + iconData.push_back(IDM_FILE_PRINT); + iconData.push_back(IDM_HELP_ABOUT); + + if (GetMenuIconHeight() >= 24) + AddMenuIcons(iconData, lightgray, IDB_MENUICONS24, 0); + else + AddMenuIcons(iconData, lightgray, IDB_MENUICONS16, 0); +} + +// Set the Resource IDs for the toolbar buttons. +void CMainFrame::SetupToolBar() +{ + AddToolBarButton(IDM_BACK); + AddToolBarButton(IDM_FORWARD); + AddToolBarButton(0); // Separator + AddToolBarButton(IDM_REFRESH); + AddToolBarButton(IDM_STOP); + AddToolBarButton(0); // Separator + AddToolBarButton(IDM_HOME); + + // Set the image lists for normal, hot and disabled buttons. + SetToolBarImages(magenta, IDB_TOOLBAR32_NORM, IDB_TOOLBAR32_HOT, IDB_TOOLBAR32_DIS); + + // Add the ComboBoxEx control. + AddComboBoxBand(); +} + +// Process the frame's window messages. +LRESULT CMainFrame::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case UWM_BEFORENAVIGATE2: OnBeforeNavigate2((DISPPARAMS*)wparam); break; + case UWM_COMMANDSTATECHANGE: OnCommandStateChange((DISPPARAMS*)wparam); break; + case UWM_DOCUMENTCOMPLETE: OnDocumentComplete((DISPPARAMS*)wparam); break; + case UWM_DOWNLOADBEGIN: OnDownloadBegin((DISPPARAMS*)wparam); break; + case UWM_NAVIGATECOMPLETE2: OnNavigateComplete2((DISPPARAMS*)wparam); break; + case UWM_NEWWINDOW2: OnNewWindow2((DISPPARAMS*)wparam); break; + case UWM_PROGRESSCHANGE: OnProgressChange((DISPPARAMS*)wparam); break; + case UWM_PROPERTYCHANGE: OnPropertyChange((DISPPARAMS*)wparam); break; + case UWM_STATUSTEXTCHANGE: OnStatusTextChange((DISPPARAMS*)wparam); break; + case UWM_TITLECHANGE: OnTitleChange((DISPPARAMS*)wparam); break; + case WM_GETMINMAXINFO: return OnGetMinMaxInfo(msg, wparam, lparam); + } + + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/Mainfrm.h b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/Mainfrm.h new file mode 100644 index 00000000..c0644ccd --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/Mainfrm.h @@ -0,0 +1,80 @@ +///////////////////////////// +// Mainfrm.h +// + +#ifndef MAINFRM_H +#define MAINFRM_H + +#include "MyCombo.h" +#include "View.h" +#include "AboutDialog.h" + + +/////////////////////////////////////////////////////////// +// CMainFrame manages the application's main window. +// The main window is a frame that has a menubar, toolbar, +// statusbar and view window. +class CMainFrame : public CFrame +{ +public: + CMainFrame() = default; + virtual ~CMainFrame() override = default; + virtual HWND Create(HWND parent = nullptr) override; + + IWebBrowser2* GetBrowser() { return m_view.GetIWebBrowser2(); } + const CEdit* GetCBEdit() const { return m_combo.GetCBEdit(); } + +protected: + virtual BOOL OnCommand(WPARAM wparam, LPARAM lparam) override; + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual BOOL OnHelp() override; + virtual void OnInitialUpdate() override; + virtual LRESULT OnNotify(WPARAM wparam, LPARAM lparam) override; + virtual void SetupMenuIcons() override; + virtual void SetupToolBar() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CMainFrame(const CMainFrame&) = delete; + CMainFrame& operator=(const CMainFrame&) = delete; + + void AddComboBoxBand(); + + // Command handlers + BOOL OnBack(); + BOOL OnEditCut(); + BOOL OnEditCopy(); + BOOL OnEditPaste(); + BOOL OnEditDelete(); + BOOL OnFileExit(); + BOOL OnForward(); + BOOL OnHome(); + BOOL OnPrint(); + BOOL OnPrintPreview(); + BOOL OnRefresh(); + BOOL OnStop(); + + // Message handlers + LRESULT OnGetMinMaxInfo(UINT msg, WPARAM wparam, LPARAM lparam); + + // User defined message handlers + void OnBeforeNavigate2(DISPPARAMS* pDispParams); + void OnCommandStateChange(DISPPARAMS* pDispParams); + void OnDocumentComplete(DISPPARAMS* pDispParams); + void OnDownloadBegin(DISPPARAMS* pDispParams); + void OnDownloadComplete(DISPPARAMS* pDispParams); + void OnNavigateComplete2(DISPPARAMS* pDispParams); + void OnNewWindow2(DISPPARAMS* pDispParams); + void OnProgressChange(DISPPARAMS* pDispParams); + void OnPropertyChange(DISPPARAMS* pDispParams); + void OnStatusTextChange(DISPPARAMS* pDispParams); + void OnTitleChange(DISPPARAMS* pDispParams); + + // Member variables + CAboutDialog m_aboutDialog; + CView m_view; + CMyCombo m_combo; +}; + +#endif //MAINFRM_H + diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/MyCombo.cpp b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/MyCombo.cpp new file mode 100644 index 00000000..579eb778 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/MyCombo.cpp @@ -0,0 +1,28 @@ +///////////////////////////// +// ComboBoxEx.cpp +// + +#include "stdafx.h" +#include "MyCombo.h" +#include "resource.h" + +//////////////////////////////// +// CMyCombo function definitions +// + +// Called when the window handle (HWND) is attached to CMyCombo. +void CMyCombo::OnAttach() +{ + m_edit.Attach(GetEditCtrl()); +} + +// Sets the CREATESTRUCT parameters before the window is created. +void CMyCombo::PreCreate(CREATESTRUCT& cs) +{ + cs.style = WS_VISIBLE | WS_CHILD | CBS_DROPDOWN | WS_CLIPCHILDREN; + cs.cy = 100; // required to display list + cs.hMenu = (HMENU)IDC_COMBOBOXEX; +} + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/MyCombo.h b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/MyCombo.h new file mode 100644 index 00000000..7bd190a9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/MyCombo.h @@ -0,0 +1,31 @@ +///////////////////////////// +// MyCombo.h +// + +#ifndef MYCOMBO_H +#define MYCOMBO_H + + +//////////////////////////////////////////////////////////////////// +// CMyCombo manages the ComboBoxEx control used by the main frame to +// hold the web address. +class CMyCombo : public CComboBoxEx +{ +public: + CMyCombo() = default; + virtual ~CMyCombo() override = default; + const CEdit* GetCBEdit() const { return &m_edit; } + +protected: + virtual void OnAttach() override; + virtual void PreCreate(CREATESTRUCT& cs) override; + +private: + CMyCombo(const CMyCombo&) = delete; + CMyCombo& operator=(const CMyCombo&) = delete; + + CEdit m_edit; +}; + + +#endif diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/Resource.rc b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/Resource.rc new file mode 100644 index 00000000..fe581e70 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/Resource.rc @@ -0,0 +1,221 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "../src/res/SystemDPI.manifest" + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDW_MAIN MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "New\tCtrl+N", IDM_FILE_NEW, GRAYED + MENUITEM "&Open...\tCtrl+O", IDM_FILE_OPEN, GRAYED + MENUITEM "&Save\tCtrl+S", IDM_FILE_SAVE, GRAYED + MENUITEM "Save &As...", IDM_FILE_SAVEAS, GRAYED + MENUITEM SEPARATOR + MENUITEM "Print Preview", IDM_FILE_PREVIEW + MENUITEM "&Print...\tCtrl+P", IDM_FILE_PRINT + MENUITEM SEPARATOR + MENUITEM "E&xit\tAlt+F4", IDM_FILE_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "Undo\tCtrl+Z", IDM_EDIT_UNDO + MENUITEM "Redo\tCtrl+Y", IDM_EDIT_REDO + MENUITEM SEPARATOR + MENUITEM "Cut\tCtrl+X", IDM_EDIT_CUT + MENUITEM "Copy\tCtrl+C", IDM_EDIT_COPY + MENUITEM "Paste\tCtrl+V", IDM_EDIT_PASTE + MENUITEM "Delete\tDel", IDM_EDIT_DELETE + END + POPUP "&View" + BEGIN + MENUITEM "&Tool Bar", IDW_VIEW_TOOLBAR, CHECKED + MENUITEM "&Status Bar", IDW_VIEW_STATUSBAR, CHECKED + END + POPUP "&Help" + BEGIN + MENUITEM "&About\tF1", IDM_HELP_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDW_MAIN ICON "../src/res/Globe.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_MENUICONS16 BITMAP "../src/res/MenuIcons16.bmp" +IDB_MENUICONS24 BITMAP "../src/res/MenuIcons24.bmp" +IDB_TOOLBAR24_NORM BITMAP "../src/res/Internet24_n.bmp" +IDB_TOOLBAR24_HOT BITMAP "../src/res/Internet24_h.bmp" +IDB_TOOLBAR24_DIS BITMAP "../src/res/Internet24_d.bmp" + +// 32bit bitmaps +IDB_TOOLBAR32_NORM BITMAP "../src/res/Browser_n.bmp" +IDB_TOOLBAR32_HOT BITMAP "../src/res/Browser_h.bmp" +IDB_TOOLBAR32_DIS BITMAP "../src/res/Browser_d.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDW_ABOUT DIALOGEX 0, 0, 186, 109 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "MS Shell Dlg", 400, 0 +BEGIN + DEFPUSHBUTTON "OK",IDOK,68,60,50,14 + CTEXT "Win32++ Internet Browser",IDC_STATIC,43,22,99,8 + ICON IDW_MAIN,0,4,4,20,20 + CTEXT "",IDC_STATIC1,53,32,80,8 + CTEXT "",IDC_STATIC2,53,42,80,8 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDW_MAIN ACCELERATORS +BEGIN + "N", IDM_FILE_NEW, VIRTKEY, CONTROL, NOINVERT + "O", IDM_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT + "P", IDM_FILE_PRINT, VIRTKEY, CONTROL, NOINVERT + "S", IDM_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT + "C", IDM_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + "X", IDM_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT + "V", IDM_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT + "Z", IDM_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT + "Y", IDM_EDIT_REDO, VIRTKEY, CONTROL, NOINVERT +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDW_MAIN "Win32++ ATL Internet Browser" + IDW_VIEW_TOOLBAR "Show or hide the tool bar" + IDW_VIEW_STATUSBAR "Show or hide the status bar" + IDW_INDICATOR_CAPS "CAP" + IDW_INDICATOR_NUM "NUM" + IDW_INDICATOR_SCRL "SCRL" + IDW_READY "Ready" +END + +STRINGTABLE +BEGIN + IDM_FILE_NEW "Create a New Document" + IDM_FILE_OPEN "Open Existing Document" + IDM_FILE_SAVE "Save the Document" + IDM_FILE_SAVEAS "Save the Document with a new name" + IDM_FILE_PRINT "Print the Document" + IDM_FILE_EXIT "End the Program" + IDM_EDIT_UNDO "Undo the last action" + IDM_EDIT_REDO "Redo the previously undone action" +END + +STRINGTABLE +BEGIN + IDM_EDIT_CUT "Cut the Selected Contents to the Clipboard" + IDM_EDIT_COPY "Copy the Selected Contents to the Clipboard" + IDM_EDIT_PASTE "Paste the Clipboard Contents to the Document" + IDM_EDIT_DELETE "Erase the selected Contents" + IDM_HELP_ABOUT "Display Information about this program" +END + +STRINGTABLE +BEGIN + IDM_BACK "Go back one page" + IDM_FORWARD "Go forward one page" + IDM_REFRESH "Reload current page" + IDM_STOP "Stop loading this page" + IDM_HOME "Load home page" +END + +STRINGTABLE +BEGIN + SC_CLOSE "Close the Window" + SC_MAXIMIZE "Maximize the Window" + SC_MINIMIZE "Minimize the Window" + SC_MOVE "Move the Window" + SC_NEXTWINDOW "Select Next Window" + SC_PREVWINDOW "Select Previous Window" + SC_RESTORE "Restore the Window" + SC_SIZE "Resize the Window" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/StdAfx.cpp b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/StdAfx.cpp new file mode 100644 index 00000000..8957144d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/StdAfx.cpp @@ -0,0 +1,16 @@ +///////////////////////////// +// StdAfx.cpp +// + +// This file is used for precompiled hearders. Precompiled headers allow +// programs to be recompiled more quickly + +// To use precompiled headers, do the following: +// 1) Add the set of rarely changed headers to stdafx.h +// 2) Include stdafx.h in each cpp file. It must be included first. +// 3) Add stdafx.cpp to your project. +// 4) Turn on precompiled hearders in the project + + +#include "stdafx.h" + diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/UserMessages.h b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/UserMessages.h new file mode 100644 index 00000000..94558e34 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/UserMessages.h @@ -0,0 +1,23 @@ +///////////////////////////// +// UserMessages.h +// + +#ifndef _USER_MESSAGES_H_ +#define _USER_MESSAGES_H_ + + +// User defined messages used in this application. +#define UWM_BEFORENAVIGATE2 (WM_APP + 0x0001) +#define UWM_COMMANDSTATECHANGE (WM_APP + 0x0002) +#define UWM_DOCUMENTCOMPLETE (WM_APP + 0x0003) +#define UWM_DOWNLOADBEGIN (WM_APP + 0x0004) +#define UWM_DOWNLOADCOMPLETE (WM_APP + 0x0005) +#define UWM_NAVIGATECOMPLETE2 (WM_APP + 0x0006) +#define UWM_NEWWINDOW2 (WM_APP + 0x0007) +#define UWM_PROGRESSCHANGE (WM_APP + 0x0008) +#define UWM_PROPERTYCHANGE (WM_APP + 0x0009) +#define UWM_STATUSTEXTCHANGE (WM_APP + 0x000A) +#define UWM_TITLECHANGE (WM_APP + 0x000B) + + +#endif // _USER_MESSAGES_H_ \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/View.cpp b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/View.cpp new file mode 100644 index 00000000..1adf62c3 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/View.cpp @@ -0,0 +1,107 @@ +///////////////////////////// +// View.cpp +// + +#include "stdafx.h" +#include "resource.h" +#include "BrowserApp.h" +#include "Mainfrm.h" +#include "View.h" +#include "DispatchSink.h" + +///////////////////////////// +// CView function definitions +// + +// Constructor. +CView::CView() : m_pInetExplorer(nullptr), m_pSourceUnk(nullptr), m_pSinkUnk(nullptr), + m_adviseCookie(0) +{ + // Initialize OLE + if FAILED(OleInitialize(nullptr)) + throw CUserException(L"Failed to initial COM"); + } + +// Destructor. +CView::~CView() +{ + if (m_pSourceUnk) + m_pSourceUnk->Release(); + + if (m_pSinkUnk) + m_pSinkUnk->Release(); + + if (m_pInetExplorer) + m_pInetExplorer->Release(); + + OleUninitialize(); + +} + +// Navigate to the web page. +void CView::Navigate(LPCWSTR str) +{ + VARIANT vars[4] = {}; + CComBSTR BStrURL(str); + m_pInetExplorer->Navigate(BStrURL, vars, vars+1, vars+2, vars+3); + SysFreeString(BStrURL); +} + +// Called when the window is created. +int CView::OnCreate(CREATESTRUCT&) +{ + // Set the window's icon + SetIconSmall(IDW_MAIN); + SetIconLarge(IDW_MAIN); + + // Use ATL to create the ActiveX control, initializes it, and hosts it in the specified window. + LRESULT hr = AtlAxCreateControlEx(L"about:blank", *this, nullptr, nullptr, &m_pSourceUnk, IID_NULL); + if (SUCCEEDED(hr)) + { + // Set the IWebBrowser2 pointer. + m_pSourceUnk->QueryInterface (IID_IWebBrowser2, (LPVOID *) &m_pInetExplorer); + + // Create sink object using CDispatchSink. + CComObject *pSinkClass = nullptr; + hr = CComObject::CreateInstance (&pSinkClass); + if (SUCCEEDED(hr)) + { + hr = pSinkClass->QueryInterface(IID_IUnknown, (LPVOID*)&m_pSinkUnk); + if (SUCCEEDED(hr)) + { + // Connect the event sink to our browser. + hr = AtlAdvise(m_pSourceUnk, m_pSinkUnk, DIID_DWebBrowserEvents2, &m_adviseCookie); + } + } + } + + if (FAILED(hr)) + Trace("*** Error *** Failed to create browser and connect event sink\n\n"); + + return 0; +} + +// Called when the window is destroyed. +void CView::OnDestroy() +{ + GetIWebBrowser2()->Stop(); + AtlUnadvise(m_pSourceUnk, DIID_DWebBrowserEvents2, m_adviseCookie); +} + +// Called after the window is created. +void CView::OnInitialUpdate() +{ + // Suppress Java script errors. + GetIWebBrowser2()->put_Silent(VARIANT_TRUE); + + TRACE("CView::OnInitialUpdate\n"); +} + +// Sets the CREATESTRUCT parameters before the window is created. +void CView::PreCreate(CREATESTRUCT& cs) +{ + // Set some optional parameters for the window + cs.style = WS_HSCROLL| WS_VSCROLL | WS_VISIBLE | WS_CHILD; + cs.dwExStyle = WS_EX_CLIENTEDGE; // Extended style +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/View.h b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/View.h new file mode 100644 index 00000000..7f8dfa16 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/View.h @@ -0,0 +1,52 @@ +///////////////////////////// +// View.h + + +#ifndef VIEW_H +#define VIEW_H + +#include // ATL support +#include // ATL COM support +#include // ATL ActiveX support +#include // ATL IDispatchID helper +#include // ATL WebBrowser2 helper + + +//////////////////////////////////////////////////////////// +// CView uses ATL to create a web browser. ATL is then used +// to connect a dispatch sink to the browser. +// The dispatch sink uses IDispatch to forward browser events +// via its invoke function. +// +class CView : public CWnd +{ + // A private class that uses CAtlExeModuleT to initialize ATL. + // This implementation requires ATL version 10.0 (VS2010) or later. + // It eliminates the need for a global CComModule _Module variable. + // CAtlExeModuleT replaces CComModule which is deprecated. + class MyModule : public CAtlExeModuleT {}; + +public: + CView(); + virtual ~CView() override; + virtual IWebBrowser2* GetIWebBrowser2() {return m_pInetExplorer;} + virtual void Navigate(LPCWSTR str); + +protected: + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual void OnDestroy() override; + virtual void OnInitialUpdate() override; + virtual void PreCreate(CREATESTRUCT& cs) override; + +private: + CView(const CView&) = delete; + CView& operator=(const CView&) = delete; + + MyModule m_module; // Instanciates (initializes) ATL + IWebBrowser2* m_pInetExplorer; // pointer to IWebBrowser2 + LPUNKNOWN m_pSourceUnk; // pointer to IUnknown for the ActiveX control + LPUNKNOWN m_pSinkUnk; // pointer to IUnknown for CDispatchSink + DWORD m_adviseCookie; // The cookie returned by AtlAdvise. +}; + +#endif diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/main.cpp b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/main.cpp new file mode 100644 index 00000000..c55bbdb2 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/main.cpp @@ -0,0 +1,49 @@ +///////////////////////////// +// main.cpp +// + +#include "stdafx.h" +#include "BrowserApp.h" + +#if defined (_MSC_VER) && (_MSC_VER >= 1920) // VS2019 or higher +#pragma warning( suppress : 28251 ) // Ignore the annotation requirement for wWinMain. +#endif + +int WINAPI wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int) +{ + try + { + // Start Win32++. + CBrowserApp theApp; + + // Run the application. + return theApp.Run(); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return -1; +} + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/Browser_d.bmp b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/Browser_d.bmp new file mode 100644 index 00000000..efc8bf70 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/Browser_d.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/Browser_h.bmp b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/Browser_h.bmp new file mode 100644 index 00000000..bb343291 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/Browser_h.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/Browser_n.bmp b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/Browser_n.bmp new file mode 100644 index 00000000..f1e9cbeb Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/Browser_n.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/Globe.ico b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/Globe.ico new file mode 100644 index 00000000..3b192884 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/Globe.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/Internet24_d.bmp b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/Internet24_d.bmp new file mode 100644 index 00000000..0238a3c2 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/Internet24_d.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/Internet24_h.bmp b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/Internet24_h.bmp new file mode 100644 index 00000000..e873de8a Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/Internet24_h.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/Internet24_n.bmp b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/Internet24_n.bmp new file mode 100644 index 00000000..12c1b32e Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/Internet24_n.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/MenuIcons16.bmp b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/MenuIcons16.bmp new file mode 100644 index 00000000..cbfa5623 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/MenuIcons16.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/MenuIcons24.bmp b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/MenuIcons24.bmp new file mode 100644 index 00000000..b7012406 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/MenuIcons24.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/SystemDPI.manifest b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/SystemDPI.manifest new file mode 100644 index 00000000..d0d8ef77 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/res/SystemDPI.manifest @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/resource.h b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/resource.h new file mode 100644 index 00000000..e1a3294a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/resource.h @@ -0,0 +1,63 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Resource.rc +// + +// include the Resource IDs defined by Win32++ +#include "default_resource.h" + + +//Resource IDs for menu items and ToolBar items +#define IDM_FILE_NEW 121 +#define IDM_FILE_OPEN 122 +#define IDM_FILE_SAVE 123 +#define IDM_FILE_SAVEAS 124 +#define IDM_FILE_PREVIEW 125 +#define IDM_FILE_PRINT 126 +#define IDM_FILE_CLOSE 127 +#define IDM_FILE_EXIT 128 +#define IDM_EDIT_UNDO 130 +#define IDM_EDIT_REDO 131 +#define IDM_EDIT_CUT 132 +#define IDM_EDIT_COPY 133 +#define IDM_EDIT_PASTE 134 +#define IDM_EDIT_DELETE 135 +#define IDM_HELP_ABOUT 140 + +#define IDM_BACK 141 +#define IDM_FORWARD 142 +#define IDM_REFRESH 143 +#define IDM_STOP 144 +#define IDM_HOME 145 + +#define IDB_TOOLBAR24_NORM 150 +#define IDB_TOOLBAR24_HOT 151 +#define IDB_TOOLBAR24_DIS 152 +#define IDB_TOOLBAR32_NORM 153 +#define IDB_TOOLBAR32_HOT 154 +#define IDB_TOOLBAR32_DIS 155 +#define IDB_MENUICONS16 156 +#define IDB_MENUICONS24 157 + +#define IDC_COMBOBOXEX 160 + +#define IDC_STATIC1 180 +#define IDC_STATIC2 181 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 149 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 150 +#endif +#endif + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/stdafx.h b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/stdafx.h new file mode 100644 index 00000000..08450116 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/BrowserATL/src/stdafx.h @@ -0,0 +1,90 @@ +///////////////////////////// +// StdAfx.h +// + +// This file is used for precompiled headers. +// Rarely modified header files should be included. +// Based on code provided by Lynn Allan. + + +#ifndef STDAFX_H +#define STDAFX_H + + +// Predefinitions for windows.h go here +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +// Specify Win32xx specific predefinitions here +//#define NO_USING_NAMESPACE // Don't use Win32xx namespace + +// Rarely modified header files should be included here +#include // Add support for std::vector +#include // Add support for std::map +#include // Add support for std::string +#include // Add support for stringstream +#include // Add support for the assert macro +#include // Add support for C style printf, sprintf, etc. +#include // Add support for C style character conversions atoi etc. +#include // Add support for C style TCHARs. + +// Add the Win32++ library +#include // Add CWinApp +#include // Add CArchive +#include // Add CAnimation, CComboBox, CComboBoxEx, CDateTime, CHeader, CHotKey, CIPAddress, CProgressBar, CSpinButton, CScrollBar, CSlider, CToolTip +#include // Add CCriticalSection, CThreadLock +#include // Add CString, CStringA, CStringW +#include // Add CDataExchange +#include // Add CDialog, CResizer +#include // Add CDockFrame, CMDIDockFrame +#include // Add CDocker, CDockContainer +#include // Add CException, CFileException, CNotSupportedException, CResourceException, CUserException, CWinException +#include // Add CFile +#include // Add CFileFind +#include // Add CFolderDialog +#include // Add CFrame +#include // Add CDC, CGDIObject, CBitmap, CBrush, CFont, CPalatte, CPen, CRgn +#include // Add CHGlobal +#include // Add CImageList +#include // Add CListView +#include // Add CMDIChild, CMDIFrame, CDockMDIFrame +#include // Add CMenu +#include // Add CMenuBar +#include // Add CMetaFile, CEnhMetaFile +#include // Add CEvent, CMutex, CSemaphore +#include // Add CPropertyPage, CPropertySheet +#include // Add CRebar +#include // Add CPoint, CRect, CSize +#include // Add CRegKey +#include // Add CRichEdit +#include // Add CScrollView +#include // Adds macros, windows header files, and CObject +#include // Add CSocket +#include // Add CStatusBar +#include // Add CButton, CEdit, CListBox +#include // Add CTab, CTabbedMDI +#include // Add AtoT, AtoW, TtoA, TtoW, WtoA, WtoT etc. +#include // Add MenuTheme, ReBarTheme, StatusBarTheme, ToolBarTheme +#include // Add CWinThread +#include // Add CTime +#include // Add CToolBar +#include // Add CTreeView +#include // Add CWebBrowser, CAXHost +#include // Add CWnd + +// WIN32_LEAN_AND_MEAN can't be used with these +#ifndef WIN32_LEAN_AND_MEAN + #include // Add CCommonDialog, CColorDialog, CFileDialog, CFindReplace, CFontDialog + #include // Add CFolderDialogEx + #include // Add CPrintPreview + #include // Add CPageSetupDialog, CPrintDialog + #include // Add CPrintDialogEx + #include // Add CTaskDialog + + // Visual Studio + #if defined (_MSC_VER) + #include // Add CRibbon, CRibbonFrame + #endif + +#endif // define WIN32_LEAN_AND_MEAN + +#endif // define STDAFX_H diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs.cbp b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs.cbp new file mode 100644 index 00000000..23e94ad4 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs.cbp @@ -0,0 +1,165 @@ + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs.cbproj b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs.cbproj new file mode 100644 index 00000000..24d41cdc --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs.cbproj @@ -0,0 +1,1599 @@ + + + {39461456-1040-43CB-9B40-5962EF847BB0} + 20.1 + None + True + Release + Win64x + 1048579 + Application + CommonDialogs + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + JPHNE + .\Embarcadero\$(Platform)\$(Config) + .\Embarcadero\$(Platform)\$(Config) + false + true + true + $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + CppGuiApplication + System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + true + <_TCHARMapping>wchar_t + CommonDialogs + ..\..\..\include\;..\src\;$(IncludePath) + ..\..\..\include\;..\src\;$(ILINK_LibraryPath) + 3081 + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + $(BDSINCLUDE)\windows\sdk;$(BRCC_IncludePath) + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + ..\src\stdafx.h + none + + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + none + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + ..\src\stdafx.h + + + false + true + false + true + _DEBUG;$(Defines) + false + None + DEBUG + true + true + true + true + Full + true + true + true + true + true + $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) + $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + + + PerMonitorV2 + false + $(BDSLIB)\$(PLATFORM)$(CC_SUFFIX)\debug;$(ILINK_LibraryPath) + true + 1033 + + + PerMonitorV2 + true + 1033 + + + PerMonitorV2 + true + 1033 + + + NDEBUG;$(Defines) + None + + + PerMonitorV2 + false + true + 1033 + + + PerMonitorV2 + true + 1033 + + + PerMonitorV2 + true + 1033 + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 85 + + + 0 + + + 1 + + + 2 + + + 3 + + + 4 + + + 5 + + + 6 + + + 7 + + + 8 + + + 9 + + + 10 + + + 11 + + + 12 + + + 13 + + + 14 + + + 85 + + + 15 + + + 16 + + + 17 + + + 86 + + + 18 + + + 19 + + + 20 + + + 21 + + +
Resource.res
+ 22 +
+ + 23 + + + 24 + + + 25 + + + 26 + true + + + 27 + + + 29 + + + 30 + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + +
+ + CPlusPlusBuilder.Personality.12 + CppGuiApplication + + + + False + True + True + False + + + Embarcadero C++Builder Office 2000 Servers Package + Embarcadero C++Builder Office XP Servers Package + + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + Assets\ + Logo150x150.png + true + + + + + Assets\ + Logo150x150.png + true + + + + + Assets\ + Logo44x44.png + true + + + + + Assets\ + Logo44x44.png + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + CommonDialogs.exe + true + + + + + CommonDialogs.exe + true + + + + + CommonDialogs.exe + true + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 64 + + + classes + 64 + + + + + res\xml + 1 + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\mips + 1 + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-v21 + 1 + + + res\values-v21 + 1 + + + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + Contents + 1 + + + Contents + 1 + + + Contents + 1 + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + library\lib\armeabi-v7a + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen + 64 + + + ..\$(PROJECTNAME).launchscreen + 64 + + + + + 1 + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + + + + + + + + + + + + + True + True + True + + + 12 + + + + +
diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2015.sln b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2015.sln new file mode 100644 index 00000000..4bc5afa4 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2015.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CommonDialogs", "CommonDialogs_2015.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2015.vcxproj b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2015.vcxproj new file mode 100644 index 00000000..45660b6b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2015.vcxproj @@ -0,0 +1,269 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + CommonDialogs + CommonDialogs + + + + Application + v140_xp + Unicode + + + Application + v140_xp + Unicode + + + Application + true + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + + + + + + + + + + + + + + + + + true + false + + + true + false + + + false + false + + + false + false + + + + Use + Level4 + true + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;htmlhelp.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;htmlhelp.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;htmlhelp.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;htmlhelp.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2015.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2015.vcxproj.filters new file mode 100644 index 00000000..07b7fb25 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2015.vcxproj.filters @@ -0,0 +1,281 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + {4b33bf11-a789-44ab-84fc-25e42aeb3566} + + + {2bcb4923-70d9-45dd-9bbe-58deefa2929c} + + + {175079c0-8ffb-4c1e-9784-f7c4f6a99390} + + + {41aad11e-81bd-4a4d-9c27-54b295b6c33d} + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2019.sln b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2019.sln new file mode 100644 index 00000000..e04fd447 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2019.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CommonDialogs", "CommonDialogs_2019.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {603A56A1-37B7-415C-BA6C-18475E6CE6E0} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2019.vcxproj b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2019.vcxproj new file mode 100644 index 00000000..04e60cc2 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2019.vcxproj @@ -0,0 +1,255 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + CommonDialogs + CommonDialogs + + + + Unicode + v142 + + + Unicode + v142 + + + true + Unicode + v142 + + + true + Unicode + v142 + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + Use + Level4 + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + MultiThreadedDebug + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + C:\Tausware\win32++\include;..\..\..\include + MultiThreadedDebug + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + C:\Tausware\win32++\include;..\..\..\include + + + + + Level4 + Use + ProgramDatabase + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + MultiThreaded + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + MultiThreaded + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2019.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2019.vcxproj.filters new file mode 100644 index 00000000..cf32bb64 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2019.vcxproj.filters @@ -0,0 +1,284 @@ + + + + + {c56c8f03-cc7c-45e5-9ff7-e8a5cd7cc41f} + + + {4ca93d41-94c7-430a-a083-8b99ddf11540} + + + {c38f06b4-be01-4552-bfc8-06cb9af504cb} + + + {f97da8ed-3584-4eea-92af-140223db7727} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2022.sln b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2022.sln new file mode 100644 index 00000000..35e4a91b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2022.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CommonDialogs", "CommonDialogs_2022.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B38D5A8A-F78F-4960-90AF-BAF771D0F18E} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2022.vcxproj b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2022.vcxproj new file mode 100644 index 00000000..bc4f0722 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2022.vcxproj @@ -0,0 +1,260 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + CommonDialogs + CommonDialogs + 10.0 + + + + Unicode + v143 + + + Unicode + v143 + + + true + Unicode + v143 + + + true + Unicode + v143 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + MultiThreadedDebug + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + MultiThreadedDebug + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + C:\Tausware\win32++\include;..\..\..\include + + + + + Level4 + Use + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + MultiThreaded + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + MultiThreaded + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2022.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2022.vcxproj.filters new file mode 100644 index 00000000..cf32bb64 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2022.vcxproj.filters @@ -0,0 +1,284 @@ + + + + + {c56c8f03-cc7c-45e5-9ff7-e8a5cd7cc41f} + + + {4ca93d41-94c7-430a-a083-8b99ddf11540} + + + {c38f06b4-be01-4552-bfc8-06cb9af504cb} + + + {f97da8ed-3584-4eea-92af-140223db7727} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2026.slnx b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2026.slnx new file mode 100644 index 00000000..a7858269 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2026.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2026.vcxproj b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2026.vcxproj new file mode 100644 index 00000000..a3d30e40 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2026.vcxproj @@ -0,0 +1,260 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + CommonDialogs + CommonDialogs + 10.0 + + + + Unicode + v145 + + + Unicode + v145 + + + true + Unicode + v145 + + + true + Unicode + v145 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + MultiThreadedDebug + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + MultiThreadedDebug + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + C:\Tausware\win32++\include;..\..\..\include + + + + + Level4 + Use + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + MultiThreaded + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + MultiThreaded + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2026.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2026.vcxproj.filters new file mode 100644 index 00000000..7b4cb728 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_2026.vcxproj.filters @@ -0,0 +1,284 @@ + + + + + {c56c8f03-cc7c-45e5-9ff7-e8a5cd7cc41f} + + + {4ca93d41-94c7-430a-a083-8b99ddf11540} + + + {c38f06b4-be01-4552-bfc8-06cb9af504cb} + + + {f97da8ed-3584-4eea-92af-140223db7727} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_DEBUG.dev b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_DEBUG.dev new file mode 100644 index 00000000..14ee121a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_DEBUG.dev @@ -0,0 +1,502 @@ +[Project] +FileName=CommonDialogs_DEBUG.dev +Name=CommonDialogs +UnitCount=31 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs=..\src\help +PrivateResource=CommonDialogs_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler=_@@_ +CppCompiler=-D _DEBUG_@@_-g_@@_-O0_@@_-D _UNICODE_@@_-D UNICODE_@@__@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lUuid_@@_-lOleaut32_@@_-lWs2_32_@@_-municode_@@__@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Debug +ObjectOutput=.\Dev-C++\Debug +OverrideOutput=1 +OverrideOutputName=CommonDialogs.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile=stdafx.mak +IncludeVersionInfo=1 +SupportXPThemes=0 +CompilerSet=4 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[VersionInfo] +Major=1 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName=Tausware +FileVersion=1.1.1.1 +FileDescription=CommonDialogs Application +InternalName=CommonDialogs Project +LegalCopyright=(c) 2016 Robert C. Tausworthe +LegalTrademarks= +OriginalFilename= +ProductName=CommonDialogs +ProductVersion=1.0 +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit9] +FileName=..\src\Doc.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit24] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit28] +FileName=..\src\View.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit41] +FileName=..\src\PrintView.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit42] +FileName=..\src\PrintView.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit43] +FileName=..\src\PrintRichView.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit33] +FileName=..\src\View.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit34] +FileName=..\src\View.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit16] +FileName=..\src\MyFontDlg.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit17] +FileName=..\src\MyFontDlg.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit20] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit25] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit27] +FileName=..\src\View.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit30] +FileName=..\src\MyFindReplaceDlg.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit14] +FileName=..\src\MyFileDlg.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit40] +FileName=..\src\PrintInfo.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit38] +FileName=..\src\View.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit44] +FileName=..\src\PrintRichView.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit45] +FileName=..\src\CPrinter.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit46] +FileName=..\src\CPrinter.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit35] +FileName=..\src\View.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit37] +FileName=..\src\View.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit29] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit39] +FileName=..\src\PrintInfo.cpp +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit31] +FileName=..\src\MyPrintDialog.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit36] +FileName=..\src\View.h +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit1] +FileName=..\src\AboutBox.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\AboutBox.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\App.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\App.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\ColorChoice.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\ColorChoice.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\ColorDefs.h +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit8] +FileName=..\src\Doc.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit10] +FileName=..\src\ListBoxDlg.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit11] +FileName=..\src\ListBoxDlg.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit12] +FileName=..\src\Mainfrm.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit13] +FileName=..\src\Mainfrm.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit15] +FileName=..\src\MyFindReplaceDlg.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit18] +FileName=..\src\PrintInfo.cpp +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit19] +FileName=..\src\PrintInfo.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit21] +FileName=..\src\Resource.rc +CompileCpp=1 +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit22] +FileName=..\src\RichEditView.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit23] +FileName=..\src\RichEditView.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit26] +FileName=..\src\StdApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_RELEASE.dev b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_RELEASE.dev new file mode 100644 index 00000000..426cf5ed --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/ProjectFiles/CommonDialogs_RELEASE.dev @@ -0,0 +1,502 @@ +[Project] +FileName=CommonDialogs_RELEASE.dev +Name=CommonDialogs +UnitCount=31 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs=..\src\help +PrivateResource=CommonDialogs_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler=_@@_ +CppCompiler=-D NDEBUG_@@_-g_@@_-O0_@@_-D _UNICODE_@@_-D UNICODE_@@__@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lUuid_@@_-lOleaut32_@@_-lWs2_32_@@_-s_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Release +ObjectOutput=.\Dev-C++\Release +OverrideOutput=1 +OverrideOutputName=CommonDialogs.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile=stdafx.mak +IncludeVersionInfo=1 +SupportXPThemes=0 +CompilerSet=3 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[VersionInfo] +Major=1 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName=Tausware +FileVersion=1.1.1.1 +FileDescription=CommonDialogs Application +InternalName=CommonDialogs Project +LegalCopyright=(c) 2016 Robert C. Tausworthe +LegalTrademarks= +OriginalFilename= +ProductName=CommonDialogs +ProductVersion=1.0 +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit9] +FileName=..\src\Doc.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit24] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit28] +FileName=..\src\View.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit41] +FileName=..\src\PrintView.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit42] +FileName=..\src\PrintView.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit43] +FileName=..\src\PrintRichView.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit33] +FileName=..\src\View.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit34] +FileName=..\src\View.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit16] +FileName=..\src\MyFontDlg.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit17] +FileName=..\src\MyFontDlg.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit20] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit25] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit27] +FileName=..\src\View.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit30] +FileName=..\src\MyFindReplaceDlg.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit14] +FileName=..\src\MyFileDlg.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit40] +FileName=..\src\PrintInfo.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit38] +FileName=..\src\View.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit44] +FileName=..\src\PrintRichView.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit45] +FileName=..\src\CPrinter.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit46] +FileName=..\src\CPrinter.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit35] +FileName=..\src\View.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit37] +FileName=..\src\View.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit29] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit39] +FileName=..\src\PrintInfo.cpp +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit31] +FileName=..\src\MyPrintDialog.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit36] +FileName=..\src\View.h +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit1] +FileName=..\src\AboutBox.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\AboutBox.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\App.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\App.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\ColorChoice.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\ColorChoice.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\ColorDefs.h +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit8] +FileName=..\src\Doc.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit10] +FileName=..\src\ListBoxDlg.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit11] +FileName=..\src\ListBoxDlg.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit12] +FileName=..\src\Mainfrm.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit13] +FileName=..\src\Mainfrm.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit15] +FileName=..\src\MyFindReplaceDlg.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit18] +FileName=..\src\PrintInfo.cpp +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit19] +FileName=..\src\PrintInfo.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit21] +FileName=..\src\Resource.rc +CompileCpp=1 +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit22] +FileName=..\src\RichEditView.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit23] +FileName=..\src\RichEditView.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit26] +FileName=..\src\StdApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/Readme.txt new file mode 100644 index 00000000..4ba6017a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/Readme.txt @@ -0,0 +1,45 @@ +CommonDialogs Example +===================== + +This sample program has a frame window which includes a menu bar, tool bar, +and status bar, with a modeless dialog as the client window of the frame. + +The program demonstrates the use of the following common dialogs classes: +* CColorDialog +* CFileDialog +* CFindReplaceDialog +* CFontDialog +* CPageSetupDialog +* CPrintDialog + + +Features demonstrated in this example +===================================== +* Use of the the CFontDialog, CColorDialog, CFileDialog, CFindReplaceDialog, + CPrintDialog, and CPageSetupDialog classes. + +* Use of CFrame to provide a frame window. + +* App-Doc-Frame-View Single Document Interface (SDI) program architecture + much like MFC applications. + +* Use of a CRichEdit control that supports cut, copy, paste, undo, redo, save, + save as, drag-and-drop, and print. + +* Use of the CColorChoice and CListBoxDlg classes that implement the selection + and display of the font foreground, font background, and control colors for + the RichEdit control, the background color of the dialog. + +* Use of the MyFileDlg, MyFindReplaceDlg, MyFontDlg, MyPrintDialog, and + MyPrintSetup classes that customize the appearance of their respective common + dialog base classes and bring context help functions to these dialogs. + +* Tool tips that appear when the mouse hovers over tool bar, dialog controls, + and the dialog client area. + +* Display of the program title, executable name, program version number, + Win32++ version number, compiler name, and most recent compilation date in + the AboutBox dialog. + +* The CPrintInfo and CPrintView classes used for printing of documents. + These emulate the manner of printing found in MFC applications. \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/AboutBox.cpp b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/AboutBox.cpp new file mode 100644 index 00000000..589d312b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/AboutBox.cpp @@ -0,0 +1,23 @@ +/* (26-Mar-2025) (AboutBox.cpp) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Implementation of the AboutBox class for the + CommonDialogs sample application using the Win32++ Windows interface + classes. + +*******************************************************************************/ + +#include "stdafx.h" +#include "StdApp.h" + +// Called before the dialog is displayed to enter the AboutBox message. +BOOL AboutBox::OnInitDialog() +{ + SetDlgItemText(IDC_ABOUT_MSG, m_about); + return TRUE; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/AboutBox.h b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/AboutBox.h new file mode 100644 index 00000000..df68dc40 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/AboutBox.h @@ -0,0 +1,35 @@ +/* (26-Mar-2025) (AboutBox.h) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Declaration of the AboutBox class for the + CommonDialogs sample application using the Win32++ Windows interface + classes. + +*******************************************************************************/ + +#ifndef ABOUTBOX_H +#define ABOUTBOX_H + + +class AboutBox : public CDialog +{ +public: + AboutBox() : CDialog(IDW_ABOUT) {} + virtual ~AboutBox() override = default; + void SetStatus(const CString& about) { m_about = about; } + +protected: + virtual BOOL OnInitDialog() override; + +private: + AboutBox(const AboutBox&) = delete; + AboutBox& operator=(const AboutBox&) = delete; + + CString m_about; +}; + +#endif // ABOUTBOX_H diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/App.cpp b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/App.cpp new file mode 100644 index 00000000..4c41fb72 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/App.cpp @@ -0,0 +1,72 @@ +/* (26-Mar-2025) (App.cpp) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: This file contains the CApp Class implementation + for the CommonDialogs demonstration sample application using the Win32++ + Windows interface classes. + +*******************************************************************************/ + +#include "stdafx.h" +#include "StdApp.h" + + +// This method creates the frame, performs initialization of the app and +// returns TRUE on success. Returning FALSE terminates the program. +BOOL CApp::InitInstance() +{ + // Initialize data strings containing the AboutBox information, the + // app path, the app directory, the app name, and the archive path. + CString appName; + ::GetModuleFileName(nullptr, appName.GetBuffer(FILENAME_MAX), FILENAME_MAX); + appName.ReleaseBuffer(); + + CFile f; // No file opened here, just used for GetFileNameWOExt. + f.SetFilePath(appName); + appName = f.GetFileNameWOExt(); + m_frame.SetDocExt(LoadString(IDS_DOC_DEFAULT_EXT)); + m_frame.SetDocFilter(LoadString(IDS_FILE_FILTER)); + + // Generate the Win32++ version string + UINT ver = _WIN32XX_VER; + CString Win32xxVersion; + Win32xxVersion.Format(L"Win32++ Version %d.%d.%d", ver / 0x100, + (ver % 0x100) / 0x10, (ver % 0x10)); + + // Generate the compiler information. + CString compiler = "an unknown compiler"; + +#if defined (__clang__) + compiler.Format(L"Clang C++ %d.%d.%d", __clang_major__, __clang_minor__, + __clang_patchlevel__); +#elif defined(__GNUC__) + compiler.Format(L"Gnu C++ %d.%d.%d", __GNUC__, __GNUC_MINOR__, + __GNUC_PATCHLEVEL__); +#elif defined(_MSC_VER) + compiler.Format(L"MS C++ %d.%d", _MSC_VER / 100, _MSC_VER % 100); +#endif + + CString compileDate = __DATE__; + + // Generate the About Box text. + CString aboutBoxInfo; + aboutBoxInfo.Format(L"%s\n\n(%s.exe)\n%s\n%s\ncompiled with " + L"%s\nbuild date: %s", LoadString(IDW_MAIN).c_str(), appName.c_str(), + LoadString(IDS_APP_VERSION).c_str(), Win32xxVersion.c_str(), + compiler.c_str(), compileDate.c_str()); + m_frame.GetAboutBox().SetStatus(aboutBoxInfo); + + m_frame.Create(); // throws a CWinException on failure + return TRUE; +} + +// Update the status of controls when the message queue is empty. +BOOL CApp::OnIdle(LONG) +{ + m_frame.UpdateToolbar(); + return FALSE; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/App.h b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/App.h new file mode 100644 index 00000000..10a047c2 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/App.h @@ -0,0 +1,36 @@ +/* (26-Mar-2025) (App.h) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Declaration of the CApp class for the CommonDialogs + sample program using the Win32++ Windows interface classes. A global access + function is also defined to the CApp object. + +*******************************************************************************/ + +#ifndef SDI_APP_H +#define SDI_APP_H + + +class CApp : public CWinApp +{ +public: + CApp() = default; + virtual ~CApp() override = default; + +protected: + virtual BOOL InitInstance() override; + virtual BOOL OnIdle(LONG) override; + +private: + CApp(const CApp&) = delete; + CApp& operator=(const CApp&) = delete; + + CMainFrame m_frame; // the main frame object +}; + + +#endif // define SDI_APP_H diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/ColorChoice.cpp b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/ColorChoice.cpp new file mode 100644 index 00000000..9f9517a5 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/ColorChoice.cpp @@ -0,0 +1,183 @@ +/* (26-Mar-2025) (ColorChoice.cpp) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Implementation of the CColorChoice class for + applications using the Win32++ Windows interface classes. This class + extends the CColoDialog class to select colors for a number of items + whose usage descriptors are displayed in a ClistBoxDlg. Instructions + on the application of this class appears below. + + Usage Information: This class populates a table of usage-color pairs + that may be used by an application or a derived class. The class then + utilizes the CListBoxDlg class to display the usage name strings in + a list box and the CColorDialog class (from which this class derives) + to assign colors to a selected usages displayed in the list box. The + user populates the color by table using the ClearColorTable() to + empty any current content and then calling the AddColorChoice() method + to add usage-color structs to the color table. The usage names appear + in the list box for selection when the DoModal() member is engaged. + + The user calls upon the DoModal() method to display the color selection + ListBox and thence the color choice dialog to supply the color for that + selection. Access to a particular element in the color table is made + using its index in the GetTableColor(), GetBrush(), GetTableUsage(), + SetTableColor(), and SetTableUsage() methods. + +*******************************************************************************/ + +#include "stdafx.h" +#include "ColorChoice.h" + +// Construct a color choice object with or without initial values. +CColorChoice::CColorChoice() : m_selection(0) +{ + ClearColorTable(); + InitCustomColors(); + SetBoxTitle(L"Color"); + m_LBDlg.SetBoxTitle(L"Choose color to change."); +} + +// Add the(id, name, color) tuple to the color table, return TRUE on success, +// FALSE otherwise. +void CColorChoice::AddColorChoice(UINT id, LPCWSTR usage, COLORREF color) +{ + ctl_color triplet; + triplet.id = id; + triplet.usage = usage; + triplet.color = color; + m_colorTable.push_back(triplet); +} + +// Show the CListBoxDlg dialog box with the list of candidate control +// categories and, if a one is selected, show the CColorDialog box to select a +// color for that control category. +INT_PTR CColorChoice::DoModal(HWND owner /* = nullptr */) +{ + // Determine a common owner for the two dialog boxes. + if (owner == nullptr) + owner = GetParameters().hwndOwner; + if (owner == nullptr) + owner = GetApp()->GetMainWnd(); + + // Prepare the list box dialog. + m_LBDlg.ClearList(); + for (UINT i = 0; i < static_cast(m_colorTable.size()); i++) + { + m_LBDlg.AddListItem(m_colorTable[i].usage); + } + + m_selection = UINT(-1); + INT_PTR selection = m_LBDlg.DoModal(owner); + if (selection != INT_MAX) + { + SetColor(m_colorTable[selection].color); + if(CColorDialog::DoModal(owner) == IDOK) + { + m_colorTable[selection].color = CColorDialog::GetColor(); + m_selection = m_colorTable[selection].id; + } + } + return (m_selection == INT_MAX ? IDCANCEL : IDOK); +} + +// Return the color found in the color table having the given id identifier. +COLORREF CColorChoice::GetTableColor(UINT id) const +{ + UINT idx = GetTableIndex(id); + if (idx == UINT(-1)) + return RGB(0, 0, 0); + + return m_colorTable[idx].color; +} + +// Return a solid brush with the color found in the color table at the given id +// identifier. If the table has not yet been populated, return a black brush. +CBrush CColorChoice::GetBrush(UINT id) const +{ + UINT idx = GetTableIndex(id); + COLORREF color = (idx == UINT(-1) ? RGB(0, 0, 0) : m_colorTable[idx].color); + CBrush br; + br.CreateSolidBrush(color); + return br; +} + +// Return the color table index of the entry having the given id. +UINT CColorChoice::GetTableIndex(UINT id) const +{ + // Ignore the invocation if the table is empty. + UINT n = static_cast(m_colorTable.size()); + for (UINT idx = 0; idx < n; ++idx) + { + if (m_colorTable[idx].id == id) + return idx; + } + + return UINT(-1); // default value +} + +// Return the usage field of the ctl_color triplet corresponding having the +// given id. +CString CColorChoice::GetTableUsage(UINT id) const +{ + UINT idx = GetTableIndex(id); + CString usage = (idx == UINT(-1) ? L"" : m_colorTable[idx].usage.c_str()); + return usage; +} + +// Initialize the custom color table entries to default values.Override this +// member to provide an application - dependent array. +void CColorChoice::InitCustomColors() +{ + COLORREF* colors = GetCustomColors(); + colors[0] = COLOR_LT_GRAY; + colors[1] = COLOR_GRAY; + colors[2] = COLOR_LT_BLUE; + colors[3] = COLOR_DK_BLUE; + colors[4] = COLOR_BROWN; + colors[5] = COLOR_DK_BROWN; + colors[6] = COLOR_LT_YELLOW; + colors[7] = COLOR_YELLOW; + colors[8] = COLOR_DK_YELLOW; + colors[9] = COLOR_LT_CYAN; + colors[10] = COLOR_DK_CYAN; + colors[11] = COLOR_LT_GREEN; + colors[12] = COLOR_DK_GREEN; + colors[13] = COLOR_LT_RED; + colors[14] = COLOR_LT_MAGENTA; + colors[15] = COLOR_DK_MAGENTA; +} + +// Perform any actions required for initialization of this object when the +// color choice is being initialized. +BOOL CColorChoice::OnInitDialog() +{ + SetWindowText(m_boxTitle); + return TRUE; +} + +// Set the color entry of the color table entry with the given id to +// the specified rgb color. +void CColorChoice::SetTableColor(UINT id, COLORREF rgb) +{ + UINT idx = GetTableIndex(id); + if (idx == UINT(-1)) + return; + + m_colorTable[idx].color = rgb; +} + +// Set the usage entry of the color table entry with the given id to the +// specified string. +void CColorChoice::SetTableUsage(UINT id, LPCWSTR s) +{ + UINT idx = GetTableIndex(id); + if (idx == UINT(-1)) + return; + + m_colorTable[idx].usage = s; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/ColorChoice.h b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/ColorChoice.h new file mode 100644 index 00000000..f18ec203 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/ColorChoice.h @@ -0,0 +1,62 @@ +/* (26-Mar-2025) (ColorChoice.h) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Declaration of the CColorChoice popup dialog class + for this application using the Win32++ Windows interface classes. + Information on the use of this class appears in the CColorChoice.cpp file. + +*******************************************************************************/ + +#ifndef CCOLORCHOICE_H +#define CCOLORCHOICE_H + +#include "ColorDefs.h" +#include "ListBoxDlg.h" + +// The id-usage-color triples forming the m_colorTable array. +struct ctl_color +{ + ctl_color() : id(0), color(0) {} + UINT id; + CString usage; + COLORREF color; +}; + +class CColorChoice : public CColorDialog +{ +public: + CColorChoice(); + virtual ~CColorChoice() override = default; + + void AddColorChoice(UINT, LPCWSTR, COLORREF); + void ClearColorTable(){m_colorTable.clear();} + void InitCustomColors(); + virtual INT_PTR DoModal(HWND owner = 0) override; + CBrush GetBrush(UINT) const; + CListBoxDlg& GetListBoxDlg() {return m_LBDlg;} + UINT GetSelectedColorID() const {return m_selection;} + COLORREF GetTableColor(UINT id) const; + UINT GetTableIndex(UINT id) const; + CString GetTableUsage(UINT id) const; + void SetBoxTitle(LPCWSTR title) {m_boxTitle = title;} + void SetTableColor(UINT id, COLORREF rgb); + void SetTableUsage(UINT id, LPCWSTR s); + +protected: + virtual BOOL OnInitDialog() override; + +private: + CColorChoice(const CColorChoice&) = delete; + CColorChoice& operator=(const CColorChoice&) = delete; + + CListBoxDlg m_LBDlg; // the list box dialog + CString m_boxTitle; // the color dialog box title + UINT m_selection; // the selected color index + std::vector m_colorTable; // usage-color pairs +}; + +#endif // CCOLORCHOICE_H diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/ColorDefs.h b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/ColorDefs.h new file mode 100644 index 00000000..408af562 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/ColorDefs.h @@ -0,0 +1,49 @@ +/* (26-Mar-2025) (ColorDefs.h) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Content Description: This file provides descriptive identifiers for a + number of commonly used RGB Color Definitions. + +*******************************************************************************/ + +#ifndef COLORDEFS_IS_LOADED +#define COLORDEFS_IS_LOADED + +#define COLOR_BLACK RGB( 0, 0, 0) +#define COLOR_GRAY RGB(100, 100, 100) +#define COLOR_LT_GRAY RGB(192, 192, 192) +#define COLOR_WHITE RGB(255, 255, 255) + +#define COLOR_BLUE RGB( 0, 0, 255) +#define COLOR_LT_BLUE RGB(128, 128, 255) +#define COLOR_DK_BLUE RGB( 0, 0, 128) + +#define COLOR_BROWN RGB(255, 128, 64) +#define COLOR_DK_BROWN RGB(128, 64, 0) + +#define COLOR_YELLOW RGB(255, 255, 0) +#define COLOR_LT_YELLOW RGB(255, 255, 128) +#define COLOR_DK_YELLOW RGB(128, 128, 0) + +#define COLOR_CYAN RGB( 0, 255, 255) +#define COLOR_LT_CYAN RGB(128, 255, 255) +#define COLOR_DK_CYAN RGB( 0, 128, 128) + +#define COLOR_GREEN RGB( 0, 255, 0) +#define COLOR_LT_GREEN RGB(128, 255, 128) +#define COLOR_DK_GREEN RGB( 0, 128, 0) + +#define COLOR_MAGENTA RGB(255, 0, 255) +#define COLOR_LT_MAGENTA RGB(255, 128, 255) +#define COLOR_DK_MAGENTA RGB(128, 0, 128) + +#define COLOR_RED RGB(255, 0, 0) +#define COLOR_LT_RED RGB(255, 128, 128) +#define COLOR_DK_RED RGB(128, 0, 0) + + +#endif /* COLORDEFS_IS_LOADED */ diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/Doc.cpp b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/Doc.cpp new file mode 100644 index 00000000..f5cb8602 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/Doc.cpp @@ -0,0 +1,344 @@ +/* (26-Mar-2025) (Doc.cpp) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Implementation of the CDoc class for the + CommonDialogs sample application using the Win32++ Windows interface + classes. + + Programming notes: Documents in this sample program are assumed to derive + from simple text files of single byte characters from the Windows standard + UTF8 code page. For a complete Unicode operation, see the NotePad sample + function in this distribution. + + Internally, the document contents are managed (as well as viewed) by the + RichEditView class. + +*******************************************************************************/ + +#include "stdafx.h" +#include "StdApp.h" + + + CDoc::CDoc() : m_isOpen(FALSE), m_data(nullptr) +{ +} + +// Find the next occurrence of the string returned by the find - replace +// dialog box FR in the document starting with the given character range +// and return the found character range, or an end - of - text range otherwise. +CHARRANGE CDoc::FindNext(const MyFindReplaceDialog& FR, CHARRANGE r) +{ + // Get the find string that does not go out of scope. + m_findNext = FR.GetFindString(); + + // Set the search parameters. + BOOL match = FR.MatchCase(); + BOOL whole = FR.MatchWholeWord(); + BOOL down = FR.SearchDown(); + DWORD dwFlags = (match ? FR_MATCHCASE : 0) | + (whole ? FR_WHOLEWORD : 0) | + (down ? FR_DOWN : 0); + r.cpMin = (down ? r.cpMax : r.cpMin); + r.cpMax = (down ? -1 : 0); + + // Perform the search as per the dwFlags and the FINDTEXEX contents. + FINDTEXTEX ftx; + ftx.chrg = r; + ftx.lpstrText = const_cast(m_findNext.c_str()); + GetRichView().FindText(dwFlags, ftx); + return ftx.chrgText; +} + +// Returns the directory of the file associated with this object. +CString CDoc::GetDocDir() const +{ + CFile f; f.SetFilePath(m_docPath); + return f.GetFileDirectory(); +} + +// Return a reference to the document data repository object. +CRichEditView& CDoc::GetRichView() const +{ + return m_data->GetRichView(); +} + +// Indicate the modification state of the document text. +BOOL CDoc::IsDirty() const +{ + return GetRichView().GetModify() && IsOpen(); +} + +// Returns TRUE if text is selected. +BOOL CDoc::IsSelected() const +{ + CHARRANGE range; + GetRichView().GetSel(range); + return m_isOpen && (range.cpMin != range.cpMax); +} + +// Returns TRUE if text can be pasted. + BOOL CDoc::CanPaste() const +{ + return m_isOpen && GetRichView().CanPaste(CF_TEXT); +} + +// Open a new document with the given filename; return TRUE if able to do +// so, or FALSE otherwise. +BOOL CDoc::MakeNewDoc(LPCWSTR docPath) +{ + SetDirty(FALSE); + m_docPath.Empty(); + m_isOpen = FALSE; + try + { + CFile f(docPath, CREATE_NEW); + f.Close(); + } + + catch (...) + { + CString msg = "Could not create document file:\n"; + msg += docPath; + ::MessageBox(nullptr, msg, L"Information", MB_OK | + MB_ICONINFORMATION | MB_TASKMODAL); + return FALSE; + } + + return TRUE; +} + +// Post a message box relating that the current search did not find the +// string sought for. +void CDoc::NotFound(const MyFindReplaceDialog& FR) +{ + BOOL match = FR.MatchCase(); + BOOL whole = FR.MatchWholeWord(); + CString msg; + LPCWSTR wholeword = (whole ? L"\nas a whole word" : L""); + LPCWSTR matchcase = (match ? L"\nmatching case" : L""); + msg.Format(L"'%s'was not found%s%s.", m_findNext.c_str(), + wholeword, matchcase); + ::MessageBox(nullptr, msg, L"Information", MB_OK | + MB_ICONINFORMATION | MB_TASKMODAL); +} + +// Perform any cleanup necessary to close the document. +void CDoc::OnCloseDoc() +{ + if (!IsOpen()) + return; + + // Check for unsaved text. + CString msg; + msg.Format(L"Save changes to this document?\n %s", + m_docPath.c_str()); + if (m_isOpen && IsDirty() && (::MessageBox(nullptr, msg, + L"Question...", MB_YESNO | MB_ICONQUESTION) == IDYES)) + { + OnSaveDoc(); + return; + } + + // Mark the document is not open, with zero length. + m_isOpen = FALSE; + m_docPath.Empty(); +} + +// This method responds to the FINDMSGSTRING registered message sent by +// the find / replace dialog box. This is the callback function response +// method for all user interactions with the dialog boxes. +void CDoc::OnFindReplace(UINT, WPARAM, LPARAM lparam) +{ + MyFindReplaceDialog* fr = + (MyFindReplaceDialog*)MyFindReplaceDialog::GetNotifier(lparam); + + assert(fr != nullptr); + if (fr != nullptr) + { + if (fr->IsTerminating()) + OnFRTerminating(fr); + else if (fr->FindNext()) + OnFRFindNext(fr); + else if (fr->ReplaceCurrent()) + OnFRReplaceCurrent(fr); + else if (fr->ReplaceAll()) + OnFRReplaceAll(fr); + } +} + +// Find the next occurrence of the string returned by the find dialog box +// in the document. +void CDoc::OnFRFindNext(MyFindReplaceDialog* fr) +{ + // Get current location or selection. + CHARRANGE r; + GetRichView().GetSel(r); + + // Find the next occurrence. + r = FindNext(*fr, r); + if (r.cpMin >= 0) + { + // Select the text and set the focus to show it. + GetRichView().SetSel(r); + GetRichView().SetFocus(); + } + else + NotFound(*fr); +} + +// Replace all occurrences of the string returned by the replace dialog box +// in the document by the string returned by that box. +void CDoc::OnFRReplaceAll(MyFindReplaceDialog* fr) +{ + // Get replacement string that does not go out of scope. + m_replaceWith = fr->GetReplaceString(); + + // Search the entire range, start at character 0. + CHARRANGE r = { 0, 0 }; + CHARRANGE r0 = r; + r = FindNext(*fr, r); + if (r.cpMin < 0) + { + NotFound(*fr); + return; + } + + // Replace this occurrence, seek the next, and repeat until no more. + do + { + GetRichView().SetSel(r); + GetRichView().ReplaceSel(m_replaceWith.c_str(), TRUE); + + // Save the last replacement site and reset the search beginning point + // for the next. + r0 = r; + r.cpMin = r.cpMax; + r = FindNext(*fr, r); + } while (r.cpMin >= 0); + + // Show the last replacement. + r0.cpMax = r0.cpMin + m_replaceWith.GetLength(); + GetRichView().SetSel(r0); + GetRichView().SetFocus(); +} + +// Replace the next occurrence of the string returned by the replace dialog +// box in the document by the string returned by that box. +void CDoc::OnFRReplaceCurrent(MyFindReplaceDialog* fr) +{ + // Get replacement string that does not go out of scope. + m_replaceWith = fr->GetReplaceString(); + + // Get current location or selection. + CHARRANGE r; + GetRichView().GetSel(r); + + // Find the next occurrence. + r = FindNext(*fr, r); + if (r.cpMin >= 0) + { + // Select the text, make the replacement, and set the focus to show it. + GetRichView().SetSel(r); + GetRichView().ReplaceSel(m_replaceWith, TRUE); + r.cpMax = r.cpMin + m_replaceWith.GetLength(); + GetRichView().SetSel(r); + GetRichView().SetFocus(); + } + else + NotFound(*fr); +} + +// Perform any actions necessary to terminate the FindReplaceDialog box. +void CDoc::OnFRTerminating(MyFindReplaceDialog*) +{ +} + +// Save current values of the document back into the currently named source +// file. Return TRUE if the document was not open or not dirty, or is saved +// properly, or FALSE otherwise. +BOOL CDoc::OnSaveDoc() +{ + assert(m_docPath.IsEmpty()); + if (!IsOpen() || !IsDirty()) + return TRUE; + + try + { + CFile f(m_docPath, CREATE_ALWAYS); // Can throw. + + GetRichView().StreamOutFile(f); + f.Close(); + m_isOpen = TRUE; + } + + catch (...) + { + CString msg = "Document file did not save."; + msg += m_docPath; + ::MessageBox(nullptr, msg, L"Information", MB_OK | + MB_ICONINFORMATION | MB_TASKMODAL); + m_isOpen = FALSE; + m_docPath.Empty(); + return FALSE; + } + + // The document will not be dirty on exit, whatever its current state. + SetDirty(FALSE); + return TRUE; +} + +// Open the document from the given path. +BOOL CDoc::OpenDoc(LPCWSTR docPath) +{ + CString msg; + if (CString(docPath).CompareNoCase(m_docPath) == 0) + { + msg.Format(L"Document file\n '%s'\nis already open.", + m_docPath.c_str()); + ::MessageBox(nullptr, msg, L"Information", MB_OK | + MB_ICONINFORMATION | MB_TASKMODAL); + + return TRUE; + } + + try + { + CFile f(docPath, OPEN_EXISTING); // Can throw + GetRichView().StreamInFile(f); + m_docPath = docPath; + f.Close(); + m_isOpen = TRUE; + } + + catch (...) + { + msg.Format(L"Document file\n '%s'\ndid not open.", docPath); + ::MessageBox(nullptr, msg, L"Information", MB_OK | + MB_ICONINFORMATION | MB_TASKMODAL); + m_isOpen = FALSE; + m_docPath.Empty(); + return FALSE; + } + + // Regardless of whether it opens, it is not dirty. + SetDirty(FALSE); + return TRUE; +} + +// Register the path to the document data repository. +void CDoc::SetDataPath(CView* path) +{ + m_data = path; +} + +// Set the real edit window text modification state to b. +void CDoc::SetDirty(BOOL b) +{ + GetRichView().SetModify(b); +} + + diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/Doc.h b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/Doc.h new file mode 100644 index 00000000..5c7ecdf0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/Doc.h @@ -0,0 +1,57 @@ +/* (26-Mar-2025) (Doc.h) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Declaration of the CDoc class for the CommonDialogs + sample program using the Win32++ Windows interface classes. This class + provides the document management functions for the application. + +*******************************************************************************/ + +#ifndef SDI_DOC_H +#define SDI_DOC_H + +class CMainFrame; +class CView; + +// This application's document management class. +class CDoc : public CObject +{ +public: + CDoc(); + virtual ~CDoc() = default; + + CString GetDocDir() const; + CString GetDocPath() const { return m_docPath;} + BOOL IsDirty() const; + BOOL IsOpen() const {return m_isOpen;} + BOOL IsSelected() const; + BOOL CanPaste() const; + BOOL MakeNewDoc(LPCWSTR); + void OnCloseDoc(); + void OnFindReplace(UINT, WPARAM, LPARAM); + void OnFRFindNext(MyFindReplaceDialog*); + void OnFRReplaceAll(MyFindReplaceDialog*); + void OnFRReplaceCurrent(MyFindReplaceDialog*); + void OnFRTerminating(MyFindReplaceDialog*); + BOOL OnSaveDoc(); + BOOL OpenDoc(LPCWSTR); + void SetDirty(BOOL b); + void SetDataPath(CView*); + +private: + CHARRANGE FindNext(const MyFindReplaceDialog&, CHARRANGE); + CRichEditView& GetRichView() const; + void NotFound(const MyFindReplaceDialog&); + + BOOL m_isOpen; // the document status + CString m_findNext; // current string to find + CString m_replaceWith; // replacement string + CString m_docPath; // the path of the open document + CView* m_data; // path to the document data +}; + +#endif //SDI_DOC_H diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/ListBoxDlg.cpp b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/ListBoxDlg.cpp new file mode 100644 index 00000000..e753d496 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/ListBoxDlg.cpp @@ -0,0 +1,85 @@ +/* (26-Mar-2025) (ListBoxDlg.cpp) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Implementation of the CListBoxDlg popup + dialog class for applications using the Win32++ Windows interface + classes. + +*******************************************************************************/ + +#include "stdafx.h" +#include "ListBoxDlg.h" +#include "resource.h" + +CListBoxDlg::CListBoxDlg() : CDialog(IDD_CLISTVIEWBOX) +{ + SetBoxTitle(L"List"); + AddListItem(L"default item 0"); +} + +// The list box message loop. +INT_PTR CListBoxDlg::DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + switch (msg) + { + case WM_COMMAND: + { + switch (HIWORD(wparam)) + { + case LBN_DBLCLK: + { + // Select the current color. + OnOK(); + break; + } + } + break; + } + case WM_SYSCOMMAND: + { + switch (wparam) + { + case SC_CLOSE: + OnCancel(); + return TRUE; + } + } + } + + // Pass unhandled messages on for default processing. + return DialogProcDefault(msg, wparam, lparam); +} + +// This method executes after the box terminates when the OK button was +// activated. +void CListBoxDlg::OnOK() +{ + int choice = m_listBox.GetCurSel(); + CDialog::EndDialog(choice >= 0 ? choice : INT_MAX); +} + +// This method executes after the box terminates and either Cancel or [X] +// button on the dialog caption was activated. +void CListBoxDlg::OnCancel() +{ + CDialog::EndDialog(INT_MAX); +} + +// Set the dialog banner text and list box contents to values. +BOOL CListBoxDlg::OnInitDialog() +{ + SetWindowText(m_boxTitle); + + // Subclass the dialog controls. + m_listBox.AttachDlgItem(IDC_LIST_BOX, *this); + m_listBox.ResetContent(); + for (UINT i = 0; i < m_listContent.size(); i++) + { + m_listBox.AddString(m_listContent[i]); + } + return TRUE; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/ListBoxDlg.h b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/ListBoxDlg.h new file mode 100644 index 00000000..bfff2048 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/ListBoxDlg.h @@ -0,0 +1,43 @@ +/* (26-Mar-2025) (ListBoxDlg.h) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Declaration of the CListBoxDlg subclass of the common + dialog class for this sample program based on the Win32++ Windows interface + classes. This class is displays a popup window containing a list box whose + items may be selected. + +*******************************************************************************/ + +#ifndef CLISTVIEW_BOX_H_DEFINED +#define CLISTVIEW_BOX_H_DEFINED + +class CListBoxDlg : public CDialog +{ +public: + CListBoxDlg(); + virtual ~CListBoxDlg() override = default; + + void AddListItem(LPCWSTR s) { m_listContent.push_back(s);} + void ClearList(){ m_listContent.clear();} + void SetBoxTitle(LPCWSTR title) { m_boxTitle = title;} + +protected: + virtual INT_PTR DialogProc(UINT, WPARAM, LPARAM) override; + virtual void OnCancel() override; + virtual BOOL OnInitDialog() override; + virtual void OnOK() override; + +private: + CListBoxDlg(const CListBoxDlg&) = delete; + CListBoxDlg& operator=(const CListBoxDlg&) = delete; + + CListBox m_listBox; // the IDC_LIST_BOX control + CString m_boxTitle; // the list box title + std::vector m_listContent; // the list strings +}; + +#endif // CLISTVIEW_BOX_H_DEFINED diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/Mainfrm.cpp b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/Mainfrm.cpp new file mode 100644 index 00000000..38bf6722 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/Mainfrm.cpp @@ -0,0 +1,634 @@ +/* (26-Mar-2025) (MainFrm.cpp) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Implementation of the CMainFrame class for the + CommonDialogs demonstration sample application using the Win32++ Windows + interface classes. + +*******************************************************************************/ + +#include "stdafx.h" +#include "StdApp.h" +#include + + +// Construct and initialize the CMainFrame object from the IDD_MAIN_DIALOG +// resource defined in resource.rc. Note that the initial window location and +// size are set here. +CMainFrame::CMainFrame() : m_view(IDD_MAIN_DIALOG), m_isTextWrap(TRUE) +{ +} + +// Create the frame window. +HWND CMainFrame::Create(HWND parent) +{ + // Set m_view as the view window of the frame. + SetView(m_view); + + // Set the registry key name, and load the initial window position. + // Use a registry key name like "CompanyName\\Application". + LoadRegistrySettings(L"Win32++\\CommonDialogs Sample"); + + // Load the settings from the registry with 5 MRU entries. + LoadRegistryMRUSettings(5); + + return CFrame::Create(parent); +} + +// Open the text document dragged and dropped in the rich edit window. +BOOL CMainFrame::DropFiles(LPARAM lparam) +{ + ENDROPFILES* ENDrop = reinterpret_cast(lparam); + HDROP hDropinfo = (HDROP) ENDrop->hDrop; + wchar_t szFileName[_MAX_PATH]; + ::DragQueryFile((HDROP)hDropinfo, 0, szFileName, _MAX_PATH); + OpenDoc(szFileName); + ::DragFinish(hDropinfo); + return TRUE; +} + +// Populate the color table with the initial ctl_color triplets used in the +// list box of the CColorDialog object. These values are displayed in the +// controls on first execution of this program, and are overwritten by +// deserialization in subsequent executions. +void CMainFrame::InitCtlColors() +{ + m_colorChoice.AddColorChoice(DlgBg, L"o Dialog background", + COLOR_DK_BLUE); + m_colorChoice.AddColorChoice(REdTxFg, L"o RichEdit text foreground", + COLOR_BLACK); + m_colorChoice.AddColorChoice(REdTxBg, L"o RichEdit text background", + COLOR_WHITE); + m_colorChoice.AddColorChoice(REdBg, L"o RichEdit background", + COLOR_WHITE); +} + +void CMainFrame::OnCloseDoc() +{ + m_docDir = m_doc.GetDocDir(); + m_doc.OnCloseDoc(); + SetWindowTitle(L""); + GetRichView().Clean(); + m_view.NoDocOpen(); +} + +// Show the CListBoxDlg color dialog box to select the color of a control's +// text foreground, text background, or control background. NOTE: colors +// selected for controls in the view are painted by the OnCtlColor() +// method invoked in the WndProc() loop each time the control is redrawn. +// The status bar color has no message to redraw it, so it is set here. +void CMainFrame::OnColorChoice() +{ + if (m_colorChoice.DoModal(*this) != IDOK) + return; + + UINT selection = m_colorChoice.GetSelectedColorID(); + if (selection == DlgBg) + SetViewBgColor(); + if (selection == REdTxFg || selection == REdTxBg || selection == REdBg) + SetRichEditColor(); + + Invalidate(); + UpdateWindow(); +} + +// The framework calls this member method when the user selects an item from a +// menu, when a child control sends a notification message, or when an +// accelerator keystroke is translated. Here, we respond to menu selections, +// toolbar events, scrollbar actions, and accelerator keys. The method returns +// nonzero if it processes the message; otherwise it returns zero. +BOOL CMainFrame::OnCommand(WPARAM wparam, LPARAM) +{ + UINT id = LOWORD(wparam); + + switch(id) + { + case IDM_COLOR_CHOICE: OnColorChoice(); return TRUE; + case IDM_EDIT_COPY: GetRichView().Copy(); return TRUE; + case IDM_EDIT_CUT: GetRichView().Cut(); return TRUE; + case IDM_EDIT_DELETE: GetRichView().Clear(); return TRUE; + case IDM_EDIT_FIND: OnEditFind(); return TRUE; + case IDM_EDIT_PASTE: GetRichView().Paste(); return TRUE; + case IDM_EDIT_REPLACE: OnEditReplace(); return TRUE; + case IDM_EDIT_REDO: GetRichView().Redo(); return TRUE; + case IDM_EDIT_UNDO: GetRichView().Undo(); return TRUE; + case IDM_FILE_CLOSE: OnCloseDoc(); return TRUE; + case IDM_FILE_EXIT: OnExit(); return TRUE; + case IDM_FILE_NEW: OnNewDoc(); return TRUE; + case IDM_FILE_OPEN: OnOpenDoc(); return TRUE; + case IDM_FILE_PAGESETUP: m_view.OnPageSetup(); return TRUE; + case IDM_FILE_PRINT: OnPrint(); return TRUE; + case IDM_FILE_SAVE: OnSave(); return TRUE; + case IDM_FILE_SAVEAS: OnSaveAs(); return TRUE; + case IDM_FONT_CHOICE: OnFontChoice(); return TRUE; + case IDM_RICHEDWRAP: OnWrapText(); return TRUE; + case IDW_ABOUT: OnHelp(); return TRUE; + case IDW_VIEW_STATUSBAR: OnViewStatusBar(); return TRUE; + case IDW_VIEW_TOOLBAR: OnViewToolBar(); return TRUE; + + case IDW_FILE_MRU_FILE1: + case IDW_FILE_MRU_FILE2: + case IDW_FILE_MRU_FILE3: + case IDW_FILE_MRU_FILE4: + case IDW_FILE_MRU_FILE5: return OnFileMRU(wparam); + } + return FALSE; +} + +// This member controls the way the frame is created. +int CMainFrame::OnCreate(CREATESTRUCT& rcs) +{ + // OnCreate controls the way the frame is created. + // Overriding CFrame::OnCreate is optional. + + // A menu is added if the IDW_MAIN menu resource is defined. + // Frames have all options enabled by default. + // Use the following functions to disable options. + + // UseIndicatorStatus(FALSE); // Don't show keyboard indicators in the StatusBar. + // UseMenuStatus(FALSE); // Don't show menu descriptions in the StatusBar. + // UseOwnerDrawnMenu(FALSE); // Don't use owner draw for popup menu items. + // UseReBar(FALSE); // Don't use a ReBar. + // UseStatusBar(FALSE); // Don't use a StatusBar. + // UseThemes(FALSE); // Don't use themes. + // UseToolBar(FALSE); // Don't use a ToolBar. + + + int rtn = CFrame::OnCreate(rcs); + m_doc.SetDataPath(&m_view); + + // Set the color choice parameters. + InitCtlColors(); + CHOOSECOLOR cc = m_colorChoice.GetParameters(); + cc.Flags = CC_FULLOPEN; + cc.Flags |= CC_ANYCOLOR | CC_RGBINIT | CC_ENABLEHOOK; + m_colorChoice.SetParameters(cc); + + // Set the initial flags to use the font style, + CHOOSEFONT cf = m_fontChoice.GetParameters(); + cf.Flags |= CF_USESTYLE; + cf.lpszStyle = const_cast(L"Regular"); // initial font + m_fontChoice.SetParameters(cf); + + // Set the default font + CFont f; + f.CreatePointFont(100, L"Courier New"); + m_fontChoice.SetChoiceFont(f); + m_fontChoice.SetColor(m_colorChoice.GetTableColor(REdTxFg)); + m_view.SetEditFont(f); + + SetViewBgColor(); + SetRichEditColor(); + return rtn; +} + +// Initiate the find non-modal dialog box. +void CMainFrame::OnEditFind() +{ + m_findReplaceDlg.SetBoxTitle(L"Find a string..."); + m_findReplaceDlg.Create(TRUE, L"Initial Text", L"", FR_DOWN | + FR_ENABLEHOOK, *this); +} + +// Invoke the find-replace dialog. +void CMainFrame::OnEditReplace() +{ + m_findReplaceDlg.SetBoxTitle(L"Find, then Replace"); + m_findReplaceDlg.Create(FALSE, L"Initial Text", L"Replace Text", + FR_DOWN | FR_ENABLEHOOK, *this); +} + +// Close the application. +void CMainFrame::OnExit() +{ + m_docDir = m_doc.GetDocDir(); // save for next file open/save + m_doc.OnCloseDoc(); + SetWindowTitle(L""); + GetRichView().Clean(); + m_view.NoDocOpen(); + Close(); +} + +// Open a file from the Most Recently Used (MRU) list. +BOOL CMainFrame::OnFileMRU(WPARAM wparam) +{ + UINT mruIndex = static_cast(LOWORD(wparam)) - IDW_FILE_MRU_FILE1; + CString mruText = GetMRUEntry(mruIndex); + + if (!OpenDoc(mruText)) + RemoveMRUEntry(mruText); + + return TRUE; +} + +// Select the view font typeface, characteristics, and color. +void CMainFrame::OnFontChoice() +{ + HWND hOwnerWnd = GetApp()->GetMainWnd(); + m_fontChoice.SetBoxTitle(L"Select font for rich edit box"); + LOGFONT lf; + m_fontChoice.GetChoiceFont().GetObject(sizeof(LOGFONT), &lf); + CHOOSEFONT cf = m_fontChoice.GetParameters(); + cf.Flags |= CF_SCREENFONTS | CF_EFFECTS | CF_INITTOLOGFONTSTRUCT; + cf.lpLogFont = &lf; + cf.rgbColors = m_colorChoice.GetTableColor(REdTxFg); + m_fontChoice.SetParameters(cf); + + // Open the dialog. + if(m_fontChoice.DoModal(hOwnerWnd)) + { + m_view.SetEditFont(m_fontChoice.GetChoiceFont()); + m_colorChoice.SetTableColor(REdTxFg, m_fontChoice.GetColor()); + SetRichEditColor(); + } + + Invalidate(); + UpdateWindow(); +} + +// Overrides CFrame OnHelp() to display a dialog bearing the program's +// application information. +BOOL CMainFrame::OnHelp() +{ + // Ensure only one dialog displays even for multiple activation commands. + if (!m_aboutBox.IsWindow()) + m_aboutBox.DoModal(*this); + + return TRUE; +} + +// The frame has now been created. Provide any desired main frame formatting. +void CMainFrame::OnInitialUpdate() +{ + // Unselect the text. + GetRichView().SetSel(0, 0); + GetRichView().SetFocus(); + + TRACE("Frame created\n"); +} + +// Update the enable and check status of menu items. +void CMainFrame::OnMenuUpdate(UINT id) +{ + UINT enabled; + UINT checked; + + switch (id) + { + case IDM_FILE_SAVE: + enabled = m_doc.IsDirty() ? MF_ENABLED : MF_GRAYED; + GetFrameMenu().EnableMenuItem(id, enabled); + break; + case IDM_FILE_SAVEAS: + enabled = m_doc.IsOpen() ? MF_ENABLED : MF_GRAYED; + GetFrameMenu().EnableMenuItem(id, enabled); + break; + case IDM_RICHEDWRAP: + checked = m_isTextWrap ? MF_CHECKED : MF_UNCHECKED; + GetFrameMenu().CheckMenuItem(id, checked); + break; + } + + return CFrame::OnMenuUpdate(id); +} + +// Prompt the user for a new document file name and, if valid, open a new +// document.The open status and path name are available from the document +// object. +void CMainFrame::OnNewDoc() +{ + MyFileDialog fd + ( TRUE, + m_docExt, + m_docDir, // a previous directory + OFN_HIDEREADONLY | + OFN_EXPLORER | + OFN_NONETWORKBUTTON | + OFN_ENABLESIZING, + m_docFilter + ); + + fd.SetBoxTitle(L"New document file..."); + fd.SetDefExt(m_docFilter); + CString msg; + while (fd.DoModal(GetApp()->GetMainWnd()) == IDOK) + { + CString selected = fd.GetPathName(); + if (::_taccess(selected, 0x04) != 0) + { + if (m_doc.MakeNewDoc(selected)) + OpenDoc(selected); + return; + } + + // Prompt the user to try again. + msg.Format(L"That document file\n '%s'\n" + L"already exists.", selected.c_str()); + ::MessageBox(nullptr, msg, L"Error", MB_OK | MB_ICONERROR | + MB_TASKMODAL); + } + msg = L"No name was entered, no action was taken."; + ::MessageBox(nullptr, msg, L"Information", MB_OK | MB_ICONINFORMATION | + MB_TASKMODAL); + return; +} + +// Process messages that controls send to the parent. +LRESULT CMainFrame::OnNotify(WPARAM wparam, LPARAM lparam) +{ + NMHDR* pNMH = reinterpret_cast(lparam); + switch (pNMH->code) + { + case EN_DROPFILES: + DropFiles(lparam); + return TRUE; + } + return CFrame::OnNotify(wparam, lparam); +} + +// Display the open file dialog to obtain the path of an existing document +// file.If one is selected, open it.The open status and path name are +// available from the document object. +void CMainFrame::OnOpenDoc() +{ + MyFileDialog fd + ( TRUE, // open file dialog + m_docExt, // extension defined by app + m_docDir, // a previous directory + OFN_HIDEREADONLY | // flags + OFN_EXPLORER | + OFN_NONETWORKBUTTON | + OFN_FILEMUSTEXIST | // only existing files allowed + OFN_PATHMUSTEXIST | + OFN_ENABLEHOOK | + OFN_ENABLESIZING, + m_docFilter + ); + fd.SetBoxTitle(L"Open document file..."); + fd.SetDefExt(m_docExt); + + CString msg; + if (fd.DoModal(GetApp()->GetMainWnd()) == IDOK) + { + CString selected = fd.GetPathName(); + if (OpenDoc(selected)) + return; + } + + msg = "No valid name was entered, no action was taken."; + ::MessageBox(nullptr, msg, L"Information", MB_OK | MB_ICONINFORMATION | + MB_TASKMODAL); + return; +} + +// Set the rich edit control colors to those found in the color table. +BOOL CMainFrame::SetRichEditColor() +{ + COLORREF txfg = m_colorChoice.GetTableColor(REdTxFg); + COLORREF txbg = m_colorChoice.GetTableColor(REdTxBg); + COLORREF bg = m_colorChoice.GetTableColor(REdBg); + m_view.SetRichEditColors(txfg, txbg, bg); + return TRUE; +} + +// Invoke a MyPrintDialog dialog to get printing parameters and then print the +// contents of the rich view control. +void CMainFrame::OnPrint() +{ + m_view.OnPrintDocument(m_doc.GetDocPath()); +} + +// Save the current document. +void CMainFrame::OnSave() +{ + m_doc.OnSaveDoc(); +} + +// Save the current document into a file named in a file dialog and make that +// file the current document. +void CMainFrame::OnSaveAs() +{ + if (!m_doc.IsOpen()) + return; + + // Declare the file dialog box. + MyFileDialog fd + ( FALSE, + m_docExt, // extension defined by app + m_docDir, // current directory + OFN_HIDEREADONLY | + OFN_OVERWRITEPROMPT | + OFN_EXPLORER | + OFN_ENABLEHOOK | + OFN_NONETWORKBUTTON, + m_docFilter // filter defined by app + ); + + fd.SetBoxTitle(L"Save document file as"); + CString msg; + if (fd.DoModal(GetApp()->GetMainWnd()) == IDOK) + { + CString selected = fd.GetPathName(); + if (selected.CompareNoCase(m_doc.GetDocPath()) == 0) + { + msg.Format(L"Document file\n '%s'\n is already " + L"open. No action taken", m_doc.GetDocPath().c_str()); + ::MessageBox(nullptr, msg, L"Information", + MB_OK | MB_ICONINFORMATION | MB_TASKMODAL); + return; + } + + CString current_doc = m_doc.GetDocPath(); + OnCloseDoc(); + CopyFile(current_doc, selected, FALSE); + if (!OpenDoc(selected)) + { + msg.Format(L"Saved document file\n '%s'" + L" could not be reopened.", selected.c_str()); + ::MessageBox(nullptr, msg, L"Information", + MB_OK | MB_ICONINFORMATION | MB_TASKMODAL); + OpenDoc(current_doc); + return; + } + } + msg = "No name was entered, no action was taken."; + ::MessageBox(nullptr, msg, L"Information", + MB_OK | MB_ICONINFORMATION | MB_TASKMODAL); +} + +// Toggle the word wrapping mode in the rich edit control. +void CMainFrame::OnWrapText() +{ + m_isTextWrap = !m_isTextWrap; + GetRichView().SetWrapping(m_isTextWrap); +} + +// Open the document from the given path.Return TRUE if successful, FALSE +// otherwise. +BOOL CMainFrame::OpenDoc(LPCWSTR docPath) +{ + if (CString(docPath).CompareNoCase(m_doc.GetDocPath()) == 0) + { + CString msg; + msg.Format(L"Document file\n '%s'\nis already open.", docPath); + ::MessageBox(nullptr, msg, L"Information", MB_OK | + MB_ICONINFORMATION | MB_TASKMODAL); + return TRUE; + } + + if (m_doc.IsOpen()) + OnCloseDoc(); + + if (m_doc.OpenDoc(docPath)) + { + m_docDir = m_doc.GetDocPath(); + SetWindowTitle(docPath); + AddMRUEntry(docPath); + return TRUE; + } + return FALSE; +} + +// Set the colors to be used in the rebar theme. +void CMainFrame::SetReBarColors(COLORREF clrBkGnd1, COLORREF clrBkGnd2, + COLORREF clrBand1, COLORREF clrBand2) +{ + ReBarTheme rt{}; + rt.UseThemes = TRUE; + rt.clrBkgnd1 = clrBkGnd1; + rt.clrBkgnd2 = clrBkGnd2; + rt.clrBand1 = clrBand1; + rt.clrBand2 = clrBand2; + rt.FlatStyle = FALSE; + rt.BandsLeft = TRUE; + rt.LockMenuBand = TRUE; + rt.RoundBorders = TRUE; + rt.ShortBands = TRUE; + rt.UseLines = TRUE; + + SetReBarTheme(rt); +} + +// Assign icons to the dropdown menu items.In particular, add the AboutBox +// identifier to the menu icon list. +void CMainFrame::SetupMenuIcons() +{ + std::vector data = GetToolBarData(); + + // Specify the bitmap and mask for the menu icons. + if (GetMenuIconHeight() >= 24) + SetMenuIcons(data, RGB(255, 0, 255), IDW_MAIN); + else + SetMenuIcons(data, RGB(192, 192, 192), IDB_MENUICONS); +} + +// Called from the CFrame::CreateToolBar() method to load the toolbar bitmaps, +// to connect the tool bar buttons to resource IDs of the toolbar buttons, and +// to define the order of appearance of the buttons on the toolbar at runtime. +void CMainFrame::SetupToolBar() +{ + // Connect button IDs to button icons, show enabled status, and + // give the explicit image index iImage of each button in the bitmap. + // Add the toolbar buttons in the order they are to appear at runtime. + AddToolBarButton(IDM_FILE_NEW, TRUE, 0, 0); + AddToolBarButton(IDM_FILE_OPEN, TRUE, 0, 1); + AddToolBarButton(IDM_FILE_SAVE, TRUE, 0, 2); + AddToolBarButton(0); // Separator + AddToolBarButton(IDM_EDIT_CUT, TRUE, 0, 3); + AddToolBarButton(IDM_EDIT_COPY, TRUE, 0, 4); + AddToolBarButton(IDM_EDIT_PASTE, TRUE, 0, 5); + AddToolBarButton(0); // Separator + AddToolBarButton( IDM_EDIT_FIND, TRUE, 0, 6); + AddToolBarButton( IDM_EDIT_REPLACE, TRUE, 0, 7); + AddToolBarButton(0); // Separator + AddToolBarButton(IDM_FILE_PRINT, TRUE, 0, 8); + AddToolBarButton(0); // Separator + AddToolBarButton(IDM_COLOR_CHOICE, TRUE, 0, 9); + AddToolBarButton(IDM_FONT_CHOICE, TRUE, 0, 10); + AddToolBarButton(0); // Separator + AddToolBarButton(IDW_ABOUT, TRUE, 0, 11); + + // Set the toolbar image list: use defaults for hot and disabled + SetToolBarImages(RGB(255, 0, 255), IDW_MAIN, 0, 0); +} + +// Sets the background color of the dialog used as the view window. +void CMainFrame:: SetViewBgColor() +{ + m_view.SetBgColor(m_colorChoice.GetBrush(DlgBg)); +} + +// Put the app title and docPath name in the main window text. Limit the +// displayed text length to that of the frame. +void CMainFrame::SetWindowTitle(LPCWSTR path) +{ + CString pathname = path; + CString title = LoadString(IDW_MAIN); + + if (!pathname.IsEmpty()) + title += " - " + pathname; + + SetWindowText(title); +} + +// Called by CApp::OnIdle to update toolbar buttons. +void CMainFrame::UpdateToolbar() +{ + BOOL isSelected = m_doc.IsSelected(); + BOOL canPaste = m_doc.CanPaste(); + BOOL isDirty = m_doc.IsDirty(); + + GetToolBar().EnableButton(IDM_FILE_SAVE, isDirty); + GetToolBar().EnableButton(IDM_EDIT_COPY, isSelected); + GetToolBar().EnableButton(IDM_EDIT_CUT, isSelected); + GetToolBar().EnableButton(IDM_EDIT_PASTE, canPaste); +} + +// This is the main frame message loop. It handles the frame's window messages. +LRESULT CMainFrame::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Can't use a case statement on this ::RegisterWindowMessage() value + if (msg == UWM_FINDMSGSTRING) + { + m_doc.OnFindReplace(msg, wparam, lparam); + return TRUE; + } + + // switch (msg) + // { + // TODO: add message handlers here + // } + + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/Mainfrm.h b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/Mainfrm.h new file mode 100644 index 00000000..69c3e719 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/Mainfrm.h @@ -0,0 +1,80 @@ +/* (26-Mar-2025) (MainFrm.h) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Declaration of the CMainFrame class for the + CommonDialogs sample application using the Win32++ Windows interface + classes. + +*******************************************************************************/ + +#ifndef SDI_MAINFRM_H +#define SDI_MAINFRM_H + + +class CMainFrame : public CFrame +{ +public: + CMainFrame(); + virtual ~CMainFrame() override = default; + virtual HWND Create(HWND parent = nullptr) override; + + AboutBox& GetAboutBox() { return m_aboutBox; } + void SetDocExt(LPCWSTR ext) { m_docExt = ext; } + void SetDocFilter(LPCWSTR filter) { m_docFilter = filter; } + void SetWindowTitle(LPCWSTR); + void UpdateToolbar(); + +protected: + virtual void OnMenuUpdate(UINT id) override; + virtual BOOL OnCommand(WPARAM wparam, LPARAM lparam) override; + virtual int OnCreate(CREATESTRUCT& rcs) override; + virtual BOOL OnHelp() override; + virtual void OnInitialUpdate() override; + virtual LRESULT OnNotify(WPARAM wparam, LPARAM lparam) override; + virtual void SetupMenuIcons() override; + virtual void SetupToolBar() override; + virtual LRESULT WndProc(UINT msg, WPARAM, LPARAM) override; + +private: + CMainFrame(const CMainFrame&) = delete; + CMainFrame& operator=(const CMainFrame&) = delete; + + BOOL DropFiles(LPARAM lparam); + CRichEditView& GetRichView() { return m_view.GetRichView();} + void InitCtlColors(); + void OnCloseDoc(); + void OnColorChoice(); + void OnEditFind(); + void OnEditReplace(); + void OnExit(); + BOOL OnFileMRU(WPARAM wparam); + void OnFontChoice(); + void OnNewDoc(); + void OnOpenDoc(); + void OnPrint(); + void OnSave(); + void OnSaveAs(); + void OnWrapText(); + BOOL OpenDoc(LPCWSTR); + void SetReBarColors(COLORREF, COLORREF, COLORREF, COLORREF); + BOOL SetRichEditColor(); + void SetViewBgColor(); + + CDoc m_doc; // the document + CView m_view; // the view + AboutBox m_aboutBox; // the AboutBox dialog + CString m_docDir; // for the file open/save dialogs + CString m_docExt; // document file extension + CString m_docFilter; // document file open/save filter + CBitmap m_colorbmp; // for the color choice menu item + BOOL m_isTextWrap; // wrap text in rich edit if true + CColorChoice m_colorChoice; // the control color choice + MyFontDialog m_fontChoice; // edit control font + MyFindReplaceDialog m_findReplaceDlg; // find-replace dialog +}; + +#endif // SDI_MAINFRM_H diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/MyFileDlg.h b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/MyFileDlg.h new file mode 100644 index 00000000..0bf809b6 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/MyFileDlg.h @@ -0,0 +1,38 @@ +/* (26-Mar-2025) (MyFileDlg.h) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Declaration and implementation of the MyFileDlg class, + which is derived from the CFileDialog class found in the Win32++ Windows + interface framework in order to add a title to the dialog. + +*******************************************************************************/ + +#ifndef MY_FILE_DLG_H +#define MY_FILE_DLG_H + +class MyFileDialog : public CFileDialog +{ +public: + MyFileDialog ( + BOOL bOpenFileDialog = TRUE, + LPCWSTR sDefExt = nullptr, + LPCWSTR sFileName = nullptr, + DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + LPCWSTR sFilter = nullptr + ) : CFileDialog(bOpenFileDialog, sDefExt, sFileName, dwFlags, sFilter) {} + + virtual ~MyFileDialog() override = default; + void SetBoxTitle(LPCWSTR title) { m_title = title; SetTitle(title);} + +private: + MyFileDialog(const MyFileDialog&) = delete; + MyFileDialog& operator=(const MyFileDialog&) = delete; + + CString m_title; // persistent over object span +}; + +#endif // MY_FILE_DLG_H diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/MyFindReplaceDlg.cpp b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/MyFindReplaceDlg.cpp new file mode 100644 index 00000000..ddf4ea0e --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/MyFindReplaceDlg.cpp @@ -0,0 +1,28 @@ +/* (26-Mar-2025) (MyFindReplaceDlg.cpp) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Implementation of the MyFindReplaceDialog class + for applications using the Win32++ Windows interface classes. This + class derives from the CFindReplaceDialog class found in the framework. + +*******************************************************************************/ + +#include "stdafx.h" +#include "MyFindReplaceDlg.h" + +// This function is called before the dialog is displayed. +BOOL MyFindReplaceDialog::OnInitDialog() +{ + SetWindowText(m_boxTitle); return TRUE; +} + +// Record the title of the find/replace dialog box after an object +// of this class is constructed, but before DoModal() is invoked. +void MyFindReplaceDialog::SetBoxTitle(LPCWSTR title) +{ + m_boxTitle = title; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/MyFindReplaceDlg.h b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/MyFindReplaceDlg.h new file mode 100644 index 00000000..bb5737a2 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/MyFindReplaceDlg.h @@ -0,0 +1,35 @@ +/* (26-Mar-2025) (MyFindReplaceDlg.h) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Declaration and implementation of the MyFindReplaceDlg + class. This class is derived from the CFindREplaceDalog class found in the + Win32++ Windows interface framework in order to add a title to the dialog. + +*******************************************************************************/ + +#ifndef MY_FIND_REPLACE_DLG_H +#define MY_FIND_REPLACE_DLG_H + +class MyFindReplaceDialog : public CFindReplaceDialog +{ + public: + MyFindReplaceDialog() = default; + virtual ~MyFindReplaceDialog() override = default; + + void SetBoxTitle(LPCWSTR title); + + protected: + virtual BOOL OnInitDialog() override; + + private: + MyFindReplaceDialog(const MyFindReplaceDialog&) = delete; + MyFindReplaceDialog& operator=(const MyFindReplaceDialog&) = delete; + + CString m_boxTitle; +}; + +#endif // MY_FIND_REPLACE_DLG_H diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/MyFontDlg.cpp b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/MyFontDlg.cpp new file mode 100644 index 00000000..d195b9a6 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/MyFontDlg.cpp @@ -0,0 +1,94 @@ +/* (26-Mar-2025) (MyFontDialog.cpp) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Implementation of the MyFontDialog class for + applications using the Win32++ Windows interface classes. This class + derives from the CFontDalog class found in the framework. + +*******************************************************************************/ + +#include "stdafx.h" +#include "MyFontDlg.h" + + +// Create a simple default font dialog object. The hdcPrinter parameter is a +// handle to a printer device context for the printer on which the fonts are to +// be selected. +MyFontDialog:: MyFontDialog(DWORD dwFlags, HDC hdcPrinter /* = nullptr */) + : CFontDialog(dwFlags | CF_INITTOLOGFONTSTRUCT | CF_EFFECTS | + CF_ENABLEHOOK, hdcPrinter) +{ + m_tm = {}; + SetBoxTitle(L"Font"); + + // Set the default font. + m_font.CreatePointFont(10, L"Courier New"); + SetChoiceFont(m_font); +} + +// Perform any actions required for initialization of this object when the font +// choice is being initialized. +BOOL MyFontDialog::OnInitDialog() +{ + SetWindowText(m_boxTitle); + return TRUE; +} + +// This member is called when the OK button is pressed. +void MyFontDialog::OnOK() +{ + LOGFONT lf = GetLogFont(); + SetChoiceLogFont(lf); +} + +// Record the current font TEXTMETRIC values and the average character width +// and height for the dialog's owner window, or the desktop if hwndOwner is 0. +void MyFontDialog::RecordFontMetrics() +{ + CWindowDC dc(GetParameters().hwndOwner); + dc.SelectObject(m_font); + + // Measure the font width and height. + dc.GetTextMetrics(m_tm); + m_fontSize.cx = m_tm.tmAveCharWidth; + m_fontSize.cy = m_tm.tmHeight + m_tm.tmExternalLeading; +} + +// Sets the font choice from the specified font. +void MyFontDialog::SetChoiceFont(const CFont& f) +{ + LOGFONT lf = f.GetLogFont(); + SetChoiceLogFont(lf); +} + +// Sets the font choice from the specified logfont. +void MyFontDialog::SetChoiceLogFont(LOGFONT& lf) +{ + SetFontIndirect(lf); + RecordFontMetrics(); +} + +// Set the current font to have the characteristics contained in the supplied +// LOGFONT structure. +void MyFontDialog::SetFontIndirect(const LOGFONT& lf) +{ + try + { + m_font.CreateFontIndirect(lf); + m_logFont = lf; + CHOOSEFONT cf = GetParameters(); + cf.lpLogFont = &m_logFont; + SetParameters(cf); + } + + catch (const CResourceException&) + { + ::MessageBox(nullptr, L"Font creation error.", + L"Error", MB_OK | MB_ICONEXCLAMATION | MB_TASKMODAL); + } +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/MyFontDlg.h b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/MyFontDlg.h new file mode 100644 index 00000000..587e46c1 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/MyFontDlg.h @@ -0,0 +1,50 @@ +/* (26-Mar-2025) (MyFontDlg.h) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Declaration of the MyFontDialog class for this + sample program using the Win32++ Windows interface classes. This class + derives from the CFontDalog class found in the framework to add needed + functionality in displaying the view. + +*******************************************************************************/ + +#ifndef MYFONTDIALOG_H +#define MYFONTDIALOG_H + +class MyFontDialog : public CFontDialog +{ +public: + MyFontDialog(DWORD dwFlags = 0, HDC hdcPrinter = nullptr); + virtual ~MyFontDialog() override = default; + + SIZE GetAvgSize() const { return m_fontSize; } + CFont GetChoiceFont() const { return m_font; } + LOGFONT GetCurrentLogFont() const { return m_logFont; } + TEXTMETRIC* GetTextMetric() { return &m_tm; } + void OnOK() override; + void SetBoxTitle(const CString& title) { m_boxTitle = title; } + void SetChoiceFont(const CFont& f); + void RecordFontMetrics(); + void SetChoiceLogFont(LOGFONT& lf); + void SetFontIndirect(const LOGFONT& lf); + void SetTextMetric(const TEXTMETRIC& tm) {m_tm = tm;} + +protected: + virtual BOOL OnInitDialog() override; + +private: + MyFontDialog(const MyFontDialog&) = delete; + MyFontDialog& operator=(const MyFontDialog&) = delete; + + CString m_boxTitle; + TEXTMETRIC m_tm; // font text metrics + CSize m_fontSize; // font average width & height + CFont m_font; // the current font + LOGFONT m_logFont; // the current logfont +}; + +#endif diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/MyPrintDialog.cpp b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/MyPrintDialog.cpp new file mode 100644 index 00000000..185866d2 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/MyPrintDialog.cpp @@ -0,0 +1,54 @@ +/* (26-Mar-2025) (MyPrintDialog.cpp) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Implementation of the MyPrintDialog and MyPageSetup + classes for applications using the Win32++ Windows interface classes. The + MyPrintDialog class derives from the CPrintDialog and the MyPageSetup + class derives from CPageSetupDialog. + +*******************************************************************************/ + +#include "stdafx.h" +#include "MyPrintDialog.h" + +BOOL MyPrintDialog::OnInitDialog() +{ + SetWindowText(m_sPDTitle); + HWND hbtn = FindWindowEx(*this, nullptr, L"Button", L"OK"); + if (hbtn != nullptr) + ::SetWindowText(hbtn, L"&Print"); + return TRUE; +} + +void MyPrintDialog::OnCancel() +{ + ::MessageBox(nullptr, L"Print job cancelled.", L"Information", + MB_OK | MB_TASKMODAL | MB_ICONINFORMATION); +} + +// Override this member method to perform special processing when the printer +// box is initialized. Return TRUE. +BOOL MyPageSetup::OnInitDialog() +{ + SetWindowText(m_PSDTitle); + return TRUE; +} + +// Override this member to perform any special processing to reset the printer +// to its incoming state. For now just announce that the dialog was cancelled. +void MyPageSetup::OnCancel() +{ + ::MessageBox(nullptr, L"Page setup cancelled. ", + L"Information", MB_OK | MB_ICONINFORMATION | MB_TASKMODAL); +} + +// Record the title of the page setup dialog box after an object of this class +// is constructed, but before DoModal() is invoked. +void MyPageSetup::SetBoxTitle(LPCWSTR title) +{ + m_PSDTitle = title; +} \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/MyPrintDialog.h b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/MyPrintDialog.h new file mode 100644 index 00000000..18c3c67f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/MyPrintDialog.h @@ -0,0 +1,63 @@ +/* (26-Mar-2025) (MyPrintDialog.h) * +******************************************************************************** +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: The declaration and implementation of the + MyPrintDialog and MyPageSetup classes, which are derived from the + CPrintDialog and CPageSetupDialog class. + +*******************************************************************************/ + +#ifndef MYPRINTER_H +#define MYPRINTER_H + +class MyPrintDialog : public CPrintDialog +{ +public: + MyPrintDialog( + DWORD dwFlags = PD_ALLPAGES | + PD_USEDEVMODECOPIES | + PD_NOPAGENUMS | + PD_HIDEPRINTTOFILE | + PD_NOSELECTION | + PD_ENABLEPRINTHOOK) + : CPrintDialog(dwFlags) {} + virtual ~MyPrintDialog() override = default; + + void SetBoxTitle (LPCWSTR title) {m_sPDTitle = title;} + +protected: + virtual BOOL OnInitDialog() override; + virtual void OnCancel() override; + virtual void OnOK() override {} + +private: + MyPrintDialog(const MyPrintDialog&) = delete; + MyPrintDialog& operator=(const MyPrintDialog&) = delete; + + CString m_sPDTitle; +}; + +class MyPageSetup : public CPageSetupDialog +{ +public: + MyPageSetup(DWORD dwFlags = PSD_MARGINS) : CPageSetupDialog(dwFlags) {} + virtual ~MyPageSetup() override = default; + + void SetBoxTitle(LPCWSTR title); + +protected: + virtual BOOL OnInitDialog() override; + virtual void OnCancel() override; + virtual void OnOK() override {} + +private: + MyPageSetup(const MyPageSetup&) = delete; + MyPageSetup& operator=(const MyPageSetup&) = delete; + + CString m_PSDTitle; +}; + +#endif // MYPRINTER_H diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/PrintInfo.cpp b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/PrintInfo.cpp new file mode 100644 index 00000000..aeffa4e3 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/PrintInfo.cpp @@ -0,0 +1,84 @@ +/* (26-Mar-2025) (PrintInfo.cpp) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Implementation of the CPrintInfo class for + applications using the Win32++ Windows interface classes. The class + is described further below. + + About the CPrintInfo class: CPrintInfo stores information about a print + or print-preview job. The CPrintView class creates a CPrintInfo object + each time the Print or Print Preview command is chosen and destroys it + once the printing task is completed. + + During the CPrintView cycle, the CPrintInfo object contains persistent + information about the print job as a whole, such as the range of pages + to be printed and the current status of the print job, including the + page currently being printed. Some of this information is obtained from, + and given into, an associated CPrintDialog object; the CPrintInfo object + retains the values entered by the user in the Print dialog box. This + information remains as the CPrintDialog object goes out of scope. (This + is different than the MFC version of this class). + + A CPrintInfo object is passed between the base CPrintView class and its + derived class during the printing process and is used to exchange + information between the two. For example, the base class informs the + derived class which page of the document to print by assigning a value + to the m_nCurPage member of CPrintInfo; the derived class retrieves this + value and performs the actual printing of the specified page. + + Another example is the case in which the length of the document is not + known until it is printed. In this situation, the derived class may + test for the end of the document each time a page is printed. When the + end is reached, the derived class may set the m_bContinuePrinting member + of CPrintInfo to FALSE; this informs the base class to stop the print + loop. + +*******************************************************************************/ + +#include "stdafx.h" +#include "PrintInfo.h" + +CPrintInfo::CPrintInfo() +{ + m_pPD = nullptr; + m_bPreview = FALSE; // initialize to not preview + m_bDirect = FALSE; // initialize to not direct + m_bDocObject = FALSE; // initialize to not IPrint + m_bContinuePrinting = FALSE; // Assume it is not yet OK to print + + m_dwFlags = 0; // not supported + m_nOffsetPage = 0; // not supported + + m_nCopies = 1; // number of copies to print + m_nFromPage = 1; // first printed page, 1 based + m_nMaxPage = 0xffff; // maximum page limit + m_nMinPage = 1; // minimum page limit + m_nToPage = 0xffff; // last printed page + m_nCurPage = 0; // Current page + + m_lpUserData = nullptr; // pointer to user created struct + m_nNumPreviewPages = 0; // (not supported) + m_rectDraw.SetRect(0, 0, 0, 0); // rect of current usable page area + m_strPageDesc = L"Page %u"; // Format string for page number display + m_nMargin = 0; // page margin, in twips +} + +// Set initial values for the CPrintInfo object. +void CPrintInfo::InitInfo(CPrintDialog* pPD, UINT fromPage, UINT toPage, + UINT minPage, UINT maxPage, UINT nCopies) +{ + assert(pPD); + m_pPD = pPD; + PRINTDLG pd = m_pPD->GetParameters(); + pd.nCopies = static_cast(nCopies); + pd.nFromPage = static_cast(fromPage); + pd.nToPage = static_cast(toPage); + pd.nMinPage = static_cast(minPage); + pd.nMaxPage = static_cast(maxPage); + m_pPD->SetParameters(pd); +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/PrintInfo.h b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/PrintInfo.h new file mode 100644 index 00000000..5e071406 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/PrintInfo.h @@ -0,0 +1,62 @@ +/* (26-Mar-2025) (PrintInfo.h) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Declaration of the CPrintInfo class for + applications using the Win32++ Windows interface classes. This class is + similar to that bearing the same name in the Microsoft Foundation Classes + (MFC), with noted exceptions. + +*******************************************************************************/ + +#ifndef CPRINTINFO_H +#define CPRINTINFO_H + +// This class encapsulates the services provided by the Windows common dialog +// box for printing. It emulates and largely uses the same notation as its +// MFC counterpart. +class CPrintInfo +{ +public: + CPrintInfo(); + ~CPrintInfo() = default; + + UINT GetFromPage() const { return m_nFromPage;} + UINT GetMaxPage() const { return m_nMaxPage; } + UINT GetMinPage() const { return m_nMinPage; } + UINT GetNCopies() const { return m_nCopies; } + UINT GetToPage() const { return m_nToPage; } + void InitInfo(CPrintDialog*, UINT, UINT, UINT, UINT, UINT); + void SetFromPage(UINT nFromPage) { m_nFromPage = nFromPage; } + void SetMaxPage(UINT nMaxPage) { m_nMaxPage = nMaxPage; } + void SetMinPage(UINT nMinPage) { m_nMinPage = nMinPage; } + void SetNCopies(UINT nCopies) { m_nCopies = nCopies; } + void SetToPage(UINT nToPage) { m_nToPage = nToPage; } + + // public data + CPrintDialog* m_pPD; // pointer to print dialog + BOOL m_bDocObject; // TRUE if a DocObject (not supported) + BOOL m_bDirect; // TRUE if bypassing Print Dialog + BOOL m_bPreview; // TRUE if in preview mode + BOOL m_bContinuePrinting; // set FALSE to end printing + UINT m_nCopies; // number of copies (not supported) + UINT m_nFromPage; // first printed page, 1 based + UINT m_nMaxPage; // maximum page limit + UINT m_nMinPage; // minimum page limit + UINT m_nToPage; // last printed page + UINT m_nCurPage; // current page + UINT m_nNumPreviewPages; // (not supported) + LPVOID m_lpUserData; // pointer to user created struct + CRect m_rectDraw; // rect of current usable page area + CString m_strPageDesc; // format string for page number display + UINT m_nMargin; // page margin, in twips + + // these only valid if m_bDocObject: currently not supported + DWORD m_dwFlags; // flags for DocObject print operations + UINT m_nOffsetPage; // first page offset in combined Doc job +}; + +#endif // CPRINTINFO_H diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/Resource.rc b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/Resource.rc new file mode 100644 index 00000000..8bb40614 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/Resource.rc @@ -0,0 +1,289 @@ +/* (26-Mar-2025) (Resource.rc) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Application resources definition file for this + application using the Win32++ Windows interface classes. + +/******************************************************************************/ + +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "../src/res/PerMonitorV2.manifest" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDW_MAIN MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&New\tCtrl+N", IDM_FILE_NEW + MENUITEM "&Open\tCtrl+O", IDM_FILE_OPEN + MENUITEM "&Save\tCtrl+S", IDM_FILE_SAVE + MENUITEM "Save &As\tCtrl+Shft+S", IDM_FILE_SAVEAS + MENUITEM "&Close", IDM_FILE_CLOSE + MENUITEM SEPARATOR + MENUITEM "&Print...\tCtrl+P", IDM_FILE_PRINT + MENUITEM "Page Setup...\tAlt+P", IDM_FILE_PAGESETUP + MENUITEM SEPARATOR + MENUITEM "Recent Files", IDW_FILE_MRU_FILE1, GRAYED + MENUITEM SEPARATOR + MENUITEM "E&xit\tCtrl+Q", IDM_FILE_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "Undo\tCtrl+Z", IDM_EDIT_UNDO //, GRAYED + MENUITEM "Redo\tCtrl+Y", IDM_EDIT_REDO //, GRAYED + MENUITEM SEPARATOR + MENUITEM "Cut\tCtrl+X", IDM_EDIT_CUT //, GRAYED + MENUITEM "Copy\tCtrl+C", IDM_EDIT_COPY //, GRAYED + MENUITEM "Paste\tCtrl+V", IDM_EDIT_PASTE //, GRAYED + MENUITEM "Delete\tDel", IDM_EDIT_DELETE //, GRAYED + MENUITEM SEPARATOR + MENUITEM "Find\tCtrl+F", IDM_EDIT_FIND //, GRAYED + MENUITEM "Replace\tCtrl+R", IDM_EDIT_REPLACE //, GRAYED + MENUITEM SEPARATOR + END + POPUP "&View" + BEGIN + MENUITEM "&Tool Bar", IDW_VIEW_TOOLBAR, CHECKED + MENUITEM "&Status Bar", IDW_VIEW_STATUSBAR, CHECKED + MENUITEM SEPARATOR + MENUITEM "&Control Colors", IDM_COLOR_CHOICE + MENUITEM "&Font Face+Color", IDM_FONT_CHOICE + MENUITEM SEPARATOR + MENUITEM "&Wrap Text Lines", IDM_RICHEDWRAP, CHECKED + END + POPUP "&Help" + BEGIN + MENUITEM "&About\tF1", IDW_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDW_MAIN ICON "../src/res/smile.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDW_MAIN BITMAP DISCARDABLE "../src/res/Toolbar.bmp" +IDB_MENUICONS BITMAP DISCARDABLE "../src/res/MenuIcons.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_MAIN_DIALOG DIALOGEX 0, 0, 300, 200 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE +EXSTYLE WS_EX_CLIENTEDGE +FONT 10, "Courier New", 0, 0 +BEGIN + // controls within the client area: + CONTROL "", IDC_RICHEDITBOX, "RichEdit50W" , ES_MULTILINE |ES_AUTOHSCROLL | + WS_BORDER | WS_TABSTOP | ES_WANTRETURN | WS_VSCROLL | + WS_HSCROLL, 10, 10, 280, 180, WS_EX_CLIENTEDGE | + WS_EX_ACCEPTFILES +END + + +IDW_ABOUT DIALOGEX 0, 0, 200, 100 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | + WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 10, "MS Shell Dlg", 400, 0 +BEGIN + DEFPUSHBUTTON "OK", IDOK, 80, 80, 40, 15 + CTEXT "Common Controls Demo", IDC_ABOUT_MSG, 30, 5, 160, 70 + ICON IDW_MAIN, 0, 5, 5, 20, 20 +END + +IDD_CLISTVIEWBOX DIALOG 0, 0, 100, 100 +STYLE WS_POPUP | WS_CAPTION | WS_BORDER | WS_SYSMENU | WS_VISIBLE | DS_SETFONT | + DS_MODALFRAME | DS_FIXEDSYS +CAPTION "CListBoxDlg Dialog" +FONT 10, "Microsoft Sans Serif" +BEGIN + DEFPUSHBUTTON "OK", IDOK, 5, 83, 30, 15 + PUSHBUTTON "Cancel", IDCANCEL, 65, 83, 30, 15 + LISTBOX IDC_LIST_BOX, 5, 5, 90, 75, WS_GROUP | WS_TABSTOP | + WS_VSCROLL | NOT WS_BORDER | LBS_NOINTEGRALHEIGHT | + LBS_NOTIFY +END + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDW_MAIN ACCELERATORS +BEGIN + "N", IDM_FILE_NEW, VIRTKEY, CONTROL, NOINVERT + "O", IDM_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT + "S", IDM_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT + "S", IDM_FILE_SAVEAS, VIRTKEY, SHIFT, CONTROL, NOINVERT + "F", IDM_EDIT_FIND, VIRTKEY, CONTROL, NOINVERT + "C", IDM_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + "X", IDM_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT + "V", IDM_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT + "P", IDM_FILE_PRINT, VIRTKEY, CONTROL, NOINVERT + "P", IDM_FILE_PAGESETUP, VIRTKEY, ALT, NOINVERT + "H", IDW_ABOUT, VIRTKEY, CONTROL, NOINVERT + "Q", IDM_FILE_EXIT, VIRTKEY, CONTROL, NOINVERT + "R", IDM_EDIT_REPLACE, VIRTKEY, CONTROL, NOINVERT + "Z", IDM_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT + "Y", IDM_EDIT_REDO, VIRTKEY, CONTROL, NOINVERT + VK_DELETE, IDM_EDIT_DELETE, VIRTKEY, SHIFT, NOINVERT +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDW_MAIN "Common Dialogs Demo" + IDW_INDICATOR_CAPS "CAP" + IDW_INDICATOR_NUM "NUM" + IDW_INDICATOR_SCRL "SCRL" + IDW_VIEW_TOOLBAR "Show or hide the tool bar." + IDW_VIEW_STATUSBAR "Show or hide the status bar." + IDM_RICHEDWRAP "Enable/disable text wrapping." + // for menu items + IDM_COLOR_CHOICE "Change the background color." + IDM_FONT_CHOICE "Change the display font." +END + +STRINGTABLE +BEGIN + IDM_FILE_NEW "Create a New Document." + IDM_FILE_OPEN "Open Existing Document." + IDM_FILE_SAVE "Save the Document." + IDM_FILE_SAVEAS "Save the Document with a new name." + IDM_FILE_PRINT "Print the Document." + IDM_FILE_CLOSE "Close the current document." + IDW_FILE_MRU_FILE1 "Open this document" + IDW_FILE_MRU_FILE2 "Open this document" + IDW_FILE_MRU_FILE3 "Open this document" + IDW_FILE_MRU_FILE4 "Open this document" + IDW_FILE_MRU_FILE5 "Open this document" + // add more mru IDs if needed + IDM_FILE_EXIT "End the Program." +END + +STRINGTABLE +BEGIN + IDM_EDIT_CUT "Cut the Selected Contents to the Clipboard." + IDM_EDIT_COPY "Copy the Selected Contents to the Clipboard." + IDM_EDIT_PASTE "Paste the Clipboard Contents to the Document." + IDM_EDIT_UNDO "Undo the last action." + IDM_EDIT_REDO "Redo the previously undone action." + IDM_EDIT_FIND "Find something..." + IDM_EDIT_REPLACE "Replace something..." + IDM_EDIT_DELETE "Erase the selected Contents." +END + +STRINGTABLE +BEGIN + IDW_ABOUT "Display information about this program." +END + +STRINGTABLE +BEGIN + SC_CLOSE "Close the Window." + SC_MAXIMIZE "Maximize the Window." + SC_MINIMIZE "Minimize the Window." + SC_MOVE "Move the Window." + SC_NEXTWINDOW "Select Next Window." + SC_PREVWINDOW "Select Previous Window." + SC_RESTORE "Restore the Window." + SC_SIZE "Resize the Window." +END + +STRINGTABLE // client area items +BEGIN + IDC_RICHEDITBOX "This is a rich edit control." +END + +STRINGTABLE // app-specific program values +BEGIN + IDS_APP_VERSION "Version 3.0 (2025)" + IDS_DOC_DEFAULT_EXT ".txt" + IDS_FILE_FILTER "Text Files (*.txt)|*.txt| All Files (*.*)|*.*||" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/RichEditView.cpp b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/RichEditView.cpp new file mode 100644 index 00000000..35f62c0c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/RichEditView.cpp @@ -0,0 +1,401 @@ +/* (26-Mar-2025) (CRichEditView.h) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Implementation of the CRichEditView class for the + CommonDialogs sample application using the Win32++ Windows interface + class. This class serves both as the document view and content manager. + +*******************************************************************************/ + +#include "stdafx.h" +#include "StdApp.h" + + +CRichEditView::CRichEditView() : m_textLength(0), m_isAppBanded(FALSE) +{ + m_fr = {}; +} + +// Clear the control of all text. +void CRichEditView::Clean() +{ + SetWindowText(L""); +} + +// Return TRUE if text is currently selected. +BOOL CRichEditView::IsSelected() +{ + CHARRANGE r; + GetSel(r); + return (r.cpMin != r.cpMax); +} + +void CRichEditView::OnAttach() +{ + // Increase the text limit of the rich edit window: here, (DWORD)-1, + // or the maximum DWORD value. + LimitText(-1); + + // Determine which messages will be passed to the parent. + DWORD dwMask = ENM_KEYEVENTS | ENM_DROPFILES | ENM_MOUSEEVENTS; + SetEventMask(dwMask); +} + +// Set the rich edit control text foreground and background colors and the +// control background color. +void CRichEditView::SetColors(COLORREF txfg, COLORREF txbg, COLORREF bg) +{ + CHARFORMAT2 chf; + chf.cbSize = sizeof(chf); + chf.dwMask = CFM_COLOR | CFM_BACKCOLOR; + chf.dwEffects = 0; + chf.crTextColor = txfg; + chf.crBackColor = txbg; + SetDefaultCharFormat(chf); + SetBackgroundColor(FALSE, bg); +} + +// Set the display font; if nullptr, the system font is used. Immediately +// redraw the view if TRUE. +void CRichEditView::SetFont(HFONT font, BOOL redraw) const +{ + CRichEdit::SetFont(font, redraw); + + // Do not automatically change fonts when the user explicitly changes + // to a different keyboard layout. + LRESULT lres = SendMessage(EM_GETLANGOPTIONS, 0, 0); + lres &= ~IMF_AUTOFONT; + SendMessage(EM_SETLANGOPTIONS, 0, lres); +} + +// Set the rich edit view window to use word wrapping(wrap is TRUE) or +// not use word wrapping(wrap is FALSE). +void CRichEditView::SetWrapping(int wrap) +{ + SetTargetDevice(nullptr, (wrap == 0 ? TRUE : FALSE)); +} + +// Read the text from the file into this rich edit control. +BOOL CRichEditView::StreamInFile(const CFile& file) +{ + UINT format = SF_TEXT; + EDITSTREAM es; + es.dwCookie = reinterpret_cast(file.GetHandle()); + es.pfnCallback = reinterpret_cast( + reinterpret_cast(StreamInCallback)); + StreamIn(format, es); + + // Clear the modified text flag + SetModify(FALSE); + return TRUE; +} + +// Write the text into the specified file. +BOOL CRichEditView::StreamOutFile(const CFile& file) +{ + UINT format = SF_TEXT; + EDITSTREAM es; + es.dwCookie = reinterpret_cast(file.GetHandle()); + es.dwError = 0; + es.pfnCallback = reinterpret_cast( + reinterpret_cast(StreamOutCallback)); + StreamOut(format, es); + + // Clear the modified text flag + SetModify(FALSE); + return TRUE; +} + +// Replace the contents of the rich edit view window with data from an input +// stream. The parameter dwCookie holds the file handle. The pbuff parameter +// points to the stream's buffer. The number of bytes streamed in is stored +// in pch. +DWORD CALLBACK CRichEditView::StreamInCallback(DWORD dwCookie, LPBYTE pbBuff, + LONG cb, LONG *pcb) +{ + *pcb = 0; + if (!::ReadFile((HANDLE)(DWORD_PTR) dwCookie, pbBuff, cb, (LPDWORD)pcb, + nullptr)) + ::MessageBox(nullptr, L"StreamInFile Failed", L"", MB_OK); + + return 0; +} + +// Transfer data out of the rich edit view window. The dwCookie parameter holds +// the file handle. The pbBuff parameter points to the stream's buffer. The +// number of bytes streamed in is stored in pcb. +DWORD CALLBACK CRichEditView::StreamOutCallback(DWORD dwCookie, LPBYTE pbBuff, + LONG cb, LONG *pcb) +{ + *pcb = 0; + if (!::WriteFile((HANDLE)(DWORD_PTR)dwCookie, pbBuff, cb, (LPDWORD)pcb, + nullptr)) + { + ::MessageBox(nullptr, L"StreamOutFile Failed", L"", MB_OK); + } + + return 0; +} + +// Call this function to invoke the print dialog box to create a printer device +// context using the values in the info structure. +BOOL CRichEditView::DoPreparePrinting(CPrintInfo& info) +{ + assert(info.m_pPD); + + // Display the print dialog. + if (info.m_pPD->DoModal(GetApp()->GetMainWnd()) != IDOK) + return FALSE; + + // Save the printer dialog parameters so they are available after the + // printer dialog object goes out of scope. + PRINTDLG pd = info.m_pPD->GetParameters(); + info.SetNCopies(pd.nCopies); + info.SetFromPage(pd.nFromPage); + info.SetMinPage(pd.nMinPage); + info.SetMaxPage(pd.nMaxPage); + info.SetToPage(pd.nToPage); + info.m_strPageDesc = L"Page %u"; + return TRUE; +} + +// Prints the current document. The documents name is set by DoPrintRichView. +// If banding is supported, this should also have been set. If the printer +// uses a data type to record the print job, this should also have been set. +void CRichEditView::DoPrintView() +{ + try + { + CPrintInfo info; + + // Display the print dialog and create printer device context. + if (!OnPreparePrinting(info)) + return; + + // Set the printer device context via saved info. + CDC DC = info.m_pPD->GetPrinterDC(); + + // Put the printer DC in MM_TEXT mode and compute the page m_rectDraw + // in twips. + DC.SetMapMode(MM_TEXT); + int nHorizRes = DC.GetDeviceCaps(HORZRES); + int nVertRes = DC.GetDeviceCaps(VERTRES); + int nLogPixelsX = DC.GetDeviceCaps(LOGPIXELSX); + int nLogPixelsY = DC.GetDeviceCaps(LOGPIXELSY); + info.m_rectDraw.SetRect(0, 0, (nHorizRes * 1440) / nLogPixelsX, + (nVertRes * 1440) / nLogPixelsY); + + // Allocate resources and perform initializations. + OnBeginPrinting(DC, info); + + // Set up the print job. + DOCINFO di{}; + di.cbSize = sizeof(DOCINFO); + di.lpszDocName = m_docPath; // the spooler label + di.lpszOutput = (m_printPath.IsEmpty() ? nullptr : m_printPath.c_str()); + di.lpszDatatype = (m_dataType.IsEmpty() ? nullptr : m_dataType.c_str()); + di.fwType = (m_isAppBanded ? DI_APPBANDING : 0); + + // Start the document. + DC.StartDoc(&di); + + // Determine the printing page range. + UINT nEndPage = info.GetToPage(); + UINT nStartPage = info.GetFromPage(); + + // Assure that the starting page is within limits. + if (nStartPage < info.GetMinPage()) + nStartPage = info.GetMinPage(); + if (nStartPage > info.GetMaxPage()) + nStartPage = info.GetMaxPage(); + + // Assure that the ending page is within limits. + if (nEndPage < info.GetMinPage()) + nEndPage = info.GetMinPage(); + if (nEndPage > info.GetMaxPage()) + nEndPage = info.GetMaxPage(); + + int nStep = (nEndPage >= nStartPage) ? 1 : -1; + nEndPage = (nEndPage == 0xffff) ? 0xffff : nEndPage + nStep; + BOOL bError = FALSE; + + for (info.m_nCurPage = nStartPage; info.m_nCurPage != nEndPage; + info.m_nCurPage += nStep) + { + OnPrepareDC(DC, info); + + // Check for end of print. + if (!info.m_bContinuePrinting) + break; + + // Attempt to start the current page. + if (DC.StartPage() < 0) + { + bError = TRUE; + break; + } + + // We must now call OnPrepareDC again because StartPage has reset + // the device attributes. + OnPrepareDC(DC, info); + + assert(info.m_bContinuePrinting); + + // The page has been successfully started, so now render the page. + OnPrint(DC, info); + if (DC.EndPage() < 0 ) + { + bError = TRUE; + break; + } + } + + // Cleanup the document printing process and end the job. + if (!bError) + DC.EndDoc(); + else + DC.AbortDoc(); + OnEndPrinting(DC, info); + } + + catch (const CWinException& /* e */) + { + // No default printer + ::MessageBox(0, L"Unable to display print dialog", + L"Print Failed", MB_OK); + return; + } +} + +// Print the contents of the CRichEditView control in the CView client +// area accessed by pView. Label the spooler output using the sDocPath. +void CRichEditView::DoPrintRichView(LPCWSTR sDocPath) +{ + m_docPath = sDocPath; + DoPrintView(); +} + +// Calculate the vector of first characters on each page in this text rich +// edit view. Set the page count and page number limits into the info object. +void CRichEditView::GetPageBreaks(CPrintInfo& info) +{ + // Use a separate format range object for pagination. + FORMATRANGE fr = m_fr; + fr.chrg.cpMin = 0; + fr.chrg.cpMax = -1; + long nTextScanned = 0; // Amount of document scanned so far. + + m_firstPageChar.clear(); + m_firstPageChar.push_back(0); + do + { + // Store the number of character's that fit on this page. + nTextScanned = FormatRange(fr, FALSE); + m_firstPageChar.push_back(nTextScanned); + + // If there is more text to format, adjust the range of characters to + // start formatting at the first character of the next page. + if (nTextScanned < m_textLength) + { + fr.chrg.cpMin = nTextScanned; + fr.chrg.cpMax = -1; + } + } while (nTextScanned < m_textLength); + + // Tell the control to release cached information. + FormatRange(fr, FALSE); + + // On exit, the m_firstPageChar vector should contain one more entry than + // the actual number of pages. + info.SetMinPage(1); + info.SetFromPage(1); + UINT maxpg = static_cast(m_firstPageChar.size()) - 1; + info.SetMaxPage(maxpg); + info.SetToPage(maxpg); +} + +// Initiate parameters used by the printing task. This includes setting the +// FORMATRANGE m_fr structure with the printer context, the printer page size +// and margins, the range of text to print, the beginning locations of each +// page to be printed. +void CRichEditView::OnBeginPrinting(CDC& DC, CPrintInfo& info) +{ + HDC hPrinterDC = DC.GetHDC(); + + // Set up the page. + m_fr = {}; + m_fr.hdc = hPrinterDC; // device to render to + m_fr.hdcTarget = hPrinterDC; // device to format to + info.m_nMargin = 200; // twips + m_fr.rcPage.left = m_fr.rcPage.top = info.m_nMargin; + m_fr.rcPage.right = info.m_rectDraw.right - info.m_nMargin; + m_fr.rcPage.bottom = info.m_rectDraw.bottom - info.m_nMargin; + + // Set up margins all around. + m_fr.rc.left = m_fr.rcPage.left; + m_fr.rc.top = m_fr.rcPage.top; + m_fr.rc.right = m_fr.rcPage.right; + m_fr.rc.bottom = m_fr.rcPage.bottom; + + // Find out real size of document in characters. + m_textLength = GetTextLengthEx(GTL_NUMCHARS); + GetPageBreaks(info); + info.m_bContinuePrinting = TRUE; + + // Default the range of text to print as the entire document. + m_fr.chrg.cpMin = 0; + m_fr.chrg.cpMax = -1; +} + +// Clean up any loose ends before ending the job. +void CRichEditView::OnEndPrinting(CDC&, CPrintInfo&) +{ + // Release the cached information. + FormatRange(m_fr, FALSE); +} + +// Make preparations for printing the next page.Here, check for an +// end - of - printing condition. +void CRichEditView::OnPrepareDC(CDC&, CPrintInfo&info /* = nullptr */) +{ + if (m_fr.chrg.cpMin >= m_textLength) + info.m_bContinuePrinting = FALSE; +} + +// Declare a printer dialog box, set initial info settings, and get the +// printer parameters via the printer dialog.Return TRUE if a printer was +// chosen, FALSE if the dialog was cancelled. +BOOL CRichEditView::OnPreparePrinting(CPrintInfo& info) +{ + // Set up the dialog to choose the printer and printing parameters. + // The PD_ENABLEPRINTHOOK parameter displays the classic dialog. + MyPrintDialog PrintDlg(PD_USEDEVMODECOPIESANDCOLLATE | PD_RETURNDC | + PD_ENABLEPRINTHOOK); + + PrintDlg.SetBoxTitle(L"Print contents of rich edit box."); + info.InitInfo(&PrintDlg, 1, 0xffff, 1, 0xffff, 1); + if (!DoPreparePrinting(info)) + return FALSE; + + return TRUE; +} + +// Print the current page indicated in info. +void CRichEditView::OnPrint(CDC&, CPrintInfo& info) +{ + UINT page_no = info.m_nCurPage; + long first = m_firstPageChar[page_no - 1]; + m_fr.chrg.cpMin = first; + m_fr.chrg.cpMax = -1; + + // Print the a page. The return value should be the index of the first + // character on the next page. Using TRUE for the wparam parameter + // causes the text to be printed. + FormatRange(m_fr, TRUE); + DisplayBand(m_fr.rc); +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/RichEditView.h b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/RichEditView.h new file mode 100644 index 00000000..a49a8182 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/RichEditView.h @@ -0,0 +1,68 @@ +/* (26-Mar-2025) (CRichEditView.h) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Declaration of the CRichEditView class for the + CommonDialogs sample application using the Win32++ Windows interface + classes. This class serves as both the view object as well as the + document repository and manager. In similarity to Microsoft Foundation + Classes (MFC) architecture it also contains the print loop. + +*******************************************************************************/ + +#ifndef CRICHEDITVIEW_H +#define CRICHEDITVIEW_H + +#include "PrintInfo.h" + +class CRichEditView : public CRichEdit +{ +public: + CRichEditView(); + virtual ~CRichEditView() override = default; + + void Clean(); + void DoPrintRichView(LPCWSTR); + void DoPrintView(); + BOOL IsSelected(); + void SetColors(COLORREF txfg, COLORREF txbg, COLORREF bg); + void SetFont(HFONT hFont, BOOL bRedraw) const; + void SetPrintPath(LPCWSTR s) { m_printPath = s;} + void SetWrapping(int wrap); + BOOL StreamInFile(const CFile& file); + BOOL StreamOutFile(const CFile& file); + +protected: + virtual void OnAttach() override; + +private: + CRichEditView(const CRichEditView&) = delete; + CRichEditView& operator=(const CRichEditView&) = delete; + + BOOL DoPreparePrinting(CPrintInfo& info); + void GetPageBreaks(CPrintInfo&); + void OnBeginPrinting(CDC& DC, CPrintInfo& info); + void OnEndPrinting(CDC& DC, CPrintInfo& info); + void OnPrepareDC(CDC& DC, CPrintInfo& info); + BOOL OnPreparePrinting(CPrintInfo& info); + void OnPrint(CDC& DC, CPrintInfo& info); + void SetAppBanding(BOOL b) { m_isAppBanded = b;} + + static DWORD CALLBACK StreamInCallback(DWORD dwCookie, LPBYTE pbBuff, + LONG cb, LONG *pcb); + static DWORD CALLBACK StreamOutCallback(DWORD dwCookie, LPBYTE pbBuff, + LONG cb, LONG *pcb); + + long m_textLength; + CString m_docPath; // document path name + CString m_printPath; // print-to-file path (not supported) + CString m_dataType; // DOCINFO data type for the print job + BOOL m_isAppBanded; // TRUE if app banding supported + FORMATRANGE m_fr; // rich edit format range struct + std::vector m_firstPageChar; // first character of each page +}; + +#endif // CRICHEDITVIEW_H diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/StdAfx.cpp b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/StdAfx.cpp new file mode 100644 index 00000000..6c00939f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/StdAfx.cpp @@ -0,0 +1,16 @@ +/* (26-Mar-2025) (StdAfx.cpp) * +******************************************************************************** + + Contents Description: Standard declarations implementation File. This + file is used for precompiled headers. Precompiled headers allow + programs to be recompiled more quickly. + + To use precompiled headers, do the following: + 1) Add the set of rarely changed headers to stdafx.h + 2) Include stdafx.h in each cpp file. It must be included first. + 3) Add stdafx.cpp to your project. + 4) Turn on precompiled hearders in the project + +*=============================================================================*/ + +#include "stdafx.h" diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/StdApp.h b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/StdApp.h new file mode 100644 index 00000000..e2b682a8 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/StdApp.h @@ -0,0 +1,34 @@ +/* (26-Mar-2025) (StdApp.h) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Standard application declarations header file. + This file is used to #include all this application's header files in the + order required for error-free compilation using the Win32++ interface + classes. + +*******************************************************************************/ + +#ifndef STD_APP_H +#define STD_APP_H + + +#include "resource.h" +#include "ColorDefs.h" +#include "ColorChoice.h" +#include "MyFileDlg.h" +#include "MyFontDlg.h" +#include "MyFindReplaceDlg.h" +#include "MyPrintDialog.h" +#include "RichEditView.h" +#include "Doc.h" +#include "PrintInfo.h" +#include "View.h" +#include "AboutBox.h" +#include "Mainfrm.h" +#include "App.h" + +#endif // STD_APP_H diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/View.cpp b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/View.cpp new file mode 100644 index 00000000..785d16ec --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/View.cpp @@ -0,0 +1,200 @@ +/* (26-Mar-2025) (View.cpp) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Implementation of the CView class for the + CommonDialogs sample application using the Win32++ Windows interface + classes. This particular view class contains features for selection of + client background color, selection of edit box font, and use of external + serialization files. + +*******************************************************************************/ + +#include "stdafx.h" +#include "StdApp.h" + +// Construct default window main view object. +CView::CView(UINT id) : CDialog(id), m_parent(nullptr) +{ +} + +// Add the string with the resource id to the control whose resource +// identifier is also id. +BOOL CView::AddToolTip(HWND parent, UINT id) +{ + return AddToolTip(parent, id, LoadString(id)); +} + +// Adds the toolTip string to the control whose resource identifier is id. +BOOL CView::AddToolTip(HWND parent, UINT id, LPCWSTR toolTip) +{ + HWND hCtl = ::GetDlgItem(parent, id); + if (hCtl == nullptr) + { + TRACE(CString("cannot connect tooltip: ") + toolTip); + return FALSE; + } + + if (!m_toolTip.AddTool(hCtl, toolTip)) + { + TRACE(CString("unable to add tooltip: ") + toolTip); + return FALSE; + } + + return TRUE; +} + +// Assign tool tips to controls in the client area. +void CView::AssignToolTips() +{ + HWND client = *this; + if (!m_toolTip.Create(client)) + { + TRACE("unable to create tool tips\n"); + return; + } + + m_toolTip.AddTool(client, L"Client area"); + AddToolTip(client, IDC_RICHEDITBOX); + m_toolTip.Activate(TRUE); +} + +// Show the view window as a modeless dialog. +HWND CView::Create(HWND parent = nullptr) +{ + m_parent = parent; + return DoModeless(parent); +} + +// This method processes all messages sent to the form dialog. +INT_PTR CView::DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + if (WM_CTLCOLORMSGBOX <= msg && msg <= WM_CTLCOLORSTATIC) + return OnCtlColor(msg, wparam, lparam); + + switch (msg) + { + case WM_SIZE: + { + CRect rc = GetClientRect(); + int gap = DpiScaleInt(10); + rc.DeflateRect(gap, gap); + GetRichView().SetWindowPos(nullptr, rc, SWP_SHOWWINDOW); + Invalidate(); + break; // Also do default processing + } + } + + // Pass unhandled messages on for default processing. + return DialogProcDefault(msg, wparam, lparam); +} + +// Announce that no document is currently open. +void CView::NoDocOpen() +{ + m_richView.SetWindowText(L"\n\n\t\tNo document is now open.\n\n\t" + L"Load or create one using a File menu command,\n\t" + L"or drag and drop a text file name in this area."); +} + +// Here we only set the client background color, as the colors of the +// statusbar and the rich edit control are set elsewhere.See View:: +// SetRichEditColors() for the latter process. +INT_PTR CView::OnCtlColor(UINT msg, WPARAM wparam, LPARAM) +{ + UINT nCtlColor = msg - WM_CTLCOLORMSGBOX; + + // Retrieve the display context. + CDC dcCtl(reinterpret_cast(wparam)); + switch (nCtlColor) + { + case CTLCOLOR_DLG: + return (UINT_PTR)m_bgBrush.GetHandle(); // preset by the frame + + case CTLCOLOR_MSGBOX: + case CTLCOLOR_EDIT: + case CTLCOLOR_LISTBOX: + case CTLCOLOR_BTN: // (none of these apply here) + case CTLCOLOR_SCROLLBAR: + case CTLCOLOR_STATIC: + break; + } + + return (INT_PTR)0; +} + +// This method is invoked immediately before the dialog box is displayed. +// This override performs special processing to initialize the view and +// other members of the application that require all windows to have been +// created. +BOOL CView::OnInitDialog() +{ + // Load the program icons. + SetIconLarge(IDW_MAIN); + SetIconSmall(IDW_MAIN); + + // Add tool tips to controls in client area. + AssignToolTips(); + + // Subclass the controls on the dialog. + AttachItem(IDC_RICHEDITBOX, m_richView); + + // Set edit box to default font + m_richView.SetFont(m_editFont, TRUE); + + // Put some arbitrary text in the edit control just for this demo. + NoDocOpen(); + + return TRUE; +} + +// Process messages that controls send to the parent. +LRESULT CView::OnNotify(WPARAM wparam, LPARAM lparam) +{ + NMHDR* pNMH = (LPNMHDR) lparam; + switch (pNMH->code) + { + case EN_DROPFILES: // A file has been dropped in the rich edit box. + SendMessage(m_parent, WM_NOTIFY, wparam, lparam); + return TRUE; + } + + return CDialog::OnNotify(wparam, lparam); +} + +// Invoke the page setup dialog box and set printer parameters. +void CView::OnPageSetup() +{ + MyPageSetup PSD(PSD_MARGINS); + PSD.SetBoxTitle(L"Page Parameter Setup"); + PSD.DoModal(GetParent()); + + // TODO: Add code here to set up the printer. Note: control does not + // return here until after OnOK() or OnCancel() have concluded. +} + +// Invoke a MyPrintDialog dialog to get printing parameters and then print +// the contents of the rich view control. +void CView::OnPrintDocument(LPCWSTR path) +{ + m_richView.DoPrintRichView(path); +} + +// Set the rich edit control text foreground and background colors and the +// control background color.This is needed only once(not like other +// controls set in OnCtlColor()). +void CView::SetRichEditColors(COLORREF txfg, COLORREF txbg, COLORREF bg) +{ + m_richView.SetColors(txfg, txbg, bg); +} + +// Set the font for the edit box in the client window. +void CView::SetEditFont(const CFont& f) +{ + m_editFont = f; + m_richView.SetFont(f, TRUE); +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/View.h b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/View.h new file mode 100644 index 00000000..c2669d3e --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/View.h @@ -0,0 +1,69 @@ +/* (26-Mar-2025) (View.h) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Declaration of the CView class for the + CommonDialogs sample application using the Win32++ Windows interface + classes. This particular view class utilizes a rich edit control to + contain, view, and manage the document's data. It also applies methods + for setting the view's foreground and background colors and the edit box + font. + +*******************************************************************************/ + +#ifndef SDI_VIEW_H +#define SDI_VIEW_H + +// Identifiers of entries in the m_colorTable array. +enum CtlColors +{ + DfltClr = 0, // default color + DlgBg, // dialog background + REdTxFg, // rich edit text foreground + REdTxBg, // rich edit text background + REdBg // rich edit control background +}; + +class CView : public CDialog +{ +public: + CView(UINT id); + virtual ~CView() override = default; + + virtual HWND Create(HWND) override; + CRichEditView& GetRichView() { return m_richView;} + CFont GetEditFont() { return m_editFont;} + void NoDocOpen(); + void OnPageSetup(); + void OnPrintDocument(LPCWSTR); + void SetEditFont(const CFont& f); + void SetBgColor(const CBrush& br) { m_bgBrush = br;} + void SetRichEditColors(COLORREF, COLORREF, COLORREF); + +protected: + virtual INT_PTR DialogProc(UINT, WPARAM, LPARAM) override; + virtual void OnCancel() override {} // Suppress keys closing the dialog + virtual void OnClose() override {} // Suppress keys closing the dialog + virtual BOOL OnInitDialog() override; + virtual LRESULT OnNotify(WPARAM wparam, LPARAM lparam) override; + +private: + CView(const CView&) = delete; + CView& operator=(const CView&) = delete; + + BOOL AddToolTip(HWND, UINT id); + BOOL AddToolTip(HWND, UINT id, LPCWSTR s); + void AssignToolTips(); + INT_PTR OnCtlColor(UINT, WPARAM, LPARAM); + + HWND m_parent; // handle of parent frame + CToolTip m_toolTip; // form tool tips + CFont m_editFont; // edit box font + CBrush m_bgBrush; // background brush object + CRichEditView m_richView; // the view of the document +}; + +#endif // SDI_VIEW_H diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/main.cpp b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/main.cpp new file mode 100644 index 00000000..15f97fd8 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/main.cpp @@ -0,0 +1,44 @@ +/* (26-Mar-2025) (main.cpp) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: This file contains the WinMain() function for the + CommonDialogs demonstration sample application using the Win32++ Windows + interface classes. + +*******************************************************************************/ + +#include "stdafx.h" +#include "StdApp.h" + +// Application entry point. +int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPWSTR, _In_ int) +{ + int rtn = -1; + + // Run the application + CApp thisApp; + try + { + rtn = thisApp.Run(); + } + catch (const CException &e) // catch all CException events + { + // Process the exception and quit + CString msg; + msg << e.what() << '\n' << e.GetText() << "\nWinMain Goodbye..."; + ::MessageBox(nullptr, msg, L"Standard Exception", MB_OK | + MB_ICONSTOP | MB_TASKMODAL); + } + catch(...) // catch all other exception events + { + CString msg = L"Unregistered exception event.\nWinMain Goodbye..."; + ::MessageBox(nullptr, msg, L"Unknown Exception", MB_OK | + MB_ICONSTOP | MB_TASKMODAL); + } + + return rtn; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/res/MenuIcons.bmp b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/res/MenuIcons.bmp new file mode 100644 index 00000000..a85f01dc Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/res/MenuIcons.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/res/PerMonitorV2.manifest b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/res/PerMonitorV2.manifest new file mode 100644 index 00000000..1831ddb6 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/res/PerMonitorV2.manifest @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + PerMonitorV2, PerMonitor + + + + + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/res/Smile.ico b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/res/Smile.ico new file mode 100644 index 00000000..ceae54bb Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/res/Smile.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/res/Toolbar.bmp b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/res/Toolbar.bmp new file mode 100644 index 00000000..40875118 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/res/Toolbar.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/resource.h b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/resource.h new file mode 100644 index 00000000..5931f5d9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/resource.h @@ -0,0 +1,76 @@ +/* (26-Mar-2025) (resource.h) * +******************************************************************************** +| | +| Authors: Robert Tausworthe, David Nash | +| | +===============================================================================* + + Contents Description: Resource Definitions used by the CommonDialogs + sample application resource.rc file. Adapted to the Win32++ Windows + interface classes. + + Special Conventions: The specification of IDs for resource objects + generally adhere to prefixes as shown in the following table. Note + that different kinds of resource objects have different prefixes to + distinguish the types of entities they belong to: + + Entity id Object + IDP_ Message-box prompt + IDD_ Dialog-box id + ID_ Standard MFC toolbar and menu command + IDT_ Toolbar command + IDM_ Menu command + IDR_ Frame-related resource + IDC_ Control resource + IDW_ Win32++ default resources + +*******************************************************************************/ + +#ifndef RESOURCE_H_DEFINED +#define RESOURCE_H_DEFINED + + +// Include the resource IDs defined by Win32++, numbered 51 - 99. +// These are prefixed by IDW_. +#include "default_resource.h" + +// resource id of the main frame dialog (see resource.rc) +#define IDD_MAIN_DIALOG 100 + +// resource IDs for Menu and ToolBar commands +#define IDM_FILE_NEW 101 +#define IDM_FILE_OPEN 102 +#define IDM_FILE_SAVE 103 +#define IDM_FILE_SAVEAS 104 +#define IDM_FILE_CLOSE 105 +#define IDM_FILE_PAGESETUP 106 +#define IDM_FILE_PRINT 107 +#define IDM_FILE_EXIT 109 +#define IDM_EDIT_UNDO 110 +#define IDM_EDIT_REDO 111 +#define IDM_EDIT_CUT 112 +#define IDM_EDIT_COPY 113 +#define IDM_EDIT_PASTE 114 +#define IDM_EDIT_FIND 115 +#define IDM_EDIT_REPLACE 116 +#define IDM_EDIT_DELETE 117 +#define IDM_FONT_CHOICE 120 +#define IDM_COLOR_CHOICE 121 +#define IDC_ABOUT_MSG 130 +#define IDS_APP_VERSION 140 +#define IDS_FILE_FILTER 141 +#define IDS_DOC_DEFAULT_EXT 142 + +// resource IDs for client area controls (IDOK has its own, so not given here) +#define IDC_RICHEDITBOX 150 +#define IDM_RICHEDWRAP 151 + +// bitmap +#define IDB_MENUICONS 160 + +// CListBoxDlg resources +#define IDD_CLISTVIEWBOX 200 +#define IDC_LIST_BOX 201 + + +#endif // RESOURCE_H_DEFINED diff --git a/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/stdafx.h b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/stdafx.h new file mode 100644 index 00000000..08450116 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CommonDialogs/src/stdafx.h @@ -0,0 +1,90 @@ +///////////////////////////// +// StdAfx.h +// + +// This file is used for precompiled headers. +// Rarely modified header files should be included. +// Based on code provided by Lynn Allan. + + +#ifndef STDAFX_H +#define STDAFX_H + + +// Predefinitions for windows.h go here +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +// Specify Win32xx specific predefinitions here +//#define NO_USING_NAMESPACE // Don't use Win32xx namespace + +// Rarely modified header files should be included here +#include // Add support for std::vector +#include // Add support for std::map +#include // Add support for std::string +#include // Add support for stringstream +#include // Add support for the assert macro +#include // Add support for C style printf, sprintf, etc. +#include // Add support for C style character conversions atoi etc. +#include // Add support for C style TCHARs. + +// Add the Win32++ library +#include // Add CWinApp +#include // Add CArchive +#include // Add CAnimation, CComboBox, CComboBoxEx, CDateTime, CHeader, CHotKey, CIPAddress, CProgressBar, CSpinButton, CScrollBar, CSlider, CToolTip +#include // Add CCriticalSection, CThreadLock +#include // Add CString, CStringA, CStringW +#include // Add CDataExchange +#include // Add CDialog, CResizer +#include // Add CDockFrame, CMDIDockFrame +#include // Add CDocker, CDockContainer +#include // Add CException, CFileException, CNotSupportedException, CResourceException, CUserException, CWinException +#include // Add CFile +#include // Add CFileFind +#include // Add CFolderDialog +#include // Add CFrame +#include // Add CDC, CGDIObject, CBitmap, CBrush, CFont, CPalatte, CPen, CRgn +#include // Add CHGlobal +#include // Add CImageList +#include // Add CListView +#include // Add CMDIChild, CMDIFrame, CDockMDIFrame +#include // Add CMenu +#include // Add CMenuBar +#include // Add CMetaFile, CEnhMetaFile +#include // Add CEvent, CMutex, CSemaphore +#include // Add CPropertyPage, CPropertySheet +#include // Add CRebar +#include // Add CPoint, CRect, CSize +#include // Add CRegKey +#include // Add CRichEdit +#include // Add CScrollView +#include // Adds macros, windows header files, and CObject +#include // Add CSocket +#include // Add CStatusBar +#include // Add CButton, CEdit, CListBox +#include // Add CTab, CTabbedMDI +#include // Add AtoT, AtoW, TtoA, TtoW, WtoA, WtoT etc. +#include // Add MenuTheme, ReBarTheme, StatusBarTheme, ToolBarTheme +#include // Add CWinThread +#include // Add CTime +#include // Add CToolBar +#include // Add CTreeView +#include // Add CWebBrowser, CAXHost +#include // Add CWnd + +// WIN32_LEAN_AND_MEAN can't be used with these +#ifndef WIN32_LEAN_AND_MEAN + #include // Add CCommonDialog, CColorDialog, CFileDialog, CFindReplace, CFontDialog + #include // Add CFolderDialogEx + #include // Add CPrintPreview + #include // Add CPageSetupDialog, CPrintDialog + #include // Add CPrintDialogEx + #include // Add CTaskDialog + + // Visual Studio + #if defined (_MSC_VER) + #include // Add CRibbon, CRibbonFrame + #endif + +#endif // define WIN32_LEAN_AND_MEAN + +#endif // define STDAFX_H diff --git a/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console.cbp b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console.cbp new file mode 100644 index 00000000..3670650f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console.cbp @@ -0,0 +1,130 @@ + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console.cbproj b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console.cbproj new file mode 100644 index 00000000..a0588b0f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console.cbproj @@ -0,0 +1,1332 @@ + + + {379386BA-EB1B-48DC-81A0-53ECF15D3811} + 20.1 + None + True + Debug + Win64x + 1048579 + Console + Console + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + JPHNE + .\Embarcadero\$(Platform)\$(Config) + .\Embarcadero\$(Platform)\$(Config) + false + true + true + $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + CppConsoleApplication + System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + true + ..\..\..\include\;..\src\;..\..\..\include;$(IncludePath) + ..\..\..\include\;..\src\;..\Documents\Visual Studio Projects\C++\Win32++\samples\Console\src\;..\..\..\Visual Studio Projects\C++\Win32++\samples\Console\src\;$(ILINK_LibraryPath) + <_TCHARMapping>char + Console + 3081 + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + $(BDS)\bin\cbuilder_PROJECTICON.ico + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + 1033 + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + 1033 + + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + 1033 + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + wxx_hglobal.h + + + false + true + false + true + _DEBUG;$(Defines) + false + None + DEBUG + true + true + true + true + Full + true + true + true + true + true + $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) + $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + + + false + $(BDSLIB)\$(PLATFORM)$(CC_SUFFIX)\debug;$(ILINK_LibraryPath) + 1033 + (None) + none + + + .\Embarcadero\$(Platform)\$(Config) + 1033 + (None) + none + + + NDEBUG;$(Defines) + None + + + false + + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 54 + + + 0 + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + + + + CPlusPlusBuilder.Personality.12 + CppConsoleApplication + + + + False + True + True + False + + + Embarcadero C++Builder Office 2000 Servers Package + Embarcadero C++Builder Office XP Servers Package + + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + Console.exe + true + + + + + Console.exe + true + + + + + Console.exe + true + + + + + 1 + + + 0 + + + + + classes + 64 + + + classes + 64 + + + + + res\xml + 1 + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\mips + 1 + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-v21 + 1 + + + res\values-v21 + 1 + + + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + + + + 1 + + + 1 + + + 0 + + + + + 1 + .framework + + + 1 + .framework + + + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 1 + + + 1 + + + + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 0 + + + + + library\lib\armeabi-v7a + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + + + + 1 + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + + + + + + + + + + + + + True + True + True + + + 12 + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2015.sln b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2015.sln new file mode 100644 index 00000000..bd5992aa --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2015.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Console", "Console_2015.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2015.vcxproj b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2015.vcxproj new file mode 100644 index 00000000..38880ba9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2015.vcxproj @@ -0,0 +1,234 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Console + Console + + + + Application + Unicode + v140_xp + + + Application + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + + + + + + + + + + + + + + + + + true + false + + + true + false + + + false + false + + + false + false + + + + NotUsing + Level4 + true + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Console + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + NotUsing + Level4 + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Console + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + NotUsing + ProgramDatabase + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Console + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + NotUsing + ProgramDatabase + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Console + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2019.sln b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2019.sln new file mode 100644 index 00000000..8e121c5e --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2019.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Console", "Console_2019.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {9AA56320-1E07-4B5A-BE07-43BCBF539751} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2019.vcxproj b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2019.vcxproj new file mode 100644 index 00000000..a4e7e252 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2019.vcxproj @@ -0,0 +1,213 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Console + Console + + + + v142 + Unicode + + + v142 + Unicode + + + true + v142 + Unicode + + + true + v142 + Unicode + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + NotUsing + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Console + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + NotUsing + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Console + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + NotUsing + ProgramDatabase + MaxSpeed + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Console + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + NotUsing + ProgramDatabase + MaxSpeed + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Console + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2019.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2019.vcxproj.filters new file mode 100644 index 00000000..eaaf1296 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2019.vcxproj.filters @@ -0,0 +1,186 @@ + + + + + {7cb94ed4-a0b7-40cd-b45f-49752643cc75} + + + {d92cbbbd-e57b-4cb8-a8c1-1bce70dff9e6} + + + {f72dfcfe-2491-4a46-a6bb-2178a5d6c7dd} + + + + + Source Files + + + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2022.sln b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2022.sln new file mode 100644 index 00000000..f3cc0ad7 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2022.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Console", "Console_2022.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {61ECBA5E-8C5F-4205-A138-8B002E765055} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2022.vcxproj b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2022.vcxproj new file mode 100644 index 00000000..f165d22b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2022.vcxproj @@ -0,0 +1,221 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Console + Console + 10.0 + + + + v143 + Unicode + + + v143 + Unicode + + + true + v143 + Unicode + + + v143 + Unicode + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + NotUsing + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Console + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + NotUsing + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Console + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + NotUsing + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Console + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + NotUsing + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Console + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2022.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2022.vcxproj.filters new file mode 100644 index 00000000..e3b60e42 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2022.vcxproj.filters @@ -0,0 +1,186 @@ + + + + + {7cb94ed4-a0b7-40cd-b45f-49752643cc75} + + + {d92cbbbd-e57b-4cb8-a8c1-1bce70dff9e6} + + + {2550ebe8-22be-4b7c-9976-16235e513fce} + + + + + Source Files + + + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2026.slnx b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2026.slnx new file mode 100644 index 00000000..66187f2d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2026.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2026.vcxproj b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2026.vcxproj new file mode 100644 index 00000000..6fd2d05c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2026.vcxproj @@ -0,0 +1,221 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Console + Console + 10.0 + + + + v145 + Unicode + + + v145 + Unicode + + + true + v145 + Unicode + + + v145 + Unicode + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + NotUsing + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Console + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + NotUsing + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Console + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + NotUsing + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Console + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + NotUsing + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Console + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2026.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2026.vcxproj.filters new file mode 100644 index 00000000..f8e9dff6 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Console/ProjectFiles/Console_2026.vcxproj.filters @@ -0,0 +1,186 @@ + + + + + {7cb94ed4-a0b7-40cd-b45f-49752643cc75} + + + {d92cbbbd-e57b-4cb8-a8c1-1bce70dff9e6} + + + {2550ebe8-22be-4b7c-9976-16235e513fce} + + + + + Source Files + + + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Console/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/Console/Readme.txt new file mode 100644 index 00000000..3c6e3698 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Console/Readme.txt @@ -0,0 +1,10 @@ +Console Sample +============== +This program demonstrates how to use the the Win32++ library in a console +application. The Win32++ library contains features such as CString and +CSocket which can be used in console applications. + + +Features demonstrated in this example +===================================== +* Using CString in a console application diff --git a/packages/media/cpp/packages/Win32xx/samples/Console/src/main.cpp b/packages/media/cpp/packages/Win32xx/samples/Console/src/main.cpp new file mode 100644 index 00000000..9c1e1589 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Console/src/main.cpp @@ -0,0 +1,19 @@ +///////////////////////////// +// main.cpp +// + +#include +#include "wxx_cstring.h" // Includes CString from Win32++. +// #include "wxx_socket.h" // Includes network support from Win32++. +// #include "stdafx.h" // Include the entire Win32++ library. + +using namespace std; + +int main() +{ + // Demonstrate the use of CString with wcout. + CString text = "Hello world"; + wcout << text.c_str() << endl; + + return 0; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/Console/src/stdafx.h b/packages/media/cpp/packages/Win32xx/samples/Console/src/stdafx.h new file mode 100644 index 00000000..08450116 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Console/src/stdafx.h @@ -0,0 +1,90 @@ +///////////////////////////// +// StdAfx.h +// + +// This file is used for precompiled headers. +// Rarely modified header files should be included. +// Based on code provided by Lynn Allan. + + +#ifndef STDAFX_H +#define STDAFX_H + + +// Predefinitions for windows.h go here +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +// Specify Win32xx specific predefinitions here +//#define NO_USING_NAMESPACE // Don't use Win32xx namespace + +// Rarely modified header files should be included here +#include // Add support for std::vector +#include // Add support for std::map +#include // Add support for std::string +#include // Add support for stringstream +#include // Add support for the assert macro +#include // Add support for C style printf, sprintf, etc. +#include // Add support for C style character conversions atoi etc. +#include // Add support for C style TCHARs. + +// Add the Win32++ library +#include // Add CWinApp +#include // Add CArchive +#include // Add CAnimation, CComboBox, CComboBoxEx, CDateTime, CHeader, CHotKey, CIPAddress, CProgressBar, CSpinButton, CScrollBar, CSlider, CToolTip +#include // Add CCriticalSection, CThreadLock +#include // Add CString, CStringA, CStringW +#include // Add CDataExchange +#include // Add CDialog, CResizer +#include // Add CDockFrame, CMDIDockFrame +#include // Add CDocker, CDockContainer +#include // Add CException, CFileException, CNotSupportedException, CResourceException, CUserException, CWinException +#include // Add CFile +#include // Add CFileFind +#include // Add CFolderDialog +#include // Add CFrame +#include // Add CDC, CGDIObject, CBitmap, CBrush, CFont, CPalatte, CPen, CRgn +#include // Add CHGlobal +#include // Add CImageList +#include // Add CListView +#include // Add CMDIChild, CMDIFrame, CDockMDIFrame +#include // Add CMenu +#include // Add CMenuBar +#include // Add CMetaFile, CEnhMetaFile +#include // Add CEvent, CMutex, CSemaphore +#include // Add CPropertyPage, CPropertySheet +#include // Add CRebar +#include // Add CPoint, CRect, CSize +#include // Add CRegKey +#include // Add CRichEdit +#include // Add CScrollView +#include // Adds macros, windows header files, and CObject +#include // Add CSocket +#include // Add CStatusBar +#include // Add CButton, CEdit, CListBox +#include // Add CTab, CTabbedMDI +#include // Add AtoT, AtoW, TtoA, TtoW, WtoA, WtoT etc. +#include // Add MenuTheme, ReBarTheme, StatusBarTheme, ToolBarTheme +#include // Add CWinThread +#include // Add CTime +#include // Add CToolBar +#include // Add CTreeView +#include // Add CWebBrowser, CAXHost +#include // Add CWnd + +// WIN32_LEAN_AND_MEAN can't be used with these +#ifndef WIN32_LEAN_AND_MEAN + #include // Add CCommonDialog, CColorDialog, CFileDialog, CFindReplace, CFontDialog + #include // Add CFolderDialogEx + #include // Add CPrintPreview + #include // Add CPageSetupDialog, CPrintDialog + #include // Add CPrintDialogEx + #include // Add CTaskDialog + + // Visual Studio + #if defined (_MSC_VER) + #include // Add CRibbon, CRibbonFrame + #endif + +#endif // define WIN32_LEAN_AND_MEAN + +#endif // define STDAFX_H diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp.cbp b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp.cbp new file mode 100644 index 00000000..467116b1 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp.cbp @@ -0,0 +1,151 @@ + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp.cbproj b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp.cbproj new file mode 100644 index 00000000..7b6e1c98 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp.cbproj @@ -0,0 +1,1564 @@ + + + {39461456-1040-43CB-9B40-5962EF847BB0} + 20.1 + None + True + Release + Win64x + 1048579 + Application + ContextHelp + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + JPHNE + .\Embarcadero\$(Platform)\$(Config) + .\Embarcadero\$(Platform)\$(Config) + false + true + true + $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + CppGuiApplication + System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + true + <_TCHARMapping>wchar_t + ContextHelp + ..\..\..\include\;..\src\;$(IncludePath) + ..\..\..\include\;..\src\;$(ILINK_LibraryPath) + 3081 + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + $(BDSINCLUDE)\windows\sdk;$(BRCC_IncludePath) + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + ..\src\stdafx.h + none + + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + false + true + false + true + _DEBUG;$(Defines) + false + None + DEBUG + true + true + true + true + Full + true + true + true + true + true + $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) + $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + + + PerMonitorV2 + false + $(BDSLIB)\$(PLATFORM)$(CC_SUFFIX)\debug;$(ILINK_LibraryPath) + true + 1033 + + + PerMonitorV2 + true + 1033 + + + PerMonitorV2 + true + 1033 + + + NDEBUG;$(Defines) + None + + + PerMonitorV2 + false + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 0 + + + 1 + + + 2 + + + 3 + + + 4 + + + 5 + + + 6 + + + 7 + + + 8 + + + 9 + + + 10 + + + 11 + + + 12 + + + 13 + + +
Resource.res
+ 14 +
+ + 15 + + + 16 + true + + + 18 + + + 19 + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + +
+ + CPlusPlusBuilder.Personality.12 + CppGuiApplication + + + + False + True + True + False + + + Embarcadero C++Builder Office 2000 Servers Package + Embarcadero C++Builder Office XP Servers Package + + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + Assets\ + Logo150x150.png + true + + + + + Assets\ + Logo44x44.png + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + .\ + true + + + + + ContextHelp.exe + true + + + + + ContextHelp.exe + true + + + + + ContextHelp.exe + true + + + + + ContextHelp.exe + true + + + + + NewProject.exe + true + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 64 + + + classes + 64 + + + + + res\xml + 1 + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\mips + 1 + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-v21 + 1 + + + res\values-v21 + 1 + + + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + Contents + 1 + + + Contents + 1 + + + Contents + 1 + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + library\lib\armeabi-v7a + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen + 64 + + + ..\$(PROJECTNAME).launchscreen + 64 + + + + + 1 + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + + + + + + + + + + + + + True + True + True + + + 12 + + + + +
diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2015.sln b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2015.sln new file mode 100644 index 00000000..94e45182 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2015.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ContextHelp", "ContextHelp_2015.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2015.vcxproj b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2015.vcxproj new file mode 100644 index 00000000..52ad5c07 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2015.vcxproj @@ -0,0 +1,257 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + ContextHelpDemo + ContextHelp + + + + Application + Unicode + v140_xp + + + Application + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + + + + + + + + + + + + + + + + + true + false + + + true + false + + + false + false + + + false + false + + + + Use + Level4 + true + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;shlwapi.lib;htmlhelp.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shlwapi.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;htmlhelp.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;shlwapi.lib;htmlhelp.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shlwapi.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;htmlhelp.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2015.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2015.vcxproj.filters new file mode 100644 index 00000000..c3908f42 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2015.vcxproj.filters @@ -0,0 +1,245 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + {d9a16de6-37e5-48be-b476-76a20843fa1c} + + + {fca2ddec-62b5-40e1-bd4e-7a02bfa7e539} + + + {544eb3f5-971e-4d92-83af-4d38df111efb} + + + {9430e960-e608-4729-a060-87873b194481} + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2019.sln b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2019.sln new file mode 100644 index 00000000..6db98549 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2019.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ContextHelp", "ContextHelp_2019.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {2CE63725-50F7-4213-98E6-6058D139C791} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2019.vcxproj b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2019.vcxproj new file mode 100644 index 00000000..a4d729cc --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2019.vcxproj @@ -0,0 +1,236 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + ContextHelp + ContextHelp + + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;shlwapi.lib;htmlhelp.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;shlwapi.lib;htmlhelp.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;shlwapi.lib;htmlhelp.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;shlwapi.lib;htmlhelp.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2019.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2019.vcxproj.filters new file mode 100644 index 00000000..a393ba18 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2019.vcxproj.filters @@ -0,0 +1,245 @@ + + + + + {1fd8f887-fdad-4c72-a536-d93eb9feb99a} + + + {85dfab0c-18b3-4e31-b146-79096145b83e} + + + {9cbf3346-52c0-44f6-b5dc-71d7080bebb5} + + + {62251ab6-34ee-4d73-baf5-5fa0c095421c} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2022.sln b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2022.sln new file mode 100644 index 00000000..c72a0959 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2022.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ContextHelp", "ContextHelp_2022.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {194B5B3B-CF4D-49C7-8BB7-86546A386D4E} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2022.vcxproj b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2022.vcxproj new file mode 100644 index 00000000..5dda9d06 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2022.vcxproj @@ -0,0 +1,245 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + ContextHelp + ContextHelp + 10.0 + + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;shlwapi.lib;htmlhelp.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;shlwapi.lib;htmlhelp.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;shlwapi.lib;htmlhelp.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;shlwapi.lib;htmlhelp.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2022.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2022.vcxproj.filters new file mode 100644 index 00000000..a393ba18 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2022.vcxproj.filters @@ -0,0 +1,245 @@ + + + + + {1fd8f887-fdad-4c72-a536-d93eb9feb99a} + + + {85dfab0c-18b3-4e31-b146-79096145b83e} + + + {9cbf3346-52c0-44f6-b5dc-71d7080bebb5} + + + {62251ab6-34ee-4d73-baf5-5fa0c095421c} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2026.slnx b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2026.slnx new file mode 100644 index 00000000..54a16b11 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2026.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2026.vcxproj b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2026.vcxproj new file mode 100644 index 00000000..fa08e2d2 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2026.vcxproj @@ -0,0 +1,245 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + ContextHelp + ContextHelp + 10.0 + + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;shlwapi.lib;htmlhelp.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;shlwapi.lib;htmlhelp.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;shlwapi.lib;htmlhelp.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;shlwapi.lib;htmlhelp.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2026.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2026.vcxproj.filters new file mode 100644 index 00000000..1b1bede5 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_2026.vcxproj.filters @@ -0,0 +1,245 @@ + + + + + {1fd8f887-fdad-4c72-a536-d93eb9feb99a} + + + {85dfab0c-18b3-4e31-b146-79096145b83e} + + + {9cbf3346-52c0-44f6-b5dc-71d7080bebb5} + + + {62251ab6-34ee-4d73-baf5-5fa0c095421c} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_DEBUG.dev b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_DEBUG.dev new file mode 100644 index 00000000..8b43b2ef --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_DEBUG.dev @@ -0,0 +1,251 @@ +[Project] +FileName=ContextHelp_DEBUG.dev +Name=ContextHelp +UnitCount=19 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs=..\lib\MinGW +PrivateResource=ContextHelp_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D _DEBUG_@@_-g_@@_-O0_@@_-DUNICODE_@@_-D_UNICODE_@@__@@__@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lUuid_@@_-lOleaut32_@@_-lWs2_32_@@_-lshlwapi_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Debug +ObjectOutput=.\Dev-C++\Debug +OverrideOutput=1 +OverrideOutputName=ContextHelp.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=4 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit1] +FileName=..\src\App.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\App.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\Doc.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\Doc.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\View.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\View.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\Mainfrm.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit8] +FileName=..\src\Mainfrm.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit11] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit12] +FileName=..\src\stdafx.h +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit13] +FileName=..\src\ContextHelp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit14] +FileName=..\src\ContextHelp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit10] +FileName=..\src\Resource.rc +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit15] +FileName=..\src\HelpAbout.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit16] +FileName=..\src\HelpAbout.h +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit17] +FileName=..\src\AppHelp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit18] +FileName=..\src\AppHelp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit19] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit20] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_RELEASE.dev b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_RELEASE.dev new file mode 100644 index 00000000..72404ca7 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/ProjectFiles/ContextHelp_RELEASE.dev @@ -0,0 +1,251 @@ +[Project] +FileName=ContextHelp_RELEASE.dev +Name=ContextHelp +UnitCount=19 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs=..\lib\MinGW +PrivateResource=ContextHelp_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-g_@@_-DUNICODE_@@_-D_UNICODE_@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lUuid_@@_-lOleaut32_@@_-lWs2_32_@@_-lshlwapi_@@_-s_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Release +ObjectOutput=.\Dev-C++\Release +OverrideOutput=1 +OverrideOutputName=ContextHelp.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=3 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit1] +FileName=..\src\App.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\App.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\Doc.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\Doc.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\View.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\View.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\Mainfrm.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit8] +FileName=..\src\Mainfrm.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit11] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit12] +FileName=..\src\stdafx.h +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit13] +FileName=..\src\ContextHelp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit14] +FileName=..\src\ContextHelp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit10] +FileName=..\src\Resource.rc +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit15] +FileName=..\src\HelpAbout.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit16] +FileName=..\src\HelpAbout.h +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit17] +FileName=..\src\AppHelp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit18] +FileName=..\src\AppHelp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit19] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit20] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/Readme.txt new file mode 100644 index 00000000..311fa9a4 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/Readme.txt @@ -0,0 +1,47 @@ +ContextHelpDemo Example +======================= +This program has a frame window which includes a Tool Bar and +Status Bar. A modeless dialog is used as the view window of our frame. + +Context help topics are initiated using the F1 key, the Shift-F1 key, the +"?" in the title bar, or a context help button on the toolbar. + +When the context help is initiated, the user chooses the help topic to +be displayed with a mouse click on the frame's client or non-client +area. Once the help topic is chosen, the ContextHelp.chm help file is +opened in a window and displays the chosen topic. + + +Instructions +============ +When the program is first run, it copies the ContextHelp.chm file from the +help folder to the %AppData%\Win32++\ContextHelp folder. Alternatively, run +the Install.bat file located in the Setup folder to copy the ContextHelp.chm +file there. + +The program will also find and use the ContextHelp.chm file if it is located +in the same folder as the program's executable. + + +Features demonstrated in this example +===================================== +* Use of CFrame to provide a frame window +* Using a modeless dialog as a view window for the frame. +* Implementing a Doc/View architecture much like MFC. +* Saving the dialog's settings in the registry. +* Use of OnMenuUpdate to update check state of menu items. +* A CAppHelp class which provides access to the context sensitive help, + and the Help About dialog. +* A toolbar with an expanded number of images sized 24x24 pixels to illustrate + a more comprehensive set of topics within the manual. +* The use of a separate bitmap containing a set of images sized 16x16 pixels + for the various menu items. + + +About Compiled Help User Manuals +================================ +Compiled help user manuals have a chm extension. They are compiled from a set +of HTML files using the Microsoft Help Workshop. The HTML files can be created +using an ordinary text editor or HTML editor. Consult the ContestHelpDemo.chm +user manual topic "Creating Help Files" for complete instructions. + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/Setup/ContextHelp.chm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/Setup/ContextHelp.chm new file mode 100644 index 00000000..6be9ba57 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/Setup/ContextHelp.chm differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/Setup/Install.bat b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/Setup/Install.bat new file mode 100644 index 00000000..9eed2475 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/Setup/Install.bat @@ -0,0 +1,20 @@ +@ECHO OFF +REM A batch file that creates and populates folders within +rem %AppData% + +ECHO Create the folders within %AppData% + +ECHO. +ECHO Creating the Win32++ folder +mkdir "%AppData%\Win32++" + +ECHO. +ECHO Creating the ContextHelp folder +mkdir "%AppData%\Win32++\ContextHelp" + +ECHO. +ECHO Copy the files to the AppData folder +copy ContextHelp.chm "%AppData%\Win32++\ContextHelp" + +ECHO. +PAUSE diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/Setup/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/Setup/Readme.txt new file mode 100644 index 00000000..64b0632e --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/Setup/Readme.txt @@ -0,0 +1,26 @@ +This folder contains the projects help and settings file. +Run the Install.bat file to copy these files to the user's AppData folder. + +Note: +Some .CHM files may not render properly on Windows XP, Windows Vista, +Windows 7, Windows 8.1, Windows 10 and Windows 11. + +When attempting to open a Compiled HTML Help (.CHM) file, the file may open +but display one of the following messages instead of the expected content: + + * Navigation to the web page was cancelled. + * Action cancelled. + +To resolve this issue, carry out the following steps: + + 1. Right-click the .CHM file and choose Properties + 2. On the General tab, click the button labelled "Unblock" + 3. Click OK + +For further information in this issue, refer to the following Microsoft articles. + +For Windows XP +http://support.microsoft.com/kb/902225 + +For Windows Vista and Windows 7 +http://support.microsoft.com/kb/2021383 \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/Adding HTML Help to MinGW.html b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/Adding HTML Help to MinGW.html new file mode 100644 index 00000000..604c1ab0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/Adding HTML Help to MinGW.html @@ -0,0 +1,161 @@ + + + +Compiled HTML Help for MinGW Win32 Application + + + +

Adding Compiled HTML Help to a MinGW Win32 Application

+
    + +
  • Get MS HTML Help Workshop

    +
      +
    • Go to MSDN, download (free) the help workshop and install.
    • +
    • In C:\Program Files\HTML Help Workshop\include there's a header file htmlhelp.h. Put a copy in C:\MinGW\include.
    • +
    • In C:\Program Files\HTML Help Workshop\lib there's a library +file htmlhelp.lib. Put a copy in C:\MinGW\lib under the name +libhtmlhelp.a. Renaming to the MinGW convention is not actually +necessary, but it makes the nature of the file clearer. As found by the +MinGW project staff, this file is a static library that calls +LoadLibrary/GetProcAddress to access the file +C:\WINDOWS\SYSTEM32\hhctrl.ocx, not an import library, and can be linked + by ld.
    • +

    +
  • + +
  • Create the help file

    +

    No directions will be given here for producing a compiled help file +with the workshop. At the simplest, a single-page HTML file can be +"compressed" in the Workshop, omitting contents, index and word search. +(The CHM for a simple HTML file was bigger than the original, presumably + from overhead in the CHM format.)

    +
  • + +
  • Include a Help Menu in your sources

    +
      +
    • WinMain and Window Procedure

      +
      #include <htmlhelp.h>          // the HTML Help Workshop header
      +#include "resource.h"          // resource header, see below
      +TCHAR szAppName[]= "MYPROG";   // initialize pointer
      +...
      +     wndclass.lpszMenuName  =  szAppName ;
      +...
      +     hwnd = CreateWindow (...
      +...
      +LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
      +                          LPARAM lParam)
      +{
      +     static HWND        hwndHelp ;
      +     
      +     switch (message)
      +     {
      +...		 
      +     case WM_COMMAND:
      +          switch (LOWORD (wParam))
      +          {
      +... messages from other menus, perhaps
      +                    // Messages from Help menu
      +               
      +          case IDM_HELP:
      +               hwndHelp = HtmlHelp (hwnd, "c:\\...\\myprog.chm", 
      +                                (UINT)NULL, (DWORD)NULL) ;
      +               // See the HTML Help API Reference help topic in HTML Help Workshop
      +               return 0 ;
      +... other items on the Help menu, perhaps (e.g., About)               
      +          }
      +          break ;
      +               
      +     }
      +     return DefWindowProc (hwnd, message, wParam, lParam) ;
      +}
      +
      +
      +

      The fragments above assume a C source file with WinMain and window +procedure WndProc, and presume familiarity with basic WinMain/WndProc +concepts, particularly the message loop and message handling. The +simplest way to make the menu resource defined in the resource file +below available is to use the same text string for the menu identifier +there as used for as the application name in the program. In the example + above szAppName is made a pointer to the string "MYPROG" and used to +intialize member lpszMenuName of the window class. Pointer szAppName is +available for other uses, including initializing member lpszClassName +for instance. Of course for only identifying the menu, you could instead + use

      +
           wndclass.lpszMenuName  =  "MYPROG" ;
      +

      and dispense with szAppName. Petzold's Programming Windows, +5th edition, pp. 441-442 and sample program MENUDEMO.C, discusses in +detail this and other methods of making the menu available to your +program. HWND hwnd is the handle to the main window created in WinMain. A + call to function HtmlHelp (described in the HTML Help Workshop help: +HTML Help References/HTML Help API Reference) opens the compiled HTML +help. The four function arguments are the handle to the calling (main) +window, the path of the compiled help file, and two others that allow +opening the help at particular topics. Here, the help file is a single +page of HTML and these arguments are set to values that the compiler +doesn't fuss at. If you create a more ambitious help file, you would +presumably know how to use the features provided by the last two +arguments. The C string for the path conforms to C conventions, so the +Windows backslash directory separators have to be doubled. To make sure +the mechanics of including a help file are working before investing a +lot of time creating the help file, you could just name one of the +hundreds of CHM files on current versions of Windows.

      +
    • +
    • Resource File

      +
      #include <winresrc.h>
      +#include "resource.h"  // resource header, see below
      +/////////////////////////////////////////////////////////////////////////////
      +// Menu
      +
      +MYPROG MENU DISCARDABLE 
      +{
      +    POPUP "&Help"
      +    {
      +        MENUITEM "&Help",                       IDM_HELP
      +    }
      +}
      +
      +
      +

      What a pain! another syntax to learn if you're doing it all yourself. + Of course, IDEs do resource files (and their headers) automatically. +This is a resource file for a menu bar with only a Help pop-up on it and + with Help as the only menu item on the pop-up. Integrate this into a +more general menu with File, etc., if there is one. MSDN, of course, +documents resource files, and many examples are to be found in Petzold and no doubt on line.

      +
    • +
    • Resource Header "resource.h"

      +
      #define IDM_HELP                        40005
      +
      +

      Here of course the actual value that IDM_HELP is a mnemonic for is defined. In Petzold's Programming Windows + where the resource files and headers are generated by MSVC, values +start with 40001. Apparently, 40000 and up is a safe range for these +values. The resource and header files above were chopped down from a +more general menu, so that's why the value is 40005.

      +
    • +
    +
  • + +
  • Build your application

    +

    Here's a makefile to build an application myprog where Cmyprog.c is +the all the C source code (including WinMain and the window procedure), +Rmyprog.rc is the resource file, and resource.h is the resource header.

    +
    LIBS = -lhtmlhelp -lcomctl32 -lcomdlg32 -lwinmm -ladvapi32 -lwinspool
    +all: myprog.exe
    +myprog.exe: Cmyprog.o Rmyprog.o
    +	gcc -mwindows -o myprog.exe Cmyprog.o Rmyprog.o $(LIBS)
    +Cmyprog.o: Cmyprog.c
    +	gcc -c -o Cmyprog.o Cmyprog.c
    +Rmyprog.o: Rmyprog.rc resource.h
    +	windres Rmyprog.rc Rmyprog.o
    +
    +

    It's possible that some of the WINAPI libraries in LIBS are +unnecessary when the required -mwindows flag is invoked. (This is John +Kopplin's belt-and-suspenders list for compiling examples in Petzold's Programming Windows.) Including -lhtmlhelp is vital, of course. Or, just from the DOS prompt:

    +
    gcc -c -o Cmyprog.o Cmyprog.c
    +windres Rmyprog.rc Rmyprog.o
    +gcc -mwindows -o myprog.exe Cmyprog.o Rmyprog.o -lhtmlhelp -lcomctl32 -lcomdlg32 -lwinmm -ladvapi32 -lwinspool
    +
    +
  • +
+ + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/AppHelpUsage.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/AppHelpUsage.htm new file mode 100644 index 00000000..fd2b03ed --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/AppHelpUsage.htm @@ -0,0 +1,156 @@ + + + + + Using the AppHelp Class + + + + + + + + + + + + + + +
+
+

Using the AppHelp Class

+
+ Getting Started ›› +
+
+ +
+ Parent + + Previous + + Next + +
+ +
+
+
+ +


+

+ This class provides access to help information in two forms: First, as + a modeless dialog bearing whatever information, or "credits," the user + desires to post there; this dialog is commonly called the "About Box", + and it is made to appear whenever the + IDM_HELP_ABOUT message is sent to + the frame's OnCommand() method. This invokes the + AppHelp::About() constructor. + Typically, an application will invoke this form of help by + activating the Help->About + topic on the main menu. +

+ +


+

+ The second form is the display of topical information held in a Compiled + HTML (.chm) file. This file + contains a set of "topics", or strings that + may be searched for using a special htmlhelp object. When it is sent + one of the topic strings, the .chm + help file is searched for an entry + matching the topic. If found, the corresponding manual page displays. + String topics are made to correspond to control IDs by the + AppHelp::AddHelpTopic() member. +

+ +


+

+ Assistance in peparing the help guide to contain the application's + topics may be found in the file +

+ +


+
+	Adding HTML Help to MinGW.html
+
+ +


+

+ which is included in the help directory of this sample program. It may + also be accessed at a number of sites using an internet search. While + being oriented to the MinGW compiler specifically, this article relates, + by inference, how to do this for other platforms. +

+ +


+

+ This topical type of help is termed "context help mode", and may be + invoked in one of several ways. The usual help mode is intended to use + the F1 function key, either as F1 itself, or as Shift+F1. Whenever + either one of these keys is pressed, the system sends the main window + a IDM_F1 or + IDM_SHIFT_F1 message, to which the + application sends to the AppHelp class + for response. When the F1 key is the one pressed, AppHelp responds by + displaying any topic that has been assigned to the control having + current keyboard or mouse focus. +

+ +


+

+ When Shift+F1 is pressed, the AppHelp class causes the cursor to change + its shape from the application cursor to the help-cursor, which takes + the shape of a question mark. The next control that is selected by + mouse, accelerator key, or tab navigation will cause the topic assigned + to that control ID to be displayed. At this point the application cursor + is restored. +

+ +


+

+ The Shift+F1 style of context help may also be invoked by selecting + either of the context help buttons, on the toolbar or on the caption bar. +

+ +


+

+ The suite of files comprising the suite of help functions is composed of +

+ +


+
+	AppHelp.h	declaration of the AppHelp class
+	AppHelp.cpp     implementation of the AppHelp class
+	ContextHelp.h	declaration of context help part of AppHelp
+	ContextHelp.cpp	implementatin of the context help methods
+	HelpAbout.h	declaration of the AboutBox part of AppHelp
+	HelpAbout.cpp	implementation of the AboutBox dialog
+	resource.h	defines help function resource IDs
+	resource.rc	contains AppHelp resources
+
+ + +


+

+ Consult the usage of these elements in the ContextHelp sample program for more information on using these features. +

+


+


+


+


+ +
+ + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/AppTitleBar.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/AppTitleBar.htm new file mode 100644 index 00000000..e30e0338 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/AppTitleBar.htm @@ -0,0 +1,53 @@ + + + + Application Caption + + + + + + + + + + + + + + +
+
+

Application Title Bar

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

+The Application Title Bar appears at the top of the application window and consists of the Application Icon, a WindowText area, and window minimize, maximize, and exit control buttons.

+

+ +
+ + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/BitmapContent.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/BitmapContent.htm new file mode 100644 index 00000000..8f96e34a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/BitmapContent.htm @@ -0,0 +1,53 @@ + + + + The Bitmap Box + + + + + + + + + + + + + + +
+
+

The Bitmap Box

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

+The bitmap displayed on the form is one labeled "Zapotec". What this particular bitmap has to do with the Zapotec people, who were an indigenous pre-Columbian civilization that flourished in the Valley of Oaxaca in Mesoamerica over 2500 years ago, is unknown. The bitmap appears on a number of forms in this series of sample programs.

+

+ +
+ + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/Button1Usage.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/Button1Usage.htm new file mode 100644 index 00000000..a87e201f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/Button1Usage.htm @@ -0,0 +1,54 @@ + + + + Other Button Usage + + + + + + + + + + + + +
+
+

Other Button Usage

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+ +
+ +


+ +

+The button in the client window labeled "Button" in this samplle program merely communicates that it has been pressed when selected by the mouse. +

+ +
+ + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/CheckBoxUsage.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/CheckBoxUsage.htm new file mode 100644 index 00000000..9f5596da --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/CheckBoxUsage.htm @@ -0,0 +1,53 @@ + + + + Check Box Usage + + + + + + + + + + + + + + +
+
+

Check Box Usage

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

+There are three check boxes in the application form. These currently do nothing, but illustrate the changes in state when left-clicked by the mouse.

+

+ +
+ + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/ContextHelp.chm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/ContextHelp.chm new file mode 100644 index 00000000..6be9ba57 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/ContextHelp.chm differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/ContextHelp.hhp b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/ContextHelp.hhp new file mode 100644 index 00000000..fb27229f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/ContextHelp.hhp @@ -0,0 +1,13 @@ +[OPTIONS] +Compatibility=1.1 or later +Compiled file=ContextHelp.chm +Contents file=toc.hhc +Default topic=introduction.htm +Display compile progress=No +Index file=Index.hhk +Language=0x409 English (United States) +Title=Context Help + + +[INFOTYPES] + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/FeatureNotDescribed.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/FeatureNotDescribed.htm new file mode 100644 index 00000000..7ba2856f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/FeatureNotDescribed.htm @@ -0,0 +1,52 @@ + + + + Feature Not Described + + + + + + + + + + + + + + +
+
+

Feature Not Found

+ + +
+
+ Parent + + Previous + +
+
+
+
+ +

+

This topic has not yet been supplied. See “Getting help” earlier in this manual for assistance in creating and describing topics.

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/FileDialogNewHelp.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/FileDialogNewHelp.htm new file mode 100644 index 00000000..47f23e38 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/FileDialogNewHelp.htm @@ -0,0 +1,54 @@ + + + + File Dialog New Help + + + + + + + + + + + + + + +
+
+

File Dialog New Help

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

This function creates the file-new dialog box that lets the user specify the drive, directory, and the name of a file  to open as the basis of a new document.  In this demo, however, no file is actually opened.

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/Index.hhk b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/Index.hhk new file mode 100644 index 00000000..2e24f6f3 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/Index.hhk @@ -0,0 +1,9 @@ + + + + + + +
    +
+ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/RadioButtonUsage.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/RadioButtonUsage.htm new file mode 100644 index 00000000..bdd8629b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/RadioButtonUsage.htm @@ -0,0 +1,53 @@ + + + + Radio Button Usage + + + + + + + + + + + + + + +
+
+

Radio Button Usage

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

+There are three radio buttons on the application form. These currently do nothing except indicate changes in state when left-clicked by the mouse..

+

+ +
+ + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/ResizeGripper.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/ResizeGripper.htm new file mode 100644 index 00000000..9564a34b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/ResizeGripper.htm @@ -0,0 +1,53 @@ + + + + Resize Gripper Control + + + + + + + + + + + + + + +
+
+

Resize Gripper Control

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

+The resize gripper control is a hash-marked area at the bottom right side of the status bar. When active, it may be used to size the window.

+

+ +
+ + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/RichEditBoxUsage.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/RichEditBoxUsage.htm new file mode 100644 index 00000000..5c5bf1b5 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/RichEditBoxUsage.htm @@ -0,0 +1,56 @@ + + + + Rich Edit Box Usage + + + + + + + + + + + + + + +
+
+

Rich Edit Box Usage

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

+This rich edit box may be used to enter text manually. No document yet corresponds to anything in the control. +

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/StatusBoxContent.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/StatusBoxContent.htm new file mode 100644 index 00000000..bfb52558 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/StatusBoxContent.htm @@ -0,0 +1,53 @@ + + + + Status Window Contents + + + + + + + + + + + + + + +
+
+

Status Window Contents

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

+The Status Window indicates whenever a check box or radio button control changes state or a button was pressed. It does not respond to other stimuli.

+

+ +
+ + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/SystemMenu.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/SystemMenu.htm new file mode 100644 index 00000000..1538e407 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/SystemMenu.htm @@ -0,0 +1,53 @@ + + + + System Menu Button + + + + + + + + + + + + + + +
+
+

System Menu Button

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

+This button, at the top left of the application's toolbar, is called the "System Menu". It generally carries an image of the application’s logo. Selecting the button causes a drop-down menu to appear of actions that pertain to the program appearance, state, and location; it also commonly includes an ‘Exit’ option.

+

+ +
+ + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/TitleBarQuestionBox.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/TitleBarQuestionBox.htm new file mode 100644 index 00000000..e7894340 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/TitleBarQuestionBox.htm @@ -0,0 +1,63 @@ + + + + + + + + Title Bar Context Help Button + + + + + + + + + + + + +
+
+

Title Bar Context Help Button

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+ +
+ + +


+ + +

+Activating the button bearing a question mark in the title bar of the window causes the cursor image to change to a question mark with a pointer. If the mouse then clicks a child window, the context help topic in this manual corresponding to that child window appears. These topics appear in the Frame Button Responses, Toolbar and Menu Items, and Client Window Controls sections found in the Contents window. +

+ + +
+ + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/aboutthisprogram.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/aboutthisprogram.htm new file mode 100644 index 00000000..97b13823 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/aboutthisprogram.htm @@ -0,0 +1,53 @@ + + + + About This Program + + + + + + + + + + + + + + +
+
+

About Box Function

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

This dialog, when activated, brings up data about the program. The default programming shows the program name, execution file name, version, Win32++ version, and compiler information.

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/clientwindowcontrols.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/clientwindowcontrols.htm new file mode 100644 index 00000000..d7f9d7e8 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/clientwindowcontrols.htm @@ -0,0 +1,63 @@ + + + + Client Window controls + + + + + + + + + + + + + + +
+
+

Client Window controls

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+ +
+ +

+

+ +The client window controls consist of three radio buttons, three check boxes, a "button" button, an "OK" button, a list box control, an edit control, a rich edit control, and two static controls, one with messages and the other with a bitmap. +

+


+

+

+Currently these do little but indicate status. If they were to have more functionality, each should have its own topical section within this guide. +

+

+
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/closecurrentdocument.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/closecurrentdocument.htm new file mode 100644 index 00000000..4d9d1b52 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/closecurrentdocument.htm @@ -0,0 +1,59 @@ + + + + Close Current Document + + + + + + + + + + + + + + +
+
+

Close Current Document

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

what happens on close

+

+ +
+ + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/colorchoicefunction.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/colorchoicefunction.htm new file mode 100644 index 00000000..1a03423d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/colorchoicefunction.htm @@ -0,0 +1,54 @@ + + + + Color Choice Function + + + + + + + + + + + + + + +
+
+

Color Choice Function

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

how to choose colors

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/colordialoghelp.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/colordialoghelp.htm new file mode 100644 index 00000000..f96c0d84 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/colordialoghelp.htm @@ -0,0 +1,54 @@ + + + + Color Dialog Help + + + + + + + + + + + + + + +
+
+

Color Dialog Help

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

How the color selection dialog works

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/contentdescriptionandusagecondit.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/contentdescriptionandusagecondit.htm new file mode 100644 index 00000000..a882693b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/contentdescriptionandusagecondit.htm @@ -0,0 +1,69 @@ + + + + Content Description and Usage Conditions + + + + + + + + + + + + + + +
+
+

Content Description and Usage Conditions

+ +
+ Introduction ››
+
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

Content Description and Usage Conditions

+


+


+

+This set of program files implements the ContextHelp sample program, which is an augmentation of the FormDocView sample found in the Win32++ Windows framework classes, Copyright ©2005-2017 David Nash, under permissions granted therein. The augmentation implements context help for each control appearing on the toolbar, main menu, and client area, initiated by the context help button on the toolbar and F1 button on the keyboard. When activated, the chosen topic found in this compiled HTML (CHM) user guide is displayed. This manual was originally developed by Robert C. Tausworthe to explain the features of the context help sample program.

+

       

+

Caveats: +The ContextHelp sample program code bears the author's copyright, which extends only to the his original contributions to the subject software, and to the alterations, addition, deletions, and other treatments of materials that may have been extracted from the cited sources.  Any unaltered portions of those materials retain their original copyright status. The author hereby grants permission to any person obtaining a copy of this treatment of the subject class and any associated documentation composed by the author, to utilize this material, free of charge and without restriction or limitation, subject to the following conditions:

+


+

The copyright notices found in the program code, as well as those in the Win32++ framework, together with the respective permission conditions, shall be included in all copies or substantial portions of this material so copied, modified, merged, published, distributed, or otherwise held by others.

+


+

These materials are provided "as is", without warranty of any kind, express or implied, including but not limited to: warranties of merchantability, fitness for a particular purpose, and non-infringement.  In no event shall the author or copyright holder be liable for any claim, damages, or other liability, whether in an action of contract, tort or otherwise, arising from, out of, or in connection with, these materials, the use thereof, or any other other dealings therewith.

+


+


+


+


+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/copyfunction.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/copyfunction.htm new file mode 100644 index 00000000..dc0efdc5 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/copyfunction.htm @@ -0,0 +1,54 @@ + + + + Copy Function + + + + + + + + + + + + + + +
+
+

Copy Function

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

what you can copy

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/creatinghelpfiles.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/creatinghelpfiles.htm new file mode 100644 index 00000000..c3a8a736 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/creatinghelpfiles.htm @@ -0,0 +1,98 @@ + + + + Creating Help Files + + + + + + + + + + + + + + +
+
+

Creating Help Files

+ +
+ Getting Started ››
+
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

Creating and Editing Help Files for a

+ +

WINAPI C++ Application

+ +


+ +

Here's how to create a help file, like this one.

+ +


+


+ +
    + +
  • Get MS the HTML Help Workshop: Go to MSDN, download (free) the help workshop, and install it. The link for this is
  • + +
+


+ +

   https://www.microsoft.com/en-us/download/details.aspx?id=21138

+ +


+ +
    + +
  • Copy the help header and library.  The HTML Help Workshop normally installs into the directory
  • + +


    +

    C:\Program Files\HTML Help Workshop\

    +


    +

    In the include subdirectory of the above, find the header file htmlhelp.h. Place a copy of this in your compiler's include path, which for  the MinGW compler is something like C:...\\MinGW\include.  Then, in C:\Program Files\HTML Help Workshop\lib find the library file htmlhelp.lib. Put a copy of this in your compiler's lib directory.  In MinGW, this may be something like C:\...\MinGW\lib; in this case, the name will need to be changed to libhtmlhelp.a. Renaming to the MinGW convention is not actually necessary, but it makes the nature of the file clearer. As found by the MinGW project staff, this file is a static library that calls LoadLibrary/GetProcAddress to access the file C:\WINDOWS\SYSTEM32\hhctrl.ocx, not an import library, that can be linked by ld.

    +


    +
      +
    • Create the help file (.chm). The Compiled HTML help file, of which these instructions are an instance of, may be created in a number of ways. One way is to read the user manual that comes with the HTML Help Workshop. That method can be somewhat daunting for the non-HTML savvy individuals who must create the HTML topic files; but having done so, its hhw.exe utility creates the manual rather handily.
    • +
    +


    +

    Another way is to use a CHM editor, which removes the writer's necessity to know how to create HTML topic files.  Some of these editors have a version that is free for noncommercial use, with modestly priced upgrades for added features. One such example is HelpNDoc4, whose freeware WYSIWYG version deposits a banner in each topic stating that this tool was used to generate the help guide. The banner is absent in their commercial versions.  You may download the free version from

    +


    +

           http://www.helpndoc.com/download

    +


    +

    You create the document as a series of topics ordered as a hierarchy that is displayed by its table of contents. Features for generating an index are also present.

    +


    +
      +
    • Accessing topics from your program. The interface between your C++ program and a CHM file is particularly simple when the Win32++  C++ library is used, as is the current application, whose User Guide is the subject of this CHM document.  The CHM guide invocations are made using the features illustrated in this ContextHelp sample program. The program declares an object of the context help class and adds the help ID string of each topic to be accessed, along with the corresponding numeric ID of a program control or feature, to the object's help table.  The full path name of the CHM file is also made known to the object.  When the context help mode is triggered by the program and one of the controls or features is actuated, the context help object engages this CHM file and the description of the topic appears.  Detailed instructions on the code that needs to be inserted into the CMainFrame.cpp and View.cpp files appears in the AppHelp.cpp file.  These fragmentary instructions  assume a C++ source file architecture with CMainFrame and CView classes presume that the programmer has some familiarity with the basic message loops and message handling in these classes. The simplest way to define the topic string identifiers defined in the help table is to use the same text strings as used for as the topic names in the CHM file.  This practice is illustrated in this CHM guide
    • +
    +

    + +
+ + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/css/base.css b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/css/base.css new file mode 100644 index 00000000..66e6e0c0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/css/base.css @@ -0,0 +1,74 @@ +body { + background-color: #fff; +} + +.clear { + border: 0; + clear: both; + margin: 0; + padding: 0; +} + +#topic_header, #topic_footer { + padding: 10px; +} + +#topic_content { + margin: 10px; +} + +/* Backgrounds */ + +#topic_header { + background: #fff url(/img/header-bg.png) repeat-x left top; + border-bottom: 1px solid #ccc; + margin-bottom: 15px; +} + +#topic_footer{ + background: #fff url(/img/footer-bg.png) repeat-x left top; + margin-top: 20px; +} + +/* Topic */ + +#topic_header #topic_header_content { + float: left; +} + +#topic_header #topic_header_nav { + float: right; +} + +#topic_header #topic_header_nav img { + margin-left: 5px; +} + +#topic_header a, +#topic_footer a { + color: #333; + text-decoration: none; +} + +#topic_header a:hover, +#topic_footer a:hover{ + text-decoration: underline; +} + +#topic_header h1 { + color: #333; + font-size: 18px; +} + +#topic_footer { + font-size: 11px; +} + +#topic_breadcrumb { + font-size: 11px; + /*padding: 5px 0 0 0;*/ +} + +#topic_content { + +} \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/css/hnd.css b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/css/hnd.css new file mode 100644 index 00000000..394ef73b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/css/hnd.css @@ -0,0 +1,306 @@ +/* ========== Text Styles ========== */ +hr { color: #000000} +body, table, span.rvts0 /* Normal text */ +{ + font-size: 10pt; + font-family: 'Arial', 'Helvetica', sans-serif; + font-style: normal; + font-weight: normal; + color: #000000; + text-decoration: none; +} +span.rvts1 /* Heading */ +{ + font-weight: bold; + color: #0000ff; +} +span.rvts2 /* Subheading */ +{ + font-weight: bold; + color: #000080; +} +span.rvts3 /* Keywords */ +{ + font-style: italic; + color: #800000; +} +a.rvts4, span.rvts4 /* Jump 1 */ +{ + color: #008000; + text-decoration: underline; +} +a.rvts5, span.rvts5 /* Jump 2 */ +{ + color: #008000; + text-decoration: underline; +} +span.rvts6 +{ +} +span.rvts7 +{ + font-weight: bold; + color: #0000ff; +} +span.rvts8 +{ + font-weight: bold; + color: #000080; +} +span.rvts9 +{ + font-style: italic; + color: #800000; +} +a.rvts10, span.rvts10 +{ + color: #008000; + text-decoration: underline; +} +span.rvts11 +{ + font-size: 14pt; + font-family: 'Times New Roman', 'Times', serif; + color: #333333; +} +span.rvts12 +{ + font-size: 12pt; + font-family: 'Times New Roman', 'Times', serif; + color: #000000; +} +span.rvts13 +{ + font-size: 14pt; + font-family: 'Times New Roman', 'Times', serif; + font-weight: bold; + color: #000000; +} +span.rvts14 /* Font Style */ +{ + font-family: 'Tahoma', 'Geneva', sans-serif; + font-style: italic; + color: #c0c0c0; +} +a.rvts15, span.rvts15 /* Font Style */ +{ + font-family: 'Tahoma', 'Geneva', sans-serif; + font-style: italic; + color: #6666ff; + text-decoration: underline; +} +a.rvts16, span.rvts16 +{ + font-size: 12pt; + font-family: 'Times New Roman', 'Times', serif; + color: #333333; + text-decoration: none; +} +a.rvts16:hover { text-decoration: underline; } +span.rvts17 +{ + font-size: 8pt; + font-family: 'Times New Roman', 'Times', serif; + color: #000000; +} +span.rvts18 +{ + font-size: 14pt; + font-family: 'Times New Roman', 'Times', serif; + font-weight: bold; + color: #000000; +} +span.rvts19 +{ + font-size: 14pt; + font-family: 'Times New Roman', 'Times', serif; + font-weight: bold; + color: #000000; +} +span.rvts20 +{ + font-size: 13pt; + font-weight: bold; +} +span.rvts21 +{ + font-family: 'Arial Unicode MS', 'Lucida Sans Unicode', 'Arial', 'Helvetica', sans-serif; +} +span.rvts22 +{ + font-weight: bold; +} +span.rvts23 +{ +} +span.rvts24 +{ + font-size: 14pt; + font-family: 'Times New Roman', 'Times', serif; + font-weight: bold; + color: #000000; +} +a.rvts25, span.rvts25 +{ + color: #0000ff; + text-decoration: underline; +} +span.rvts26 +{ + font-family: 'Courier New', 'Courier', monospace; +} +span.rvts27 +{ + font-family: 'Courier New', 'Courier', monospace; +} +span.rvts28 +{ + font-family: 'Courier New', 'Courier', monospace; +} +span.rvts29 +{ + font-family: 'Courier New', 'Courier', monospace; +} +a.rvts30, span.rvts30 +{ + color: #0000ff; + text-decoration: underline; +} +span.rvts31 +{ + font-weight: bold; +} +span.rvts32 +{ + font-size: 16pt; + font-weight: bold; +} +/* ========== Para Styles ========== */ +p,ul,ol /* Paragraph Style */ +{ + text-align: left; + text-indent: 0px; + padding: 0px 0px 0px 0px; + margin: 0px 0px 0px 0px; +} +.rvps1 /* Centered */ +{ + text-align: center; +} +.rvps2 +{ +} +.rvps3 +{ + text-align: center; +} +.rvps4 +{ + border-color: #cccccc; + border-style: solid; + border-width: 1px; + border-top: none; + border-right: none; + border-left: none; + background: #efefef; + padding: 10px 10px 10px 10px; +} +.rvps5 +{ + text-align: left; + text-indent: 0px; + border-color: #cccccc; + border-style: solid; + border-width: 1px; + border-top: none; + border-right: none; + border-left: none; + background: #efefef; + padding: 10px 10px 10px 10px; + margin: 0px 0px 0px 0px; +} +.rvps6 +{ + text-align: center; + text-indent: 0px; + padding: 0px 0px 0px 0px; + margin: 16px 0px 4px 0px; +} +.rvps7 +{ + text-align: justify; +} +.rvps8 +{ + text-align: center; + text-indent: 0px; + page-break-after: avoid; + padding: 0px 0px 0px 0px; + margin: 16px 0px 4px 0px; +} +.rvps9 /* Paragraph Style */ +{ + text-align: center; + border-color: #c0c0c0; + border-style: solid; + border-width: 1px; + border-right: none; + border-left: none; + padding: 2px 0px 2px 0px; + margin: 7px 0px 7px 0px; +} +.rvps10 +{ + text-align: justify; + margin: 0px 0px 0px 24px; +} +.rvps11 +{ + text-align: center; + text-indent: 0px; + page-break-after: avoid; + padding: 0px 0px 0px 0px; + margin: 16px 0px 4px 0px; +} +.rvps12 +{ + text-align: center; + text-indent: 0px; + padding: 0px 0px 0px 0px; + margin: 16px 0px 4px 0px; +} +.rvps13 +{ + background: #ffffff; + padding: 10px 10px 10px 10px; +} +.rvps14 +{ + margin: 0px 0px 0px 24px; +} +.rvps15 +{ + text-indent: 48px; +} +.rvps16 +{ + margin: 0px 0px 0px 24px; +} +.rvps17 +{ + text-align: center; + text-indent: 0px; + page-break-after: avoid; + padding: 0px 0px 0px 0px; + margin: 16px 0px 4px 0px; +} +.rvps18 +{ + text-align: justify; + text-indent: 48px; +} +/* ========== Lists ========== */ +.list0 {text-indent: 0px; margin-left: 24px; list-style-position: outside; list-style-type: disc;} +.list1 {text-indent: 0px; margin-left: 48px; list-style-position: outside; list-style-type: circle;} +.list2 {text-indent: 0px; margin-left: 48px; list-style-position: outside; list-style-type: square;} +.list3 {text-indent: 0px; margin-left: 48px; list-style-position: outside; list-style-type: disc;} diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/css/ielte8.css b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/css/ielte8.css new file mode 100644 index 00000000..5609c07d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/css/ielte8.css @@ -0,0 +1,4 @@ +#topic_content, #topic_footer, +#toc_content, #toc_footer { + width: 100%; +} \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/css/reset.css b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/css/reset.css new file mode 100644 index 00000000..62035503 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/css/reset.css @@ -0,0 +1,56 @@ +/* http://meyerweb.com/eric/tools/css/reset/ + v2.0 | 20110126 + License: none (public domain) +*/ + +html, body { + margin: 0; + padding: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; +} + +div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, hgroup, +menu, nav, output, ruby, section, summary, +time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; +} +img { + padding: 0; + border: 0; + font-size: 100%; + font: inherit; +} +table, caption, tbody, tfoot, thead, tr, th, td { + margin: 0; + font-size: 100%; + font: inherit; +} +/* HTML5 display-role reset for older browsers */ +article, aside, details, figcaption, figure, +footer, header, hgroup, menu, nav, section { + display: block; +} +blockquote, q { + quotes: none; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ''; + content: none; +} \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/cutfunction.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/cutfunction.htm new file mode 100644 index 00000000..c591e2f9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/cutfunction.htm @@ -0,0 +1,54 @@ + + + + Cut Function + + + + + + + + + + + + + + +
+
+

Cut Function

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

what you can cut

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/deletefunction.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/deletefunction.htm new file mode 100644 index 00000000..403cfe69 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/deletefunction.htm @@ -0,0 +1,54 @@ + + + + DeleteFunction + + + + + + + + + + + + + + +
+
+

DeleteFunction

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

what gets deleted when you press this button

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/dialoghelpbuttons.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/dialoghelpbuttons.htm new file mode 100644 index 00000000..f8344318 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/dialoghelpbuttons.htm @@ -0,0 +1,54 @@ + + + + Dialog HELP buttons + + + + + + + + + + + + + + +
+
+

Dialog HELP buttons

+ + +
+
+ Parent + Previous + + Next + +
+
+
+
+ +

+

There are several dialog boxes used that have a HELP button. These are described in the paragraphs below.

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/editboxusage.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/editboxusage.htm new file mode 100644 index 00000000..a1b28495 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/editboxusage.htm @@ -0,0 +1,56 @@ + + + + Edit Box Usage + + + + + + + + + + + + + + +
+
+

Edit Box Usage

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

+This regular edit box may be used to enter text manually. No document yet corresponds to anything in the control. +

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/exitterminateprogram.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/exitterminateprogram.htm new file mode 100644 index 00000000..8a482d34 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/exitterminateprogram.htm @@ -0,0 +1,54 @@ + + + + Exit, Terminate Program + + + + + + + + + + + + + + +
+
+

Exit, Terminate Program

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

describe termination: saving, achive, etc

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/filedialogopenhelp.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/filedialogopenhelp.htm new file mode 100644 index 00000000..80ef4add --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/filedialogopenhelp.htm @@ -0,0 +1,54 @@ + + + + File Dialog Open Help + + + + + + + + + + + + + + +
+
+

File Dialog Open Help

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

This function creates the file-open dialog box that lets the user specify the drive, directory, and the name of a file  to open as the basis of a document.  In this demo, however, no file is actually opened.

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/filedialogsaveashelp.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/filedialogsaveashelp.htm new file mode 100644 index 00000000..3e3f086e --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/filedialogsaveashelp.htm @@ -0,0 +1,54 @@ + + + + File Dialog SaveAs Help + + + + + + + + + + + + + + +
+
+

File Dialog SaveAs Help

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

Here's how to use the file file choice Save As function.

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/findindocument.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/findindocument.htm new file mode 100644 index 00000000..1bdb5b3a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/findindocument.htm @@ -0,0 +1,54 @@ + + + + Find in Document + + + + + + + + + + + + + + +
+
+

Find in Document

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

how to find things

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/findtextdialoghelp.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/findtextdialoghelp.htm new file mode 100644 index 00000000..caf45192 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/findtextdialoghelp.htm @@ -0,0 +1,54 @@ + + + + Find Text Dialog Help + + + + + + + + + + + + + + +
+
+

Find Text Dialog Help

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

How the find dialog works

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/fontchoicedialoghelp.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/fontchoicedialoghelp.htm new file mode 100644 index 00000000..b87cc6bc --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/fontchoicedialoghelp.htm @@ -0,0 +1,54 @@ + + + + Font Choice Dialog Help + + + + + + + + + + + + + + +
+
+

Font Choice Dialog Help

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

The font choice dialog  box enables the user to choose attributes for a font. These attributes include a typeface name, style (bold, italic, or regular), point size, effects (underline, strikeout, and text color), and a script (or character set).

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/fontchoicefunction.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/fontchoicefunction.htm new file mode 100644 index 00000000..3366598d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/fontchoicefunction.htm @@ -0,0 +1,54 @@ + + + + Font Choice Function + + + + + + + + + + + + + + +
+
+

Font Choice Function

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

how to choose fonts

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/framebuttonresponses.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/framebuttonresponses.htm new file mode 100644 index 00000000..71262576 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/framebuttonresponses.htm @@ -0,0 +1,55 @@ + + + + Frame Button Responses + + + + + + + + + + + + + + +
+
+

Frame Button Responses

+
+ Getting Started ››
+
+
+ + Parent + + Previous + + Next + +
+
+
+
+ +

+

Here's what the frame buttons do: (to be supplied)

+

+ +
+ + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/gettinghelp.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/gettinghelp.htm new file mode 100644 index 00000000..dc34afa6 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/gettinghelp.htm @@ -0,0 +1,66 @@ + + + + Getting Help + + + + + + + + + + + + + + +
+
+

Getting Help

+ +
+ GettingStarted ››
+
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

+ +

+The Microsoft® HTML Help Workshop consists of an online Help Viewer, related help components, and help authoring tools from Microsoft Corporation. The Help Viewer uses the underlying components of Microsoft Internet Explorer to display help content. It supports HTML, ActiveX®, Java™, scripting languages (JScript®, and Microsoft Visual Basic® Scripting Edition), and HTML image formats (.jpeg, .gif, and .png files). The help authoring tool, HTML Help Workshop, provides an easy-to-use system for creating and managing help projects and their related files.

+ +


+ +

+The Workshop contains an ActiveX control or Java Applet to insert into HTML files, a help authoring tool, an online image editing tool, and an executable program that displays a user's help files. It also has an authoring guide with sections on how to design a help system and how to use HTML Help Workshop. It has references to information about the HTML Help ActiveX control, an HTML Help API reference for developers, a complete HTML tag reference, and reusable help topics that explain how to use the Help Viewer. +

+ +


+ +

+A wealth of guidance on the production of help topics is available via internet search.

+ +
+ + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/gettingstarted.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/gettingstarted.htm new file mode 100644 index 00000000..94955acc --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/gettingstarted.htm @@ -0,0 +1,57 @@ + + + + Getting Started + + + + + + + + + + + + + + + + +
+
+

Getting Started

+ +
+ Introduction ›› +
+
+
+ Parent + + Previous + + Next + +
+
+
+ +
+ +

+

+

Describe how to install this program. In this ContextHelp case, the program and help sources are found in the samples folder. Navigate to the Projects subfolder and find the file that launches the compiler IDE on your system. Make any modifications to the source code to personalize it to your usage. Then compile and run the program.

+


+

Use the main menu items and toolbar buttons to select things to be done. Most of these are mere stubs for functions in a more complete application, and just say "feature not implemented." But the HELP and CONTEXT HELP buttons launch this manual to topics corresponding to the particular toolbar button or menu item selected.

+
+ + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/img/arrow_left.png b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/img/arrow_left.png new file mode 100644 index 00000000..7270e0dc Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/img/arrow_left.png differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/img/arrow_right.png b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/img/arrow_right.png new file mode 100644 index 00000000..ca41e5d8 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/img/arrow_right.png differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/img/arrow_up.png b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/img/arrow_up.png new file mode 100644 index 00000000..557d5e6a Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/img/arrow_up.png differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/img/footer-bg.png b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/img/footer-bg.png new file mode 100644 index 00000000..5682c5f3 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/img/footer-bg.png differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/img/header-bg.png b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/img/header-bg.png new file mode 100644 index 00000000..81d526d0 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/img/header-bg.png differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/introduction.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/introduction.htm new file mode 100644 index 00000000..c52be94b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/introduction.htm @@ -0,0 +1,48 @@ + + + + Introduction + + + + + + + + + + + + +
+
+

Introduction

+ +
+
+ + Next + +
+
+
+ +
+ +


+ +

+This document accompanies the ContextHelp C++ sample program and contains an outline of topics to be filled in when used in other applications. It should contain information about the application and provide instructions and hints for usage. +

+ +
+ + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/js/chmRelative.js b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/js/chmRelative.js new file mode 100644 index 00000000..348dd297 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/js/chmRelative.js @@ -0,0 +1 @@ +function relativelnk(a){var b,c;b=location.href.search(/:/)==2?14:7;c=location.href.lastIndexOf("\\")+1;a="file:///"+location.href.substring(b,c)+a;location.href=a}; \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/keywords.hhk b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/keywords.hhk new file mode 100644 index 00000000..a0ba13c6 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/keywords.hhk @@ -0,0 +1,43 @@ + + + + + + + + + +
    + +
  • + + + + + +
  • + + + +
  • + + + +
  • + + + +
  • + + + +
  • + + + +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_left.png b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_left.png new file mode 100644 index 00000000..7270e0dc Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_left.png differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_left1.png b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_left1.png new file mode 100644 index 00000000..7270e0dc Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_left1.png differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_left2.png b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_left2.png new file mode 100644 index 00000000..7270e0dc Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_left2.png differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_left3.png b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_left3.png new file mode 100644 index 00000000..7270e0dc Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_left3.png differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_left4.png b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_left4.png new file mode 100644 index 00000000..7270e0dc Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_left4.png differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_right.png b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_right.png new file mode 100644 index 00000000..ca41e5d8 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_right.png differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_right1.png b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_right1.png new file mode 100644 index 00000000..ca41e5d8 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_right1.png differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_right2.png b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_right2.png new file mode 100644 index 00000000..ca41e5d8 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_right2.png differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_right3.png b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_right3.png new file mode 100644 index 00000000..ca41e5d8 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_right3.png differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_right4.png b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_right4.png new file mode 100644 index 00000000..ca41e5d8 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_right4.png differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_right5.png b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_right5.png new file mode 100644 index 00000000..ca41e5d8 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_right5.png differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_up.png b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_up.png new file mode 100644 index 00000000..557d5e6a Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_up.png differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_up1.png b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_up1.png new file mode 100644 index 00000000..557d5e6a Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_up1.png differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_up2.png b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_up2.png new file mode 100644 index 00000000..557d5e6a Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_up2.png differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_up3.png b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_up3.png new file mode 100644 index 00000000..557d5e6a Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/lib/imgarrow_up3.png differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/listboxdialoghelp.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/listboxdialoghelp.htm new file mode 100644 index 00000000..a689c70a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/listboxdialoghelp.htm @@ -0,0 +1,54 @@ + + + + List Box Dialog Help + + + + + + + + + + + + + + +
+
+

List Box Dialog Help

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

Here's how to use the ListBox to select the control background and text foreground and background colors:

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/maximizewindow.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/maximizewindow.htm new file mode 100644 index 00000000..3b708161 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/maximizewindow.htm @@ -0,0 +1,54 @@ + + + + Maximize Window + + + + + + + + + + + + + + +
+
+

Maximize Window

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

Maximize the window

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/minimizewindow.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/minimizewindow.htm new file mode 100644 index 00000000..f37cd69b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/minimizewindow.htm @@ -0,0 +1,54 @@ + + + + Minimize Window + + + + + + + + + + + + + + +
+
+

Minimize Window

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

Minimize the Window

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/mostrecentlyusedlist.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/mostrecentlyusedlist.htm new file mode 100644 index 00000000..53c15e2f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/mostrecentlyusedlist.htm @@ -0,0 +1,54 @@ + + + + Most Recently Used List + + + + + + + + + + + + + + +
+
+

Most Recently Used List

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

what is in the MRU list

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/newdocument.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/newdocument.htm new file mode 100644 index 00000000..ca7137d0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/newdocument.htm @@ -0,0 +1,54 @@ + + + + New Document + + + + + + + + + + + + + + +
+
+

New Document

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

Here's how to create a new document:

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/okbuttonusage.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/okbuttonusage.htm new file mode 100644 index 00000000..bc80e017 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/okbuttonusage.htm @@ -0,0 +1,56 @@ + + + + OK Button Usage + + + + + + + + + + + + + + +
+
+

OK Button Usage

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

+The OK button is special because the message sent by the control does not pass through the usual message loop. Here, selecting it merely registers in the Status Window. +

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/openexistingdocument.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/openexistingdocument.htm new file mode 100644 index 00000000..ea8a1d31 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/openexistingdocument.htm @@ -0,0 +1,54 @@ + + + + Open Existing Document + + + + + + + + + + + + + + +
+
+

Open Existing Document

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

describe open function

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/pagesetupdialoghelp.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/pagesetupdialoghelp.htm new file mode 100644 index 00000000..b3dcbe05 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/pagesetupdialoghelp.htm @@ -0,0 +1,54 @@ + + + + Page Setup Dialog Help + + + + + + + + + + + + + + +
+
+

Page Setup Dialog Help

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

Here's how you use the Page Setup dialog box

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/pagesetupforprintout.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/pagesetupforprintout.htm new file mode 100644 index 00000000..90ce4ba9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/pagesetupforprintout.htm @@ -0,0 +1,53 @@ + + + + Page Setup for Printout + + + + + + + + + + + + + + +
+
+

Page Setup for Printout

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/pastefunction.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/pastefunction.htm new file mode 100644 index 00000000..2d1218f6 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/pastefunction.htm @@ -0,0 +1,54 @@ + + + + Paste Function + + + + + + + + + + + + + + +
+
+

Paste Function

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

what you can paste

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/previewprintout.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/previewprintout.htm new file mode 100644 index 00000000..930e9f41 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/previewprintout.htm @@ -0,0 +1,54 @@ + + + + Preview Printout + + + + + + + + + + + + + + +
+
+

Preview Printout

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

describe print preview

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/printdocument.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/printdocument.htm new file mode 100644 index 00000000..a9b67747 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/printdocument.htm @@ -0,0 +1,54 @@ + + + + Print Document + + + + + + + + + + + + + + +
+
+

Print Document

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

describe print function

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/printerdialoghelp.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/printerdialoghelp.htm new file mode 100644 index 00000000..1f61377d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/printerdialoghelp.htm @@ -0,0 +1,54 @@ + + + + Printer Dialog Help + + + + + + + + + + + + + + +
+
+

Printer Dialog Help

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

How the printer choice dialog works

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/redofunction.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/redofunction.htm new file mode 100644 index 00000000..45f939d9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/redofunction.htm @@ -0,0 +1,54 @@ + + + + Redo Function + + + + + + + + + + + + + + +
+
+

Redo Function

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

what can you redo

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/replaceindocument.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/replaceindocument.htm new file mode 100644 index 00000000..87e93086 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/replaceindocument.htm @@ -0,0 +1,54 @@ + + + + Replace in Document + + + + + + + + + + + + + + +
+
+

Replace in Document

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

how to replace things

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/replacetextdialoghelp.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/replacetextdialoghelp.htm new file mode 100644 index 00000000..aa955fbe --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/replacetextdialoghelp.htm @@ -0,0 +1,54 @@ + + + + Replace Text Dialog Help + + + + + + + + + + + + + + +
+
+

Replace Text Dialog Help

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

Here's how to use the replace dialog box:

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/restorewindow.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/restorewindow.htm new file mode 100644 index 00000000..103196a7 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/restorewindow.htm @@ -0,0 +1,54 @@ + + + + Restore Window + + + + + + + + + + + + + + +
+
+

Restore Window

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

Restore the window from maximized mode.

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/saveasanotherdocument.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/saveasanotherdocument.htm new file mode 100644 index 00000000..73cade37 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/saveasanotherdocument.htm @@ -0,0 +1,54 @@ + + + + SaveAs Another Document + + + + + + + + + + + + + + +
+
+

SaveAs Another Document

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

describe save-as function

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/savecurrentdocument.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/savecurrentdocument.htm new file mode 100644 index 00000000..18774837 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/savecurrentdocument.htm @@ -0,0 +1,54 @@ + + + + Save Current Document + + + + + + + + + + + + + + +
+
+

Save Current Document

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

describe save function

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/statusbartopics.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/statusbartopics.htm new file mode 100644 index 00000000..be5e365f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/statusbartopics.htm @@ -0,0 +1,54 @@ + + + + Statusbar Topics + + + + + + + + + + + + + + +
+
+

Statusbar Topics

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

what does the status bar show

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/systemrequirements.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/systemrequirements.htm new file mode 100644 index 00000000..7a661b8f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/systemrequirements.htm @@ -0,0 +1,74 @@ + + + + System requirements + + + + + + + + + + + + + + +
+
+

System requirements

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

+System requirements

+

+Getting Started ››

+

+Parent Previous Next

+

+System Requirements

+


+ +

+Describe for your application the system requirements and other specifications necessary for operation. Things such as:

+ + +


+

Operating system: Windows XP, Windows 10, etc.

+


+

Disk storage: xx MBytes

+


+

RAM: xx bytes

+ +

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/toc.hhc b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/toc.hhc new file mode 100644 index 00000000..b352025b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/toc.hhc @@ -0,0 +1,331 @@ + + + + + + + + + + +
    +
  • + + + +
      +
    • + + + + +
    • + + + + +
    • + + + + +
    +
  • + + + +
      +
    • + + + + +
    • + + + + +
        +
      • + + + + +
      +
    • + + + + +
    +
  • + + + +
      +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    +
  • + + + +
      +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    +
  • + + + +
      +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    +
  • + + + +
      +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    • + + + + +
    +
+ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/toolbarandmenuitems.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/toolbarandmenuitems.htm new file mode 100644 index 00000000..a6c38f9c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/toolbarandmenuitems.htm @@ -0,0 +1,54 @@ + + + + Toolbar and Menu Items + + + + + + + + + + + + + + +
+
+

Toolbar and Menu Items

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +


+

Describe the toolbar and menu items that render context help when activated.

+ +


+

Then select any of the features in the table of contents for a fuller explanation of that feature.

+ +
+ + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/toolbartopics.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/toolbartopics.htm new file mode 100644 index 00000000..02fc1f80 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/toolbartopics.htm @@ -0,0 +1,54 @@ + + + + Toolbar Topics + + + + + + + + + + + + + + +
+
+

Toolbar Topics

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

what's in the toolbar

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/undofunction.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/undofunction.htm new file mode 100644 index 00000000..074c31bb --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/undofunction.htm @@ -0,0 +1,54 @@ + + + + Undo Function + + + + + + + + + + + + + + +
+
+

Undo Function

+ + +
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+

what can you undo

+

+ +
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/welcome.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/welcome.htm new file mode 100644 index 00000000..d5ff72fb --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/welcome.htm @@ -0,0 +1,74 @@ + + + + Welcome + + + + + + + + + + + + + + +
+
+

Welcome

+ +
+ Introduction ››
+
+
+ Parent + + Previous + + Next + +
+
+
+
+ +

+


+ +

+This manual in the form you see it here provides an outline of topics typical of an actual application that might call for a help guide of this form. This section presently describes the design and features of the ContextHelp sample program. Salient features in the program's composition include

+ +


+
      + +
    • +Use of Win32++, which is a C++ class library that is used to build Windows applications. It provides an application programming interface to the Windows API and is similar to the Microsoft Foundation Classes (MFC). However, there are several differences between it and MFC, and these are documented in its user manual. Win32++ is capable of being used with a wide range of free compilers, including Visual Studio Express and the MinGW compiler provided with CodeBlocks and Dev-C++.
    • + +
    • +This sample program derives from the FormDocView sample program that is found in the Win32++ samples folder. The principal changes made to this template are an augmented toolbar and code necessary to include the AppHelp class and to connect it to the frame and view controls. +
    • + +
    • +Use of the AppHelp class to access the descriptions of the program's individual features within this compiled HTML (.chm) help document that you are now reading. The AppHelp class also provides an AboutBox popup dialog that replaced the FormDocView about dialog. This capability is very much like that found in the MFC context help functions.
    • + +
    • +An augmented toolbar with 24×24 pixel buttons for typical uses, all of which have context help topics in this manual. The use of the buttons in non-context-help mode lead to "feature not implemented" messages. +.
    • + +
+
+ + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/whatsnew.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/whatsnew.htm new file mode 100644 index 00000000..7c150d77 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/whatsnew.htm @@ -0,0 +1,54 @@ + + + + What's New + + + + + + + + + + + + +
+
+

What's New

+ +
+ Introduction ›› +
+
+
+ Parent + + Previous + + Next + +
+
+
+ +
+ +


+ +

+This is a new sample application program. The program is essentially the same as the FormDocView sample program with context help added. As new releases of this program become available, this topic will contain the list of changes from previous versions that may be of interest to the user. +

+ +
+ + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/~~TypicalTopic.htm b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/~~TypicalTopic.htm new file mode 100644 index 00000000..e1877057 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/help/~~TypicalTopic.htm @@ -0,0 +1,75 @@ + + + + + + + + TOPIC_TITLE + + + + + + + + + + + + +
+
+

TOPIC_TITLE

+ +
+ PARENT_DESCRIPTION ›› +
+
+
+ Parent + + Previous + + Next + +
+
+
+ +
+ + +


+ + +

+Indented text +

+ + +

+BEGIN THE DESCRIPTION HERE. +

+ + +
+	AppHelp.h       declaration of the AppHelp class
+	AppHelp.cpp     implementation of the AppHelp class
+	AppHelpRC.h     resource definitions needed by the class
+	AppHelp.rc      the AboutBox template
+
+ +
+ + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/App.cpp b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/App.cpp new file mode 100644 index 00000000..8a5601d9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/App.cpp @@ -0,0 +1,22 @@ +///////////////////////////// +// App.cpp +// + +#include "stdafx.h" +#include "App.h" + + + +//////////////////////////// +// CApp function definitions +// + +// Called when the application starts. +BOOL CApp::InitInstance() +{ + // Create the frame window. + m_frame.Create(); // throws a CWinException on failure + + return TRUE; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/App.h b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/App.h new file mode 100644 index 00000000..d9723c90 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/App.h @@ -0,0 +1,31 @@ +///////////////////////////// +// App.h +// + +#ifndef SDI_APP_H +#define SDI_APP_H + +#include "Mainfrm.h" + +/////////////////////////////////////////////////////////////// +// CApp manages the application. It initializes the Win32++ +// framework when it is constructed, and creates the main frame +// window when it runs. +class CApp : public CWinApp +{ +public: + CApp() = default;; + virtual ~CApp() override = default;; + +protected: + virtual BOOL InitInstance() override; + +private: + CApp(const CApp&) = delete; + CApp& operator=(const CApp&) = delete; + + CMainFrame m_frame; +}; + + +#endif // define SDI_APP_H diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/AppHelp.cpp b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/AppHelp.cpp new file mode 100644 index 00000000..dc7517df --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/AppHelp.cpp @@ -0,0 +1,120 @@ +///////////////////////////// +// AppHelp.cpp +// + +#include "stdafx.h" +#include "AppHelp.h" +#include "resource.h" + +///////////////////////////// +// CHelp function definitions +// + +// Constructor. +CHelp::CHelp() +{ + SetCommandHelpTopics(); + SetClientHelpTopics(); + SetFrameHelpTopics(); +} + +// Opens the help about dialog. +BOOL CHelp::About(HWND hParent) +{ + m_helpAbout.DoModal(hParent); + return TRUE; +} + +// Adds a topic to the context help map. +void CHelp::AddHelpTopic(UINT id, LPCWSTR topic) +{ + m_contextHelp.AddHelpTopic(id, topic); +} + +// Define the context help topics to be displayed for the menu items and the toolbar. +void CHelp::SetCommandHelpTopics() +{ + // define the help topics for the menu and status bar + AddHelpTopic(IDW_MENUBAR, L"ToolbarandMenuItems"); + AddHelpTopic(IDW_STATUSBAR, L"StatusbarTopics"); + + // define the help topics for the tool bar buttons + AddHelpTopic(IDM_FILE_NEW, L"NewDocument"); + AddHelpTopic(IDM_FILE_OPEN, L"OpenExistingDocument"); + AddHelpTopic(IDM_FILE_SAVE, L"SaveCurrentDocument"); + AddHelpTopic(IDM_FILE_SAVEAS, L"SaveAsAnotherDocument"); + AddHelpTopic(IDM_FILE_CLOSE, L"CloseCurrentDocument"); + AddHelpTopic(IDM_FILE_PRINT, L"PrintDocument"); + AddHelpTopic(IDM_FILE_PRINT_PREVIEW, L"PreviewPrintout"); + AddHelpTopic(IDM_FILE_EXIT, L"ExitTerminateProgram"); + AddHelpTopic(IDM_EDIT_UNDO, L"UndoFunction"); + AddHelpTopic(IDM_EDIT_REDO, L"RedoFunction"); + AddHelpTopic(IDM_EDIT_CUT, L"CutFunction"); + AddHelpTopic(IDM_EDIT_COPY, L"CopyFunction"); + AddHelpTopic(IDM_EDIT_PASTE, L"PasteFunction"); + AddHelpTopic(IDM_EDIT_DELETE, L"DeleteFunction"); + AddHelpTopic(IDM_EDIT_FIND, L"FindInDocument"); + AddHelpTopic(IDM_EDIT_REPLACE, L"ReplaceInDocument"); + AddHelpTopic(IDM_HELP_CONTENT, L"Introduction"); + AddHelpTopic(IDM_HELP_CONTEXT, L"Welcome"); + AddHelpTopic(IDM_HELP_ABOUT, L"AboutThisProgram"); + AddHelpTopic(IDM_COLOR_CHOICE, L"ColorChoiceFunction"); + AddHelpTopic(IDM_FONT_CHOICE, L"FontChoiceFunction"); + AddHelpTopic(IDW_ABOUT, L"AboutThisProgram"); +} + +// Define the help topic for the dialog. +void CHelp::SetClientHelpTopics() +{ + // Define the help topic for the dialog's client area. + AddHelpTopic(IDD_DIALOG1, L"clientwindowcontrols"); + + // Define the help topics for the client area controls. + AddHelpTopic(IDC_LIST1, L"ListBoxDialogHelp"); + AddHelpTopic(IDC_RICHEDIT1, L"RichEditBoxUsage"); + AddHelpTopic(IDC_EDIT1, L"EditBoxUsage"); + AddHelpTopic(ID_RADIO_A, L"RadioButtonUsage"); + AddHelpTopic(ID_RADIO_B, L"RadioButtonUsage"); + AddHelpTopic(ID_RADIO_C, L"RadioButtonUsage"); + AddHelpTopic(ID_CHECK_A, L"CheckBoxUsage"); + AddHelpTopic(ID_CHECK_B, L"CheckBoxUsage"); + AddHelpTopic(ID_CHECK_C, L"CheckBoxUsage"); + AddHelpTopic(IDC_BUTTON1, L"Button1Usage"); + AddHelpTopic(IDC_STATUS, L"StatusBoxContent"); + AddHelpTopic(IDC_BITMAP1, L"BitmapContent"); + AddHelpTopic(IDOK, L"OKButtonUsage"); +} + +// Define the context help topics for the frame. +void CHelp::SetFrameHelpTopics() +{ + AddHelpTopic(IDFR_CLOSE, L"ExitTerminateProgram"); + AddHelpTopic(IDFR_SYSTEMMENU, L"SystemMenu"); + AddHelpTopic(IDFR_CAPTION, L"AppTitleBar"); + AddHelpTopic(IDFR_GRIPPER, L"ResizeGripper"); + AddHelpTopic(IDFR_HELP, L"TitleBarQuestionBox"); +} + +// Assigns the context help file's path name. +void CHelp::SetHelpFilePath(LPCWSTR chmName) +{ + m_contextHelp.SetHelpFilePath(chmName); +} + +// Display the context help for the specified topic. +void CHelp::ShowHelpTopic(UINT id) +{ + m_contextHelp.ShowHelpTopic(id); +} + +// Display the context help for the specified topic. +void CHelp::ShowHelpTopic(LPCWSTR topic) +{ + m_contextHelp.ShowHelpTopic(topic); +} + +// Assigns the credits text for the help about dialog. +void CHelp::SetCredits(LPCWSTR credits) +{ + m_helpAbout.SetCredits(credits); +} diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/AppHelp.h b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/AppHelp.h new file mode 100644 index 00000000..a9aef8ff --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/AppHelp.h @@ -0,0 +1,39 @@ +///////////////////////////// +// AppHelp.h +// + +#ifndef APPHELP_H +#define APPHELP_H + +#include "ContextHelp.h" +#include "HelpAbout.h" + + +////////////////////////////////////////////////////// +// CHelp combines the features of the CContextHelp and +// CAboutHelp classes. +class CHelp +{ +public: + CHelp(); + virtual ~CHelp() = default; + + BOOL About(HWND hParent = nullptr); + void SetCredits(LPCWSTR credits); + void SetHelpFilePath(LPCWSTR chmName); + void ShowHelpTopic(UINT id); + void ShowHelpTopic(LPCWSTR topic); + +private: + void AddHelpTopic(UINT id, LPCWSTR topic); + void SetCommandHelpTopics(); + void SetClientHelpTopics(); + void SetFrameHelpTopics(); + + // Member variables + CContextHelp m_contextHelp; + CAboutHelp m_helpAbout; +}; + + +#endif // APPHELP_H diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/ContextHelp.cpp b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/ContextHelp.cpp new file mode 100644 index 00000000..807dcf4e --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/ContextHelp.cpp @@ -0,0 +1,169 @@ +///////////////////////////// +// ContextHelp.cpp +// + +// This class creates a window to display a .chm help file. +// +// CContextHelp implements the following functions: +// AddHelpTopic. Adds a pair to a map of known topics. +// CreateHtmlHelp. Creates a HtmlHelp window. +// ShowHelpTopic. Creates a HtmlHelp window and displays the specified topic. +// GetHelpFilePath. Retrieves the pathname of the chm help file. +// SetHelpFilePath Set the pathname of the chm help file +// +// The .chm help file is typically placed in a subdirectory of the user's +// APPDATA environmental path. +// +// Be sure to load the htmlhelp.h and htmlhelp.lib precisely as +// described in Adding Compiled HTML Help to MinGW Win32 Apps.html. +// Add the link to the libhtmlhelp.a to use this function +// (linker parameter -lhtmlhelp in DevC++). Ignore the compiler +// warning message ".drectve `-defaultlib:uuid.lib ' unrecognized". +// For other compilers, add the htmlhelp.lib to the linker list. +// +// How to use CContexHelp +// 1) Use SetHelpFilePath to specify the chm help file. +// 2) Use AddHelpTopic to add a pair to the map of known topics. +// 3) Use ShowHelpTopic to display the help for a specified topic. +// +// Acknowledgement: +// I wish to thank Robert C. Tausworthe for providing the original +// code and for his ongoing assistance in developing this sample. + + +#include "stdafx.h" +#include // load after windows.h to get system #defines + +#include "ContextHelp.h" +#include "resource.h" + + +//////////////////////////////////// +// CContextHelp function definitions +// + +// Add the (control-id, string topic) pair to the help topic table. +// Assert if a duplicate id entered. +void CContextHelp::AddHelpTopic(UINT id, LPCWSTR topic) +{ + assert(id); + assert(topic); + + // Ensure this isn't a duplicate entry + assert(m_helpTopics.find(id) == m_helpTopics.end()); + + // Add the topic to the map + m_helpTopics.emplace(std::make_pair(id, topic)); +} + +// Creates the HtmlHelp window, and binds this object to its HWND. +// This function uses LoadLibrary to gain access to the HtmHelpW function from "hhctrl.ocx". +// Refer to HtmlHelp in the Windows API documentation for more information. +HWND CContextHelp::CreateHtmlHelp(HWND hwndCaller, LPCWSTR string, UINT command, DWORD data) +{ + // Prepare this CWnd for possible re-use + if (*this != 0) + Detach(); + + using HTMLHELPW = HWND (WINAPI*)(HWND, LPCWSTR, UINT, DWORD_PTR); + HTMLHELPW pHtmlHelpW = nullptr; + HWND hWnd = nullptr; + + CString system; + ::GetSystemDirectory(system.GetBuffer(MAX_PATH), MAX_PATH); + system.ReleaseBuffer(); + + HMODULE module = ::LoadLibrary(system + "\\hhctrl.ocx"); + if (module) + { + pHtmlHelpW = reinterpret_cast( + reinterpret_cast(::GetProcAddress(module, "HtmlHelpW"))); + } + + // Create the HtmlHelp window. + if (pHtmlHelpW) + { + hWnd = pHtmlHelpW(hwndCaller, string, command, data); + + // Throw an exception if the window wasn't created. + if (hWnd == nullptr) + throw CWinException(L"Failed to initiate Context Help"); + + // Bind the hWnd to this CWnd object. + Attach(hWnd); + } + + return hWnd; +} + +// Display the application guide topic corresponding to the numeric +// identifier id, if present in the help table, and if the topic exists +// in the guide. +void CContextHelp::ShowHelpTopic(UINT id) +{ + // Find the CString mapped to this UINT + auto m = m_helpTopics.find(id); + CString topic = (m != m_helpTopics.end()) ? m->second : CString("FeatureNotDescribed"); + + ShowHelpTopic(topic); +} + +// Display the application guide topic, if present, or show the topic +// in a message box if there is no such topic in the guide. +void CContextHelp::ShowHelpTopic(LPCWSTR topic) +{ + CString topic_url; + if (topic[0] != 0) + topic_url << "::/" << topic << ".htm"; + + CString seek_url = m_helpFilePath + topic_url; + + try + { + CreateHtmlHelp(::GetDesktopWindow(), seek_url.c_str(), HH_DISPLAY_TOPIC, 0); + } + + catch (const CWinException&) + { + // if no help guide topic was opened, show that this happened + CString s; + CString fmt = "Help topic could not be located:\n\n%s%s"; + CString add = (m_helpFilePath.IsEmpty() ? "\n\nNo help guide exists." + : "\n\nMake sure the .chm file is in the .exe directory."); + + s.Format(fmt, topic, add.c_str()); + ::MessageBox(nullptr, s, L"Information", MB_OK | MB_ICONINFORMATION | MB_TASKMODAL); + } +} + +// Handle the window's messages. +LRESULT CContextHelp::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/ContextHelp.h b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/ContextHelp.h new file mode 100644 index 00000000..50f53a05 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/ContextHelp.h @@ -0,0 +1,67 @@ +///////////////////////////// +// ContextHelp.h +// + +// This class creates a window to display a .chm help file. +// +// CContextHelp implements the following functions: +// AddHelpTopic. Adds a pair to a map of known topics. +// CreateHtmlHelp. Creates a HtmlHelp window. +// ShowHelpTopic. Creates a HtmlHelp window and displays the specified topic. +// GetHelpFilePath. Retrieves the pathname of the chm help file. +// SetHelpFilePath Set the pathname of the chm help file +// +// The .chm help file is typically placed in a subdirectory of the user's +// APPDATA environmental path. +// +// Be sure to load the htmlhelp.h and htmlhelp.lib precisely as +// described in Adding Compiled HTML Help to MinGW Win32 Apps.html. +// Add the link to the libhtmlhelp.a to use this function +// (linker parameter -lhtmlhelp in DevC++). Ignore the compiler +// warning message ".drectve `-defaultlib:uuid.lib ' unrecognized". +// For other compilers, add the htmlhelp.lib to the linker list. +// +// How to use CContexHelp +// 1) Use SetHelpFilePath to specify the chm help file. +// 2) Use AddHelpTopic to add a pair to the map of known topics. +// 3) Use ShowHelpTopic to display the help for a specified topic. +// +// Acknowledgement: +// I wish to thank Robert C. Tausworthe for providing the original +// code and for his ongoing assistance in developing this sample. + + +#ifndef CONTEXTHELP_H +#define CONTEXTHELP_H + + +//////////////////////////////////////////////////// +// CContextHelp opens the help file and displays the +// required topic. +class CContextHelp : public CWnd +{ +public: + CContextHelp() = default;; + virtual ~CContextHelp() override = default;; + + void AddHelpTopic(UINT id, LPCWSTR topic); + const CString& GetHelpFilePath() const { return m_helpFilePath; } + void SetHelpFilePath(LPCWSTR chmName) { m_helpFilePath = chmName; } + void ShowHelpTopic(UINT id); + void ShowHelpTopic(LPCWSTR topic); + +protected: + LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CContextHelp(const CContextHelp&) = delete; + CContextHelp& operator=(const CContextHelp&) = delete; + + HWND CreateHtmlHelp(HWND hwndCaller, LPCWSTR string, UINT command, DWORD data); + + // Member variables + CString m_helpFilePath; // Help file path + std::unordered_map m_helpTopics; // Map of help topics +}; + +#endif // CONTEXTHELP_H diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/Doc.cpp b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/Doc.cpp new file mode 100644 index 00000000..3fd93678 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/Doc.cpp @@ -0,0 +1,52 @@ +///////////////////////////// +// Doc.cpp +// + +#include "stdafx.h" +#include "Doc.h" +#include "resource.h" + +//////////////////////////// +// CDoc function definitions +// + +// Constructor. +CDoc::CDoc() : m_isCheckA(false), m_isCheckB(false), m_isCheckC(false), m_radio(ID_RADIO_A) +{ +} + +// Load values from the registry. +void CDoc::LoadSettings(LPCWSTR keyName) +{ + CString fullKeyName = "Software\\"; + fullKeyName += keyName; + fullKeyName += "\\Document Settings"; + CRegKey key; + if (ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, fullKeyName, KEY_READ)) + { + key.QueryBoolValue(L"CheckA", m_isCheckA); + key.QueryBoolValue(L"CheckB", m_isCheckB); + key.QueryBoolValue(L"CheckC", m_isCheckC); + key.QueryDWORDValue(L"Radio", m_radio); + } +} + +// Store values in the registry. +void CDoc::SaveSettings(LPCWSTR keyName) +{ + CString fullKeyName = "Software\\"; + fullKeyName += keyName; + fullKeyName += "\\Document Settings"; + + CRegKey key; + if (ERROR_SUCCESS == key.Create(HKEY_CURRENT_USER, fullKeyName)) + { + if (ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, fullKeyName)) + { + key.SetBoolValue(L"CheckA", m_isCheckA); + key.SetBoolValue(L"CheckB", m_isCheckB); + key.SetBoolValue(L"CheckC", m_isCheckC); + key.SetDWORDValue(L"Radio", m_radio); + } + } +} diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/Doc.h b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/Doc.h new file mode 100644 index 00000000..70d6420e --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/Doc.h @@ -0,0 +1,39 @@ +///////////////////////////// +// Doc.h +// + +#ifndef SDI_DOC_H +#define SDI_DOC_H + + +///////////////////////////////////////////////////////////////// +// CDoc holds the application's data. It stores the application's +// settings in the registry. +class CDoc +{ +public: + CDoc(); + virtual ~CDoc() = default;; + void LoadSettings(LPCWSTR keyName); + void SaveSettings(LPCWSTR keyName); + + bool GetCheckA() { return m_isCheckA; } + void SetCheckA(bool isChecked) { m_isCheckA = isChecked; } + + bool GetCheckB() { return m_isCheckB; } + void SetCheckB(bool isChecked) { m_isCheckB = isChecked; } + + bool GetCheckC() { return m_isCheckC; } + void SetCheckC(bool isChecked) { m_isCheckC = isChecked; } + + UINT GetRadio() { return m_radio; } + void SetRadio(UINT radio) { m_radio = radio; } + +private: + bool m_isCheckA; + bool m_isCheckB; + bool m_isCheckC; + DWORD m_radio; +}; + +#endif //SDI_DOC_H diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/HelpAbout.cpp b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/HelpAbout.cpp new file mode 100644 index 00000000..5de344e1 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/HelpAbout.cpp @@ -0,0 +1,24 @@ +///////////////////////////// +// HelpAbout.cpp +// + +#include "stdafx.h" +#include "HelpAbout.h" +#include "resource.h" + +////////////////////////////////// +// CAboutHelp function definitions +// + +// Constructor. +CAboutHelp::CAboutHelp() : CDialog(IDW_ABOUT) +{ + m_credits = "Use the SetCredits function to specify this dialog's text"; +} + +// Called before the dialog is displayed. +BOOL CAboutHelp::OnInitDialog() +{ + SetDlgItemText(IDC_ABOUT_CREDITS, m_credits); + return TRUE; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/HelpAbout.h b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/HelpAbout.h new file mode 100644 index 00000000..210f2555 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/HelpAbout.h @@ -0,0 +1,30 @@ +///////////////////////////// +// HelpAbout.h +// + +#ifndef HELPABOUT_H +#define HELPABOUT_H + +///////////////////////////////////////////////////////////////// +// CAboutHelp manages the dialog which displays information about +// this application. +class CAboutHelp : public CDialog +{ +public: + CAboutHelp(); + virtual ~CAboutHelp() override = default; + + const CString& GetCredits() const { return m_credits; } + void SetCredits(LPCWSTR credits) { m_credits = credits; } + +protected: + virtual BOOL OnInitDialog() override; + +private: + CAboutHelp(const CAboutHelp&) = delete; + CAboutHelp& operator=(const CAboutHelp&) = delete; + + CString m_credits; // AboutBox contents +}; + +#endif // HELPABOUT_H diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/Mainfrm.cpp b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/Mainfrm.cpp new file mode 100644 index 00000000..a59deee6 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/Mainfrm.cpp @@ -0,0 +1,439 @@ +///////////////////////////// +// Mainfrm.cpp +// + +#include "stdafx.h" +#include +#include "Mainfrm.h" +#include "resource.h" + +constexpr COLORREF lightgray = RGB(192, 192, 192); +constexpr COLORREF magenta = RGB(255, 0, 255); + +////////////////////////////////// +// CMainFrame function definitions +// + +// Constructor +CMainFrame::CMainFrame() : m_view(IDD_DIALOG1), m_isChoosing(FALSE) +{ +} + +// Enables choose topic mode +BOOL CMainFrame::ChooseHelpTopic() +{ + ::SetCursor(::LoadCursor(nullptr, IDC_HELP)); + SetCapture(); + m_isChoosing = TRUE; + return TRUE; +} + +// Create the frame window. +HWND CMainFrame::Create(HWND parent) +{ + // Set the modeless dialog as the view window of the frame. + SetView(m_view); + + // Set the registry key name, and load the initial window position. + // Use a registry key name like "CompanyName\\Application". + CString appName = LoadString(IDS_APP_NAME); + CString groupFolder = LoadString(IDS_GROUP_FOLDER); + LoadRegistrySettings(groupFolder + appName); + + // Set the path to the chm help file for m_AppHelp + // generate the help file directory and path strings + CString helpFilename = LoadString(IDS_HELP_FILE); + CString helpDir = CreateAppDataFolder(groupFolder + appName); + CString helpPath = helpDir + "\\" + helpFilename; + + if (!::PathFileExists(helpPath)) + { + // The Help file is not in AppDataPath yet so copy it there + CString OrigHelpPath = "..\\help\\" + helpFilename; + + if (!::CopyFile(OrigHelpPath, helpPath, TRUE)) + { + // The file copy failed, so set the path to the current folder. + // The Help file might be located with the program's executable. + helpPath = helpFilename; + } + } + + if (::PathFileExists(helpPath)) + { + // Specify the help file used by CHelp. + m_appHelp.SetHelpFilePath(helpPath); + } + else + { + CString msg = L"Failed to find " + LoadString(IDS_HELP_FILE); + ::MessageBox(nullptr, msg, L"File not found", MB_ICONWARNING); + } + + // Generate the Win32++ version string. + UINT ver = _WIN32XX_VER; + CString win32Version; + win32Version.Format(L"using Win32++ Version %d.%d.%d", ver / 0x100, + (ver % 0x100) / 0x10, (ver % 0x10)); + + // Generate compiler information for the About box. + CString sCompiler; +#ifdef __GNUC__ + sCompiler.Format(L"Gnu C++ %d.%d.%d", __GNUC__, __GNUC_MINOR__, + __GNUC_PATCHLEVEL__); +#elif defined(_MSC_VER) + sCompiler.Format(L"MS C++ %d.%d", _MSC_VER / 100, _MSC_VER % 100); +#elif defined(__BORLANDC__) + sCompiler = L"an Embarcadero compiler"; +#else + sCompiler = L"an unknown compiler"; +#endif + + // Set the information used in the Help About dialog. + CString aboutBoxInfo = LoadString(IDW_MAIN); + aboutBoxInfo += '\n' + LoadString(IDS_APP_VERSION); + aboutBoxInfo += "\ncompiled with " + sCompiler; + aboutBoxInfo += " on " + CString(__DATE__); + aboutBoxInfo += "\n" + win32Version; + m_appHelp.SetCredits(aboutBoxInfo); + + return CFrame::Create(parent); +} + +// Return a string consisting of the APPDATA folder with the specified +// folder appended. Create this folder if it does not exist. Throws a +// CUserException if the folder creation fails. +CString CMainFrame::CreateAppDataFolder(const CString& subfolder) +{ + CString appDataPath = GetAppDataPath(); + if (!appDataPath.IsEmpty()) + { + appDataPath += L"\\" + subfolder; + ::SHCreateDirectory(nullptr, appDataPath); + + DWORD attributes = GetFileAttributes(appDataPath); + if ((attributes == INVALID_FILE_ATTRIBUTES) || !(attributes & FILE_ATTRIBUTE_DIRECTORY)) + throw CFileException(appDataPath, L"Failed to access app directory"); + } + else + appDataPath = L"."; + + return appDataPath; +} + +// Identifies the window from the cursor position and returns its ID. +UINT CMainFrame::GetIDFromCursorPos() +{ + UINT id = 0; + CPoint pt = GetCursorPos(); + HWND control = ::WindowFromPoint(pt); + + if (control == GetToolBar().GetHwnd()) + { + // Over the toolbar window, so identify the toolbar button + + int button = GetToolBar().HitTest(); + id = GetToolBar().GetCommandID(button); + } + else if (control == GetHwnd()) + { + // Over the frame window. Check to see if we are over a non-client area spot. + + // The WM_NCHITTEST message returns a value indicating the position of the + // cursor hot spot within the non-client area. + int result = static_cast(SendMessage(WM_NCHITTEST, 0, MAKELPARAM(pt.x, pt.y))); + + id = IDFR_NCFRAME + result; // As defined in resource.h + } + else if (control != 0) + { + // The view window (dialog), dialog controls, menubar and statusbar all have control IDs. + id = ::GetDlgCtrlID(control); + } + + return id; +} + +BOOL CMainFrame::LoadRegistrySettings(LPCWSTR keyName) +{ + CFrame::LoadRegistrySettings(keyName); + GetDoc().LoadSettings(GetRegistryKeyName().c_str()); + + return TRUE; +} + +// Processes accelerators, toolbar buttons and menu input +BOOL CMainFrame::OnCommand(WPARAM wparam, LPARAM) +{ + UINT id = LOWORD(wparam); + + switch(id) + { + case ID_CHECK_A: return m_view.OnCheckA(); + case ID_CHECK_B: return m_view.OnCheckB(); + case ID_CHECK_C: return m_view.OnCheckC(); + + case IDM_FILE_EXIT: return OnFileExit(); + case IDW_VIEW_STATUSBAR: return OnViewStatusBar(); + case IDW_VIEW_TOOLBAR: return OnViewToolBar(); + + case ID_RADIO_A: + case ID_RADIO_B: // intentionally blank + case ID_RADIO_C: return m_view.OnRangeOfIDs(ID_RADIO_A, ID_RADIO_C, id); + + case IDM_HELP_ABOUT: return m_appHelp.About(*this); // Menu item + case IDM_HELP_CONTENT: return ShowHelpTopic(id); // Menu item + case IDM_HELP_CONTEXT: return ChooseHelpTopic(); // Toolbar Button + case IDM_SHIFT_F1: return OnShiftF1(); // Accelerator + case IDM_F1: return OnF1(); // Accelerator + + } + + return FALSE; +} + +// OnCreate controls the way the frame is created. +// Overriding CFrame::OnCreate is optional. +int CMainFrame::OnCreate(CREATESTRUCT& cs) +{ + // A menu is added if the IDW_MAIN menu resource is defined. + // Frames have all options enabled by default. + // Use the following functions to disable options. + + // UseIndicatorStatus(FALSE); // Don't show keyboard indicators in the StatusBar. + // UseMenuStatus(FALSE); // Don't show menu descriptions in the StatusBar. + // UseOwnerDrawnMenu(FALSE); // Don't use owner draw for popup menu items. + // UseReBar(FALSE); // Don't use a ReBar. + // UseStatusBar(FALSE); // Don't use a StatusBar. + // UseThemes(FALSE); // Don't use themes. + // UseToolBar(FALSE); // Don't use a ToolBar. + + // call the base class function + int result = CFrame::OnCreate(cs); + + // Add control IDs for various windows + GetView().SetWindowLongPtr(GWLP_ID, IDD_DIALOG1); + GetMenuBar().SetWindowLongPtr(GWLP_ID, IDW_MENUBAR); + GetStatusBar().SetWindowLongPtr(GWLP_ID, IDW_STATUSBAR); + + return result; +} + +// Called when the F1 key is pressed. +BOOL CMainFrame::OnF1() +{ + UINT id = GetIDFromCursorPos(); + + if (id != 0) + m_appHelp.ShowHelpTopic(id); + else + m_appHelp.ShowHelpTopic(L"Introduction"); + + return TRUE; +} + +// Issue a close request to the frame. +BOOL CMainFrame::OnFileExit() +{ + Close(); + return TRUE; +} + +void CMainFrame::OnInitialUpdate() +{ + // The frame is now created. + // Place any additional startup code here. + +} + +// Updates the check state of the various menu items +void CMainFrame::OnMenuUpdate(UINT id) +{ + + switch (id) + { + case ID_CHECK_A: OnUpdateCheckA(id); break; + case ID_CHECK_B: OnUpdateCheckB(id); break; + case ID_CHECK_C: OnUpdateCheckC(id); break; + } + + if ((id >= ID_RADIO_A) && (id <= ID_RADIO_C)) + OnUpdateRangeOfIDs(ID_RADIO_A, ID_RADIO_C, id); + + CFrame::OnMenuUpdate(id); +} + +// Handle the left mouse button click. +// Note: When the frame has mouse capture, clicks over child windows are processed here too. +LRESULT CMainFrame::OnLButtonDown(UINT msg, WPARAM wparam, LPARAM lparam) +{ + if (GetCapture() == *this) + { + UINT id = GetIDFromCursorPos(); + ShowHelpTopic(id); + ReleaseCapture(); + m_isChoosing = FALSE; + return 0; + } + + return FinalWindowProc(msg, wparam, lparam); +} + +// Modifies the cursor when appropriate. +LRESULT CMainFrame::OnSetCursor(UINT msg, WPARAM wparam, LPARAM lparam) +{ + if (m_isChoosing) + { + ::SetCursor(::LoadCursor(nullptr, IDC_HELP)); + return TRUE; + } + + return FinalWindowProc(msg, wparam, lparam); +} + +// Called when the F1 key is pressed while SHIFT is held down. +BOOL CMainFrame::OnShiftF1() +{ + ChooseHelpTopic(); + return TRUE; +} + +// Updates the menu when check box A is clicked. +void CMainFrame::OnUpdateCheckA(UINT id) +{ + BOOL checkA = GetDoc().GetCheckA(); + GetFrameMenu().CheckMenuItem(id, checkA ? MF_CHECKED : MF_UNCHECKED); +} + +// Updates the menu when check box B is clicked. +void CMainFrame::OnUpdateCheckB(UINT id) +{ + BOOL checkB = GetDoc().GetCheckB(); + GetFrameMenu().CheckMenuItem(id, checkB ? MF_CHECKED : MF_UNCHECKED); +} + +// Updates the menu when check box C is clicked. +void CMainFrame::OnUpdateCheckC(UINT id) +{ + BOOL checkC = GetDoc().GetCheckC(); + GetFrameMenu().CheckMenuItem(id, checkC ? MF_CHECKED : MF_UNCHECKED); +} + +// Updates the menu when a radio button is selected. +void CMainFrame::OnUpdateRangeOfIDs(UINT idFirst, UINT idLast, UINT id) +{ + int fileItem = GetFrameMenu().FindMenuItem(L"&Select"); + CMenu radioMenu = GetFrameMenu().GetSubMenu(fileItem); + if (GetDoc().GetRadio() == id) + radioMenu.CheckMenuRadioItem(idFirst, idLast, id, MF_BYCOMMAND); +} + +// Sets the CREATESTRUCT parameters before the window is created. +void CMainFrame::PreCreate(CREATESTRUCT& cs) +{ + // Call base clase to set defaults + CFrame::PreCreate(cs); + + cs.style &= ~WS_MAXIMIZEBOX; + cs.style &= ~WS_MINIMIZEBOX; + cs.dwExStyle |= WS_EX_CONTEXTHELP; +} + +// Stores settings in the registry. +BOOL CMainFrame::SaveRegistrySettings() +{ + CFrame::SaveRegistrySettings(); + GetDoc().SaveSettings(GetRegistryKeyName().c_str()); + + return TRUE; +} + +// Specify the icons used in popup menus. +void CMainFrame::SetupMenuIcons() +{ + std::vector data = GetToolBarData(); + if (GetMenuIconHeight() >= 24) + SetMenuIcons(data, magenta, IDB_TOOLBAR24); + else + SetMenuIcons(data, lightgray, IDB_TOOLBAR16); +} + +// Set the resource IDs and images for the toolbar buttons. +void CMainFrame::SetupToolBar() +{ + // Connect button IDs to button icons. + AddToolBarButton(IDM_FILE_NEW, FALSE); + AddToolBarButton(IDM_FILE_OPEN, FALSE); + AddToolBarButton(IDM_FILE_SAVE, FALSE); + AddToolBarButton(IDM_FILE_SAVEAS, FALSE); + AddToolBarButton(0); // Separator + AddToolBarButton(IDM_EDIT_CUT, FALSE); + AddToolBarButton(IDM_EDIT_COPY, FALSE); + AddToolBarButton(IDM_EDIT_PASTE, FALSE); + AddToolBarButton(0); // Separator + AddToolBarButton(IDM_FILE_PRINT, FALSE); + AddToolBarButton(0); // Separator + AddToolBarButton(IDM_HELP_CONTENT); + AddToolBarButton(IDM_HELP_CONTEXT); + AddToolBarButton(0); // Separator + + // Set the toolbar image list. + SetToolBarImages(magenta, IDB_TOOLBAR24); +} + +// Called for a System Command such as SC_CLOSE, SC_CONTEXTHELP etc. +LRESULT CMainFrame::OnSysCommand(UINT msg, WPARAM wparam, LPARAM lparam) +{ + if (wparam == SC_CONTEXTHELP) + ChooseHelpTopic(); + + // Now call CFrame's OnSysCommand + return CFrame::OnSysCommand(msg, wparam, lparam); +} + +// Display the context help for the specified topic. +BOOL CMainFrame::ShowHelpTopic(UINT id) +{ + m_appHelp.ShowHelpTopic(id); + return TRUE; +} + +// Handle the frame's window messages. +LRESULT CMainFrame::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case WM_SETCURSOR: return OnSetCursor(msg, wparam, lparam); // Modify the cursor when appropriate + case WM_SYSCOMMAND: return OnSysCommand(msg, wparam, lparam); // Add SC_CONTEXTHELP support + case WM_HELP: return 0; // Suppress default handling on F1 and SHIFT F1 + case WM_LBUTTONDOWN: return OnLButtonDown(msg, wparam, lparam); // Handle left mouse click + } + + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/Mainfrm.h b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/Mainfrm.h new file mode 100644 index 00000000..57244dd9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/Mainfrm.h @@ -0,0 +1,65 @@ +///////////////////////////// +// Mainfrm.h +// + +#ifndef MAINFRM_H +#define MAINFRM_H + +#include "View.h" +#include "AppHelp.h" + + +/////////////////////////////////////////////////////////// +// CMainFrame manages the application's main window. +// The main window is a frame which has a menubar, toolbar, +// statusbar and view window. +class CMainFrame : public CFrame +{ +public: + CMainFrame(); + virtual ~CMainFrame() override = default; + virtual HWND Create(HWND parent = nullptr) override; + +protected: + virtual BOOL LoadRegistrySettings(LPCWSTR keyName) override; + virtual BOOL OnCommand(WPARAM wparam, LPARAM lparam) override; + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual void OnInitialUpdate() override; + virtual void OnMenuUpdate(UINT id) override; + virtual LRESULT OnSysCommand(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual BOOL SaveRegistrySettings() override; + virtual void SetupMenuIcons() override; + virtual void SetupToolBar() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CMainFrame(const CMainFrame&) = delete; + CMainFrame& operator=(const CMainFrame&) = delete; + + BOOL ChooseHelpTopic(); + CString CreateAppDataFolder(const CString& subfolder); + CDoc& GetDoc() { return m_view.GetDoc(); } + UINT GetIDFromCursorPos(); + BOOL OnF1(); + BOOL OnFileExit(); + BOOL OnShiftF1(); + void OnUpdateCheckA(UINT id); + void OnUpdateCheckB(UINT id); + void OnUpdateCheckC(UINT id); + void OnUpdateRangeOfIDs(UINT idFirst, UINT idLast, UINT id); + BOOL ShowHelpTopic(UINT id); + + // Message handlers + LRESULT OnLButtonDown(UINT msg, WPARAM wparam, LPARAM lparam); + LRESULT OnSetCursor(UINT msg, WPARAM wparam, LPARAM lparam); + + // Member variables + CView m_view; + CHelp m_appHelp; // Help object for context help and help about dialog + BOOL m_isChoosing; +}; + + +#endif //MAINFRM_H + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/Resource.rc b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/Resource.rc new file mode 100644 index 00000000..a9e593d9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/Resource.rc @@ -0,0 +1,278 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "../src/res/PerMonitorV2.manifest" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDW_MAIN MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "New\tCtrl+N", IDM_FILE_NEW, GRAYED + MENUITEM "&Open...\tCtrl+O", IDM_FILE_OPEN, GRAYED + MENUITEM "&Save\tCtrl+S", IDM_FILE_SAVE, GRAYED + MENUITEM "Save &As...", IDM_FILE_SAVEAS, GRAYED + MENUITEM "Close", IDM_FILE_CLOSE, GRAYED + MENUITEM SEPARATOR + MENUITEM "&Print...\tCtrl+P", IDM_FILE_PRINT, GRAYED + MENUITEM SEPARATOR + MENUITEM "E&xit\tAlt+F4", IDM_FILE_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "Undo\tCtrl+Z", IDM_EDIT_UNDO, GRAYED + MENUITEM "Redo\tCtrl+Y", IDM_EDIT_REDO, GRAYED + MENUITEM SEPARATOR + MENUITEM "Cut\tCtrl+X", IDM_EDIT_CUT, GRAYED + MENUITEM "Copy\tCtrl+C", IDM_EDIT_COPY, GRAYED + MENUITEM "Paste\tCtrl+V", IDM_EDIT_PASTE, GRAYED + MENUITEM "Delete\tDel", IDM_EDIT_DELETE, GRAYED + END + POPUP "&View" + BEGIN + MENUITEM "&Tool Bar", IDW_VIEW_TOOLBAR, CHECKED + MENUITEM "&Status Bar", IDW_VIEW_STATUSBAR, CHECKED + END + POPUP "&Select" + BEGIN + MENUITEM "Radio A", ID_RADIO_A + MENUITEM "Radio B", ID_RADIO_B + MENUITEM "Radio C", ID_RADIO_C + MENUITEM SEPARATOR + MENUITEM "Check A", ID_CHECK_A + MENUITEM "Check B", ID_CHECK_B + MENUITEM "Check C", ID_CHECK_C + END + POPUP "&Help" + BEGIN + MENUITEM "&Manual", IDM_HELP_CONTENT + MENUITEM "&About\tF1", IDM_HELP_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDW_MAIN ICON "../src/res/ContextHelp.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_TOOLBAR16 BITMAP "../src/res/Toolbar16.bmp" +IDB_TOOLBAR24 BITMAP "../src/res/Toolbar24.bmp" +IDB_BITMAP1 BITMAP "../src/res/Zapotec.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDW_ABOUT DIALOGEX 200, 200, 300, 150 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | + WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "MS Shell Dlg", 400, 0 +BEGIN + // This dialog's text is set by the application + CTEXT "", IDC_ABOUT_CREDITS, 25, 10, 250, 100 + ICON IDW_MAIN, 0, 4, 4, 20, 20 +END + + +IDD_DIALOG1 DIALOGEX 0, 0, 321, 199 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE +EXSTYLE WS_EX_CLIENTEDGE +FONT 8, "MS Shell Dlg", 0, 0 +BEGIN + DEFPUSHBUTTON "OK", IDOK, 241, 153, 50, 16 + CONTROL "Radio_A", ID_RADIO_A, "Button", BS_AUTORADIOBUTTON | + WS_TABSTOP, 30, 24, 48, 10 + CONTROL "Radio_B", ID_RADIO_B, "Button", BS_AUTORADIOBUTTON, + 30, 36, 48, 10 + CONTROL "Radio_C", ID_RADIO_C, "Button", BS_AUTORADIOBUTTON, + 30, 48, 48, 10 + PUSHBUTTON "Button", IDC_BUTTON1, 30, 82, 49, 11, WS_TABSTOP + CONTROL "Check Box A", ID_CHECK_A, "Button", BS_AUTOCHECKBOX | + WS_TABSTOP, 30, 114, 55, 10 + CONTROL "Check Box B", ID_CHECK_B, "Button", BS_AUTOCHECKBOX | + WS_TABSTOP, 30, 126, 55, 10 + CONTROL "Check Box C", ID_CHECK_C, "Button", BS_AUTOCHECKBOX | + WS_TABSTOP, 30, 139, 55, 10 + LISTBOX IDC_LIST1, 120, 23, 84, 35, LBS_SORT | LBS_NOINTEGRALHEIGHT | + NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP, WS_EX_STATICEDGE + EDITTEXT IDC_EDIT1, 120, 82, 84, 35, ES_MULTILINE | ES_AUTOHSCROLL | + NOT WS_BORDER | WS_VSCROLL | WS_HSCROLL, WS_EX_STATICEDGE + CONTROL "", IDC_RICHEDIT1, "RichEdit50W" , ES_MULTILINE | + ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | WS_VSCROLL | + WS_HSCROLL, 120, 142, 84, 35 + CONTROL IDB_BITMAP1, IDC_BITMAP1, "Static", SS_BITMAP | SS_NOTIFY | + WS_TABSTOP, 231, 7, 64, 59 + GROUPBOX "Status Window", IDC_GROUP1, 226, 78, 78, 51, BS_CENTER + LTEXT "Actions are displayed here", IDC_STATUS, 229, 91, 71, 35, + SS_NOTIFY | WS_TABSTOP +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDW_MAIN ACCELERATORS +BEGIN + "N", IDM_FILE_NEW, VIRTKEY, CONTROL, NOINVERT + "O", IDM_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT + "P", IDM_FILE_PRINT, VIRTKEY, CONTROL, NOINVERT + "S", IDM_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT + "C", IDM_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + "X", IDM_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT + "V", IDM_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT + "Z", IDM_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT + "Y", IDM_EDIT_REDO, VIRTKEY, CONTROL, NOINVERT + VK_F1, IDM_SHIFT_F1, VIRTKEY, SHIFT, NOINVERT + VK_F1, IDM_F1, VIRTKEY, NOINVERT +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDW_MAIN "Context Help Demo Program" + IDW_VIEW_TOOLBAR "Show or hide the tool bar" + IDW_VIEW_STATUSBAR "Show or hide the status bar" + IDW_INDICATOR_CAPS "CAP" + IDW_INDICATOR_NUM "NUM" + IDW_INDICATOR_SCRL "SCRL" + IDW_READY "Ready" + IDS_GROUP_FOLDER "Win32++\\" + IDS_APP_NAME "ContextHelp" + IDS_HELP_FILE "ContextHelp.chm" + IDS_APP_VERSION "Version 1.0 (2017)" +END + +STRINGTABLE +BEGIN + IDM_FILE_NEW "Create a New Document" + IDM_FILE_OPEN "Open Existing Document" + IDM_FILE_SAVE "Save the Document" + IDM_FILE_SAVEAS "Save the Document with a new name" + IDM_FILE_CLOSE "Close the Document" + IDM_FILE_PRINT "Print the Document" + IDM_FILE_PRINT_PREVIEW "Preview the printed the Document" + IDM_FILE_EXIT "End the Program" +END + +STRINGTABLE +BEGIN + IDM_EDIT_CUT "Cut the Selected Contents to the Clipboard" + IDM_EDIT_COPY "Copy the Selected Contents to the Clipboard" + IDM_EDIT_FIND "Find the selected text" + IDM_EDIT_PASTE "Paste the Clipboard Contents to the Document" + IDM_EDIT_REPLACE "Find and replace text" + IDM_EDIT_DELETE "Erase the selected Contents" + IDM_EDIT_UNDO "Undo the last action" + IDM_EDIT_REDO "Redo the previously undone action" +END + +STRINGTABLE +BEGIN + IDM_FONT_CHOICE "Choose a font for..." + IDM_COLOR_CHOICE "Choose a color for..." + IDM_HELP_CONTENT "Show the user manual" + IDM_HELP_CONTEXT "Show a topic in the user manual" + IDW_ABOUT "Display Information about this program" +END + +STRINGTABLE +BEGIN + ID_CHECK_A "Hint for CheckA" + ID_CHECK_B "Hint for CheckB" + ID_CHECK_C "Hint for CheckC" + ID_RADIO_A "Radio Button A" + ID_RADIO_B "Radio Button B" + ID_RADIO_C "Radio Button C" + IDB_BITMAP1 "Zapotec bitmap" +END + +STRINGTABLE +BEGIN + SC_CLOSE "Close the Window" + SC_MAXIMIZE "Maximize the Window" + SC_MINIMIZE "Minimize the Window" + SC_MOVE "Move the Window" + SC_NEXTWINDOW "Select Next Window" + SC_PREVWINDOW "Select Previous Window" + SC_RESTORE "Restore the Window" + SC_SIZE "Resize the Window" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/StdAfx.cpp b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/StdAfx.cpp new file mode 100644 index 00000000..8957144d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/StdAfx.cpp @@ -0,0 +1,16 @@ +///////////////////////////// +// StdAfx.cpp +// + +// This file is used for precompiled hearders. Precompiled headers allow +// programs to be recompiled more quickly + +// To use precompiled headers, do the following: +// 1) Add the set of rarely changed headers to stdafx.h +// 2) Include stdafx.h in each cpp file. It must be included first. +// 3) Add stdafx.cpp to your project. +// 4) Turn on precompiled hearders in the project + + +#include "stdafx.h" + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/View.cpp b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/View.cpp new file mode 100644 index 00000000..3f0505a0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/View.cpp @@ -0,0 +1,259 @@ +///////////////////////////// +// View.cpp +// + +#include "stdafx.h" +#include "View.h" +#include "resource.h" + +////////////////////////////////// +// Definitions for the CView class +// + +// Constructor. +CView::CView(UINT resID) : CDialog(resID), m_parent(nullptr) +{ +} + +// Creates the view window. Its a modeless dialog. +HWND CView::Create(HWND parent = nullptr) +{ + m_parent = parent; + return DoModeless(parent); +} + +// Process the dialog's window messages. +INT_PTR CView::DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass messages on to the resizer. + m_resizer.HandleMessage(msg, wparam, lparam); + + switch (msg) + { + case WM_SIZE: return OnSize(msg, wparam, lparam); + } + + // Pass unhandled messages on to parent DialogProc. + return DialogProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + +void CView::DpiScaleImage() +{ + m_patternImage.LoadBitmap(IDB_BITMAP1); + m_patternImage = DpiScaleUpBitmap(m_patternImage); + LPARAM lparam = reinterpret_cast(m_patternImage.GetHandle()); + m_picture.SendMessage(STM_SETIMAGE, IMAGE_BITMAP, lparam); +} + +// Retrieves a reference to CDoc. +CDoc& CView::GetDoc() +{ + return m_doc; +} + +// Called when the button is pressed. +BOOL CView::OnButton() +{ + SetDlgItemText(IDC_STATUS, L"Button Pressed"); + TRACE("Button Pressed\n"); + return TRUE; +} + +// Called when the esc key is pressed. +void CView::OnCancel() +{ + // Discard these messages + SetDlgItemText(IDC_STATUS, L"Cancel Pressed."); + TRACE("Cancel Pressed.\n"); +} + +// Called when a request is made to close the dialog. +void CView::OnClose() +{ + // Suppress handling of WM_CLOSE for the dialog. + // An edit control will send WM_CLOSE to the dialog if the Esc button is pressed. +} + +// Process command notifications from the dialog's controls. +BOOL CView::OnCommand(WPARAM wparam, LPARAM) +{ + WORD id = LOWORD(wparam); + + switch (id) + { + case IDC_BUTTON1: return OnButton(); + case ID_CHECK_A: return OnCheckA(); + case ID_CHECK_B: return OnCheckB(); + case ID_CHECK_C: return OnCheckC(); + + case ID_RADIO_A: + case ID_RADIO_B: // intentionally blank + case ID_RADIO_C: return OnRangeOfIDs(ID_RADIO_A, ID_RADIO_C, id); + } + + return FALSE; +} + +// Called before the dialog (view window) is displayed. +BOOL CView::OnInitDialog() +{ + // Set the Icon + SetIconLarge(IDW_MAIN); + SetIconSmall(IDW_MAIN); + + // Attach CWnd objects to the dialog items + AttachItem(IDC_BUTTON1, m_button); + AttachItem(ID_CHECK_A, m_checkA); + AttachItem(ID_CHECK_B, m_checkB); + AttachItem(ID_CHECK_C, m_checkC); + AttachItem(IDC_EDIT1, m_edit); + AttachItem(IDC_LIST1, m_listBox); + AttachItem(IDOK, m_ok); + AttachItem(ID_RADIO_A, m_radioA); + AttachItem(ID_RADIO_B, m_radioB); + AttachItem(ID_RADIO_C, m_radioC); + AttachItem(IDC_RICHEDIT1, m_richEdit); + AttachItem(IDC_GROUP1, m_group); + AttachItem(IDC_STATUS, m_status); + AttachItem(IDC_BITMAP1, m_picture); + + // Put some text in the edit boxes + SetDlgItemText(IDC_EDIT1, L"Edit Control"); + SetDlgItemText(IDC_RICHEDIT1, L"Rich Edit Window"); + + // Put some text in the list box + for (int i = 0 ; i < 8 ; i++) + { + m_listBox.AddString(L"List Box"); + } + + // Set initial button states + bool isChecked = GetDoc().GetCheckA(); + int checkState = isChecked ? BST_CHECKED : BST_UNCHECKED; + m_checkA.SetCheck(checkState); + + isChecked = GetDoc().GetCheckB(); + checkState = isChecked ? BST_CHECKED : BST_UNCHECKED; + m_checkB.SetCheck(checkState); + + isChecked = GetDoc().GetCheckC(); + checkState = isChecked ? BST_CHECKED : BST_UNCHECKED; + m_checkC.SetCheck(checkState); + + UINT curRadio = GetDoc().GetRadio(); + OnRangeOfIDs(ID_RADIO_A, ID_RADIO_C, curRadio); + + // Initialize dialog resizing + m_resizer.Initialize( *this, CRect(0, 0, 450, 350) ); + m_resizer.AddChild(m_radioA, CResizer::topleft, 0); + m_resizer.AddChild(m_radioB, CResizer::topleft, 0); + m_resizer.AddChild(m_radioC, CResizer::topleft, 0); + m_resizer.AddChild(m_checkA, CResizer::topleft, 0); + m_resizer.AddChild(m_checkB, CResizer::topleft, 0); + m_resizer.AddChild(m_checkC, CResizer::topleft, 0); + m_resizer.AddChild(m_button, CResizer::topleft, 0); + m_resizer.AddChild(m_edit, CResizer::topleft, RD_STRETCH_WIDTH); + m_resizer.AddChild(m_listBox, CResizer::topleft, RD_STRETCH_WIDTH); + m_resizer.AddChild(m_richEdit, CResizer::topleft, RD_STRETCH_WIDTH | RD_STRETCH_HEIGHT); + m_resizer.AddChild(m_picture, CResizer::topright, 0); + m_resizer.AddChild(m_ok, CResizer::bottomright, 0); + m_resizer.AddChild(m_group, CResizer::bottomright, RD_STRETCH_HEIGHT); + m_resizer.AddChild(m_status, CResizer::bottomright, RD_STRETCH_HEIGHT); + + return TRUE; +} + +// Called when the OK button is pressed. +void CView::OnOK() +{ + SetDlgItemText(IDC_STATUS, L"OK Button Pressed."); + TRACE("OK Button Pressed.\n"); +} + +// Called when Check Box A is toggled. +BOOL CView::OnCheckA() +{ + TRACE("Check Box A\n"); + bool isCheckA = GetDoc().GetCheckA(); + isCheckA = !isCheckA; // Toggle + UINT checkFlag = isCheckA ? BST_CHECKED : BST_UNCHECKED; + CheckDlgButton(ID_CHECK_A, checkFlag); + GetDoc().SetCheckA(isCheckA); + + SetDlgItemText(IDC_STATUS, L"Check Box A toggled"); + return TRUE; +} + +// Called when Check Box B is toggled. +BOOL CView::OnCheckB() +{ + TRACE("Check Box B\n"); + bool isCheckB = GetDoc().GetCheckB(); + isCheckB = !isCheckB; // Toggle + UINT checkFlag = isCheckB ? BST_CHECKED : BST_UNCHECKED; + CheckDlgButton(ID_CHECK_B, checkFlag); + GetDoc().SetCheckB(isCheckB); + + SetDlgItemText(IDC_STATUS, L"Check Box B toggled"); + return TRUE; +} + +// Called when Check Box C is toggled. +BOOL CView::OnCheckC() +{ + TRACE("Check Box C\n"); + bool isCheckC = GetDoc().GetCheckC(); + isCheckC = !isCheckC; // Toggle + UINT checkFlag = isCheckC ? BST_CHECKED : BST_UNCHECKED; + CheckDlgButton(ID_CHECK_C, checkFlag); + GetDoc().SetCheckC(isCheckC); + + SetDlgItemText(IDC_STATUS, L"Check Box C toggled"); + return TRUE; +} + +// Called when the radio button is selected. +BOOL CView::OnRangeOfIDs(UINT firstID, UINT lastID, UINT clickedID) +{ + CheckRadioButton(firstID, lastID, clickedID); + + GetDoc().SetRadio(clickedID); + SetDlgItemText(IDC_STATUS, L"Radio changed"); + TRACE("Radio changed\n"); + + return TRUE; +} + +INT_PTR CView::OnSize(UINT msg, WPARAM wparam, LPARAM lparam) +{ + // Perform default processing first. + FinalWindowProc(msg, wparam, lparam); + + // Set the image size. + DpiScaleImage(); + return 0; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/View.h b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/View.h new file mode 100644 index 00000000..51d2e12f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/View.h @@ -0,0 +1,67 @@ +///////////////////////////// +// View.h +// + +#ifndef SDI_VIEW_H +#define SDI_VIEW_H + +#include "Doc.h" + +////////////////////////////////////////// +// CView manages CMainFrame's view window. +class CView : public CDialog +{ +public: + CView(UINT resID); + virtual ~CView() override = default; + virtual HWND Create(HWND hParent) override; + + void DpiScaleImage(); + CDoc& GetDoc(); + + // Command handlers + BOOL OnButton(); + BOOL OnCheckA(); + BOOL OnCheckB(); + BOOL OnCheckC(); + BOOL OnRangeOfIDs(UINT firstID, UINT lastID, UINT clickedID); + + // Command handlers + INT_PTR OnSize(UINT msg, WPARAM wparam, LPARAM lparam); + +protected: + virtual INT_PTR DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual void OnCancel() override; + virtual void OnClose() override; + virtual BOOL OnCommand(WPARAM wparam, LPARAM lparam) override; + virtual BOOL OnInitDialog() override; + virtual void OnOK() override; + +private: + CView(const CView&) = delete; + CView& operator=(const CView&) = delete; + + // Member variables + CDoc m_doc; + CResizer m_resizer; + HWND m_parent; // handle of parent frame + CBitmap m_patternImage; + + // Member variables for dialog controls. + CButton m_radioA; + CButton m_radioB; + CButton m_radioC; + CButton m_checkA; + CButton m_checkB; + CButton m_checkC; + CButton m_button; + CListBox m_listBox; + CEdit m_edit; + CRichEdit m_richEdit; + CStatic m_picture; + CStatic m_status; + CButton m_ok; + CWnd m_group; +}; + +#endif //SDI_VIEW_H diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/main.cpp b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/main.cpp new file mode 100644 index 00000000..0c359b6a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/main.cpp @@ -0,0 +1,40 @@ +///////////////////////////// +// main.cpp +// + +#include "stdafx.h" +#include "App.h" + +int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPWSTR, _In_ int) +{ + try + { + // Start Win32++. + CApp theApp; + + // Run the application. + return theApp.Run(); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return -1; +} \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/res/ContextHelp.ico b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/res/ContextHelp.ico new file mode 100644 index 00000000..ffba069b Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/res/ContextHelp.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/res/PerMonitorV2.manifest b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/res/PerMonitorV2.manifest new file mode 100644 index 00000000..d303e5c0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/res/PerMonitorV2.manifest @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + PerMonitorV2, PerMonitor + + + + + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/res/Toolbar16.bmp b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/res/Toolbar16.bmp new file mode 100644 index 00000000..3ccbec8e Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/res/Toolbar16.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/res/Toolbar24.bmp b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/res/Toolbar24.bmp new file mode 100644 index 00000000..8d20c837 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/res/Toolbar24.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/res/Zapotec.bmp b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/res/Zapotec.bmp new file mode 100644 index 00000000..9c5f34e8 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/res/Zapotec.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/resource.h b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/resource.h new file mode 100644 index 00000000..349474f9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/resource.h @@ -0,0 +1,96 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Resource.rc +// + +// include the Resource IDs defined by Win32++ +#include "default_resource.h" + +// resource ID for the About dialog text. +#define IDC_ABOUT_CREDITS 200 + +// IDs for non-client areas of the frame +// Add IDFR_NCFRAME to the value returned by the WM_NCHITTEST message +#define IDFR_NCFRAME 230 +#define IDFR_SYSTEMMENU (IDFR_NCFRAME + HTSYSMENU) +#define IDFR_CAPTION (IDFR_NCFRAME + HTCAPTION) +#define IDFR_GRIPPER (IDFR_NCFRAME + HTCLIENT) +#define IDFR_CLOSE (IDFR_NCFRAME + HTCLOSE) +#define IDFR_HELP (IDFR_NCFRAME + HTHELP) + +// ID for the statusbar windows +#define IDW_STATUSBAR 280 + +// Resource IDs for standard menu items and ToolBar items +#define IDM_FILE_NEW 301 +#define IDM_FILE_OPEN 302 +#define IDM_FILE_SAVE 303 +#define IDM_FILE_SAVEAS 304 +#define IDM_FILE_PRINT 305 +#define IDM_FILE_PRINT_PREVIEW 306 +#define IDM_FILE_CLOSE 307 +#define IDM_FILE_EXIT 308 +#define IDM_EDIT_UNDO 309 +#define IDM_EDIT_REDO 310 +#define IDM_EDIT_CUT 311 +#define IDM_EDIT_COPY 312 +#define IDM_EDIT_PASTE 313 +#define IDM_EDIT_FIND 314 +#define IDM_EDIT_REPLACE 315 +#define IDM_EDIT_DELETE 316 +#define IDM_FONT_CHOICE 317 +#define IDM_COLOR_CHOICE 318 +#define IDM_CREDITS 319 +#define IDM_HELP_ABOUT 320 +#define IDM_HELP_CONTENT 321 +#define IDM_HELP_CONTEXT 322 +#define IDM_SHIFT_F1 323 +#define IDM_F1 324 + +// Resource IDs for the app's menu-items +#define ID_RADIO_A 330 +#define ID_RADIO_B 331 +#define ID_RADIO_C 332 +#define ID_CHECK_A 333 +#define ID_CHECK_B 334 +#define ID_CHECK_C 335 + +// Resource string identifiers +#define IDS_GROUP_FOLDER 340 +#define IDS_APP_NAME 341 +#define IDS_HELP_FILE 342 +#define IDS_APP_VERSION 343 + +// Bitmap resource IDs for the toolbar and menu icons +#define IDB_TOOLBAR16 350 +#define IDB_TOOLBAR24 351 + +//Resource IDs for the dialog +#define IDD_DIALOG1 401 +#define IDC_EDIT1 420 +#define IDC_LIST1 421 +#define IDC_BUTTON1 422 +#define IDC_RICHEDIT1 423 +#define IDC_BITMAP1 430 +#define IDC_GROUP1 431 +#define IDC_STATUS 432 +#define IDC_HOTKEY1 440 +#define IDB_BITMAP1 450 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 359 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 360 +#endif +#endif + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/stdafx.h b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/stdafx.h new file mode 100644 index 00000000..08450116 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/ContextHelp/src/stdafx.h @@ -0,0 +1,90 @@ +///////////////////////////// +// StdAfx.h +// + +// This file is used for precompiled headers. +// Rarely modified header files should be included. +// Based on code provided by Lynn Allan. + + +#ifndef STDAFX_H +#define STDAFX_H + + +// Predefinitions for windows.h go here +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +// Specify Win32xx specific predefinitions here +//#define NO_USING_NAMESPACE // Don't use Win32xx namespace + +// Rarely modified header files should be included here +#include // Add support for std::vector +#include // Add support for std::map +#include // Add support for std::string +#include // Add support for stringstream +#include // Add support for the assert macro +#include // Add support for C style printf, sprintf, etc. +#include // Add support for C style character conversions atoi etc. +#include // Add support for C style TCHARs. + +// Add the Win32++ library +#include // Add CWinApp +#include // Add CArchive +#include // Add CAnimation, CComboBox, CComboBoxEx, CDateTime, CHeader, CHotKey, CIPAddress, CProgressBar, CSpinButton, CScrollBar, CSlider, CToolTip +#include // Add CCriticalSection, CThreadLock +#include // Add CString, CStringA, CStringW +#include // Add CDataExchange +#include // Add CDialog, CResizer +#include // Add CDockFrame, CMDIDockFrame +#include // Add CDocker, CDockContainer +#include // Add CException, CFileException, CNotSupportedException, CResourceException, CUserException, CWinException +#include // Add CFile +#include // Add CFileFind +#include // Add CFolderDialog +#include // Add CFrame +#include // Add CDC, CGDIObject, CBitmap, CBrush, CFont, CPalatte, CPen, CRgn +#include // Add CHGlobal +#include // Add CImageList +#include // Add CListView +#include // Add CMDIChild, CMDIFrame, CDockMDIFrame +#include // Add CMenu +#include // Add CMenuBar +#include // Add CMetaFile, CEnhMetaFile +#include // Add CEvent, CMutex, CSemaphore +#include // Add CPropertyPage, CPropertySheet +#include // Add CRebar +#include // Add CPoint, CRect, CSize +#include // Add CRegKey +#include // Add CRichEdit +#include // Add CScrollView +#include // Adds macros, windows header files, and CObject +#include // Add CSocket +#include // Add CStatusBar +#include // Add CButton, CEdit, CListBox +#include // Add CTab, CTabbedMDI +#include // Add AtoT, AtoW, TtoA, TtoW, WtoA, WtoT etc. +#include // Add MenuTheme, ReBarTheme, StatusBarTheme, ToolBarTheme +#include // Add CWinThread +#include // Add CTime +#include // Add CToolBar +#include // Add CTreeView +#include // Add CWebBrowser, CAXHost +#include // Add CWnd + +// WIN32_LEAN_AND_MEAN can't be used with these +#ifndef WIN32_LEAN_AND_MEAN + #include // Add CCommonDialog, CColorDialog, CFileDialog, CFindReplace, CFontDialog + #include // Add CFolderDialogEx + #include // Add CPrintPreview + #include // Add CPageSetupDialog, CPrintDialog + #include // Add CPrintDialogEx + #include // Add CTaskDialog + + // Visual Studio + #if defined (_MSC_VER) + #include // Add CRibbon, CRibbonFrame + #endif + +#endif // define WIN32_LEAN_AND_MEAN + +#endif // define STDAFX_H diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl.cbp b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl.cbp new file mode 100644 index 00000000..b12f2714 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl.cbp @@ -0,0 +1,141 @@ + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl.cbproj b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl.cbproj new file mode 100644 index 00000000..e5d1428c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl.cbproj @@ -0,0 +1,1520 @@ + + + {39461456-1040-43CB-9B40-5962EF847BB0} + 20.1 + None + True + Debug + Win64x + 1048579 + Application + CustomControl + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + JPHNE + .\Embarcadero\$(Platform)\$(Config) + .\Embarcadero\$(Platform)\$(Config) + false + true + true + $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + CppGuiApplication + System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + true + <_TCHARMapping>wchar_t + CustomControl + ..\..\..\include\;..\src\;$(IncludePath) + ..\..\..\include\;..\src\;$(ILINK_LibraryPath) + 3081 + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + $(BDSINCLUDE)\windows\sdk;$(BRCC_IncludePath) + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + ..\src\stdafx.h + none + + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + false + true + false + true + _DEBUG;$(Defines) + false + None + DEBUG + true + true + true + true + Full + true + true + true + true + true + $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) + $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + + + PerMonitorV2 + false + $(BDSLIB)\$(PLATFORM)$(CC_SUFFIX)\debug;$(ILINK_LibraryPath) + true + 1033 + + + PerMonitorV2 + true + 1033 + + + PerMonitorV2 + true + 1033 + + + NDEBUG;$(Defines) + None + + + PerMonitorV2 + false + true + 1033 + + + PerMonitorV2 + true + 1033 + + + PerMonitorV2 + true + 1033 + + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 0 + + + 1 + + + 2 + + + 3 + + + 4 + + + 5 + + + 6 + + + 7 + + +
Resource.res
+ 8 +
+ + 9 + + + 10 + true + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + +
+ + CPlusPlusBuilder.Personality.12 + CppGuiApplication + + + + False + True + True + False + + + Embarcadero C++Builder Office 2000 Servers Package + Embarcadero C++Builder Office XP Servers Package + + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + Assets\ + Logo150x150.png + true + + + + + Assets\ + Logo44x44.png + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + CustomControl.exe + true + + + + + CustomControl.exe + true + + + + + NewProject.exe + true + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 64 + + + classes + 64 + + + + + res\xml + 1 + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\mips + 1 + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-v21 + 1 + + + res\values-v21 + 1 + + + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + Contents + 1 + + + Contents + 1 + + + Contents + 1 + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + library\lib\armeabi-v7a + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen + 64 + + + ..\$(PROJECTNAME).launchscreen + 64 + + + + + 1 + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + + + + + + + + + + + + + True + True + True + + + 12 + + + + +
diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2015.sln b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2015.sln new file mode 100644 index 00000000..7f13b18d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2015.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CustomControl", "CustomControl_2015.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2015.vcxproj b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2015.vcxproj new file mode 100644 index 00000000..f59ca9fb --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2015.vcxproj @@ -0,0 +1,249 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + CustomControl + CustomControl + + + + Application + Unicode + v140_xp + + + Application + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + + + + + + + + + + + + + + + + + true + false + + + true + false + + + false + false + + + false + false + + + + Use + Level4 + true + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2015.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2015.vcxproj.filters new file mode 100644 index 00000000..59857c8b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2015.vcxproj.filters @@ -0,0 +1,221 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + {86790b47-d32f-41a7-b741-89ee90d64b6d} + + + {e15d7f75-acf5-492f-ba57-b883f91cfdc5} + + + {1dcddfe4-dd07-43c5-a6d4-b6a46f049287} + + + {cbba403a-bc76-477a-b285-e00b59b0a45a} + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2019.sln b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2019.sln new file mode 100644 index 00000000..3d29e768 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2019.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CustomControl", "CustomControl_2019.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {6A097950-6292-49A2-BFE2-40E4C35B52E3} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2019.vcxproj b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2019.vcxproj new file mode 100644 index 00000000..77e026c5 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2019.vcxproj @@ -0,0 +1,228 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + CustomControl + CustomControl + + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2019.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2019.vcxproj.filters new file mode 100644 index 00000000..403a0799 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2019.vcxproj.filters @@ -0,0 +1,221 @@ + + + + + {b712865a-d32c-4236-96ed-36316d4d1bfd} + + + {79a09424-0c46-402c-acef-d15b32705841} + + + {a5e2625c-4187-423c-ac63-f48ce9c57c76} + + + {8fc8aec3-ee0c-4b3e-bddb-57b85e800c1c} + + + + + Source FIles + + + Source FIles + + + Source FIles + + + Source FIles + + + Source FIles + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2022.sln b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2022.sln new file mode 100644 index 00000000..84f1f53d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2022.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CustomControl", "CustomControl_2022.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C2786FCD-B50F-4C4D-9E07-AF8E67A6B305} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2022.vcxproj b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2022.vcxproj new file mode 100644 index 00000000..951f5f6c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2022.vcxproj @@ -0,0 +1,239 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + CustomControl + CustomControl + 10.0 + + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2022.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2022.vcxproj.filters new file mode 100644 index 00000000..403a0799 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2022.vcxproj.filters @@ -0,0 +1,221 @@ + + + + + {b712865a-d32c-4236-96ed-36316d4d1bfd} + + + {79a09424-0c46-402c-acef-d15b32705841} + + + {a5e2625c-4187-423c-ac63-f48ce9c57c76} + + + {8fc8aec3-ee0c-4b3e-bddb-57b85e800c1c} + + + + + Source FIles + + + Source FIles + + + Source FIles + + + Source FIles + + + Source FIles + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2026.slnx b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2026.slnx new file mode 100644 index 00000000..b84d03a0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2026.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2026.vcxproj b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2026.vcxproj new file mode 100644 index 00000000..5eba1dbe --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2026.vcxproj @@ -0,0 +1,239 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + CustomControl + CustomControl + 10.0 + + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2026.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2026.vcxproj.filters new file mode 100644 index 00000000..e77329f9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_2026.vcxproj.filters @@ -0,0 +1,221 @@ + + + + + {b712865a-d32c-4236-96ed-36316d4d1bfd} + + + {79a09424-0c46-402c-acef-d15b32705841} + + + {a5e2625c-4187-423c-ac63-f48ce9c57c76} + + + {8fc8aec3-ee0c-4b3e-bddb-57b85e800c1c} + + + + + Source FIles + + + Source FIles + + + Source FIles + + + Source FIles + + + Source FIles + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_DEBUG.dev b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_DEBUG.dev new file mode 100644 index 00000000..28b0c204 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_DEBUG.dev @@ -0,0 +1,192 @@ +[Project] +FileName=CustomControl_DEBUG.dev +Name=CustomControl +UnitCount=11 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=CustomControl_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D _DEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Debug +ObjectOutput=.\Dev-C++\Debug +OverrideOutput=1 +OverrideOutputName=CustomControl.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=4 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[Unit1] +FileName=..\src\CustomControlApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\CustomControlApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\MyDialog.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\MyDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\MyWebControl.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\MyWebControl.h +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit8] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit11] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\Resource.rc +CompileCpp=1 +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit14] +FileName=Hyperlink.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit15] +FileName=Hyperlink.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit16] +FileName=Hyperlink.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit10] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_RELEASE.dev b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_RELEASE.dev new file mode 100644 index 00000000..4c5f39a6 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/ProjectFiles/CustomControl_RELEASE.dev @@ -0,0 +1,192 @@ +[Project] +FileName=CustomControl_RELEASE.dev +Name=CustomControl +UnitCount=11 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=CustomControl_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D NDEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@__@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-s_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Release +ObjectOutput=.\Dev-C++\Release +OverrideOutput=1 +OverrideOutputName=CustomControl.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=3 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[Unit1] +FileName=..\src\CustomControlApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\CustomControlApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\MyDialog.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\MyDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\MyWebControl.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\MyWebControl.h +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit8] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit11] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit10] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\Resource.rc +CompileCpp=1 +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit14] +FileName=Hyperlink.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit15] +FileName=Hyperlink.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit16] +FileName=Hyperlink.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/CustomControl/Readme.txt new file mode 100644 index 00000000..e986a9cc --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/Readme.txt @@ -0,0 +1,21 @@ +Custom Control Example +================== +This is sample demonstrates how to build a custom control and display it +in a dialog. The custom control is created from CWebBrowser. + + +Features demonstrated in this example +===================================== +* Registering a custom control. +* Specifying the custom control in resource.rc. +* Using CWebBrowser in a custom control. +* Automatic resizing of the custom control when the dialog is resized + +Note: +This sample uses the IWebBrowser2 interface to display web pages. The IWebBrowser2 +provides access to the same features as used by the Microsoft's Internet Explorer. +Support for Internet Explorer ended on June 15, 2022, so this sample might not render +web pages properly. + +Consider using using the EdgeBrowser and EdgeBrowserEx samples to display modern +web pages instead. diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/CustomControlApp.cpp b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/CustomControlApp.cpp new file mode 100644 index 00000000..446ba49f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/CustomControlApp.cpp @@ -0,0 +1,24 @@ +///////////////////////////// +// CustomControlApp.cpp +// + +#include "stdafx.h" +#include "CustomControlApp.h" +#include "resource.h" + +/////////////////////////////////////// +// Definitions for the CDialogApp class +// + +CCustomControlApp::CCustomControlApp() : m_myDialog(IDD_DIALOG1) +{ +} + +BOOL CCustomControlApp::InitInstance() +{ + // Display the modal dialog. + m_myDialog.DoModal(); // throws a CWinException on failure + + return TRUE; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/CustomControlApp.h b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/CustomControlApp.h new file mode 100644 index 00000000..2b85ca7c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/CustomControlApp.h @@ -0,0 +1,32 @@ +///////////////////////////// +// CustomControlApp.h +// + +#ifndef CUSTOMCONTROLAPP_H +#define CUSTOMCONTROLAPP_H + +#include "MyDialog.h" + + +///////////////////////////////////////////////////////////////// +// CCustomControlApp manages the application. It initializes the +// Win32++ framework when it is constructed, and creates the main +// dialog when it runs. +class CCustomControlApp : public CWinApp +{ +public: + CCustomControlApp(); + virtual ~CCustomControlApp() override = default; + +protected: + virtual BOOL InitInstance() override; + +private: + CCustomControlApp(const CCustomControlApp&) = delete; + CCustomControlApp& operator=(const CCustomControlApp&) = delete; + + CMyDialog m_myDialog; +}; + + +#endif // define CUSTOMCONTROLAPP_H diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/MyDialog.cpp b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/MyDialog.cpp new file mode 100644 index 00000000..0f7762f7 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/MyDialog.cpp @@ -0,0 +1,125 @@ +///////////////////////////// +// MyDialog.cpp +// + +#include "stdafx.h" +#include "MyDialog.h" +#include "resource.h" + +////////////////////////////////////// +// Definitions for the CMyDialog class +// + +// Constructor. +CMyDialog::CMyDialog(UINT resID) : CDialog(resID) +{ +} + +// Called when the dialog window is destroyed +void CMyDialog::OnDestroy() +{ + // Ends the application. + ::PostQuitMessage(0); +} + +// Processes the dialog's window messages. +INT_PTR CMyDialog::DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass resizing messages on to the resizer. + m_resizer.HandleMessage(msg, wparam, lparam); + + // switch (msg) + // { + // Additional messages to be handled go here + // } + + // Pass unhandled messages on to parent DialogProc. + return DialogProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + +// Called when the esc button is pressed. +void CMyDialog::OnCancel() +{ + // Suppress default handling of OnCancel. +} + +// Called when the Enter key is pressed. +void CMyDialog::OnOK() +{ + TRACE("Enter key pressed\n"); + // Send Ctrl M to the browser + + // Create a generic keyboard event structure + +#ifdef INPUT_KEYBOARD // Not supported on some old ms compilers + + INPUT ip; + ip.type = INPUT_KEYBOARD; + ip.ki.wScan = 0; + ip.ki.time = 0; + ip.ki.dwExtraInfo = 0; + + // Press the "Ctrl" key + ip.ki.wVk = VK_CONTROL; + ip.ki.dwFlags = 0; + SendInput(1, &ip, sizeof(ip)); + + // Press the "M" key + ip.ki.wVk = 'M'; + ip.ki.dwFlags = 0; + SendInput(1, &ip, sizeof(ip)); + + // Release the "M" key + ip.ki.wVk = 'M'; + ip.ki.dwFlags = KEYEVENTF_KEYUP; + SendInput(1, &ip, sizeof(ip)); + + // Release the "Ctrl" key + ip.ki.wVk = VK_CONTROL; + ip.ki.dwFlags = KEYEVENTF_KEYUP; + SendInput(1, &ip, sizeof(ip)); + +#endif +} + +// Called before the dialog is displayed. +BOOL CMyDialog::OnInitDialog() +{ + // Set the Icon + SetIconLarge(IDW_MAIN); + SetIconSmall(IDW_MAIN); + + // Attach the custom control to a CWnd object + m_webControl.AttachDlgItem(IDC_CUSTOMWEB, *this); + + // Support automatic resizing + m_resizer.Initialize( *this, CRect(0, 0, 300, 200) ); + m_resizer.AddChild(m_webControl, CResizer::topleft, RD_STRETCH_WIDTH|RD_STRETCH_HEIGHT); + + return TRUE; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/MyDialog.h b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/MyDialog.h new file mode 100644 index 00000000..a00c2417 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/MyDialog.h @@ -0,0 +1,34 @@ +///////////////////////////// +// MyDialog.h +// + +#ifndef MYDIALOG_H +#define MYDIALOG_H + + +#include "MyWebControl.h" + +/////////////////////////////////////////////////// +// CMyDialog manages the application's main dialog. +class CMyDialog : public CDialog +{ +public: + CMyDialog(UINT resID); + virtual ~CMyDialog() override = default; + +protected: + virtual void OnDestroy() override; + virtual INT_PTR DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual void OnCancel() override; + virtual BOOL OnInitDialog() override; + virtual void OnOK() override; + +private: + CMyDialog(const CMyDialog&) = delete; + CMyDialog& operator=(const CMyDialog&) = delete; + + CResizer m_resizer; + CWebControl m_webControl; +}; + +#endif //MYDIALOG_H diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/MyWebControl.cpp b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/MyWebControl.cpp new file mode 100644 index 00000000..0be51048 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/MyWebControl.cpp @@ -0,0 +1,72 @@ +///////////////////////////// +// MyWebControl.cpp +// + +#include "stdafx.h" +#include "MyWebControl.h" + +//////////////////////////////////////// +// Definitions for the CWebControl class +// + +// Constructor +CWebControl::CWebControl() +{ + // The entry for the dialog's control in resource.rc must match this name. + CString className = "WebControl"; + + // Register the window class + WNDCLASS wc{}; + HINSTANCE instance = GetApp()->GetInstanceHandle(); + if (!::GetClassInfo(instance, className, &wc)) + { + wc.lpszClassName = className; + wc.lpfnWndProc = ::DefWindowProc; + wc.hInstance = instance; + ::RegisterClass(&wc); + } + + assert (::GetClassInfo(instance, className, &wc)); +} + +// Called after the web control is created. +void CWebControl::OnInitialUpdate() +{ + // Suppress Java script errors. + GetIWebBrowser2()->put_Silent(VARIANT_TRUE); + + // Load web page. + Navigate2(L"www.google.com"); +} + +// Handle the window's messages. +LRESULT CWebControl::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/MyWebControl.h b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/MyWebControl.h new file mode 100644 index 00000000..74a41213 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/MyWebControl.h @@ -0,0 +1,29 @@ +///////////////////////////// +// MyWebControl.h +// + +#ifndef __MYCONTROL_H +#define __MYCONTROL_H + + +///////////////////////////////////////////////// +// CWebControl is a custom control for the dialog +// that displays a web browser. +class CWebControl : public CWebBrowser +{ +public: + CWebControl(); + virtual ~CWebControl() override = default; + +protected: + virtual void OnInitialUpdate() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CWebControl(const CWebControl&) = delete; + CWebControl& operator=(const CWebControl&) = delete; +}; + + +#endif // __MYCONTROL_H + diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/Resource.rc b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/Resource.rc new file mode 100644 index 00000000..78dc1bda --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/Resource.rc @@ -0,0 +1,87 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "../src/res/PerMonitorV2.manifest" + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDW_MAIN ICON "../src/res/Dialog.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_DIALOG1 DIALOGEX 0, 0, 310, 178 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME +EXSTYLE WS_EX_APPWINDOW +CAPTION "Resizable dialog with a Custom Control" +FONT 8, "MS Shell Dlg", 0, 0 +BEGIN + CONTROL "", IDC_CUSTOMWEB, "WebControl", 0, 11,23,288,146 +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/StdAfx.cpp b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/StdAfx.cpp new file mode 100644 index 00000000..8957144d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/StdAfx.cpp @@ -0,0 +1,16 @@ +///////////////////////////// +// StdAfx.cpp +// + +// This file is used for precompiled hearders. Precompiled headers allow +// programs to be recompiled more quickly + +// To use precompiled headers, do the following: +// 1) Add the set of rarely changed headers to stdafx.h +// 2) Include stdafx.h in each cpp file. It must be included first. +// 3) Add stdafx.cpp to your project. +// 4) Turn on precompiled hearders in the project + + +#include "stdafx.h" + diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/main.cpp b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/main.cpp new file mode 100644 index 00000000..a819c4c0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/main.cpp @@ -0,0 +1,40 @@ +///////////////////////////// +// main.cpp +// + +#include "stdafx.h" +#include "CustomControlApp.h" + +int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPWSTR, _In_ int) +{ + try + { + // Start Win32++. + CCustomControlApp theApp; + + // Run the application. + return theApp.Run(); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return -1; +} \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/res/Dialog.ico b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/res/Dialog.ico new file mode 100644 index 00000000..4730e915 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/res/Dialog.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/res/PerMonitorV2.manifest b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/res/PerMonitorV2.manifest new file mode 100644 index 00000000..d303e5c0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/res/PerMonitorV2.manifest @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + PerMonitorV2, PerMonitor + + + + + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/resource.h b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/resource.h new file mode 100644 index 00000000..ebc76ba5 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/resource.h @@ -0,0 +1,26 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Resource.rc +// + +// include the Resource IDs defined by Win32++ +#include "default_resource.h" + + +//Resource IDs for the dialog +#define IDD_DIALOG1 121 +#define IDC_CUSTOMWEB 122 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 159 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 160 +#endif +#endif + + diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/stdafx.h b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/stdafx.h new file mode 100644 index 00000000..08450116 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomControl/src/stdafx.h @@ -0,0 +1,90 @@ +///////////////////////////// +// StdAfx.h +// + +// This file is used for precompiled headers. +// Rarely modified header files should be included. +// Based on code provided by Lynn Allan. + + +#ifndef STDAFX_H +#define STDAFX_H + + +// Predefinitions for windows.h go here +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +// Specify Win32xx specific predefinitions here +//#define NO_USING_NAMESPACE // Don't use Win32xx namespace + +// Rarely modified header files should be included here +#include // Add support for std::vector +#include // Add support for std::map +#include // Add support for std::string +#include // Add support for stringstream +#include // Add support for the assert macro +#include // Add support for C style printf, sprintf, etc. +#include // Add support for C style character conversions atoi etc. +#include // Add support for C style TCHARs. + +// Add the Win32++ library +#include // Add CWinApp +#include // Add CArchive +#include // Add CAnimation, CComboBox, CComboBoxEx, CDateTime, CHeader, CHotKey, CIPAddress, CProgressBar, CSpinButton, CScrollBar, CSlider, CToolTip +#include // Add CCriticalSection, CThreadLock +#include // Add CString, CStringA, CStringW +#include // Add CDataExchange +#include // Add CDialog, CResizer +#include // Add CDockFrame, CMDIDockFrame +#include // Add CDocker, CDockContainer +#include // Add CException, CFileException, CNotSupportedException, CResourceException, CUserException, CWinException +#include // Add CFile +#include // Add CFileFind +#include // Add CFolderDialog +#include // Add CFrame +#include // Add CDC, CGDIObject, CBitmap, CBrush, CFont, CPalatte, CPen, CRgn +#include // Add CHGlobal +#include // Add CImageList +#include // Add CListView +#include // Add CMDIChild, CMDIFrame, CDockMDIFrame +#include // Add CMenu +#include // Add CMenuBar +#include // Add CMetaFile, CEnhMetaFile +#include // Add CEvent, CMutex, CSemaphore +#include // Add CPropertyPage, CPropertySheet +#include // Add CRebar +#include // Add CPoint, CRect, CSize +#include // Add CRegKey +#include // Add CRichEdit +#include // Add CScrollView +#include // Adds macros, windows header files, and CObject +#include // Add CSocket +#include // Add CStatusBar +#include // Add CButton, CEdit, CListBox +#include // Add CTab, CTabbedMDI +#include // Add AtoT, AtoW, TtoA, TtoW, WtoA, WtoT etc. +#include // Add MenuTheme, ReBarTheme, StatusBarTheme, ToolBarTheme +#include // Add CWinThread +#include // Add CTime +#include // Add CToolBar +#include // Add CTreeView +#include // Add CWebBrowser, CAXHost +#include // Add CWnd + +// WIN32_LEAN_AND_MEAN can't be used with these +#ifndef WIN32_LEAN_AND_MEAN + #include // Add CCommonDialog, CColorDialog, CFileDialog, CFindReplace, CFontDialog + #include // Add CFolderDialogEx + #include // Add CPrintPreview + #include // Add CPageSetupDialog, CPrintDialog + #include // Add CPrintDialogEx + #include // Add CTaskDialog + + // Visual Studio + #if defined (_MSC_VER) + #include // Add CRibbon, CRibbonFrame + #endif + +#endif // define WIN32_LEAN_AND_MEAN + +#endif // define STDAFX_H diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg.cbp b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg.cbp new file mode 100644 index 00000000..89037571 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg.cbp @@ -0,0 +1,145 @@ + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg.cbproj b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg.cbproj new file mode 100644 index 00000000..f6a4e09b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg.cbproj @@ -0,0 +1,1532 @@ + + + {39461456-1040-43CB-9B40-5962EF847BB0} + 20.1 + None + True + Release + Win64x + 1048579 + Application + CustomPrintDlg + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + JPHNE + .\Embarcadero\$(Platform)\$(Config) + .\Embarcadero\$(Platform)\$(Config) + false + true + true + $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + CppGuiApplication + System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + true + <_TCHARMapping>wchar_t + CustomPrintDlg + ..\..\..\include\;..\src\;$(IncludePath) + ..\..\..\include\;..\src\;$(ILINK_LibraryPath) + 3081 + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + $(BDSINCLUDE)\windows\sdk;$(BRCC_IncludePath) + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + ..\src\stdafx.h + none + + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + false + true + false + true + _DEBUG;$(Defines) + false + None + DEBUG + true + true + true + true + Full + true + true + true + true + true + $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) + $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + + + PerMonitorV2 + false + $(BDSLIB)\$(PLATFORM)$(CC_SUFFIX)\debug;$(ILINK_LibraryPath) + true + 1033 + + + PerMonitorV2 + true + 1033 + + + PerMonitorV2 + true + 1033 + + + NDEBUG;$(Defines) + None + + + PerMonitorV2 + false + true + 1033 + + + PerMonitorV2 + true + 1033 + + + PerMonitorV2 + true + 1033 + + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 68 + + + 0 + + + 1 + + + 2 + + + 3 + + + 4 + + + 5 + + +
Resource.res
+ 6 +
+ + 7 + + + 8 + + + 9 + + + 10 + true + + + 12 + + + 13 + + + 14 + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + +
+ + CPlusPlusBuilder.Personality.12 + CppGuiApplication + + + + False + True + True + False + + + Embarcadero C++Builder Office 2000 Servers Package + Embarcadero C++Builder Office XP Servers Package + + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + Assets\ + Logo150x150.png + true + + + + + Assets\ + Logo44x44.png + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + CustomPrintDlg.exe + true + + + + + CustomPrintDlg.exe + true + + + + + NewProject.exe + true + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 64 + + + classes + 64 + + + + + res\xml + 1 + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\mips + 1 + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-v21 + 1 + + + res\values-v21 + 1 + + + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + Contents + 1 + + + Contents + 1 + + + Contents + 1 + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + library\lib\armeabi-v7a + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen + 64 + + + ..\$(PROJECTNAME).launchscreen + 64 + + + + + 1 + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + + + + + + + + + + + + + True + True + True + + + 12 + + + + +
diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2015.sln b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2015.sln new file mode 100644 index 00000000..46ca87eb --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2015.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CustomPrintDlg", "CustomPrintDlg_2015.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2015.vcxproj b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2015.vcxproj new file mode 100644 index 00000000..dbd29665 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2015.vcxproj @@ -0,0 +1,253 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + CustomPrintDlg + CustomPrintDlg + + + + Application + Unicode + v140_xp + + + Application + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + + + + + + + + + + + + + + + + + true + false + + + true + false + + + false + false + + + false + false + + + + Use + Level4 + true + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2015.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2015.vcxproj.filters new file mode 100644 index 00000000..7dc984f1 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2015.vcxproj.filters @@ -0,0 +1,236 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Header Files + + + Win32++ + + + Header Files + + + + + {9e0766f3-476b-4b58-8d32-c03851ad1ea0} + + + {812e5f18-180b-4dc9-bff7-bba765c69ba5} + + + {929888c6-c895-4d58-80b0-ace237839ae0} + + + {b6dbd6b3-08a1-413c-ae5e-98826af580ce} + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2019.sln b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2019.sln new file mode 100644 index 00000000..b7f8c037 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2019.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CustomPrintDlg", "CustomPrintDlg_2019.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C1ED47EF-1912-4278-A6FF-ABABD226B50A} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2019.vcxproj b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2019.vcxproj new file mode 100644 index 00000000..36685df0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2019.vcxproj @@ -0,0 +1,234 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + CustomPrintDlg + CustomPrintDlg + + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2019.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2019.vcxproj.filters new file mode 100644 index 00000000..680b43ba --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2019.vcxproj.filters @@ -0,0 +1,233 @@ + + + + + {7b97ebda-b676-4144-8740-565f84523516} + + + {221892de-4907-4ce3-9105-0d8acbcf8d3d} + + + {d91d3353-b635-49ce-99b9-25fe709af307} + + + {2309c372-d161-4c01-b572-27bb5e18cddf} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Header Files + + + Win32++ + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2022.sln b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2022.sln new file mode 100644 index 00000000..e5f3ed7c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2022.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CustomPrintDlg", "CustomPrintDlg_2022.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {CB62F297-98A6-4E83-AB1C-326AFA69156F} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2022.vcxproj b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2022.vcxproj new file mode 100644 index 00000000..198e883a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2022.vcxproj @@ -0,0 +1,249 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + CustomPrintDlg + CustomPrintDlg + 10.0 + + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2022.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2022.vcxproj.filters new file mode 100644 index 00000000..254dd8a4 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2022.vcxproj.filters @@ -0,0 +1,249 @@ + + + + + {7b97ebda-b676-4144-8740-565f84523516} + + + {221892de-4907-4ce3-9105-0d8acbcf8d3d} + + + {d91d3353-b635-49ce-99b9-25fe709af307} + + + {2309c372-d161-4c01-b572-27bb5e18cddf} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Header Files + + + Win32++ + + + Header Files + + + + + Resource Files + + + + + Resource Files + + + Resource Files + + + Resource Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2026.slnx b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2026.slnx new file mode 100644 index 00000000..0b106bcd --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2026.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2026.vcxproj b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2026.vcxproj new file mode 100644 index 00000000..640dde28 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2026.vcxproj @@ -0,0 +1,249 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + CustomPrintDlg + CustomPrintDlg + 10.0 + + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2026.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2026.vcxproj.filters new file mode 100644 index 00000000..6694ad3f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_2026.vcxproj.filters @@ -0,0 +1,249 @@ + + + + + {7b97ebda-b676-4144-8740-565f84523516} + + + {221892de-4907-4ce3-9105-0d8acbcf8d3d} + + + {d91d3353-b635-49ce-99b9-25fe709af307} + + + {2309c372-d161-4c01-b572-27bb5e18cddf} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Header Files + + + Win32++ + + + Header Files + + + + + Resource Files + + + + + Resource Files + + + Resource Files + + + Resource Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_DEBUG.dev b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_DEBUG.dev new file mode 100644 index 00000000..779fe2b4 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_DEBUG.dev @@ -0,0 +1,201 @@ +[Project] +FileName=CustomPrintDlg_DEBUG.dev +Name=CustomPrintDlg +UnitCount=15 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=CustomPrintDlg_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D _DEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@__@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-lWinspool_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Debug +ObjectOutput=.\Dev-C++\Debug +OverrideOutput=1 +OverrideOutputName=CustomPrintDlg.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=4 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit1] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\Mainfrm.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\Mainfrm.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\Resource.rc +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\RichView.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\RichView.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit8] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit10] +FileName=..\src\TextApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit11] +FileName=..\src\TextApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit12] +FileName=..\src\UserMessages.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit13] +FileName=..\src\CustomPrintDlg.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit14] +FileName=..\src\CustomPrintDlg.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit15] +FileName=..\..\Browser\src\AboutDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_RELEASE.dev b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_RELEASE.dev new file mode 100644 index 00000000..066c10ae --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/ProjectFiles/CustomPrintDlg_RELEASE.dev @@ -0,0 +1,201 @@ +[Project] +FileName=CustomPrintDlg_RELEASE.dev +Name=CustomPrintDlg +UnitCount=15 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=CustomPrintDlg_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D NDEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-lWinspool_@@_-s_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Release +ObjectOutput=.\Dev-C++\Release +OverrideOutput=1 +OverrideOutputName=CustomPrintDlg.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=3 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit1] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\Mainfrm.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\Mainfrm.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\Resource.rc +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\RichView.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\RichView.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit8] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit10] +FileName=..\src\TextApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit11] +FileName=..\src\TextApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit12] +FileName=..\src\UserMessages.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit13] +FileName=..\src\CustomPrintDlg.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit14] +FileName=..\src\CustomPrintDlg.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit15] +FileName=..\..\Browser\src\AboutDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/Readme.txt new file mode 100644 index 00000000..39a3c56b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/Readme.txt @@ -0,0 +1,66 @@ +CustomPrintDlg Sample +===================== +The print dialog has changed since the 22H2 update to Windows 10/11. The +new print dialog ignores the hDevMode and hDevNames supplied to it. The new +print dialog also displays a print preview we can't use, which is rather +unfortunate. + +This project provides an alternative to the current print dialog. The +CustomPrintDlg class emulates the print dialog from earlier versions of +Windows. It can be used as a replacement for CPrintDialog in the Notepad +sample as shown here. Unlike the PrintDlg and PrintDlgEx, the CustomPrintDlg +can be easily be customized to add or remove features appropriate to your +application. + +This sample demonstrates how to manually create the hDevMode and hDevNames +global memory for a specified printer. This global memory is used by the +the CustomPrintDlg to retrieve and update the printer's DevNames and DevMode +information. + +This project also demonstrates how to use a Rich Edit control as a simple +text editor. It supports Rich Text Format (RTF), and plain text. It also +supports ANSI, UTF-8 and UTF-16 encodings like the Notepad sample. + +Features demonstrated in this example +===================================== +* Using CCustomPrintDlg to display the print dialog. +* Enumerating the available printers. +* Choosing this application's printer. +* Creating a printer's hDevMode and hDevNames global memory. +* Retrieving and using the printer's DevMode and DevNames. +* Using CPrintPreview to preview the print job before printing. +* Printing the entire document document or a specified or page range. +* Printing multiple copies, with or without collating. + +* Use of CFrame to display the window frame. +* Using a Rich edit control in the view window (ver 2.0 for unicode support). +* File open and file save using stream callbacks. +* Text operations, such as cut, copy, paste, delete, undo and redo. +* Selecting a file using drag and drop. +* Use of OnIdle to dynamically update the toolbar buttons. +* Use of OnMenuUpdate to dynamically update the menu items. +* Choosing the font to display the text. +* Enabling and disabling word wrap + +* Loading and saving of UTF-8 encoded text files. +* Loading and saving of UTF-16 Little Ended encoded text files. +* Loading and saving of ANSI files (plain text only). +* Loading and saving of both rich text format (RTF) and plain text files. + + +Notes: +* UTF-8 files need a Byte Order Mark (BOM), otherwise they are treated as ANSI + by the rich edit control. +* UTF-8 is the most popular encoding for text files, for good reason. +* UTF-8 is a super set of ASCII encoding. All ASCII text files are also UTF-8. +* UTF-8 uses one or more bytes to encode a character. +* ASCII encoding uses 7 bits, whereas ANSI encoding uses 8 bits. +* The way the ANSI text is displayed will depend on the code page. +* Microsoft typically uses the term "Unicode" to refer to UTF-16 Little Ended. +* UTF-16 Little Ended files can be loaded with a BOM. +* Files with a rtf extension are treated as rich text in this application. +* Files without a rtf extension are treated as plain text. +* Plain text files can only have a single font. +* Rich text files can have multiple fonts within the one document. +* Choosing an encoding determines how text is saved. It doesn't alter how text + is displayed. \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/AboutDialog.h b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/AboutDialog.h new file mode 100644 index 00000000..71e4364d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/AboutDialog.h @@ -0,0 +1,31 @@ +///////////////////////////////////////////// +// AboutDialog.h + +#ifndef _ABOUTDIALOG_H_ +#define _ABOUTDIALOG_H_ + +#include "resource.h" + +//////////////////////////////////////////////////////// +// CAboutDialog manages the dialog which displays +// information about this program. +class CAboutDialog : public CDialog +{ +public: + CAboutDialog() : CDialog(IDW_ABOUT) {} + virtual BOOL OnInitDialog() override + { + // Set the Win32++ version string. + UINT ver = _WIN32XX_VER; + CString Win32xxVersion; + Win32xxVersion << "Win32++ Version " << ver / 0x100 << "." << + (ver % 0x100) / 0x10 << "." << (ver % 0x10); + + SetDlgItemText(IDC_STATIC1, Win32xxVersion); + SetDlgItemText(IDC_STATIC2, L"by David Nash"); + + return TRUE; + } +}; + +#endif // _ABOUTDIALOG_H_ diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/CustomPrintDlg.cpp b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/CustomPrintDlg.cpp new file mode 100644 index 00000000..5a50139c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/CustomPrintDlg.cpp @@ -0,0 +1,740 @@ +///////////////////////////// +// CustomPrintDialog.cpp +// + +#include "stdafx.h" +#include "resource.h" +#include "CustomPrintDlg.h" +#include "UserMessages.h" + +/////////////////////////////////////// +// CCustomPrintDlg function definitions +// + +// Constructor. +CCustomPrintDlg::CCustomPrintDlg() + : CDialog(IDD_PRINTDLG), m_copies(1), m_fromPage(1), m_radio(0), m_toPage(9999), + m_collate(0), m_printToFile(0), m_maxPage(0), + m_isPropertiesDisplayed(false) +{ + m_hDevMode = nullptr; + m_hDevNames = nullptr; + m_owner = nullptr; +} + +// Creates and assigns the hDevMode and hDevNames global memory for the +// specified printer. Refer to Microsoft's Knowledge Base Article Q166129. +bool CCustomPrintDlg::CreateGlobalHandles(LPCWSTR printerName, HGLOBAL* pHDevMode, + HGLOBAL* pHDevNames) +{ + // HGLOBAL pHdevMode and pHDevNames are required. + assert(pHDevMode); + assert(pHDevNames); + + bool result = false; + + // Open printer + HANDLE printer; + if (::OpenPrinter(const_cast(printerName), &printer, nullptr)) + { + // Create PRINTER_INFO_2 structure. + DWORD bytesNeeded = 0; + ::GetPrinter(printer, 2, nullptr, 0, &bytesNeeded); + std::vector infoBuffer(bytesNeeded); + PRINTER_INFO_2* p2 = reinterpret_cast(infoBuffer.data()); + + // Fill the PRINTER_INFO_2 structure and close the printer handle. + if (::GetPrinter(printer, 2, infoBuffer.data(), bytesNeeded, &bytesNeeded)) + { + // Allocate a global handle for DEVMODE. + size_t bufferSize = sizeof(DEVMODE) + p2->pDevMode->dmDriverExtra; + HGLOBAL newDevMode = ::GlobalAlloc(GHND, bufferSize); + assert(newDevMode); + if (newDevMode != nullptr) + { + // copy DEVMODE data from PRINTER_INFO_2::pDevMode. + CDevMode pNewDevMode(newDevMode); + memcpy(pNewDevMode, p2->pDevMode, sizeof(*p2->pDevMode) + + p2->pDevMode->dmDriverExtra); + + // Compute size of DEVNAMES structure from PRINTER_INFO_2's data. + size_t driverLength = lstrlen(p2->pDriverName) + 1; // driver name + size_t printerLength = lstrlen(p2->pPrinterName) + 1; // printer name + size_t portLength = lstrlen(p2->pPortName) + 1; // port name + + // Allocate a global handle big enough to hold DEVNAMES. + bufferSize = sizeof(DEVNAMES) + (driverLength + printerLength + + portLength) * sizeof(wchar_t); + HGLOBAL newDevNames = ::GlobalAlloc(GHND, bufferSize); + assert(newDevNames); + if (newDevNames != nullptr) + { + CDevNames pNewDevNames(newDevNames); + + // Copy the DEVNAMES information from PRINTER_INFO_2. + // offset = wchar_t Offset into structure. + size_t offset = sizeof(DEVNAMES) / sizeof(wchar_t); + + pNewDevNames->wDriverOffset = static_cast(offset); + memcpy(pNewDevNames.GetString() + offset, p2->pDriverName, + driverLength * sizeof(wchar_t)); + offset = offset + driverLength; + + pNewDevNames->wDeviceOffset = static_cast(offset); + memcpy(pNewDevNames.GetString() + offset, p2->pPrinterName, + printerLength * sizeof(wchar_t)); + offset = offset + printerLength; + + pNewDevNames->wOutputOffset = static_cast(offset); + memcpy(pNewDevNames.GetString() + offset, p2->pPortName, + portLength * sizeof(wchar_t)); + pNewDevNames->wDefault = 0; + + // Set the new hDevMode and hDevNames. + *pHDevMode = newDevMode; + *pHDevNames = newDevNames; + + result = true; + } + } + } + + ::ClosePrinter(printer); + } + + return result; +} + +// Used by UpdateData to exchange data with the dialog. +void CCustomPrintDlg::DoDataExchange(CDataExchange& DX) +{ + // Connect the dialog controls to member variables. + DX.DDX_Control(IDC_COMBOBOX, m_comboBox); + DX.DDX_Control(IDS_FROM, m_editFrom); + DX.DDX_Control(IDS_TO, m_editTo); + DX.DDX_Control(IDS_COPIES, m_editCopies); + + // Connect radio boxes value to int member variable. + DX.DDX_Radio(IDB_RADIOALL, m_radio); + + // Connect check box values to int member variables. + DX.DDX_Check(IDB_COLLATE, m_collate); + DX.DDX_Check(IDB_PRINTTOFILE, m_printToFile); + + // Connect numeric edit boxes values to int member variables. + DX.DDX_Text(IDS_FROM, m_fromPage); + DX.DDX_Text(IDS_TO, m_toPage); + DX.DDX_Text(IDS_COPIES, m_copies); + + // Connect text edit boxes values to CString member variables. + DX.DDX_Text(IDS_STATUS, m_status); + DX.DDX_Text(IDS_TYPE, m_type); + DX.DDX_Text(IDS_WHERE, m_where); + DX.DDX_Text(IDS_COMMENT, m_comment); + + if (m_radio == IDB_RADIORANGE) + { + GetDlgItem(IDS_FROM).ShowWindow(SW_SHOW); + GetDlgItem(IDS_TO).ShowWindow(SW_SHOW); + } + else + { + GetDlgItem(IDS_FROM).ShowWindow(SW_HIDE); + GetDlgItem(IDS_TO).ShowWindow(SW_HIDE); + } + +} + +// Display the print dialog, and allow the user to select various options. +// An exception is thrown if the dialog isn't created. +// An exception is thrown if there is no default printer. +inline INT_PTR CCustomPrintDlg::DoModal(HWND owner) +{ + assert(!IsWindow()); // Only one window per CWnd instance allowed + + if (FindPrinters().size() == 0) + throw CResourceException(GetApp()->MsgPrintFound()); + + GetApp()->UpdateDefaultPrinter(); + + // Assign values to member variables. + m_hDevMode = GetApp()->GetHDevMode(); + m_hDevNames = GetApp()->GetHDevNames(); + m_owner = owner; + + // Display the modal dialog. + INT_PTR result = CDialog::DoModal(owner); + if (result == -1) + { + int error = static_cast(CommDlgExtendedError()); + + // Reset global memory + m_hDevMode = nullptr; + m_hDevNames = nullptr; + GetApp()->ResetPrinterMemory(); + throw CWinException(GetApp()->MsgWndDialog(), error); + } + + return result; +} + +// Display the print setup dialog, and allow the user to select various options. +// An exception is thrown if there is no default printer. +INT_PTR CCustomPrintDlg::DoSetupModal(HWND owner) +{ + if (FindPrinters().size() == 0) + throw CResourceException(GetApp()->MsgPrintFound()); + + // Update the default printer + GetApp()->UpdateDefaultPrinter(); + + // Display the print setup dialog. + PRINTDLG pd = {}; + pd.lStructSize = sizeof(pd); + pd.hDevMode = GetApp()->GetHDevMode(); + pd.hDevNames = GetApp()->GetHDevNames(); + pd.Flags = PD_PRINTSETUP; + pd.hwndOwner = owner; + + INT_PTR result = ::PrintDlg(&pd); + if (result != 0) + { + // User pressed OK + GetApp()->UpdatePrinterMemory(pd.hDevMode, pd.hDevNames); + SetPrinterFromDevMode(GetDeviceName(), GetDevMode()); + m_hDevMode = nullptr; + m_hDevNames = nullptr; + } + else + { + m_hDevMode = nullptr; + m_hDevNames = nullptr; + int error = static_cast(CommDlgExtendedError()); + if (error != 0) + throw CWinException(GetApp()->MsgWndDialog(), error); + } + + return result; +} + +// Returns a vector of CString printer names. +std::vector CCustomPrintDlg::FindPrinters() const +{ + std::vector printerNames; + + DWORD bufferSize = 0; + DWORD printerCount = 0; + DWORD level = 2; // for PRINTER_INFO_2 + ::SetLastError(0); + + // Identify size of PRINTER_INFO_2 buffer required. + ::EnumPrinters(PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, + nullptr, level, nullptr, 0, &bufferSize, &printerCount); + + // Check for ERROR_INSUFFICIENT_BUFFER + if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER) + { + // Allocate the size of our vector. + std::vector buffer(bufferSize); + + // Fill the buffer. The buffer is actually an array of PRINTER_INFO_2. + VERIFY(::EnumPrinters(PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, + nullptr, level, buffer.data(), bufferSize, &bufferSize, &printerCount)); + + // Do we have any printers? + if (printerCount != 0) + { + // Get our array of PRINTER_INFO_2 + PRINTER_INFO_2* pInfo = reinterpret_cast(buffer.data()); + + for (DWORD i = 0; i < printerCount; i++, pInfo++) + { + // Store the printer name in our vector of CString. + printerNames.push_back(pInfo->pPrinterName); + } + } + } + + return printerNames; +} + +// Retrieves the number of copies requested. +int CCustomPrintDlg::GetCopies() const +{ + return m_copies; +} + +// Retrieves the printer's CDevMode. CDevMode can be used as a pointer +// to a DEVMODE struct. +CDevMode CCustomPrintDlg::GetDevMode() const +{ + if (GetApp()->GetHDevMode().Get() == nullptr) + GetApp()->UpdateDefaultPrinter(); + if (GetApp()->GetHDevMode().Get() == nullptr) + throw CResourceException(GetApp()->MsgPrintFound()); + return CDevMode(GetApp()->GetHDevMode()); +} + +// Retrieves the printer's CDevNames. CDevNames can be used as a pointer +// to a DEVNAMES struct. +CDevNames CCustomPrintDlg::GetDevNames() const +{ + if (GetApp()->GetHDevNames().Get() == nullptr) + GetApp()->UpdateDefaultPrinter(); + if (GetApp()->GetHDevNames().Get() == nullptr) + throw CResourceException(GetApp()->MsgPrintFound()); + return CDevNames(GetApp()->GetHDevNames()); +} + +// Retrieves the printer's driver name. +CString CCustomPrintDlg::GetDriverName() const +{ + if (GetApp()->GetHDevNames().Get() == nullptr) + GetApp()->UpdateDefaultPrinter(); + CString str; + if (GetApp()->GetHDevNames().Get() != nullptr) + str = GetDevNames().GetDriverName(); + return str; +} + +// Retrieves the printer's device name. +CString CCustomPrintDlg::GetDeviceName() const +{ + if (GetApp()->GetHDevNames().Get() == nullptr) + GetApp()->UpdateDefaultPrinter(); + CString str; + if (GetApp()->GetHDevNames().Get() != nullptr) + str = GetDevNames().GetDeviceName(); + return str; +} + +// Retrieves the printer's port name. +CString CCustomPrintDlg::GetPortName() const +{ + if (GetApp()->GetHDevNames().Get() == nullptr) + GetApp()->UpdateDefaultPrinter(); + CString str; + if (GetApp()->GetHDevNames().Get() != nullptr) + str = GetDevNames().GetPortName(); + return str; +} + +// Returns the device context of the default or currently chosen printer. +// Throws on failure. +CDC CCustomPrintDlg::GetPrinterDC() const +{ + CDC dc; + if (GetApp()->GetHDevNames().Get() == nullptr) + GetApp()->UpdateDefaultPrinter(); + if ((GetApp()->GetHDevNames().Get() != nullptr) && (GetApp()->GetHDevMode().Get() != 0)) + { + dc.CreateDC(GetDriverName(), GetDeviceName(), + GetPortName(), GetDevMode()); + } + else + throw CResourceException(GetApp()->MsgPrintFound()); + + return dc; +} + +// Returns the print to file state. +int CCustomPrintDlg::GetPrintToFile() const +{ + return m_printToFile; +} + +// Retrieves the starting page of the print range. +int CCustomPrintDlg::GetFromPage() const +{ + return (IsPrintRange() ? m_fromPage : -1); +} + +// Retrieves the ending page of the print range. +int CCustomPrintDlg::GetToPage() const +{ + return (IsPrintRange() ? m_toPage : -1); +} + +// Retrieves the status from the printer's PRINTER_INFO_2. +DWORD CCustomPrintDlg::GetPrinterStatus(LPCWSTR printerName) const +{ + DWORD status = 0; + HANDLE printer = 0; + + if (::OpenPrinter(const_cast(printerName), &printer, nullptr)) + { + // Create PRINTER_INFO_2 structure. + DWORD bufferSize = 0; + ::GetPrinter(printer, 2, nullptr, 0, &bufferSize); + assert(bufferSize); + std::vector infoBuffer(bufferSize); + + // Fill the PRINTER_INFO_2 structure. + if (::GetPrinter(printer, 2, infoBuffer.data(), bufferSize, &bufferSize)) + { + PRINTER_INFO_2* printerInfo2 = reinterpret_cast(infoBuffer.data()); + status = printerInfo2->Status; + } + ::ClosePrinter(printer); + } + + return status; +} + +// Retrieves the print range radio button. +int CCustomPrintDlg::GetRadio() const +{ + return m_radio; +} + +// Call this function after calling DoModal to determine whether to print +// all pages in the document. +bool CCustomPrintDlg::IsPrintAll() const +{ + return (!IsPrintRange() && !IsPrintSelection()); +} + +// Call this function after calling DoModal to determine whether the printer +// should collate all printed copies of the document. +bool CCustomPrintDlg::IsCollate() const +{ + return !!m_collate; +} + +// Call this function after calling DoModal to determine whether to print +// only a range of pages in the document. +bool CCustomPrintDlg::IsPrintRange() const +{ + return (m_radio == IDB_RADIORANGE - IDB_RADIOALL); +} + +// Call this function after calling DoModal to determine whether to print +// only the currently selected items. +bool CCustomPrintDlg::IsPrintSelection() const +{ + return (m_radio == IDB_RADIOSELECTION - IDB_RADIOALL); +} + +// Returns true if the Print to file checkbox is ticked. +bool CCustomPrintDlg::IsPrintToFile() const +{ + return m_printToFile != 0; +} + +// Handle the printer name combo-box selection. +BOOL CCustomPrintDlg::OnComboSelection() +{ + CString deviceName; + int item = m_comboBox.GetCurSel(); + int length = m_comboBox.GetLBTextLen(item); + m_comboBox.GetLBText(item, deviceName.GetBuffer(length)); + deviceName.ReleaseBuffer(); + if (deviceName != GetDeviceName()) + { + HGLOBAL newHDevMode = nullptr; + HGLOBAL newHDevNames = nullptr; + CreateGlobalHandles(deviceName, &newHDevMode, &newHDevNames); + GetApp()->ResetPrinterMemory(); + m_hDevNames = newHDevNames; + m_hDevMode = newHDevMode; + GetApp()->UpdatePrinterMemory(newHDevMode, newHDevNames); + + m_type = GetDriverName(); + m_where = GetPortName(); + UpdateStatusText(); + } + + ::SendMessage(m_owner, UWM_SETDEFAULTOPTIONS, 0, 0); + UpdateData(m_dx, SENDTOCONTROL); + return TRUE; +} + +// Called when the Close button is pressed. +void CCustomPrintDlg::OnCancel() +{ + // Ignore Cancel button if the Properties dialog is displayed. + if (!m_isPropertiesDisplayed) + CDialog::OnCancel(); +} + +// Called when the dialog is closed. +void CCustomPrintDlg::OnClose() +{ + // Ignore close request if the Properties dialog is displayed. + if (!m_isPropertiesDisplayed) + CDialog::OnClose(); +} + +// Called when a button on the dialog is pressed, or a combo-box selection +// is made. +BOOL CCustomPrintDlg::OnCommand(WPARAM wparam, LPARAM) +{ + UINT id = LOWORD(wparam); + + switch (id) + { + case IDB_HELP: return OnHelp(); + case IDB_PRINTPROPERTIES: return OnPrintProperties(); + + case IDB_RADIOALL: // Intentionally blank + case IDB_RADIORANGE: // Intentionally blank + case IDB_RADIOSELECTION: return OnRadioSelection(id); + } + + UINT msg = HIWORD(wparam); + switch (msg) + { + case CBN_SELCHANGE: return OnComboSelection(); + } + + return FALSE; +} + +// Called when the dialog's help button is pressed. +BOOL CCustomPrintDlg::OnHelp() +{ + MessageBox(L"Add some useful help here.", L"Help Button Pressed", MB_OK); + return TRUE; +} + +// Called before the modal dialog is displayed. +BOOL CCustomPrintDlg::OnInitDialog() +{ + // Set the dialog's PortName and DriverName text. + HGLOBAL hDevMode = nullptr; + HGLOBAL hDevNames = nullptr; + if (CreateGlobalHandles(GetDeviceName(), &hDevMode, &hDevNames)) + { + CDevNames pDevNames(hDevNames); + + m_type = pDevNames.GetDriverName(); + m_where = pDevNames.GetPortName(); + } + if (hDevMode != nullptr) + ::GlobalFree(hDevMode); + if (hDevNames != nullptr) + ::GlobalFree(hDevNames); + + UpdateStatusText(); + + // Update the dialog. + UpdateData(m_dx, SENDTOCONTROL); + + std::vector names = FindPrinters(); + for (const CString& str : names) + { + m_comboBox.AddString(str); + } + + int item = m_comboBox.FindString(0, GetDeviceName()); + m_comboBox.SetCurSel(item); + + return TRUE; +} + +// Called when the OK button is pressed. +void CCustomPrintDlg::OnOK() +{ + // Ignore OK button if the Properties dialog is displayed. + if (!m_isPropertiesDisplayed) + { + UpdateData(m_dx, READFROMCONTROL); + if (m_fromPage >= 1 && m_fromPage <= m_maxPage && + m_toPage >= 1 && m_toPage <= m_maxPage) + { + GetApp()->UpdatePrinterMemory(m_hDevMode, m_hDevNames); + m_hDevMode = nullptr; + m_hDevNames = nullptr; + + CDialog::OnOK(); + } + else + { + CString text = "Enter a page between 1 and "; + text << ToCString(m_maxPage); + MessageBox(text, L"Invalid Page", MB_OK); + } + } +} + +// Called when the properties button on the print dialog is pressed. +BOOL CCustomPrintDlg::OnPrintProperties() +{ + assert(m_owner != 0); + + // Ignore Properties button if the Properties dialog is already displayed. + if (!m_isPropertiesDisplayed) + { + m_isPropertiesDisplayed = true; + // Get the printer name. + CString dev = GetDeviceName(); + LPWSTR deviceName = const_cast(dev.c_str()); + + // Retrieve the printer handle with PRINTER_ALL_ACCESS if we can. + HANDLE printer; + PRINTER_DEFAULTS printerDefaults{}; + printerDefaults.DesiredAccess = PRINTER_ALL_ACCESS; + if (::OpenPrinter(deviceName, &printer, &printerDefaults) == FALSE) + if (::OpenPrinter(deviceName, &printer, nullptr) == FALSE) + return false; + + // Allocate the pDevMode buffer as an array of BYTE. + // We use DocumentProperties to retrieve the size of the buffer. + size_t devModeSize = ::DocumentProperties(*this, printer, deviceName, + nullptr, GetDevMode(), 0); + std::vector buffer(devModeSize); + LPDEVMODE pDevMode = reinterpret_cast(buffer.data()); + + // We use the AdvancedDocumentProperties property sheet, to retrieve + // the updated devMode data. + if (IDOK == ::AdvancedDocumentProperties(*this, printer, deviceName, + pDevMode, GetDevMode())) + { + SetPrinterFromDevMode(deviceName, pDevMode); + HGLOBAL newDevMode = nullptr; + HGLOBAL newDevNames = nullptr; + if (CreateGlobalHandles(deviceName, &newDevMode, &newDevNames)) + { + // copy the updated devMode data to our global memory. + CDevMode pNewDevMode(newDevMode); + memcpy(pNewDevMode, pDevMode, devModeSize); + + // Save the new global memory handles. + // CWinApp is assigned ownership of of the global memory. + GetApp()->ResetPrinterMemory(); + m_hDevMode = newDevMode; + m_hDevNames = newDevNames; + GetApp()->UpdatePrinterMemory(newDevMode, newDevNames); + } + else + return FALSE; + } + + VERIFY(::ClosePrinter(printer)); + + ::SendMessage(m_owner, UWM_SETDEFAULTOPTIONS, 0, 0); + UpdateData(m_dx, SENDTOCONTROL); + + m_isPropertiesDisplayed = false; + } + return TRUE; +} + +// Called when a radio button is selected +BOOL CCustomPrintDlg::OnRadioSelection(UINT id) +{ + CheckRadioButton(IDB_RADIOALL, IDB_RADIOSELECTION, id); + UpdateData(m_dx, READFROMCONTROL); + + if (id == IDB_RADIORANGE) + { + GetDlgItem(IDS_FROM).ShowWindow(SW_SHOW); + GetDlgItem(IDS_TO).ShowWindow(SW_SHOW); + } + else + { + GetDlgItem(IDS_FROM).ShowWindow(SW_HIDE); + GetDlgItem(IDS_TO).ShowWindow(SW_HIDE); + } + + return TRUE; +} + +// Set the collate state. +void CCustomPrintDlg::SetCollate(bool isCollate) +{ + m_collate = isCollate ? 1 : 0; +} + +// Set the number of copies to be printed. +void CCustomPrintDlg::SetCopies(int copies) +{ + m_copies = copies; +} + +// Set the start page for printing. +void CCustomPrintDlg::SetFromPage(int fromPage) +{ + m_fromPage = fromPage; +} + +// Set the print to file state. +void CCustomPrintDlg::SetPrintToFile(bool isPrintToFile) +{ + m_printToFile = isPrintToFile ? 1 : 0; +} + +// Set the Print range radio button. +void CCustomPrintDlg::SetRadio(int radio) +{ + m_radio = radio; +} + +// Set the end page for printing. +void CCustomPrintDlg::SetToPage(int toPage) +{ + m_toPage = toPage; +} + +// Set the number of pages the document has based on the current page size. +void CCustomPrintDlg::SetMaxPage(int maxPage) +{ + m_maxPage = maxPage; +} + +// Sets the DEVMODE parameters of the specified printer. +bool CCustomPrintDlg::SetPrinterFromDevMode(LPCWSTR deviceName, LPDEVMODE pDevMode) +{ + assert(deviceName); + assert(pDevMode); + + // Retrieve the printer handle with PRINTER_ALL_ACCESS if we can. + HANDLE printer; + PRINTER_DEFAULTS printerDefaults{}; + printerDefaults.DesiredAccess = PRINTER_ALL_ACCESS; + if (::OpenPrinter(const_cast(deviceName), &printer, &printerDefaults) == FALSE) + if (::OpenPrinter(const_cast(deviceName), &printer, nullptr) == FALSE) + throw CWinException(L"Failed to get printer handle.");; + + // Determine the size of the printerInfo buffer. + DWORD bufferSize = 0; + SetLastError(0); + VERIFY(::GetPrinter(printer, 2, nullptr, 0, &bufferSize) == FALSE); + if ((GetLastError() != ERROR_INSUFFICIENT_BUFFER) || (bufferSize == 0)) + throw CWinException(L"Failed to get printer info buffer size."); + + // Allocate a buffer for the PRINTER_INFO_2. + std::vector infoBuffer(bufferSize); + PRINTER_INFO_2* printerInfo2 = reinterpret_cast(infoBuffer.data()); + + // Update the printer. + if (::GetPrinter(printer, 2, infoBuffer.data(), bufferSize, &bufferSize)) + { + printerInfo2->pDevMode = pDevMode; + ::SetPrinter(printer, 2, infoBuffer.data(), 0); + return true; + } + + return false; +} + +// Retrieves the printer status and stores a text result. +void CCustomPrintDlg::UpdateStatusText() +{ + // Refer to the description of PRINTER_INFO_2 in the + // windows API documentation for possible status values. + DWORD status = GetPrinterStatus(GetDeviceName()); + CString statusText; + if (status == 0) statusText = L"Ready"; + if (status & PRINTER_STATUS_PAUSED) statusText = L"Paused"; + if (status & PRINTER_STATUS_ERROR) statusText = L"Error"; + if (status & PRINTER_STATUS_OFFLINE) statusText = L"Offline"; + if (status & PRINTER_STATUS_BUSY) statusText = L"Busy"; + if (status & PRINTER_STATUS_PRINTING) statusText = L"Printing"; + if (status & PRINTER_STATUS_NOT_AVAILABLE) statusText = L"Not available"; + if (status & PRINTER_STATUS_TONER_LOW) statusText = L"Ink or toner low"; + if (status & PRINTER_STATUS_NO_TONER) statusText = L"No ink or toner"; + if (status & PRINTER_STATUS_PAPER_OUT) statusText = L"Out of paper"; + if (status & PRINTER_STATUS_PAPER_JAM) statusText = L"Paper jam"; + m_status = statusText; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/CustomPrintDlg.h b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/CustomPrintDlg.h new file mode 100644 index 00000000..54f8589e --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/CustomPrintDlg.h @@ -0,0 +1,96 @@ +///////////////////////////// +// CustomPrintDialog.h +// + +#ifndef CUSTOMPRINTDLG_H +#define CUSTOMPRINTDLG_H + +#include "resource.h" + +//////////////////////////////////////////////////// +// CCustomPrintDlg manages the custom print dialog. +// This dialog allows the user to choose the printer +// and various print settings. +class CCustomPrintDlg : public CDialog +{ +public: + CCustomPrintDlg(); + virtual ~CCustomPrintDlg() override = default; + + virtual INT_PTR DoModal(HWND owner = nullptr) override; + + INT_PTR DoSetupModal(HWND owner = nullptr); + int GetCopies() const; + CDevMode GetDevMode() const; + CDevNames GetDevNames() const; + CString GetDriverName() const; + CString GetDeviceName() const; + CString GetPortName() const; + CDC GetPrinterDC() const; + DWORD GetPrinterStatus(LPCWSTR szPrnName) const; + int GetFromPage() const; + int GetRadio() const; + int GetPrintToFile() const; + int GetToPage() const; + bool IsCollate() const; + bool IsPrintAll() const; + bool IsPrintRange() const; + bool IsPrintSelection() const; + bool IsPrintToFile() const; + void SetCollate(bool isCollate); + void SetCopies(int copies); + void SetFromPage(int fromPage); + void SetMaxPage(int maxPage); + void SetPrintToFile(bool isPrintToFile); + void SetRadio(int radio); + void SetToPage(int toPage); + void UpdateStatusText(); + +protected: + virtual void DoDataExchange(CDataExchange& DX) override; + virtual void OnCancel() override; + virtual void OnClose() override; + virtual BOOL OnCommand(WPARAM wparam, LPARAM) override; + virtual BOOL OnInitDialog() override; + virtual void OnOK() override; + +private: + CCustomPrintDlg(const CCustomPrintDlg&); + CCustomPrintDlg& operator=(const CCustomPrintDlg&); + + bool CreateGlobalHandles(LPCWSTR printerName, HGLOBAL* pHDevMode, HGLOBAL* pHDevNames); + std::vector FindPrinters() const; + BOOL OnHelp(); + BOOL OnPrintProperties(); + BOOL OnComboSelection(); + BOOL OnRadioSelection(UINT id); + bool SetPrinterFromDevMode(LPCWSTR deviceName, LPDEVMODE pDevMode); + + CDataExchange m_dx; // DataExchange object, called by UpdateData + HGLOBAL m_hDevMode; // Global memory for printer's DevMode + HGLOBAL m_hDevNames; // Global memory for printer's DevNames + HWND m_owner; // Owner window set in DoModal + + CComboBox m_comboBox; + CEdit m_editFrom; + CEdit m_editTo; + CEdit m_editCopies; + + int m_copies; + int m_fromPage; + int m_radio; + int m_toPage; + int m_collate; + int m_printToFile; + int m_maxPage; + + CString m_status; + CString m_type; + CString m_where; + CString m_comment; + + bool m_isPropertiesDisplayed; +}; + + +#endif // CUSTOMPRINTDLG_H diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/Mainfrm.cpp b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/Mainfrm.cpp new file mode 100644 index 00000000..990387c1 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/Mainfrm.cpp @@ -0,0 +1,1171 @@ +///////////////////////////// +// Mainfrm.cpp +// + +#include "stdafx.h" +#include "Mainfrm.h" +#include "resource.h" +#include "CustomPrintDlg.h" + +#ifndef INVALID_FILE_ATTRIBUTES + #define INVALID_FILE_ATTRIBUTES ((DWORD)-1) +#endif + +#ifndef SF_USECODEPAGE + #define SF_USECODEPAGE 0x0020 +#endif + +// Encoding IDs +const int ANSI = 0; // Default for plain text +const int UTF8 = 1; // Default for rich text +const int UTF16LE = 2; + + +/////////////////////////////////// +// CMainFrame function definitions +// + +// Constructor. +CMainFrame::CMainFrame() : m_preview(m_richView), + m_encodeMode(ANSI), m_isToolbarShown(true), + m_isWrapped(false), m_isRTF(false), m_oldFocus(nullptr) +{ +} + +// Adjusts the specified value for the current DPI. +int CMainFrame::AdjustForDPI(int value) const +{ + CClientDC statusDC(GetStatusBar()); + statusDC.SelectObject(GetStatusBar().GetFont()); + + // Perform the DPI adjustment calculation. + const int defaultDPI = 96; + int xDPI = statusDC.GetDeviceCaps(LOGPIXELSX); + value = MulDiv(value, xDPI, defaultDPI); + + return value; +} + +// Clears the contents of the richedit view. +void CMainFrame::ClearContents() +{ + m_richView.SetWindowText(nullptr); + m_pathName.Empty(); + SetWindowTitle(); + m_richView.SetFontDefaults(); + m_richView.SetModify(FALSE); + + // Set Rich text or plain text mode. + UINT mode = m_isRTF ? TM_RICHTEXT : TM_PLAINTEXT; + VERIFY(m_richView.SetTextMode(mode) == 0); + + SetStatusIndicators(); +} + +// Create the frame window. +HWND CMainFrame::Create(HWND parent) +{ + // Set m_view as the view window of the frame. + SetView(m_richView); + + // Set the registry key name, and load the initial window position. + // Use a registry key name like "CompanyName\\Application". + LoadRegistrySettings(L"Win32++\\Notepad Sample"); + + // Load the settings from the registry with 5 MRU entries. + LoadRegistryMRUSettings(5); + + return CFrame::Create(parent); +} + +// Determines the encoding of the specified file. +void CMainFrame::DetermineEncoding(CFile& file) +{ + UINT encoding = ANSI; + ULONGLONG fileLength = file.GetLength(); + + if (fileLength >= 3) + { + try + { + file.SeekToBegin(); + DWORD testlen = std::min(1024, static_cast(fileLength)); + std::vector buffer(testlen); + file.Read(buffer.data(), testlen); + + // look UTF Byte Order Mark (BOM) + if (buffer[0] == 0xef && buffer[1] == 0xbb && buffer[2] == 0xbf) + encoding = UTF8; + + // check for UTF-16 LE with Byte Order Mark (BOM) + int tests = IS_TEXT_UNICODE_SIGNATURE; + int textLength = static_cast(testlen); + if (::IsTextUnicode(buffer.data(), textLength, &tests) != 0) + encoding = UTF16LE; + } + catch (const CFileException& e) + { + CString str = CString("Failed to read from ") + e.GetFileName(); + ::MessageBox(nullptr, str, AtoW(e.what()), MB_ICONWARNING); + } + } + + file.SeekToBegin(); + + SetEncoding(encoding); +} + +// Retrieves the width of the part required to contain the specified text. +int CMainFrame::GetTextPartWidth(LPCWSTR text) const +{ + CClientDC statusDC(GetStatusBar()); + statusDC.SelectObject(GetStatusBar().GetFont()); + CSize textSize = statusDC.GetTextExtentPoint32(text); + int width = textSize.cx; + const int border = 8; + width += border; + + return width; +} + +// The stream in callback function. Reads from the file. +DWORD CALLBACK CMainFrame::MyStreamInCallback(DWORD cookie, LPBYTE pBuffer, LONG cb, LONG *pcb) +{ + HANDLE file = reinterpret_cast(static_cast(cookie)); + LPDWORD bytesRead = reinterpret_cast(pcb); + *bytesRead = 0; + DWORD bytesToRead = static_cast(cb); + if (!::ReadFile(file, pBuffer, bytesToRead, bytesRead, nullptr)) + ::MessageBox(nullptr, L"ReadFile Failed", L"", MB_OK); + + return 0; +} + +// The stream out callback function. Writes to the file. +DWORD CALLBACK CMainFrame::MyStreamOutCallback(DWORD cookie, LPBYTE pBuffer, LONG cb, LONG *pcb) +{ + HANDLE file = reinterpret_cast(static_cast(cookie)); + LPDWORD bytesWritten = reinterpret_cast(pcb); + *bytesWritten = 0; + DWORD bytesToRead = static_cast(cb); + if (!::WriteFile(file, pBuffer, bytesToRead, bytesWritten, nullptr)) + ::MessageBox(nullptr, L"WriteFile Failed", L"", MB_OK); + return 0; +} + +// Called when the window is closed. +void CMainFrame::OnClose() +{ + // Close the preview. + if (GetView() == m_preview) + OnPreviewClose(); + + // Check for unsaved text. + SaveModifiedText(); + + // Call the base function. + CFrame::OnClose(); +} + + +// Handle commands from the menu and toolbar. +BOOL CMainFrame::OnCommand(WPARAM wparam, LPARAM) +{ + UINT id = LOWORD(wparam); + + switch (id) + { + case IDM_FILE_NEW_PLAIN: return OnFileNewPlain(); + case IDM_FILE_NEW_RICH: return OnFileNewRich(); + case IDM_FILE_OPEN: return OnFileOpen(); + case IDM_FILE_SAVE: return OnFileSave(); + case IDM_FILE_SAVEAS: return OnFileSaveAs(); + case IDM_FILE_PREVIEW: return OnFilePreview(); + case IDM_FILE_PRINTNOW: return OnFilePrintNow(); + case IDM_FILE_PRINT: return OnFilePrint(); + case IDM_FILE_PRINTSETUP: return OnFilePrintSetup(); + case IDM_EDIT_COPY: return OnEditCopy(); + case IDM_EDIT_PASTE: return OnEditPaste(); + case IDM_EDIT_CUT: return OnEditCut(); + case IDM_EDIT_DELETE: return OnEditDelete(); + case IDM_EDIT_REDO: return OnEditRedo(); + case IDM_EDIT_UNDO: return OnEditUndo(); + case IDM_ENC_ANSI: return OnEncodeANSI(); + case IDM_ENC_UTF8: return OnEncodeUTF8(); + case IDM_ENC_UTF16: return OnEncodeUTF16(); + case IDM_FILE_EXIT: return OnFileExit(); + case IDW_VIEW_STATUSBAR: return OnViewStatusBar(); + case IDW_VIEW_TOOLBAR: return OnViewToolBar(); + case IDM_OPTIONS_WRAP: return OnOptionsWrap(); + case IDM_OPTIONS_FONT: return OnOptionsFont(); + case IDM_HELP_ABOUT: return OnHelp(); + + case IDW_FILE_MRU_FILE1: + case IDW_FILE_MRU_FILE2: + case IDW_FILE_MRU_FILE3: + case IDW_FILE_MRU_FILE4: + case IDW_FILE_MRU_FILE5: return OnFileMRU(wparam); + } + + return FALSE; +} + +// OnCreate controls the way the frame is created. +int CMainFrame::OnCreate(CREATESTRUCT& cs) +{ + // OnCreate controls the way the frame is created. + // Overriding CFrame::OnCreate is optional. + + // A menu is added if the IDW_MAIN menu resource is defined. + // Frames have all options enabled by default. + // Use the following functions to disable options. + + // UseIndicatorStatus(FALSE); // Don't show keyboard indicators in the StatusBar. + // UseMenuStatus(FALSE); // Don't show menu descriptions in the StatusBar. + // UseOwnerDrawnMenu(FALSE); // Don't use owner draw for popup menu items. + // UseReBar(FALSE); // Don't use a ReBar. + // UseStatusBar(FALSE); // Don't use a StatusBar. + // UseThemes(FALSE); // Don't use themes. + // UseToolBar(FALSE); // Don't use a ToolBar. + + // Call the base class function. + int result = CFrame::OnCreate(cs); + + // Change the status text to the name of the current printer. + CCustomPrintDlg printDlg; + CString deviceName = printDlg.GetDeviceName(); + if (deviceName.IsEmpty()) + SetStatusText(L"No printer found"); + else + { + CString status = L"Printer: " + printDlg.GetDeviceName(); + SetStatusText(status); + } + + return result; +} + +// Called when the effective dots per inch (dpi) for a window has changed. +// This occurs when: +// - The window is moved to a new monitor that has a different DPI. +// - The DPI of the monitor hosting the window changes. +LRESULT CMainFrame::OnDpiChanged(UINT msg, WPARAM wparam, LPARAM lparam) +{ + CFrame::OnDpiChanged(msg, wparam, lparam); + UpdateToolbar(); + RecalcLayout(); + return 0; +} + +// Called in response to the EN_DROPFILES notification. +void CMainFrame::OnDropFiles(HDROP dropInfo) +{ + UINT length = ::DragQueryFile(dropInfo, 0, nullptr, 0); + int bufferLength = static_cast(length); + if (length > 0) + { + CString fileName; + ::DragQueryFile(dropInfo, 0, fileName.GetBuffer(bufferLength), length + 1); + fileName.ReleaseBuffer(); + + if (ReadFile(fileName)) + { + m_pathName = fileName; + SetWindowTitle(); + AddMRUEntry(fileName); + } + } + + ::DragFinish(dropInfo); +} + +// Delete (cut) the current selection, if any. +BOOL CMainFrame::OnEditCut() +{ + m_richView.Cut(); + return TRUE; +} + +// Copy the current selection to the clipboard. +BOOL CMainFrame::OnEditCopy() +{ + m_richView.Copy(); + return TRUE; +} + +// Paste plain text or rich text to the document. +BOOL CMainFrame::OnEditPaste() +{ + if (m_isRTF) + // Paste rich text and plain text. + m_richView.Paste(); + else + // Paste plain text only. + m_richView.PasteSpecial(CF_TEXT); + + return TRUE; +} + +// Clears the contents of the document. +BOOL CMainFrame::OnEditDelete() +{ + m_richView.Clear(); + return TRUE; +} + +// Redoes the next action in the redo queue. +BOOL CMainFrame::OnEditRedo() +{ + m_richView.Redo(); + return TRUE; +} + +// Undoes the last operation in the undo queue. +BOOL CMainFrame::OnEditUndo() +{ + m_richView.Undo(); + return TRUE; +} + +// Select ANSI encoding. +BOOL CMainFrame::OnEncodeANSI() +{ + SetEncoding(ANSI); + int menuItem = GetFrameMenu().FindMenuItem(L"&Encoding"); + if (menuItem >= 0) + { + CMenu ThemeMenu = GetFrameMenu().GetSubMenu(menuItem); + ThemeMenu.CheckMenuRadioItem(IDM_ENC_ANSI, IDM_ENC_UTF16, IDM_ENC_ANSI, MF_BYCOMMAND); + } + + return TRUE; +} + +// Select UTF8 encoding. +BOOL CMainFrame::OnEncodeUTF8() +{ + SetEncoding(UTF8); + int menuItem = GetFrameMenu().FindMenuItem(L"&Encoding"); + if (menuItem >= 0) + { + CMenu ThemeMenu = GetFrameMenu().GetSubMenu(menuItem); + ThemeMenu.CheckMenuRadioItem(IDM_ENC_ANSI, IDM_ENC_UTF16, IDM_ENC_UTF8, MF_BYCOMMAND); + } + + return TRUE; +} + +// Select UTF16 encoding. +BOOL CMainFrame::OnEncodeUTF16() +{ + SetEncoding(UTF16LE); + int menuItem = GetFrameMenu().FindMenuItem(L"&Encoding"); + if (menuItem >= 0) + { + CMenu ThemeMenu = GetFrameMenu().GetSubMenu(menuItem); + ThemeMenu.CheckMenuRadioItem(IDM_ENC_ANSI, IDM_ENC_UTF16, IDM_ENC_UTF16, MF_BYCOMMAND); + } + + return TRUE; +} + +// Issue a close request to the frame to end the application. +BOOL CMainFrame::OnFileExit() +{ + Close(); + return TRUE; +} + +// Respond to a MRU selection. +BOOL CMainFrame::OnFileMRU(WPARAM wparam) +{ + UINT mruIndex = static_cast(LOWORD(wparam)) - IDW_FILE_MRU_FILE1; + CString mruText = GetMRUEntry(mruIndex); + + if (ReadFile(mruText)) + m_pathName = mruText; + else + RemoveMRUEntry(mruText); + + SetWindowTitle(); + + return TRUE; +} + +// Create a blank plain text document. +BOOL CMainFrame::OnFileNewPlain() +{ + //Check for unsaved text + SaveModifiedText(); + m_isRTF = false; + SetEncoding(ANSI); + ClearContents(); + return TRUE; +} + +// Create a blank rich text document. +BOOL CMainFrame::OnFileNewRich() +{ + //Check for unsaved text + SaveModifiedText(); + m_isRTF = true; + SetEncoding(ANSI); + ClearContents(); + return TRUE; +} + +// Preview the print job before sending it to a printer. +BOOL CMainFrame::OnFilePreview() +{ + // Verify a print preview is possible + try + { + m_isToolbarShown = GetToolBar().IsWindow() && GetToolBar().IsWindowVisible(); + + // Retrieve the device context of the default or currently chosen printer. + CCustomPrintDlg printDialog; + CDC printerDC = printDialog.GetPrinterDC(); + + // Create the preview window if required. + if (!m_preview.IsWindow()) + m_preview.Create(*this); + + // Set the preview's owner for notification messages, and number of pages. + UINT maxPage = m_richView.CollatePages(printerDC); + m_preview.DoPrintPreview(*this, maxPage); + + // Save the current Focus. + SaveFocus(); + + // Swap views + SetView(m_preview); + m_preview.SetFocus(); + + // Hide the menu and toolbar + ShowMenu(FALSE); + ShowToolBar(FALSE); + } + + catch (const CException& e) + { + // An exception occurred. Display the relevant information. + MessageBox(e.GetText(), L"Print Preview Failed", MB_ICONWARNING); + SetView(m_richView); + ShowMenu(GetFrameMenu() != 0); + ShowToolBar(m_isToolbarShown); + } + + return TRUE; +} + +// Select the printer and print the document. +BOOL CMainFrame::OnFilePrint() +{ + try + { + m_richView.DoPrint(m_pathName); + + // Change the status text to the name of the current printer. + CCustomPrintDlg printDlg; + CString deviceName = printDlg.GetDeviceName(); + if (deviceName.IsEmpty()) + SetStatusText(L"No printer found"); + else + { + CString status = L"Printer: " + printDlg.GetDeviceName(); + SetStatusText(status); + } + } + + catch (const CException& e) + { + // An exception occurred. Display the relevant information. + MessageBox(e.GetText(), L"Print Failed", MB_ICONWARNING); + } + + return TRUE; +} + +// Select the printer for use by the application. +BOOL CMainFrame::OnFilePrintSetup() +{ + try + { + CCustomPrintDlg printDlg; + printDlg.DoSetupModal(*this); + + // Change the status text to the name of the current printer. + CString deviceName = printDlg.GetDeviceName(); + if (deviceName.IsEmpty()) + SetStatusText(L"No printer found"); + else + { + CString status = L"Printer: " + printDlg.GetDeviceName(); + SetStatusText(status); + } + } + + catch(const CException& e) + { + // An exception occurred. Display the relevant information. + MessageBox(e.GetText(), L"Print Setup Failed", MB_ICONWARNING); + } + + return TRUE; +} + +// Print the document without selecting the printer. +BOOL CMainFrame::OnFilePrintNow() +{ + try + { + m_richView.QuickPrint(m_pathName); + } + + catch (const CException& e) + { + // An exception occurred. Display the relevant information. + MessageBox(e.GetText(), L"Print Failed", MB_ICONWARNING); + } + return TRUE; +} + +// Display the file choose dialog and load text from a file. +BOOL CMainFrame::OnFileOpen() +{ + // szFilters is a text string that includes two file name filters: + // "*.txt" for Plain Text files, "*.rtf" for Rich Text files and "*.*' for "All Files." + LPCWSTR filters; + if (m_isRTF) + filters = L"Rich Text Files (*.rtf)\0*.rtf\0Plain Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0"; + else + filters = L"Plain Text Files (*.txt)\0*.txt\0Rich Text Files (*.rtf)\0*.rtf\0All Files (*.*)\0*.*\0"; + + CFileDialog fileDlg(TRUE, L"txt", nullptr, OFN_FILEMUSTEXIST, filters); + + if (fileDlg.DoModal(*this) == IDOK) + { + CString str = fileDlg.GetPathName(); + + if (ReadFile(str)) + { + SetPathName(str); + AddMRUEntry(str); + SetWindowTitle(); + } + } + + return TRUE; +} + +// Save the document text to the current file. +BOOL CMainFrame::OnFileSave() +{ + if (m_pathName.IsEmpty()) + OnFileSaveAs(); + else + { + DWORD dwAttrib = GetFileAttributes(m_pathName); + if (dwAttrib != INVALID_FILE_ATTRIBUTES) + { + CString str = "This file already exists.\nDo you want to replace it?"; + if (IDYES == MessageBox(str, L"Confirm Save", MB_ICONWARNING | MB_OKCANCEL)) + WriteFile(m_pathName); + } + else + WriteFile(m_pathName); + } + + return TRUE; +} + +// Display the file choose dialog and save text to the file. +BOOL CMainFrame::OnFileSaveAs() +{ + // szFilter is a text string that includes two file name filters: + // "*.txt" for Plain Text Files, "*.rtf" for Rich Text Files, and "*.*' for All Files. + LPCWSTR filters; + if (m_isRTF) + filters = L"Rich Text Files (*.rtf)\0*.rtf\0Plain Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0"; + else + filters = L"Plain Text Files (*.txt)\0*.txt\0Rich Text Files (*.rtf)\0*.rtf\0All Files (*.*)\0*.*\0"; + CFileDialog fileDlg(FALSE, L"txt", nullptr, OFN_OVERWRITEPROMPT, filters); + + if (fileDlg.DoModal(*this) == IDOK) + { + CString str = fileDlg.GetPathName(); + WriteFile(str); + SetPathName(str); + AddMRUEntry(str); + SetWindowTitle(); + } + + return TRUE; +} + +// Display the help about dialog. +BOOL CMainFrame::OnHelp() +{ + // Ensure only one dialog displayed even for multiple hits of the F1 button. + if (!m_aboutDialog.IsWindow()) + { + m_aboutDialog.DoModal(*this); + } + + return TRUE; +} + +// Called after OnCreate. +void CMainFrame::OnInitialUpdate() +{ + DragAcceptFiles(TRUE); + SetWindowTitle(); + + // Select the ANSI radio button + int menuItem = GetFrameMenu().FindMenuItem(L"&Encoding"); + if (menuItem >= 0) + { + CMenu ThemeMenu = GetFrameMenu().GetSubMenu(menuItem); + ThemeMenu.CheckMenuRadioItem(IDM_ENC_ANSI, IDM_ENC_UTF16, IDM_ENC_ANSI, MF_BYCOMMAND); + } + + m_richView.SetFocus(); + SetEncoding(ANSI); + + // Retrieve the command line arguments. + std::vector args = GetCommandLineArgs(); + // The second argument (if any) contains our file name. + if (args.size() > 1) + ReadFile(args[1]); +} + +// Updates menu items before they are displayed. +void CMainFrame::OnMenuUpdate(UINT id) +{ + UINT enabled; + UINT checked; + + switch (id) + { + case IDM_OPTIONS_WRAP: + { + checked = m_isWrapped ? MF_CHECKED : MF_GRAYED; + GetFrameMenu().CheckMenuItem(id, checked); + break; + } + case IDM_ENC_UTF8: + { + // Only enable UTF-8 for plain text mode. + enabled = m_isRTF ? MF_GRAYED : MF_ENABLED; + GetFrameMenu().EnableMenuItem(id, enabled); + break; + } + case IDM_ENC_UTF16: + { + // Only enable UTF-16 for plain text mode. + enabled = m_isRTF ? MF_GRAYED : MF_ENABLED; + GetFrameMenu().EnableMenuItem(id, enabled); + break; + } + case IDM_FILE_SAVE: + { + enabled = m_richView.GetModify()? MF_ENABLED : MF_GRAYED; + GetFrameMenu().EnableMenuItem(id, enabled); + break; + } + case IDM_EDIT_COPY: + case IDM_EDIT_CUT: + case IDM_EDIT_DELETE: + { + CHARRANGE range; + m_richView.GetSel(range); + enabled = (range.cpMin != range.cpMax) ? MF_ENABLED : MF_GRAYED; + GetFrameMenu().EnableMenuItem(id, enabled); + break; + } + case IDM_EDIT_PASTE: + { + enabled = m_richView.CanPaste(CF_TEXT) ? MF_ENABLED : MF_GRAYED; + GetFrameMenu().EnableMenuItem(id, enabled); + break; + } + case IDM_EDIT_REDO: + { + enabled = m_richView.CanRedo() ? MF_ENABLED : MF_GRAYED; + GetFrameMenu().EnableMenuItem(id, enabled); + break; + } + case IDM_EDIT_UNDO: + { + enabled = m_richView.CanUndo() ? MF_ENABLED : MF_GRAYED; + GetFrameMenu().EnableMenuItem(id, enabled); + break; + } + } + + if ((id >= IDM_ENC_ANSI) && (id <= IDM_ENC_UTF16)) + OnUpdateRangeOfIDs(IDM_ENC_ANSI, IDM_ENC_UTF16, id); + + CFrame::OnMenuUpdate(id); +} + +// Respond to notification messages (WM_NOTIFY) from child windows. +LRESULT CMainFrame::OnNotify(WPARAM wparam, LPARAM lparam) +{ + LPNMHDR pHeader = reinterpret_cast(lparam); + switch (pHeader->code) + { + case EN_DROPFILES: + { + ENDROPFILES* enDrop = reinterpret_cast(lparam); + HDROP dropInfo = reinterpret_cast(enDrop->hDrop); + OnDropFiles(dropInfo); + } + return TRUE; + } + + return CFrame::OnNotify(wparam, lparam); +} + +// Select a font for the document. +BOOL CMainFrame::OnOptionsFont() +{ + // Retrieve the current character format. + CHARFORMAT cf{}; + cf.cbSize = sizeof(cf); + cf.dwMask = CFM_COLOR | CFM_FACE | CFM_EFFECTS; + + if (m_isRTF) + m_richView.GetSelectionCharFormat(cf); + else + m_richView.GetDefaultCharFormat(cf); + + // Display the Choose Font dialog + CFontDialog dlg(cf, CF_SCREENFONTS | CF_EFFECTS); + + if (dlg.DoModal(*this) == IDOK) + { + + // Assign the new font to the rich text document. + cf = dlg.GetCharFormat(); + if (m_isRTF) + { + // Change the selected characters in a RTF document. + m_richView.SetSelectionCharFormat(cf); + } + else + { + // Change the entire document for plain text. + m_richView.SetDefaultCharFormat(cf); + } + } + + return TRUE; +} + +// Turn word wrap on or off. +BOOL CMainFrame::OnOptionsWrap() +{ + m_richView.SetTargetDevice(0, m_isWrapped); + m_isWrapped = !m_isWrapped; + return TRUE; +} + +// Called when the Print Preview's "Close" button is pressed. +LRESULT CMainFrame::OnPreviewClose() +{ + // Swap the view + SetView(m_richView); + + // Show the menu and toolbar + ShowMenu(GetFrameMenu() != 0); + ShowToolBar(m_isToolbarShown); + UpdateSettings(); + + // Restore focus to the window focused before DoPrintPreview was called. + RestoreFocus(); + + return 0; +} + +// Called when the Print Preview's "Print Now" button is pressed +LRESULT CMainFrame::OnPreviewPrint() +{ + try + { + m_richView.QuickPrint(m_pathName); + } + + catch (const CException& e) + { + // An exception occurred. Display the relevant information. + MessageBox(e.GetText(), L"Print Failed", MB_ICONWARNING); + } + + return 0; +} + +// Called when the Print Preview's "Print Setup" button is pressed. +LRESULT CMainFrame::OnPreviewSetup() +{ + // Call the print setup dialog. + CPrintDialog printDlg(PD_PRINTSETUP); + try + { + // Display the print dialog + if (printDlg.DoModal(*this) == IDOK) + { + CString status = L"Printer: " + printDlg.GetDeviceName(); + SetStatusText(status); + } + + // Initiate the print preview. + CDC printerDC = printDlg.GetPrinterDC(); + UINT maxPage = m_richView.CollatePages(printerDC); + m_preview.DoPrintPreview(*this, maxPage); + } + + catch (const CException& e) + { + // An exception occurred. Display the relevant information. + MessageBox(e.GetErrorString(), e.GetText(), MB_ICONWARNING); + } + + return 0; +} + +// Update the radio buttons in the menu. +BOOL CMainFrame::OnUpdateRangeOfIDs(UINT idFirst, UINT idLast, UINT id) +{ + int menuItem = GetFrameMenu().FindMenuItem(L"&Encoding"); + CMenu radioMenu = GetFrameMenu().GetSubMenu(menuItem); + UINT enc = m_encodeMode + IDM_ENC_ANSI; + if (enc == id) + radioMenu.CheckMenuRadioItem(idFirst, idLast, id, MF_BYCOMMAND); + + return TRUE; +} + +// Streams the file into the rich edit control. +BOOL CMainFrame::ReadFile(LPCWSTR fileName) +{ + try + { + // Open the file for reading + CFile file; + file.Open(fileName, OPEN_EXISTING | CFile::modeRead); + + // Restrict the file size to something a richedit control can handle. + ULONGLONG fileLength = file.GetLength(); + if (fileLength > 100000000) + { + throw CFileException(fileName, L"File is too large!"); + } + + // Use RFT mode if the file has an rtf extension + CString ext = file.GetFileNameExt(); + ext.MakeLower(); + if (ext == L"rtf") + OnFileNewRich(); + else + OnFileNewPlain(); + + // set the EDITSTREAM mode + int stream_mode = m_isRTF? SF_RTF : SF_TEXT; + // try to determine the file encoding: Note that ANSI and UTF-8 are + // handled by default, and only UTF-16 LE is accommodated by RichEdit. + DetermineEncoding(file); + if (m_encodeMode == UTF16LE) + stream_mode |= SF_UNICODE; + + if (m_encodeMode == UTF16LE) + file.Seek(2, FILE_BEGIN); + + // Skip the BOM for UTF8 encoding + if ((m_encodeMode == UTF8) && m_isRTF) + file.Seek(3, FILE_BEGIN); + + EDITSTREAM es; + es.dwCookie = reinterpret_cast(file.GetHandle()); + es.pfnCallback = reinterpret_cast( + reinterpret_cast(MyStreamInCallback)); + m_richView.StreamIn(stream_mode, es); + + //Clear the modified text flag + m_richView.SetModify(FALSE); + + SetStatusIndicators(); + } + + catch (const CFileException& e) + { + CString str = L"Failed to load: "; + str += e.GetFilePath(); + str += "\n"; + str += e.GetText(); + ::MessageBox(nullptr, str, AtoW(e.what()), MB_ICONWARNING); + return FALSE; + } + + return TRUE; +} + +// Provides an opportunity to save the document before it is closed. +void CMainFrame::SaveModifiedText() +{ + // Check for unsaved text + if (m_richView.GetModify()) + if (::MessageBox(0, L"Save changes to this document", L"Notepad", MB_YESNO | MB_ICONWARNING) == IDYES) + OnFileSave(); +} + +// Set the encoding type. +void CMainFrame::SetEncoding(int encodeMode) +{ + m_encodeMode = encodeMode; + SetStatusIndicators(); +} + +// Saves the documents full path name. +void CMainFrame::SetPathName(LPCWSTR filePathName) +{ + m_pathName = filePathName; +} + +// Updates the status indicators. +void CMainFrame::SetStatusIndicators() +{ + if (GetStatusBar().IsWindow()) + { + // Calculate the width of the text indicators + CClientDC statusDC(GetStatusBar()); + statusDC.SelectObject(GetStatusBar().GetFont()); + CString cap = LoadString(IDW_INDICATOR_CAPS); + CString num = LoadString(IDW_INDICATOR_NUM); + CString ovr = LoadString(IDW_INDICATOR_OVR); + CString ins = LoadString(IDW_INDICATOR_INS); + CString scrl = LoadString(IDW_INDICATOR_SCRL); + CString rich = LoadString(IDW_INDICATOR_RICH); + CString plain = LoadString(IDW_INDICATOR_PLAIN); + CString empty; + + m_mode = m_isRTF ? rich : plain; + + switch (m_encodeMode) + { + case ANSI: m_encoding = LoadString(IDM_ENC_ANSI); break; + case UTF8: m_encoding = LoadString(IDM_ENC_UTF8); break; + case UTF16LE: m_encoding = LoadString(IDM_ENC_UTF16); break; + default: m_encoding = LoadString(IDM_ENC_ANSI); break; + } + + m_cap = (::GetKeyState(VK_CAPITAL) & 0x0001) ? cap : empty; + m_num = (::GetKeyState(VK_NUMLOCK) & 0x0001) ? num : empty; + m_ovr = (::GetKeyState(VK_INSERT) & 0x0001) ? ovr : ins; + + // Update the indicators. + // Need member variables for owner drawn text to keep them in scope. + GetStatusBar().SetPartText(1, m_mode, SBT_OWNERDRAW); + GetStatusBar().SetPartText(2, m_encoding, SBT_OWNERDRAW); + GetStatusBar().SetPartText(3, m_cap, SBT_OWNERDRAW); + GetStatusBar().SetPartText(4, m_num, SBT_OWNERDRAW); + GetStatusBar().SetPartText(5, m_ovr, SBT_OWNERDRAW); + } +} + +// Reposition the statusbar parts. It's called when the statusbar is resized. +void CMainFrame::SetStatusParts() +{ + // Calculate the width of the text indicators + CClientDC statusDC(GetStatusBar()); + statusDC.SelectObject(GetStatusBar().GetFont()); + + // Fill a vector with the status bar part widths. + std::vector partWidths; + + partWidths.push_back(GetTextPartWidth(LoadString(IDW_INDICATOR_PLAIN))); + partWidths.push_back(GetTextPartWidth(LoadString(IDM_ENC_UTF16))); + partWidths.push_back(GetTextPartWidth(LoadString(IDW_INDICATOR_CAPS))); + partWidths.push_back(GetTextPartWidth(LoadString(IDW_INDICATOR_NUM))); + partWidths.push_back(GetTextPartWidth(LoadString(IDW_INDICATOR_OVR))); + + int sumWidths = 0; + for (int i : partWidths) + { + sumWidths += i; + } + + const int gripWidth = 20; + sumWidths += AdjustForDPI(gripWidth); + + // Insert the width for the first status bar part into the vector. + CRect clientRect = GetClientRect(); + const LONG minWidth = 300; + int width = std::max(minWidth, clientRect.right); + auto begin = partWidths.begin(); + partWidths.insert(begin, width - sumWidths); + + // Create or resize the status bar parts. + int part = 0; + for (int i : partWidths) + { + GetStatusBar().SetPartWidth(part++, i); + } +} + + +// Specifies the images for menu item IDs matching the toolbar data. +void CMainFrame::SetupMenuIcons() +{ + std::vector data = GetToolBarData(); + if (GetMenuIconHeight() >= 24) + SetMenuIcons(data, RGB(192, 192, 192), IDW_MAIN); + else + SetMenuIcons(data, RGB(192, 192, 192), IDW_MENUICONS); +} + +// Assigns images and command IDs to the toolbar buttons, +void CMainFrame::SetupToolBar() +{ + // Define the resource IDs for the toolbar + AddToolBarButton(IDM_FILE_NEW_PLAIN); + AddToolBarButton(IDM_FILE_NEW_RICH); + AddToolBarButton(IDM_FILE_OPEN); + AddToolBarButton(IDM_FILE_SAVE); + AddToolBarButton(IDM_FILE_SAVEAS); + AddToolBarButton(0); // Separator + AddToolBarButton(IDM_EDIT_CUT); + AddToolBarButton(IDM_EDIT_COPY); + AddToolBarButton(IDM_EDIT_PASTE); + AddToolBarButton(0); // Separator + AddToolBarButton(IDM_FILE_PRINT); + AddToolBarButton(0); // Separator + AddToolBarButton(IDM_HELP_ABOUT); +} + +// Sets the frame's title. +void CMainFrame::SetWindowTitle() +{ + CString appName; + appName.LoadString(IDW_MAIN); + CString title; + + if (m_pathName.IsEmpty()) + title << appName; + else + title << m_pathName << L" - " << appName; + + SetWindowText(title); +} + +// Called by CTextApp::OnIdle to update toolbar buttons +void CMainFrame::UpdateToolbar() +{ + CHARRANGE range; + m_richView.GetSel(range); + BOOL isSelected = (range.cpMin != range.cpMax); + BOOL canPaste = m_richView.CanPaste(CF_TEXT); + BOOL isDirty = m_richView.GetModify(); + + GetToolBar().EnableButton(IDM_EDIT_COPY, isSelected); + GetToolBar().EnableButton(IDM_EDIT_CUT, isSelected); + GetToolBar().EnableButton(IDM_EDIT_PASTE, canPaste); + GetToolBar().EnableButton(IDM_FILE_SAVE, isDirty); +} + +// Process the frame's window messages. +LRESULT CMainFrame::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case UWM_PREVIEWCLOSE: return OnPreviewClose(); + case UWM_PREVIEWPRINT: return OnPreviewPrint(); + case UWM_PREVIEWSETUP: return OnPreviewSetup(); + } + + return WndProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + +// Streams from the rich edit control to the specified file. +BOOL CMainFrame::WriteFile(LPCWSTR szFileName) +{ + try + { + // Open the file for writing + CFile file; + file.Open(szFileName, CREATE_ALWAYS); + + // Use Rich Text mode if the file has an rtf extension + CString ext = file.GetFileNameExt(); + ext.MakeLower(); + m_isRTF = (ext == L"rtf"); + + // set the EDITSTREAM mode + int stream_mode = m_isRTF ? SF_RTF : SF_TEXT; + + if (m_encodeMode == UTF16LE) + stream_mode |= SF_UNICODE; + + if (m_encodeMode == UTF8) + stream_mode |= (CP_UTF8 << 16) | SF_USECODEPAGE; + + // Write the BOM for UTF16LE encoding. + if (m_encodeMode == UTF16LE) + { + byte buffer[2] = { 0xff, 0xfe }; + file.Write(buffer, 2); + } + + // Write the BOM for UTF encoding + if (m_encodeMode == UTF8) + { + byte buffer[3] = { 0xef, 0xbb, 0xbf }; + file.Write(buffer, 3); + } + + EDITSTREAM es; + es.dwCookie = reinterpret_cast(file.GetHandle()); + es.dwError = 0; + es.pfnCallback = reinterpret_cast( + reinterpret_cast(MyStreamOutCallback)); + m_richView.StreamOut(stream_mode, es); + + //Clear the modified text flag + m_richView.SetModify(FALSE); + } + + catch (const CFileException&) + { + CString str = L"Failed to write: "; + str += szFileName; + ::MessageBox(nullptr, str, L"Warning", MB_ICONWARNING); + return FALSE; + } + + return TRUE; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/Mainfrm.h b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/Mainfrm.h new file mode 100644 index 00000000..3184c8d2 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/Mainfrm.h @@ -0,0 +1,110 @@ +///////////////////////////// +// Mainfrm.h +// + +#ifndef MAINFRM_H +#define MAINFRM_H + +#include "RichView.h" +#include "AboutDialog.h" + + +/////////////////////////////////////////////////////////// +// CMainFrame manages the application's main window. +// The main window is a frame that has a menubar, toolbar, +// statusbar and view window. +class CMainFrame : public CFrame +{ +public: + CMainFrame(); + virtual ~CMainFrame() override = default; + virtual HWND Create(HWND parent = nullptr) override; + void UpdateToolbar(); + +protected: + virtual void OnClose() override; + virtual BOOL OnCommand(WPARAM wparam, LPARAM lparam) override; + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual LRESULT OnDpiChanged(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual BOOL OnHelp() override; + virtual void OnInitialUpdate() override; + virtual void OnMenuUpdate(UINT id) override; + virtual LRESULT OnNotify(WPARAM wparam, LPARAM lparam) override; + virtual void SetStatusIndicators() override; + virtual void SetStatusParts() override; + virtual void SetupMenuIcons() override; + virtual void SetupToolBar() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CMainFrame(const CMainFrame&) = delete; + CMainFrame& operator=(const CMainFrame&) = delete; + + // Static callback functions + static DWORD CALLBACK MyStreamInCallback(DWORD cookie, LPBYTE pBuffer, LONG cb, LONG* pcb); + static DWORD CALLBACK MyStreamOutCallback(DWORD cookie, LPBYTE pBuffer, LONG cb, LONG* pcb); + + // Command handlers + void OnDropFiles(HDROP dropInfo); + BOOL OnEditCut(); + BOOL OnEditCopy(); + BOOL OnEditPaste(); + BOOL OnEditDelete(); + BOOL OnEditRedo(); + BOOL OnEditUndo(); + BOOL OnEncodeANSI(); + BOOL OnEncodeUTF8(); + BOOL OnEncodeUTF16(); + BOOL OnFileMRU(WPARAM wparam); + BOOL OnFileExit(); + BOOL OnFileNewPlain(); + BOOL OnFileNewRich(); + BOOL OnFileOpen(); + BOOL OnFilePreview(); + BOOL OnFilePrint(); + BOOL OnFilePrintSetup(); + BOOL OnFilePrintNow(); + BOOL OnFileSaveAs(); + BOOL OnFileSave(); + BOOL OnOptionsFont(); + BOOL OnOptionsWrap(); + BOOL OnUpdateRangeOfIDs(UINT idFirst, UINT idLast, UINT id); + + // Message handlers + LRESULT OnPreviewClose(); + LRESULT OnPreviewPrint(); + LRESULT OnPreviewSetup(); + + int AdjustForDPI(int value) const; + void ClearContents(); + void DetermineEncoding(CFile& file); + int GetTextPartWidth(LPCWSTR text) const; + BOOL ReadFile(LPCWSTR fileName); + void RestoreFocus() { ::SetFocus(m_oldFocus); } + void SaveFocus() { m_oldFocus = ::GetFocus(); } + void SaveModifiedText(); + void SetEncoding(int encoding); + void SetPathName(LPCWSTR fullFileName); + + void SetWindowTitle(); + BOOL WriteFile(LPCWSTR fileName); + + // Member variables + CAboutDialog m_aboutDialog; + CRichView m_richView; + CPrintPreview m_preview; // CRichView is the source of for CPrintPreview + CString m_pathName; + CString m_mode; + CString m_cap; + CString m_num; + CString m_ovr; + CString m_encoding; + int m_encodeMode; + bool m_isToolbarShown; + bool m_isWrapped; + bool m_isRTF; + HWND m_oldFocus; +}; + +#endif //MAINFRM_H + diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/Resource.rc b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/Resource.rc new file mode 100644 index 00000000..95c1293e --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/Resource.rc @@ -0,0 +1,332 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "../src/res/PerMonitorV2.manifest" + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDW_MAIN MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "New Plain Text", IDM_FILE_NEW_PLAIN + MENUITEM "New Rich Text", IDM_FILE_NEW_RICH + MENUITEM "&Open...\tCtrl+O", IDM_FILE_OPEN + MENUITEM "&Save\tCtrl+S", IDM_FILE_SAVE + MENUITEM "Save &As...", IDM_FILE_SAVEAS + MENUITEM SEPARATOR + MENUITEM "&Print...\tCtrl+P", IDM_FILE_PRINT + MENUITEM "Print Preview", IDM_FILE_PREVIEW + MENUITEM "Print Now", IDM_FILE_PRINTNOW + MENUITEM "Printer Setup", IDM_FILE_PRINTSETUP + MENUITEM SEPARATOR + MENUITEM "Recent Files", IDW_FILE_MRU_FILE1, GRAYED + MENUITEM SEPARATOR + MENUITEM "E&xit\tAlt+F4", IDM_FILE_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "Undo\tCtrl+Z", IDM_EDIT_UNDO + MENUITEM "Redo\tCtrl+Y", IDM_EDIT_REDO + MENUITEM SEPARATOR + MENUITEM "Cut\tCtrl+X", IDM_EDIT_CUT + MENUITEM "Copy\tCtrl+C", IDM_EDIT_COPY + MENUITEM "Paste\tCtrl+V", IDM_EDIT_PASTE + MENUITEM "Delete\tDel", IDM_EDIT_DELETE + END + POPUP "&Options" + BEGIN + MENUITEM "Font", IDM_OPTIONS_FONT + MENUITEM "Word Wrap", IDM_OPTIONS_WRAP, CHECKED + END + POPUP "&Encoding" + BEGIN + MENUITEM "ANSI", IDM_ENC_ANSI + MENUITEM "UTF-8", IDM_ENC_UTF8 + MENUITEM "UTF-16", IDM_ENC_UTF16 + END + POPUP "&View" + BEGIN + MENUITEM "&Tool Bar", IDW_VIEW_TOOLBAR, CHECKED + MENUITEM "&Status Bar", IDW_VIEW_STATUSBAR, CHECKED + END + POPUP "&Help" + BEGIN + MENUITEM "&About\tF1", IDM_HELP_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDW_MAIN ICON "../src/res/Notepad.ico" + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDW_MAIN BITMAP "../src/res/toolbar24.bmp" +IDW_MENUICONS BITMAP "../src/res/toolbar16.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDW_ABOUT DIALOGEX 0, 0, 186, 109 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "MS Shell Dlg", 400, 0 +BEGIN + DEFPUSHBUTTON "OK",IDOK,68,60,50,14 + CTEXT "Notepad with custom print dialog",IDC_STATIC,43,22,99,8 + ICON IDW_MAIN,0,4,4,20,20 + CTEXT "",IDC_STATIC1,53,32,80,8 + CTEXT "",IDC_STATIC2,53,42,80,8 +END + +IDD_PRINTDLG DIALOGEX 32, 32, 288, 186 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Print" +FONT 8, "MS Shell Dlg", 0, 0 +BEGIN + GROUPBOX "Printer",IDC_GROUPBOX1,8,4,272,84,WS_GROUP + LTEXT "&Name:", IDC_STATIC,16,20,36,8 + COMBOBOX IDC_COMBOBOX,52,18,152,152,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Properties...",IDB_PRINTPROPERTIES,212,17,60,14,WS_GROUP + LTEXT "Status:", IDC_STATIC,16,36,36,10,SS_NOPREFIX + CONTROL "",IDS_STATUS,"Static",SS_LEFTNOWORDWRAP | SS_NOPREFIX | WS_GROUP,52,36,224,10 + LTEXT "Type:", IDC_STATIC,16,48,36,10,SS_NOPREFIX + CONTROL "",IDS_TYPE,"Static",SS_LEFTNOWORDWRAP | SS_NOPREFIX | WS_GROUP,52,48,224,10 + LTEXT "Where:", IDC_STATIC,16,60,36,10,SS_NOPREFIX + CONTROL "",IDS_WHERE,"Static",SS_LEFTNOWORDWRAP | SS_NOPREFIX | WS_GROUP,52,60,224,10 + LTEXT "Comment:", IDC_STATIC,16,72,36,10,SS_NOPREFIX + CONTROL "",IDS_COMMENT,"Static",SS_LEFTNOWORDWRAP | SS_NOPREFIX | WS_GROUP,52,72,156,10 + CONTROL "Print to fi&le",IDB_PRINTTOFILE,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,212,72,64,12 + GROUPBOX "Print range",IDC_GROUPBOX2,8,92,144,64,WS_GROUP + RADIOBUTTON "&All", IDB_RADIOALL,16,106,64,12,WS_GROUP + RADIOBUTTON "Pa&ges", IDB_RADIORANGE,16,122,36,12 + RADIOBUTTON "&Selection", IDB_RADIOSELECTION,16,138,64,12 + RTEXT "&from:",IDC_STATIC,52,124,20,8 + EDITTEXT IDS_FROM,74,122,26,12,ES_NUMBER | WS_GROUP + RTEXT "&to:",IDC_STATIC,102,124,16,8 + EDITTEXT IDS_TO,120,122,26,12,ES_NUMBER | WS_GROUP + GROUPBOX "Copies",IDC_GROUPBOX3,160,92,120,64,WS_GROUP + LTEXT "Number of &copies:", IDC_STATIC,168,108,68,8 + EDITTEXT IDS_COPIES,240,106,32,12,ES_NUMBER | WS_GROUP +// ICON "",1086,162,124,20,20,SS_CENTERIMAGE | WS_GROUP + CONTROL "C&ollate",IDB_COLLATE,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,240,130,36,12 + DEFPUSHBUTTON "OK",IDOK,180,164,48,14,WS_GROUP + PUSHBUTTON "Cancel",IDCANCEL,232,164,48,14 + PUSHBUTTON "&Help", IDB_HELP,8,164,48,14 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDW_MAIN ACCELERATORS +BEGIN + "O", IDM_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT + "P", IDM_FILE_PRINT, VIRTKEY, CONTROL, NOINVERT + "S", IDM_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT + "C", IDM_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + "X", IDM_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT + "V", IDM_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT + "Z", IDM_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT + "Y", IDM_EDIT_REDO, VIRTKEY, CONTROL, NOINVERT +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_PRINTDLG, DIALOG + BEGIN + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDW_MAIN "CustomPrintDialog" + IDW_VIEW_TOOLBAR "Show or hide the tool bar" + IDW_VIEW_STATUSBAR "Show or hide the status bar" + IDW_READY "Ready" + IDW_INDICATOR_CAPS "CAP" + IDW_INDICATOR_NUM "NUM" +END + +STRINGTABLE +BEGIN + IDW_INDICATOR_SCRL "SCRL" +END + +STRINGTABLE +BEGIN + IDM_HELP_ABOUT "Display Information about this program" + IDW_INDICATOR_INS "INS" + IDW_INDICATOR_OVR "OVR" + IDW_INDICATOR_PLAIN "Plain text mode" + IDW_INDICATOR_RICH "Rich text mode" +END + +STRINGTABLE +BEGIN + IDW_PREVIEWPRINT "Print Now" + IDW_PREVIEWSETUP "Print Setup" + IDW_PREVIEWPREV "Prev Page" + IDW_PREVIEWNEXT "Next Page" +END + +STRINGTABLE +BEGIN + IDW_PREVIEWCLOSE "Close" +END + +STRINGTABLE +BEGIN + IDM_FILE_NEW_PLAIN "Create a New Plain Text Document" + IDM_FILE_NEW_RICH "Create a New Rich Text Document" + IDM_FILE_OPEN "Open Existing Document" + IDM_FILE_SAVE "Save the Document" + IDM_FILE_SAVEAS "Save the Document with a new name" + IDM_FILE_PREVIEW "Preview the print job before printing" + IDM_FILE_PRINTNOW "Print without displaying a print dialog" +END + +STRINGTABLE +BEGIN + IDM_FILE_PRINT "Print the Document" + IDM_FILE_PRINTSETUP "Select the printer and paper size" + IDM_FILE_EXIT "End the Program" + IDM_EDIT_UNDO "Undo the last action" + IDM_EDIT_REDO "Redo the previously undone action" + IDM_EDIT_CUT "Cut the Selected Contents to the Clipboard" + IDM_EDIT_COPY "Copy the Selected Contents to the Clipboard" + IDM_EDIT_PASTE "Paste the Clipboard Contents to the Document" + IDM_EDIT_DELETE "Erase the selected Contents" + IDM_OPTIONS_FONT "Choose the font" + IDM_OPTIONS_WRAP "Enable or disable word wrap" +END + +STRINGTABLE +BEGIN + IDM_ENC_ANSI "Encoding: ANSI" + IDM_ENC_UTF8 "Encoding: UTF-8" + IDM_ENC_UTF16 "Encoding: UTF-16" +END + +STRINGTABLE +BEGIN + SC_CLOSE "Close the Window" + SC_MAXIMIZE "Maximize the Window" + SC_MINIMIZE "Minimize the Window" + SC_MOVE "Move the Window" + SC_NEXTWINDOW "Select Next Window" + SC_PREVWINDOW "Select Previous Window" + SC_RESTORE "Restore the Window" + SC_SIZE "Resize the Window" +END + +STRINGTABLE +BEGIN + IDW_FILE_MRU_FILE1 "Open this document" + IDW_FILE_MRU_FILE2 "Open this document" + IDW_FILE_MRU_FILE3 "Open this document" + IDW_FILE_MRU_FILE4 "Open this document" + IDW_FILE_MRU_FILE5 "Open this document" +END + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/RichView.cpp b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/RichView.cpp new file mode 100644 index 00000000..0750d159 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/RichView.cpp @@ -0,0 +1,406 @@ +///////////////////////////// +// RichView.cpp +// + +#include "stdafx.h" +#include "RichView.h" +#include "UserMessages.h" + + +///////////////////////////////// +// CRichView function definitions +// + +// Calculates the character position of the page breaks, and returns +// the number of pages. +int CRichView::CollatePages(const CDC& printerDC) +{ + if (printerDC.GetHDC() == nullptr) + return 0; + + // Find the first and last characters. + LONG firstChar = 0; + LONG lastChar = GetTextLengthEx(GTL_NUMCHARS); + if (m_printDialog.IsPrintSelection()) + { + LONG first = 0; + LONG last = 0; + GetSel(first, last); + if (first != last) // Is anything selected? + { + firstChar = first; + lastChar = last; + } + } + + FORMATRANGE fr; + fr.hdcTarget = printerDC; + fr.hdc = printerDC; + fr.rcPage = GetPageRect(printerDC); + fr.rc = GetPrintRect(printerDC); + fr.chrg.cpMin = firstChar; + fr.chrg.cpMax = lastChar; + + // Calculate the page breaks + LONG lastCharOnPage; // The index of the last char that fits on the page. + m_pageBreaks.clear(); + do + { + lastCharOnPage = FormatRange(fr, FALSE); + fr.chrg.cpMin = lastCharOnPage; + fr.chrg.cpMax = lastChar; + m_pageBreaks.push_back(lastCharOnPage); // store the page break index in the vector + + } while (lastCharOnPage < lastChar); + + // return the number of pages. + return static_cast(m_pageBreaks.size()); +} + +// Choose the printer and print the document. +void CRichView::DoPrint(LPCWSTR docName) +{ + // Set initial pages selection, along with to and from pages. + SetDefaultPrintOptions(); + + INT_PTR result = m_printDialog.DoModal(*this); + if (result == IDOK) + { + // Acquire the currently selected printer and page settings. + CDC printerDC = m_printDialog.GetPrinterDC(); + m_printDialog.SetFromPage(std::max(m_printDialog.GetFromPage(), 1)); + m_printDialog.SetToPage(std::min(m_printDialog.GetToPage(), CollatePages(printerDC))); + m_printDialog.SetFromPage(std::min(m_printDialog.GetFromPage(), m_printDialog.GetToPage())); + + // Calculate the pages to print. + std::vector pages = SetPagesToPrint(printerDC); + + // Find the first and last characters. + LONG firstChar = 0; + LONG lastChar = GetTextLengthEx(GTL_NUMCHARS); + if (m_printDialog.IsPrintSelection()) + { + LONG first = 0; + LONG last = 0; + GetSel(first, last); + if (first != last) // Is anything selected? + { + firstChar = first; + lastChar = last; + } + } + + // Assign values to the FORMATRANGE struct + FORMATRANGE fr{}; + fr.hdc = printerDC; + fr.hdcTarget = printerDC; + fr.rcPage = GetPageRect(printerDC); + fr.rc = GetPrintRect(printerDC); + fr.chrg.cpMin = firstChar; + fr.chrg.cpMax = lastChar; + + // Start print job. + DOCINFO di{}; + di.cbSize = sizeof(DOCINFO); + di.lpszDocName = docName; + di.lpszOutput = nullptr; // Do not print to file. + printerDC.StartDoc(&di); + + for (int i : pages) + { + // Start the page. + printerDC.StartPage(); + + // Print the page. + PrintPage(printerDC, i - 1); + + // End the page. + printerDC.EndPage(); + } + + // End the print job + printerDC.EndDoc(); + } +} + +// Returns a CRect of the entire printable area. Units are measured in twips. +CRect CRichView::GetPageRect(const CDC& dc) +{ + CRect rcPage; + + // Get the printer page specifications + int horizRes = dc.GetDeviceCaps(HORZRES); // in pixels + int vertRes = dc.GetDeviceCaps(VERTRES); // in pixels + int logPixelsX = dc.GetDeviceCaps(LOGPIXELSX); // in pixels per logical inch + int logPixelsY = dc.GetDeviceCaps(LOGPIXELSY); // in pixels per logical inch + + int tpi = 1440; // twips per inch + + rcPage.right = (horizRes / logPixelsX) * tpi; + rcPage.bottom = (vertRes / logPixelsY) * tpi; + + return rcPage; +} + +// Returns the print area within the page. Units are measured in twips. +CRect CRichView::GetPrintRect(const CDC& dc) +{ + CRect rcPage = GetPageRect(dc); + CRect rcPrintArea; + + // Scale the margins. + int dpiX = dc.GetDeviceCaps(LOGPIXELSX); + int dpiY = dc.GetDeviceCaps(LOGPIXELSY); + + if (!rcPage.IsRectEmpty()) + { + rcPrintArea.left = rcPage.left + dpiX / 3; + rcPrintArea.top = rcPage.top + dpiY / 3; + rcPrintArea.right = rcPage.right - dpiX / 3; + rcPrintArea.bottom = rcPage.bottom - dpiY / 3; + } + + return rcPrintArea; +} + +// Called when the window handle (HWND) is attached to CRichView. +void CRichView::OnAttach() +{ + // Increase the text limit of the rich edit window. + LimitText(-1); + + // Determine which messages will be passed to the parent. + DWORD mask = ENM_KEYEVENTS | ENM_DROPFILES; + SetEventMask(mask); + + // Advises the control to be per-monitor DPI aware. + // This affects the initial font size on a second monitor with different DPI. + SendMessage(WM_DPICHANGED_BEFOREPARENT); + + SetFontDefaults(); +} + +// Sets the CREATESTRUCT parameters before the window is created. +void CRichView::PreCreate(CREATESTRUCT& cs) +{ + cs.style = ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE | WS_CHILD | + WS_CLIPCHILDREN | WS_HSCROLL | WS_VISIBLE | WS_VSCROLL; + + cs.dwExStyle = WS_EX_CLIENTEDGE | WS_EX_ACCEPTFILES; +} + +// Prints the specified page to specified dc. +// Called by CPrintPreview, and also used for printing. +void CRichView::PrintPage(CDC& dc, int page) +{ + CDC printerDC = m_printDialog.GetPrinterDC(); + + // Find the first character. + LONG firstChar = 0; + if (m_printDialog.IsPrintSelection()) + { + // Check if something is selected. + LONG first = 0; + LONG last = 0; + GetSel(first, last); + if (first != last) // Is anything selected? + { + firstChar = first; + } + } + + // Assign values to the FORMATRANGE struct + FORMATRANGE fr{}; + fr.hdcTarget = printerDC; + fr.hdc = dc; + fr.rcPage = GetPageRect(printerDC); + fr.rc = GetPrintRect(printerDC); + fr.chrg.cpMin = (page > 0) ? m_pageBreaks[page - 1] : firstChar; + fr.chrg.cpMax = m_pageBreaks[page]; + + // Display text from the richedit control on the memory dc. + FormatRange(fr, TRUE); + DisplayBand(GetPrintRect(printerDC)); + + // Tell the control to release the cached information. + FormatRange(); +} + +// Print the entire document without bringing up a print dialog. +// docName - specifies the document name for the print job. +void CRichView::QuickPrint(LPCWSTR docName) +{ + // Default to printing entire document, 1 copy. + SetDefaultPrintOptions(); + + // Acquire the currently selected printer's device context. + CDC printerDC = m_printDialog.GetPrinterDC(); + + // Start print job. + DOCINFO di{}; + di.cbSize = sizeof(DOCINFO); + di.lpszDocName = docName; + di.lpszOutput = nullptr; // Do not print to file. + printerDC.StartDoc(&di); + + int maxPages = CollatePages(printerDC); + + for (int page = 0; page < maxPages; ++page) + { + // Start the page. + printerDC.StartPage(); + + // Print the page. + PrintPage(printerDC, page); + + // End the page. + printerDC.EndPage(); + } + + // End the print job. + printerDC.EndDoc(); +} + +// Sets the initial font for the document. +void CRichView::SetFontDefaults() +{ + // Set font to Courier New, size 10. + CHARFORMAT cf{}; + cf.cbSize = sizeof(cf); + cf.dwMask = CFM_SIZE | CFM_FACE | CFM_EFFECTS; + StrCopy(cf.szFaceName, L"Courier New", LF_FACESIZE); + cf.yHeight = 204; + SetDefaultCharFormat(cf); + + // Prevent Unicode characters from changing the font. + LRESULT result = SendMessage(EM_GETLANGOPTIONS, 0, 0); + result &= ~IMF_AUTOFONT; + SendMessage(EM_SETLANGOPTIONS, 0, result); +} + +std::vector CRichView::SetPagesToPrint(const CDC& printerDC) +{ + std::vector pages; // Vector of pages to print. + + BOOL isPages = m_printDialog.IsPrintRange(); // Pages radio button selected. + BOOL isCollated = m_printDialog.IsCollate(); // Collated button selected. + int copies = m_printDialog.GetCopies(); + int maxPage = CollatePages(printerDC); + int minPage = 1; + + if (isPages) + { + // Loop for multiple copies, collated. + for (int count1 = 0; count1 < copies; count1++) + { + int fromPage = m_printDialog.GetFromPage(); + int toPage = m_printDialog.GetToPage(); + if (fromPage <= toPage) + { + fromPage = std::max(minPage, fromPage); + toPage = std::min(maxPage, toPage); + + // Loop for multiple pages. + for (int j = fromPage; j <= toPage; j++) + { + // Loop for multiple copies, not collated. + for (int count2 = 0; count2 < copies; count2++) + { + pages.push_back(j); + if (isCollated) break; // break out of loop if collated. + } + } + } + else + { + fromPage = std::min(maxPage, fromPage); + toPage = std::max(minPage, toPage); + + // Loop for multiple pages in reverse order. + for (int j = fromPage; j >= toPage; j--) + { + // For multiple copies, not collated. + for (int count2 = 0; count2 < copies; count2++) + { + pages.push_back(j); + if (isCollated) break; // break out of loop if collated. + } + } + } + + if (!isCollated) break; // break out of loop if not collated. + } + } + else + { + // Print the entire or selected document, multiple copies. + for (int count1 = 0; count1 < copies; count1++) + { + // For multiple copies, collated. + for (int i = minPage; i <= maxPage; i++) + { + // For multiple copies, not collated. + for (int count2 = 0; count2 < copies; count2++) + { + pages.push_back(i); + if (isCollated) break; + } + } + + if (!isCollated) break; + } + } + + return pages; +} + +// Sets the initial dialog options. +void CRichView::SetDefaultPrintOptions() +{ + m_printDialog.SetRadio(0); // Set print range to All pages + m_printDialog.SetCopies(1); + m_printDialog.SetFromPage(1); + CDC printerDC = m_printDialog.GetPrinterDC(); + int maxPage = CollatePages(printerDC); + m_printDialog.SetMaxPage(maxPage); + m_printDialog.SetToPage(maxPage); + m_printDialog.SetCollate(1); // Tick the collate button +} + +LRESULT CRichView::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case UWM_SETDEFAULTOPTIONS: + { + SetDefaultPrintOptions(); + } + break; + } + + return WndProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/RichView.h b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/RichView.h new file mode 100644 index 00000000..326db9a5 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/RichView.h @@ -0,0 +1,43 @@ +///////////////////////////// +// RichView.h +// + +#ifndef RICHVIEW_H +#define RICHVIEW_H + + +#include "CustomPrintDlg.h" + + +//////////////////////////////////////////////////// +// CRichView manages a rich edit control. It is used +// as the view window for CMainFrame. +class CRichView : public CRichEdit +{ +public: + CRichView() = default; + virtual ~CRichView() = default; + int CollatePages(const CDC& printerDC); + void DoPrint(LPCWSTR docName); + void PrintPage(CDC& dc, int page); + void QuickPrint(LPCWSTR docName); + void SetDefaultPrintOptions(); + void SetFontDefaults(); + std::vector SetPagesToPrint(const CDC& printerDC); + +protected: + virtual void OnAttach() override; + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual LRESULT WndProc(UINT, WPARAM, LPARAM) override; + +private: + CRichView(const CRichView&) = delete; + CRichView& operator=(const CRichView&) = delete; + + CRect GetPageRect(const CDC& dc); + CRect GetPrintRect(const CDC& dc); + std::vector m_pageBreaks; + CCustomPrintDlg m_printDialog; +}; + +#endif // RICHVIEW_H diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/StdAfx.cpp b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/StdAfx.cpp new file mode 100644 index 00000000..8957144d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/StdAfx.cpp @@ -0,0 +1,16 @@ +///////////////////////////// +// StdAfx.cpp +// + +// This file is used for precompiled hearders. Precompiled headers allow +// programs to be recompiled more quickly + +// To use precompiled headers, do the following: +// 1) Add the set of rarely changed headers to stdafx.h +// 2) Include stdafx.h in each cpp file. It must be included first. +// 3) Add stdafx.cpp to your project. +// 4) Turn on precompiled hearders in the project + + +#include "stdafx.h" + diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/TextApp.cpp b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/TextApp.cpp new file mode 100644 index 00000000..b9957a9b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/TextApp.cpp @@ -0,0 +1,29 @@ +///////////////////////////// +// TextApp.cpp +// + +#include "stdafx.h" +#include "TextApp.h" +#include "resource.h" + +//////////////////////////////// +// CTextApp function definitions +// + +// Called when the application starts. +BOOL CTextApp::InitInstance() +{ + // Create the frame window. + m_frame.Create(); // throws a CWinException on failure + + return TRUE; +} + +// Called when the message queue is empty. +BOOL CTextApp::OnIdle(LONG) +{ + m_frame.UpdateToolbar(); + + return FALSE; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/TextApp.h b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/TextApp.h new file mode 100644 index 00000000..7dfe1de3 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/TextApp.h @@ -0,0 +1,33 @@ +///////////////////////////// +// TextApp.h +// + +#ifndef TEXTAPP_H +#define TEXTAPP_H + +#include "Mainfrm.h" + + +/////////////////////////////////////////////////////////////// +// CTextApp manages the application. It initializes the Win32++ +// framework when it is constructed, and creates the main frame +// window when it runs. +class CTextApp : public CWinApp +{ +public: + CTextApp() = default; + virtual ~CTextApp() override = default; + +protected: + virtual BOOL InitInstance() override; + virtual BOOL OnIdle(LONG count) override; + +private: + CTextApp(const CTextApp&) = delete; + CTextApp& operator=(const CTextApp&) = delete; + + CMainFrame m_frame; +}; + + +#endif // define TEXTAPP_H diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/UserMessages.h b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/UserMessages.h new file mode 100644 index 00000000..f49be248 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/UserMessages.h @@ -0,0 +1,13 @@ +///////////////////////////// +// UserMessages.h +// + +#ifndef _USER_MESSAGES_H_ +#define _USER_MESSAGES_H_ + + +// User defined messages used in this application. +#define UWM_SETDEFAULTOPTIONS (WM_APP + 0x0001) + + +#endif // _USER_MESSAGES_H_ diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/main.cpp b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/main.cpp new file mode 100644 index 00000000..bab18272 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/main.cpp @@ -0,0 +1,41 @@ +///////////////////////////// +// main.cpp +// + +#include "stdafx.h" +#include "TextApp.h" + +int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPWSTR, _In_ int) +{ + try + { + // Start Win32++. + CTextApp theApp; + + // Run the application. + return theApp.Run(); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return -1; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/res/Notepad.ico b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/res/Notepad.ico new file mode 100644 index 00000000..8bc6165d Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/res/Notepad.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/res/PerMonitorV2.manifest b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/res/PerMonitorV2.manifest new file mode 100644 index 00000000..d303e5c0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/res/PerMonitorV2.manifest @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + PerMonitorV2, PerMonitor + + + + + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/res/Toolbar16.bmp b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/res/Toolbar16.bmp new file mode 100644 index 00000000..18994ee4 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/res/Toolbar16.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/res/Toolbar24.bmp b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/res/Toolbar24.bmp new file mode 100644 index 00000000..9e43b478 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/res/Toolbar24.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/resource.h b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/resource.h new file mode 100644 index 00000000..9e47ab6f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/resource.h @@ -0,0 +1,74 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Resource.rc +// + +// include the Resource IDs defined by Win32++ +#include "default_resource.h" + +//Resource IDs for menu items and ToolBar items +#define IDM_FILE_NEW_PLAIN 121 +#define IDM_FILE_NEW_RICH 122 +#define IDM_FILE_OPEN 123 +#define IDM_FILE_SAVE 124 +#define IDM_FILE_SAVEAS 125 +#define IDM_FILE_PREVIEW 126 +#define IDM_FILE_PRINTNOW 127 +#define IDM_FILE_PRINT 128 +#define IDM_FILE_PRINTSETUP 129 +#define IDM_FILE_CLOSE 130 +#define IDM_FILE_EXIT 131 +#define IDM_EDIT_UNDO 134 +#define IDM_EDIT_REDO 135 +#define IDM_EDIT_CUT 136 +#define IDM_EDIT_COPY 137 +#define IDM_EDIT_PASTE 138 +#define IDM_EDIT_DELETE 139 +#define IDM_OPTIONS_FONT 140 +#define IDM_OPTIONS_WRAP 141 +#define IDM_ENC_ANSI 150 +#define IDM_ENC_UTF8 151 +#define IDM_ENC_UTF16 152 +#define IDM_HELP_ABOUT 160 + +#define IDW_INDICATOR_INS 170 +#define IDW_INDICATOR_OVR 171 +#define IDW_INDICATOR_PLAIN 172 +#define IDW_INDICATOR_RICH 173 +#define IDW_MENUICONS 180 +#define IDD_PRINTDLG 200 +#define IDC_COMBOBOX 201 +#define IDB_PRINTPROPERTIES 202 +#define IDS_STATUS 203 +#define IDS_TYPE 204 +#define IDS_WHERE 205 +#define IDS_COMMENT 206 +#define IDS_FROM 207 +#define IDS_TO 208 +#define IDB_RADIOALL 209 +#define IDB_RADIORANGE 210 +#define IDB_RADIOSELECTION 211 +#define IDS_COPIES 212 +#define IDB_COLLATE 213 +#define IDB_HELP 214 +#define IDB_PRINTTOFILE 215 + +#define IDC_GROUPBOX1 216 +#define IDC_GROUPBOX2 217 +#define IDC_GROUPBOX3 218 + +#define IDC_STATIC1 220 +#define IDC_STATIC2 221 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 130 +#endif +#endif + diff --git a/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/stdafx.h b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/stdafx.h new file mode 100644 index 00000000..08450116 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/CustomPrintDlg/src/stdafx.h @@ -0,0 +1,90 @@ +///////////////////////////// +// StdAfx.h +// + +// This file is used for precompiled headers. +// Rarely modified header files should be included. +// Based on code provided by Lynn Allan. + + +#ifndef STDAFX_H +#define STDAFX_H + + +// Predefinitions for windows.h go here +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +// Specify Win32xx specific predefinitions here +//#define NO_USING_NAMESPACE // Don't use Win32xx namespace + +// Rarely modified header files should be included here +#include // Add support for std::vector +#include // Add support for std::map +#include // Add support for std::string +#include // Add support for stringstream +#include // Add support for the assert macro +#include // Add support for C style printf, sprintf, etc. +#include // Add support for C style character conversions atoi etc. +#include // Add support for C style TCHARs. + +// Add the Win32++ library +#include // Add CWinApp +#include // Add CArchive +#include // Add CAnimation, CComboBox, CComboBoxEx, CDateTime, CHeader, CHotKey, CIPAddress, CProgressBar, CSpinButton, CScrollBar, CSlider, CToolTip +#include // Add CCriticalSection, CThreadLock +#include // Add CString, CStringA, CStringW +#include // Add CDataExchange +#include // Add CDialog, CResizer +#include // Add CDockFrame, CMDIDockFrame +#include // Add CDocker, CDockContainer +#include // Add CException, CFileException, CNotSupportedException, CResourceException, CUserException, CWinException +#include // Add CFile +#include // Add CFileFind +#include // Add CFolderDialog +#include // Add CFrame +#include // Add CDC, CGDIObject, CBitmap, CBrush, CFont, CPalatte, CPen, CRgn +#include // Add CHGlobal +#include // Add CImageList +#include // Add CListView +#include // Add CMDIChild, CMDIFrame, CDockMDIFrame +#include // Add CMenu +#include // Add CMenuBar +#include // Add CMetaFile, CEnhMetaFile +#include // Add CEvent, CMutex, CSemaphore +#include // Add CPropertyPage, CPropertySheet +#include // Add CRebar +#include // Add CPoint, CRect, CSize +#include // Add CRegKey +#include // Add CRichEdit +#include // Add CScrollView +#include // Adds macros, windows header files, and CObject +#include // Add CSocket +#include // Add CStatusBar +#include // Add CButton, CEdit, CListBox +#include // Add CTab, CTabbedMDI +#include // Add AtoT, AtoW, TtoA, TtoW, WtoA, WtoT etc. +#include // Add MenuTheme, ReBarTheme, StatusBarTheme, ToolBarTheme +#include // Add CWinThread +#include // Add CTime +#include // Add CToolBar +#include // Add CTreeView +#include // Add CWebBrowser, CAXHost +#include // Add CWnd + +// WIN32_LEAN_AND_MEAN can't be used with these +#ifndef WIN32_LEAN_AND_MEAN + #include // Add CCommonDialog, CColorDialog, CFileDialog, CFindReplace, CFontDialog + #include // Add CFolderDialogEx + #include // Add CPrintPreview + #include // Add CPageSetupDialog, CPrintDialog + #include // Add CPrintDialogEx + #include // Add CTaskDialog + + // Visual Studio + #if defined (_MSC_VER) + #include // Add CRibbon, CRibbonFrame + #endif + +#endif // define WIN32_LEAN_AND_MEAN + +#endif // define STDAFX_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo.cbp b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo.cbp new file mode 100644 index 00000000..48f820e4 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo.cbp @@ -0,0 +1,150 @@ + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo.cbproj b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo.cbproj new file mode 100644 index 00000000..f7c632f0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo.cbproj @@ -0,0 +1,1543 @@ + + + {39461456-1040-43CB-9B40-5962EF847BB0} + 20.1 + None + True + Release + Win64x + 1048579 + Application + DDXDemo + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + JPHNE + .\Embarcadero\$(Platform)\$(Config) + .\Embarcadero\$(Platform)\$(Config) + false + true + true + $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + CppGuiApplication + System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + true + <_TCHARMapping>wchar_t + DDXDemo + ..\..\..\include\;..\src\;$(IncludePath) + ..\..\..\include\;..\src\;$(ILINK_LibraryPath) + 3081 + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + $(BDSINCLUDE)\windows\sdk;$(BRCC_IncludePath) + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + ..\src\stdafx.h + none + + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + false + true + false + true + _DEBUG;$(Defines) + false + None + DEBUG + true + true + true + true + Full + true + true + true + true + true + $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) + $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + + + PerMonitorV2 + false + $(BDSLIB)\$(PLATFORM)$(CC_SUFFIX)\debug;$(ILINK_LibraryPath) + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + <_TCHARMapping>wchar_t + + + PerMonitorV2 + true + 1033 + + + NDEBUG;$(Defines) + None + + + PerMonitorV2 + false + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 69 + + + 70 + + + 0 + + + 1 + + + 2 + + + 3 + + + 4 + + + 5 + + + 6 + + + 7 + + + 8 + + + 9 + + + 10 + + +
Resource.res
+ 11 +
+ + 12 + + + 13 + true + + + 15 + + + 16 + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + +
+ + CPlusPlusBuilder.Personality.12 + CppGuiApplication + + + + False + True + True + False + + + Embarcadero C++Builder Office 2000 Servers Package + Embarcadero C++Builder Office XP Servers Package + + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + Assets\ + Logo150x150.png + true + + + + + Assets\ + Logo44x44.png + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + DDXDemo.exe + true + + + + + DDXDemo.exe + true + + + + + NewProject.exe + true + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 64 + + + classes + 64 + + + + + res\xml + 1 + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\mips + 1 + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-v21 + 1 + + + res\values-v21 + 1 + + + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + Contents + 1 + + + Contents + 1 + + + Contents + 1 + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + library\lib\armeabi-v7a + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen + 64 + + + ..\$(PROJECTNAME).launchscreen + 64 + + + + + 1 + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + + + + + + + + + + + + + True + True + True + + + 12 + + + + +
diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2015.sln b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2015.sln new file mode 100644 index 00000000..1b16472d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2015.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DDXDemo", "DDXDemo_2015.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2015.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2015.vcxproj new file mode 100644 index 00000000..c0277793 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2015.vcxproj @@ -0,0 +1,255 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DDXDemo + DDXDemo + + + + Application + Unicode + v140_xp + + + Application + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + + + + + + + + + + + + + + + + + true + false + + + true + false + + + false + false + + + false + false + + + + Use + Level4 + true + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2015.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2015.vcxproj.filters new file mode 100644 index 00000000..4b519c21 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2015.vcxproj.filters @@ -0,0 +1,239 @@ + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + + + {d9a16de6-37e5-48be-b476-76a20843fa1c} + + + {fca2ddec-62b5-40e1-bd4e-7a02bfa7e539} + + + {544eb3f5-971e-4d92-83af-4d38df111efb} + + + {9430e960-e608-4729-a060-87873b194481} + + + + + Resource Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2019.sln b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2019.sln new file mode 100644 index 00000000..ecde5312 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2019.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DDXDemo", "DDXDemo_2019.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {92BB3DF7-F9AE-45DF-A159-403E0B32BB59} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2019.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2019.vcxproj new file mode 100644 index 00000000..225a52b1 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2019.vcxproj @@ -0,0 +1,234 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DDXDemo + DDXDemo + + + + v142 + Unicode + + + v142 + Unicode + + + v142 + Unicode + + + v142 + Unicode + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2019.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2019.vcxproj.filters new file mode 100644 index 00000000..e47a5ffe --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2019.vcxproj.filters @@ -0,0 +1,239 @@ + + + + + {e0625690-cae4-4b2d-8a2f-312328bb12b5} + + + {1ea5c1f2-dcc9-4eff-b739-65e11d7866aa} + + + {997fb7e9-d6db-4800-aa1d-54eb167450be} + + + {9eb4a31a-1e8b-44a8-83a3-55ddc5e5214f} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2022.sln b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2022.sln new file mode 100644 index 00000000..6b69fc4f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2022.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DDXDemo", "DDXDemo_2022.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {75AF8A2F-1847-4A7F-9ABF-940DA47C28B0} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2022.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2022.vcxproj new file mode 100644 index 00000000..6206b87f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2022.vcxproj @@ -0,0 +1,245 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DDXDemo + DDXDemo + 10.0 + + + + v143 + Unicode + + + v143 + Unicode + + + v143 + Unicode + + + v143 + Unicode + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2022.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2022.vcxproj.filters new file mode 100644 index 00000000..e47a5ffe --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2022.vcxproj.filters @@ -0,0 +1,239 @@ + + + + + {e0625690-cae4-4b2d-8a2f-312328bb12b5} + + + {1ea5c1f2-dcc9-4eff-b739-65e11d7866aa} + + + {997fb7e9-d6db-4800-aa1d-54eb167450be} + + + {9eb4a31a-1e8b-44a8-83a3-55ddc5e5214f} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2026.slnx b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2026.slnx new file mode 100644 index 00000000..1fa6bfe6 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2026.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2026.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2026.vcxproj new file mode 100644 index 00000000..3f927f6c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2026.vcxproj @@ -0,0 +1,245 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DDXDemo + DDXDemo + 10.0 + + + + v145 + Unicode + + + v145 + Unicode + + + v145 + Unicode + + + v145 + Unicode + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2026.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2026.vcxproj.filters new file mode 100644 index 00000000..53edf1ef --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_2026.vcxproj.filters @@ -0,0 +1,239 @@ + + + + + {e0625690-cae4-4b2d-8a2f-312328bb12b5} + + + {1ea5c1f2-dcc9-4eff-b739-65e11d7866aa} + + + {997fb7e9-d6db-4800-aa1d-54eb167450be} + + + {9eb4a31a-1e8b-44a8-83a3-55ddc5e5214f} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_DEBUG.dev b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_DEBUG.dev new file mode 100644 index 00000000..97f352c3 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_DEBUG.dev @@ -0,0 +1,292 @@ +[Project] +FileName=DDXDemo_DEBUG.dev +Name=DDXDemo +UnitCount=17 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=DDXDemo_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D _DEBUG_@@_-g_@@_-DUNICODE_@@_-D_UNICODE_@@__@@__@@__@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Debug +ObjectOutput=.\Dev-C++\Debug +OverrideOutput=1 +OverrideOutputName=DDXDemo.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=4 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit1] +FileName=..\src\Mainfrm.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\Mainfrm.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\Resource.rc +CompileCpp=1 +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\App.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit8] +FileName=..\src\App.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit11] +FileName=..\src\Doc.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit12] +FileName=..\src\Doc.h +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit13] +FileName=..\src\MyScrollbar.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit14] +FileName=..\src\MyScrollbar.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\MyButton.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit10] +FileName=..\src\MyButton.h +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit15] +FileName=..\src\View.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit16] +FileName=..\src\View.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit17] +FileName=..\src\AboutDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit18] +FileName=..\src\MyScrollbar.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit19] +FileName=..\src\MyScrollbar.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit20] +FileName=..\src\MySlider.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit21] +FileName=..\src\MySlider.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit22] +FileName=..\src\View.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit23] +FileName=..\src\View.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit24] +FileName=..\src\wxx_DDXDialog.h +CompileCpp=1 +Folder=Win32++ +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_RELEASE.dev b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_RELEASE.dev new file mode 100644 index 00000000..7adc7a84 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/ProjectFiles/DDXDemo_RELEASE.dev @@ -0,0 +1,292 @@ +[Project] +FileName=DDXDemo_RELEASE.dev +Name=DDXDemo +UnitCount=17 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=DDXDemo_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D NDEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@__@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-s_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Release +ObjectOutput=.\Dev-C++\Release +OverrideOutput=1 +OverrideOutputName=DDXDemo.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=4 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit1] +FileName=..\src\Mainfrm.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\Mainfrm.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\Resource.rc +CompileCpp=1 +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\App.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit8] +FileName=..\src\App.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\Doc.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit10] +FileName=..\src\Doc.h +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit11] +FileName=..\src\View.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit12] +FileName=..\src\View.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit13] +FileName=..\src\MyButton.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit14] +FileName=..\src\MyButton.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit15] +FileName=..\src\MyScrollbar.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit16] +FileName=..\src\MyScrollbar.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit17] +FileName=..\src\AboutDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit18] +FileName=..\src\MyMonthCalendar.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit19] +FileName=..\src\MyMonthCalendar.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit20] +FileName=..\src\MyScrollbar.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit21] +FileName=..\src\MyScrollbar.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit22] +FileName=..\src\MySlider.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit23] +FileName=..\src\MySlider.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit24] +FileName=..\src\wxx_DDXDialog.h +CompileCpp=1 +Folder=Win32++ +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/Readme.txt new file mode 100644 index 00000000..6e7b2520 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/Readme.txt @@ -0,0 +1,30 @@ +DDXDemo Example +=============== +This sample program has a frame window which includes a menu bar, toolbar +and status bar, in which a modeless dialog is used as the client window of +the frame. It was adapted from the FormDocView sample program in the Win32++ +release. + +The project architecture is of the App-Frame-Doc-View form, an approach used +in of these sample programs. Frame and view data that are to persist between +executions, as well as the data comprising the document, are stored in the +system registry, + +Features demonstrated in this example +===================================== +* App-Frame-Doc-View program architecture. +* Use of a modeless dialog derived from CDialog as the view window +* Use of the CRegKey class to store and retrieve persistent data in the + system registry. +* Use of Dialog Data Exchange (DDX) and Validation (DDV) classes to create + an interactive application programming interface to dialog boxes and the + view class accessing or depositing data in those controls. These are + consistent with similar capabilities in the Microsoft Foundation Classes. +* A resizable form for the display, with a resizing gripper tool at the + end of the status bar. +* Programmer-selectable menu, tool bar, and status bar themes, as well as + selectable foreground and background colors of the dialog controls and + client area. +* Tool tips that appear when the mouse hovers over tool bar, dialog controls, + and the dialog client area +* Use of a rich edit control on the form derived from the CRichEdit class. diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/AboutDialog.h b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/AboutDialog.h new file mode 100644 index 00000000..71e4364d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/AboutDialog.h @@ -0,0 +1,31 @@ +///////////////////////////////////////////// +// AboutDialog.h + +#ifndef _ABOUTDIALOG_H_ +#define _ABOUTDIALOG_H_ + +#include "resource.h" + +//////////////////////////////////////////////////////// +// CAboutDialog manages the dialog which displays +// information about this program. +class CAboutDialog : public CDialog +{ +public: + CAboutDialog() : CDialog(IDW_ABOUT) {} + virtual BOOL OnInitDialog() override + { + // Set the Win32++ version string. + UINT ver = _WIN32XX_VER; + CString Win32xxVersion; + Win32xxVersion << "Win32++ Version " << ver / 0x100 << "." << + (ver % 0x100) / 0x10 << "." << (ver % 0x10); + + SetDlgItemText(IDC_STATIC1, Win32xxVersion); + SetDlgItemText(IDC_STATIC2, L"by David Nash"); + + return TRUE; + } +}; + +#endif // _ABOUTDIALOG_H_ diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/App.cpp b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/App.cpp new file mode 100644 index 00000000..3f96856f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/App.cpp @@ -0,0 +1,91 @@ +/* (20-Oct-2024) [Tab/Indent: 8/8][Line/Box: 80/74] (App.cpp) * +******************************************************************************** +| | +| Author: Robert C. Tausworthe, 2020 | +| | +===============================================================================* + + Contents Description: The DDXDemo CApp class implementation. This class + governs the overall actions of the DDX/DDV Demonstration program. This + class is a modified version of that found in the FormDocView sample + distributed with the Win32++ Windows interface classes. The modified sample + program was based on code provided by Lynn Allan. This demo extends the + given sample by application of Dialog Data Exchange and Validation (DDX/DDV). + + Programming Notes: The programming style roughly follows that established + by the 1995-1999 Jet Propulsion Laboratory Deep Space Network Planning and + Preparation Subsystem project for C++ programming. + + Acknowledgement: The author would like to thank and acknowledge the advice, + critical review, insight, and assistance provided by David Nash in the + development of this work. + +*******************************************************************************/ + +#include "stdafx.h" +#include "App.h" + +/****************************************************************************** + + The WINAPI entry point for a graphical Windows-based application. + +*============================================================================*/ + + int WINAPI +wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPWSTR, _In_ int) /* + + This function is called by the system as the initial entry point for + a WinApi-based application. None of the passed parameters are used by + this application, and are thus not named in the calling sequence above + in order to suppress compiler messages. +*-----------------------------------------------------------------------------*/ +{ + try + { + // declare the application object + CApp theApp; + + // run the application + return theApp.Run(); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return -1; +} + +/******************************************************************************* + + CApp Methods + +*============================================================================*/ + BOOL CApp:: +InitInstance() /* + + Called by theApp.Run() execution in WinMain to create the application + frame, which controls the program. +*-----------------------------------------------------------------------------*/ +{ + // Create the Frame Window + m_frame.Create(); // throws a CWinException on failure + return TRUE; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/App.h b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/App.h new file mode 100644 index 00000000..f8280076 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/App.h @@ -0,0 +1,52 @@ +/* (20-Oct-2024) [Tab/Indent: 8/8][Line/Box: 80/74] (App.h) * +******************************************************************************** +| | +| Author: Robert C. Tausworthe, 2020 | +| | +===============================================================================* + + Contents Description: The DDXDemo CApp class declaration. This class + governs the overall actions of the DDX/DDV Demonstration program. + This class is a modified version of that found in the FormDocView sample + distributed with the Win32++ Windows interface classes. The modified sample + program was based on code provided by Lynn Allan. This demo extends the + given sample by application of Dialog Data Exchange and Validation (DDX/DDV). + + Programming Notes: The programming style roughly follows that established + by the 1995-1999 Jet Propulsion Laboratory Deep Space Network Planning and + Preparation Subsystem project for C++ programming. + + Acknowledgement: The author would like to thank and acknowledge the advice, + critical review, insight, and assistance provided by David Nash in the + development of this work. + +*******************************************************************************/ + +#ifndef SDI_APP_H +#define SDI_APP_H + +#include "Mainfrm.h" + +/*============================================================================*/ + class +CApp : public CWinApp /* + + Declaration of the CApp class of the App-Frame-Doc-View architecture. +*-----------------------------------------------------------------------------*/ +{ + public: + CApp() = default; + virtual ~CApp() override = default; + + protected: + virtual BOOL InitInstance() override; + + private: + CApp(const CApp&) = delete; + CApp& operator=(const CApp&) = delete; + + CMainFrame m_frame; +}; +/*----------------------------------------------------------------------------*/ +#endif // define SDI_APP_H + diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/Doc.cpp b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/Doc.cpp new file mode 100644 index 00000000..37b4e3e8 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/Doc.cpp @@ -0,0 +1,213 @@ +/* (20-Oct-2024) [Tab/Indent: 8/8][Line/Box: 80/74] (Doc.cpp) * +******************************************************************************** +| | +| Author: Robert C. Tausworthe, 2020 | +| | +===============================================================================* + + Contents Description: The DDXDemo CDoc class implementation. This class + interfaces the document, held in the registry, with the remainder of the + DDX/DDV Demonstration program. This class is a modified version of that + found in the FormDocView sample distributed with the Win32++ Windows + interface classes. The modified sample program was based on code provided + by Lynn Allan. This demo extends the given sample by application of + Dialog Data Exchange and Validation (DDX/DDV). + + Programming Notes: The programming style roughly follows that established + by the 1995-1999 Jet Propulsion Laboratory Deep Space Network Planning and + Preparation Subsystem project for C++ programming. + + Acknowledgement: The author would like to thank and acknowledge the advice, + critical review, insight, and assistance provided by David Nash in the + development of this work. + +*******************************************************************************/ + +#include "stdafx.h" +#include "Doc.h" + +/*============================================================================*/ + CDoc:: +CDoc() /* + + Construct the basic document object. +*-----------------------------------------------------------------------------*/ +{ + //Initialize the values of ALL controls using DDX/DDV. These are + // overwritten by saved values from the registry after initial + // startup, but it is important to have valid values for the + // initial startup. + m_byteVal = 10; + m_shortVal = 0; + m_intVal = 0; + m_UINTVal = 10; + m_longVal = 0L; + m_ULongVal = 10; + m_floatVal = 0.0; + m_doubleVal = 0.0; + m_LPWSTRVal[0] = L'\0'; + m_checkVal[0] = FALSE; + m_checkVal[1] = FALSE; + m_checkVal[2] = FALSE; + m_radioA = 0; + m_listBoxIndx = 0; + m_comboBoxIndx = 0; + m_sliderVal = 0; + CTime t = CTime::GetCurrentTime(); + t.GetAsSystemTime(m_dateSysTime); + m_calDateSysTime = m_dateSysTime; +} + +/*============================================================================*/ + void CDoc:: +LoadDocRegistry(LPCWSTR keyName) /* + + Load the saved document value parameters from the registry from the + 'HKEY_CURRENT_USER\Software\keyName\Document Settings' key. +*-----------------------------------------------------------------------------*/ +{ + CRegKey key; + CString strKey; + strKey << L"Software\\" << keyName << L"\\Document Settings"; + if (ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, strKey, KEY_READ)) + { + m_byteVal = static_cast(RegQueryDWORDValue(key, L"Byte1")); + m_shortVal = static_cast(RegQueryDWORDValue(key, L"Short1")); + m_intVal = RegQueryDWORDValue(key, L"Int1"); + m_UINTVal = RegQueryDWORDValue(key, L"UINT1"); + m_longVal = RegQueryDWORDValue(key, L"Long1"); + m_ULongVal = RegQueryDWORDValue(key, L"ULong1"); + CString s = RegQueryStringValue(key, L"Float1"); + LPWSTR p; + m_floatVal = static_cast(_tcstod(s.c_str(), &p)); + s = RegQueryStringValue(key, L"Double1"); + m_doubleVal = _tcstod(s, &p); + s = RegQueryStringValue(key, L"LPWSTR1"); + StrCopy(m_LPWSTRVal, s.c_str(), 256); + m_checkVal[0] = RegQueryBOOLValue(key, L"CheckA"); + m_checkVal[1] = RegQueryBOOLValue(key, L"CheckB"); + m_checkVal[2] = RegQueryBOOLValue(key, L"CheckC"); + m_radioA = RegQueryDWORDValue(key, L"Radio"); + m_editVal = RegQueryStringValue(key, L"Edit1"); + m_richEditVal = RegQueryStringValue(key, L"RichEdit1"); + m_listBoxVal = RegQueryStringValue(key, L"ListBox1"); + m_listBoxIndx = RegQueryDWORDValue(key, L"ListBox1x"); + m_comboBoxVal = RegQueryStringValue(key, L"ComboBox1"); + m_comboBoxIndx = RegQueryDWORDValue(key, L"ComboBox1x"); + m_sliderVal = RegQueryDWORDValue(key, L"Slider1"); + m_dateSysTime = RegQuerySYSTEMTIMEValue(key, L"MyDateTime"); + m_calDateSysTime = RegQuerySYSTEMTIMEValue(key, L"MoCalendar1"); + } +} + +/*============================================================================*/ + BOOL CDoc:: +RegQueryBOOLValue(CRegKey& key, LPCWSTR pName) /* + + Return the BOOL value of a specified value pName found in the + currently open registry key. Here, the boolean value is stored in a + DWORD slot, rather than a bool-sized slot. +*-----------------------------------------------------------------------------*/ +{ + return RegQueryDWORDValue(key, pName) & 1; +} + +/*============================================================================*/ + DWORD CDoc:: +RegQueryDWORDValue(CRegKey& key, LPCWSTR pName) /* + + Return the DWORD value of a specified value pName found in the + currently open registry key. +*-----------------------------------------------------------------------------*/ +{ + DWORD dw; + if (ERROR_SUCCESS == key.QueryDWORDValue(pName, dw)) + return dw; + else + return 0; +} + +/*============================================================================*/ + SYSTEMTIME CDoc:: +RegQuerySYSTEMTIMEValue(CRegKey& key, LPCWSTR pName) /* + + Return the SYSTEMTIME value of a specified value pName found in the + currently open registry key. +*-----------------------------------------------------------------------------*/ +{ + SYSTEMTIME value; + ULONG size = sizeof(SYSTEMTIME); + if (ERROR_SUCCESS != key.QueryBinaryValue(pName, &value, &size)) + { + CTime t = CTime::GetCurrentTime(); + t.GetAsSystemTime(value); + } + return value; +} + +/*============================================================================*/ + CString CDoc:: +RegQueryStringValue(CRegKey &key, LPCWSTR pName) /* + + Return the CString value of a specified value pName found in the + currently open registry key. +*-----------------------------------------------------------------------------*/ +{ + ULONG len = 256; + CString sValue; + if (ERROR_SUCCESS == key.QueryStringValue(pName, sValue.GetBuffer(255), &len)) + { + sValue.ReleaseBuffer(); + return sValue; + } + else + return L""; +} + +/*============================================================================*/ + void CDoc:: +SaveDocRegistry(LPCWSTR keyName) /* + + Write document value parameters into the registry key labelled + 'HKEY_CURRENT_USER\Software\keyName\Document Settings'. +*-----------------------------------------------------------------------------*/ +{ + CString strKey; + strKey << L"Software\\" << keyName << L"\\Document Settings"; + CRegKey key; + key.Create(HKEY_CURRENT_USER, strKey, nullptr, REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, nullptr, nullptr); + // Create() closes the key handle, so we have to reopen it + if (ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, strKey, KEY_WRITE)) + { + key.SetDWORDValue(L"CheckA", m_checkVal[0]); + key.SetDWORDValue(L"CheckB", m_checkVal[1]); + key.SetDWORDValue(L"CheckC", m_checkVal[2]); + key.SetDWORDValue(L"Radio", m_radioA); + key.SetDWORDValue(L"Byte1", m_byteVal); + key.SetDWORDValue(L"Short1", m_shortVal); + key.SetDWORDValue(L"Int1", m_intVal); + key.SetDWORDValue(L"UINT1", m_UINTVal); + key.SetDWORDValue(L"Long1", m_longVal); + key.SetDWORDValue(L"ULong1", m_ULongVal); + CString s; + s.Format(L"%.*g", FLT_DIG, m_floatVal); + key.SetStringValue(L"Float1", s.c_str()); + s.Format(L"%.*g", FLT_DIG, m_doubleVal); + key.SetStringValue(L"Double1", s.c_str()); + key.SetStringValue(L"LPWSTR1", m_LPWSTRVal); + key.SetStringValue(L"Edit1", m_editVal.c_str()); + key.SetStringValue(L"RichEdit1", m_richEditVal.c_str()); + key.SetStringValue(L"ListBox1", m_listBoxVal.c_str()); + key.SetDWORDValue(L"ListBox1x", m_listBoxIndx); + key.SetStringValue(L"ComboBox1", m_comboBoxVal.c_str()); + key.SetDWORDValue(L"ComboBox1x", m_comboBoxIndx); + key.SetDWORDValue(L"Slider1", m_sliderVal); + ULONG size = sizeof(SYSTEMTIME); + key.SetBinaryValue(L"MyDateTime", static_cast(&m_dateSysTime), + size); + key.SetBinaryValue(L"MoCalendar1", static_cast(&m_calDateSysTime), + size); + } +}/*---------------------------------------------------------------------------*/ + diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/Doc.h b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/Doc.h new file mode 100644 index 00000000..ecc1ebd6 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/Doc.h @@ -0,0 +1,138 @@ +/* (20-Oct-2024) [Tab/Indent: 8/8][Line/Box: 80/74] (Doc.h) * +******************************************************************************** +| | +| Author: Robert C. Tausworthe, 2020 | +| | +===============================================================================* + + Contents Description: The DDXDemo CDoc class declaration. This class + interfaces the document, held in the registry, with the remainder of the + DDX/DDV Demonstration program. This class is a modified version of that + found in the FormDocView sample distributed with the Win32++ Windows + interface classes. The modified sample program was based on code provided + by Lynn Allan. This demo extends the given sample by application of + Dialog Data Exchange and Validation (DDX/DDV). + + Programming Notes: The programming style roughly follows that established + by the 1995-1999 Jet Propulsion Laboratory Deep Space Network Planning and + Preparation Subsystem project for C++ programming. + + Acknowledgement: The author would like to thank and acknowledge the advice, + critical review, insight, and assistance provided by David Nash in the + development of this work. + +*******************************************************************************/ + +#ifndef SDI_DOC_H +#define SDI_DOC_H + +/*============================================================================*/ + class +CDoc : public CObject /* + + Declaration of the CDoc class of the App-Frame-Doc-View architecture. +*-----------------------------------------------------------------------------*/ +{ + public: + CDoc(); + virtual ~CDoc() override = default; + + void LoadDocRegistry(LPCWSTR keyName); + void SaveDocRegistry(LPCWSTR keyName); + BOOL RegQueryBOOLValue(CRegKey& key, LPCWSTR pName); + DWORD RegQueryDWORDValue(CRegKey& key, LPCWSTR pName); + CString RegQueryStringValue(CRegKey& key, LPCWSTR pName); + SYSTEMTIME RegQuerySYSTEMTIMEValue(CRegKey &key, LPCWSTR pName); + BOOL GetCheckA() const {return m_checkVal[0];} + void SetCheckA(BOOL IsChecked) { m_checkVal[0] = IsChecked;} + + BOOL GetCheckB() const {return m_checkVal[1];} + void SetCheckB(BOOL IsChecked) { m_checkVal[1] = IsChecked;} + + BOOL GetCheckC() const {return m_checkVal[2];} + void SetCheckC(BOOL IsChecked) { m_checkVal[2] = IsChecked;} + + UINT GetRadio() const {return m_radioA;} + void SetRadio(UINT radio) { m_radioA = radio;} + + const CString& GetListBoxS() const {return m_listBoxVal;} + void SetListBoxS(const CString &s){ m_listBoxVal = s;} + + int GetListBoxX() const {return m_listBoxIndx;} + void SetListBoxX(int index){m_listBoxIndx = index;} + + const CString& GetComboBoxS() const {return m_comboBoxVal;} + void SetComboBoxS(const CString &s){ m_comboBoxVal = s;} + + int GetComboBoxX() const {return m_comboBoxIndx;} + void SetComboBoxX(int index){m_comboBoxIndx = index;} + + const CString& GetEditBox() const {return m_editVal;} + void SetEditBox(const CString &s){m_editVal = s;} + + const CString& GetRichEditBox() const {return m_richEditVal;} + void SetRichEditBox(const CString &s){ m_richEditVal = s;} + + BYTE GetByte() const {return m_byteVal;} + void SetByte(BYTE val) {m_byteVal = val;} + + short GetShort() const {return m_shortVal;} + void SetShort(short val) {m_shortVal = val;} + + int GetInt() const {return m_intVal;} + void SetInt(int val) {m_intVal = val;} + + UINT GetUINT() const {return m_UINTVal;} + void SetUINT(UINT val) {m_UINTVal = val;} + + long GetLong() {return m_longVal;} + void SetLong(long val) {m_longVal = val;} + + DWORD GetULong() const {return m_ULongVal;} + void SetULong(DWORD val) {m_ULongVal = val;} + + float GetFloat() const {return m_floatVal;} + void SetFloat(float val) {m_floatVal = val;} + + double GetDouble() const {return m_doubleVal;} + void SetDouble(double val) {m_doubleVal = val;} + + const CString& GetString() const {return m_editVal;} + void SetString(const CString& val) {m_editVal = val;} + + LPCWSTR GetLPWSTR() const {return m_LPWSTRVal;} + void SetLPWSTR(LPCWSTR val) {StrCopy(m_LPWSTRVal, val, 256); } + + int GetSlider() const {return m_sliderVal;} + void SetSlider(int val) {m_sliderVal = val;} + + SYSTEMTIME GetDateTime() const {return m_dateSysTime;} + void SetDateTime(const SYSTEMTIME &st){m_dateSysTime = st;} + + SYSTEMTIME GetMoCalendar() const {return m_calDateSysTime;} + void SetMoCalendar(const SYSTEMTIME &st){m_calDateSysTime = st;} + + private: + BYTE m_byteVal; + short m_shortVal; + int m_intVal; + int m_comboBoxIndx; + int m_listBoxIndx; + int m_sliderVal; + UINT m_UINTVal; + long m_longVal; + DWORD m_ULongVal; + float m_floatVal; + double m_doubleVal; + BOOL m_checkVal[3]; + UINT m_radioA; + CString m_listBoxVal; + CString m_comboBoxVal; + CString m_editVal; + CString m_richEditVal; + wchar_t m_LPWSTRVal[256]; + SYSTEMTIME m_dateSysTime; + SYSTEMTIME m_calDateSysTime; +}; +/*----------------------------------------------------------------------------*/ +#endif //SDI_DOC_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/Mainfrm.cpp b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/Mainfrm.cpp new file mode 100644 index 00000000..9d35a0cd --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/Mainfrm.cpp @@ -0,0 +1,419 @@ +/* (20-Oct-2024) [Tab/Indent: 8/8][Line/Box: 80/74] (MainFrm.cpp) * +******************************************************************************** +| | +| Author: Robert C. Tausworthe, 2020 | +| | +===============================================================================* + + Contents Description: The DDXDemo CMainFrame class implementation. + This class controls the appearance and frame-related actions of the + DDXDemo sample program. This class is a modified version of that found + in the FormDocView sample distributed with the Win32++ Windows interface + classes. This class presents a fixed-size frame whose status bar has no + resizing gripper in the lower-right-hand corner. + + Programming Notes: The programming style roughly follows that established + by the 1995-1999 Jet Propulsion Laboratory Deep Space Network Planning and + Preparation Subsystem project for C++ programming. + + Acknowledgement: The author would like to thank and acknowledge the advice, + critical review, insight, and assistance provided by David Nash in the + development of this work. + +*******************************************************************************/ + +#include "stdafx.h" +#include "Mainfrm.h" +#include "App.h" +#include "resource.h" + +static const LPCWSTR registryKeyName = L"Win32++\\DDX-DDVDemo"; + +/*============================================================================*/ + CMainFrame:: +CMainFrame() /* + + Construct the CMainFrame. +*-----------------------------------------------------------------------------*/ + : m_view(IDD_MAIN_DIALOG) +{ +} + +/*============================================================================*/ + HWND CMainFrame:: +Create(HWND parent) /* + + Create the frame window and load the persistent frame and view parameters + that will have been saved in previous invocations of the program via + the registry in the key section 'Software\\Frame Settings'. + Also load the document's saved parameters from the + 'Software\\Document Settings' key. + + Note: the used here refers to the registerKeyName above. +* ---------------------------------------------------------------------------- - */ +{ + // Set m_view as the view window of the frame. + SetView(m_view); + + LoadRegistrySettings(registryKeyName); + + return CFrame::Create(parent); +} + +/*============================================================================*/ + BOOL CMainFrame:: +LoadRegistrySettings(LPCWSTR keyName) /* + + Load the main frame and document persistent data from the registry + section marked by keyName. The frame values were automatically + deposited into the registry by the base class SaveRegistrySettings(), + which was called by the framework when the program was last terminated. + The document data is recovered by a CDoc class method. +*-----------------------------------------------------------------------------*/ +{ + // reload previously saved window placement, toolbar/statusbar + // switches and view settings from the registry entries in key section + // 'Software\keyName\Frame Settings' + CFrame::LoadRegistrySettings(keyName); + // load the saved document entries from the same key + TheDoc().LoadDocRegistry(keyName); + return TRUE; +} + +/*============================================================================*/ +BOOL CMainFrame:: + OnCheckButton(UINT id) /* + + Toggle the check state of the button with the specified id. +*-----------------------------------------------------------------------------*/ +{ + m_view.SetCheck(id - IDC_CHECK_A); + return TRUE; +} + +/*============================================================================*/ + void CMainFrame:: +OnClose() /* + + The framework calls this member function as a signal that the CWnd or + application is to terminate. Retrieve the data in the dialog controls + and save it if all is well. If an error arises, return with the cursor + in the offending control so the user can correct it. +*-----------------------------------------------------------------------------*/ +{ + if (!UpdateDialog(READFROMCONTROL)) + { // oops! there is a problem with some of the control data + TRACE("*** Verification failed ***\n"); + return; // return control to user to fix this problem + } + // save the document contents into the registry + TheDoc().SaveDocRegistry(GetRegistryKeyName().c_str()); + TRACE("Data saved to registry\n"); + // the base class calls SaveRegistrySettings() and DestroyWindow() + CFrame::OnClose(); +} + +/*============================================================================*/ + BOOL CMainFrame:: +OnCommand(WPARAM wparam, LPARAM) /* + + The framework calls this member function when the user selects an item + from a menu, when a child control sends a notification message, or when + an accelerator keystroke is translated. +*-----------------------------------------------------------------------------*/ +{ + UINT id = LOWORD(wparam); + switch(id) + { + case IDM_EDIT_CUT: return OnEditCut(); + case IDM_EDIT_COPY: return OnEditCopy(); + case IDM_EDIT_DELETE: return OnEditDelete(); + case IDM_EDIT_PASTE: return OnEditPaste(); + case IDM_EDIT_REDO: return OnEditRedo(); + case IDM_EDIT_UNDO: return OnEditUndo(); + case IDM_FILE_EXIT: return OnFileExit(); + case IDW_ABOUT: return OnHelp(); + case IDW_VIEW_STATUSBAR: return OnViewStatusBar(); + case IDW_VIEW_TOOLBAR: return OnViewToolBar(); + + case IDC_CHECK_A: + case IDC_CHECK_B: + case IDC_CHECK_C: return OnCheckButton(id); + + case IDC_RADIO_A: + case IDC_RADIO_B: + case IDC_RADIO_C: return OnRadioButton(id); + } + // indicate not processed here + return FALSE; +} + +/*============================================================================*/ + int CMainFrame:: +OnCreate(CREATESTRUCT& cs) /* + + Define the way the frame is created. +*-----------------------------------------------------------------------------*/ +{ + // Uncomment the lines below to change frame options. + + // UseIndicatorStatus(FALSE); // Don't show keyboard indicators in the StatusBar. + // UseMenuStatus(FALSE); // Don't show menu descriptions in the StatusBar. + // UseOwnerDrawnMenu(FALSE); // Don't use owner draw for popup menu items. + // UseReBar(FALSE); // Don't use a ReBar. + // UseStatusBar(FALSE); // Don't use a StatusBar. + // UseThemes(FALSE); // Don't use themes. + // UseToolBar(FALSE); // Don't use a ToolBar. + + // call the base class function + int rtn = CFrame::OnCreate(cs); + + // show the initial document and status + UpdateDialog(SENDTOCONTROL); + return rtn; +} + +/*============================================================================*/ + BOOL CMainFrame:: +OnEditCopy() /* + + Copy text to the control with keyboard focus. +*-----------------------------------------------------------------------------*/ +{ + GetFocus().SendMessage(WM_COPY, 0, 0); + return TRUE; +} + +/*============================================================================*/ + BOOL CMainFrame:: +OnEditCut() /* + + Cut text from the control with keyboard focus. +*-----------------------------------------------------------------------------*/ +{ + GetFocus().SendMessage(WM_CUT, 0, 0); + return TRUE; +} + +/*============================================================================*/ + BOOL CMainFrame:: +OnEditDelete() /* + + Delete text from the control with keyboard focus. +*-----------------------------------------------------------------------------*/ +{ + GetFocus().SendMessage(WM_CLEAR, 0, 0); + return TRUE; +} + +/*============================================================================*/ + BOOL CMainFrame:: +OnEditPaste() /* + + Paste text to the control with keyboard focus. +*-----------------------------------------------------------------------------*/ +{ + GetFocus().SendMessage(WM_PASTE, 0, 0); + return TRUE; +} + +/*============================================================================*/ + BOOL CMainFrame:: +OnEditRedo() /* + + Redo the last text operation for the control with keyboard focus. +*-----------------------------------------------------------------------------*/ +{ + GetFocus().SendMessage(EM_REDO, 0, 0); + return TRUE; +} + +/*============================================================================*/ + BOOL CMainFrame:: +OnEditUndo() /* + + Undo the last text operation for the control with keyboard focus. +*-----------------------------------------------------------------------------*/ +{ + GetFocus().SendMessage(EM_UNDO, 0, 0); + return TRUE; +} + +/*============================================================================*/ + BOOL CMainFrame:: +OnFileExit() /* + + Close the application. +*-----------------------------------------------------------------------------*/ +{ + // Issue a close request to the frame + Close(); + return TRUE; +} + +/*============================================================================*/ + BOOL CMainFrame:: +OnHelp() + /* + Display the help about dialog. +*-----------------------------------------------------------------------------*/ +{ + // Ensure only one dialog displayed even for multiple hits of the F1 button. + if (!m_aboutDialog.IsWindow()) + { + m_aboutDialog.DoModal(*this); + } + + return TRUE; +} + + +/*============================================================================*/ + void CMainFrame:: +OnInitialUpdate() /* + + This method is called by the framework after the view is first attached + to the document, but before the view is initially displayed. Add code + here to perform any one-time initialization. +*-----------------------------------------------------------------------------*/ +{ + // The frame is now created. + // Place any additional startup code here. +} + +/*============================================================================*/ +void CMainFrame:: +OnMenuUpdate(UINT id) /* + + This method is called by the framework before the menu items are + displayed. Add code here to update the check state of menu items. +*-----------------------------------------------------------------------------*/ +{ + switch (id) + { + case IDC_CHECK_A: + { + bool isCheckA = (m_view.GetCheckA() != 0); + UINT check = isCheckA ? MF_CHECKED : MF_UNCHECKED; + GetFrameMenu().CheckMenuItem(id, check); + } + break; + case IDC_CHECK_B: + { + bool isCheckB = (m_view.GetCheckB() != 0); + UINT check = isCheckB ? MF_CHECKED : MF_UNCHECKED; + GetFrameMenu().CheckMenuItem(id, check); + } + break; + case IDC_CHECK_C: + { + bool isCheckC = (m_view.GetCheckC() != 0); + UINT check = isCheckC ? MF_CHECKED : MF_UNCHECKED; + GetFrameMenu().CheckMenuItem(id, check); + } + break; + } + + if ((id >= IDC_RADIO_A) && (id <= IDC_RADIO_C)) + { + int radio = id - IDC_RADIO_A; + if (m_view.GetRadio() == radio) + GetFrameMenu().CheckMenuRadioItem(IDC_RADIO_A, IDC_RADIO_C, + id, MF_BYCOMMAND); + } + + CFrame::OnMenuUpdate(id); +} + +/*============================================================================*/ +BOOL CMainFrame:: + OnRadioButton(UINT id) /* + + Select the radio button with the specified id. +*-----------------------------------------------------------------------------*/ +{ + m_view.SetRadio(id - IDC_CHECK_A); + return TRUE; +} + +/*============================================================================*/ +void CMainFrame:: + SetupMenuIcons() /* + + Specify the bitmap for the menu icons. + *-----------------------------------------------------------------------------*/ +{ + std::vector data = GetToolBarData(); + if (GetMenuIconHeight() >= 24) + SetMenuIcons(data, RGB(192, 192, 192), IDW_MAIN); + else + SetMenuIcons(data, RGB(192, 192, 192), IDB_TOOLBAR16); +} + +/*============================================================================*/ + void CMainFrame:: +SetupToolBar() /* + + Add the specific buttons to the tool bar. +*-----------------------------------------------------------------------------*/ +{ + // Set the Resource IDs for the toolbar buttons + AddToolBarButton( IDM_FILE_NEW ); + AddToolBarButton( IDM_FILE_OPEN ); + AddToolBarButton( IDM_FILE_SAVE ); + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_EDIT_CUT ); + AddToolBarButton( IDM_EDIT_COPY ); + AddToolBarButton( IDM_EDIT_PASTE ); + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_FILE_PRINT ); + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDW_ABOUT ); +} + +/*============================================================================*/ + BOOL CMainFrame:: +UpdateDialog(BOOL bReadFromControl) /* + + Update data items in memory (bReadFromControl is READFROMCONTROL) or in + the dialog controls (bReadFromControl is SENDTOCONTROL). The list of + affected controls is specified in the CView::DoDataExchange() method. +*-----------------------------------------------------------------------------*/ +{ + return m_view.UpdateDialog(bReadFromControl); +} + +/*============================================================================*/ + LRESULT CMainFrame:: +WndProc(UINT msg, WPARAM wparam, LPARAM lparam) /* + + Handle the window's messages +------------------------------------------------------------------------------*/ +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/Mainfrm.h b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/Mainfrm.h new file mode 100644 index 00000000..27fa6700 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/Mainfrm.h @@ -0,0 +1,75 @@ +/* (20-Oct-2024) [Tab/Indent: 8/8][Line/Box: 80/74] (MainFrm.h) * +******************************************************************************** +| | +| Author: Robert C. Tausworthe, 2020 | +| | +===============================================================================* + + Contents Description: The DDXDemo CMainFrame class declaration. This class + controls the appearance and frame-related actions of the DDXDemo program. + This class presents a fixed-size frame whose status bar has no resizing + gripper in the lower-right-hand corner. + + Programming Notes: The programming style roughly follows that established + by the 1995-1999 Jet Propulsion Laboratory Deep Space Network Planning and + Preparation Subsystem project for C++ programming. + + Acknowledgement: The author would like to thank and acknowledge the advice, + critical review, insight, and assistance provided by David Nash in the + development of this work. + +*******************************************************************************/ + +#ifndef MAINFRM_H +#define MAINFRM_H + +#include "View.h" +#include "AboutDialog.h" + +/*============================================================================*/ + class +CMainFrame : public CFrame /* + + Declaration of the CMainFrame class of the App-Frame-Doc-View architecture. +*----------------------------------------------------------------------------*/ +{ + public: + CMainFrame(); + virtual ~CMainFrame() override = default; + virtual HWND Create(HWND parent = nullptr) override; + + CDoc& TheDoc() { return m_view.TheDoc(); } + BOOL UpdateDialog(BOOL bReadFromControl); + + protected: + virtual BOOL LoadRegistrySettings(LPCWSTR keyName) override; + virtual void OnClose() override; + virtual BOOL OnCommand(WPARAM wparam, LPARAM lparam) override; + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual BOOL OnHelp() override; + virtual void OnInitialUpdate() override; + virtual void OnMenuUpdate(UINT id) override; + virtual void SetupMenuIcons() override; + virtual void SetupToolBar() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + + private: + CMainFrame(const CMainFrame&) = delete; + CMainFrame& operator=(const CMainFrame&) = delete; + + BOOL OnCheckButton(UINT id); + BOOL OnEditCopy(); + BOOL OnEditCut(); + BOOL OnEditDelete(); + BOOL OnEditPaste(); + BOOL OnEditRedo(); + BOOL OnEditUndo(); + BOOL OnFileExit(); + BOOL OnRadioButton(UINT id); + + CAboutDialog m_aboutDialog; + CView m_view; +}; +/*----------------------------------------------------------------------------*/ +#endif //MAINFRM_H + diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/MyButton.cpp b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/MyButton.cpp new file mode 100644 index 00000000..458589ac --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/MyButton.cpp @@ -0,0 +1,62 @@ +/* (20-Oct-2024) [Tab/Indent: 8/8][Line/Box: 80/74] (MyButton.cpp) * +******************************************************************************** +| | +| Author: Robert C. Tausworthe, 2020 | +| | +===============================================================================* + + Contents Description: The CMyButton class implementation. This class is + derived from the CButton class found in the Win32++ Windows interface + classes. It permits individual settings of the parameters of owner-drawn + button controls on dialog forms. + + Programming Notes: The programming style roughly follows that established + by the 1995-1999 Jet Propulsion Laboratory Deep Space Network Planning and + Preparation Subsystem project for C++ programming. + + Acknowledgement: The author would like to thank and acknowledge the advice, + critical review, insight, and assistance provided by David Nash in the + development of this work. + +*******************************************************************************/ + +#include "stdafx.h" +#include "MyButton.h" + +/*============================================================================*/ + void CMyButton:: +DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) /* + + Custom draw the item specified in lpDrawItemStruct: here a button. + Invoked by the view for the owner-drawn button in response to the + WM_DRAWITEM system message. An owner-drawn button has the BS_OWNERDRAW + style set. Also see the BS_ style values. +*-----------------------------------------------------------------------------*/ +{ + // get the device context and attach the button handle to it + CDC dc; + dc.Attach(lpDrawItemStruct->hDC); + // determine the button rectangle + CRect rect = lpDrawItemStruct->rcItem; + // draw in the button text + dc.DrawText(GetWindowText(), -1, rect, DT_CENTER | DT_VCENTER | + DT_SINGLELINE); + // get the current state of the button + UINT state = lpDrawItemStruct->itemState; + if ( (state & ODS_SELECTED) ) // if it is pressed + dc.DrawEdge(rect, EDGE_SUNKEN, BF_RECT); // draw a sunken face + else + dc.DrawEdge(rect, EDGE_RAISED, BF_RECT); // draw a raised face + // draw the focus rectangle, a dotted rectangle just inside the + // button rectangle when the button has the focus. + if (lpDrawItemStruct->itemAction & ODA_FOCUS) + { + int iChange = 3; + rect.top += iChange; + rect.left += iChange; + rect.right -= iChange; + rect.bottom -= iChange; + dc.DrawFocusRect(rect); + } +} +/*----------------------------------------------------------------------------*/ diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/MyButton.h b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/MyButton.h new file mode 100644 index 00000000..9e0d1e37 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/MyButton.h @@ -0,0 +1,45 @@ +/* (20-Oct-2024) [Tab/Indent: 8/8][Line/Box: 80/74] (MyButton.h) * +******************************************************************************** +| | +| Author: Robert C. Tausworthe, 2020 | +| | +===============================================================================* + + Contents Description: The CMyButton class declaration. This class is + derived from the CButton class found in the Win32++ Windows interface + classes. It permits individual settings of the parameters of owner-drawn + button controls on dialog forms. + + Programming Notes: The programming style roughly follows that established + by the 1995-1999 Jet Propulsion Laboratory Deep Space Network Planning and + Preparation Subsystem project for C++ programming. + + Acknowledgement: The author would like to thank and acknowledge the advice, + critical review, insight, and assistance provided by David Nash in the + development of this work. + +*******************************************************************************/ + +#ifndef CMyButton_H +#define CMyButton_H + +/******************************************************************************/ + class +CMyButton : public CButton /* + + This class extends the CButton class to permit owner-drawn buttons. +*-----------------------------------------------------------------------------*/ +{ + public: + CMyButton() = default; + virtual ~CMyButton() override = default; + + void DrawItem(LPDRAWITEMSTRUCT); + + private: + CMyButton(const CMyButton&) = delete; + CMyButton& operator=(const CMyButton&) = delete; +}; + +/*----------------------------------------------------------------------------*/ +#endif // CMyButton_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/MyScrollbar.cpp b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/MyScrollbar.cpp new file mode 100644 index 00000000..f83f92fa --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/MyScrollbar.cpp @@ -0,0 +1,89 @@ +/* (20-Oct-2024) [Tab/Indent: 8/8][Line/Box: 80/74] (MyScrollBar.cpp) * +******************************************************************************** +| | +| Author: Robert C. Tausworthe, 2020 | +| | +===============================================================================* + + Contents Description: The custom scroll bar class implementation for + this DDX-DDV Test program. This class is derived from the MyScrollBar + class found in the Win32++ Windows sample programs. + + Programming Notes: The programming style roughly follows that established + by the 1995-1999 Jet Propulsion Laboratory Deep Space Network Planning and + Preparation Subsystem project for C++ programming. + + Acknowledgement: The author would like to thank and acknowledge the advice, + critical review, insight, and assistance provided by David Nash in the + development of this work. + +*******************************************************************************/ + +#include "stdafx.h" +#include "MyScrollbar.h" +#include "App.h" +#include "resource.h" + +/*============================================================================*/ + CMyScrollBar:: +CMyScrollBar() /* + +*-----------------------------------------------------------------------------*/ +{ + m_scrollInfo = {}; +} + +/*============================================================================*/ + int CMyScrollBar:: +GetHScrollPos(UINT, WPARAM wparam, LPARAM) /* + + Respond to WM_HSCROLL messages and return the current position of the + scroll bar. +*-----------------------------------------------------------------------------*/ +{ + GetScrollInfo(m_scrollInfo); + switch (LOWORD (wparam)) + { + case SB_LINELEFT: // user clicked left or up arrow + m_scrollInfo.nPos -= 1; + break; + + case SB_LINERIGHT: // clicked right or down arrow + m_scrollInfo.nPos += 1; + break; + + case SB_PAGELEFT: // clicked page up or scroll bar left of thumb + m_scrollInfo.nPos -= m_scrollInfo.nPage; + break; + + case SB_PAGERIGHT: // clicked page down or scroll bar right of thumb + m_scrollInfo.nPos += m_scrollInfo.nPage; + break; + + case SB_THUMBTRACK: // user dragged the scroll box + m_scrollInfo.nPos = m_scrollInfo.nTrackPos; + break; + + default : + break; + } + return m_scrollInfo.nPos; +} + +/*============================================================================*/ + void CMyScrollBar:: +SetScrollInfo(int lo, int hi, int pos, int page) /* + +*-----------------------------------------------------------------------------*/ +{ + m_scrollInfo.cbSize = sizeof(SCROLLINFO); + m_scrollInfo.nPos = pos; + m_scrollInfo.nPage = page; + m_scrollInfo.nMin = lo; + m_scrollInfo.nMax = hi + (page - 1); + m_scrollInfo.fMask = SIF_ALL; + + // Set the scroll bar position + CScrollBar::SetScrollInfo(m_scrollInfo, TRUE); +} +/*----------------------------------------------------------------------------*/ diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/MyScrollbar.h b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/MyScrollbar.h new file mode 100644 index 00000000..e1d01b74 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/MyScrollbar.h @@ -0,0 +1,47 @@ +/* (20-Oct-2024) [Tab/Indent: 8/8][Line/Box: 80/74] (MyMyScrollbar.h) * +******************************************************************************** +| | +| Author: Robert C. Tausworthe, 2020 | +| | +===============================================================================* + + Contents Description: The custom MyScroll bar class declaration for + this DDX-DDV Test program. This class is derived from the MyScrollBar + class found in the Win32++ Windows sample programs. + + Programming Notes: The programming style roughly follows that established + by the 1995-1999 Jet Propulsion Laboratory Deep Space Network Planning and + Preparation Subsystem project for C++ programming. + + Acknowledgement: The author would like to thank and acknowledge the advice, + critical review, insight, and assistance provided by David Nash in the + development of this work. + + +*******************************************************************************/ + +#ifndef MYSCROLLBAR_H +#define MYSCROLLBAR_H + +/*============================================================================*/ + class +CMyScrollBar : public CScrollBar /* + +*-----------------------------------------------------------------------------*/ +{ + public: + CMyScrollBar(); + virtual ~CMyScrollBar() override = default; + + int GetHScrollPos(UINT, WPARAM, LPARAM); + void SetScrollInfo(int lo, int hi, int pos, int page); + + private: + CMyScrollBar(const CMyScrollBar&) = delete; + CMyScrollBar& operator=(const CMyScrollBar&) = delete; + + SCROLLINFO m_scrollInfo; +}; + +/*----------------------------------------------------------------------------*/ +#endif // MYSCROLLBAR_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/Resource.rc b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/Resource.rc new file mode 100644 index 00000000..e6bba78d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/Resource.rc @@ -0,0 +1,376 @@ +/* (20-Oct-2024) [Tab/Indent: 8/8][Line/Box: 80/74] (Resource.rc) * +******************************************************************************** +| | +| Author: Robert C. Tausworthe, 2020 | +| | +===============================================================================* + + Contents Description: Application resources file for a this DDXDemo + application. Adapted to use Win32++ Windows interface classes. + + Acknowledgement: The author would like to thank and acknowledge the advice, + critical review, insight, and assistance provided by David Nash in the + development of this work. + +******************************************************************************/ + +// Microsoft Visual C++ generated resource script. +// + +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "../src/res/PerMonitorV2.manifest" + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + + // Main Menu +IDW_MAIN MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "E&xit\tAlt+F4", IDM_FILE_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "Undo\tCtrl+Z", IDM_EDIT_UNDO + MENUITEM "Redo\tCtrl+Y", IDM_EDIT_REDO + MENUITEM SEPARATOR + MENUITEM "Cut\tCtrl+X", IDM_EDIT_CUT + MENUITEM "Copy\tCtrl+C", IDM_EDIT_COPY + MENUITEM "Paste\tCtrl+V", IDM_EDIT_PASTE + MENUITEM "Delete\tDel", IDM_EDIT_DELETE + END + POPUP "&View" + BEGIN + MENUITEM "&Tool Bar", IDW_VIEW_TOOLBAR, CHECKED + MENUITEM "&Status Bar", IDW_VIEW_STATUSBAR, CHECKED + END + POPUP "&Select" + BEGIN + MENUITEM "Radio A", IDC_RADIO_A + MENUITEM "Radio B", IDC_RADIO_B + MENUITEM "Radio C", IDC_RADIO_C + MENUITEM SEPARATOR + MENUITEM "Check A", IDC_CHECK_A + MENUITEM "Check B", IDC_CHECK_B + MENUITEM "Check C", IDC_CHECK_C + END + POPUP "&Help" + BEGIN + MENUITEM "&About\tF1", IDW_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDW_MAIN ICON "../src/res/Form.ico" + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_ROSE_BITMAP BITMAP "../src/res/moondance.bmp" +IDB_TOOLBAR16 BITMAP "../src/res/Toolbar16.bmp" +IDW_MAIN BITMAP "../src/res/Toolbar24.bmp" + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + + // Main Dialog: the CView form +IDD_MAIN_DIALOG DIALOGEX 0, 0, 400, 368 +STYLE /*DS_SHELLFONT |*/ WS_VISIBLE | WS_CHILDWINDOW +FONT 8, "Courier", 0, 0 +BEGIN + EDITTEXT IDC_EDIT_BYTE, 90, 20, 15, 10, WS_GROUP | NOT WS_BORDER | + ES_NUMBER | ES_RIGHT, WS_EX_STATICEDGE + LTEXT " BYTE ", IDC_STATIC, 110, 20, 40, 10, SS_LEFT + EDITTEXT IDC_EDIT_SHORT, 75, 40, 30, 10, NOT WS_BORDER | ES_RIGHT, + WS_EX_STATICEDGE + LTEXT " short ", IDC_STATIC, 110, 40, 40, 10, SS_LEFT + EDITTEXT IDC_EDIT_INT, 50, 60, 55, 10, NOT WS_BORDER | ES_RIGHT, + WS_EX_STATICEDGE + LTEXT " int ", IDC_STATIC, 110, 60, 40, 10, SS_LEFT + EDITTEXT IDC_EDIT_UINT, 50, 80, 55, 10, NOT WS_BORDER | ES_NUMBER | + ES_RIGHT, WS_EX_STATICEDGE + LTEXT " UINT ", IDC_STATIC, 110, 80, 40, 10, SS_LEFT + EDITTEXT IDC_EDIT_LONG, 50, 100, 55, 10, NOT WS_BORDER | ES_RIGHT, + ES_NUMBER | WS_EX_STATICEDGE + LTEXT " long ", IDC_STATIC, 110, 100, 40, 10, SS_LEFT + EDITTEXT IDC_EDIT_DWORD, 50, 120, 55, 10, NOT WS_BORDER | ES_NUMBER | + ES_RIGHT, WS_EX_STATICEDGE + LTEXT " DWORD ", IDC_STATIC, 110, 120, 40, 10, SS_LEFT + EDITTEXT IDC_EDIT_FLOAT, 15, 140, 90, 10, NOT WS_BORDER | ES_RIGHT, + WS_EX_STATICEDGE + LTEXT " float ", IDC_STATIC, 110, 140, 40, 10, SS_LEFT + EDITTEXT IDC_EDIT_DOUBLE, 15, 160, 90, 10, NOT WS_BORDER | ES_RIGHT, + WS_EX_STATICEDGE + LTEXT " double ", IDC_STATIC, 110, 160, 40, 10, SS_LEFT + EDITTEXT IDC_EDIT_LPWSTR, 15, 180, 135, 10, NOT WS_BORDER, + WS_EX_STATICEDGE + EDITTEXT IDC_EDIT_CSTRING, 15, 200, 135, 35, WS_GROUP | NOT WS_BORDER | + ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE | + ES_WANTRETURN, WS_EX_STATICEDGE + CONTROL "Rich edit box", IDC_EDIT_RICHEDIT, "RichEdit50W" , + WS_TABSTOP | WS_BORDER | ES_AUTOHSCROLL | ES_MULTILINE | + ES_WANTRETURN, 15, 240, 135, 35 + LISTBOX IDC_LISTBOX, 15, 280, 135, 70, WS_GROUP | WS_TABSTOP | + WS_VSCROLL | NOT WS_BORDER | LBS_NOINTEGRALHEIGHT | + LBS_SORT | LBS_NOTIFY + CONTROL "", IDC_SLIDER, "msctls_trackbar32", WS_TABSTOP | + TBS_NOTICKS | TBS_BOTH, 185, 15, 135, 15 + CONTROL "", IDC_PROGRESSBAR, "msctls_progress32", + WS_TABSTOP | PBS_SMOOTH, 185, 45, 135, 14 + SCROLLBAR IDC_SCROLLBAR, 185, 70, 135, 14, SBS_HORZ | WS_TABSTOP + COMBOBOX IDC_COMBOBOX, 185, 95, 135, 150, CBS_DROPDOWN | + CBS_HASSTRINGS | WS_TABSTOP | WS_VSCROLL + AUTORADIOBUTTON "Radio_A", IDC_RADIO_A, 190, 125, 48, 10, WS_GROUP | + BS_NOTIFY + AUTORADIOBUTTON "Radio_B", IDC_RADIO_B, 190, 140, 48, 10, BS_NOTIFY + AUTORADIOBUTTON "Radio_C", IDC_RADIO_C, 190, 155, 48, 10, BS_NOTIFY + AUTOCHECKBOX "Check Box A", IDC_CHECK_A, 190, 180, 55, 10, + WS_GROUP | WS_TABSTOP | BS_NOTIFY + AUTOCHECKBOX "Check Box B", IDC_CHECK_B, 190, 195, 55, 10, WS_GROUP | + WS_TABSTOP | BS_NOTIFY + AUTOCHECKBOX "Check Box C", IDC_CHECK_C, 190, 210, 55, 10, WS_GROUP | + WS_TABSTOP | BS_NOTIFY + CONTROL "", IDC_DATE_TIME, "SysDateTimePick32", WS_GROUP | + WS_TABSTOP | DTS_TIMEFORMAT , 190, 230, 100, 15 + CONTROL "", IDC_CALENDAR, "SysMonthCal32", WS_TABSTOP | + MCS_NOTODAY, 175, 250, 127, 108 + PUSHBUTTON "PUSH ME", IDC_PUSH_ME_BUTTON, 330, 15, 50, 16, + WS_GROUP | WS_TABSTOP | BS_OWNERDRAW + PUSHBUTTON "STATUS", IDOK, 330, 35, 50, 16, + WS_GROUP | WS_TABSTOP | BS_OWNERDRAW + CONTROL IDB_ROSE_BITMAP, IDC_ROSE_BITMAP, "Static", WS_TABSTOP | + SS_BITMAP | SS_NOTIFY, 395, 10, 64, 59 + GROUPBOX " Status Window ", IDC_STATUS_GROUP, 325, 80, 135, 265, + BS_CENTER + LTEXT "Actions are displayed here", IDC_EDIT_STATUS, + 335, 95, 120, 245, SS_LEFT | SS_NOTIFY +END + + + // About Dialog +IDW_ABOUT DIALOGEX 0, 0, 186, 109 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "MS Shell Dlg", 400, 0 +BEGIN + DEFPUSHBUTTON "OK",IDOK,68,60,50,14 + CTEXT "DDX/DDV Demo Application",IDC_STATIC,43,22,99,8 + ICON IDW_MAIN,0,4,4,20,20 + CTEXT "",IDC_STATIC1,53,32,80,8 + CTEXT "",IDC_STATIC2,53,42,80,8 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDW_MAIN ACCELERATORS +BEGIN + "N", IDM_FILE_NEW, VIRTKEY, CONTROL + "O", IDM_FILE_OPEN, VIRTKEY, CONTROL + "P", IDM_FILE_PRINT, VIRTKEY, CONTROL + "S", IDM_FILE_SAVE, VIRTKEY, CONTROL + "C", IDM_EDIT_COPY, VIRTKEY, CONTROL + "X", IDM_EDIT_CUT, VIRTKEY, CONTROL + "V", IDM_EDIT_PASTE, VIRTKEY, CONTROL + "Z", IDM_EDIT_UNDO, VIRTKEY, CONTROL + "Y", IDM_EDIT_REDO, VIRTKEY, CONTROL +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_MAIN_DIALOG, DIALOG + BEGIN + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// AFX_DIALOG_LAYOUT +// + +IDD_MAIN_DIALOG AFX_DIALOG_LAYOUT +BEGIN + 0 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + + // Standard resource ID messages +STRINGTABLE +BEGIN + IDW_MAIN "DDX/DDV Demo" + IDW_ABOUT "Display Information about this program" + IDW_VIEW_TOOLBAR "Show or hide the tool bar" + IDW_VIEW_STATUSBAR "Show or hide the status bar" + IDW_READY "Ready" + IDW_INDICATOR_CAPS "CAP" + IDW_INDICATOR_NUM "NUM" + IDW_INDICATOR_SCRL "SCRL" +END + + // Menu selection messages +STRINGTABLE +BEGIN + IDM_FILE_NEW "Create a New Document" + IDM_FILE_OPEN "Open Existing Document" + IDM_FILE_SAVE "Save the Document" + IDM_FILE_SAVEAS "Save the Document with a new name" + IDM_FILE_PRINT "Print the Document" + IDM_FILE_EXIT "End the Program" + IDM_EDIT_UNDO "Undo the last action" + IDM_EDIT_REDO "Redo the previously undone action" + IDM_EDIT_CUT "Cut the Selected Contents to the Clipboard" + IDM_EDIT_COPY "Copy the Selected Contents to the Clipboard" + IDM_EDIT_PASTE "Paste the Clipboard Contents to the Document" + IDM_EDIT_DELETE "Erase the selected Contents" +END + + // Tool Tips Text +STRINGTABLE +BEGIN + IDOK "Hint for STATUS button: Collect and show status." + IDC_RADIO_A "Hint for Radio Button A: Click to select." + IDC_RADIO_B "Hint for Radio Button B: Click to select." + IDC_RADIO_C "Hint for Radio Button C: Click to select." + IDC_CHECK_A "Hint for Check A: Check or uncheck." + IDC_CHECK_B "Hint for Check B: Check or uncheck." + IDC_CHECK_C "Hint for Check C: Check or uncheck." + IDD_MAIN_DIALOG "Hint for Main Dialog: Does not display." + IDC_EDIT_BYTE "Hint for byte: Enter one byte." + IDC_EDIT_SHORT "Hint for short: Enter short integer." + IDC_EDIT_INT "Hint for int: Enter integer." + IDC_EDIT_UINT "Hint for UINT: Enter unsigned integer." + IDC_EDIT_LONG "Hint for long: Enter long integer." + IDC_EDIT_DWORD "Hint for DWORD: Enter double word integer." + IDC_EDIT_FLOAT "Hint for float: Enter floating point number." + IDC_EDIT_DOUBLE "Hint for double: Enter double precision floating point number." + IDC_EDIT_LPWSTR "Hint for LPWSTR: Enter string characters." + IDC_EDIT_CSTRING "Hint for Edit Box: Enter text here." + IDC_EDIT_RICHEDIT "Hint for Rich Edit: Enter text here." + IDC_EDIT_STATUS "Hint for Status area: Display status of controls." + IDC_LISTBOX "Hint for List Box entries: Select one." + IDC_SLIDER "Hint for slider: click or slide thumb to value." + IDC_PROGRESSBAR "Hint for progressbar: this shows progress." + IDC_SCROLLBAR "Hint for scrollbar: click or slide thumb to value." + IDC_COMBOBOX "Hint for combo box: choose an entry." + IDC_DATE_TIME "Hint for date and time: choose a date and time." + IDC_CALENDAR "Hint for calendar: choose a date." + IDC_STATUS_GROUP "Hint for Status Group: This tool tip does not display." + IDC_PUSH_ME_BUTTON "Hint for Button: Push to see status." + IDC_ROSE_BITMAP "Hint for Rose Bitmap: Push to see rose variety." +END + + // Standard frame messages +STRINGTABLE +BEGIN + SC_CLOSE "Close the Window" + SC_MAXIMIZE "Maximize the Window" + SC_MINIMIZE "Minimize the Window" + SC_MOVE "Move the Window" + SC_NEXTWINDOW "Select Next Window" + SC_PREVWINDOW "Select Previous Window" + SC_RESTORE "Restore the Window" + SC_SIZE "Resize the Window" +END + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/StdAfx.cpp b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/StdAfx.cpp new file mode 100644 index 00000000..ddb3a26a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/StdAfx.cpp @@ -0,0 +1,16 @@ +/* (20-Oct-2024) [Tab/Indent: 8/8][Line/Box: 80/74] (StdAfx.cpp) * +******************************************************************************** + + Contents Description: Standard declarations implementation File. This file + is used for precompiled hearders. Precompiled headers allow programs to be + recompiled more quickly. + + To use precompiled headers, do the following: + 1) Add the set of rarely changed headers to stdafx.h + 2) Include stdafx.h in each cpp file. It must be included first. + 3) Add stdafx.cpp to your project. + 4) Turn on precompiled hearders in the project + +*=============================================================================*/ + +#include "stdafx.h" diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/View.cpp b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/View.cpp new file mode 100644 index 00000000..0bdb16fa --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/View.cpp @@ -0,0 +1,939 @@ +/* (20-Oct-2024) [Tab/Indent: 8/8][Line/Box: 80/74] (View.cpp) * +******************************************************************************** +| | +| Author: Robert C. Tausworthe, 2020 | +| | +===============================================================================* + + Contents Description: The DDXDemo CView class implementation. This class + controls the appearance and view-related actions of the DDX/DDV test + program. This class is a modified version of that found in the + FormDocView sample distributed with the Win32++ Windows interface classes. + The modified sample program was based on code provided by LynnAllan. This + program extends the given sample by application of Dialog Data Exchange + and Validation (DDX/DDV). + + Programming Notes: The programming style roughly follows that established + by the 1995-1999 Jet Propulsion Laboratory Deep Space Network Planning and + Preparation Subsystem project for C++ programming. + + Acknowledgement: The author would like to thank and acknowledge the advice, + critical review, insight, and assistance provided by David Nash in the + development of this work. + +*******************************************************************************/ + +#include "stdafx.h" +#include "Doc.h" +#include "View.h" +#include "App.h" +#include "resource.h" + +#ifndef CFM_BACKCOLOR +#define CFM_BACKCOLOR 0x04000000 +#endif // CFM_BACKCOLOR + +static const CString unit[] = {L'A', L'B', L'C'}; + +/*=============================================================================* + + Define the color palette */ + +#define COLOR_BLACK RGB( 0, 0, 0) +#define COLOR_GRAY RGB(100, 100, 100) +#define COLOR_LT_GRAY RGB(200, 200, 200) +#define COLOR_WHITE RGB(255, 255, 255) + +#define COLOR_BLUE RGB( 0, 0, 255) +#define COLOR_LT_BLUE RGB(200, 200, 255) +#define COLOR_DK_BLUE RGB( 0, 0, 128) +#define COLOR_LILAC RGB(230, 230, 255) + +#define COLOR_BROWN RGB(255, 128, 64) +#define COLOR_DK_BROWN RGB(128, 64, 0) + +#define COLOR_YELLOW RGB(255, 255, 0) +#define COLOR_LT_YELLOW RGB(255, 255, 200) +#define COLOR_DK_YELLOW RGB(128, 128, 0) + +#define COLOR_CYAN RGB( 0, 255, 255) +#define COLOR_LT_CYAN RGB(200, 255, 255) +#define COLOR_DK_CYAN RGB( 0, 128, 128) + +#define COLOR_GREEN RGB( 0, 255, 0) +#define COLOR_LT_GREEN RGB(200, 255, 200) +#define COLOR_DK_GREEN RGB( 0, 128, 0) + +#define COLOR_MAGENTA RGB(255, 0, 255) +#define COLOR_LT_MAGENTA RGB(255, 200, 255) +#define COLOR_DK_MAGENTA RGB(128, 0, 128) + +#define COLOR_RED RGB(255, 0, 0) +#define COLOR_LT_RED RGB(255, 200, 200) +#define COLOR_DK_RED RGB(128, 0, 0) + +/*============================================================================*/ + CView:: +CView(UINT nResID) /* + + Construct the dialog view based on the resource.rc defined by the + resource identifier nResID. Set the initial text foreground and + background display color and the form background brush for each + control type, and set the view background color. The frame colors + are set separately, in CMainFrame::SetThemeColors(). +*-----------------------------------------------------------------------------*/ + : CDialog(nResID), m_focusID(0) +{ + // These initial values for the dialog controls that use DDX/DDV + // validation will be overwritten in OnInitDialog() by the + // GetDocumentValues() method before they are ever used. However, it is + // good practice for constructors to initialize all its essential + // parameters. + m_byteVal = 10; + m_shortVal = 0; + m_intVal = 0; + m_UINTVal = 10; + m_longVal = 0L; + m_ULongVal = 10; + m_floatVal = 0.0; + m_doubleVal = 0.0; + m_LPWSTRVal[0] = L'\0'; + m_checkVal[0] = FALSE; + m_checkVal[1] = FALSE; + m_checkVal[2] = FALSE; + m_radioA = 0; + m_editVal.Empty(); + m_richEditVal.Empty(); + m_listBoxVal.Empty(); + m_listBoxIndx = 0; + m_comboBoxVal.Empty(); + m_comboBoxIndx = 0; + m_sliderVal = 0; + m_progressVal = 0; + m_scrollBarVal = 0; + CTime t = CTime::GetCurrentTime(); + t.GetAsSystemTime(m_dateSysTime); + m_calDateSysTime = m_dateSysTime; + // buttons + m_buttonFgClr = COLOR_BLACK; + m_buttonBgClr = COLOR_CYAN; + m_buttonBgBrush.CreateSolidBrush(COLOR_LT_CYAN); + // edit boxes + m_editFgClr = COLOR_WHITE; + m_editBgClr = COLOR_RED; + m_editBgBrush.CreateSolidBrush(COLOR_LT_RED); + // the dialog box + m_dialogFgClr = COLOR_WHITE; + m_dialogBgClr = COLOR_BLUE; + m_dialogBgBrush.CreateSolidBrush(COLOR_LILAC); + // list boxes + m_listBoxFgClr = COLOR_BLACK; + m_listBoxBgClr = COLOR_GREEN; + m_listBoxBgBrush.CreateSolidBrush(COLOR_LT_GREEN); + // scroll bars (when used) + m_scrollFgClr = COLOR_WHITE; + m_scrollBgClr = COLOR_MAGENTA; + m_scrollBgBrush.CreateSolidBrush(COLOR_LT_MAGENTA); + // static boxes + m_staticBoxFgClr = COLOR_BLACK; + m_staticBoxBgClr = COLOR_YELLOW; + m_staticBoxBgBrush.CreateSolidBrush(COLOR_LT_YELLOW); + // richedit controls (these are set differently than the others) + m_richEditFgClr = COLOR_WHITE; + m_richEditBgClr = COLOR_RED; + m_richEditClientBgClr = COLOR_LT_RED; +} + +/*============================================================================*/ + BOOL CView:: +AddToolTip(UINT id) /* + + Add the string with the resource id to the control whose resource + identifier is also id. Return TRUE on success, FALSE otherwise. +*-----------------------------------------------------------------------------*/ +{ + return AddToolTip(id, LoadString(id)); +} + +/*============================================================================*/ + BOOL CView:: +AddToolTip(UINT id, const CString & sToolTip) /* + + Add the sToolTip string to the control whose resource identifier is + id. Return TRUE on success, FALSE otherwise. +*-----------------------------------------------------------------------------*/ +{ + HWND ctl = ::GetDlgItem(*this, id); + if (ctl == nullptr) + { + TRACE("cannot connect tooltip: " + sToolTip); + return FALSE; + } + if (!m_toolTip.AddTool(ctl, sToolTip.c_str())) + { + TRACE("unable to add tooltip: " + sToolTip); + return FALSE; + } + return TRUE; +} + +/*============================================================================*/ + void CView:: +AdjustStatus() /* + + Set the status control to reflect the values of variable controls on the + dialog. +*-----------------------------------------------------------------------------*/ +{ + LPCWSTR TorF[] = {L"OFF", L"ON"}; + + // display the DateTime control content + CTime t(m_dateSysTime); + CString dt = t.Format(L"%d-%b-%Y %H:%M:%S"); + // display the MonthCalendar control content + t = m_calDateSysTime; + CString mc = t.Format(L"%d-%b-%Y"); + + // set m_statusBoxVal to display values of all controls + LPCWSTR fmt = L"STATUS Button Pressed.\nStatus is:\n\n" + L"ID of focus is %d\n" + L"BYTE is %hu\n" + L"short is %hd\n" + L"int is %d\n" + L"UINT is %u\n" + L"long is %ld\n" + L"ULONG is %lu\n" + L"float is %g\n" + L"double is %g\n" + L"LPWSTR is %s\n" + L"Text Box is '%s'\n" + L"RichEdit is '%s'\n" + L"ListBox is '%s'\n" + L"ComboBox is '%s'\n" + L"Radio_%s is selected\n" + L"Check Box A is %s\n" + L"Check Box B is %s\n" + L"Check Box C is %s\n" + L"Slider Pos is %d\n" + L"ScrollBar is %d\n" + L"Progress is %d\n" + L"DateTime is %s\n" + L"Month Clndr is %s\n" + ; + m_statusBoxVal.Format(fmt, + m_focusID, + m_byteVal, + m_shortVal, + m_intVal, + m_UINTVal, + m_longVal, + m_ULongVal, + m_floatVal, + m_doubleVal, + m_LPWSTRVal, + m_editVal.c_str(), + m_richEditVal.c_str(), + m_listBoxVal.c_str(), + m_comboBoxVal.c_str(), + unit[m_radioA].c_str(), + TorF[m_checkVal[0]], + TorF[m_checkVal[1]], + TorF[m_checkVal[2]], + m_sliderVal, + m_scrollBarVal, + m_progressVal, + dt.c_str(), + mc.c_str() + ); +} + +/*============================================================================*/ + void CView:: +AssignToolTips() /* + + Assign tool tips to all controls in the client area. +*-----------------------------------------------------------------------------*/ +{ + HWND hParent = *this; + if (!m_toolTip.Create(hParent)) + { + TRACE("unable to create tool tips\n"); + return; + } + m_toolTip.AddTool(hParent, L"Client area"); + AddToolTip(IDC_RADIO_A); + AddToolTip(IDC_RADIO_B); + AddToolTip(IDC_RADIO_C); + AddToolTip(IDC_PUSH_ME_BUTTON); + AddToolTip(IDC_CHECK_A); + AddToolTip(IDC_CHECK_B); + AddToolTip(IDC_CHECK_C); + AddToolTip(IDOK); + AddToolTip(IDC_LISTBOX); + AddToolTip(IDC_EDIT_CSTRING); + AddToolTip(IDC_EDIT_RICHEDIT); + AddToolTip(IDC_STATUS_GROUP); + AddToolTip(IDC_EDIT_STATUS); + AddToolTip(IDC_ROSE_BITMAP); + AddToolTip(IDC_EDIT_BYTE); + AddToolTip(IDC_EDIT_SHORT); + AddToolTip(IDC_EDIT_INT); + AddToolTip(IDC_EDIT_UINT); + AddToolTip(IDC_EDIT_LONG); + AddToolTip(IDC_EDIT_DWORD); + AddToolTip(IDC_EDIT_FLOAT); + AddToolTip(IDC_EDIT_DOUBLE); + AddToolTip(IDC_EDIT_LPWSTR); + AddToolTip(IDC_CALENDAR); + AddToolTip(IDC_DATE_TIME); + AddToolTip(IDC_SCROLLBAR); + AddToolTip(IDC_PROGRESSBAR); + AddToolTip(IDC_SLIDER); + AddToolTip(IDC_COMBOBOX); + m_toolTip.Activate(TRUE); +} + +/*============================================================================*/ + INT_PTR CView:: +DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) /* + + Process the view messages: control colors and owner-drawn buttons. +*-----------------------------------------------------------------------------*/ +{ + try + { + // Add case statements for each messages to be handled here + switch (msg) + { + case WM_CTLCOLORBTN: + case WM_CTLCOLOREDIT: + case WM_CTLCOLORDLG: // sent to dialog boxes directly, not here! + case WM_CTLCOLORLISTBOX: + case WM_CTLCOLORSCROLLBAR: + case WM_CTLCOLORSTATIC: + // for these messages, wparam has the control's hdc and + // lparam has the control's hwnd + return OnCtlColor(reinterpret_cast(wparam), + reinterpret_cast(lparam), msg); + + case WM_DRAWITEM: + { + LPDRAWITEMSTRUCT lpDrawItemStruct = + reinterpret_cast(lparam); + UINT id = static_cast(wparam); + if (id == IDOK) + m_statusButton.DrawItem(lpDrawItemStruct); + if (id == IDC_PUSH_ME_BUTTON) + m_pushButton.DrawItem(lpDrawItemStruct); + return TRUE; + } + + case WM_HSCROLL: + { + HWND wnd = reinterpret_cast(lparam); + int pos = 0; + if (wnd == HWND(m_scrollBar)) + pos = m_scrollBar.GetHScrollPos(msg, wparam, lparam); + else if (wnd == HWND(m_slider)) + pos = m_slider.GetPos(); + SetControlPositions(pos); + return TRUE; + } + + } + // Pass unhandled messages on to parent DialogProc + return DialogProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + +/*============================================================================*/ + void CView:: +DoDataExchange(CDataExchange& dx) /* + + Specify the controls used for Dialog Data Exchange (DDX) and Dialog Data + Verification (DDV). This function is invoked each time UpdateData is called. +*-----------------------------------------------------------------------------*/ +{ + // DDX_Control is used to attach controls to the numeric ID + dx.DDX_Control(IDC_COMBOBOX, m_comboBox); + dx.DDX_Control(IDC_LISTBOX, m_listBox); + dx.DDX_Control(IDC_EDIT_RICHEDIT, m_richEdit); + dx.DDX_Control(IDOK, m_statusButton); + dx.DDX_Control(IDC_PUSH_ME_BUTTON, m_pushButton); + dx.DDX_Control(IDC_SLIDER, m_slider); + dx.DDX_Control(IDC_PROGRESSBAR, m_progressBar); + dx.DDX_Control(IDC_SCROLLBAR, m_scrollBar); + dx.DDX_Control(IDC_DATE_TIME, m_dateTime); + dx.DDX_Control(IDC_CALENDAR, m_monthCal); + + // The other DDX functions transfer the control's to data to or from + // the specified variable. + // The DDV functions specify the range of valid data for the control. + + // connect byte box to m_byteVal and specify limits + dx.DDX_Text(IDC_EDIT_BYTE, m_byteVal); + dx.DDV_MinMaxByte( m_byteVal, 10, 200); + // connect short box to m_shortVal and specify limits + dx.DDX_Text(IDC_EDIT_SHORT, m_shortVal); + dx.DDV_MinMaxShort( m_shortVal, -1000, 1000); + // connect int box to m_intVal and specify limits + dx.DDX_Text(IDC_EDIT_INT, m_intVal); + dx.DDV_MinMaxInt( m_intVal, -10000, 10000); + // connect UINT box to m_UINTVal and specify limits + dx.DDX_Text(IDC_EDIT_UINT, m_UINTVal); + dx.DDV_MinMaxUInt( m_UINTVal, 10, 10000); + // connect long box to m_longVal and specify limits + dx.DDX_Text(IDC_EDIT_LONG, m_longVal); + dx.DDV_MinMaxLong( m_longVal, -100000, 100000); + // connect ULONG box to m_ULongVal and specify limits + dx.DDX_Text(IDC_EDIT_DWORD, m_ULongVal); + dx.DDV_MinMaxULong( m_ULongVal, 10, 100000); + // connect float box to m_floatVal and specify limits + dx.DDX_Text(IDC_EDIT_FLOAT, m_floatVal); + dx.DDV_MinMaxFloat( m_floatVal, -10.0, 100000.0); + // connect double box to m_doubleVal and specify limits + dx.DDX_Text(IDC_EDIT_DOUBLE, m_doubleVal); + dx.DDV_MinMaxDouble( m_doubleVal, -10.0, 100000.); + // connect the LPWSTR box and specify length + dx.DDX_Text(IDC_EDIT_LPWSTR, m_LPWSTRVal, 255); + dx.DDV_MaxChars( m_LPWSTRVal, 25); + // connect the regular edit box to m_editVal and specify length + dx.DDX_Text(IDC_EDIT_CSTRING, m_editVal); + dx.DDV_MaxChars( m_editVal, 25); + // connect the rich edit box to m_richEditVal for string operations + dx.DDX_Text(IDC_EDIT_RICHEDIT, m_richEditVal); + dx.DDV_MaxChars( m_richEditVal, 25); // limit length + // connect the slider control to m_sliderVal and specify limits + dx.DDX_Slider(IDC_SLIDER, m_sliderVal); + dx.DDV_MinMaxSlider( m_sliderVal, 0, 1000); + // connect the progress bar to m_progressVal + dx.DDX_Progress(IDC_PROGRESSBAR, m_progressVal); + // connect scroll bar to m_scrollBarVal + dx.DDX_Scroll(IDC_SCROLLBAR, m_scrollBarVal); + // connect the radio boxes + dx.DDX_Radio( IDC_RADIO_A, m_radioA); + // connect check boxes + dx.DDX_Check(IDC_CHECK_A, m_checkVal[0]); + dx.DDX_Check(IDC_CHECK_B, m_checkVal[1]); + dx.DDX_Check(IDC_CHECK_C, m_checkVal[2]); + // Note: Data in a combo box may be accessed two ways: by string or by + // index. Only one of these two methods should be used. Comment the + // other out below. + dx.DDX_CBString(IDC_COMBOBOX, m_comboBoxVal); // use string method +// dx.DDX_CBIndex(IDC_COMBOBOX, m_comboBoxIndx); // use index method +// m_comboBox.GetLBText(m_comboBoxIndx, m_comboBoxVal.GetBuffer(256)); +// m_comboBoxVal.ReleaseBuffer(); + + // Note: Data in a list box may be accessed two ways: by string or by + // index. Only one of these two methods should be used. Comment the + // other out below. + dx.DDX_LBString(IDC_LISTBOX, m_listBoxVal); // use string method +// dx.DDX_LBIndex(IDC_LISTBOX, m_listBoxIndx); // use index method +// m_listBox.GetText(m_listBoxIndx, m_listBoxVal.GetBuffer(256)); +// m_listBoxVal.ReleaseBuffer(); + + // engage the DateTime control and specify +/-30 days + CTime tnow = CTime::GetCurrentTime(); + CTimeSpan tmo = 30 * 86400; + CTime tMin = tnow - tmo, + tMax = tnow + tmo; + SYSTEMTIME stMin, stMax; + tMin.GetAsSystemTime(stMin); + tMax.GetAsSystemTime(stMax); + dx.DDX_DateTime(IDC_DATE_TIME, m_dateSysTime); + dx.DDV_MinMaxDateTime(m_dateSysTime, stMin, stMax); + // engage the Month Calendar control and specify +/-30 days + dx.DDX_MonthCal(IDC_CALENDAR, m_calDateSysTime); + dx.DDV_MinMaxMonth(m_calDateSysTime, stMin, stMax); + // connect the status box + dx.DDX_Text(IDC_EDIT_STATUS, m_statusBoxVal); +} + +/*============================================================================*/ + void CView:: +GetDocumentValues() /* + + Load those things from the document that it saves. +*-----------------------------------------------------------------------------*/ +{ + m_byteVal = m_doc.GetByte(); + m_shortVal = m_doc.GetShort(); + m_intVal = m_doc.GetInt(); + m_UINTVal = m_doc.GetUINT(); + m_longVal = m_doc.GetLong(); + m_ULongVal = m_doc.GetULong(); + m_floatVal = m_doc.GetFloat(); + m_doubleVal = m_doc.GetDouble(); + m_radioA = m_doc.GetRadio(); + m_checkVal[0] = m_doc.GetCheckA(); + m_checkVal[1] = m_doc.GetCheckB(); + m_checkVal[2] = m_doc.GetCheckC(); + m_editVal = m_doc.GetEditBox(); + m_richEditVal = m_doc.GetRichEditBox(); + m_listBoxVal = m_doc.GetListBoxS(); + m_listBoxIndx = m_doc.GetListBoxX(); + m_comboBoxVal = m_doc.GetComboBoxS(); + m_comboBoxIndx = m_doc.GetComboBoxX(); + m_sliderVal = m_doc.GetSlider(); + m_dateSysTime = m_doc.GetDateTime(); + m_calDateSysTime = m_doc.GetMoCalendar(); + StrCopy(m_LPWSTRVal, m_doc.GetLPWSTR(), 256); +} + +/*============================================================================*/ + void CView:: +OnBitmap() /* + + Activate the DDX/DDV mechanism to read current values from the dialog + form and to set the status box to indicate this button was pressed. +*-----------------------------------------------------------------------------*/ +{ + // save current contents of controls + UpdateData(m_dx, READFROMCONTROL); + // reset status to just this message: + m_statusBoxVal = L"The moondance rose."; + // post the message + UpdateData(m_dx, SENDTOCONTROL); + TRACE("Bitmap Pressed\n"); +} + +/*============================================================================*/ + void CView:: +OnButton() /* + + Activate the DDX/DDV mechanism to read current values from the dialog + form and to set the status box to indicate this button was pressed. +*-----------------------------------------------------------------------------*/ +{ + // read current contents of controls to memory + UpdateData(m_dx, READFROMCONTROL); + // reset the status message to just this: + m_statusBoxVal = L"PUSH ME button Pressed"; + // send this status message (and also the other values) back into + // the control + UpdateData(m_dx, SENDTOCONTROL); + TRACE("PUSH ME button Pressed\n"); +} + +/*============================================================================*/ + BOOL CView:: +OnCommand(WPARAM wparam, LPARAM) /* + + The framework calls this member function when the user selects an item + from a menu, when a child control sends a notification message, or when + an accelerator keystroke is translated. +*-----------------------------------------------------------------------------*/ +{ + WORD id = LOWORD(wparam); + WORD ctl = HIWORD(wparam); + switch (id) + { + case IDC_PUSH_ME_BUTTON: + OnButton(); + m_focusID = id; + return TRUE; + + case IDC_ROSE_BITMAP: + OnBitmap(); + m_focusID = id; + return TRUE; + + case IDC_EDIT_STATUS: + m_focusID = id; + return TRUE; + + + case IDC_RADIO_A: + case IDC_RADIO_B: + case IDC_RADIO_C: + SetRadioAStatus(); + return TRUE; + + case IDC_CHECK_A: + SetCheckAStatus(); + return TRUE; + + case IDC_CHECK_B: + SetCheckBStatus(); + return TRUE; + + case IDC_CHECK_C: + SetCheckCStatus(); + return TRUE; + } + // deal with setting the focus for edit controls, combo boxes, + // list boxes, radio buttons, and check boxes + if (ctl == EN_SETFOCUS || ctl == CBN_SETFOCUS || ctl == LBN_SETFOCUS + || (ctl == BN_SETFOCUS && IDC_RADIO_A <= id && id <= IDC_CHECK_C)) + { + m_focusID = id; + return FALSE; + } + return FALSE; +} + +/*============================================================================*/ + INT_PTR CView:: +OnCtlColor(HDC dc, HWND hWnd, UINT nCtlColor) /* + + This member function is invoked when a child control is about to be + drawn. It can be used to prepare the display context dc for drawing + the control using user-selected colors. +*-----------------------------------------------------------------------------*/ +{ + // get the control numeric ID, when needed + UINT id = ::GetDlgCtrlID(hWnd); + // get the display context + CDC dcCtl(dc); + // to avoid compiler warnings, declare control colors and + // assign them arbitrary (because unused) values + COLORREF fg = COLOR_BLACK; + COLORREF bk = COLOR_BLACK; + CBrush br = CBrush(COLOR_BLACK); + // handle each color message separately + switch (nCtlColor) + { + case WM_CTLCOLORBTN: + // handle each button separately (but here, they have the + // same colors) + if (id == IDOK) + { + fg = m_buttonFgClr; + bk = m_buttonBgClr; + br = m_buttonBgBrush; + } + if (id == IDC_PUSH_ME_BUTTON) + { + fg = m_buttonFgClr; + bk = m_buttonBgClr; + br = m_buttonBgBrush; + } + break; + + case WM_CTLCOLOREDIT: + fg = m_editFgClr; + bk = m_editBgClr; + br = m_editBgBrush; + break; + + case WM_CTLCOLORDLG: + fg = m_dialogFgClr; + bk = m_dialogBgClr; + br = m_dialogBgBrush; + break; + + case WM_CTLCOLORLISTBOX: + fg = m_listBoxFgClr; + bk = m_listBoxBgClr; + br = m_listBoxBgBrush; + break; + + case WM_CTLCOLORSCROLLBAR: + fg = m_scrollFgClr; + bk = m_scrollBgClr; + br = m_scrollBgBrush; + break; + + case WM_CTLCOLORSTATIC: + // change caption color of group box + if (id == IDC_STATUS_GROUP) + { + fg = m_dialogFgClr; + bk = m_dialogBgClr; + br = m_dialogBgBrush; // doesn't do anything + } + else if (IDC_RADIO_A <= id && id <= IDC_CHECK_C) + { + fg = m_buttonFgClr; + bk = m_buttonBgClr; + br = m_buttonBgBrush; + } + else + { + fg = m_staticBoxFgClr; + bk = m_staticBoxBgClr; + br = m_staticBoxBgBrush; + } + break; + } + // set the foreground and background device contexts + dcCtl.SetTextColor(fg); + dcCtl.SetBkColor(bk); + // Keep changes to the device context + dcCtl.Detach(); + // return the brush handle + return (INT_PTR)br.GetHandle(); +} + +/*============================================================================*/ + BOOL CView:: +OnInitDialog() /* + + This method is activated before the dialog box just before is displayed. + Insert instructions that are needed to perform special processing when the + dialog box is initialized. The return value is always TRUE. +*-----------------------------------------------------------------------------*/ +{ + // Set the Icon + SetIconLarge(IDW_MAIN); + SetIconSmall(IDW_MAIN); + // add tool tips to controls in client area + AssignToolTips(); + // Connect controls to IDs and read default data values into them. + UpdateData(m_dx, SENDTOCONTROL); + // Set the rich edit control text foreground and background colors + // and the control background color. This is needed only once (not + // like other controls set in OnCtlColor()). + CHARFORMAT2 chf; + chf.cbSize = sizeof(chf); + chf.dwMask = CFM_COLOR | CFM_BACKCOLOR; + chf.dwEffects = 0; + chf.crTextColor = m_richEditFgClr; + chf.crBackColor = m_richEditBgClr; + m_richEdit.SetDefaultCharFormat(chf); + m_richEdit.SetBackgroundColor(FALSE, m_richEditClientBgClr); + // initialize some of the subclassed controls for this test: + // list box, combo box, slider, progress bar, and scroll bar: + // put some text in the list box (normally, entries might be + // retrieved from the document, saved in the registry, but here, + // for simplicity, we just enter some sample values) + m_listBox.ResetContent(); + for (int i = 0 ; i < 10 ; i++) + { + CString s; + s.Format(L"List Box%d", i); + m_listBox.AddString(s); + } + // ditto for the combo box + m_comboBox.ResetContent(); + for (int j = 0 ; j < 8 ; j++) + { + CString s; + s.Format(L"Combo Box%d", j); + m_comboBox.AddString(s); + } + // set the slider, progress, and scroll bar ranges + int lo = 0; + int page = 20; + int hi = 50 * page; + m_scrollBar.SetScrollInfo(lo, hi, 0, page); + // set slider range and page size + m_slider.SetRangeMin(lo); + m_slider.SetRangeMax(hi); + m_slider.SetPageSize(page); + m_progressBar.SetRange((short)lo, (short)hi); + // set Date-Time display format + m_dateTime.SetFormat(L"dd'-'MMM'-'yyyy' 'HH':'mm':'ss"); + // retrieve values from the document + GetDocumentValues(); + // gang together progress, scroll bar, and slider + m_progressVal = m_scrollBarVal = m_sliderVal; + return TRUE; +} + +/*============================================================================*/ + void CView:: +OnOK() /* + + Called when the user clicks the button with an ID of IDOK. Display the + contents of all controls and save those that are part of the document. +*-----------------------------------------------------------------------------*/ +{ + UpdateData(m_dx, READFROMCONTROL); + AdjustStatus(); + UpdateData(m_dx, SENDTOCONTROL); + UpdateDocument(); + TRACE("STATUS Button Pressed.\n\n"); +} + +/*============================================================================*/ + LRESULT CView:: +OnNotify(WPARAM wparam, LPARAM lparam) /* + + Respond to WM_NOTIFY messages received from child windows. Here, typical + notifications from the data-time and month calendar controls are identified. +*-----------------------------------------------------------------------------*/ +{ + NMHDR *pNMHdr = reinterpret_cast(lparam); + switch (pNMHdr->code) + { + case NM_SETFOCUS: // date-time picker + case MCN_SELECT: // month calendar + case MCN_SELCHANGE: // " " + { + m_focusID = static_cast(wparam); + return TRUE; + } + } + return FALSE; +} + +/*============================================================================*/ + void CView:: +SetCheck(UINT check) /* + + Toggle the check box control whose ID is (IDC_CHECK_A + check). +*-----------------------------------------------------------------------------*/ +{ + // toggle the check control + m_checkVal[check] = (m_checkVal[check]? FALSE : TRUE); + // set the status + m_statusBoxVal = "Check " + unit[check] + " set " + + (m_checkVal[check] ? "ON." : "OFF."); + UpdateData(m_dx, SENDTOCONTROL); +} + +/*============================================================================*/ + void CView:: +SetCheckAStatus() /* + + Show the status of the A check control. +*-----------------------------------------------------------------------------*/ +{ + UpdateData(m_dx, READFROMCONTROL); + m_statusBoxVal << "Check A set " << (m_checkVal[0] ? "ON." : "OFF."); + UpdateData(m_dx, SENDTOCONTROL); +} + +/*============================================================================*/ + void CView:: +SetCheckBStatus() /* + + Show the status of the B check control. + +*-----------------------------------------------------------------------------*/ +{ + UpdateData(m_dx, READFROMCONTROL); + m_statusBoxVal << "Check B set " << (m_checkVal[1] ? "ON." : "OFF."); + UpdateData(m_dx, SENDTOCONTROL); +} + +/*============================================================================*/ + void CView:: +SetCheckCStatus() /* + + Show the status of the C check control. +*-----------------------------------------------------------------------------*/ +{ + UpdateData(m_dx, READFROMCONTROL); + m_statusBoxVal << "Check C set " << (m_checkVal[2] ? "ON." : "OFF."); + UpdateData(m_dx, SENDTOCONTROL); +} + +/*============================================================================*/ + void CView:: +SetRadio(UINT id) /* + + Set the radio control to select that whose ID is (IDC_RADIO_A + id), and + set the status box radio value accordingly. +*-----------------------------------------------------------------------------*/ +{ + m_radioA = id; + m_statusBoxVal = CString("Radio button set to ") + unit[m_radioA]; + UpdateData(m_dx, SENDTOCONTROL); +} + +/*============================================================================*/ + void CView:: +SetRadioAStatus() /* + + Set the status box radio button value to that in the DDX specification. +*-----------------------------------------------------------------------------*/ +{ + UpdateData(m_dx, READFROMCONTROL); + m_statusBoxVal = CString("Radio button set to ") + unit[m_radioA]; + UpdateData(m_dx, SENDTOCONTROL); +} + +/*============================================================================*/ + void CView:: +SetControlPositions(int pos) /* + + Set the slider, scroll, and progress bars to the given pos. +*-----------------------------------------------------------------------------*/ +{ + SetSlider(pos); + SetScrollBar(pos); + SetProgress(pos); + AdjustStatus(); + + // Update the slider, scrollbar, progressbar and status windows. + UpdateData(m_dx, SENDTOCONTROL); +} + +/*============================================================================*/ + void CView:: +UpdateDocument() /* + + Save the pertinent members of the view that are also members of the + document. +*-----------------------------------------------------------------------------*/ +{ + m_doc.SetByte(m_byteVal); + m_doc.SetShort(m_shortVal); + m_doc.SetInt(m_intVal); + m_doc.SetUINT(m_UINTVal); + m_doc.SetLong(m_longVal); + m_doc.SetULong(m_ULongVal); + m_doc.SetFloat(m_floatVal); + m_doc.SetDouble(m_doubleVal); + m_doc.SetLPWSTR(m_LPWSTRVal); + m_doc.SetEditBox(m_editVal); + m_doc.SetRichEditBox(m_richEditVal); + m_doc.SetListBoxS(m_listBoxVal); + m_doc.SetListBoxX(m_listBoxIndx); + m_doc.SetComboBoxS(m_comboBoxVal); + m_doc.SetComboBoxX(m_comboBoxIndx); + m_doc.SetRadio(m_radioA); + m_doc.SetCheckA(m_checkVal[0]); + m_doc.SetCheckB(m_checkVal[1]); + m_doc.SetCheckC(m_checkVal[2]); + m_doc.SetSlider(m_sliderVal); + m_doc.SetDateTime(m_dateSysTime); + m_doc.SetMoCalendar(m_calDateSysTime); +} + +/*============================================================================*/ + BOOL CView:: +UpdateDialog(BOOL bReadFromControl) /* + + Update the DDX controls according to bReadFromControl and save document + values if successful. Return TRUE on success, FALSE on failure. +*-----------------------------------------------------------------------------*/ +{ + if (bReadFromControl == SENDTOCONTROL) + AdjustStatus(); + BOOL ok = UpdateData(m_dx, bReadFromControl); + if (ok) + { // all is well + TRACE("Verification passed\n"); + UpdateDocument(); + } + else + { // oops! there is a problem with some of the control data + TRACE("*** Verification failed ***\n"); + } + return ok; +} +/*----------------------------------------------------------------------------*/ diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/View.h b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/View.h new file mode 100644 index 00000000..a084b5c3 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/View.h @@ -0,0 +1,156 @@ +/* (20-Oct-2024) [Tab/Indent: 8/8][Line/Box: 80/74] (View.h) * +******************************************************************************** +| | +| Author: Robert C. Tausworthe, 2020 | +| | +===============================================================================* + + Contents Description: The DDXDemo CView class declaration. This class + defines the appearance and related actions of the DDX/DDV test program. + This class is a modified version of that found in the FormDocView sample + distributed with the Win32++ Windows interface classes. The modified sample + program was based on code provided by Lynn Allan. This program extends the + given sample by application of Dialog Data Exchange and Validation (DDX/DDV). + + Programming Notes: The programming style roughly follows that established + by the 1995-1999 Jet Propulsion Laboratory Deep Space Network Planning and + Preparation Subsystem project for C++ programming. + + Acknowledgement: The author would like to thank and acknowledge the advice, + critical review, insight, and assistance provided by David Nash in the + development of this work. + +*******************************************************************************/ + +#ifndef SDI_VIEW_H +#define SDI_VIEW_H + +#include "MyButton.h" +#include "MyScrollbar.h" +#include "Doc.h" + +/*============================================================================*/ + class +CView : public CDialog /* + + Declaration of the CView class of the App-Frame-Doc-View architecture. +*----------------------------------------------------------------------------*/ +{ + public: + CView(UINT nResID); + virtual ~CView() override = default; + + void AdjustStatus(); + BOOL GetCheckA() const { return m_checkVal[0]; } + BOOL GetCheckB() const { return m_checkVal[1]; } + BOOL GetCheckC() const { return m_checkVal[2]; } + int GetRadio() const { return m_radioA; } + void SetCheck(UINT); + void SetRadio(UINT); + void SetCheckAStatus(); + void SetCheckBStatus(); + void SetCheckCStatus(); + void SetFocusID(int value) { m_focusID = value; } + void SetProgress(int value) { m_progressVal = value; } + void SetRadioAStatus(); + void SetScrollBar(int value) { m_scrollBarVal = value; } + void SetSlider(int value) { m_sliderVal = value; } + CDoc& TheDoc() { return m_doc; } + BOOL UpdateDialog(BOOL bReadFromControl); + void UpdateDocument(); + + protected: + virtual void DoDataExchange(CDataExchange& dx) override; + virtual BOOL OnInitDialog() override; + virtual void OnOK() override; + virtual LRESULT OnNotify(WPARAM wparam, LPARAM lparam) override; + virtual INT_PTR DialogProc(UINT, WPARAM, LPARAM) override; + virtual void OnCancel() override {} // Suppress esc key closing the dialog + virtual BOOL OnCommand(WPARAM wparam, LPARAM lparam) override; + + private: + CView(const CView&) = delete; + CView& operator=(const CView&) = delete; + + BOOL AddToolTip(UINT id); + BOOL AddToolTip(UINT id, const CString & s); + void AssignToolTips(); + void GetDocumentValues(); + void OnBitmap(); + void OnButton(); + INT_PTR OnCtlColor(HDC, HWND, UINT); + void SetControlPositions(int pos); + + // DDX/DDV variables that are connected + int m_sliderVal; + int m_progressVal; + int m_scrollBarVal; + int m_focusID; // the control with current focus + // DDX/DDV variables for controls on the form + CDataExchange m_dx; + BYTE m_byteVal; + short m_shortVal; + UINT m_UINTVal; + long m_longVal; + DWORD m_ULongVal; + float m_floatVal; + double m_doubleVal; + int m_intVal; + BOOL m_checkVal[3]; + int m_comboBoxIndx; + int m_listBoxIndx; + int m_radioA; + CString m_comboBoxVal; + CString m_listBoxVal; + CString m_editVal; + CString m_richEditVal; + CString m_statusBoxVal; + WCHAR m_LPWSTRVal[256]; + SYSTEMTIME m_dateSysTime; + SYSTEMTIME m_calDateSysTime; + + // controls on the form that need to be attached + CComboBox m_comboBox; + CDateTime m_dateTime; + CListBox m_listBox; + CMonthCalendar m_monthCal; + CProgressBar m_progressBar; + CRichEdit m_richEdit; + CMyScrollBar m_scrollBar; + CMyButton m_statusButton; + CMyButton m_pushButton; + CSlider m_slider; + + // form control display colors + COLORREF m_buttonFgClr; + COLORREF m_buttonBgClr; + COLORREF m_editFgClr; + COLORREF m_editBgClr; + COLORREF m_richEditFgClr; + COLORREF m_richEditBgClr; + COLORREF m_richEditClientBgClr; + COLORREF m_dialogFgClr; + COLORREF m_dialogBgClr; + COLORREF m_listBoxFgClr; + COLORREF m_listBoxBgClr; + COLORREF m_scrollFgClr; + COLORREF m_scrollBgClr; + COLORREF m_staticBoxFgClr; + COLORREF m_staticBoxBgClr; + + // form display background brushes + CBrush m_buttonBgBrush; + CBrush m_editBgBrush; + CBrush m_dialogBgBrush; + CBrush m_listBoxBgBrush; + CBrush m_scrollBgBrush; + CBrush m_staticBoxBgBrush; + + // form tool tips + CToolTip m_toolTip; + + // the document + CDoc m_doc; +}; +/*----------------------------------------------------------------------------*/ +#endif //SDI_VIEW_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/res/Form.ico b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/res/Form.ico new file mode 100644 index 00000000..e5397f81 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/res/Form.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/res/PerMonitorV2.manifest b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/res/PerMonitorV2.manifest new file mode 100644 index 00000000..1831ddb6 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/res/PerMonitorV2.manifest @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + PerMonitorV2, PerMonitor + + + + + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/res/Toolbar16.bmp b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/res/Toolbar16.bmp new file mode 100644 index 00000000..79ad442f Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/res/Toolbar16.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/res/Toolbar24.bmp b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/res/Toolbar24.bmp new file mode 100644 index 00000000..4000d938 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/res/Toolbar24.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/res/moondance.bmp b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/res/moondance.bmp new file mode 100644 index 00000000..74437fd6 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/res/moondance.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/resource.h b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/resource.h new file mode 100644 index 00000000..96048758 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/resource.h @@ -0,0 +1,91 @@ +/* (20-Oct-2024) [Tab/Indent: 8/8][Line/Box: 80/74] (resource.h) * +******************************************************************************** +| | +| Author: Robert C. Tausworthe, 2020 | +| | +===============================================================================* + + Contents Description: Declaration of the DDXDemo sample program resource + identifers used by its resource.rc and other members. This resource file + is a modified version of that found in the FormDocView sample + distributed with the Win32++ Windows interface classes. The modified sample + program was based on code provided by Lynn Allan. This program extends the + given sample by application of Dialog Data Exchange and Validation (DDX/DDV). + + Acknowledgement: The author would like to thank and acknowledge the advice, + critical review, insight, and assistance provided by David Nash in the + development of this work. + +*******************************************************************************/ + +#ifndef RESOURCE_H +#define RESOURCE_H + + // Include the Resource IDs defined by Win32++ +#include "default_resource.h" + + // Resource ID for the dialog +#define IDD_MAIN_DIALOG 100 + + // Resource IDs for standard menu items +#define IDM_FILE_NEW 200 +#define IDM_FILE_OPEN 201 +#define IDM_FILE_SAVE 202 +#define IDM_FILE_SAVEAS 203 +#define IDM_FILE_PRINT 204 +#define IDM_FILE_CLOSE 205 +#define IDM_FILE_EXIT 206 +#define IDM_EDIT_UNDO 207 +#define IDM_EDIT_REDO 208 +#define IDM_EDIT_CUT 209 +#define IDM_EDIT_COPY 210 +#define IDM_EDIT_PASTE 211 +#define IDM_EDIT_DELETE 212 + + // Resource IDs for the app's menu-items (also on dialog) +#define IDC_RADIO_A 300 +#define IDC_RADIO_B 301 +#define IDC_RADIO_C 302 +#define IDC_CHECK_A 303 +#define IDC_CHECK_B 304 +#define IDC_CHECK_C 305 + + // Resource IDs for dialog edit boxes +#define IDC_EDIT_BYTE 400 +#define IDC_EDIT_SHORT 401 +#define IDC_EDIT_INT 402 +#define IDC_EDIT_UINT 403 +#define IDC_EDIT_LONG 404 +#define IDC_EDIT_DWORD 405 +#define IDC_EDIT_FLOAT 406 +#define IDC_EDIT_DOUBLE 407 +#define IDC_EDIT_LPWSTR 408 +#define IDC_EDIT_CSTRING 409 +#define IDC_EDIT_RICHEDIT 410 +#define IDC_EDIT_STATUS 411 + + // Resource IDs for other controls +#define IDC_LISTBOX 500 +#define IDC_SLIDER 501 +#define IDC_PROGRESSBAR 502 +#define IDC_SCROLLBAR 503 +#define IDC_COMBOBOX 504 +#define IDC_DATE_TIME 505 +#define IDC_CALENDAR 506 +#define IDC_STATUS_GROUP 507 + + // Resource IDs for buttons (except STATUS = IDOK button) +#define IDC_PUSH_ME_BUTTON 600 +#define IDB_ROSE_BITMAP 601 +#define IDC_ROSE_BITMAP 602 + + // Resource ID for small menu icons +#define IDB_TOOLBAR16 603 + + // Resource IDs for the about dialog +#define IDC_STATIC1 610 +#define IDC_STATIC2 611 + +/*----------------------------------------------------------------------------*/ +#endif // RESOURCE_H + diff --git a/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/stdafx.h b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/stdafx.h new file mode 100644 index 00000000..08450116 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DDXDemo/src/stdafx.h @@ -0,0 +1,90 @@ +///////////////////////////// +// StdAfx.h +// + +// This file is used for precompiled headers. +// Rarely modified header files should be included. +// Based on code provided by Lynn Allan. + + +#ifndef STDAFX_H +#define STDAFX_H + + +// Predefinitions for windows.h go here +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +// Specify Win32xx specific predefinitions here +//#define NO_USING_NAMESPACE // Don't use Win32xx namespace + +// Rarely modified header files should be included here +#include // Add support for std::vector +#include // Add support for std::map +#include // Add support for std::string +#include // Add support for stringstream +#include // Add support for the assert macro +#include // Add support for C style printf, sprintf, etc. +#include // Add support for C style character conversions atoi etc. +#include // Add support for C style TCHARs. + +// Add the Win32++ library +#include // Add CWinApp +#include // Add CArchive +#include // Add CAnimation, CComboBox, CComboBoxEx, CDateTime, CHeader, CHotKey, CIPAddress, CProgressBar, CSpinButton, CScrollBar, CSlider, CToolTip +#include // Add CCriticalSection, CThreadLock +#include // Add CString, CStringA, CStringW +#include // Add CDataExchange +#include // Add CDialog, CResizer +#include // Add CDockFrame, CMDIDockFrame +#include // Add CDocker, CDockContainer +#include // Add CException, CFileException, CNotSupportedException, CResourceException, CUserException, CWinException +#include // Add CFile +#include // Add CFileFind +#include // Add CFolderDialog +#include // Add CFrame +#include // Add CDC, CGDIObject, CBitmap, CBrush, CFont, CPalatte, CPen, CRgn +#include // Add CHGlobal +#include // Add CImageList +#include // Add CListView +#include // Add CMDIChild, CMDIFrame, CDockMDIFrame +#include // Add CMenu +#include // Add CMenuBar +#include // Add CMetaFile, CEnhMetaFile +#include // Add CEvent, CMutex, CSemaphore +#include // Add CPropertyPage, CPropertySheet +#include // Add CRebar +#include // Add CPoint, CRect, CSize +#include // Add CRegKey +#include // Add CRichEdit +#include // Add CScrollView +#include // Adds macros, windows header files, and CObject +#include // Add CSocket +#include // Add CStatusBar +#include // Add CButton, CEdit, CListBox +#include // Add CTab, CTabbedMDI +#include // Add AtoT, AtoW, TtoA, TtoW, WtoA, WtoT etc. +#include // Add MenuTheme, ReBarTheme, StatusBarTheme, ToolBarTheme +#include // Add CWinThread +#include // Add CTime +#include // Add CToolBar +#include // Add CTreeView +#include // Add CWebBrowser, CAXHost +#include // Add CWnd + +// WIN32_LEAN_AND_MEAN can't be used with these +#ifndef WIN32_LEAN_AND_MEAN + #include // Add CCommonDialog, CColorDialog, CFileDialog, CFindReplace, CFontDialog + #include // Add CFolderDialogEx + #include // Add CPrintPreview + #include // Add CPageSetupDialog, CPrintDialog + #include // Add CPrintDialogEx + #include // Add CTaskDialog + + // Visual Studio + #if defined (_MSC_VER) + #include // Add CRibbon, CRibbonFrame + #endif + +#endif // define WIN32_LEAN_AND_MEAN + +#endif // define STDAFX_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/ProjectFiles/DarkModeFrame_2022.sln b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/ProjectFiles/DarkModeFrame_2022.sln new file mode 100644 index 00000000..23ef8fa9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/ProjectFiles/DarkModeFrame_2022.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DarkModeFrame", "DarkModeFrame_2022.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {410357BD-E2A6-4C1A-B499-7EAA15077CE8} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/ProjectFiles/DarkModeFrame_2022.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/ProjectFiles/DarkModeFrame_2022.vcxproj new file mode 100644 index 00000000..3b192d27 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/ProjectFiles/DarkModeFrame_2022.vcxproj @@ -0,0 +1,244 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DarkMode + DarkFrame + 10.0 + + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/ProjectFiles/DarkModeFrame_2022.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/ProjectFiles/DarkModeFrame_2022.vcxproj.filters new file mode 100644 index 00000000..53261510 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/ProjectFiles/DarkModeFrame_2022.vcxproj.filters @@ -0,0 +1,242 @@ + + + + + {87c8779f-f84a-4e64-ae21-68dff40d2e27} + + + {347319b8-082d-4d49-ab28-709702a750f7} + + + {a2bed347-0929-43b3-9413-740cd73018cc} + + + {41edd5da-1621-4500-bafc-695726cbde5f} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/ProjectFiles/DarkModeFrame_2026.slnx b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/ProjectFiles/DarkModeFrame_2026.slnx new file mode 100644 index 00000000..e32bbfd4 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/ProjectFiles/DarkModeFrame_2026.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/ProjectFiles/DarkModeFrame_2026.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/ProjectFiles/DarkModeFrame_2026.vcxproj new file mode 100644 index 00000000..3196789d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/ProjectFiles/DarkModeFrame_2026.vcxproj @@ -0,0 +1,244 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DarkMode + DarkFrame + 10.0 + + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/ProjectFiles/DarkModeFrame_2026.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/ProjectFiles/DarkModeFrame_2026.vcxproj.filters new file mode 100644 index 00000000..53261510 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/ProjectFiles/DarkModeFrame_2026.vcxproj.filters @@ -0,0 +1,242 @@ + + + + + {87c8779f-f84a-4e64-ae21-68dff40d2e27} + + + {347319b8-082d-4d49-ab28-709702a750f7} + + + {a2bed347-0929-43b3-9413-740cd73018cc} + + + {41edd5da-1621-4500-bafc-695726cbde5f} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/Readme.txt new file mode 100644 index 00000000..49ae01e2 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/Readme.txt @@ -0,0 +1,51 @@ +DarkModeFrame Sample +==================== +This project demonstrates dark mode support with Win32++. + +This is a frame based application which automatically detects when the Windows +theme has dark mode enabled for applications, and adjust the frame's colors +accordingly. + +This code requires Visual Studio Community 2022 with the Windows App SDK +installed. The Windows App SDK can be installed using the VS2022 installer +as follows: +* Select Desktop development with C++. +* Then in the Installation details pane of the installation dialog box, + select Windows App SDK C++ Templates (at the bottom of the list). + +More detailed instructions can be found on the following web site. +https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/set-up-your-development-environment + +Some of the code in this sample is based on code provided here: +https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/apply-windows-themes + + +This sample detects both high contrast themes and dark mode themes. Dark mode +themes that are high contrast behave differently to normal dark mode themes. +Dark high contrast themes do the following: + Change the color of dropdown menu items. + Change the default color of all dialogs (including common dialogs). + Change the default color of all common controls. + +Normal window themes with dark mode enabled do the following: + Change the color of the common dialogs such as FileOpen. + +Summary of modifications to the Frame sample to support dark mode +----------------------------------------------------------------- + - Add the Windows App SDK to VS2022. + - Add DarkMode.cpp and DarkMode.h + - Add CDarkDialog (for a dark Help About). + - Override the following functions in CMainFrame + - OnHelp + - OnSysColorChange + - SetTheme, and add the dark theme. + - Modify CView::OnDraw + + +Features demonstrated in this example +===================================== +* How to detect when a dark mode theme is in use. +* How to detect when a high contrast theme is in use. +* How to automatically adjust the frame's colours to support dark mode. +* How to modify a dialog to support dark mode. + diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/DarkAbout.cpp b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/DarkAbout.cpp new file mode 100644 index 00000000..ec9e9376 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/DarkAbout.cpp @@ -0,0 +1,146 @@ +///////////////////////////// +// DarkAbout.cpp +// + +#include "stdafx.h" +#include +#include "DarkMode.h" +#include "DarkAbout.h" +#include "resource.h" + +/////////////////////////////////// +// CDarkAbout function definitions +// + +// Constructor. +CDarkAbout::CDarkAbout() : m_isDarkMode(false) +{ + SetDialogFromID(IDW_ABOUT); +} + +// Process the dialog's window messages. +INT_PTR CDarkAbout::DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case WM_CTLCOLORDLG: + case WM_CTLCOLORBTN: + case WM_CTLCOLORSTATIC: return OnCtlColors(msg, wparam, lparam); + case WM_DRAWITEM: return OnDrawItem(wparam, lparam); + } + + // Pass unhandled messages on to parent DialogProc. + return DialogProcDefault(msg, wparam, lparam); + } + + // catch all CException types + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + TaskDialogBox(nullptr, str1, str2, TD_ERROR_ICON); + } + + return 0; +} + +// Set the colors for the dialog and static controls. +LRESULT CDarkAbout::OnCtlColors(UINT, WPARAM wparam, LPARAM) +{ + if (m_isDarkMode) + { + HDC dc = reinterpret_cast(wparam); + ::SetBkMode(dc, TRANSPARENT); + ::SetTextColor(dc, RGB(255, 255, 255)); + + return reinterpret_cast(::GetStockObject(BLACK_BRUSH)); + } + + return 0; +} + +// Perform the owner draw for buttons. +LRESULT CDarkAbout::OnDrawItem(WPARAM, LPARAM lparam) +{ + LPDRAWITEMSTRUCT pDraw = (LPDRAWITEMSTRUCT)lparam; + CDC dc(pDraw->hDC); + CRect rect = pDraw->rcItem; + dc.SetTextColor(RGB(220, 220, 220)); + + if (pDraw->itemState & ODS_SELECTED) + { + dc.CreatePen(PS_SOLID, 1, RGB(140, 140, 140)); + dc.CreateSolidBrush(RGB(60, 60, 60)); + } + else + { + dc.CreatePen(PS_SOLID, 1, RGB(100, 100, 100)); + dc.CreateSolidBrush(RGB(80, 80, 80)); + } + + // Draw the button text. + CString str = GetDlgItemText(pDraw->CtlID); + rect.DeflateRect(1, 1); + dc.RoundRect(rect, 10, 10); + dc.DrawText(str, -1, rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE); + + return TRUE; +} + +// Called before the dialog is displayed. +BOOL CDarkAbout::OnInitDialog() +{ + // Add dark mode support for system menu. + SetPreferredAppMode(AllowDark); + + // Set the application icon. + SetIconLarge(IDW_MAIN); + SetIconSmall(IDW_MAIN); + + // Make the OK button owner drawn for dark mode. + SetButtonOwnerDraw(m_isDarkMode); + + // Set the caption to dark for dark mode. + BOOL value = IsDarkMode() ? TRUE : FALSE; + ::DwmSetWindowAttribute(*this, DWMWA_USE_IMMERSIVE_DARK_MODE, &value, sizeof(value)); + + // Set the Win32++ version string. + UINT ver = _WIN32XX_VER; + CString Win32xxVersion; + Win32xxVersion << "Win32++ Version " << ver / 0x100 << "." << + (ver % 0x100) / 0x10 << "." << (ver % 0x10); + + SetDlgItemText(IDC_STATIC1, Win32xxVersion); + SetDlgItemText(IDC_STATIC2, L"by David Nash"); + + return TRUE; +} + +// Use owner draw for buttons for dark mode. +void CDarkAbout::SetButtonOwnerDraw(bool isOwnerDraw) +{ + HWND ok = ::GetDlgItem(*this, IDOK); + DWORD style = static_cast(::GetWindowLongPtr(ok, GWL_STYLE)); + + if (isOwnerDraw) + ::SetWindowLongPtr(ok, GWL_STYLE, style | BS_OWNERDRAW); + else + ::SetWindowLongPtr(ok, GWL_STYLE, style & ~BS_OWNERDRAW); +} + +// Configure the dialog for dark mode. +void CDarkAbout::SetDarkMode(bool isDarkMode) +{ + // Make the OK button owner drawn for dark mode. + if (IsWindow()) + SetButtonOwnerDraw(isDarkMode); + + m_isDarkMode = isDarkMode; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/DarkAbout.h b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/DarkAbout.h new file mode 100644 index 00000000..7767bdae --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/DarkAbout.h @@ -0,0 +1,40 @@ +///////////////////////////// +// DarkAbout.h +// + +#ifndef _DARK_ABOUT_H_ +#define _DARK_ABOUT_H_ + + +/////////////////////////////////////////////////////////// +// CDarkAbout provides a dialog compatible with dark mode, +// for the Help About dialog. +// When a dark mode theme is active: +// - the dialog's background color is set to black. +// - the colors for the static static control are adjusted. +// - the OK button is converted to owner drawn. +// - the colors for the OK button are adjusted. +class CDarkAbout : public CDialog +{ +public: + CDarkAbout(); + virtual ~CDarkAbout() override = default; + void SetDarkMode(bool isDarkMode); + +protected: + virtual BOOL OnInitDialog() override; + virtual INT_PTR DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CDarkAbout(const CDarkAbout&) = delete; + CDarkAbout& operator=(const CDarkAbout&) = delete; + + LRESULT OnDrawItem(WPARAM, LPARAM); + LRESULT OnCtlColors(UINT, WPARAM, LPARAM); + void SetButtonOwnerDraw(bool isOwnerDraw); + + bool m_isDarkMode; +}; + + +#endif // _DARK_ABOUT_H_ diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/DarkMode.cpp b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/DarkMode.cpp new file mode 100644 index 00000000..ae864ea9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/DarkMode.cpp @@ -0,0 +1,88 @@ +///////////////////////////// +// DarkMode.cpp +// + +#include "stdafx.h" +#include "DarkMode.h" + + +// Determine if the specified Color can be classified as light. +bool IsColorLight(const Color& clr) +{ + return (((5 * clr.G) + (2 * clr.R) + clr.B) > (8 * 128)); +} + +// Returns true if the current theme is dark mode. +bool IsDarkMode() +{ + auto settings = UISettings(); + auto foreground = settings.GetColorValue(UIColorType::Foreground); + return IsColorLight(foreground); +} + +bool IsHighContrast() +{ + HIGHCONTRAST info{}; + info.cbSize = sizeof(info); + return (SystemParametersInfo(SPI_GETHIGHCONTRAST, 0, &info, 0) && + (info.dwFlags & HCF_HIGHCONTRASTON)); +} + +// Returns true if the operating system supports SetPreferredAppMode. +// Windows 10 May 2019 Update or later is required, also known as +// version 1903 and codenamed "19H1". +bool IsPreferredModeSupported() +{ + // using declaration for the RtlGetVersion function. + using RTLGETVERSION = NTSTATUS (WINAPI*)(PRTL_OSVERSIONINFOW); + + static RTLGETVERSION pfn = nullptr; + if (pfn == nullptr) + { + HMODULE module = ::GetModuleHandleW(L"ntdll.dll"); + if (module) + { + pfn = reinterpret_cast( + reinterpret_cast(::GetProcAddress(module, "RtlGetVersion"))); + } + } + + RTL_OSVERSIONINFOW osvi{}; + if (pfn != nullptr) + { + osvi.dwOSVersionInfoSize = sizeof(osvi); + pfn(&osvi); + } + + // A build number of 18362 indicates version 1903. + return (osvi.dwMajorVersion >= 10) && (osvi.dwBuildNumber >= 18362); +} + +// This function is required to add further darkmode support to the frame +// window. Here we use it to provide the dark mode system menu. +// Hopefully Microsoft will make this function available in the Windows App SDK +// in a future release. +// +// Until then we need to acquire this function directly from uxtheme.dll at +// ordinal 135. This approach isn't officially supported by Microsoft and +// could change in the future. +void SetPreferredAppMode(AppMode mode) +{ + // using declaration for the SetPreferredAppMode function. + using SETPREFERREDAPPMODE = AppMode (WINAPI*)(AppMode); + + static SETPREFERREDAPPMODE pSetPreferredAppMode = nullptr; + if (pSetPreferredAppMode == nullptr && IsPreferredModeSupported()) + { + HMODULE uxtheme = ::GetModuleHandleW(L"uxtheme.dll"); + if (uxtheme) + { + // Acquire the function pointer to SetPreferredAppMode from uxtheme.dll at ordinal 135. + pSetPreferredAppMode = reinterpret_cast( + reinterpret_cast(GetProcAddress(uxtheme, MAKEINTRESOURCEA(135)))); + } + } + + if (pSetPreferredAppMode != nullptr) + pSetPreferredAppMode(mode); +} diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/DarkMode.h b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/DarkMode.h new file mode 100644 index 00000000..5f7a8da0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/DarkMode.h @@ -0,0 +1,47 @@ +///////////////////////////// +// DarkMode.h +// + +// Requires the Windows App SDK to be installed from the VS2022 installer : +// * Select Desktop development with C++. +// * Then in the Installation details pane of the installation dialog box, +// select Windows App SDK C++ Templates(at the bottom of the list). +// +// https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/set-up-your-development-environment +// + +// The dark mode support is based on code provided here: +// https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/apply-windows-themes +// + +// Note that we also need the SetPreferredAppMode function from uxtheme.dll +// for full dark mode support. This function isn't currently provided by +// Windows App SDK. It needs to be acquired manually from uxtheme.dll at +// ordinal 135. + +#ifndef _DARKMODE_H_ +#define _DARKMODE_H_ + +#include + +// Namespaces from the Windows App SDK +using namespace winrt::Windows::UI; +using namespace winrt::Windows::UI::ViewManagement; + +// enum used by the SetPreferredAppMode function +enum AppMode +{ + Default, + AllowDark, + ForceDark, + ForceLight, + Max +}; + +bool IsColorLight(const Color& clr); +bool IsDarkMode(); +bool IsHighContrast(); +bool IsPreferredModeSupported(); +void SetPreferredAppMode(AppMode mode); + +#endif // _DARKMODE_H_ diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/DarkPreview.h b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/DarkPreview.h new file mode 100644 index 00000000..3bb84c35 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/DarkPreview.h @@ -0,0 +1,176 @@ +///////////////////////////// +// DarkPreview.h +// + +#ifndef _DARK_PREVIEW_H_ +#define _DARK_PREVIEW_H_ + + +//////////////////////////////////////////////////////////////////// +// CDarkPreview is a class template used to provides a print preview +// that is compatible with dark mode. +// +template +class CDarkPreview : public CPrintPreview +{ +public: + CDarkPreview() : m_isDarkMode(false) {} + CDarkPreview(T& source) : CPrintPreview(source), m_isDarkMode(false) {} + virtual ~CDarkPreview() override = default; + + LRESULT OnCtlColors(UINT, WPARAM wparam, LPARAM); + LRESULT OnDrawItem(WPARAM, LPARAM lparam); + void SetButtonOwnerDraw(bool isOwnerDraw); + void SetDarkMode(bool isDarkMode); + +protected: + virtual INT_PTR DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual BOOL OnInitDialog() override; + +private: + CDarkPreview(const CDarkPreview&) = delete; + CDarkPreview& operator=(const CDarkPreview&) = delete; + + bool m_isDarkMode; +}; + + +//////////////////////////////////////////////////// +// Definitions for the CDarkPreview class template +// member functions. +// + +// Handle the dialogs window messages. +template +inline INT_PTR CDarkPreview::DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case WM_CTLCOLORDLG: + case WM_CTLCOLORBTN: + case WM_CTLCOLORSTATIC: return OnCtlColors(msg, wparam, lparam); + case WM_DRAWITEM: return OnDrawItem(wparam, lparam); + } + + // Pass unhandled messages on to parent DialogProc. + return CPrintPreview::DialogProc(msg, wparam, lparam); + } + + // catch all CException types + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + TaskDialogBox(nullptr, str1, str2, TD_ERROR_ICON); + } + + return 0; +} + +// Set the colors for the dialog and static controls. +template +inline LRESULT CDarkPreview::OnCtlColors(UINT, WPARAM wparam, LPARAM) +{ + if (m_isDarkMode) + { + HDC dc = reinterpret_cast(wparam); + ::SetBkMode(dc, TRANSPARENT); + ::SetTextColor(dc, RGB(255, 255, 255)); + + return reinterpret_cast(::GetStockObject(BLACK_BRUSH)); + } + + return 0; +} + +// Perform the owner draw for buttons. +template +inline LRESULT CDarkPreview::OnDrawItem(WPARAM, LPARAM lparam) +{ + LPDRAWITEMSTRUCT pDraw = (LPDRAWITEMSTRUCT)lparam; + CDC dc(pDraw->hDC); + CRect rect = pDraw->rcItem; + dc.SetTextColor(RGB(220, 220, 220)); + + if (pDraw->itemState & ODS_SELECTED) + { + dc.CreatePen(PS_SOLID, 1, RGB(140, 140, 140)); + dc.CreateSolidBrush(RGB(60, 60, 60)); + } + else + { + dc.CreatePen(PS_SOLID, 1, RGB(100, 100, 100)); + dc.CreateSolidBrush(RGB(80, 80, 80)); + } + + // Draw the button text. + CString str = this->GetDlgItemText(pDraw->CtlID); + rect.DeflateRect(1, 1); + dc.RoundRect(rect, 10, 10); + dc.DrawText(str, -1, rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE); + + return TRUE; +} + +// Called before the dialog is displayed. +template +inline BOOL CDarkPreview::OnInitDialog() +{ + // Set the application icon + CPrintPreview::OnInitDialog(); + + // Make the OK button owner drawn for dark mode. + SetButtonOwnerDraw(m_isDarkMode); + + return TRUE; +} + +// Use owner draw for buttons for dark mode. +template +inline void CDarkPreview::SetButtonOwnerDraw(bool isOwnerDraw) +{ + HWND print = this->GetDlgItem(IDW_PREVIEWPRINT); + HWND setup = this->GetDlgItem(IDW_PREVIEWSETUP); + HWND prev = this->GetDlgItem(IDW_PREVIEWPREV); + HWND next = this->GetDlgItem(IDW_PREVIEWNEXT); + HWND close = this->GetDlgItem(IDW_PREVIEWCLOSE); + + DWORD style = static_cast(::GetWindowLongPtr(print, GWL_STYLE)); + + if (isOwnerDraw) + { + ::SetWindowLongPtr(print, GWL_STYLE, style | BS_OWNERDRAW); + ::SetWindowLongPtr(setup, GWL_STYLE, style | BS_OWNERDRAW); + ::SetWindowLongPtr(prev, GWL_STYLE, style | BS_OWNERDRAW); + ::SetWindowLongPtr(next, GWL_STYLE, style | BS_OWNERDRAW); + ::SetWindowLongPtr(close, GWL_STYLE, style | BS_OWNERDRAW); + } + else + { + ::SetWindowLongPtr(print, GWL_STYLE, style & ~BS_OWNERDRAW); + ::SetWindowLongPtr(setup, GWL_STYLE, style & ~BS_OWNERDRAW); + ::SetWindowLongPtr(prev, GWL_STYLE, style & ~BS_OWNERDRAW); + ::SetWindowLongPtr(next, GWL_STYLE, style & ~BS_OWNERDRAW); + ::SetWindowLongPtr(close, GWL_STYLE, style & ~BS_OWNERDRAW); + } +} + +// Configure the dialog for dark mode. +template +inline void CDarkPreview::SetDarkMode(bool isDarkMode) +{ + // Make the buttons owner drawn for dark mode. + if (this->IsWindow()) + SetButtonOwnerDraw(isDarkMode); + + m_isDarkMode = isDarkMode; +} + + +#endif // _DARK_PREVIEW_H_ diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/Doc.cpp b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/Doc.cpp new file mode 100644 index 00000000..4dcfe4ee --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/Doc.cpp @@ -0,0 +1,61 @@ +///////////////////////////// +// Doc.cpp +// + +#include "stdafx.h" +#include "Doc.h" + +//////////////////////////// +// CDoc function definitions +// + +// An example of how to load document data. +void CDoc::FileLoad(LPCWSTR filename) +{ + try + { + CArchive ar(filename, CArchive::load); + ar >> *this; // Uses the Serialize function + } + + catch (const CFileException &e) + { + // An exception occurred. Display the relevant information. + TaskDialogBox(nullptr, e.GetText(), L"Failed to Load File", TD_WARNING_ICON); + } +} + +// An example of how to save document data. +void CDoc::FileStore(LPCWSTR /* filename */) +{ +// try +// { +// CArchive ar(filename, CArchive::store); +// ar << *this; // Uses the Serialize function +// result = TRUE; +// } +// catch (const CFileException &e) +// { +// // An exception occurred. Display the relevant information. +// TaskDialogBox(nullptr, e.GetText(), L"Failed to Save File", TD_ERROR_ICON); +// } + +} + +// Uses CArchive to stream data to or from a file. +void CDoc::Serialize(CArchive& /* ar */) +{ + +// if (ar.IsStoring()) +// { +// // Store data in archive +// ar << m_memberVariable; +// } +// else +// { +// // Load data from archive +// ar >> m_memberVariable; +// } + +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/Doc.h b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/Doc.h new file mode 100644 index 00000000..93f32f0a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/Doc.h @@ -0,0 +1,24 @@ +///////////////////////////// +// Doc.h +// + +#ifndef WIN32XX_DOC_H +#define WIN32XX_DOC_H + + +////////////////////////////////////////////////////////////// +// CDoc holds the application's data. It inherits from CObject +// to perform data serialization to and from the archive. +class CDoc : public CObject +{ +public: + CDoc() = default; + virtual ~CDoc() override = default; + void FileLoad(LPCWSTR filename); + void FileStore(LPCWSTR filename); + +protected: + virtual void Serialize(CArchive& ar) override; +}; + +#endif // WIN32XX_DOC_H \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/FrameApp.cpp b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/FrameApp.cpp new file mode 100644 index 00000000..e7d28988 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/FrameApp.cpp @@ -0,0 +1,22 @@ +///////////////////////////// +// FrameApp.cpp +// + +#include "stdafx.h" +#include "FrameApp.h" + + +///////////////////////////////// +// CFrameApp function definitions +// + +// Called when the application starts. +BOOL CFrameApp::InitInstance() +{ + // Create the frame window. + m_frame.Create(); // throws a CWinException on failure + + return TRUE; +} + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/FrameApp.h b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/FrameApp.h new file mode 100644 index 00000000..364413ab --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/FrameApp.h @@ -0,0 +1,32 @@ +///////////////////////////// +// FrameApp.h +// + +#ifndef FRAMEAPP_H +#define FRAMEAPP_H + +#include "Mainfrm.h" + + +//////////////////////////////////////////////////////////////// +// CFrameApp manages the application. It initializes the Win32++ +// framework when it is constructed, and creates the main frame +// window when it runs. +class CFrameApp : public CWinApp +{ +public: + CFrameApp() = default; + virtual ~CFrameApp() override = default; + +protected: + virtual BOOL InitInstance() override; + +private: + CFrameApp(const CFrameApp&) = delete; + CFrameApp& operator=(const CFrameApp&) = delete; + + CMainFrame m_frame; +}; + + +#endif // define FRAMEAPP_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/Mainfrm.cpp b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/Mainfrm.cpp new file mode 100644 index 00000000..a64e1551 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/Mainfrm.cpp @@ -0,0 +1,404 @@ +///////////////////////////// +// Mainfrm.cpp +// + +#include "stdafx.h" +#include +#include "Mainfrm.h" +#include "DarkMode.h" +#include "resource.h" + +// Add the following libraries to the linker. +#pragma comment( lib, "Dwmapi" ) +#pragma comment( lib, "WindowsApp.lib" ) + +////////////////////////////////// +// CMainFrame function definitions +// + +// Constructor. +CMainFrame::CMainFrame() : m_preview(m_view), m_isToolbarShown(true) +{ +} + +// Create the frame window. +HWND CMainFrame::Create(HWND parent) +{ + // Set m_view as the view window of the frame. + SetView(m_view); + + // Set the registry key name, and load the initial window position. + // Use a registry key name like "CompanyName\\Application". + LoadRegistrySettings(L"Win32++\\DarkFrame"); + + // Initialize dark mode. + SetPreferredAppMode(AllowDark); + + // Create the window. + return CFrame::Create(parent); +} + +// Called when the frame window is asked to close. +void CMainFrame::OnClose() +{ + // Close the preview. + if (GetView() == m_preview) + OnPreviewClose(); + + // Proceed with closing the frame. + CFrame::OnClose(); +} + +// OnCommand responds to menu and and toolbar input. +BOOL CMainFrame::OnCommand(WPARAM wparam, LPARAM) +{ + UINT id = LOWORD(wparam); + switch(id) + { + case IDM_FILE_OPEN: return OnFileOpen(); + case IDM_FILE_SAVE: return OnFileSave(); + case IDM_FILE_SAVEAS: return OnFileSaveAs(); + case IDM_FILE_PREVIEW: return OnFilePreview(); + case IDM_FILE_PRINT: return OnFilePrint(); + case IDM_FILE_EXIT: return OnFileExit(); + case IDW_VIEW_STATUSBAR: return OnViewStatusBar(); + case IDW_VIEW_TOOLBAR: return OnViewToolBar(); + case IDM_HELP_ABOUT: return OnHelp(); + } + + return FALSE; +} + +// OnCreate controls the way the frame is created. +// Overriding CFrame::OnCreate is optional. +int CMainFrame::OnCreate(CREATESTRUCT& cs) +{ + // A menu is added if the IDW_MAIN menu resource is defined. + // Frames have all options enabled by default. + // Use the following functions to disable options. + + // UseIndicatorStatus(FALSE); // Don't show keyboard indicators in the StatusBar. + // UseMenuStatus(FALSE); // Don't show menu descriptions in the StatusBar. + // UseOwnerDrawnMenu(FALSE); // Don't use owner draw for popup menu items. + // UseReBar(FALSE); // Don't use a ReBar. + // UseStatusBar(FALSE); // Don't use a StatusBar. + // UseThemes(FALSE); // Don't use themes. + // UseToolBar(FALSE); // Don't use a ToolBar. + + // Call the base class function. + return CFrame::OnCreate(cs); +} + +// Issue a close request to the frame to end the program. +BOOL CMainFrame::OnFileExit() +{ + Close(); + return TRUE; +} + +BOOL CMainFrame::OnHelp() +{ + // Ensure only one dialog displayed even for multiple hits of the F1 button. + if (!m_helpDialog.IsWindow()) + { + m_helpDialog.DoModal(*this); + } + + return TRUE; +} + +// Create the File Open dialog to choose the file to load. +BOOL CMainFrame::OnFileOpen() +{ + CString filter = "Program Files (*.cpp; *.h)|*.cpp; *.h|All Files (*.*)|*.*|"; + CFileDialog fileDlg(TRUE); // TRUE for file open + fileDlg.SetFilter(filter); + fileDlg.SetDefExt(L".cpp"); + + // Bring up the file open dialog retrieve the selected filename. + if (fileDlg.DoModal(*this) == IDOK) + { + GetDoc().FileLoad(fileDlg.GetPathName()); + } + + return TRUE; +} + +// Save the file. +BOOL CMainFrame::OnFileSave() +{ + // ToDo: Add code to save the file. + + return TRUE; +} + +// Create the File Save dialog to choose the file to save. +BOOL CMainFrame::OnFileSaveAs() +{ + CString filter = "Program Files (*.cpp; *.h)|*.cpp; *.h|All Files (*.*)|*.*|"; + CFileDialog fileDlg(FALSE); // FALSE for file save. + fileDlg.SetFilter(filter); + fileDlg.SetDefExt(L".cpp"); + + // Bring up the file save dialog retrieve the selected filename. + if (fileDlg.DoModal(*this) == IDOK) + { + GetDoc().FileStore(fileDlg.GetPathName()); + + // ToDo: Add code to save the file. + } + + return TRUE; +} + +// Previews a print job before sending it to the printer. +BOOL CMainFrame::OnFilePreview() +{ + try + { + m_isToolbarShown = GetToolBar().IsWindow() && GetToolBar().IsWindowVisible(); + + // Get the device context of the default or currently chosen printer. + CPrintDialog printDlg; + CDC printerDC = printDlg.GetPrinterDC(); + + // Create the preview window if required. + if (!m_preview.IsWindow()) + m_preview.Create(*this); + + // Set the preview's owner (for messages). + m_preview.DoPrintPreview(*this); + + // Swap views. + SetView(m_preview); + + // Hide the menu and toolbar. + ShowMenu(FALSE); + ShowToolBar(FALSE); + + // Update status. + CString status = L"Printer: " + printDlg.GetDeviceName(); + SetStatusText(status); + } + + catch (const CException& e) + { + // An exception occurred. Display the relevant information. + TaskDialogBox(nullptr, e.GetText(), L"Print Preview Failed", TD_ERROR_ICON); + SetView(m_view); + ShowMenu(GetFrameMenu().GetHandle() != 0); + ShowToolBar(m_isToolbarShown); + } + + return TRUE; +} + +// Bring up a dialog to choose the printer. +BOOL CMainFrame::OnFilePrint() +{ + CPrintDialog printdlg; + + try + { + if (IDOK == printdlg.DoModal(*this)) + { + m_view.QuickPrint(L"Frame Sample"); + } + } + + catch (const CException& e) + { + // An exception occurred. Display the relevant information. + TaskDialogBox(nullptr, e.GetText(), L"Print Failed", TD_ERROR_ICON); + } + + return TRUE; +} + +// Called after the window is created. +void CMainFrame::OnInitialUpdate() +{ + // The frame is now created. + // Place any additional startup code here. + + SetDarkMode(IsDarkMode()); + + TRACE("Frame created\n"); +} + +// Called when the Print Preview's "Close" button is pressed. +LRESULT CMainFrame::OnPreviewClose() +{ + // Swap the view. + SetView(m_view); + + // Show the menu and toolbar. + ShowMenu(GetFrameMenu().GetHandle() != 0); + ShowToolBar(m_isToolbarShown); + UpdateSettings(); + + SetStatusText(LoadString(IDW_READY)); + + return 0; +} + +// Called when the Print Preview's "Print Now" button is pressed. +LRESULT CMainFrame::OnPreviewPrint() +{ + m_view.QuickPrint(L"Frame Sample"); + return 0; +} + +// Called when the Print Preview's "Print Setup" button is pressed. +LRESULT CMainFrame::OnPreviewSetup() +{ + // Call the print setup dialog. + CPrintDialog printDlg(PD_PRINTSETUP); + try + { + // Display the print dialog. + if (printDlg.DoModal(*this) == IDOK) + { + CString status = L"Printer: " + printDlg.GetDeviceName(); + SetStatusText(status); + } + } + + catch (const CException& e) + { + // An exception occurred. Display the relevant information. + TaskDialogBox(nullptr, e.GetErrorString(), e.GetText(), TD_ERROR_ICON); + } + + // Initiate the print preview. + m_preview.DoPrintPreview(*this); + + return 0; +} + +// Called when the user changes the system colors or theme. +LRESULT CMainFrame::OnSysColorChange(UINT msg, WPARAM wparam, LPARAM lparam) +{ + SetDarkMode(IsDarkMode()); + return CFrame::OnSysColorChange(msg, wparam, lparam); +} + +// Adjusts the frame window and child window settings for dark mode. +void CMainFrame::SetDarkMode(bool isDarkMode) +{ + m_helpDialog.SetDarkMode(isDarkMode); + m_view.SetDarkMode(isDarkMode); + m_preview.SetDarkMode(isDarkMode); + + if (isDarkMode && !IsHighContrast()) + UseDarkMenu(TRUE); + else + UseDarkMenu(FALSE); + + // Redraw the help about dialog. + if (m_helpDialog.IsWindow()) + m_helpDialog.Invalidate(); + + // Set the caption to dark for dark mode. + BOOL value = isDarkMode ? TRUE : FALSE; + ::DwmSetWindowAttribute(*this, DWMWA_USE_IMMERSIVE_DARK_MODE, &value, sizeof(value)); +} + +// Specify the colors and settings for the dark mode theme. +void CMainFrame::SetDarkTheme() +{ + BOOL t = TRUE; + BOOL f = FALSE; + + ReBarTheme rbt = { t, RGB(30, 30, 30), RGB(30, 30, 30), RGB(50, 50, 50), RGB(50, 50, 50), f, t, t, f, t, f }; + SetReBarTheme(rbt); + + StatusBarTheme sbt = { t, RGB(30, 30, 30), RGB(30, 30, 30), RGB(255, 255, 255) }; + SetStatusBarTheme(sbt); + + ToolBarTheme tbt = { t, RGB(49, 106, 197), RGB(64,177,230), RGB(27,65, 160), RGB(64, 177, 230), RGB(49, 106, 197) }; + SetToolBarTheme(tbt); + + MenuTheme mt = { t, RGB(30, 30, 30), RGB(30, 30, 30), RGB(40, 40, 40), RGB(40, 40, 40), RGB(96, 96, 96), RGB(255, 255, 255) }; + SetMenuTheme(mt); +} + +// Override the virtual SetTheme function to add the dark theme. +void CMainFrame::SetTheme() +{ + if (IsUsingThemes()) + { + if (IsDarkMode()) + SetDarkTheme(); + else + CFrame::SetTheme(); // Use the default theme. + } +} + +// Specifies the images for some of the menu items. +void CMainFrame::SetupMenuIcons() +{ + // Set the bitmap used for menu icons + std::vector data = GetToolBarData(); + if (GetMenuIconHeight() >= 24) + SetMenuIcons(data, RGB(192, 192, 192), IDW_MAIN); + else + SetMenuIcons(data, RGB(192, 192, 192), IDB_MENUICONS); +} + +// Set the resource IDs and images for the toolbar buttons. +void CMainFrame::SetupToolBar() +{ + AddToolBarButton( IDM_FILE_NEW ); + AddToolBarButton( IDM_FILE_OPEN ); + AddToolBarButton( IDM_FILE_SAVE ); + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_EDIT_CUT, FALSE ); // disabled button + AddToolBarButton( IDM_EDIT_COPY, FALSE ); // disabled button + AddToolBarButton( IDM_EDIT_PASTE, FALSE ); // disabled button + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_FILE_PRINT ); + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_HELP_ABOUT ); +} + +// Process the frame's window messages. +LRESULT CMainFrame::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case UWM_PREVIEWCLOSE: return OnPreviewClose(); + case UWM_PREVIEWPRINT: return OnPreviewPrint(); + case UWM_PREVIEWSETUP: return OnPreviewSetup(); + } + + return WndProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + TaskDialogBox(nullptr, str1, str2, TD_ERROR_ICON); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + TaskDialogBox(nullptr, str1, L"Error: std::exception", TD_ERROR_ICON); + } + + return 0; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/Mainfrm.h b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/Mainfrm.h new file mode 100644 index 00000000..57337bf9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/Mainfrm.h @@ -0,0 +1,65 @@ +///////////////////////////// +// Mainfrm.h +// + +#ifndef MAINFRM_H +#define MAINFRM_H + +#include "DarkAbout.h" +#include "DarkPreview.h" +#include "View.h" + + +/////////////////////////////////////////////////////////// +// CMainFrame manages the application's main window. +// The main window is a frame which has a menubar, toolbar, +// statusbar and view window. +class CMainFrame : public CFrame +{ +public: + CMainFrame(); + CDoc& GetDoc() { return m_view.GetDoc(); } + void SetDarkMode(bool isDarkMode); + void SetDarkTheme(); + + virtual ~CMainFrame() override = default; + virtual HWND Create(HWND parent = nullptr) override; + +protected: + virtual void OnClose() override; + virtual BOOL OnCommand(WPARAM, LPARAM) override; + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual BOOL OnHelp() override; + virtual void OnInitialUpdate() override; + virtual LRESULT OnSysColorChange(UINT, WPARAM, LPARAM) override; + virtual void SetTheme() override; + virtual void SetupMenuIcons() override; + virtual void SetupToolBar() override; + virtual LRESULT WndProc(UINT, WPARAM, LPARAM) override; + +private: + CMainFrame(const CMainFrame&) = delete; + CMainFrame& operator=(const CMainFrame&) = delete; + + // Command Handlers + BOOL OnFileExit(); + BOOL OnFileOpen(); + BOOL OnFilePrint(); + BOOL OnFileSave(); + BOOL OnFileSaveAs(); + BOOL OnFilePreview(); + + // Message handlers + LRESULT OnPreviewClose(); + LRESULT OnPreviewPrint(); + LRESULT OnPreviewSetup(); + + // Member variables + CView m_view; + CDarkPreview m_preview; + CDarkAbout m_helpDialog; + bool m_isToolbarShown; +}; + +#endif //MAINFRM_H + diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/Resource.rc b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/Resource.rc new file mode 100644 index 00000000..73b13079 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/Resource.rc @@ -0,0 +1,216 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "../src/res/PerMonitorV2.manifest" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDW_MAIN MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "New\tCtrl+N", IDM_FILE_NEW + MENUITEM "&Open...\tCtrl+O", IDM_FILE_OPEN + MENUITEM "&Save\tCtrl+S", IDM_FILE_SAVE + MENUITEM "Save &As...", IDM_FILE_SAVEAS + MENUITEM SEPARATOR + MENUITEM "Print Preview", IDM_FILE_PREVIEW + MENUITEM "&Print...\tCtrl+P", IDM_FILE_PRINT + MENUITEM SEPARATOR + MENUITEM "E&xit\tAlt+F4", IDM_FILE_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "Undo\tCtrl+Z", IDM_EDIT_UNDO, GRAYED + MENUITEM "Redo\tCtrl+Y", IDM_EDIT_REDO, GRAYED + MENUITEM SEPARATOR + MENUITEM "Cut\tCtrl+X", IDM_EDIT_CUT, GRAYED + MENUITEM "Copy\tCtrl+C", IDM_EDIT_COPY, GRAYED + MENUITEM "Paste\tCtrl+V", IDM_EDIT_PASTE, GRAYED + MENUITEM "Delete\tDel", IDM_EDIT_DELETE, GRAYED + END + POPUP "&View" + BEGIN + MENUITEM "&Tool Bar", IDW_VIEW_TOOLBAR, CHECKED + MENUITEM "&Status Bar", IDW_VIEW_STATUSBAR, CHECKED + END + POPUP "&Help" + BEGIN + MENUITEM "&About\tF1", IDM_HELP_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDW_MAIN ICON "../src/res/SunGlasses.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDW_MAIN BITMAP "../src/res/Toolbar.bmp" +IDB_MENUICONS BITMAP "../src/res/MenuIcons.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDW_ABOUT DIALOGEX 0, 0, 186, 109 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "MS Shell Dlg", 400, 0 +BEGIN + DEFPUSHBUTTON "OK",IDOK,68,60,50,14 + CTEXT "Dark Mode Aware Application",IDC_STATIC,43,22,99,8 + ICON IDW_MAIN,0,4,4,20,20 + CTEXT "",IDC_STATIC1,53,32,80,8 + CTEXT "",IDC_STATIC2,53,42,80,8 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDW_MAIN ACCELERATORS +BEGIN + "N", IDM_FILE_NEW, VIRTKEY, CONTROL, NOINVERT + "O", IDM_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT + "P", IDM_FILE_PRINT, VIRTKEY, CONTROL, NOINVERT + "S", IDM_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT + "C", IDM_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + "X", IDM_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT + "V", IDM_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT + "Z", IDM_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT + "Y", IDM_EDIT_REDO, VIRTKEY, CONTROL, NOINVERT +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDW_MAIN "Dark Mode Aware Application" + IDW_INDICATOR_CAPS "CAP" + IDW_INDICATOR_NUM "NUM" + IDW_INDICATOR_SCRL "SCRL" + IDW_READY "Ready" + IDW_VIEW_TOOLBAR "Show or hide the tool bar" + IDW_VIEW_STATUSBAR "Show or hide the status bar" +END + +STRINGTABLE +BEGIN + IDW_PREVIEWPRINT "Print" + IDW_PREVIEWSETUP "Print Setup" + IDW_PREVIEWPREV "Prev Page" + IDW_PREVIEWNEXT "Next Page" + IDW_PREVIEWCLOSE "Close" +END + +STRINGTABLE +BEGIN + IDM_FILE_NEW "Create a New Document" + IDM_FILE_OPEN "Open Existing Document" + IDM_FILE_SAVE "Save the Document" + IDM_FILE_SAVEAS "Save the Document with a new name" + IDM_FILE_PREVIEW "Preview the print job before printing" + IDM_FILE_PRINT "Print the Document" + IDM_FILE_EXIT "End the Program" + IDM_EDIT_UNDO "Undo the last action" + IDM_EDIT_REDO "Redo the previously undone action" +END + +STRINGTABLE +BEGIN + IDM_EDIT_CUT "Cut the Selected Contents to the Clipboard" + IDM_EDIT_COPY "Copy the Selected Contents to the Clipboard" + IDM_EDIT_PASTE "Paste the Clipboard Contents to the Document" + IDM_EDIT_DELETE "Erase the selected Contents" + IDM_HELP_ABOUT "Display Information about this program" +END + +STRINGTABLE +BEGIN + SC_CLOSE "Close the Window" + SC_MAXIMIZE "Maximize the Window" + SC_MINIMIZE "Minimize the Window" + SC_MOVE "Move the Window" + SC_NEXTWINDOW "Select Next Window" + SC_PREVWINDOW "Select Previous Window" + SC_RESTORE "Restore the Window" + SC_SIZE "Resize the Window" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/StdAfx.cpp b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/StdAfx.cpp new file mode 100644 index 00000000..8957144d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/StdAfx.cpp @@ -0,0 +1,16 @@ +///////////////////////////// +// StdAfx.cpp +// + +// This file is used for precompiled hearders. Precompiled headers allow +// programs to be recompiled more quickly + +// To use precompiled headers, do the following: +// 1) Add the set of rarely changed headers to stdafx.h +// 2) Include stdafx.h in each cpp file. It must be included first. +// 3) Add stdafx.cpp to your project. +// 4) Turn on precompiled hearders in the project + + +#include "stdafx.h" + diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/View.cpp b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/View.cpp new file mode 100644 index 00000000..c6f7a182 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/View.cpp @@ -0,0 +1,198 @@ +///////////////////////////// +// View.cpp +// + +#include "stdafx.h" +#include "View.h" + +constexpr COLORREF black = RGB(0, 0, 0); +constexpr COLORREF white = RGB(255, 255, 255); + +///////////////////////////// +// CView function definitions +// + +// Constructor. +CView::CView() : m_isDarkMode(false) +{ +} + +// Returns a reference to CDoc. +CDoc& CView::GetDoc() +{ + return m_doc; +} + +// OnDraw is called when part or all of the window needs to be redrawn. +void CView::OnDraw(CDC& dc) +{ + CRect rc = GetClientRect(); + dc.SetBkMode(TRANSPARENT); + + if (m_isDarkMode) + { + dc.SolidFill(black, rc); + dc.SetTextColor(white); + } + else + dc.SolidFill(white, rc); + + NONCLIENTMETRICS info = GetNonClientMetrics(); + LOGFONT lf = info.lfMessageFont; + int dpi = GetWindowDpi(*this); + lf.lfHeight = -MulDiv(10, dpi, POINTS_PER_INCH); + dc.CreateFontIndirect(lf); + + // Centre some text in our view window. + dc.DrawText(L"View Window", -1, rc, DT_CENTER | DT_VCENTER | DT_SINGLELINE); +} + +// OnInitialUpdate is called immediately after the window is created. +void CView::OnInitialUpdate() +{ + TRACE("View window created\n"); +} + +// Sets the WNDCLASS parameters before the window is created. +// This is where we set the Window class parameters. +// Preforming this is optional, but doing so allows us to +// take more precise control over the type of window we create. +void CView::PreRegisterClass(WNDCLASS& wc) +{ + // Set the Window Class name + wc.lpszClassName = L"Win32++ View"; + + // Set a background brush to white + wc.hbrBackground = static_cast(::GetStockObject(WHITE_BRUSH)); + + // Set the default cursor + wc.hCursor = ::LoadCursor(nullptr, IDC_ARROW); + + // Set the class style (not to be confused with the window styles set in PreCreate) + wc.style = CS_DBLCLKS; // Generate left button double click messages. +} + + +// Prints the specified page to the specified device context. +// Here we copy (stretch) a bitmap image of the view window +// to the printed page. +void CView::PrintPage(CDC& dc, int) +{ + try + { + // Get the device context of the default or currently chosen printer + CPrintDialog printDlg; + CDC printDC = printDlg.GetPrinterDC(); + + int cxPage = printDC.GetDeviceCaps(HORZRES); // Width in pixels. + int cyPage = printDC.GetDeviceCaps(VERTRES); // Height in pixels. + + int cxView = GetClientRect().Width(); + int cyView = GetClientRect().Height(); + + // Draw the view image to a memory DC. + CClientDC viewDC(*this); + CMemDC memDC(viewDC); + memDC.CreateCompatibleBitmap(viewDC, cxView, cyView); + OnDraw(memDC); + + // Now we convert the bitmap from DDB to DIB + CBitmap bmView = memDC.DetachBitmap(); + CBitmapInfoPtr pbmi(bmView); + + // Extract the device independent image data. + BITMAPINFOHEADER* pBIH = reinterpret_cast(pbmi.get()); + UINT scanLines = static_cast(cyView); + memDC.GetDIBits(bmView, 0, scanLines, nullptr, pbmi, DIB_RGB_COLORS); + std::vector byteArray(pBIH->biSizeImage, 0); + byte* pByteArray = byteArray.data(); + memDC.GetDIBits(bmView, 0, scanLines, pByteArray, pbmi, DIB_RGB_COLORS); + + // Copy the DI bits to the specified dc + dc.StretchDIBits(0, 0, cxPage, cyPage, 0, 0, + cxView, cyView, pByteArray, pbmi, DIB_RGB_COLORS, SRCCOPY); + } + + catch (const CException& e) + { + // An exception occurred. Display the relevant information. + TaskDialogBox(nullptr, e.GetText(), L"Print Failed", TD_ERROR_ICON); + } +} + +// Print to the default or previously chosen printer. +void CView::QuickPrint(LPCWSTR docName) +{ + try + { + // Create a DOCINFO structure. + DOCINFO di = {}; + di.cbSize = sizeof(DOCINFO); + di.lpszDocName = docName; + + // Get the device context of the default or currently chosen printer. + CPrintDialog printDlg; + CDC printDC = printDlg.GetPrinterDC(); + + // Begin a print job by calling the StartDoc function. + printDC.StartDoc(&di); + + // Inform the driver that the application is about to begin sending data. + printDC.StartPage(); + + // Print the page on the printer DC + PrintPage(printDC); + + // Inform the driver that the page is finished. + printDC.EndPage(); + + // Inform the driver that document has ended. + printDC.EndDoc(); + } + + catch (const CException& e) + { + // An exception occurred. Display the relevant information. + TaskDialogBox(nullptr, e.GetText(), L"Print Failed", TD_ERROR_ICON); + } +} + + +// All window messages for this window pass through WndProc. +LRESULT CView::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case WM_SIZE: + Invalidate(); + break; // Also do default processing. + } + + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + TaskDialogBox(nullptr, str1, str2, TD_ERROR_ICON); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + TaskDialogBox(nullptr, str1, L"Error: std::exception", TD_ERROR_ICON); + } + + return 0; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/View.h b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/View.h new file mode 100644 index 00000000..cda70bb7 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/View.h @@ -0,0 +1,38 @@ +///////////////////////////// +// View.h +// + +#ifndef VIEW_H +#define VIEW_H + +#include "Doc.h" + + +////////////////////////////////////////// +// CView manages CMainFrame's view window. +class CView : public CWnd +{ +public: + CView(); + virtual ~CView() override = default; + CDoc& GetDoc(); + void PrintPage(CDC& dc, int page = 1); + void QuickPrint(LPCWSTR docName); + void SetDarkMode(bool isDarkMode) { m_isDarkMode = isDarkMode; } + +protected: + virtual void OnDraw(CDC& dc) override; + virtual void OnInitialUpdate() override; + virtual void PreRegisterClass(WNDCLASS& wc) override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CView(const CView&) = delete; + CView& operator=(const CView&) = delete; + + CDoc m_doc; + bool m_isDarkMode; +}; + + +#endif // VIEW_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/main.cpp b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/main.cpp new file mode 100644 index 00000000..2a574765 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/main.cpp @@ -0,0 +1,44 @@ +///////////////////////////// +// main.cpp +// + +#include "stdafx.h" +#include "FrameApp.h" + + +int WINAPI WinMain (_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPSTR, _In_ int) +{ + try + { + if (GetWinVersion() < 3000) + throw CUserException(L"Windows 10 or higher required"); + + // Start Win32++. + CFrameApp theApp; + + // Run the application and the message loop. + return theApp.Run(); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + CString str2; + str2 << "Error: " << e.what(); + TaskDialogBox(nullptr, str1, str2, TD_ERROR_ICON); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + TaskDialogBox(nullptr, str1, L"Error: std::exception", TD_ERROR_ICON); + } + + return -1; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/res/MenuIcons.bmp b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/res/MenuIcons.bmp new file mode 100644 index 00000000..79ad442f Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/res/MenuIcons.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/res/PerMonitorV2.manifest b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/res/PerMonitorV2.manifest new file mode 100644 index 00000000..d303e5c0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/res/PerMonitorV2.manifest @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + PerMonitorV2, PerMonitor + + + + + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/res/SunGlasses.ico b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/res/SunGlasses.ico new file mode 100644 index 00000000..6bb6cb0b Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/res/SunGlasses.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/res/Toolbar.bmp b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/res/Toolbar.bmp new file mode 100644 index 00000000..4000d938 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/res/Toolbar.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/resource.h b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/resource.h new file mode 100644 index 00000000..a62184f7 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/resource.h @@ -0,0 +1,39 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Resource.rc +// + +// include the Resource IDs defined by Win32++ +#include "default_resource.h" + +#define IDM_FILE_NEW 121 +#define IDM_FILE_OPEN 122 +#define IDM_FILE_SAVE 123 +#define IDM_FILE_SAVEAS 124 +#define IDM_FILE_PREVIEW 125 +#define IDM_FILE_PRINT 126 +#define IDM_FILE_CLOSE 127 +#define IDM_FILE_EXIT 128 +#define IDM_EDIT_UNDO 130 +#define IDM_EDIT_REDO 131 +#define IDM_EDIT_CUT 132 +#define IDM_EDIT_COPY 133 +#define IDM_EDIT_PASTE 134 +#define IDM_EDIT_DELETE 135 +#define IDM_HELP_ABOUT 140 +#define IDB_MENUICONS 150 + +#define IDC_STATIC1 160 +#define IDC_STATIC2 161 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 130 +#endif +#endif diff --git a/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/stdafx.h b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/stdafx.h new file mode 100644 index 00000000..08450116 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DarkModeFrame/src/stdafx.h @@ -0,0 +1,90 @@ +///////////////////////////// +// StdAfx.h +// + +// This file is used for precompiled headers. +// Rarely modified header files should be included. +// Based on code provided by Lynn Allan. + + +#ifndef STDAFX_H +#define STDAFX_H + + +// Predefinitions for windows.h go here +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +// Specify Win32xx specific predefinitions here +//#define NO_USING_NAMESPACE // Don't use Win32xx namespace + +// Rarely modified header files should be included here +#include // Add support for std::vector +#include // Add support for std::map +#include // Add support for std::string +#include // Add support for stringstream +#include // Add support for the assert macro +#include // Add support for C style printf, sprintf, etc. +#include // Add support for C style character conversions atoi etc. +#include // Add support for C style TCHARs. + +// Add the Win32++ library +#include // Add CWinApp +#include // Add CArchive +#include // Add CAnimation, CComboBox, CComboBoxEx, CDateTime, CHeader, CHotKey, CIPAddress, CProgressBar, CSpinButton, CScrollBar, CSlider, CToolTip +#include // Add CCriticalSection, CThreadLock +#include // Add CString, CStringA, CStringW +#include // Add CDataExchange +#include // Add CDialog, CResizer +#include // Add CDockFrame, CMDIDockFrame +#include // Add CDocker, CDockContainer +#include // Add CException, CFileException, CNotSupportedException, CResourceException, CUserException, CWinException +#include // Add CFile +#include // Add CFileFind +#include // Add CFolderDialog +#include // Add CFrame +#include // Add CDC, CGDIObject, CBitmap, CBrush, CFont, CPalatte, CPen, CRgn +#include // Add CHGlobal +#include // Add CImageList +#include // Add CListView +#include // Add CMDIChild, CMDIFrame, CDockMDIFrame +#include // Add CMenu +#include // Add CMenuBar +#include // Add CMetaFile, CEnhMetaFile +#include // Add CEvent, CMutex, CSemaphore +#include // Add CPropertyPage, CPropertySheet +#include // Add CRebar +#include // Add CPoint, CRect, CSize +#include // Add CRegKey +#include // Add CRichEdit +#include // Add CScrollView +#include // Adds macros, windows header files, and CObject +#include // Add CSocket +#include // Add CStatusBar +#include // Add CButton, CEdit, CListBox +#include // Add CTab, CTabbedMDI +#include // Add AtoT, AtoW, TtoA, TtoW, WtoA, WtoT etc. +#include // Add MenuTheme, ReBarTheme, StatusBarTheme, ToolBarTheme +#include // Add CWinThread +#include // Add CTime +#include // Add CToolBar +#include // Add CTreeView +#include // Add CWebBrowser, CAXHost +#include // Add CWnd + +// WIN32_LEAN_AND_MEAN can't be used with these +#ifndef WIN32_LEAN_AND_MEAN + #include // Add CCommonDialog, CColorDialog, CFileDialog, CFindReplace, CFontDialog + #include // Add CFolderDialogEx + #include // Add CPrintPreview + #include // Add CPageSetupDialog, CPrintDialog + #include // Add CPrintDialogEx + #include // Add CTaskDialog + + // Visual Studio + #if defined (_MSC_VER) + #include // Add CRibbon, CRibbonFrame + #endif + +#endif // define WIN32_LEAN_AND_MEAN + +#endif // define STDAFX_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime.cbp b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime.cbp new file mode 100644 index 00000000..b4c3ec90 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime.cbp @@ -0,0 +1,139 @@ + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime.cbproj b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime.cbproj new file mode 100644 index 00000000..32d355ba --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime.cbproj @@ -0,0 +1,1518 @@ + + + {39461456-1040-43CB-9B40-5962EF847BB0} + 20.1 + None + True + Release + Win64x + 1048579 + Application + DateTime + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + JPHNE + .\Embarcadero\$(Platform)\$(Config) + .\Embarcadero\$(Platform)\$(Config) + false + true + true + $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + CppGuiApplication + System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + true + <_TCHARMapping>wchar_t + DateTime + ..\..\..\include\;..\src\;$(IncludePath) + ..\..\..\include\;..\src\;$(ILINK_LibraryPath) + 3081 + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + $(BDSINCLUDE)\windows\sdk;$(BRCC_IncludePath) + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + ..\src\stdafx.h + none + + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + false + true + false + true + _DEBUG;$(Defines) + false + None + DEBUG + true + true + true + true + Full + true + true + true + true + true + $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) + $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + + + PerMonitorV2 + false + $(BDSLIB)\$(PLATFORM)$(CC_SUFFIX)\debug;$(ILINK_LibraryPath) + true + 1033 + + + PerMonitorV2 + true + 1033 + (None) + <_TCHARMapping>wchar_t + + + PerMonitorV2 + true + 1033 + + + NDEBUG;$(Defines) + None + + + PerMonitorV2 + false + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 0 + + + 1 + + + 2 + + + 3 + + + 4 + + + 5 + + +
Resource.res
+ 6 +
+ + 7 + + + 8 + true + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + +
+ + CPlusPlusBuilder.Personality.12 + CppGuiApplication + + + + False + True + True + False + + + Embarcadero C++Builder Office 2000 Servers Package + Embarcadero C++Builder Office XP Servers Package + + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + Assets\ + Logo150x150.png + true + + + + + Assets\ + Logo44x44.png + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + DateTime.exe + true + + + + + DateTime.exe + true + + + + + NewProject.exe + true + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 64 + + + classes + 64 + + + + + res\xml + 1 + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\mips + 1 + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-v21 + 1 + + + res\values-v21 + 1 + + + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + Contents + 1 + + + Contents + 1 + + + Contents + 1 + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + library\lib\armeabi-v7a + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen + 64 + + + ..\$(PROJECTNAME).launchscreen + 64 + + + + + 1 + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + + + + + + + + + + + + + True + True + True + + + 12 + + + + +
diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2015.sln b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2015.sln new file mode 100644 index 00000000..1141410d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2015.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DateTime", "DateTime_2015.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2015.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2015.vcxproj new file mode 100644 index 00000000..43c87a10 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2015.vcxproj @@ -0,0 +1,247 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DateTime + DateTime + + + + Application + Unicode + v140_xp + + + Application + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + + + + + + + + + + + + + + + + + true + false + + + true + false + + + false + false + + + false + false + + + + Use + Level4 + true + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2015.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2015.vcxproj.filters new file mode 100644 index 00000000..f78b675d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2015.vcxproj.filters @@ -0,0 +1,215 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + {86790b47-d32f-41a7-b741-89ee90d64b6d} + + + {e15d7f75-acf5-492f-ba57-b883f91cfdc5} + + + {1dcddfe4-dd07-43c5-a6d4-b6a46f049287} + + + {cbba403a-bc76-477a-b285-e00b59b0a45a} + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2019.sln b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2019.sln new file mode 100644 index 00000000..5a6bd653 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2019.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DateTime", "DateTime_2019.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {1A817C85-2F24-4CC0-B3F5-B97265F11B4B} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2019.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2019.vcxproj new file mode 100644 index 00000000..8d6bafd3 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2019.vcxproj @@ -0,0 +1,226 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DateTime + DateTime + + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2019.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2019.vcxproj.filters new file mode 100644 index 00000000..deb00e7a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2019.vcxproj.filters @@ -0,0 +1,215 @@ + + + + + {23e77f61-43c6-428e-b5f4-c8ccf4cdd2e7} + + + {045d59db-5c46-4779-b971-fd0905711d7b} + + + {7c568ef0-e880-426f-95ef-95a4569de469} + + + {d967d560-e860-46f6-90fe-6a9352a3bb61} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2022.sln b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2022.sln new file mode 100644 index 00000000..fab48310 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2022.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DateTime", "DateTime_2022.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A277D5FC-789B-40DD-A261-02197C185A3B} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2022.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2022.vcxproj new file mode 100644 index 00000000..c2f2a4c3 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2022.vcxproj @@ -0,0 +1,235 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DateTime + DateTime + 10.0 + + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2022.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2022.vcxproj.filters new file mode 100644 index 00000000..deb00e7a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2022.vcxproj.filters @@ -0,0 +1,215 @@ + + + + + {23e77f61-43c6-428e-b5f4-c8ccf4cdd2e7} + + + {045d59db-5c46-4779-b971-fd0905711d7b} + + + {7c568ef0-e880-426f-95ef-95a4569de469} + + + {d967d560-e860-46f6-90fe-6a9352a3bb61} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2026.slnx b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2026.slnx new file mode 100644 index 00000000..e2a3f17a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2026.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2026.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2026.vcxproj new file mode 100644 index 00000000..3cfcdcc8 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2026.vcxproj @@ -0,0 +1,235 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DateTime + DateTime + 10.0 + + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2026.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2026.vcxproj.filters new file mode 100644 index 00000000..f2e722a4 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_2026.vcxproj.filters @@ -0,0 +1,215 @@ + + + + + {23e77f61-43c6-428e-b5f4-c8ccf4cdd2e7} + + + {045d59db-5c46-4779-b971-fd0905711d7b} + + + {7c568ef0-e880-426f-95ef-95a4569de469} + + + {d967d560-e860-46f6-90fe-6a9352a3bb61} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_DEBUG.dev b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_DEBUG.dev new file mode 100644 index 00000000..792c0576 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_DEBUG.dev @@ -0,0 +1,141 @@ +[Project] +FileName=DateTime_DEBUG.dev +Name=DateTime +UnitCount=9 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=DateTime_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D_DEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@__@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Debug +ObjectOutput=.\Dev-C++\Debug +OverrideOutput=1 +OverrideOutputName=DateTime.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=4 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[Unit1] +FileName=..\src\DialogApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\DialogApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\MyDialog.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\MyDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\Resource.rc +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit8] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_RELEASE.dev b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_RELEASE.dev new file mode 100644 index 00000000..65c226e5 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/ProjectFiles/DateTime_RELEASE.dev @@ -0,0 +1,141 @@ +[Project] +FileName=DateTime_RELEASE.dev +Name=DateTime +UnitCount=9 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=DateTime_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D NDEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-s_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Release +ObjectOutput=.\Dev-C++\Release +OverrideOutput=1 +OverrideOutputName=DateTime.exe +HostApplication= +Folders=Header,Resource,Source +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=3 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[Unit1] +FileName=..\src\DialogApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\DialogApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\MyDialog.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\MyDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\Resource.rc +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit8] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/DateTime/Readme.txt new file mode 100644 index 00000000..cead4a68 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/Readme.txt @@ -0,0 +1,23 @@ +DateTime Example +================ +This program simply displays a modal dialog which contains a Month Calendar +control and a date time picker. The control displays the current date and +time, and give the user an opportunity to change them. + + +Features demonstrated in this example +===================================== +* Using a dialog as an application +* Using CDialog to display a dialog defined in a resource script (resource.rc) +* Hosting a Month Calendar control in a dialog, and interacting with it +* Using a Date Time picker to display and set the time + + +About Dialogs +============= +Dialog applications are easy to create, provided we have access to a +resource editor to build the resource script file for us (often called +resource.rc). Commercial compilers usually include a resource editor +for this purpose, but free compilers generally don't. A resource +editor is include with Microsoft's Visual Studio Studio Community. + diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/src/DialogApp.cpp b/packages/media/cpp/packages/Win32xx/samples/DateTime/src/DialogApp.cpp new file mode 100644 index 00000000..c8fe741b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/src/DialogApp.cpp @@ -0,0 +1,26 @@ +///////////////////////////// +// DialogApp.cpp +// + +#include "stdafx.h" +#include "DialogApp.h" +#include "resource.h" + +////////////////////////////////// +// CDialogApp function definitions +// + +// Constructor. +CDialogApp::CDialogApp() : m_myDialog(IDD_DIALOG1) +{ +} + +// Called when the application starts. +BOOL CDialogApp::InitInstance() +{ + // Display the modal dialog. + m_myDialog.DoModal(); // throws a CWinException on failure + + return TRUE; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/src/DialogApp.h b/packages/media/cpp/packages/Win32xx/samples/DateTime/src/DialogApp.h new file mode 100644 index 00000000..bd3d111f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/src/DialogApp.h @@ -0,0 +1,33 @@ +///////////////////////////// +// DialogApp.h +// + +#ifndef DIALOGAPP_H +#define DIALOGAPP_H + +#include "MyDialog.h" + + +///////////////////////////////////////////////////////////////// +// CDialogApp manages the application. It initializes the Win32++ +// framework when it is constructed, and creates the main dialog +// when it runs. +class CDialogApp : public CWinApp +{ +public: + CDialogApp(); + virtual ~CDialogApp() override = default; + +protected: + virtual BOOL InitInstance() override; + +private: + CDialogApp(const CDialogApp&) = delete; + CDialogApp& operator=(const CDialogApp&) = delete; + + CMyDialog m_myDialog; +}; + + +#endif // define DIALOGAPP_H + diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/src/MyDialog.cpp b/packages/media/cpp/packages/Win32xx/samples/DateTime/src/MyDialog.cpp new file mode 100644 index 00000000..a5868cce --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/src/MyDialog.cpp @@ -0,0 +1,148 @@ +///////////////////////////// +// MyDialog.cpp +// + +#include "stdafx.h" +#include "MyDialog.h" +#include "resource.h" + +////////////////////////////////////// +// Definitions for the CMyDialog class +// + +// Constructor. +CMyDialog::CMyDialog(UINT resID) : CDialog(resID) +{ +} + +// Called when the dialog window is destroyed. +void CMyDialog::OnDestroy() +{ + // End the application + ::PostQuitMessage(0); +} + +// Processes the dialog's window messages. +INT_PTR CMyDialog::DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case WM_TIMER: + if (wparam == ID_TIMER) + { + // Update the time displayed every second + SYSTEMTIME lt; + GetLocalTime(<); + m_dateTime.SetTime(lt); + + return 0; + } + } + + // Pass unhandled messages on to parent DialogProc. + return DialogProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + +// Called when a control sends a command notification (WM_COMMAND). +BOOL CMyDialog::OnCommand(WPARAM wparam, LPARAM) +{ + UINT id = LOWORD(wparam); + + switch(id) + { + case IDC_BUTTONSET: + { + SYSTEMTIME month = m_monthCal.GetCurSel(); + SYSTEMTIME all = m_dateTime.GetTime(); + + all.wDay = month.wDay; + all.wMonth = month.wMonth; + all.wYear = month.wYear; + + if (!SetLocalTime(&all)) + { + MessageBox(L"Failed to set the time\nRun app as Administrator", + L"Set Time Failed", MB_OK); + } + return TRUE; + } + + case IDC_BUTTONCANCEL: + { + TRACE(L"Cancel Button Pressed\n"); + OnCancel(); + return TRUE; + } + } + + return FALSE; +} + +// Called before the dialog is displayed. +BOOL CMyDialog::OnInitDialog() +{ + // Set the Icon + SetIconLarge(IDW_MAIN); + SetIconSmall(IDW_MAIN); + + // Attach the dialog items to the CWnd objects + AttachItem(IDC_DATETIMEPICKER1, m_dateTime); + AttachItem(IDC_MONTHCALENDAR1, m_monthCal); + + // Set timer for 1000 milliseconds + SetTimer(ID_TIMER, 1000, 0); + + return TRUE; +} + +// Called when a notification (WM_NOTIFY) is received. +LRESULT CMyDialog::OnNotify(WPARAM wparam, LPARAM lparam) +{ + UNREFERENCED_PARAMETER(wparam); + + LPNMHDR pHeader = reinterpret_cast(lparam); + switch (pHeader->code) + { + case DTN_DATETIMECHANGE: + // Stop the timer when the DataeTime's time is changed + KillTimer(ID_TIMER); + break; + case NM_KILLFOCUS: + // Set timer for 1000 milliseconds + SetTimer(ID_TIMER, 1000, 0); + break; + } + + return 0; +} + +// Called when the enter key is pressed. +void CMyDialog::OnOK() +{ + // This function suppresses the default OnOK +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/src/MyDialog.h b/packages/media/cpp/packages/Win32xx/samples/DateTime/src/MyDialog.h new file mode 100644 index 00000000..a7e9334a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/src/MyDialog.h @@ -0,0 +1,37 @@ +///////////////////////////// +// MyDialog.h +// + +#ifndef MYDIALOG_H +#define MYDIALOG_H + +#define ID_TIMER 101 + + +/////////////////////////////////////////////////// +// CMyDialog manages the application's main dialog. +class CMyDialog : public CDialog +{ +public: + CMyDialog(UINT resID); + virtual ~CMyDialog() override = default; + +protected: + virtual void OnDestroy() override; + virtual BOOL OnInitDialog() override; + virtual INT_PTR DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual BOOL OnCommand(WPARAM wparam, LPARAM lparam) override; + virtual LRESULT OnNotify(WPARAM wparam, LPARAM lparam) override; + virtual void OnOK() override; + +private: + CMyDialog(const CMyDialog&) = delete; + CMyDialog& operator=(const CMyDialog&) = delete; + + // Member variables + CDateTime m_dateTime; + CMonthCalendar m_monthCal; + +}; + +#endif //MYDIALOG_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/src/Resource.rc b/packages/media/cpp/packages/Win32xx/samples/DateTime/src/Resource.rc new file mode 100644 index 00000000..a62b4c24 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/src/Resource.rc @@ -0,0 +1,128 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "../src/res/PerMonitorV2.manifest" + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDW_MAIN ICON "../src/res/DateTime.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_BITMAP1 BITMAP "../src/res/Zapotec.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_DIALOG1 DIALOGEX 0, 0, 284, 141 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_APPWINDOW +CAPTION "Date and Time" +FONT 8, "MS Shell Dlg", 0, 0 +BEGIN + CONTROL "",IDC_MONTHCALENDAR1,"SysMonthCal32",MCS_NOTODAY | WS_TABSTOP,12,25,154,100 + CONTROL "",IDC_DATETIMEPICKER1,"SysDateTimePick32",DTS_UPDOWN | WS_TABSTOP | 0x8,175,27,95,13 + LTEXT "Set the date and time:",IDC_STATIC,181,54,82,8 + LTEXT "Date",IDC_STATIC,14,14,49,8 + LTEXT "Time",IDC_STATIC,176,15,55,8 + PUSHBUTTON "Cancel",IDC_BUTTONCANCEL,196,99,44,14 + PUSHBUTTON "Set",IDC_BUTTONSET,196,73,44,14 +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_DIALOG1, DIALOG + BEGIN + RIGHTMARGIN, 283 + BOTTOMMARGIN, 140 + END +END +#endif // APSTUDIO_INVOKED + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/src/StdAfx.cpp b/packages/media/cpp/packages/Win32xx/samples/DateTime/src/StdAfx.cpp new file mode 100644 index 00000000..8957144d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/src/StdAfx.cpp @@ -0,0 +1,16 @@ +///////////////////////////// +// StdAfx.cpp +// + +// This file is used for precompiled hearders. Precompiled headers allow +// programs to be recompiled more quickly + +// To use precompiled headers, do the following: +// 1) Add the set of rarely changed headers to stdafx.h +// 2) Include stdafx.h in each cpp file. It must be included first. +// 3) Add stdafx.cpp to your project. +// 4) Turn on precompiled hearders in the project + + +#include "stdafx.h" + diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/src/main.cpp b/packages/media/cpp/packages/Win32xx/samples/DateTime/src/main.cpp new file mode 100644 index 00000000..e7d0b704 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/src/main.cpp @@ -0,0 +1,41 @@ +///////////////////////////// +// main.cpp +// + +#include "stdafx.h" +#include "DialogApp.h" + +int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPWSTR, _In_ int) +{ + try + { + // Start Win32++. + CDialogApp theApp; + + // Run the application. + return theApp.Run(); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return -1; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/src/res/DateTime.ico b/packages/media/cpp/packages/Win32xx/samples/DateTime/src/res/DateTime.ico new file mode 100644 index 00000000..3c109f60 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DateTime/src/res/DateTime.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/src/res/PerMonitorV2.manifest b/packages/media/cpp/packages/Win32xx/samples/DateTime/src/res/PerMonitorV2.manifest new file mode 100644 index 00000000..d303e5c0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/src/res/PerMonitorV2.manifest @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + PerMonitorV2, PerMonitor + + + + + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/src/res/Zapotec.bmp b/packages/media/cpp/packages/Win32xx/samples/DateTime/src/res/Zapotec.bmp new file mode 100644 index 00000000..9c5f34e8 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DateTime/src/res/Zapotec.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/src/resource.h b/packages/media/cpp/packages/Win32xx/samples/DateTime/src/resource.h new file mode 100644 index 00000000..22d7584e --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/src/resource.h @@ -0,0 +1,30 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Resource.rc +// + +// include the Resource IDs defined by Win32++ +#include "default_resource.h" + +//The resource ID for MENU, ICON, ToolBar Bitmap, Accelerator, +// and Window Caption + +//Resource IDs for the dialog +#define IDD_DIALOG1 121 +#define IDC_BUTTONSET 141 +#define IDC_BUTTONCANCEL 142 +#define IDC_MONTHCALENDAR1 143 +#define IDC_DATETIMEPICKER1 144 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 130 +#endif +#endif + diff --git a/packages/media/cpp/packages/Win32xx/samples/DateTime/src/stdafx.h b/packages/media/cpp/packages/Win32xx/samples/DateTime/src/stdafx.h new file mode 100644 index 00000000..08450116 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DateTime/src/stdafx.h @@ -0,0 +1,90 @@ +///////////////////////////// +// StdAfx.h +// + +// This file is used for precompiled headers. +// Rarely modified header files should be included. +// Based on code provided by Lynn Allan. + + +#ifndef STDAFX_H +#define STDAFX_H + + +// Predefinitions for windows.h go here +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +// Specify Win32xx specific predefinitions here +//#define NO_USING_NAMESPACE // Don't use Win32xx namespace + +// Rarely modified header files should be included here +#include // Add support for std::vector +#include // Add support for std::map +#include // Add support for std::string +#include // Add support for stringstream +#include // Add support for the assert macro +#include // Add support for C style printf, sprintf, etc. +#include // Add support for C style character conversions atoi etc. +#include // Add support for C style TCHARs. + +// Add the Win32++ library +#include // Add CWinApp +#include // Add CArchive +#include // Add CAnimation, CComboBox, CComboBoxEx, CDateTime, CHeader, CHotKey, CIPAddress, CProgressBar, CSpinButton, CScrollBar, CSlider, CToolTip +#include // Add CCriticalSection, CThreadLock +#include // Add CString, CStringA, CStringW +#include // Add CDataExchange +#include // Add CDialog, CResizer +#include // Add CDockFrame, CMDIDockFrame +#include // Add CDocker, CDockContainer +#include // Add CException, CFileException, CNotSupportedException, CResourceException, CUserException, CWinException +#include // Add CFile +#include // Add CFileFind +#include // Add CFolderDialog +#include // Add CFrame +#include // Add CDC, CGDIObject, CBitmap, CBrush, CFont, CPalatte, CPen, CRgn +#include // Add CHGlobal +#include // Add CImageList +#include // Add CListView +#include // Add CMDIChild, CMDIFrame, CDockMDIFrame +#include // Add CMenu +#include // Add CMenuBar +#include // Add CMetaFile, CEnhMetaFile +#include // Add CEvent, CMutex, CSemaphore +#include // Add CPropertyPage, CPropertySheet +#include // Add CRebar +#include // Add CPoint, CRect, CSize +#include // Add CRegKey +#include // Add CRichEdit +#include // Add CScrollView +#include // Adds macros, windows header files, and CObject +#include // Add CSocket +#include // Add CStatusBar +#include // Add CButton, CEdit, CListBox +#include // Add CTab, CTabbedMDI +#include // Add AtoT, AtoW, TtoA, TtoW, WtoA, WtoT etc. +#include // Add MenuTheme, ReBarTheme, StatusBarTheme, ToolBarTheme +#include // Add CWinThread +#include // Add CTime +#include // Add CToolBar +#include // Add CTreeView +#include // Add CWebBrowser, CAXHost +#include // Add CWnd + +// WIN32_LEAN_AND_MEAN can't be used with these +#ifndef WIN32_LEAN_AND_MEAN + #include // Add CCommonDialog, CColorDialog, CFileDialog, CFindReplace, CFontDialog + #include // Add CFolderDialogEx + #include // Add CPrintPreview + #include // Add CPageSetupDialog, CPrintDialog + #include // Add CPrintDialogEx + #include // Add CTaskDialog + + // Visual Studio + #if defined (_MSC_VER) + #include // Add CRibbon, CRibbonFrame + #endif + +#endif // define WIN32_LEAN_AND_MEAN + +#endif // define STDAFX_H diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog.cbp b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog.cbp new file mode 100644 index 00000000..2d06cc3a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog.cbp @@ -0,0 +1,139 @@ + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog.cbproj b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog.cbproj new file mode 100644 index 00000000..42e2fb1a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog.cbproj @@ -0,0 +1,1518 @@ + + + {39461456-1040-43CB-9B40-5962EF847BB0} + 20.1 + None + True + Release + Win64x + 1048579 + Application + Dialog + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + JPHNE + .\Embarcadero\$(Platform)\$(Config) + .\Embarcadero\$(Platform)\$(Config) + false + true + true + $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + CppGuiApplication + System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + true + <_TCHARMapping>wchar_t + Dialog + ..\..\..\include\;..\src\;$(IncludePath) + ..\..\..\include\;..\src\;$(ILINK_LibraryPath) + 3081 + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + $(BDSINCLUDE)\windows\sdk;$(BRCC_IncludePath) + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + ..\src\stdafx.h + none + + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + false + true + false + true + _DEBUG;$(Defines) + false + None + DEBUG + true + true + true + true + Full + true + true + true + true + true + $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) + $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + + + PerMonitorV2 + false + $(BDSLIB)\$(PLATFORM)$(CC_SUFFIX)\debug;$(ILINK_LibraryPath) + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + + + NDEBUG;$(Defines) + None + + + PerMonitorV2 + false + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 0 + + + 1 + + + 2 + + + 3 + + + 4 + + + 5 + + +
Resource.res
+ 6 +
+ + 7 + + + 8 + true + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + +
+ + CPlusPlusBuilder.Personality.12 + CppGuiApplication + + + + False + True + True + False + + + Embarcadero C++Builder Office 2000 Servers Package + Embarcadero C++Builder Office XP Servers Package + + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + Assets\ + Logo150x150.png + true + + + + + Assets\ + Logo44x44.png + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + Dialog.exe + true + + + + + Dialog.exe + true + + + + + NewProject.exe + true + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 64 + + + classes + 64 + + + + + res\xml + 1 + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\mips + 1 + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-v21 + 1 + + + res\values-v21 + 1 + + + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + Contents + 1 + + + Contents + 1 + + + Contents + 1 + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + library\lib\armeabi-v7a + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen + 64 + + + ..\$(PROJECTNAME).launchscreen + 64 + + + + + 1 + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + + + + + + + + + + + + + True + True + True + + + 12 + + + + +
diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2015.sln b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2015.sln new file mode 100644 index 00000000..e27f00a5 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2015.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Dialog", "Dialog_2015.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2015.vcxproj b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2015.vcxproj new file mode 100644 index 00000000..8e2b898d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2015.vcxproj @@ -0,0 +1,247 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Dialog + Dialog + + + + Application + Unicode + v140_xp + + + Application + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + + + + + + + + + + + + + + + + + true + false + + + true + false + + + false + false + + + false + false + + + + Use + Level4 + true + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2015.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2015.vcxproj.filters new file mode 100644 index 00000000..f78b675d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2015.vcxproj.filters @@ -0,0 +1,215 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + {86790b47-d32f-41a7-b741-89ee90d64b6d} + + + {e15d7f75-acf5-492f-ba57-b883f91cfdc5} + + + {1dcddfe4-dd07-43c5-a6d4-b6a46f049287} + + + {cbba403a-bc76-477a-b285-e00b59b0a45a} + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2019.sln b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2019.sln new file mode 100644 index 00000000..de4c122f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2019.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Dialog", "Dialog_2019.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {392D2838-D0A9-4008-88BB-4C6DE614FB29} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2019.vcxproj b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2019.vcxproj new file mode 100644 index 00000000..97145fb8 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2019.vcxproj @@ -0,0 +1,224 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Dialog + Dialog + + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + Use + Level4 + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + MultiThreadedDebug + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + MultiThreadedDebug + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + MultiThreaded + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + MultiThreaded + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2019.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2019.vcxproj.filters new file mode 100644 index 00000000..1f34dfe1 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2019.vcxproj.filters @@ -0,0 +1,215 @@ + + + + + {7ee81e69-d248-4674-8c2f-4772fd081cd6} + + + {74fb6970-1067-49d0-a9cd-a950730acaee} + + + {b990b21e-c34d-4e72-9e3e-9a0eadc52220} + + + {49aa0452-31d2-4b78-8527-075aa0d8f3d2} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2022.sln b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2022.sln new file mode 100644 index 00000000..c624a130 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2022.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Dialog", "Dialog_2022.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {2847A20C-5D88-4820-9193-D4A3044EF53F} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2022.vcxproj b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2022.vcxproj new file mode 100644 index 00000000..22e2f828 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2022.vcxproj @@ -0,0 +1,235 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Dialog + Dialog + 10.0 + + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + MultiThreadedDebug + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + MultiThreadedDebug + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + MultiThreaded + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + MultiThreaded + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2022.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2022.vcxproj.filters new file mode 100644 index 00000000..1f34dfe1 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2022.vcxproj.filters @@ -0,0 +1,215 @@ + + + + + {7ee81e69-d248-4674-8c2f-4772fd081cd6} + + + {74fb6970-1067-49d0-a9cd-a950730acaee} + + + {b990b21e-c34d-4e72-9e3e-9a0eadc52220} + + + {49aa0452-31d2-4b78-8527-075aa0d8f3d2} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2026.slnx b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2026.slnx new file mode 100644 index 00000000..670f73a3 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2026.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2026.vcxproj b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2026.vcxproj new file mode 100644 index 00000000..0e9a1bf4 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2026.vcxproj @@ -0,0 +1,235 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Dialog + Dialog + 10.0 + + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + MultiThreadedDebug + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + MultiThreadedDebug + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + MultiThreaded + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + MultiThreaded + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2026.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2026.vcxproj.filters new file mode 100644 index 00000000..ebee0ac3 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_2026.vcxproj.filters @@ -0,0 +1,215 @@ + + + + + {7ee81e69-d248-4674-8c2f-4772fd081cd6} + + + {74fb6970-1067-49d0-a9cd-a950730acaee} + + + {b990b21e-c34d-4e72-9e3e-9a0eadc52220} + + + {49aa0452-31d2-4b78-8527-075aa0d8f3d2} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_DEBUG.dev b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_DEBUG.dev new file mode 100644 index 00000000..547c64a1 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_DEBUG.dev @@ -0,0 +1,141 @@ +[Project] +FileName=Dialog_DEBUG.dev +Name=Dialog +UnitCount=9 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=Dialog_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D_DEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@__@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Debug +ObjectOutput=.\Dev-C++\Debug +OverrideOutput=1 +OverrideOutputName=Dialog.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=4 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[Unit1] +FileName=..\src\DialogApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\DialogApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\MyDialog.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\MyDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\Resource.rc +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit8] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_RELEASE.dev b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_RELEASE.dev new file mode 100644 index 00000000..dffabd51 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/ProjectFiles/Dialog_RELEASE.dev @@ -0,0 +1,141 @@ +[Project] +FileName=Dialog_RELEASE.dev +Name=Dialog +UnitCount=9 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=Dialog_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D NDEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-s_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Release +ObjectOutput=.\Dev-C++\Release +OverrideOutput=1 +OverrideOutputName=Dialog.exe +HostApplication= +Folders=Header,Resource,Source +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=3 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[Unit1] +FileName=..\src\DialogApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\DialogApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\MyDialog.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\MyDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\Resource.rc +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit8] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/Dialog/Readme.txt new file mode 100644 index 00000000..c6715eeb --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/Readme.txt @@ -0,0 +1,20 @@ +Dialog Example +============== +This program simply displays a modal dialog. It might prove a useful +starting point for your own dialog based projects. + + +Features demonstrated in this example +===================================== +* Using a dialog as an application +* Using CDialog to display a dialog defined in a resource script (resource.rc) + + +About Dialogs +============= +Dialog applications are easy to create, provided we have access to a resource +editor to build the resource script file for us (often called resource.rc). +Commercial compilers usually include a resource editor for this purpose, but +many free compilers don't. A resource editor is included with Microsoft's +Visual Studio Studio Community. + diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/src/DialogApp.cpp b/packages/media/cpp/packages/Win32xx/samples/Dialog/src/DialogApp.cpp new file mode 100644 index 00000000..544c61d1 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/src/DialogApp.cpp @@ -0,0 +1,27 @@ +///////////////////////////// +// DialogApp.cpp +// + +#include "stdafx.h" +#include "DialogApp.h" +#include "resource.h" + + +////////////////////////////////// +// CDialogApp function definitions +// + +// Constructor. +CDialogApp::CDialogApp() : m_myDialog(IDD_DIALOG1) +{ +} + +// Called when the application starts. +BOOL CDialogApp::InitInstance() +{ + // Display the modal dialog. + m_myDialog.DoModal(); // throws a CWinException on failure. + + return TRUE; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/src/DialogApp.h b/packages/media/cpp/packages/Win32xx/samples/Dialog/src/DialogApp.h new file mode 100644 index 00000000..7954aeb4 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/src/DialogApp.h @@ -0,0 +1,32 @@ +///////////////////////////// +// DialogApp.h +// + +#ifndef DIALOGAPP_H +#define DIALOGAPP_H + +#include "MyDialog.h" + + +//////////////////////////////////////////////////////////////// +// CDialogApp manages the application. It initializes the Win32++ +// framework when it is constructed, and creates the main dialog +// when it runs. +class CDialogApp : public CWinApp +{ +public: + CDialogApp(); + virtual ~CDialogApp() override = default; + +protected: + virtual BOOL InitInstance() override; + +private: + CDialogApp(const CDialogApp&) = delete; + CDialogApp& operator=(const CDialogApp&) = delete; + + CMyDialog m_myDialog; +}; + + +#endif // define DIALOGAPP_H diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/src/MyDialog.cpp b/packages/media/cpp/packages/Win32xx/samples/Dialog/src/MyDialog.cpp new file mode 100644 index 00000000..4ee566ad --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/src/MyDialog.cpp @@ -0,0 +1,163 @@ +///////////////////////////// +// MyDialog.cpp +// + +#include "stdafx.h" +#include "MyDialog.h" +#include "resource.h" + +///////////////////////////////// +// CMyDialog function definitions +// + +// Constructor. +CMyDialog::CMyDialog(UINT resID) : CDialog(resID) +{ +} + +// Called when the dialog window is destroyed. +void CMyDialog::OnDestroy() +{ + // End the application + ::PostQuitMessage(0); +} + +// Process the dialog's window messages. +INT_PTR CMyDialog::DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // switch (msg) + // { + // Additional messages to be handled go here + // } + + // Pass unhandled messages on to parent DialogProc. + return DialogProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + +// Handle the command notifications from controls. +BOOL CMyDialog::OnCommand(WPARAM wparam, LPARAM) +{ + UINT id = LOWORD(wparam); + switch (id) + { + case IDC_BUTTON1: return OnButton(); + case IDC_CHECK1: return OnCheck1(); + case IDC_CHECK2: return OnCheck2(); + case IDC_CHECK3: return OnCheck3(); + + case IDC_RADIO1: + case IDC_RADIO2: // intentionally blank + case IDC_RADIO3: return OnRangeOfRadioIDs(IDC_RADIO1, IDC_RADIO3, id); + } + + return FALSE; +} + +// Called before the dialog is displayed. +BOOL CMyDialog::OnInitDialog() +{ + // Set the application icon + SetIconLarge(IDW_MAIN); + SetIconSmall(IDW_MAIN); + + // Attach the controls to our CWnd member objects. + AttachItem(IDC_EDIT1, m_edit); + AttachItem(IDC_LIST1, m_listBox); + AttachItem(IDC_RICHEDIT1, m_richEdit); + + // Put some text in the edit boxes + SetDlgItemText(IDC_EDIT1, L"Edit Control"); + SetDlgItemText(IDC_RICHEDIT1, L"Rich Edit Window"); + + // Put some text in the list box + for (int i = 0; i < 8; i++) + m_listBox.AddString(L"ListBox"); + + // Select the first radio button + CheckRadioButton(IDC_RADIO1, IDC_RADIO3, IDC_RADIO1); + + // Adjust the pattern image size. + m_patternImage.LoadBitmap(IDB_BITMAP1); + m_patternImage = DpiScaleUpBitmap(m_patternImage); + LPARAM lparam = reinterpret_cast(m_patternImage.GetHandle()); + SendDlgItemMessage(IDC_STATIC1, STM_SETIMAGE, IMAGE_BITMAP, lparam); + + return TRUE; +} + +// Called when the OK button or Enter key is pressed. +void CMyDialog::OnOK() +{ + MessageBox(L"OK Button Pressed. Program will exit now.", L"Button", MB_OK); + CDialog::OnOK(); +} + +// Called when the button is pressed. +BOOL CMyDialog::OnButton() +{ + SetDlgItemText(IDC_STATIC3, L"Button Pressed"); + TRACE("Button Pressed\n"); + return TRUE; +} + +// Called when Check Box 1 is clicked. +BOOL CMyDialog::OnCheck1() +{ + SetDlgItemText(IDC_STATIC3, L"Check Box 1"); + TRACE("Check Box 1\n"); + return TRUE; +} + +// Called when Check Box 2 is clicked. +BOOL CMyDialog::OnCheck2() +{ + SetDlgItemText(IDC_STATIC3, L"Check Box 2"); + TRACE("Check Box 2\n"); + return TRUE; +} + +// Called when Check Box 3 is clicked. +BOOL CMyDialog::OnCheck3() +{ + SetDlgItemText(IDC_STATIC3, L"Check Box 3"); + TRACE("Check Box 3\n"); + return TRUE; +} + +// Called when a radio button is selected. +BOOL CMyDialog::OnRangeOfRadioIDs(UINT idFirst, UINT idLast, UINT idClicked) +{ + CheckRadioButton(idFirst, idLast, idClicked); + + CString str; + UINT button = idClicked - idFirst + 1U; + str << "Radio" << button; + TRACE(str); TRACE("\n"); + SetDlgItemText(IDC_STATIC3, str); + + return TRUE; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/src/MyDialog.h b/packages/media/cpp/packages/Win32xx/samples/Dialog/src/MyDialog.h new file mode 100644 index 00000000..87842f2c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/src/MyDialog.h @@ -0,0 +1,44 @@ +///////////////////////////// +// MyDialog.h +// + +#ifndef MYDIALOG_H +#define MYDIALOG_H + + +/////////////////////////////////////////////////// +// CMyDialog manages the application's main dialog. +class CMyDialog : public CDialog +{ +public: + CMyDialog(UINT resID); + virtual ~CMyDialog() override = default; + +protected: + virtual void OnDestroy() override; + virtual BOOL OnInitDialog() override; + virtual INT_PTR DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual BOOL OnCommand(WPARAM wparam, LPARAM lparam) override; + virtual void OnOK() override; + +private: + CMyDialog(const CMyDialog&) = delete; + CMyDialog& operator=(const CMyDialog&) = delete; + + // Command handlers + BOOL OnButton(); + BOOL OnCheck1(); + BOOL OnCheck2(); + BOOL OnCheck3(); + BOOL OnRangeOfRadioIDs(UINT idFirst, UINT idLast, UINT idClicked); + + // Member variables + CEdit m_edit; + CListBox m_listBox; + CRichEdit m_richEdit; + CFont m_font; + CBitmap m_patternImage; + +}; + +#endif //MYDIALOG_H diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/src/Resource.rc b/packages/media/cpp/packages/Win32xx/samples/Dialog/src/Resource.rc new file mode 100644 index 00000000..1b6c7300 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/src/Resource.rc @@ -0,0 +1,115 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "../src/res/PerMonitorV2.manifest" + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDW_MAIN ICON "../src/res/Dialog.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_BITMAP1 BITMAP "../src/res/Zapotec.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_DIALOG1 DIALOGEX 0, 0, 320, 200 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | + WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_APPWINDOW +CAPTION "My Dialog" +//FONT 8, "MS Shell Dlg", 0, 0, 0x1 +FONT 8, "MS Shell Dlg", 0, 0 +BEGIN + DEFPUSHBUTTON "OK",IDOK,241,153,50,16 + CONTROL "Radio1",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,30,24,38, + 10 + CONTROL "Radio2",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,30,36,38, + 10 + CONTROL "Radio3",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,30,48,38, + 10 + EDITTEXT IDC_EDIT1,120,82,84,35,ES_MULTILINE | ES_WANTRETURN | + ES_AUTOHSCROLL | NOT WS_BORDER,WS_EX_STATICEDGE + CONTROL "Check Box 1",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,30,114,55,10 + CONTROL "Check Box 2",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,30,126,55,10 + CONTROL "Check Box 3",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,30,139,55,10 + LISTBOX IDC_LIST1,120,23,84,35,LBS_SORT | LBS_NOINTEGRALHEIGHT | + NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP,WS_EX_STATICEDGE + PUSHBUTTON "Button",IDC_BUTTON1,30,82,49,11 + CONTROL "",IDC_RICHEDIT1,"RichEdit50W" ,ES_MULTILINE | ES_WANTRETURN | + ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP,120,142,84,35 + CONTROL IDB_BITMAP1,IDC_STATIC1,"Static",SS_BITMAP,231,7,64,59 + GROUPBOX "Static Window",IDC_STATIC2,226,78,78,51,BS_CENTER + LTEXT "Actions are displayed here",IDC_STATIC3,229,91,71,35 +END + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/src/StdAfx.cpp b/packages/media/cpp/packages/Win32xx/samples/Dialog/src/StdAfx.cpp new file mode 100644 index 00000000..8957144d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/src/StdAfx.cpp @@ -0,0 +1,16 @@ +///////////////////////////// +// StdAfx.cpp +// + +// This file is used for precompiled hearders. Precompiled headers allow +// programs to be recompiled more quickly + +// To use precompiled headers, do the following: +// 1) Add the set of rarely changed headers to stdafx.h +// 2) Include stdafx.h in each cpp file. It must be included first. +// 3) Add stdafx.cpp to your project. +// 4) Turn on precompiled hearders in the project + + +#include "stdafx.h" + diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/src/main.cpp b/packages/media/cpp/packages/Win32xx/samples/Dialog/src/main.cpp new file mode 100644 index 00000000..df822a3f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/src/main.cpp @@ -0,0 +1,41 @@ +///////////////////////////// +// main.cpp +// + +#include "stdafx.h" +#include "DialogApp.h" + +int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPWSTR, _In_ int) +{ + try + { + // Start Win32++. + CDialogApp theApp; + + // Run the application. + return theApp.Run(); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return -1; + } + diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/src/res/Dialog.ico b/packages/media/cpp/packages/Win32xx/samples/Dialog/src/res/Dialog.ico new file mode 100644 index 00000000..4730e915 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Dialog/src/res/Dialog.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/src/res/PerMonitorV2.manifest b/packages/media/cpp/packages/Win32xx/samples/Dialog/src/res/PerMonitorV2.manifest new file mode 100644 index 00000000..d303e5c0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/src/res/PerMonitorV2.manifest @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + PerMonitorV2, PerMonitor + + + + + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/src/res/Zapotec.bmp b/packages/media/cpp/packages/Win32xx/samples/Dialog/src/res/Zapotec.bmp new file mode 100644 index 00000000..9c5f34e8 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Dialog/src/res/Zapotec.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/src/resource.h b/packages/media/cpp/packages/Win32xx/samples/Dialog/src/resource.h new file mode 100644 index 00000000..95cfddf6 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/src/resource.h @@ -0,0 +1,41 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Resource.rc +// + +// include the Resource IDs defined by Win32++ +#include "default_resource.h" + +//The resource ID for MENU, ICON, ToolBar Bitmap, Accelerator, +// and Window Caption + +//Resource IDs for the dialog +#define IDD_DIALOG1 121 +#define IDC_RADIO1 130 +#define IDC_RADIO2 131 +#define IDC_RADIO3 132 +#define IDC_CHECK1 133 +#define IDC_CHECK2 134 +#define IDC_CHECK3 135 +#define IDC_EDIT1 140 +#define IDC_LIST1 141 +#define IDC_BUTTON1 142 +#define IDC_RICHEDIT1 153 +#define IDC_STATIC1 150 +#define IDC_STATIC2 151 +#define IDC_STATIC3 152 +#define IDC_HOTKEY1 153 +#define IDB_BITMAP1 154 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 130 +#endif +#endif + diff --git a/packages/media/cpp/packages/Win32xx/samples/Dialog/src/stdafx.h b/packages/media/cpp/packages/Win32xx/samples/Dialog/src/stdafx.h new file mode 100644 index 00000000..08450116 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dialog/src/stdafx.h @@ -0,0 +1,90 @@ +///////////////////////////// +// StdAfx.h +// + +// This file is used for precompiled headers. +// Rarely modified header files should be included. +// Based on code provided by Lynn Allan. + + +#ifndef STDAFX_H +#define STDAFX_H + + +// Predefinitions for windows.h go here +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +// Specify Win32xx specific predefinitions here +//#define NO_USING_NAMESPACE // Don't use Win32xx namespace + +// Rarely modified header files should be included here +#include // Add support for std::vector +#include // Add support for std::map +#include // Add support for std::string +#include // Add support for stringstream +#include // Add support for the assert macro +#include // Add support for C style printf, sprintf, etc. +#include // Add support for C style character conversions atoi etc. +#include // Add support for C style TCHARs. + +// Add the Win32++ library +#include // Add CWinApp +#include // Add CArchive +#include // Add CAnimation, CComboBox, CComboBoxEx, CDateTime, CHeader, CHotKey, CIPAddress, CProgressBar, CSpinButton, CScrollBar, CSlider, CToolTip +#include // Add CCriticalSection, CThreadLock +#include // Add CString, CStringA, CStringW +#include // Add CDataExchange +#include // Add CDialog, CResizer +#include // Add CDockFrame, CMDIDockFrame +#include // Add CDocker, CDockContainer +#include // Add CException, CFileException, CNotSupportedException, CResourceException, CUserException, CWinException +#include // Add CFile +#include // Add CFileFind +#include // Add CFolderDialog +#include // Add CFrame +#include // Add CDC, CGDIObject, CBitmap, CBrush, CFont, CPalatte, CPen, CRgn +#include // Add CHGlobal +#include // Add CImageList +#include // Add CListView +#include // Add CMDIChild, CMDIFrame, CDockMDIFrame +#include // Add CMenu +#include // Add CMenuBar +#include // Add CMetaFile, CEnhMetaFile +#include // Add CEvent, CMutex, CSemaphore +#include // Add CPropertyPage, CPropertySheet +#include // Add CRebar +#include // Add CPoint, CRect, CSize +#include // Add CRegKey +#include // Add CRichEdit +#include // Add CScrollView +#include // Adds macros, windows header files, and CObject +#include // Add CSocket +#include // Add CStatusBar +#include // Add CButton, CEdit, CListBox +#include // Add CTab, CTabbedMDI +#include // Add AtoT, AtoW, TtoA, TtoW, WtoA, WtoT etc. +#include // Add MenuTheme, ReBarTheme, StatusBarTheme, ToolBarTheme +#include // Add CWinThread +#include // Add CTime +#include // Add CToolBar +#include // Add CTreeView +#include // Add CWebBrowser, CAXHost +#include // Add CWnd + +// WIN32_LEAN_AND_MEAN can't be used with these +#ifndef WIN32_LEAN_AND_MEAN + #include // Add CCommonDialog, CColorDialog, CFileDialog, CFindReplace, CFontDialog + #include // Add CFolderDialogEx + #include // Add CPrintPreview + #include // Add CPageSetupDialog, CPrintDialog + #include // Add CPrintDialogEx + #include // Add CTaskDialog + + // Visual Studio + #if defined (_MSC_VER) + #include // Add CRibbon, CRibbonFrame + #endif + +#endif // define WIN32_LEAN_AND_MEAN + +#endif // define STDAFX_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars.cbp b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars.cbp new file mode 100644 index 00000000..cbebf4f2 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars.cbp @@ -0,0 +1,140 @@ + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars.cbproj b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars.cbproj new file mode 100644 index 00000000..3a24dcb7 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars.cbproj @@ -0,0 +1,1525 @@ + + + {39461456-1040-43CB-9B40-5962EF847BB0} + 20.1 + None + True + Release + Win64x + 1048579 + Application + DialogBars + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + JPHNE + .\Embarcadero\$(Platform)\$(Config) + .\Embarcadero\$(Platform)\$(Config) + false + true + true + $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + CppGuiApplication + System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + true + <_TCHARMapping>wchar_t + DialogBars + ..\..\..\include\;..\src\;$(IncludePath) + ..\..\..\include\;..\src\;$(ILINK_LibraryPath) + 3081 + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + $(BDSINCLUDE)\windows\sdk;$(BRCC_IncludePath) + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + ..\src\stdafx.h + none + + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + false + true + false + true + _DEBUG;$(Defines) + false + None + DEBUG + true + true + true + true + Full + true + true + true + true + true + $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) + $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + + + PerMonitorV2 + false + $(BDSLIB)\$(PLATFORM)$(CC_SUFFIX)\debug;$(ILINK_LibraryPath) + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + <_TCHARMapping>wchar_t + + + PerMonitorV2 + true + 1033 + + + NDEBUG;$(Defines) + None + + + PerMonitorV2 + false + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 0 + + + 1 + + + 2 + + + 3 + + + 4 + + + 5 + + +
Resource.res
+ 6 +
+ + 7 + + + 8 + + + 9 + + + 10 + true + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + +
+ + CPlusPlusBuilder.Personality.12 + CppGuiApplication + + + + False + True + True + False + + + Embarcadero C++Builder Office 2000 Servers Package + Embarcadero C++Builder Office XP Servers Package + + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + Assets\ + Logo150x150.png + true + + + + + Assets\ + Logo44x44.png + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + DialogBars.exe + true + + + + + DialogBars.exe + true + + + + + NewProject.exe + true + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 64 + + + classes + 64 + + + + + res\xml + 1 + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\mips + 1 + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-v21 + 1 + + + res\values-v21 + 1 + + + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + Contents + 1 + + + Contents + 1 + + + Contents + 1 + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + library\lib\armeabi-v7a + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen + 64 + + + ..\$(PROJECTNAME).launchscreen + 64 + + + + + 1 + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + + + + + + + + + + + + + True + True + True + + + 12 + + + + +
diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2015.sln b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2015.sln new file mode 100644 index 00000000..33f8a00d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2015.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DialogBars", "DialogBars_2015.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2015.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2015.vcxproj new file mode 100644 index 00000000..94a70b08 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2015.vcxproj @@ -0,0 +1,171 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + + + + + + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DialogBars + DialogBars + + + + Application + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + + + + + + + + + + + true + false + + + false + false + + + + Use + Level4 + true + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2015.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2015.vcxproj.filters new file mode 100644 index 00000000..8ec479de --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2015.vcxproj.filters @@ -0,0 +1,221 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + {c5f8a84c-b2e0-4196-a94f-b68fdd88070d} + + + {98003bf0-4c17-4513-b2bb-b563b70fb54a} + + + {2144ad9e-6007-412b-85e2-81eb259f897f} + + + {e5a2f9fb-8bb7-4d6e-b527-7b6a3336a4af} + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2019.sln b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2019.sln new file mode 100644 index 00000000..ab86ed8a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2019.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DialogBars", "DialogBars_2019.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {7B148DBA-01CB-4CB6-B2B0-33D6C47A36D3} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2019.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2019.vcxproj new file mode 100644 index 00000000..85db3937 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2019.vcxproj @@ -0,0 +1,228 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DialogBars + DialogBars + + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2019.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2019.vcxproj.filters new file mode 100644 index 00000000..34c3fcf2 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2019.vcxproj.filters @@ -0,0 +1,221 @@ + + + + + {fe514656-404c-4376-b047-a5766fc80b26} + + + {84680a60-a017-4224-9306-a0c667a7d344} + + + {54d2c067-3d97-41a7-8bbc-a78ecd5ec247} + + + {9fcf0a1f-69d6-4bec-b763-5fc9aafe17e6} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2022.sln b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2022.sln new file mode 100644 index 00000000..8c86073a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2022.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DialogBars", "DialogBars_2022.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E6F03130-1A61-460C-AAA0-CFC871C7AFC2} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2022.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2022.vcxproj new file mode 100644 index 00000000..e5ab6e79 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2022.vcxproj @@ -0,0 +1,237 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DialogBars + DialogBars + 10.0 + + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2022.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2022.vcxproj.filters new file mode 100644 index 00000000..34c3fcf2 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2022.vcxproj.filters @@ -0,0 +1,221 @@ + + + + + {fe514656-404c-4376-b047-a5766fc80b26} + + + {84680a60-a017-4224-9306-a0c667a7d344} + + + {54d2c067-3d97-41a7-8bbc-a78ecd5ec247} + + + {9fcf0a1f-69d6-4bec-b763-5fc9aafe17e6} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2026.slnx b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2026.slnx new file mode 100644 index 00000000..b3af0abb --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2026.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2026.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2026.vcxproj new file mode 100644 index 00000000..c33924ca --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2026.vcxproj @@ -0,0 +1,237 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DialogBars + DialogBars + 10.0 + + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2026.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2026.vcxproj.filters new file mode 100644 index 00000000..84fef35e --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_2026.vcxproj.filters @@ -0,0 +1,221 @@ + + + + + {fe514656-404c-4376-b047-a5766fc80b26} + + + {84680a60-a017-4224-9306-a0c667a7d344} + + + {54d2c067-3d97-41a7-8bbc-a78ecd5ec247} + + + {9fcf0a1f-69d6-4bec-b763-5fc9aafe17e6} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_DEBUG.dev b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_DEBUG.dev new file mode 100644 index 00000000..5fb09b9a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_DEBUG.dev @@ -0,0 +1,201 @@ +[Project] +FileName=DialogBars_DEBUG.dev +Name=DialogBarsDemo +UnitCount=11 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=DialogBarsDemo_DEBUG_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D_DEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@__@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Debug +ObjectOutput=.\Dev-C++\Debug +OverrideOutput=1 +OverrideOutputName=DialogBars.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=4 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[Unit1] +FileName=..\src\DialogApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\DialogApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\MyDialog.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\MyDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\Resource.rc +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit8] +FileName=..\src\Scrollbar.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit10] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit11] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit13] +FileName=..\src\Slider.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit15] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\Scrollbar.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit17] +FileName=..\src\res\Zapotec.bmp +Folder=Resource +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit14] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_RELEASE.dev b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_RELEASE.dev new file mode 100644 index 00000000..1472d6ec --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/ProjectFiles/DialogBars_RELEASE.dev @@ -0,0 +1,192 @@ +[Project] +FileName=DialogBars_RELEASE.dev +Name=DialogBarsDemo +UnitCount=11 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=DialogBarsDemo_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D NDEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-s_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Release +ObjectOutput=.\Dev-C++\Release +OverrideOutput=1 +OverrideOutputName=DialogBars.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=3 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[Unit1] +FileName=..\src\DialogApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\DialogApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\MyDialog.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\MyDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\Resource.rc +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit8] +FileName=..\src\Scrollbar.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\Scrollbar.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit10] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit11] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit13] +FileName=..\src\Slider.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit14] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit15] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/DialogBars/Readme.txt new file mode 100644 index 00000000..efa2558f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/Readme.txt @@ -0,0 +1,13 @@ +DialogBars Example +================== +This program displays a modal dialog containing a slider control, a scroll bar +control and a progress bar control. These controls are attached to CWnd objects. + + +Features demonstrated in this example +===================================== +* Using a dialog as an application. +* Using a slider, scroll bar and progress bar control in a dialog. +* Use of AttachItem to attach a dialog control to a CWnd. +* Use of OnMessageReflect to handle notifications in the object that + generated them. \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/DialogApp.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/DialogApp.cpp new file mode 100644 index 00000000..8222a23b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/DialogApp.cpp @@ -0,0 +1,26 @@ +///////////////////////////// +// DialogApp.cpp +// + +#include "stdafx.h" +#include "DialogApp.h" +#include "resource.h" + + +////////////////////////////////// +// CDialogApp function definitions +// + +// Constructor. +CDialogApp::CDialogApp() : m_myDialog(IDD_DIALOG1) +{ +} + +// Called when the application starts. +BOOL CDialogApp::InitInstance() +{ + // Display the modal dialog. + m_myDialog.DoModal(); // throws a CWinException on failure. + + return TRUE; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/DialogApp.h b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/DialogApp.h new file mode 100644 index 00000000..fd700703 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/DialogApp.h @@ -0,0 +1,32 @@ +///////////////////////////// +// DialogApp.h +// + +#ifndef DIALOGAPP_H +#define DIALOGAPP_H + +#include "MyDialog.h" + + +///////////////////////////////////////////////////////////////// +// CDialogApp manages the application. It initializes the Win32++ +// framework when it is constructed, and creates the main dialog +// when it runs. +class CDialogApp : public CWinApp +{ +public: + CDialogApp(); + virtual ~CDialogApp() override = default; + +protected: + virtual BOOL InitInstance() override; + +private: + CDialogApp(const CDialogApp&) = delete; + CDialogApp& operator=(const CDialogApp&) = delete; + + CMyDialog m_myDialog; +}; + + +#endif // define DIALOGAPP_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/MyDialog.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/MyDialog.cpp new file mode 100644 index 00000000..f047cb81 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/MyDialog.cpp @@ -0,0 +1,133 @@ +///////////////////////////// +// MyDialog.cpp +// + +#include "stdafx.h" +#include "MyDialog.h" +#include "resource.h" + + +///////////////////////////////// +// CMyDialog function definitions +// + +// Constructor. +CMyDialog::CMyDialog(UINT resID) : CDialog(resID) +{ +} + +INT_PTR CMyDialog::DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case WM_HSCROLL: return OnHScroll(wparam, lparam); + } + + // Pass unhandled messages on to parent DialogProc. + return DialogProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + +// Called when the dialog window is destroyed. +void CMyDialog::OnDestroy() +{ + // End the application + ::PostQuitMessage(0); +} + +BOOL CMyDialog::OnHScroll(WPARAM wparam, LPARAM lparam) +{ + HWND wnd = reinterpret_cast(lparam); + int pos = 0; + bool isSlider = (wnd == m_slider.GetHwnd()); + + if (isSlider) + pos = m_slider.GetPos(); + else + pos = m_scrollBar.GetPos(wparam); + + SetSliderPos(pos); + SetScrollPos(pos); + SetProgressPos(pos); + SetStatic(isSlider, pos); + return TRUE; +} + +// Called before the dialog is displayed. +BOOL CMyDialog::OnInitDialog() +{ + // Set the Icon + SetIconLarge(IDW_MAIN); + SetIconSmall(IDW_MAIN); + + // Attach the dialog items to the CWnd objects + AttachItem(IDC_PROGRESS1, m_progressBar); + AttachItem(IDC_SCROLLBAR1, m_scrollBar); + AttachItem(IDC_SLIDER1, m_slider); + + m_slider.SetTicFreq(10); + + return TRUE; +} + +// Called when the OK button or Enter key is pressed. +void CMyDialog::OnOK() +{ + MessageBox(L"OK Button Pressed. Program will exit now.", L"Button", MB_OK); + CDialog::OnOK(); +} + +// Sets the progress bar's position. +void CMyDialog::SetProgressPos(int pos) +{ + m_progressBar.SetPos(pos); +} + +// Sets the scroll bar's position. +void CMyDialog::SetScrollPos(int pos) +{ + m_scrollBar.SetPos(pos); +} + +// Sets the slider control's position. +void CMyDialog::SetSliderPos(int pos) +{ + m_slider.SetPos(pos, TRUE); +} + +// Sets the static control's text. +void CMyDialog::SetStatic(bool isSlider, int pos) +{ + CString str; + if (isSlider) + str.Format(L"Slider Position %d", pos); + else + str.Format(L"Scroll Position %d", pos); + + // Set the text in the static control + SetDlgItemText(IDC_STATIC2, str); +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/MyDialog.h b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/MyDialog.h new file mode 100644 index 00000000..b94d20cc --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/MyDialog.h @@ -0,0 +1,43 @@ +///////////////////////////// +// MyDialog.h +// + +#ifndef MYDIALOG_H +#define MYDIALOG_H + +#include "Scrollbar.h" + + +/////////////////////////////////////////////////// +// CMyDialog manages the application's main dialog. +class CMyDialog : public CDialog +{ +public: + CMyDialog(UINT resID); + virtual ~CMyDialog() override = default; + +protected: + virtual INT_PTR DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual void OnDestroy() override; + virtual BOOL OnInitDialog() override; + virtual void OnOK() override; + +private: + CMyDialog(const CMyDialog&) = delete; + CMyDialog& operator=(const CMyDialog&) = delete; + + // Message Handlers + BOOL OnHScroll(WPARAM wparam, LPARAM lparam); + + void SetProgressPos(int pos); + void SetScrollPos(int pos); + void SetSliderPos(int pos); + void SetStatic(bool isSlider, int pos); + + // Member variables + CMyScrollBar m_scrollBar; + CSlider m_slider; + CProgressBar m_progressBar; +}; + +#endif //MYDIALOG_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/Resource.rc b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/Resource.rc new file mode 100644 index 00000000..75d3d73b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/Resource.rc @@ -0,0 +1,92 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "../src/res/PerMonitorV2.manifest" + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDW_MAIN ICON "../src/res/Dialog.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_DIALOG1 DIALOGEX 0, 0, 272, 146 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | + WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_APPWINDOW +CAPTION "My Dialog" +FONT 8, "MS Shell Dlg", 0, 0 +BEGIN + DEFPUSHBUTTON "OK",IDOK,193,98,50,16 + GROUPBOX "Static Control",IDC_STATIC1,178,14,78,51,BS_LEFT + LTEXT "Input displayed here",IDC_STATIC2,183,23,71,35 + CONTROL "",IDC_SLIDER1,"msctls_trackbar32",TBS_AUTOTICKS | + WS_TABSTOP,25,21,118,23 + CONTROL "",IDC_PROGRESS1,"msctls_progress32",0x0,32,99,104,21 + SCROLLBAR IDC_SCROLLBAR1,32,60,104,14 + LTEXT "Slider Control",IDC_STATIC,32,9,68,11 + LTEXT "Progress bar Control",IDC_STATIC,32,87,68,11 + LTEXT "Scroll bar Control",IDC_STATIC,32,50,68,11 +END + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/Scrollbar.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/Scrollbar.cpp new file mode 100644 index 00000000..3c8a0f28 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/Scrollbar.cpp @@ -0,0 +1,79 @@ +///////////////////////////// +// ScrollBar.cpp +// + +#include "stdafx.h" +#include "Scrollbar.h" +#include "DialogApp.h" + +//////////////////////////////////// +// CMyScrollBar function definitions +// + +// Constructor. +CMyScrollBar::CMyScrollBar() +{ + m_si = {}; +} + +// Returns the current scroll bar position. +int CMyScrollBar::GetPos(WPARAM wparam) +{ + GetScrollInfo(m_si); + + switch (LOWORD(wparam)) + { + // user clicked left arrow + case SB_LINELEFT: + m_si.nPos -= 1; + break; + + // user clicked right arrow + case SB_LINERIGHT: + m_si.nPos += 1; + break; + + // user clicked the scroll bar shaft left of the scroll box + case SB_PAGELEFT: + m_si.nPos -= m_si.nPage; + break; + + // user clicked the scroll bar shaft right of the scroll box + case SB_PAGERIGHT: + m_si.nPos += m_si.nPage; + break; + + // user dragged the scroll box + case SB_THUMBTRACK: + m_si.nPos = m_si.nTrackPos; + break; + + default: + break; + } + + m_si.nPos = std::min(m_si.nPos, 100); + m_si.nPos = std::max(m_si.nPos, 0); + return m_si.nPos; +} + +// Called after the scrollbar is attached. +void CMyScrollBar::OnInitialUpdate() +{ + // Set the Scroll bar position + SetPos(0); +} + +// Sets the scroll bar's position. +void CMyScrollBar::SetPos(int pos) +{ + m_si.cbSize = sizeof(SCROLLINFO); + m_si.nPos = pos; + m_si.nPage = 10; + m_si.nMax = 100 + (m_si.nPage -1); + m_si.fMask = SIF_ALL; + + // Set the scroll bar position + SetScrollInfo(m_si, TRUE); +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/Scrollbar.h b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/Scrollbar.h new file mode 100644 index 00000000..f6f866c9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/Scrollbar.h @@ -0,0 +1,31 @@ +///////////////////////////// +// ScrollBar.h +// + +#ifndef MYSCROLLBAR_H +#define MYSCROLLBAR_H + + +////////////////////////////////////////////// +// CMyScrollBar manages the scrollbar control. +class CMyScrollBar : public CScrollBar +{ +public: + CMyScrollBar(); + virtual ~CMyScrollBar() override = default; + + int GetPos(WPARAM wparam); + void SetPos(int pos); + +protected: + virtual void OnInitialUpdate() override; + +private: + CMyScrollBar(const CMyScrollBar&) = delete; + CMyScrollBar& operator=(const CMyScrollBar&) = delete; + + SCROLLINFO m_si; +}; + + +#endif diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/StdAfx.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/StdAfx.cpp new file mode 100644 index 00000000..8957144d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/StdAfx.cpp @@ -0,0 +1,16 @@ +///////////////////////////// +// StdAfx.cpp +// + +// This file is used for precompiled hearders. Precompiled headers allow +// programs to be recompiled more quickly + +// To use precompiled headers, do the following: +// 1) Add the set of rarely changed headers to stdafx.h +// 2) Include stdafx.h in each cpp file. It must be included first. +// 3) Add stdafx.cpp to your project. +// 4) Turn on precompiled hearders in the project + + +#include "stdafx.h" + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/main.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/main.cpp new file mode 100644 index 00000000..e7d0b704 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/main.cpp @@ -0,0 +1,41 @@ +///////////////////////////// +// main.cpp +// + +#include "stdafx.h" +#include "DialogApp.h" + +int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPWSTR, _In_ int) +{ + try + { + // Start Win32++. + CDialogApp theApp; + + // Run the application. + return theApp.Run(); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return -1; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/res/Dialog.ico b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/res/Dialog.ico new file mode 100644 index 00000000..4730e915 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/res/Dialog.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/res/PerMonitorV2.manifest b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/res/PerMonitorV2.manifest new file mode 100644 index 00000000..d303e5c0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/res/PerMonitorV2.manifest @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + PerMonitorV2, PerMonitor + + + + + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/resource.h b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/resource.h new file mode 100644 index 00000000..63865af2 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/resource.h @@ -0,0 +1,27 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Resource.rc +// + +// include the Resource IDs defined by Win32++ +#include "default_resource.h" + +#define IDD_DIALOG1 121 +#define IDC_STATIC1 131 +#define IDC_STATIC2 132 +#define IDB_BITMAP1 150 +#define IDC_SLIDER1 1000 +#define IDC_PROGRESS1 1001 +#define IDC_SCROLLBAR1 1002 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 159 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 160 +#endif +#endif diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/stdafx.h b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/stdafx.h new file mode 100644 index 00000000..08450116 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogBars/src/stdafx.h @@ -0,0 +1,90 @@ +///////////////////////////// +// StdAfx.h +// + +// This file is used for precompiled headers. +// Rarely modified header files should be included. +// Based on code provided by Lynn Allan. + + +#ifndef STDAFX_H +#define STDAFX_H + + +// Predefinitions for windows.h go here +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +// Specify Win32xx specific predefinitions here +//#define NO_USING_NAMESPACE // Don't use Win32xx namespace + +// Rarely modified header files should be included here +#include // Add support for std::vector +#include // Add support for std::map +#include // Add support for std::string +#include // Add support for stringstream +#include // Add support for the assert macro +#include // Add support for C style printf, sprintf, etc. +#include // Add support for C style character conversions atoi etc. +#include // Add support for C style TCHARs. + +// Add the Win32++ library +#include // Add CWinApp +#include // Add CArchive +#include // Add CAnimation, CComboBox, CComboBoxEx, CDateTime, CHeader, CHotKey, CIPAddress, CProgressBar, CSpinButton, CScrollBar, CSlider, CToolTip +#include // Add CCriticalSection, CThreadLock +#include // Add CString, CStringA, CStringW +#include // Add CDataExchange +#include // Add CDialog, CResizer +#include // Add CDockFrame, CMDIDockFrame +#include // Add CDocker, CDockContainer +#include // Add CException, CFileException, CNotSupportedException, CResourceException, CUserException, CWinException +#include // Add CFile +#include // Add CFileFind +#include // Add CFolderDialog +#include // Add CFrame +#include // Add CDC, CGDIObject, CBitmap, CBrush, CFont, CPalatte, CPen, CRgn +#include // Add CHGlobal +#include // Add CImageList +#include // Add CListView +#include // Add CMDIChild, CMDIFrame, CDockMDIFrame +#include // Add CMenu +#include // Add CMenuBar +#include // Add CMetaFile, CEnhMetaFile +#include // Add CEvent, CMutex, CSemaphore +#include // Add CPropertyPage, CPropertySheet +#include // Add CRebar +#include // Add CPoint, CRect, CSize +#include // Add CRegKey +#include // Add CRichEdit +#include // Add CScrollView +#include // Adds macros, windows header files, and CObject +#include // Add CSocket +#include // Add CStatusBar +#include // Add CButton, CEdit, CListBox +#include // Add CTab, CTabbedMDI +#include // Add AtoT, AtoW, TtoA, TtoW, WtoA, WtoT etc. +#include // Add MenuTheme, ReBarTheme, StatusBarTheme, ToolBarTheme +#include // Add CWinThread +#include // Add CTime +#include // Add CToolBar +#include // Add CTreeView +#include // Add CWebBrowser, CAXHost +#include // Add CWnd + +// WIN32_LEAN_AND_MEAN can't be used with these +#ifndef WIN32_LEAN_AND_MEAN + #include // Add CCommonDialog, CColorDialog, CFileDialog, CFindReplace, CFontDialog + #include // Add CFolderDialogEx + #include // Add CPrintPreview + #include // Add CPageSetupDialog, CPrintDialog + #include // Add CPrintDialogEx + #include // Add CTaskDialog + + // Visual Studio + #if defined (_MSC_VER) + #include // Add CRibbon, CRibbonFrame + #endif + +#endif // define WIN32_LEAN_AND_MEAN + +#endif // define STDAFX_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo.cbp b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo.cbp new file mode 100644 index 00000000..e9868a5d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo.cbp @@ -0,0 +1,142 @@ + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo.cbproj b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo.cbproj new file mode 100644 index 00000000..07b8db61 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo.cbproj @@ -0,0 +1,1534 @@ + + + {39461456-1040-43CB-9B40-5962EF847BB0} + 20.1 + None + True + Release + Win64x + 1048579 + Application + DialogDemo + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + JPHNE + .\Embarcadero\$(Platform)\$(Config) + .\Embarcadero\$(Platform)\$(Config) + false + true + true + $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + CppGuiApplication + System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + true + <_TCHARMapping>wchar_t + DialogDemo + ..\..\..\include\;..\src\;$(IncludePath) + ..\..\..\include\;..\src\;$(ILINK_LibraryPath) + 3081 + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + $(BDSINCLUDE)\windows\sdk;$(BRCC_IncludePath) + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + ..\src\stdafx.h + none + + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + false + true + false + true + _DEBUG;$(Defines) + false + None + DEBUG + true + true + true + true + Full + true + true + true + true + true + $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) + $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + + + PerMonitorV2 + false + $(BDSLIB)\$(PLATFORM)$(CC_SUFFIX)\debug;$(ILINK_LibraryPath) + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + false + + + PerMonitorV2 + true + 1033 + + + NDEBUG;$(Defines) + None + + + PerMonitorV2 + false + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 67 + + + 0 + + + 1 + + + 2 + + + 3 + + + 4 + + + 5 + + + 6 + + + 7 + + + 8 + + + 9 + + +
Resource.res
+ 10 +
+ + 11 + + + 12 + true + + + 14 + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + +
+ + CPlusPlusBuilder.Personality.12 + CppGuiApplication + + + + False + True + True + False + + + Embarcadero C++Builder Office 2000 Servers Package + Embarcadero C++Builder Office XP Servers Package + + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + Assets\ + Logo150x150.png + true + + + + + Assets\ + Logo44x44.png + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + DialogDemo.exe + true + + + + + DialogDemo.exe + true + + + + + NewProject.exe + true + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 64 + + + classes + 64 + + + + + res\xml + 1 + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\mips + 1 + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-v21 + 1 + + + res\values-v21 + 1 + + + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + Contents + 1 + + + Contents + 1 + + + Contents + 1 + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + library\lib\armeabi-v7a + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen + 64 + + + ..\$(PROJECTNAME).launchscreen + 64 + + + + + 1 + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + + + + + + + + + + + + + True + True + True + + + 12 + + + + +
diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2015.sln b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2015.sln new file mode 100644 index 00000000..37f1e888 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2015.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DialogDemo", "DialogDemo_2015.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2015.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2015.vcxproj new file mode 100644 index 00000000..096ec1d0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2015.vcxproj @@ -0,0 +1,252 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DialogDemo + DialogDemo + + + + Application + Unicode + v140_xp + + + Application + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + + + + + + + + + + + + + + + + + true + false + + + true + false + + + false + false + + + false + false + + + + Use + Level4 + true + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2015.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2015.vcxproj.filters new file mode 100644 index 00000000..2b107351 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2015.vcxproj.filters @@ -0,0 +1,233 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Win32++ + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + {86790b47-d32f-41a7-b741-89ee90d64b6d} + + + {e15d7f75-acf5-492f-ba57-b883f91cfdc5} + + + {1dcddfe4-dd07-43c5-a6d4-b6a46f049287} + + + {cbba403a-bc76-477a-b285-e00b59b0a45a} + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2019.sln b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2019.sln new file mode 100644 index 00000000..05bcb1dd --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2019.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DialogDemo", "DialogDemo_2019.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {29844E92-A696-425B-8CDF-A5ACE203D9CB} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2019.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2019.vcxproj new file mode 100644 index 00000000..7ed347c9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2019.vcxproj @@ -0,0 +1,229 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DialogDemo + DialogDemo + + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2019.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2019.vcxproj.filters new file mode 100644 index 00000000..fec7c508 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2019.vcxproj.filters @@ -0,0 +1,230 @@ + + + + + {242d3718-00f8-4d89-aeaf-a3f05ed45a1d} + + + {8e9b441f-e3e4-47a1-96a0-1db8ff3ae5bb} + + + {aff4f9f3-bc10-4491-992a-4525ec35ee39} + + + {9f02de3c-8066-44e3-b6f7-b1ac341d7f14} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2022.sln b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2022.sln new file mode 100644 index 00000000..9558c2f7 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2022.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DialogDemo", "DialogDemo_2022.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D9E9FC99-1C35-48CE-9211-CAB7B9C15A3F} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2022.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2022.vcxproj new file mode 100644 index 00000000..2f4cfb97 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2022.vcxproj @@ -0,0 +1,240 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DialogDemo + DialogDemo + 10.0 + + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2022.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2022.vcxproj.filters new file mode 100644 index 00000000..fec7c508 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2022.vcxproj.filters @@ -0,0 +1,230 @@ + + + + + {242d3718-00f8-4d89-aeaf-a3f05ed45a1d} + + + {8e9b441f-e3e4-47a1-96a0-1db8ff3ae5bb} + + + {aff4f9f3-bc10-4491-992a-4525ec35ee39} + + + {9f02de3c-8066-44e3-b6f7-b1ac341d7f14} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2026.slnx b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2026.slnx new file mode 100644 index 00000000..bae2626e --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2026.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2026.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2026.vcxproj new file mode 100644 index 00000000..1afa080c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2026.vcxproj @@ -0,0 +1,240 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DialogDemo + DialogDemo + 10.0 + + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2026.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2026.vcxproj.filters new file mode 100644 index 00000000..037ee9be --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_2026.vcxproj.filters @@ -0,0 +1,230 @@ + + + + + {242d3718-00f8-4d89-aeaf-a3f05ed45a1d} + + + {8e9b441f-e3e4-47a1-96a0-1db8ff3ae5bb} + + + {aff4f9f3-bc10-4491-992a-4525ec35ee39} + + + {9f02de3c-8066-44e3-b6f7-b1ac341d7f14} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_DEBUG.dev b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_DEBUG.dev new file mode 100644 index 00000000..29fdbabc --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_DEBUG.dev @@ -0,0 +1,202 @@ +[Project] +FileName=DialogDemo_DEBUG.dev +Name=DialogDemo +UnitCount=13 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=DialogDemo_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D _DEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Debug +ObjectOutput=.\Dev-C++\Debug +OverrideOutput=1 +OverrideOutputName=DialogDemo.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=4 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[Unit1] +FileName=..\src\DialogDemoApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\DialogDemoApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\Hyperlink.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\Hyperlink.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\MyButton.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\MyButton.h +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit8] +FileName=..\src\MyDialog.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit11] +FileName=..\src\Resource.rc +CompileCpp=1 +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\MyDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit15] +FileName=Hyperlink.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit16] +FileName=Hyperlink.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit10] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit12] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit13] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_RELEASE.dev b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_RELEASE.dev new file mode 100644 index 00000000..c9824a1d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/ProjectFiles/DialogDemo_RELEASE.dev @@ -0,0 +1,202 @@ +[Project] +FileName=DialogDemo_RELEASE.dev +Name=DialogDemo +UnitCount=13 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=DialogDemo_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D NDEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@__@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-s_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Release +ObjectOutput=.\Dev-C++\Release +OverrideOutput=1 +OverrideOutputName=DialogDemo.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=3 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[Unit1] +FileName=..\src\DialogDemoApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\DialogDemoApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\Hyperlink.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\Hyperlink.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\MyButton.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\MyButton.h +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit8] +FileName=..\src\MyDialog.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit11] +FileName=..\src\Resource.rc +CompileCpp=1 +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit10] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\MyDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit15] +FileName=Hyperlink.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit16] +FileName=Hyperlink.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit12] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit13] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/Readme.txt new file mode 100644 index 00000000..bbd50fe8 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/Readme.txt @@ -0,0 +1,26 @@ +DialogDemo Example +================== +This is a dialog application with fairly typical features. The dialog itself +is defined in the resource script (resource.rc). The various controls +within the dialog are attached to CWnd objects using AttachDlgItem. + +Also, refer to the FormDocView example for demonstration of additional features +such as saving the dialog's state in the registry. + + +Features demonstrated in this example +===================================== +* Using a dialog as an application. +* The use of AttachItem to attach a dialog control to a CWnd. +* The handling of messages in a button control. +* Using a static control as a hyperlink. +* Use of OnMessageReflect to handle notifications in the object that + generated them. + +About Dialogs +============= +Dialog applications are easy to create, provided we have access to a resource +editor to build the resource script file for us (often called resource.rc). +Commercial compilers usually include a resource editor for this purpose, but +many free compilers don't. A resource editor is included with Microsoft's +Visual Studio Studio Community. \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/DialogDemoApp.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/DialogDemoApp.cpp new file mode 100644 index 00000000..17c79e90 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/DialogDemoApp.cpp @@ -0,0 +1,27 @@ +///////////////////////////// +// DialogDemoApp.cpp +// + +#include "stdafx.h" +#include "DialogDemoApp.h" +#include "resource.h" + + +////////////////////////////////////// +// CDialogDemoApp function definitions +// + +// Constructor. +CDialogDemoApp::CDialogDemoApp() : m_myDialog(IDD_DIALOG1) +{ +} + +// Called when the application starts. +BOOL CDialogDemoApp::InitInstance() +{ + // Display the modal dialog. + m_myDialog.DoModal(); // throws a CWinException on failure + + return TRUE; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/DialogDemoApp.h b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/DialogDemoApp.h new file mode 100644 index 00000000..52a45d5f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/DialogDemoApp.h @@ -0,0 +1,32 @@ +/////////////////////////////////////// +// DialogDemoApp.h +// + +#ifndef DLGSUBCLASSAPP_H +#define DLGSUBCLASSAPP_H + +#include "MyDialog.h" + + +///////////////////////////////////////////////////////////// +// CDialogDemoApp manages the application. It initializes the +// Win32++ framework when it is constructed, and creates the +// main dialog when it runs. +class CDialogDemoApp : public CWinApp +{ +public: + CDialogDemoApp(); + virtual ~CDialogDemoApp() override = default; + +protected: + virtual BOOL InitInstance() override; + +private: + CDialogDemoApp(const CDialogDemoApp&) = delete; + CDialogDemoApp& operator=(const CDialogDemoApp&) = delete; + + CMyDialog m_myDialog; +}; + + +#endif // define DLGSUBCLASSAPP_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/Hyperlink.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/Hyperlink.cpp new file mode 100644 index 00000000..50905049 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/Hyperlink.cpp @@ -0,0 +1,127 @@ +///////////////////////////// +// Hyperlink.cpp +// + +#include "stdafx.h" +#include "Hyperlink.h" + +////////////////////////////////// +// CHyperlink function definitions +// + +// Constructor. +CHyperlink::CHyperlink() : m_isUrlVisited(false), m_isClicked(false), m_crVisited(RGB(128, 0, 128)), + m_crNotVisited(RGB(0,0,255)) +{ + // Create the cursor + m_cursor = ::LoadCursor(nullptr, IDC_HAND); +} + +// Called when the left mouse button is clicked. +LRESULT CHyperlink::OnLButtonDown() +{ + SetCapture(); + m_isClicked = TRUE; + return 0; +} + +// Called when the left mouse button is released. +LRESULT CHyperlink::OnLButtonUp(LPARAM lparam) +{ + ReleaseCapture(); + if(m_isClicked) + { + m_isClicked = FALSE; + CPoint pt; + pt.x = LOWORD(lparam); + pt.y = HIWORD(lparam); + ClientToScreen(pt); + CRect rc = GetWindowRect(); + + if (rc.PtInRect(pt)) OpenUrl(); + } + + return 0; +} + +// Opens the default browser and displays the web page. +void CHyperlink::OpenUrl() +{ + LPCWSTR url = L"http://sourceforge.net/projects/win32-framework/"; + + HINSTANCE result = ::ShellExecute(nullptr, L"open", url, nullptr, nullptr, SW_SHOWNORMAL); + if (reinterpret_cast(result) > 32) + { + m_isUrlVisited = TRUE; + + // redraw the window to update the color + Invalidate(); + } +} + +// Handles messages reflected back from the dialog. +LRESULT CHyperlink::OnMessageReflect(UINT msg, WPARAM wparam, LPARAM) +{ + // Messages such as WM_CTLCOLORSTATIC are reflected back to the CWnd object that created them. + if (msg == WM_CTLCOLORSTATIC) + { + CDC dc(reinterpret_cast(wparam)); + dc.SetTextColor( m_isUrlVisited? m_crVisited : m_crNotVisited); + dc.SetBkMode(TRANSPARENT); + dc.SelectObject(m_urlFont); + + // Detach the dc to keep the url font selected. + dc.Detach(); + return (LRESULT)GetSysColorBrush(COLOR_BTNFACE); + } + return 0; +} + +// Modifies the cursor when its over the hyperlink control. +LRESULT CHyperlink::OnSetCursor() +{ + // Must use ::SetCursor here. CStatic::SetCursor does not do the same thing. + ::SetCursor(m_cursor); + + return 1; // Non-zero return prevents default processing +} + +// Process the hyperlink control's window messages. +LRESULT CHyperlink::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case WM_LBUTTONDOWN: return OnLButtonDown(); + case WM_LBUTTONUP: return OnLButtonUp(lparam); + case WM_SETCURSOR: return OnSetCursor(); + case WM_NCHITTEST: return HTCLIENT; // Claim that the mouse is in a client area + } + + return WndProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/Hyperlink.h b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/Hyperlink.h new file mode 100644 index 00000000..9c3b8bff --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/Hyperlink.h @@ -0,0 +1,49 @@ +///////////////////////////// +// Hyperlink.h +// + +#ifndef HYPERLINK_H +#define HYPERLINK_H + + +#ifndef IDC_HAND + #define IDC_HAND MAKEINTRESOURCE(32649) +#endif + + +////////////////////////////////////////////////// +// CHyperlink manages the hyperlink. The hyperlink +// is a modified static control. +class CHyperlink : public CStatic +{ +public: + CHyperlink(); + virtual ~CHyperlink() override = default; + + void SetUrlFont(CFont urlFont) { m_urlFont = urlFont; } + +protected: + virtual LRESULT OnMessageReflect(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CHyperlink(const CHyperlink&) = delete; + CHyperlink& operator=(const CHyperlink&) = delete; + void OpenUrl(); + + // Message handlers + LRESULT OnLButtonDown(); + LRESULT OnLButtonUp(LPARAM lparam); + LRESULT OnSetCursor(); + + // Member variables + bool m_isUrlVisited; + bool m_isClicked; + COLORREF m_crVisited; + COLORREF m_crNotVisited; + HCURSOR m_cursor; + CFont m_urlFont; +}; + +#endif // HYPERLINK_H + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/MyButton.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/MyButton.cpp new file mode 100644 index 00000000..735532ea --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/MyButton.cpp @@ -0,0 +1,102 @@ +///////////////////////////// +// MyButton.cpp +// + +#include "stdafx.h" +#include "MyButton.h" +#include "DialogDemoApp.h" +#include "UserMessages.h" + +///////////////////////////////// +// CMyButton function definitions +// + +// Called when the mouse is moved over the button control. +LRESULT CMyButton::OnMouseMove(UINT msg, WPARAM wparam, LPARAM lparam) +{ + TRACE("CButton::WndProc - WM_MOUSEMOVE Message\n"); + GetParent().SendMessage(UWM_SETSTATIC, (WPARAM)L"WM_MOUSEMOVE"); + return FinalWindowProc(msg, wparam, lparam); +} + +// Called when the mouse is detected over the button control. +LRESULT CMyButton::OnNCHitTest(UINT msg, WPARAM wparam, LPARAM lparam) +{ + TRACE("CButton::WndProc - WM_NCHITTEST Message\n"); + GetParent().SendMessage(UWM_SETSTATIC, (WPARAM)L"WM_NCHITTEST"); + return FinalWindowProc(msg, wparam, lparam); +} + +// Called when a WM_SETCURSOR message is received. +LRESULT CMyButton::OnSetCursor(UINT msg, WPARAM wparam, LPARAM lparam) +{ + TRACE("CButton::WndProc - WM_SETCURSOR Message\n"); + GetParent().SendMessage(UWM_SETSTATIC, (WPARAM)L"WM_SETCURSOR"); + return FinalWindowProc(msg, wparam, lparam); +} + +// Called when the left mouse button is pressed over the button. +LRESULT CMyButton::OnLButtonDown(UINT msg, WPARAM wparam, LPARAM lparam) +{ + TRACE("CButton::WndProc - WM_LBUTTONDOWN Message\n"); + GetParent().SendMessage(UWM_SETSTATIC, (WPARAM)L"WM_LBUTTONDOWN"); + return FinalWindowProc(msg, wparam, lparam); +} + +// Called when the left mouse button is released over the button. +LRESULT CMyButton::OnLButtonUp(UINT msg, WPARAM wparam, LPARAM lparam) +{ + TRACE("CButton::WndProc - WM_LBUTTONUP Message\n"); + GetParent().SendMessage(UWM_SETSTATIC, (WPARAM)L"WM_LBUTTONUP"); + return FinalWindowProc(msg, wparam, lparam); +} + +// Called when the right mouse button is pressed over the button. +LRESULT CMyButton::OnRButtonDown(UINT msg, WPARAM wparam, LPARAM lparam) +{ + TRACE("CButton::WndProc - WM_RBUTTONDOWN Message\n"); + GetParent().SendMessage(UWM_SETSTATIC, (WPARAM)L"WM_RBUTTONDOWN"); + return FinalWindowProc(msg, wparam, lparam); +} + +// Process the window messages for the button control. +LRESULT CMyButton::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case WM_MOUSEMOVE: return OnMouseMove(msg, wparam, lparam); + case WM_NCHITTEST: return OnNCHitTest(msg, wparam, lparam); + case WM_SETCURSOR: return OnSetCursor(msg, wparam, lparam); + case WM_LBUTTONDOWN: return OnLButtonDown(msg, wparam, lparam); + case WM_LBUTTONUP: return OnLButtonUp(msg, wparam, lparam); + case WM_RBUTTONDOWN: return OnRButtonDown(msg, wparam, lparam); + default: + break; + } + + return WndProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/MyButton.h b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/MyButton.h new file mode 100644 index 00000000..b606c58e --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/MyButton.h @@ -0,0 +1,35 @@ +///////////////////////////// +// MyButton.h +// + +#ifndef MYBUTTON_H +#define MYBUTTON_H + + +/////////////////////////////////////// +// CMyButton manages the button control. +class CMyButton : public CButton +{ +public: + CMyButton() = default; + virtual ~CMyButton() override = default; + +protected: + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CMyButton(const CMyButton&) = delete; + CMyButton& operator=(const CMyButton&) = delete; + + // Message handlers + LRESULT OnMouseMove(UINT msg, WPARAM wparam, LPARAM lparam); + LRESULT OnNCHitTest(UINT msg, WPARAM wparam, LPARAM lparam); + LRESULT OnSetCursor(UINT msg, WPARAM wparam, LPARAM lparam); + LRESULT OnLButtonDown(UINT msg, WPARAM wparam, LPARAM lparam); + LRESULT OnLButtonUp(UINT msg, WPARAM wparam, LPARAM lparam); + LRESULT OnRButtonDown(UINT msg, WPARAM wparam, LPARAM lparam); +}; + + +#endif //BUTTON_H + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/MyDialog.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/MyDialog.cpp new file mode 100644 index 00000000..e56bd8c9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/MyDialog.cpp @@ -0,0 +1,204 @@ +/////////////////////////////////////// +// MyDialog.cpp + +#include "stdafx.h" +#include "MyDialog.h" +#include "resource.h" +#include "UserMessages.h" + + +///////////////////////////////// +// CMyDialog function definitions +// + +// Constructor. +CMyDialog::CMyDialog(UINT resID) : CDialog(resID) +{ +} + +// Constructor. +CMyDialog::CMyDialog(LPCWSTR resName) : CDialog(resName) +{ +} + +// Process the dialog's window messages. +INT_PTR CMyDialog::DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case WM_DPICHANGED: return OnDpiChanged(); + case UWM_SETSTATIC: return OnSetStatic(wparam); + } + + // Pass unhandled messages on to parent DialogProc. + return DialogProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + +// Process the command messages (WM_COMMAND) from the controls. +BOOL CMyDialog::OnCommand(WPARAM wparam, LPARAM) +{ + UINT id = LOWORD(wparam); + switch (id) + { + case IDC_BUTTON1: return OnButton(); + case IDC_CHECK1: return OnCheck1(); + case IDC_CHECK2: return OnCheck2(); + case IDC_CHECK3: return OnCheck3(); + + case IDC_RADIO1: + case IDC_RADIO2: // intentionally blank + case IDC_RADIO3: return OnRangeOfRadioIDs(IDC_RADIO1, IDC_RADIO3, id); + } + + return FALSE; +} + +// Called when the dialog window is destroyed. +void CMyDialog::OnDestroy() +{ + // End the application + ::PostQuitMessage(0); +} + +// Called when the effective dots per inch (dpi) for the dialog has changed. +INT_PTR CMyDialog::OnDpiChanged() +{ + SetURLFont(); + return 0; +} + +// Called before the dialog is displayed. +BOOL CMyDialog::OnInitDialog() +{ + // Set the application icon + SetIconLarge(IDW_MAIN); + SetIconSmall(IDW_MAIN); + + // Put some text in the rich edit box + SetDlgItemText(IDC_RICHEDIT1, L"Rich Edit Window"); + + // Put some text in the list box + AttachItem(IDC_LIST1, m_listBox); + for (int i = 0 ; i < 8 ; i++) + m_listBox.AddString(L"List Box"); + + // Turn our button into a MyButton object + AttachItem(IDC_BUTTON2, m_button); + + // Turn our static control into a hyperlink + AttachItem(IDC_STATIC4, m_hyperlink); + + // Attach the rich edit control to m_RichEdit + AttachItem(IDC_RICHEDIT1, m_richEdit); + + // Select the first radio button + CheckRadioButton(IDC_RADIO1, IDC_RADIO3, IDC_RADIO1); + + // Update the font for the hyperlink + SetURLFont(); + + return TRUE; +} + +// Called when the OK button or Enter key is pressed. +void CMyDialog::OnOK() +{ + MessageBox(L"OK Button Pressed. Program will exit now.", L"Button", MB_OK); + CDialog::OnOK(); +} + +// Called when the button is pressed. +BOOL CMyDialog::OnButton() +{ + SetStatic(L"Button Pressed"); + TRACE("Button Pressed\n"); + return TRUE; +} + +// Called when check box 1 is clicked. +BOOL CMyDialog::OnCheck1() +{ + SetStatic(L"Check Box 1"); + TRACE("Check Box 1\n"); + return TRUE; +} + +// Called when check box 2 is clicked. +BOOL CMyDialog::OnCheck2() +{ + SetStatic(L"Check Box 2"); + TRACE("Check Box 2\n"); + return TRUE; +} + +// Called when check box 3 is clicked. +BOOL CMyDialog::OnCheck3() +{ + SetStatic(L"Check Box 3"); + TRACE("Check Box 3\n"); + return TRUE; +} + +// Called when a radio button is selected. +BOOL CMyDialog::OnRangeOfRadioIDs(UINT idFirst, UINT idLast, UINT idClicked) +{ + CheckRadioButton(idFirst, idLast, idClicked); + + CString str; + int button = idClicked - idFirst + 1; + str.Format(L"Radio%d", button); + TRACE(str); TRACE("\n"); + SetStatic(str); + + return TRUE; +} + +// Called in response the UWM_SETSTATIC message to update the static text. +INT_PTR CMyDialog::OnSetStatic(WPARAM wparam) +{ + SetStatic(reinterpret_cast(wparam)); + return 0; +} + +// Sets the text in the static control. +void CMyDialog::SetStatic(LPCWSTR text) +{ + SetDlgItemText(IDC_STATIC3, text); +} + +// Sets the hyperlink's font +void CMyDialog::SetURLFont() +{ + // Get the dialog's font and add an underline. + LOGFONT logfont = GetFont().GetLogFont(); + logfont.lfUnderline = TRUE; + CFont urlFont(logfont); + + // Assign the font to the hyperlink. + m_hyperlink.SetUrlFont(urlFont); +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/MyDialog.h b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/MyDialog.h new file mode 100644 index 00000000..785d4ce8 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/MyDialog.h @@ -0,0 +1,54 @@ +///////////////////////////// +// MyDialog.h +// + +#ifndef MYDIALOG_H +#define MYDIALOG_H + + +#include "MyButton.h" +#include "Hyperlink.h" + + +/////////////////////////////////////////////////// +// CMyDialog manages the application's main dialog. +class CMyDialog : public CDialog +{ +public: + CMyDialog(UINT resID); + CMyDialog(LPCWSTR resName); + virtual ~CMyDialog() override = default; + + void SetStatic(LPCWSTR text); + void SetURLFont(); + +protected: + virtual void OnDestroy() override; + virtual BOOL OnInitDialog() override; + virtual INT_PTR DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual BOOL OnCommand(WPARAM wparam, LPARAM lparam) override; + virtual void OnOK() override; + +private: + CMyDialog(const CMyDialog&) = delete; + CMyDialog& operator=(const CMyDialog&) = delete; + + // Command handlers + BOOL OnButton(); + BOOL OnCheck1(); + BOOL OnCheck2(); + BOOL OnCheck3(); + BOOL OnRangeOfRadioIDs(UINT idFirst, UINT idLast, UINT idClicked); + + // Message handlers + INT_PTR OnDpiChanged(); + INT_PTR OnSetStatic(WPARAM wparam); + + // Member variables + CRichEdit m_richEdit; + CMyButton m_button; + CHyperlink m_hyperlink; + CListBox m_listBox; +}; + +#endif //MYDIALOG_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/Resource.rc b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/Resource.rc new file mode 100644 index 00000000..81184e34 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/Resource.rc @@ -0,0 +1,118 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "../src/res/PerMonitorV2.manifest" + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDW_MAIN ICON "../src/res/Dialog.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_DIALOG1 DIALOGEX 0, 0, 310, 178 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_APPWINDOW +CAPTION "DlgSubclass sample with Hyperlink and Subclassed Button" +FONT 8, "MS Shell Dlg", 0, 0 +BEGIN + DEFPUSHBUTTON "OK",IDOK,241,153,50,16 + CONTROL "Radio1",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,30,24,38,10 + CONTROL "Radio2",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,30,36,38,10 + CONTROL "Radio3",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,30,48,38,10 + CONTROL "Check Box 1",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,114,55,10 + CONTROL "Check Box 2",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,126,55,10 + CONTROL "Check Box 3",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,139,55,10 + LISTBOX IDC_LIST1,120,23,84,35,LBS_SORT | LBS_NOINTEGRALHEIGHT | NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP,WS_EX_STATICEDGE + PUSHBUTTON "Button",IDC_BUTTON1,30,82,49,11 + CONTROL "",IDC_RICHEDIT1, "RichEdit50W" , ES_MULTILINE | ES_WANTRETURN | ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP,120,86,84,35 + GROUPBOX "Static Window",IDC_STATIC2,226,78,78,51,BS_CENTER + LTEXT "Actions are displayed here",IDC_STATIC3,229,91,71,35 + PUSHBUTTON "Subclassed Button",IDC_BUTTON2,220,15,81,45 + LTEXT "http://sourceforge.net/projects/win32-framework",IDC_STATIC4,25,160,186,11 +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (Australia) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENA) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS +#pragma code_page(1252) + +#endif // English (Australia) resources +///////////////////////////////////////////////////////////////////////////// + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/StdAfx.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/StdAfx.cpp new file mode 100644 index 00000000..8957144d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/StdAfx.cpp @@ -0,0 +1,16 @@ +///////////////////////////// +// StdAfx.cpp +// + +// This file is used for precompiled hearders. Precompiled headers allow +// programs to be recompiled more quickly + +// To use precompiled headers, do the following: +// 1) Add the set of rarely changed headers to stdafx.h +// 2) Include stdafx.h in each cpp file. It must be included first. +// 3) Add stdafx.cpp to your project. +// 4) Turn on precompiled hearders in the project + + +#include "stdafx.h" + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/UserMessages.h b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/UserMessages.h new file mode 100644 index 00000000..d746a2e4 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/UserMessages.h @@ -0,0 +1,14 @@ +///////////////////////////// +// UserMessages.h +// + +#ifndef _USER_MESSAGES_H_ +#define _USER_MESSAGES_H_ + + +// Message called by CMyButton. Sets static text. +#define UWM_SETSTATIC (WM_APP + 0x0001) + + +#endif // _USER_MESSAGES_H_ + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/main.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/main.cpp new file mode 100644 index 00000000..b7c0af36 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/main.cpp @@ -0,0 +1,40 @@ +///////////////////////////// +// main.cpp +// + +#include "stdafx.h" +#include "DialogDemoApp.h" + +int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPWSTR, _In_ int) +{ + try + { + // Start Win32++. + CDialogDemoApp theApp; + + // Run the application. + return theApp.Run(); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return -1; + } \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/res/Dialog.ico b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/res/Dialog.ico new file mode 100644 index 00000000..4730e915 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/res/Dialog.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/res/PerMonitorV2.manifest b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/res/PerMonitorV2.manifest new file mode 100644 index 00000000..d303e5c0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/res/PerMonitorV2.manifest @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + PerMonitorV2, PerMonitor + + + + + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/resource.h b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/resource.h new file mode 100644 index 00000000..8dadc612 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/resource.h @@ -0,0 +1,42 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Resource.rc +// + +// include the Resource IDs defined by Win32++ +#include "default_resource.h" + + +//Resource IDs for the dialog +#define IDD_DIALOG1 121 +#define IDC_RADIO1 130 +#define IDC_RADIO2 131 +#define IDC_RADIO3 132 +#define IDC_CHECK1 133 +#define IDC_CHECK2 134 +#define IDC_CHECK3 135 +#define IDC_EDIT1 140 +#define IDC_LIST1 141 +#define IDC_BUTTON1 142 +#define IDC_BUTTON2 143 +#define IDC_RICHEDIT1 144 +#define IDC_STATIC1 150 +#define IDC_STATIC2 151 +#define IDC_STATIC3 152 +#define IDC_STATIC4 153 +#define IDC_HOTKEY1 160 +#define IDB_BITMAP1 161 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 159 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 160 +#endif +#endif + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/stdafx.h b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/stdafx.h new file mode 100644 index 00000000..08450116 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogDemo/src/stdafx.h @@ -0,0 +1,90 @@ +///////////////////////////// +// StdAfx.h +// + +// This file is used for precompiled headers. +// Rarely modified header files should be included. +// Based on code provided by Lynn Allan. + + +#ifndef STDAFX_H +#define STDAFX_H + + +// Predefinitions for windows.h go here +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +// Specify Win32xx specific predefinitions here +//#define NO_USING_NAMESPACE // Don't use Win32xx namespace + +// Rarely modified header files should be included here +#include // Add support for std::vector +#include // Add support for std::map +#include // Add support for std::string +#include // Add support for stringstream +#include // Add support for the assert macro +#include // Add support for C style printf, sprintf, etc. +#include // Add support for C style character conversions atoi etc. +#include // Add support for C style TCHARs. + +// Add the Win32++ library +#include // Add CWinApp +#include // Add CArchive +#include // Add CAnimation, CComboBox, CComboBoxEx, CDateTime, CHeader, CHotKey, CIPAddress, CProgressBar, CSpinButton, CScrollBar, CSlider, CToolTip +#include // Add CCriticalSection, CThreadLock +#include // Add CString, CStringA, CStringW +#include // Add CDataExchange +#include // Add CDialog, CResizer +#include // Add CDockFrame, CMDIDockFrame +#include // Add CDocker, CDockContainer +#include // Add CException, CFileException, CNotSupportedException, CResourceException, CUserException, CWinException +#include // Add CFile +#include // Add CFileFind +#include // Add CFolderDialog +#include // Add CFrame +#include // Add CDC, CGDIObject, CBitmap, CBrush, CFont, CPalatte, CPen, CRgn +#include // Add CHGlobal +#include // Add CImageList +#include // Add CListView +#include // Add CMDIChild, CMDIFrame, CDockMDIFrame +#include // Add CMenu +#include // Add CMenuBar +#include // Add CMetaFile, CEnhMetaFile +#include // Add CEvent, CMutex, CSemaphore +#include // Add CPropertyPage, CPropertySheet +#include // Add CRebar +#include // Add CPoint, CRect, CSize +#include // Add CRegKey +#include // Add CRichEdit +#include // Add CScrollView +#include // Adds macros, windows header files, and CObject +#include // Add CSocket +#include // Add CStatusBar +#include // Add CButton, CEdit, CListBox +#include // Add CTab, CTabbedMDI +#include // Add AtoT, AtoW, TtoA, TtoW, WtoA, WtoT etc. +#include // Add MenuTheme, ReBarTheme, StatusBarTheme, ToolBarTheme +#include // Add CWinThread +#include // Add CTime +#include // Add CToolBar +#include // Add CTreeView +#include // Add CWebBrowser, CAXHost +#include // Add CWnd + +// WIN32_LEAN_AND_MEAN can't be used with these +#ifndef WIN32_LEAN_AND_MEAN + #include // Add CCommonDialog, CColorDialog, CFileDialog, CFindReplace, CFontDialog + #include // Add CFolderDialogEx + #include // Add CPrintPreview + #include // Add CPageSetupDialog, CPrintDialog + #include // Add CPrintDialogEx + #include // Add CTaskDialog + + // Visual Studio + #if defined (_MSC_VER) + #include // Add CRibbon, CRibbonFrame + #endif + +#endif // define WIN32_LEAN_AND_MEAN + +#endif // define STDAFX_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing.cbp b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing.cbp new file mode 100644 index 00000000..319bfe2b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing.cbp @@ -0,0 +1,139 @@ + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing.cbproj b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing.cbproj new file mode 100644 index 00000000..ac9fec22 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing.cbproj @@ -0,0 +1,1519 @@ + + + {39461456-1040-43CB-9B40-5962EF847BB0} + 20.1 + None + True + Release + Win64x + 1048579 + Application + DialogResizing + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + JPHNE + .\Embarcadero\$(Platform)\$(Config) + .\Embarcadero\$(Platform)\$(Config) + false + true + true + $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + CppGuiApplication + System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + true + <_TCHARMapping>wchar_t + DialogResizing + ..\..\..\include\;..\src\;$(IncludePath) + ..\..\..\include\;..\src\;$(ILINK_LibraryPath) + 3081 + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + $(BDSINCLUDE)\windows\sdk;..\src\$(BDSINCLUDE)\windows\sdk;$(BRCC_IncludePath) + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + ..\src\stdafx.h + none + + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + false + true + false + true + _DEBUG;$(Defines) + false + None + DEBUG + true + true + true + true + Full + true + true + true + true + true + $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) + $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + + + PerMonitorV2 + false + $(BDSLIB)\$(PLATFORM)$(CC_SUFFIX)\debug;$(ILINK_LibraryPath) + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + false + + + PerMonitorV2 + true + 1033 + + + NDEBUG;$(Defines) + None + + + PerMonitorV2 + false + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 0 + + + 1 + + + 2 + + + 3 + + + 4 + + + 5 + + +
Resource.res
+ 6 +
+ + 7 + + + 8 + true + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + +
+ + CPlusPlusBuilder.Personality.12 + CppGuiApplication + + + + False + True + True + False + + + Embarcadero C++Builder Office 2000 Servers Package + Embarcadero C++Builder Office XP Servers Package + + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + Assets\ + Logo150x150.png + true + + + + + Assets\ + Logo44x44.png + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + DialogResizing.exe + true + + + + + DialogResizing.exe + true + + + + + NewProject.exe + true + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 64 + + + classes + 64 + + + + + res\xml + 1 + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\mips + 1 + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-v21 + 1 + + + res\values-v21 + 1 + + + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + Contents + 1 + + + Contents + 1 + + + Contents + 1 + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + library\lib\armeabi-v7a + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen + 64 + + + ..\$(PROJECTNAME).launchscreen + 64 + + + + + 1 + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + + + + + + + + + + + + + True + True + True + + + 12 + + + + +
diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2015.sln b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2015.sln new file mode 100644 index 00000000..ee68946c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2015.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DialogResizing", "DialogResizing_2015.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2015.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2015.vcxproj new file mode 100644 index 00000000..2bfd88ac --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2015.vcxproj @@ -0,0 +1,247 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DialogResizing + DialogResizing + + + + Application + Unicode + v140_xp + + + Application + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + + + + + + + + + + + + + + + + + true + false + + + true + false + + + false + false + + + false + false + + + + Use + Level4 + true + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2015.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2015.vcxproj.filters new file mode 100644 index 00000000..75e6a00f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2015.vcxproj.filters @@ -0,0 +1,218 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Win32++ + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + {81793198-dade-49f7-8124-b6822fb48228} + + + {4379d5cf-73d6-422e-addd-190e4822f875} + + + {7aa6268a-6a9a-40f2-87cf-97d6a5f3fbef} + + + {eecf15d7-bea0-456a-945f-406192c44397} + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2019.sln b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2019.sln new file mode 100644 index 00000000..8a4b04a0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2019.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DialogResizing", "DialogResizing_2019.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {60167B52-08D7-40FB-922D-233EA52D7081} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2019.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2019.vcxproj new file mode 100644 index 00000000..7137f3a0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2019.vcxproj @@ -0,0 +1,224 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DialogResizing + DialogResizing + + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2019.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2019.vcxproj.filters new file mode 100644 index 00000000..3e5c805a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2019.vcxproj.filters @@ -0,0 +1,215 @@ + + + + + {34b6b0b7-822c-4d97-8ee3-f31bd922df07} + + + {948a2591-7526-430f-a12e-a85eaa16e099} + + + {c8a8958f-77b0-4aef-911b-7c2b995c1fc9} + + + {0a3db11a-9331-4b16-89c3-4fc5487ad5da} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2022.sln b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2022.sln new file mode 100644 index 00000000..db99e2b1 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2022.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DialogResizing", "DialogResizing_2022.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {186AAE30-2F0A-4082-A9A1-1F9E915AD8E6} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2022.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2022.vcxproj new file mode 100644 index 00000000..e88364e9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2022.vcxproj @@ -0,0 +1,235 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DialogResizing + DialogResizing + 10.0 + + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2022.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2022.vcxproj.filters new file mode 100644 index 00000000..3e5c805a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2022.vcxproj.filters @@ -0,0 +1,215 @@ + + + + + {34b6b0b7-822c-4d97-8ee3-f31bd922df07} + + + {948a2591-7526-430f-a12e-a85eaa16e099} + + + {c8a8958f-77b0-4aef-911b-7c2b995c1fc9} + + + {0a3db11a-9331-4b16-89c3-4fc5487ad5da} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2026.slnx b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2026.slnx new file mode 100644 index 00000000..b56fe78e --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2026.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2026.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2026.vcxproj new file mode 100644 index 00000000..4a856927 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2026.vcxproj @@ -0,0 +1,235 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DialogResizing + DialogResizing + 10.0 + + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2026.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2026.vcxproj.filters new file mode 100644 index 00000000..879dfb6d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_2026.vcxproj.filters @@ -0,0 +1,215 @@ + + + + + {34b6b0b7-822c-4d97-8ee3-f31bd922df07} + + + {948a2591-7526-430f-a12e-a85eaa16e099} + + + {c8a8958f-77b0-4aef-911b-7c2b995c1fc9} + + + {0a3db11a-9331-4b16-89c3-4fc5487ad5da} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_DEBUG.dev b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_DEBUG.dev new file mode 100644 index 00000000..c49465e2 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_DEBUG.dev @@ -0,0 +1,141 @@ +[Project] +FileName=DialogResizing_DEBUG.dev +Name=DialogResizing +UnitCount=9 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=Dialog_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D_DEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@__@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Debug +ObjectOutput=.\Dev-C++\Debug +OverrideOutput=1 +OverrideOutputName=DialogResizing.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=4 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[Unit1] +FileName=..\src\DialogApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\DialogApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\MyDialog.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\MyDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\Resource.rc +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit8] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_RELEASE.dev b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_RELEASE.dev new file mode 100644 index 00000000..1d4ba924 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/ProjectFiles/DialogResizing_RELEASE.dev @@ -0,0 +1,141 @@ +[Project] +FileName=DialogResizing_RELEASE.dev +Name=DialogResizing +UnitCount=9 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=Dialog_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D NDEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-s_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Release +ObjectOutput=.\Dev-C++\Release +OverrideOutput=1 +OverrideOutputName=DialogResizing.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=3 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[Unit1] +FileName=..\src\DialogApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\DialogApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\MyDialog.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\MyDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\Resource.rc +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit8] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/Readme.txt new file mode 100644 index 00000000..1ede4228 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/Readme.txt @@ -0,0 +1,19 @@ +Resizing Dialog Example +======================= +This program simply displays a modal dialog that can be resized. + +Features demonstrated in this example +===================================== +* Using a dialog as an application +* Using CDialog to display a dialog defined a resource script (resource.rc) +* Using CResizer to manage the resizing of the dialog. + + +About Dialogs +============= +Dialog applications are easy to create, provided we have access to a resource +editor to build the resource script file for us (often called resource.rc). +Commercial compilers usually include a resource editor for this purpose, but +many free compilers don't. A resource editor is included with Microsoft's +Visual Studio Studio Community. + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/DialogApp.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/DialogApp.cpp new file mode 100644 index 00000000..8222a23b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/DialogApp.cpp @@ -0,0 +1,26 @@ +///////////////////////////// +// DialogApp.cpp +// + +#include "stdafx.h" +#include "DialogApp.h" +#include "resource.h" + + +////////////////////////////////// +// CDialogApp function definitions +// + +// Constructor. +CDialogApp::CDialogApp() : m_myDialog(IDD_DIALOG1) +{ +} + +// Called when the application starts. +BOOL CDialogApp::InitInstance() +{ + // Display the modal dialog. + m_myDialog.DoModal(); // throws a CWinException on failure. + + return TRUE; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/DialogApp.h b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/DialogApp.h new file mode 100644 index 00000000..fd700703 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/DialogApp.h @@ -0,0 +1,32 @@ +///////////////////////////// +// DialogApp.h +// + +#ifndef DIALOGAPP_H +#define DIALOGAPP_H + +#include "MyDialog.h" + + +///////////////////////////////////////////////////////////////// +// CDialogApp manages the application. It initializes the Win32++ +// framework when it is constructed, and creates the main dialog +// when it runs. +class CDialogApp : public CWinApp +{ +public: + CDialogApp(); + virtual ~CDialogApp() override = default; + +protected: + virtual BOOL InitInstance() override; + +private: + CDialogApp(const CDialogApp&) = delete; + CDialogApp& operator=(const CDialogApp&) = delete; + + CMyDialog m_myDialog; +}; + + +#endif // define DIALOGAPP_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/MyDialog.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/MyDialog.cpp new file mode 100644 index 00000000..aee2c8ee --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/MyDialog.cpp @@ -0,0 +1,202 @@ +///////////////////////////// +// MyDialog.cpp +// + +#include "stdafx.h" +#include "MyDialog.h" +#include "resource.h" + + +///////////////////////////////// +// CMyDialog function definitions +// + +// Constructor. +CMyDialog::CMyDialog(UINT resID) : CDialog(resID) +{ +} + +// Process the dialog's window messages. +INT_PTR CMyDialog::DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass resizing messages on to the resizer. + m_resizer.HandleMessage(msg, wparam, lparam); + + // switch (msg) + // { + // Additional messages to be handled go here. + // } + + // Pass unhandled messages on to parent DialogProc. + return DialogProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + +// Process the dialog's command messages(WM_COMMAND) +BOOL CMyDialog::OnCommand(WPARAM wparam, LPARAM) +{ + UINT id = LOWORD(wparam); + switch (id) + { + case IDC_BUTTON1: return OnButton(); + case IDC_CHECK1: return OnCheck1(); + case IDC_CHECK2: return OnCheck2(); + case IDC_CHECK3: return OnCheck3(); + + case IDC_RADIO1: + case IDC_RADIO2: // intentionally blank + case IDC_RADIO3: return OnRangeOfRadioIDs(IDC_RADIO1, IDC_RADIO3, id); + } + + return FALSE; +} + +// Called when the dialog window is destroyed. +void CMyDialog::OnDestroy() +{ + // End the application + ::PostQuitMessage(0); +} + +// Called before the dialog is displayed. +BOOL CMyDialog::OnInitDialog() +{ + // Set the Icon + SetIconLarge(IDW_MAIN); + SetIconSmall(IDW_MAIN); + + // Attach CWnd objects to the dialog items + AttachItem(IDC_BUTTON1, m_button); + AttachItem(IDC_CHECK1, m_checkA); + AttachItem(IDC_CHECK2, m_checkB); + AttachItem(IDC_CHECK3, m_checkC); + AttachItem(IDC_RADIO1, m_radioA); + AttachItem(IDC_RADIO2, m_radioB); + AttachItem(IDC_RADIO3, m_radioC); + AttachItem(IDC_RICHEDIT1, m_richEdit1); + AttachItem(IDC_RICHEDIT2, m_richEdit2); + + // Put some text in the edit boxes + m_richEdit1.SetWindowText(L"Rich Edit Window"); + m_richEdit2.SetWindowText(L"Rich Edit Window"); + + // Initialize dialog resizing + m_resizer.Initialize( *this, CRect(0, 0, 200, 200) ); + m_resizer.AddChild(m_radioA, CResizer::topleft, 0); + m_resizer.AddChild(m_radioB, CResizer::topleft, 0); + m_resizer.AddChild(m_radioC, CResizer::topleft, 0); + m_resizer.AddChild(m_button, CResizer::topleft, 0); + m_resizer.AddChild(m_checkA, CResizer::bottomright, 0); + m_resizer.AddChild(m_checkB, CResizer::bottomright, 0); + m_resizer.AddChild(m_checkC, CResizer::bottomright, 0); + m_resizer.AddChild(m_richEdit1, CResizer::topright, RD_STRETCH_WIDTH); + m_resizer.AddChild(m_richEdit2, CResizer::bottomleft, RD_STRETCH_WIDTH| RD_STRETCH_HEIGHT); + + m_resizer.RecalcLayout(); + + // Select the first radio button. + CheckRadioButton(IDC_RADIO1, IDC_RADIO3, IDC_RADIO1); + + return TRUE; +} + +// Called when the OK button or Enter key is pressed. +void CMyDialog::OnOK() +{ + MessageBox(L"OK Button Pressed. Program will exit now.", L"Button", MB_OK); + CDialog::OnOK(); +} + +// Called when the button is pressed. +BOOL CMyDialog::OnButton() +{ + SetDlgItemText(IDC_STATIC3, L"Button Pressed"); + TRACE("Button Pressed\n"); + return TRUE; +} + +// Called when check box 1 is clicked. +BOOL CMyDialog::OnCheck1() +{ + SetDlgItemText(IDC_STATIC3, L"Check Box 1"); + TRACE("Check Box 1\n"); + return TRUE; +} + +// Called when check box 2 is clicked. +BOOL CMyDialog::OnCheck2() +{ + SetDlgItemText(IDC_STATIC3, L"Check Box 2"); + TRACE("Check Box 2\n"); + return TRUE; +} + +// Called when check box 3 is clicked. +BOOL CMyDialog::OnCheck3() +{ + SetDlgItemText(IDC_STATIC3, L"Check Box 3"); + TRACE("Check Box 3\n"); + return TRUE; +} + +// Called when the dialog's background is redrawn. +BOOL CMyDialog::OnEraseBkgnd(CDC&) +{ + // Adding a gripper to a resizable dialog is a bit of a hack, but since it + // is often done, here is one method of doing it safely. + + // Draw the dialog's background manually + CRect rc = GetClientRect(); + CClientDC dcClient(*this); + dcClient.SolidFill(GetSysColor(COLOR_3DFACE), rc); + + // Draw size grip + if (rc.Width() > m_resizer.GetMinRect().Width() && rc.Height() > m_resizer.GetMinRect().Height()) + { + double scale = (double)GetWindowDpi(*this) / (double)GetWindowDpi(HWND_DESKTOP); + int size = (int)(scale * GetSystemMetrics(SM_CXVSCROLL)); + rc.left = rc.right - size; + rc.top = rc.bottom - size; + dcClient.DrawFrameControl(rc, DFC_SCROLL, DFCS_SCROLLSIZEGRIP); + } + + // Suppress default background drawing + return TRUE; +} + +// Called when a radio button is selected. +BOOL CMyDialog::OnRangeOfRadioIDs(UINT idFirst, UINT idLast, UINT idClicked) +{ + CheckRadioButton(idFirst, idLast, idClicked); + + CString str; + int nButton = idClicked - idFirst + 1; + str.Format(L"Radio%d", nButton); + TRACE(str); TRACE("\n"); + + return TRUE; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/MyDialog.h b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/MyDialog.h new file mode 100644 index 00000000..4423686c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/MyDialog.h @@ -0,0 +1,51 @@ +///////////////////////////// +// MyDialog.h +// + +#ifndef MYDIALOG_H +#define MYDIALOG_H + + +///////////////////////////////////////////////////////// +// CMyDialog manages the application's main dialog. +// The CResizer member provides the support for resizing. +class CMyDialog : public CDialog +{ +public: + CMyDialog(UINT resID); + virtual ~CMyDialog() override = default; + +protected: + virtual void OnDestroy() override; + virtual BOOL OnInitDialog() override; + virtual INT_PTR DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual BOOL OnCommand(WPARAM wparam, LPARAM lparam) override; + virtual BOOL OnEraseBkgnd(CDC& dc) override; + virtual void OnOK() override; + +private: + CMyDialog(const CMyDialog&) = delete; + CMyDialog& operator=(const CMyDialog&) = delete; + + // Command handlers + BOOL OnButton(); + BOOL OnCheck1(); + BOOL OnCheck2(); + BOOL OnCheck3(); + BOOL OnRangeOfRadioIDs(UINT idFirst, UINT idLast, UINT idClicked); + + CResizer m_resizer; + + // Member variables + CButton m_radioA; + CButton m_radioB; + CButton m_radioC; + CButton m_checkA; + CButton m_checkB; + CButton m_checkC; + CButton m_button; + CRichEdit m_richEdit1; + CRichEdit m_richEdit2; +}; + +#endif //MYDIALOG_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/Resource.rc b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/Resource.rc new file mode 100644 index 00000000..88d759e2 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/Resource.rc @@ -0,0 +1,97 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "../src/res/PerMonitorV2.manifest" + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDW_MAIN ICON "../src/res/Dialog.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_DIALOG1 DIALOGEX 0, 0, 203, 127 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX| WS_MAXIMIZEBOX +EXSTYLE WS_EX_APPWINDOW +CAPTION "My Dialog" +FONT 8, "MS Shell Dlg", 0, 0 +BEGIN + CONTROL "Radio1",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,16,12,38,10 + CONTROL "Radio2",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,16,24,38,10 + CONTROL "Radio3",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,16,36,38,10 + PUSHBUTTON "Button",IDC_BUTTON1,14,56,49,11 + CONTROL "Check Box 1",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,77,55,10 + CONTROL "Check Box 2",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,91,55,10 + CONTROL "Check Box 3",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,105,55,10 + CONTROL "",IDC_RICHEDIT1,"RichEdit50W" ,ES_MULTILINE | ES_WANTRETURN | ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP,97,12,84,42 + CONTROL "",IDC_RICHEDIT2,"RichEdit50W" ,ES_MULTILINE | ES_WANTRETURN | ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP,13,76,84,42 +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/StdAfx.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/StdAfx.cpp new file mode 100644 index 00000000..8957144d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/StdAfx.cpp @@ -0,0 +1,16 @@ +///////////////////////////// +// StdAfx.cpp +// + +// This file is used for precompiled hearders. Precompiled headers allow +// programs to be recompiled more quickly + +// To use precompiled headers, do the following: +// 1) Add the set of rarely changed headers to stdafx.h +// 2) Include stdafx.h in each cpp file. It must be included first. +// 3) Add stdafx.cpp to your project. +// 4) Turn on precompiled hearders in the project + + +#include "stdafx.h" + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/main.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/main.cpp new file mode 100644 index 00000000..25607e6b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/main.cpp @@ -0,0 +1,43 @@ +///////////////////////////// +// main.cpp +// + +#include "stdafx.h" +#include "DialogApp.h" + +int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPWSTR, _In_ int) +{ + try + { + // Start Win32++. + CDialogApp theApp; + + // Run the application. + return theApp.Run(); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return -1; +} + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/res/Dialog.ico b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/res/Dialog.ico new file mode 100644 index 00000000..4730e915 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/res/Dialog.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/res/PerMonitorV2.manifest b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/res/PerMonitorV2.manifest new file mode 100644 index 00000000..d303e5c0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/res/PerMonitorV2.manifest @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + PerMonitorV2, PerMonitor + + + + + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/resource.h b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/resource.h new file mode 100644 index 00000000..4f174000 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/resource.h @@ -0,0 +1,42 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Resource.rc +// + +// include the Resource IDs defined by Win32++ +#include "default_resource.h" + +//The resource ID for MENU, ICON, ToolBar Bitmap, Accelerator, +// and Window Caption + +//Resource IDs for the dialog +#define IDD_DIALOG1 121 +#define IDC_RADIO1 130 +#define IDC_RADIO2 131 +#define IDC_RADIO3 132 +#define IDC_CHECK1 133 +#define IDC_CHECK2 134 +#define IDC_CHECK3 135 +#define IDC_EDIT1 140 +#define IDC_LIST1 141 +#define IDC_BUTTON1 142 +#define IDC_RICHEDIT1 143 +#define IDC_RICHEDIT2 144 +#define IDC_STATIC1 150 +#define IDC_STATIC2 151 +#define IDC_STATIC3 152 +#define IDC_HOTKEY1 153 +#define IDB_BITMAP1 154 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 130 +#endif +#endif + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/stdafx.h b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/stdafx.h new file mode 100644 index 00000000..08450116 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogResizing/src/stdafx.h @@ -0,0 +1,90 @@ +///////////////////////////// +// StdAfx.h +// + +// This file is used for precompiled headers. +// Rarely modified header files should be included. +// Based on code provided by Lynn Allan. + + +#ifndef STDAFX_H +#define STDAFX_H + + +// Predefinitions for windows.h go here +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +// Specify Win32xx specific predefinitions here +//#define NO_USING_NAMESPACE // Don't use Win32xx namespace + +// Rarely modified header files should be included here +#include // Add support for std::vector +#include // Add support for std::map +#include // Add support for std::string +#include // Add support for stringstream +#include // Add support for the assert macro +#include // Add support for C style printf, sprintf, etc. +#include // Add support for C style character conversions atoi etc. +#include // Add support for C style TCHARs. + +// Add the Win32++ library +#include // Add CWinApp +#include // Add CArchive +#include // Add CAnimation, CComboBox, CComboBoxEx, CDateTime, CHeader, CHotKey, CIPAddress, CProgressBar, CSpinButton, CScrollBar, CSlider, CToolTip +#include // Add CCriticalSection, CThreadLock +#include // Add CString, CStringA, CStringW +#include // Add CDataExchange +#include // Add CDialog, CResizer +#include // Add CDockFrame, CMDIDockFrame +#include // Add CDocker, CDockContainer +#include // Add CException, CFileException, CNotSupportedException, CResourceException, CUserException, CWinException +#include // Add CFile +#include // Add CFileFind +#include // Add CFolderDialog +#include // Add CFrame +#include // Add CDC, CGDIObject, CBitmap, CBrush, CFont, CPalatte, CPen, CRgn +#include // Add CHGlobal +#include // Add CImageList +#include // Add CListView +#include // Add CMDIChild, CMDIFrame, CDockMDIFrame +#include // Add CMenu +#include // Add CMenuBar +#include // Add CMetaFile, CEnhMetaFile +#include // Add CEvent, CMutex, CSemaphore +#include // Add CPropertyPage, CPropertySheet +#include // Add CRebar +#include // Add CPoint, CRect, CSize +#include // Add CRegKey +#include // Add CRichEdit +#include // Add CScrollView +#include // Adds macros, windows header files, and CObject +#include // Add CSocket +#include // Add CStatusBar +#include // Add CButton, CEdit, CListBox +#include // Add CTab, CTabbedMDI +#include // Add AtoT, AtoW, TtoA, TtoW, WtoA, WtoT etc. +#include // Add MenuTheme, ReBarTheme, StatusBarTheme, ToolBarTheme +#include // Add CWinThread +#include // Add CTime +#include // Add CToolBar +#include // Add CTreeView +#include // Add CWebBrowser, CAXHost +#include // Add CWnd + +// WIN32_LEAN_AND_MEAN can't be used with these +#ifndef WIN32_LEAN_AND_MEAN + #include // Add CCommonDialog, CColorDialog, CFileDialog, CFindReplace, CFontDialog + #include // Add CFolderDialogEx + #include // Add CPrintPreview + #include // Add CPageSetupDialog, CPrintDialog + #include // Add CPrintDialogEx + #include // Add CTaskDialog + + // Visual Studio + #if defined (_MSC_VER) + #include // Add CRibbon, CRibbonFrame + #endif + +#endif // define WIN32_LEAN_AND_MEAN + +#endif // define STDAFX_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab.cbp b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab.cbp new file mode 100644 index 00000000..2206112f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab.cbp @@ -0,0 +1,139 @@ + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab.cbproj b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab.cbproj new file mode 100644 index 00000000..b93ed79a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab.cbproj @@ -0,0 +1,1518 @@ + + + {39461456-1040-43CB-9B40-5962EF847BB0} + 20.1 + None + True + Release + Win64x + 1048579 + Application + DialogTab + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + JPHNE + .\Embarcadero\$(Platform)\$(Config) + .\Embarcadero\$(Platform)\$(Config) + false + true + true + $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + CppGuiApplication + System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + true + <_TCHARMapping>wchar_t + DialogTab + ..\..\..\include\;..\src\;$(IncludePath) + ..\..\..\include\;..\src\;$(ILINK_LibraryPath) + 3081 + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + $(BDSINCLUDE)\windows\sdk;$(BRCC_IncludePath) + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + ..\src\stdafx.h + none + + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + false + true + false + true + _DEBUG;$(Defines) + false + None + DEBUG + true + true + true + true + Full + true + true + true + true + true + $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) + $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + + + PerMonitorV2 + false + $(BDSLIB)\$(PLATFORM)$(CC_SUFFIX)\debug;$(ILINK_LibraryPath) + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + + + NDEBUG;$(Defines) + None + + + PerMonitorV2 + false + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 62 + + + 0 + + + 1 + + + 2 + + + 3 + + + 4 + + + 5 + + +
Resource.res
+ 6 +
+ + 7 + + + 8 + true + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + +
+ + CPlusPlusBuilder.Personality.12 + CppGuiApplication + + + + False + True + True + False + + + Embarcadero C++Builder Office 2000 Servers Package + Embarcadero C++Builder Office XP Servers Package + + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + Assets\ + Logo150x150.png + true + + + + + Assets\ + Logo44x44.png + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + DialogTab.exe + true + + + + + DialogTab.exe + true + + + + + NewProject.exe + true + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 64 + + + classes + 64 + + + + + res\xml + 1 + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\mips + 1 + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-v21 + 1 + + + res\values-v21 + 1 + + + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + Contents + 1 + + + Contents + 1 + + + Contents + 1 + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + library\lib\armeabi-v7a + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen + 64 + + + ..\$(PROJECTNAME).launchscreen + 64 + + + + + 1 + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + + + + + + + + + + + + + True + True + True + + + 12 + + + + +
diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2015.sln b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2015.sln new file mode 100644 index 00000000..021e1c11 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2015.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DialogTab", "DialogTab_2015.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2015.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2015.vcxproj new file mode 100644 index 00000000..667a74b6 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2015.vcxproj @@ -0,0 +1,247 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DialogTab + DialogTab + + + + Application + Unicode + v140_xp + + + Application + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + + + + + + + + + + + + + + + + + true + false + + + true + false + + + false + false + + + false + false + + + + Use + Level4 + true + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2015.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2015.vcxproj.filters new file mode 100644 index 00000000..08056bf1 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2015.vcxproj.filters @@ -0,0 +1,218 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Win32++ + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + {7ea1bc52-bd0f-4cb1-8203-382351c995eb} + + + {a8a63f6f-b0ed-4430-87dc-6eae4946ca21} + + + {9ea2974f-afd4-4a4d-b406-c6554bcfbba0} + + + {ed068afe-2c65-4fe6-a661-51ef0db86724} + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2019.sln b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2019.sln new file mode 100644 index 00000000..37319181 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2019.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DialogTab", "DialogTab_2019.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {43F8ACC7-B016-47E1-B56F-42B5D0D8AC3A} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2019.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2019.vcxproj new file mode 100644 index 00000000..b2f170be --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2019.vcxproj @@ -0,0 +1,224 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DialogTab + DialogTab + + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2019.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2019.vcxproj.filters new file mode 100644 index 00000000..7320dc08 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2019.vcxproj.filters @@ -0,0 +1,215 @@ + + + + + {f61b00be-5f3f-432a-84bf-5ef398f482d5} + + + {05c393aa-ef3b-4582-8f80-093dba8926bd} + + + {fb004f05-567f-4b4c-a65c-deb8db413e2b} + + + {752d4573-9ff1-487e-baf0-0070ad19f9db} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2022.sln b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2022.sln new file mode 100644 index 00000000..dfdd5295 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2022.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DialogTab", "DialogTab_2022.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {758CA6B4-A97A-4F48-9743-126A7ABEEB72} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2022.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2022.vcxproj new file mode 100644 index 00000000..500e59b5 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2022.vcxproj @@ -0,0 +1,235 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DialogTab + DialogTab + 10.0 + + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2022.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2022.vcxproj.filters new file mode 100644 index 00000000..7320dc08 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2022.vcxproj.filters @@ -0,0 +1,215 @@ + + + + + {f61b00be-5f3f-432a-84bf-5ef398f482d5} + + + {05c393aa-ef3b-4582-8f80-093dba8926bd} + + + {fb004f05-567f-4b4c-a65c-deb8db413e2b} + + + {752d4573-9ff1-487e-baf0-0070ad19f9db} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2026.slnx b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2026.slnx new file mode 100644 index 00000000..bacf6c3f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2026.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2026.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2026.vcxproj new file mode 100644 index 00000000..e8c0c41b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2026.vcxproj @@ -0,0 +1,235 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DialogTab + DialogTab + 10.0 + + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2026.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2026.vcxproj.filters new file mode 100644 index 00000000..73b24c01 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_2026.vcxproj.filters @@ -0,0 +1,215 @@ + + + + + {f61b00be-5f3f-432a-84bf-5ef398f482d5} + + + {05c393aa-ef3b-4582-8f80-093dba8926bd} + + + {fb004f05-567f-4b4c-a65c-deb8db413e2b} + + + {752d4573-9ff1-487e-baf0-0070ad19f9db} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_DEBUG.dev b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_DEBUG.dev new file mode 100644 index 00000000..124e2fd7 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_DEBUG.dev @@ -0,0 +1,142 @@ +[Project] +FileName=DialogTab_DEBUG.dev +Name=DialogTabDemo +UnitCount=9 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=DialogTabDemo_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D _DEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Debug +ObjectOutput=.\Dev-C++\Debug +OverrideOutput=1 +OverrideOutputName=DialogTab.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=4 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit1] +FileName=..\src\DialogApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\DialogApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\MyDialog.cpp +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit5] +FileName=..\src\MyDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\Resource.rc +CompileCpp=1 +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit8] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_RELEASE.dev b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_RELEASE.dev new file mode 100644 index 00000000..fa91e0d9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/ProjectFiles/DialogTab_RELEASE.dev @@ -0,0 +1,142 @@ +[Project] +FileName=DialogTab_RELEASE.dev +Name=DialogTabDemo +UnitCount=9 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=DialogTabDemo_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D NDEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Release +ObjectOutput=.\Dev-C++\Release +OverrideOutput=1 +OverrideOutputName=DialogTab.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=3 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit1] +FileName=..\src\DialogApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\DialogApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\MyDialog.cpp +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit5] +FileName=..\src\MyDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\Resource.rc +CompileCpp=1 +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit8] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/DialogTab/Readme.txt new file mode 100644 index 00000000..f74d2a1f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/Readme.txt @@ -0,0 +1,15 @@ +DialogTab Example +================== +This dialog features a Tab control in the main dialog. The tab control +then displays other simple dialogs. + +Note that property sheets provide an alternative to dialogs with a tab control. +Refer to the PropertySheet example for a demonstration of property sheets. + + +Features demonstrated in this example +===================================== +* Using a dialog as an application. +* Use of AttachItem to attach a dialog control to a CWnd. +* Using a Tab control within a dialog +* Using dialogs within a tab control \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/DialogApp.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/DialogApp.cpp new file mode 100644 index 00000000..2271c6e5 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/DialogApp.cpp @@ -0,0 +1,24 @@ +///////////////////////////// +// DialogApp.cpp +// + +#include "stdafx.h" +#include "DialogApp.h" +#include "resource.h" + +////////////////////////////////// +// CDialogApp function definitions +// + +CDialogApp::CDialogApp() : m_myDialog(IDD_DIALOG1) +{ +} + +BOOL CDialogApp::InitInstance() +{ + // Display the modeless dialog. + m_myDialog.Create(); // throws a CWinException on failure. + + return TRUE; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/DialogApp.h b/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/DialogApp.h new file mode 100644 index 00000000..fd700703 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/DialogApp.h @@ -0,0 +1,32 @@ +///////////////////////////// +// DialogApp.h +// + +#ifndef DIALOGAPP_H +#define DIALOGAPP_H + +#include "MyDialog.h" + + +///////////////////////////////////////////////////////////////// +// CDialogApp manages the application. It initializes the Win32++ +// framework when it is constructed, and creates the main dialog +// when it runs. +class CDialogApp : public CWinApp +{ +public: + CDialogApp(); + virtual ~CDialogApp() override = default; + +protected: + virtual BOOL InitInstance() override; + +private: + CDialogApp(const CDialogApp&) = delete; + CDialogApp& operator=(const CDialogApp&) = delete; + + CMyDialog m_myDialog; +}; + + +#endif // define DIALOGAPP_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/MyDialog.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/MyDialog.cpp new file mode 100644 index 00000000..b8e19d10 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/MyDialog.cpp @@ -0,0 +1,285 @@ +///////////////////////////// +// MyDialog.cpp +// + +#include "stdafx.h" +#include "MyDialog.h" +#include "resource.h" + +using namespace std; + +///////////////////////////////////// +// CButtonDialog function definitions +// + +// Constructor. +CButtonDialog::CButtonDialog(UINT resID) : CDialog(resID) +{ + m_brush.CreateSolidBrush(RGB(255, 255, 255)); +} + +// Process the dialog's window messages. +INT_PTR CButtonDialog::DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case WM_CTLCOLORDLG: return OnCtlColorDlg(msg, wparam, lparam); + case WM_CTLCOLORSTATIC: return OnCtlColorStatic(msg, wparam, lparam); + } + + // Pass unhandled messages on to parent DialogProc. + return DialogProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + +// Process the dialog's command messages (WM_COMMAND). +BOOL CButtonDialog::OnCommand(WPARAM wparam, LPARAM) +{ + UINT id = LOWORD(wparam); + switch (id) + { + case IDC_BUTTON1: return OnButton(); + case IDC_CHECK1: return OnCheck1(); + case IDC_CHECK2: return OnCheck2(); + case IDC_CHECK3: return OnCheck3(); + + case IDC_RADIO1: + case IDC_RADIO2: // intentionally blank + case IDC_RADIO3: return OnRangeOfRadioIDs(IDC_RADIO1, IDC_RADIO3, id); + } + + return FALSE; +} + +// Called when the button is pressed. +BOOL CButtonDialog::OnButton() +{ + TRACE("Push Button Pressed\n"); + return TRUE; +} + +// Called when the check box 1 is clicked. +BOOL CButtonDialog::OnCheck1() +{ + TRACE("Check Box 1\n"); + return TRUE; +} + +// Called when the check box 2 is clicked. +BOOL CButtonDialog::OnCheck2() +{ + TRACE("Check Box 2\n"); + return TRUE; +} + +// Called when the check box 3 is clicked. +BOOL CButtonDialog::OnCheck3() +{ + TRACE("Check Box 3\n"); + return TRUE; +} + +// Set the background color of the dialog +INT_PTR CButtonDialog::OnCtlColorDlg(UINT msg, WPARAM wparam, LPARAM lparam) +{ + if (IsXPThemed()) + return reinterpret_cast(m_brush.GetHandle()); + else + return FinalWindowProc(msg, wparam, lparam); +} + +// Set the background color of static controls +INT_PTR CButtonDialog::OnCtlColorStatic(UINT msg, WPARAM wparam, LPARAM lparam) +{ + if (IsXPThemed()) + return reinterpret_cast(m_brush.GetHandle()); + else + return FinalWindowProc(msg, wparam, lparam); +} + +// Called when a radio button is selected. +BOOL CButtonDialog::OnRangeOfRadioIDs(UINT firstID, UINT lastID, UINT clickedID) +{ + CheckRadioButton(firstID, lastID, clickedID); + + CString str; + int button = clickedID - firstID + 1; + str.Format(L"Radio%d", button); + TRACE(str); TRACE("\n"); + + return TRUE; +} + + +/////////////////////////////////////// +// CComboBoxDialog function definitions +// + +// Constructor. +CComboBoxDialog::CComboBoxDialog(int resID) : CDialog(resID) +{ + m_brush.CreateSolidBrush(RGB(255, 255, 255)); +} + +// Process the dialog's window messages. +INT_PTR CComboBoxDialog::DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + // Set the background color of the dialog + case WM_CTLCOLORDLG: + if (IsXPThemed()) return reinterpret_cast(m_brush.GetHandle()); + break; + + // Set the background color of static controls + case WM_CTLCOLORSTATIC: + if (IsXPThemed()) return reinterpret_cast(m_brush.GetHandle()); + break; + + } + + // Pass unhandled messages on to parent DialogProc + return DialogProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + +// Called before the dialog is displayed. +BOOL CComboBoxDialog::OnInitDialog() +{ + // Put some text in the Combo Boxes + for (int i = 0 ; i < 6 ; i++) + { + SendDlgItemMessage(IDC_COMBO1, CB_ADDSTRING, 0, reinterpret_cast(L"C Box 1")); + SendDlgItemMessage(IDC_COMBO2, CB_ADDSTRING, 0, reinterpret_cast(L"C Box 2")); + SendDlgItemMessage(IDC_COMBO3, CB_ADDSTRING, 0, reinterpret_cast(L"C Box 3")); + } + + return TRUE; +} + +///////////////////////////////// +// CMyDialog function definitions +// + +// Constructor. +CMyDialog::CMyDialog(int resID) : CDialog(resID) +{ + m_pButtonDlg = nullptr; + m_pComboDlg = nullptr; +} + +// Process the dialog's window messages. +INT_PTR CMyDialog::DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // switch (msg) + // { + // } + + // Pass unhandled messages on to parent DialogProc + return DialogProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + +// Called when the dialog window is destroyed. +void CMyDialog::OnDestroy() +{ + // End the application + ::PostQuitMessage(0); +} + +// Called before the dialog is displayed. +BOOL CMyDialog::OnInitDialog() +{ + // Set the Icon + SetIconLarge(IDW_MAIN); + SetIconSmall(IDW_MAIN); + + AttachItem(IDC_TAB1, m_tab); + + m_pButtonDlg = static_cast(m_tab.AddTabPage(make_unique(IDD_BUTTONS), L"Button Dialog")); + m_pComboDlg = static_cast(m_tab.AddTabPage(make_unique(IDD_COMBOBOXES), L"ComboBox Dialog")); + m_tab.SelectPage(0); + + // Add some checkmarks to buttons to the button dialog + m_pButtonDlg->CheckRadioButton(IDC_RADIO1, IDC_RADIO3, IDC_RADIO1); + m_pButtonDlg->CheckDlgButton(IDC_CHECK1, BST_CHECKED); + + return TRUE; +} + +// This is called when the Enter key is pressed +void CMyDialog::OnOK() +{ + // Do default action (i.e. close the dialog) + CDialog::OnOK(); +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/MyDialog.h b/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/MyDialog.h new file mode 100644 index 00000000..079b8658 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/MyDialog.h @@ -0,0 +1,91 @@ +///////////////////////////// +// MyDialog.h +// + +#ifndef MYDIALOG_H +#define MYDIALOG_H + + +///////////////////////////////////////////////////// +// CButtonDialog manages a dialog with several button +// controls. +class CButtonDialog : public CDialog +{ +public: + CButtonDialog(UINT resID); + virtual ~CButtonDialog() override = default; + +protected: + virtual INT_PTR DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual BOOL OnCommand(WPARAM wparam, LPARAM lparam) override; + virtual void OnOK() override {} // suppress closing dialog with the enter key + virtual void OnCancel() override {} // suppress closing dialog with the esc key + +private: + CButtonDialog(const CButtonDialog&); // Disable copy construction + CButtonDialog& operator=(const CButtonDialog&); // Disable assignment operator + + // Command handlers + BOOL OnButton(); + BOOL OnCheck1(); + BOOL OnCheck2(); + BOOL OnCheck3(); + INT_PTR OnCtlColorDlg(UINT msg, WPARAM wparam, LPARAM lparam); + INT_PTR OnCtlColorStatic(UINT msg, WPARAM wparam, LPARAM lparam); + BOOL OnRangeOfRadioIDs(UINT firstID, UINT lastID, UINT clickedID); + + // Member variables + CBrush m_brush; +}; + + +///////////////////////////////////////////////////////// +// CComboBoxDialog manages a dialog that contains several +// ComboBox controls. +class CComboBoxDialog : public CDialog +{ +public: + CComboBoxDialog (int resID); + virtual ~CComboBoxDialog() override = default; + +protected: + virtual INT_PTR DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual BOOL OnInitDialog() override; + virtual void OnOK() override {} // suppress closing dialog with the enter key + virtual void OnCancel() override {} // suppress closing dialog with the esc key + +private: + CComboBoxDialog(const CComboBoxDialog&); // Disable copy construction + CComboBoxDialog& operator=(const CComboBoxDialog&); // Disable assignment operator + + CBrush m_brush; +}; + + +///////////////////////////////////////////////////// +// CMyDialog manages the application's main dialog. +// The main dialog has a tab control. The tab control +// is used to display either the button dialog or the +// ComboBox dialog. +class CMyDialog : public CDialog +{ +public: + CMyDialog(int resID); + virtual ~CMyDialog() override = default; + +protected: + virtual void OnDestroy() override; + virtual BOOL OnInitDialog() override; + virtual INT_PTR DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual void OnOK() override; + +private: + CMyDialog(const CMyDialog&); // Disable copy construction + CMyDialog& operator=(const CMyDialog&); // Disable assignment operator + + CTab m_tab; + CButtonDialog* m_pButtonDlg; + CComboBoxDialog* m_pComboDlg; +}; + +#endif //MYDIALOG_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/Resource.rc b/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/Resource.rc new file mode 100644 index 00000000..2f5d0d37 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/Resource.rc @@ -0,0 +1,110 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "../src/res/PerMonitorV2.manifest" +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDW_MAIN ICON "../src/res/Tab.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_DIALOG1 DIALOGEX 0, 0, 268, 112 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_APPWINDOW +CAPTION "Tab Dialog" +FONT 8, "MS Shell Dlg", 0, 0 +BEGIN + CONTROL "",IDC_TAB1,"SysTabControl32",0x0,2,1,264,108 +END + +IDD_BUTTONS DIALOGEX 0, 0, 230, 94 +STYLE DS_SETFONT | WS_CHILD | WS_VISIBLE +FONT 8, "MS Shell Dlg", 0, 0 +BEGIN + GROUPBOX "Pushbuttons",IDC_STATIC,10,5,60,76 + PUSHBUTTON "Pushbutton",IDC_BUTTON1,15,20,49,14 + GROUPBOX "Radio Buttons",IDC_STATIC,84,5,60,76 + CONTROL "Radio1",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | WS_GROUP,89,20,50,10 + CONTROL "Radio2",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,89,39,50,10 + CONTROL "Radio3",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,89,57,50,10 + GROUPBOX "Check Boxes",IDC_STATIC,157,5,60,77 + CONTROL "Check1",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,20,50,10 + CONTROL "Check2",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,39,50,10 + CONTROL "Check3",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,57,50,10 +END + +IDD_COMBOBOXES DIALOGEX 0, 0, 230, 94 +STYLE DS_SETFONT | WS_CHILD | WS_VISIBLE +FONT 8, "MS Shell Dlg", 0, 0 +BEGIN + COMBOBOX IDC_COMBO1,10,15,60,70,CBS_SIMPLE | CBS_SORT | WS_VSCROLL | WS_TABSTOP + GROUPBOX "Simple",IDC_STATIC,5,0,70,90 + COMBOBOX IDC_COMBO2,85,15,60,75,CBS_DROPDOWN | CBS_SORT | CBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP + GROUPBOX "Drop Down",IDC_STATIC,80,0,70,90 + COMBOBOX IDC_COMBO3,160,15,60,75,CBS_DROPDOWNLIST | CBS_SORT | CBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP + GROUPBOX "Drop List",IDC_STATIC,155,0,70,90 +END + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/StdAfx.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/StdAfx.cpp new file mode 100644 index 00000000..8957144d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/StdAfx.cpp @@ -0,0 +1,16 @@ +///////////////////////////// +// StdAfx.cpp +// + +// This file is used for precompiled hearders. Precompiled headers allow +// programs to be recompiled more quickly + +// To use precompiled headers, do the following: +// 1) Add the set of rarely changed headers to stdafx.h +// 2) Include stdafx.h in each cpp file. It must be included first. +// 3) Add stdafx.cpp to your project. +// 4) Turn on precompiled hearders in the project + + +#include "stdafx.h" + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/main.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/main.cpp new file mode 100644 index 00000000..cc7f6ebd --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/main.cpp @@ -0,0 +1,40 @@ +///////////////////////////// +// main.cpp +// + +#include "stdafx.h" +#include "DialogApp.h" + +int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPWSTR, _In_ int) +{ + try + { + // Start Win32++. + CDialogApp theApp; + + // Run the application. + return theApp.Run(); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return -1; +} \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/res/PerMonitorV2.manifest b/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/res/PerMonitorV2.manifest new file mode 100644 index 00000000..d303e5c0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/res/PerMonitorV2.manifest @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + PerMonitorV2, PerMonitor + + + + + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/res/Tab.ico b/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/res/Tab.ico new file mode 100644 index 00000000..79e1c851 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/res/Tab.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/resource.h b/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/resource.h new file mode 100644 index 00000000..24ce7c24 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/resource.h @@ -0,0 +1,38 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Resource.rc +// + +// include the Resource IDs defined by Win32++ +#include "default_resource.h" + + +//Resource IDs for the dialog +#define IDD_DIALOG1 121 +#define IDC_TAB1 122 +#define IDD_BUTTONS 123 +#define IDD_COMBOBOXES 124 +#define IDC_RADIO1 130 +#define IDC_RADIO2 131 +#define IDC_RADIO3 132 +#define IDC_CHECK1 133 +#define IDC_CHECK2 134 +#define IDC_CHECK3 135 +#define IDC_BUTTON1 136 +#define IDC_COMBO1 137 +#define IDC_COMBO2 138 +#define IDC_COMBO3 139 + +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 130 +#endif +#endif diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/stdafx.h b/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/stdafx.h new file mode 100644 index 00000000..08450116 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTab/src/stdafx.h @@ -0,0 +1,90 @@ +///////////////////////////// +// StdAfx.h +// + +// This file is used for precompiled headers. +// Rarely modified header files should be included. +// Based on code provided by Lynn Allan. + + +#ifndef STDAFX_H +#define STDAFX_H + + +// Predefinitions for windows.h go here +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +// Specify Win32xx specific predefinitions here +//#define NO_USING_NAMESPACE // Don't use Win32xx namespace + +// Rarely modified header files should be included here +#include // Add support for std::vector +#include // Add support for std::map +#include // Add support for std::string +#include // Add support for stringstream +#include // Add support for the assert macro +#include // Add support for C style printf, sprintf, etc. +#include // Add support for C style character conversions atoi etc. +#include // Add support for C style TCHARs. + +// Add the Win32++ library +#include // Add CWinApp +#include // Add CArchive +#include // Add CAnimation, CComboBox, CComboBoxEx, CDateTime, CHeader, CHotKey, CIPAddress, CProgressBar, CSpinButton, CScrollBar, CSlider, CToolTip +#include // Add CCriticalSection, CThreadLock +#include // Add CString, CStringA, CStringW +#include // Add CDataExchange +#include // Add CDialog, CResizer +#include // Add CDockFrame, CMDIDockFrame +#include // Add CDocker, CDockContainer +#include // Add CException, CFileException, CNotSupportedException, CResourceException, CUserException, CWinException +#include // Add CFile +#include // Add CFileFind +#include // Add CFolderDialog +#include // Add CFrame +#include // Add CDC, CGDIObject, CBitmap, CBrush, CFont, CPalatte, CPen, CRgn +#include // Add CHGlobal +#include // Add CImageList +#include // Add CListView +#include // Add CMDIChild, CMDIFrame, CDockMDIFrame +#include // Add CMenu +#include // Add CMenuBar +#include // Add CMetaFile, CEnhMetaFile +#include // Add CEvent, CMutex, CSemaphore +#include // Add CPropertyPage, CPropertySheet +#include // Add CRebar +#include // Add CPoint, CRect, CSize +#include // Add CRegKey +#include // Add CRichEdit +#include // Add CScrollView +#include // Adds macros, windows header files, and CObject +#include // Add CSocket +#include // Add CStatusBar +#include // Add CButton, CEdit, CListBox +#include // Add CTab, CTabbedMDI +#include // Add AtoT, AtoW, TtoA, TtoW, WtoA, WtoT etc. +#include // Add MenuTheme, ReBarTheme, StatusBarTheme, ToolBarTheme +#include // Add CWinThread +#include // Add CTime +#include // Add CToolBar +#include // Add CTreeView +#include // Add CWebBrowser, CAXHost +#include // Add CWnd + +// WIN32_LEAN_AND_MEAN can't be used with these +#ifndef WIN32_LEAN_AND_MEAN + #include // Add CCommonDialog, CColorDialog, CFileDialog, CFindReplace, CFontDialog + #include // Add CFolderDialogEx + #include // Add CPrintPreview + #include // Add CPageSetupDialog, CPrintDialog + #include // Add CPrintDialogEx + #include // Add CTaskDialog + + // Visual Studio + #if defined (_MSC_VER) + #include // Add CRibbon, CRibbonFrame + #endif + +#endif // define WIN32_LEAN_AND_MEAN + +#endif // define STDAFX_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate.cbp b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate.cbp new file mode 100644 index 00000000..39c2f059 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate.cbp @@ -0,0 +1,148 @@ + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate.cbproj b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate.cbproj new file mode 100644 index 00000000..31915279 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate.cbproj @@ -0,0 +1,1548 @@ + + + {39461456-1040-43CB-9B40-5962EF847BB0} + 20.1 + None + True + Release + Win64x + 1048579 + Application + DialogTemplate + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + JPHNE + .\Embarcadero\$(Platform)\$(Config) + .\Embarcadero\$(Platform)\$(Config) + false + true + true + $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + CppGuiApplication + System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + true + <_TCHARMapping>wchar_t + DialogTemplate + ..\..\..\include\;..\src\;$(IncludePath) + ..\..\..\include\;..\src\;$(ILINK_LibraryPath) + 3081 + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + $(BDSINCLUDE)\windows\sdk;$(BRCC_IncludePath) + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + ..\src\stdafx.h + none + + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + false + true + false + true + _DEBUG;$(Defines) + false + None + DEBUG + true + true + true + true + Full + true + true + true + true + true + $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) + $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + + + PerMonitorV2 + false + $(BDSLIB)\$(PLATFORM)$(CC_SUFFIX)\debug;$(ILINK_LibraryPath) + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + + + NDEBUG;$(Defines) + None + + + PerMonitorV2 + false + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 71 + + + 72 + + + 0 + + + 1 + + + 2 + + + 3 + + + 4 + + + 5 + + + 6 + + + 7 + + + 8 + + + 9 + + +
Resource.res
+ 10 +
+ + 11 + + + 12 + + + 13 + + + 14 + + + 15 + + + 16 + true + + + 18 + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + +
+ + CPlusPlusBuilder.Personality.12 + CppGuiApplication + + + + False + True + True + False + + + Embarcadero C++Builder Office 2000 Servers Package + Embarcadero C++Builder Office XP Servers Package + + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + Assets\ + Logo150x150.png + true + + + + + Assets\ + Logo44x44.png + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + DialogTemplate.exe + true + + + + + DialogTemplate.exe + true + + + + + NewProject.exe + true + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 64 + + + classes + 64 + + + + + res\xml + 1 + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\mips + 1 + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-v21 + 1 + + + res\values-v21 + 1 + + + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + Contents + 1 + + + Contents + 1 + + + Contents + 1 + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + library\lib\armeabi-v7a + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen + 64 + + + ..\$(PROJECTNAME).launchscreen + 64 + + + + + 1 + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + + + + + + + + + + + + + True + True + True + + + 12 + + + + +
diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2015.sln b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2015.sln new file mode 100644 index 00000000..a1a3a578 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2015.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DialogTemplate", "DialogTemplate_2015.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2015.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2015.vcxproj new file mode 100644 index 00000000..720a3bf8 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2015.vcxproj @@ -0,0 +1,261 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DialogTemplate + DialogTemplate + + + + Application + Unicode + v140_xp + + + Application + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + + + + + + + + + + + + + + + + + true + false + + + true + false + + + false + false + + + false + false + + + + Use + Level4 + true + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2015.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2015.vcxproj.filters new file mode 100644 index 00000000..42f604b8 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2015.vcxproj.filters @@ -0,0 +1,259 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Header Files + + + + + Resource Files + + + Resource Files + + + + + {4b33bf11-a789-44ab-84fc-25e42aeb3566} + + + {2bcb4923-70d9-45dd-9bbe-58deefa2929c} + + + {175079c0-8ffb-4c1e-9784-f7c4f6a99390} + + + {41aad11e-81bd-4a4d-9c27-54b295b6c33d} + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2019.sln b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2019.sln new file mode 100644 index 00000000..c07b7568 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2019.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DialogTemplate", "DialogTemplate_2019.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {CAFDAD48-4D27-4AB5-8DE1-826717DD3777} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2019.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2019.vcxproj new file mode 100644 index 00000000..e8d1d1d6 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2019.vcxproj @@ -0,0 +1,238 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DialogTemplate + DialogTemplate + + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2019.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2019.vcxproj.filters new file mode 100644 index 00000000..c6f23d08 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2019.vcxproj.filters @@ -0,0 +1,245 @@ + + + + + {87c8779f-f84a-4e64-ae21-68dff40d2e27} + + + {347319b8-082d-4d49-ab28-709702a750f7} + + + {a2bed347-0929-43b3-9413-740cd73018cc} + + + {41edd5da-1621-4500-bafc-695726cbde5f} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2022.sln b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2022.sln new file mode 100644 index 00000000..89c3cff5 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2022.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DialogTemplate", "DialogTemplate_2022.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {410357BD-E2A6-4C1A-B499-7EAA15077CE8} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2022.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2022.vcxproj new file mode 100644 index 00000000..55caac3e --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2022.vcxproj @@ -0,0 +1,245 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DialogTemplate + DialogTemplate + 10.0 + + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2022.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2022.vcxproj.filters new file mode 100644 index 00000000..226ea89a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2022.vcxproj.filters @@ -0,0 +1,245 @@ + + + + + {87c8779f-f84a-4e64-ae21-68dff40d2e27} + + + {347319b8-082d-4d49-ab28-709702a750f7} + + + {a2bed347-0929-43b3-9413-740cd73018cc} + + + {41edd5da-1621-4500-bafc-695726cbde5f} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2026.slnx b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2026.slnx new file mode 100644 index 00000000..b897d7c6 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2026.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2026.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2026.vcxproj new file mode 100644 index 00000000..45cc50fa --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2026.vcxproj @@ -0,0 +1,245 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DialogTemplate + DialogTemplate + 10.0 + + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2026.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2026.vcxproj.filters new file mode 100644 index 00000000..a0649236 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_2026.vcxproj.filters @@ -0,0 +1,245 @@ + + + + + {87c8779f-f84a-4e64-ae21-68dff40d2e27} + + + {347319b8-082d-4d49-ab28-709702a750f7} + + + {a2bed347-0929-43b3-9413-740cd73018cc} + + + {41edd5da-1621-4500-bafc-695726cbde5f} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_DEBUG.dev b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_DEBUG.dev new file mode 100644 index 00000000..44249687 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_DEBUG.dev @@ -0,0 +1,242 @@ +[Project] +FileName=DialogTemplate_DEBUG.dev +Name=DialogTemplate +UnitCount=19 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=DialogTemplate_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D _DEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@__@@__@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Debug +ObjectOutput=.\Dev-C++\Debug +OverrideOutput=1 +OverrideOutputName=DialogTemplate.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=4 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[Unit1] +FileName=..\src\FrameApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\FrameApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\Mainfrm.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\Mainfrm.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\Resource.rc +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit8] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit10] +FileName=..\src\DialogsTree.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit11] +FileName=..\src\DialogsTree.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit12] +FileName=..\src\ResourceFinder.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit13] +FileName=..\src\ResourceFinder.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit14] +FileName=..\src\DialogHolder.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit15] +FileName=..\src\DialogHolder.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit16] +FileName=..\src\RichView.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit17] +FileName=..\src\RichView.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit18] +FileName=..\src\UserMessages.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit19] +FileName=..\src\AboutDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_RELEASE.dev b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_RELEASE.dev new file mode 100644 index 00000000..f89f5d1c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/ProjectFiles/DialogTemplate_RELEASE.dev @@ -0,0 +1,242 @@ +[Project] +FileName=DialogTemplate_RELEASE.dev +Name=DialogTemplate +UnitCount=19 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=DialogTemplate_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D NDEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-s_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Release +ObjectOutput=.\Dev-C++\Release +OverrideOutput=1 +OverrideOutputName=DialogTemplate.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=3 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[Unit1] +FileName=..\src\FrameApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\FrameApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\Mainfrm.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\Mainfrm.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\Resource.rc +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit8] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit10] +FileName=..\src\DialogsTree.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit11] +FileName=..\src\DialogsTree.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit12] +FileName=..\src\ResourceFinder.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit13] +FileName=..\src\ResourceFinder.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit14] +FileName=..\src\DialogHolder.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit15] +FileName=..\src\DialogHolder.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit16] +FileName=..\src\RichView.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit17] +FileName=..\src\RichView.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit18] +FileName=..\src\UserMessages.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit19] +FileName=..\src\AboutDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/Readme.txt new file mode 100644 index 00000000..b6760b1f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/Readme.txt @@ -0,0 +1,34 @@ +DialogTemplate Sample +===================== +A dialog box template is the binary data that describes the dialog box. +A dialog template can be used as an alternative to a resource script +to define and create a dialog. The CDialog class can use the dialog +template to create the dialog. + +This program identifies the dialogs within the selected exe or dll file +and displays them in a tree view. When a dialog is selected in the +tree view, the dialog template is written to rich edit view in a form +that can be copied to another program. + +The program will reconstruct the dialog template array from the text +output in the rich edit view. It will then use this array with CDialog +to display the dialog. + +The contents of the rich edit view can be saved to a header file. + +Note that this application will fail to display a dialog if it contains +a custom control. + +Features demonstrated in this example +===================================== +* The use of CDockFrame and CDocker to build a frame which contains a + rich edit view, and a tree view. +* How to enumerate all the resources contained in an exe or dll file, + using EnumResourceTypes, EnumResourceNames and EnumResourceLanguages. +* How to set CDialog's dialog from a dialog template and display it. +* How to print the contents of the rich edit view. +* How to print preview the contents of the rich edit view. +* How to save the contents of the rich edit view to a file. +* How to use OnIdle to dynamically update the toolbar buttons. +* How to use OnMenuUpdate to dynamically update enable state of the menu items. + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/AboutDialog.h b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/AboutDialog.h new file mode 100644 index 00000000..71e4364d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/AboutDialog.h @@ -0,0 +1,31 @@ +///////////////////////////////////////////// +// AboutDialog.h + +#ifndef _ABOUTDIALOG_H_ +#define _ABOUTDIALOG_H_ + +#include "resource.h" + +//////////////////////////////////////////////////////// +// CAboutDialog manages the dialog which displays +// information about this program. +class CAboutDialog : public CDialog +{ +public: + CAboutDialog() : CDialog(IDW_ABOUT) {} + virtual BOOL OnInitDialog() override + { + // Set the Win32++ version string. + UINT ver = _WIN32XX_VER; + CString Win32xxVersion; + Win32xxVersion << "Win32++ Version " << ver / 0x100 << "." << + (ver % 0x100) / 0x10 << "." << (ver % 0x10); + + SetDlgItemText(IDC_STATIC1, Win32xxVersion); + SetDlgItemText(IDC_STATIC2, L"by David Nash"); + + return TRUE; + } +}; + +#endif // _ABOUTDIALOG_H_ diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/DialogHolder.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/DialogHolder.cpp new file mode 100644 index 00000000..c1c9cc98 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/DialogHolder.cpp @@ -0,0 +1,103 @@ +///////////////////////////////////////////////////////////// +// DialogHolder.cpp - Definitions for the CDialogHolder class +// + + +#include "stdafx.h" +#include "DialogHolder.h" + + +void CDialogHolder::PreCreate(CREATESTRUCT& cs) +{ + // Remove the visible style + cs.style &= ~WS_VISIBLE; +} + +// Displays the dialog defined by the specified dialog template array +// in the bottom right corner of the frame. +void CDialogHolder::ShowDialog(CWnd* pFrame, unsigned char* dlgArray) +{ + assert(pFrame); + assert(dlgArray); + + // Destroy the current dialog and dialog holder. + m_dialog.Destroy(); + Destroy(); + + // Create the dialog holder window. + Create(); + SetIconLarge(IDW_MAIN); + SetIconSmall(IDW_MAIN); + SetWindowText(L"Dialog Holder"); + + try + { + // Create the dialog. + m_dialog.SetDialogTemplate((LPCDLGTEMPLATE)dlgArray); + m_dialog.Create(*this); // Creates a modeless dialog + + // Calculate the bottom right position of the frame. + CRect dlgRect = m_dialog.GetWindowRect(); + CRect frameRect = pFrame->GetWindowRect(); + int left = frameRect.left + frameRect.Width() - dlgRect.Width(); + int top = frameRect.top + frameRect.Height() - dlgRect.Height(); + int width = dlgRect.Width(); + int height = dlgRect.Height(); + + // Position the dialog holder and dialog. + DWORD style = m_dialog.GetStyle(); + if (style & WS_CHILD) + { + int captionHeight = GetWindowRect().Height() - GetClientRect().Height(); + height += captionHeight; + top -= captionHeight; + SetWindowPos(HWND_TOPMOST, left, top, width, height, SWP_SHOWWINDOW); + + // Reposition the dialog at top left corner of the dialog holder. + m_dialog.SetWindowPos(HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE); + } + else + { + SetWindowPos(HWND_TOP, left, top, width, height, 0); + m_dialog.SetWindowPos(HWND_TOPMOST, left, top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); + } + } + + catch (const CWinException& e) + { + CString error = "Error reported by GetLastError:\n"; + error << e.GetErrorString(); + MessageBox(error, L"Failed to create dialog", MB_OK); + } +} + +// All window messages for this window pass through WndProc. +LRESULT CDialogHolder::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/DialogHolder.h b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/DialogHolder.h new file mode 100644 index 00000000..0c7d9b7b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/DialogHolder.h @@ -0,0 +1,31 @@ +////////////////////////////////////////////////////// +// DialogsHolderh - Declaration of CDialogHolder class +// + +#ifndef _DIALOG_HOLDER_H_ +#define _DIALOG_HOLDER_H_ + + +///////////////////////////////////////////////////// +// CDialogHolder is the parent window for the dialog. +// Dialogs with the WS_CHILD style can't be created +// without a parent window. +class CDialogHolder : public CWnd +{ +public: + CDialogHolder() = default; + virtual ~CDialogHolder() override = default; + void ShowDialog(CWnd* pFrame, unsigned char* dlg); + +protected: + virtual void PreCreate(CREATESTRUCT& cs) override; + LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CDialogHolder(const CDialogHolder&) = delete; + CDialogHolder& operator=(const CDialogHolder&) = delete; + + CDialog m_dialog; +}; + +#endif // _DIALOG_HOLDER_H_ diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/DialogsTree.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/DialogsTree.cpp new file mode 100644 index 00000000..b16a1e5a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/DialogsTree.cpp @@ -0,0 +1,177 @@ +////////////////////////////////////////////////////// +// DialogsTree.cpp - Definitions for the CDialogsTree, +// and CDockDialogsTree classes +// + + +#include "stdafx.h" +#include "DialogsTree.h" +#include "FrameApp.h" +#include "UserMessages.h" +#include "resource.h" + + +//////////////////////////////////// +// CDialogsTree function definitions +// + +// Destructor. +CDialogsTree::~CDialogsTree() +{ + if (IsWindow()) DeleteAllItems(); +} + +void CDialogsTree::FillTree(const std::vector& allInfo, LPCWSTR fileName) +{ + DeleteAllItems(); + CString rootName; + rootName << fileName << " - Dialogs"; + HTREEITEM rootItem = InsertItem(rootName, 0, 0); + HTREEITEM currentItem = rootItem; + HTREEITEM prevItem = rootItem; + + for (const ResourceInfo& ri : allInfo) + { + CString prevType; + ResourceInfo* prevInfo = (ResourceInfo*)GetItemData(prevItem); + if (prevInfo != 0) + { + prevType = prevInfo->typeName; + } + + CString dialogName("5"); + if (ri.typeName == dialogName) + { + CString itemName; + itemName << ri.resourceName << " " << ri.languageID; + currentItem = InsertItem(itemName, 1, 1, rootItem); + SetItemData(currentItem, (DWORD_PTR)&ri); + } + + prevItem = currentItem; + } + + + // Expand some tree-view items + Expand(rootItem, TVE_EXPAND); +} + +// Called when a window handle (HWND) is attached to CDialogsTree. +void CDialogsTree::OnAttach() +{ + //set the the tree-view's image list + int size = DpiScaleInt(24); + m_normalImages.Create(size, size, ILC_COLOR32, 1, 0); + m_normalImages.AddIcon(IDI_WINDOWS); + m_normalImages.AddIcon(IDW_MAIN); + SetImageList(m_normalImages, TVSIL_NORMAL); + + // Adjust style to show lines and [+] button + DWORD dwStyle = GetStyle(); + dwStyle |= TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT; + SetStyle(dwStyle); +} + +// Called when the WM_NOTIFY message is reflected back to CViewTree +// by the framework. +LRESULT CDialogsTree::OnNotifyReflect(WPARAM, LPARAM lparam) +{ + LPNMTREEVIEW pTreeView = (LPNMTREEVIEW)lparam; + switch (pTreeView->hdr.code) + { + case TVN_SELCHANGED: return OnSelChanged(); + } + + return 0; +} + +// Called when a treeview item is selected. +BOOL CDialogsTree::OnSelChanged() +{ + // Send the message to CMainFrame. + GetAncestor().SendMessage(UWM_ONSELECTTREEITEM, 0, 0); + return TRUE; +} + + +// Set the CREATESTURCT parameters before the window is created. +void CDialogsTree::PreCreate(CREATESTRUCT& cs) +{ + cs.style = TVS_NOTOOLTIPS | WS_CHILD; +} + +// All window messages for this window pass through WndProc. +LRESULT CDialogsTree::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + + +//////////////////////////////////// +// CDockDialogsTree function definitions +// + +// Constructor. +CDockDialogsTree::CDockDialogsTree() +{ + SetView(m_tree); + + // Set the width of the splitter bar + SetBarWidth(8); +} + +// All window messages for this window pass through WndProc. +LRESULT CDockDialogsTree::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/DialogsTree.h b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/DialogsTree.h new file mode 100644 index 00000000..1ffc28d9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/DialogsTree.h @@ -0,0 +1,62 @@ +////////////////////////////////////////////////////////// +// DialogsTree.h - Declaration of CDialogsTree, +// and CDockDialogsTree classes +// + +#ifndef _DIALOGSTREE_H_ +#define _DIALOGSTREE_H_ + +#include "ResourceFinder.h" + + +/////////////////////////////////////////////// +// CDialogsTree manages a tree view control. +// This is the view window for CDockDialogsTree, +// and is used to display a list of dialogs. +class CDialogsTree : public CTreeView +{ +public: + CDialogsTree() = default; + virtual ~CDialogsTree() override; + + void FillTree(const std::vector& allInfo, LPCWSTR fileName); + +protected: + virtual void OnAttach() override; + virtual LRESULT OnNotifyReflect(WPARAM, LPARAM lparam) override; + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CDialogsTree(const CDialogsTree&) = delete; + CDialogsTree& operator=(const CDialogsTree&) = delete; + + // Private member functions + BOOL OnSelChanged(); + + // Private member variables + CImageList m_normalImages; +}; + +///////////////////////////////////////// +// CDockDialogsTree manages a docker. It uses +// CDialogsTree as its view. +class CDockDialogsTree : public CDocker +{ +public: + CDockDialogsTree(); + virtual ~CDockDialogsTree() override = default; + CDialogsTree* GetTree() { return &m_tree; } + +protected: + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CDockDialogsTree(const CDockDialogsTree&) = delete; + CDockDialogsTree& operator=(const CDockDialogsTree&) = delete; + + CDialogsTree m_tree; +}; + + +#endif //_DIALOGSTREE_H_ diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/FrameApp.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/FrameApp.cpp new file mode 100644 index 00000000..198e0d26 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/FrameApp.cpp @@ -0,0 +1,28 @@ +///////////////////////////// +// FrameApp.cpp +// + +#include "stdafx.h" +#include "FrameApp.h" + + +///////////////////////////////// +// CFrameApp function definitions +// + +// Called when the application starts. +BOOL CFrameApp::InitInstance() +{ + // Create the frame window. + m_frame.Create(); // throws a CWinException on failure + + return TRUE; +} + +// Called when the message queue is empty. +BOOL CFrameApp::OnIdle(LONG) +{ + m_frame.UpdateToolbar(); + + return FALSE; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/FrameApp.h b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/FrameApp.h new file mode 100644 index 00000000..20091dcc --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/FrameApp.h @@ -0,0 +1,33 @@ +///////////////////////////// +// FrameApp.h +// + +#ifndef FRAMEAPP_H +#define FRAMEAPP_H + +#include "Mainfrm.h" + + +//////////////////////////////////////////////////////////////// +// CFrameApp manages the application. It initializes the Win32++ +// framework when it is constructed, and creates the main frame +// window when it runs. +class CFrameApp : public CWinApp +{ +public: + CFrameApp() = default; + virtual ~CFrameApp() override = default; + +protected: + virtual BOOL InitInstance() override; + virtual BOOL OnIdle(LONG) override; + +private: + CFrameApp(const CFrameApp&) = delete; + CFrameApp& operator=(const CFrameApp&) = delete; + + CMainFrame m_frame; +}; + + +#endif // define FRAMEAPP_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/Mainfrm.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/Mainfrm.cpp new file mode 100644 index 00000000..75cb6099 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/Mainfrm.cpp @@ -0,0 +1,564 @@ +///////////////////////////// +// Mainfrm.cpp +// + +#include "stdafx.h" +#include "Mainfrm.h" +#include "ResourceFinder.h" +#include "UserMessages.h" +#include "resource.h" + + +////////////////////////////////// +// CMainFrame function definitions +// + +// Constructor. +CMainFrame::CMainFrame() : m_preview(m_richView), m_pDockDialogsTree(nullptr), + m_isTemplateShown(false) +{ +} + +// Create the frame window. +HWND CMainFrame::Create(HWND parent) +{ + // Set m_view as the view window of the frame. + SetView(m_richView); + + // Set the registry key name, and load the initial window position. + // Use a registry key name like "CompanyName\\Application". + LoadRegistrySettings(L"Win32++\\DialogTemplate"); + + return CDockFrame::Create(parent); +} + +// Attempts to create the dialog from the template text +// that is displayed in the rich edit view. +void CMainFrame::DialogFromTemplateText() +{ + // Retrieve the text from the rich edit window. + CString templateText = m_richView.GetWindowText(); + + // Fill arrayText with the hex numbers from templateText. + int start = templateText.FindOneOf(L"{"); + int end = templateText.FindOneOf(L"}"); + if (start > 0 && end > start) + { + CString arrayText = templateText.Mid(start + 1, end - start - 1); + arrayText.Remove(L' '); + arrayText.Remove(L'\n'); + arrayText.Remove(L'\t'); + arrayText.Remove(L'\r'); + + // Fill array vector with values from arrayText. + CString resToken; + int curPos = 0; + std::vector array; + resToken = arrayText.Tokenize(L",", curPos); + while (resToken != L"") + { + long value = strtol(WtoA(resToken), nullptr, 0); + array.push_back(static_cast(value)); + resToken = arrayText.Tokenize(L",", curPos); + }; + + m_holder.ShowDialog(this, array.data()); + } +} + +// Returns the file name extracted from the path name. +inline CString CMainFrame::GetFileName() const +{ + CString fileName = m_pathName; + int pos = fileName.ReverseFind(L'\\'); + if (pos >= 0) + fileName = fileName.Mid(pos + 1); + + return fileName; +} + +// Returns a pointer to the tree view. +CDialogsTree* CMainFrame::GetTree() +{ + assert(m_pDockDialogsTree); + return m_pDockDialogsTree->GetTree(); +} + +// The stream out callback function. Used to writes the text to a file. +DWORD CALLBACK CMainFrame::MyStreamOutCallback(DWORD cookie, LPBYTE pBuffer, LONG cb, LONG* pcb) +{ + // Required for StreamOut + if (!cb) + return 1; + + HANDLE file = reinterpret_cast(static_cast(cookie)); + LPDWORD bytesWritten = reinterpret_cast(pcb); + *bytesWritten = 0; + if (!::WriteFile(file, pBuffer, cb, bytesWritten, nullptr)) + ::MessageBox(nullptr, L"WriteFile Failed", L"", MB_OK); + return 0; +} + +// OnCommand responds to menu and and toolbar input. +BOOL CMainFrame::OnCommand(WPARAM wparam, LPARAM) +{ + UINT id = LOWORD(wparam); + switch(id) + { + case IDM_EDIT_COPY: return OnEditCopy(); + case IDM_FILE_EXIT: return OnFileExit(); + case IDM_FILE_NEW: return OnFileNew(); + case IDM_FILE_OPEN: return OnFileOpen(); + case IDM_FILE_PREVIEW: return OnFilePreview(); + case IDM_FILE_PRINT: return OnFilePrint(); + case IDM_FILE_SAVE: return OnFileSave(); + case IDW_VIEW_STATUSBAR: return OnViewStatusBar(); + case IDW_VIEW_TOOLBAR: return OnViewToolBar(); + case IDM_HELP_ABOUT: return OnHelp(); + } + + return FALSE; +} + +// OnCreate controls the way the frame is created. +// Overriding CFrame::OnCreate is optional. +int CMainFrame::OnCreate(CREATESTRUCT& cs) +{ + // A menu is added if the IDW_MAIN menu resource is defined. + // Frames have all options enabled by default. + // Use the following functions to disable options. + + // UseIndicatorStatus(FALSE); // Don't show keyboard indicators in the StatusBar + // UseMenuStatus(FALSE); // Don't show menu descriptions in the StatusBar + // UseReBar(FALSE); // Don't use a ReBar + // UseStatusBar(FALSE); // Don't use a StatusBar + // UseThemes(FALSE); // Don't use themes + // UseToolBar(FALSE); // Don't use a ToolBar + + // call the base class function + return CDockFrame::OnCreate(cs); +} + +// Called in response to the UWM_DROPFILE user defined message. +LRESULT CMainFrame::OnDropFile(WPARAM wparam) +{ + Reset(); + + // wParam is a pointer (LPCWSTR) to the file name. + LPCWSTR pathName = reinterpret_cast(wparam); + assert(pathName); + m_pathName = pathName; + + // Fill the tree view with a list of dialogs. + m_finder.FindResources(pathName); + GetTree()->FillTree(m_finder.GetAllInfo(), GetFileName()); + + return 0; +} + +// Copy the current selection to the clipboard. +BOOL CMainFrame::OnEditCopy() +{ + m_richView.Copy(); + return TRUE; +} + +// Issue a close request to the frame to end the program. +BOOL CMainFrame::OnFileExit() +{ + Close(); + return TRUE; +} + +BOOL CMainFrame::OnFileNew() +{ + Reset(); + return TRUE; +} + +// Display the help about dialog. +BOOL CMainFrame::OnHelp() +{ + // Ensure only one dialog displayed even for multiple hits of the F1 button. + if (!m_aboutDialog.IsWindow()) + { + m_aboutDialog.DoModal(*this); + } + + return TRUE; +} + +// Called after the window is created. +void CMainFrame::OnInitialUpdate() +{ + // Add the docker for the tree view. + DWORD style = DS_DOCKED_LEFT | DS_CLIENTEDGE | DS_NO_CLOSE | DS_NO_UNDOCK | DS_NO_CAPTION; + const int width = DpiScaleInt(250); + m_pDockDialogsTree = static_cast + (AddDockedChild(std::make_unique(), style, width)); + + Reset(); +} + +// Create the File Open dialog to choose the file to load. +BOOL CMainFrame::OnFileOpen() +{ + m_richView.SetWindowText(nullptr); + + CString filter = "Program Files (*.exe; *.dll)|*.exe; *.dll|All Files (*.*)|*.*|"; + CFileDialog fileDlg(TRUE); // TRUE for file open + fileDlg.SetFilter(filter); + fileDlg.SetDefExt(L".exe"); + + // Bring up the file open dialog retrieve the selected filename. + if (fileDlg.DoModal(*this) == IDOK) + { + m_pathName = fileDlg.GetPathName(); + + // Fill the tree view with a list of dialogs. + m_finder.FindResources(m_pathName); + GetTree()->FillTree(m_finder.GetAllInfo(), GetFileName()); + } + + return TRUE; +} + +// Preview the print job before sending it to a printer. +BOOL CMainFrame::OnFilePreview() +{ + // Verify a print preview is possible + try + { + // Retrieve the device context of the default or currently chosen printer. + CPrintDialog printDlg; + CDC printerDC = printDlg.GetPrinterDC(); + + // Create the preview window if required. + if (!m_preview.IsWindow()) + m_preview.Create(*this); + + // Set the preview's owner (for messages), and number of pages. + UINT maxPage = m_richView.CollatePages(); + m_preview.DoPrintPreview(*this, maxPage); + + // Swap views + SetView(m_preview); + m_preview.SetFocus(); + } + + catch (const CException& e) + { + // An exception occurred. Display the relevant information. + MessageBox(e.GetText(), L"Print Preview Failed", MB_ICONWARNING); + SetView(m_richView); + } + + return TRUE; +} + +// Select the printer and print the document. +BOOL CMainFrame::OnFilePrint() +{ + try + { + m_richView.DoPrint(m_pathName); + } + + catch (const CException& e) + { + // An exception occurred. Display the relevant information. + MessageBox(e.GetText(), L"Print Failed", MB_ICONWARNING); + } + + return TRUE; +} + +// Create the File Save dialog to choose the file to save. +BOOL CMainFrame::OnFileSave() +{ + CString filter = "Program Files (*.h; *.cpp)|*.h; *.cpp|All Files (*.*)|*.*|"; + CFileDialog fileDlg(FALSE); // FALSE for file save + fileDlg.SetFilter(filter); + fileDlg.SetDefExt(L".h"); + + // Bring up the file save dialog retrieve the selected filename + if (fileDlg.DoModal(*this) == IDOK) + { + CString pathName = fileDlg.GetPathName(); + WriteFile(pathName); + } + + return TRUE; +} + +// Called when a menu item is about to be displayed. +void CMainFrame::OnMenuUpdate(UINT id) +{ + // Update the check buttons before displaying the menu. + switch (id) + { + case IDM_EDIT_COPY: + case IDM_FILE_PRINT: + case IDM_FILE_SAVE: + { + // Enable these menu items if the template is shown in the rich edit view. + GetFrameMenu().EnableMenuItem(id, m_isTemplateShown? MF_ENABLED : MF_GRAYED); + } + break; + } + + CDockFrame::OnMenuUpdate(id); +} + +// Called when the Print Preview's "Close" button is pressed. +BOOL CMainFrame::OnPreviewClose() +{ + // Swap the view + SetView(m_richView); + UpdateSettings(); + + return TRUE; +} + +// Called when the Print Preview's "Print Now" button is pressed +BOOL CMainFrame::OnPreviewPrint() +{ + try + { + m_richView.QuickPrint(m_pathName); + } + + catch (const CException& e) + { + // An exception occurred. Display the relevant information. + MessageBox(e.GetText(), L"Print Failed", MB_ICONWARNING); + } + return TRUE; +} + +// Called when the Print Preview's "Print Setup" button is pressed. +BOOL CMainFrame::OnPreviewSetup() +{ + // Call the print setup dialog. + CPrintDialog printDlg(PD_PRINTSETUP); + try + { + // Display the print dialog + if (printDlg.DoModal(*this) == IDOK) + { + CString status = L"Printer: " + printDlg.GetDeviceName(); + SetStatusText(status); + } + + // Initiate the print preview. + UINT maxPage = m_richView.CollatePages(); + m_preview.DoPrintPreview(*this, maxPage); + } + + catch (const CException& e) + { + // An exception occurred. Display the relevant information. + MessageBox(e.GetErrorString(), e.GetText(), MB_ICONWARNING); + } + + return TRUE; +} + +// Called when a selection is made on the tree view. +LRESULT CMainFrame::OnSelectTreeItem() +{ + m_richView.SetWindowText(nullptr); + m_holder.Destroy(); + SetView(m_richView); + m_isTemplateShown = false; + + HTREEITEM item = GetTree()->GetSelection(); + HMODULE module = LoadLibraryEx(m_pathName, nullptr, LOAD_LIBRARY_AS_DATAFILE); + ResourceInfo* info = reinterpret_cast + (GetTree()->GetItemData(item)); + + if (module != 0) + { + if (info != nullptr) + { + // Display the dialog template in the rich edit view. + if (info->resourceID != 0) + ShowTemplateText(module, MAKEINTRESOURCE(info->resourceID)); + else + ShowTemplateText(module, info->resourceName); + } + + ::FreeLibrary(module); + } + + DialogFromTemplateText(); + return 0; +} + +// Called by CFrameApp::OnIdle to update toolbar buttons +void CMainFrame::UpdateToolbar() +{ + GetToolBar().EnableButton(IDM_EDIT_COPY, m_isTemplateShown); + GetToolBar().EnableButton(IDM_FILE_PRINT, m_isTemplateShown); + GetToolBar().EnableButton(IDM_FILE_SAVE, m_isTemplateShown); +} + +// Sets the application back to default. +void CMainFrame::Reset() +{ + m_holder.Destroy(); + GetTree()->DeleteAllItems(); + m_pathName.Empty(); + m_isTemplateShown = false; + SetView(m_richView); + + CString text = "Choose a file to load dialog resources from.\n"; + text << "Use the menu or toolbar to open the file, \n"; + text << "or drag and drop it onto this window."; + m_richView.SetWindowText(text); +} + +// Configure the menu icons. +void CMainFrame::SetupMenuIcons() +{ + // Set the bitmap used for menu icons + std::vector data = GetToolBarData(); + if (GetMenuIconHeight() >= 24) + AddMenuIcons(data, RGB(192, 192, 192), IDW_MAIN, 0); + else + AddMenuIcons(data, RGB(192, 192, 192), IDB_MENUICONS, 0); +} + +// Set the resource IDs and images for the toolbar buttons. +void CMainFrame::SetupToolBar() +{ + AddToolBarButton( IDM_FILE_NEW ); + AddToolBarButton( IDM_FILE_OPEN ); + AddToolBarButton( IDM_FILE_SAVE ); + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_EDIT_COPY); + AddToolBarButton( IDM_FILE_PRINT ); + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_HELP_ABOUT ); +} + +// Displays the dialog template in the rich edit view in a form +// that can be copied to a C++ header file. +void CMainFrame::ShowTemplateText(HMODULE module, LPCWSTR dialogRes) +{ + HRSRC dialog = ::FindResource(module, dialogRes, RT_DIALOG); + + if (dialog != nullptr) + { + HGLOBAL dialogResource = ::LoadResource(module, dialog); + if (dialogResource != nullptr) + { + CString dialogName; + if (IS_INTRESOURCE(dialogRes)) + dialogName = ToCString(reinterpret_cast(dialogRes)); + else + dialogName = dialogRes; + + unsigned char* buf = static_cast(::LockResource(dialogResource)); + if (buf != nullptr) + { + CString output; + output << "// Template array for dialog: " << dialogName << "\n"; + output << "static unsigned char dialog" << "_" << dialogName << "[] = \n{\n\t"; + m_richView.AppendText(output); + + DWORD sz = ::SizeofResource(module, dialog); + for (DWORD i = 0; i < sz; i++) + { + output.Empty(); + output.Format(L"0x%02x", buf[i]); + + // Append a comma except for the last byte, + if (i != sz - 1) + output << ", "; + + // Wrap the text output at 16 bytes. + if ((i != 0) && ((i + 1) % 16 == 0)) + output << "\n\t"; + + m_richView.AppendText(output); + } + m_richView.AppendText(L"\n};\n"); + m_isTemplateShown = true; + } + ::FreeResource(dialogResource); + } + } +} + +// Process the frame's window messages. +LRESULT CMainFrame::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case UWM_DROPFILE: return OnDropFile(wparam); + case UWM_ONSELECTTREEITEM: return OnSelectTreeItem(); + case UWM_PREVIEWCLOSE: OnPreviewClose(); break; + case UWM_PREVIEWPRINT: OnPreviewPrint(); break; + case UWM_PREVIEWSETUP: OnPreviewSetup(); break; + } + + return WndProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + +// Streams from the rich edit control to the specified file. +BOOL CMainFrame::WriteFile(LPCWSTR szFileName) +{ + try + { + // Open the file for writing + CFile file; + file.Open(szFileName, CREATE_ALWAYS); + + EDITSTREAM es; + es.dwCookie = reinterpret_cast(file.GetHandle()); + es.dwError = 0; + es.pfnCallback = reinterpret_cast(MyStreamOutCallback); + m_richView.StreamOut(SF_TEXT, es); + + // Clear the modified text flag + m_richView.SetModify(FALSE); + } + + catch (const CFileException&) + { + CString str = L"Failed to write: "; + str += szFileName; + ::MessageBox(0, str, L"Warning", MB_ICONWARNING); + return FALSE; + } + + return TRUE; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/Mainfrm.h b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/Mainfrm.h new file mode 100644 index 00000000..991195e0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/Mainfrm.h @@ -0,0 +1,80 @@ +///////////////////////////// +// Mainfrm.h +// + +#ifndef MAINFRM_H +#define MAINFRM_H + +#include "RichView.h" +#include "DialogsTree.h" +#include "DialogHolder.h" +#include "AboutDialog.h" + + +/////////////////////////////////////////////////////////// +// CMainFrame manages the application's main window. +// The main window is a frame which has a menubar, toolbar, +// statusbar and view window. +class CMainFrame : public CDockFrame +{ +public: + CMainFrame(); + virtual ~CMainFrame() override = default; + virtual HWND Create(HWND parent = nullptr) override; + + void DialogFromTemplateText(); + CString GetFileName() const; + CDialogsTree* GetTree(); + void UpdateToolbar(); + void ShowTemplateText(HMODULE module, LPCWSTR dialogRes); + +protected: + virtual BOOL OnCommand(WPARAM wparam, LPARAM lparam) override; + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual BOOL OnHelp() override; + virtual void OnInitialUpdate() override; + virtual void OnMenuUpdate(UINT id) override; + virtual void SetupMenuIcons() override; + virtual void SetupToolBar() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CMainFrame(const CMainFrame&) = delete; + CMainFrame& operator=(const CMainFrame&) = delete; + + // Command handlers + BOOL OnEditCopy(); + BOOL OnFileExit(); + BOOL OnFileNew(); + BOOL OnFileOpen(); + BOOL OnFilePrint(); + BOOL OnFilePreview(); + BOOL OnFileSave(); + BOOL OnPreviewClose(); + BOOL OnPreviewPrint(); + BOOL OnPreviewSetup(); + + // Message handlers + LRESULT OnDropFile(WPARAM wparam); + LRESULT OnSelectTreeItem(); + + // Callback procedures + static DWORD CALLBACK MyStreamOutCallback(DWORD cookie, LPBYTE pBuffer, LONG cb, LONG* pcb); + + // Private member functions + void Reset(); + BOOL WriteFile(LPCWSTR szFileName); + + // Private member variables + CAboutDialog m_aboutDialog; + CRichView m_richView; + CPrintPreview m_preview; // CRichView is the source of for CPrintPreview + CString m_pathName; + CDockDialogsTree* m_pDockDialogsTree; + CResourceFinder m_finder; + CDialogHolder m_holder; + bool m_isTemplateShown; +}; + +#endif //MAINFRM_H + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/Resource.rc b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/Resource.rc new file mode 100644 index 00000000..4eba22c2 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/Resource.rc @@ -0,0 +1,218 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "../src/res/PerMonitorV2.manifest" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDW_MAIN MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "New\tCtrl+N", IDM_FILE_NEW + MENUITEM "&Open...\tCtrl+O", IDM_FILE_OPEN + MENUITEM "&Save\tCtrl+S", IDM_FILE_SAVE + MENUITEM SEPARATOR + MENUITEM "Print Preview", IDM_FILE_PREVIEW + MENUITEM "&Print...\tCtrl+P", IDM_FILE_PRINT + MENUITEM SEPARATOR + MENUITEM "E&xit\tAlt+F4", IDM_FILE_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "Copy\tCtrl+C", IDM_EDIT_COPY + END + POPUP "&View" + BEGIN + MENUITEM "&Tool Bar", IDW_VIEW_TOOLBAR, CHECKED + MENUITEM "&Status Bar", IDW_VIEW_STATUSBAR, CHECKED + END + POPUP "&Help" + BEGIN + MENUITEM "&About\tF1", IDM_HELP_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDW_MAIN ICON "../src/res/Magnifier.ico" +IDI_WINDOWS ICON "../src/res/Windows.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDW_MAIN BITMAP "../src/res/Toolbar.bmp" +IDB_MENUICONS BITMAP "../src/res/MenuIcons.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Cursor +// + +IDW_SPLITH CURSOR "../src/res/SplitH.cur" +IDW_SPLITV CURSOR "../src/res/SplitV.cur" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDW_ABOUT DIALOGEX 0, 0, 186, 109 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "MS Shell Dlg", 400, 0 +BEGIN + DEFPUSHBUTTON "OK",IDOK,68,60,50,14 + CTEXT "Dialog Template Application",IDC_STATIC,43,22,99,8 + ICON IDW_MAIN,0,4,4,20,20 + CTEXT "",IDC_STATIC1,53,32,80,8 + CTEXT "",IDC_STATIC2,53,42,80,8 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDW_MAIN ACCELERATORS +BEGIN + "N", IDM_FILE_NEW, VIRTKEY, CONTROL, NOINVERT + "O", IDM_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT + "P", IDM_FILE_PRINT, VIRTKEY, CONTROL, NOINVERT + "S", IDM_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT + "C", IDM_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + "X", IDM_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT + "V", IDM_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT + "Z", IDM_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT + "Y", IDM_EDIT_REDO, VIRTKEY, CONTROL, NOINVERT +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDW_MAIN "Dialog Template Application" + IDW_INDICATOR_CAPS "CAP" + IDW_INDICATOR_NUM "NUM" + IDW_INDICATOR_SCRL "SCRL" + IDW_READY "Ready" + IDW_VIEW_TOOLBAR "Show or hide the tool bar" + IDW_VIEW_STATUSBAR "Show or hide the status bar" +END + +STRINGTABLE +BEGIN + IDW_PREVIEWPRINT "Print" + IDW_PREVIEWSETUP "Print Setup" + IDW_PREVIEWPREV "Prev Page" + IDW_PREVIEWNEXT "Next Page" + IDW_PREVIEWCLOSE "Close" +END + +STRINGTABLE +BEGIN + IDM_FILE_NEW "Create a New Document" + IDM_FILE_OPEN "Open Existing Document" + IDM_FILE_SAVE "Save the Document" + IDM_FILE_SAVEAS "Save the Document with a new name" + IDM_FILE_PREVIEW "Preview the print job before printing" + IDM_FILE_PRINT "Print the Document" + IDM_FILE_EXIT "End the Program" + IDM_EDIT_UNDO "Undo the last action" + IDM_EDIT_REDO "Redo the previously undone action" +END + +STRINGTABLE +BEGIN + IDM_EDIT_CUT "Cut the Selected Contents to the Clipboard" + IDM_EDIT_COPY "Copy the Selected Contents to the Clipboard" + IDM_EDIT_PASTE "Paste the Clipboard Contents to the Document" + IDM_EDIT_DELETE "Erase the selected Contents" + IDM_HELP_ABOUT "Display Information about this program" +END + +STRINGTABLE +BEGIN + SC_CLOSE "Close the Window" + SC_MAXIMIZE "Maximize the Window" + SC_MINIMIZE "Minimize the Window" + SC_MOVE "Move the Window" + SC_NEXTWINDOW "Select Next Window" + SC_PREVWINDOW "Select Previous Window" + SC_RESTORE "Restore the Window" + SC_SIZE "Resize the Window" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/ResourceFinder.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/ResourceFinder.cpp new file mode 100644 index 00000000..7316a549 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/ResourceFinder.cpp @@ -0,0 +1,91 @@ +/////////////////////////////////////// +// ResourceFinder.cpp +// + + +#include "stdafx.h" +#include "ResourceFinder.h" + +/////////////////////////////////////// +// CResourceFinder function definitions +// + +// Finds the resources in the specified executable or DLL file. +void CResourceFinder::FindResources(LPCWSTR fileName) +{ + m_fileName.Empty(); + m_allInfo.clear(); + HMODULE module = LoadLibraryEx(fileName, nullptr, LOAD_LIBRARY_AS_DATAFILE); + if (module != nullptr) + { + // Find all of the loaded file's resources. + EnumResourceTypes(module, reinterpret_cast(EnumTypesProc), + reinterpret_cast(this)); + + FreeLibrary(module); + m_fileName = fileName; + } +} + +// Resource type callback procedure. +BOOL CResourceFinder::EnumTypesProc(HANDLE module, LPWSTR typeName, LONG_PTR lparam) +{ + CResourceFinder* pFinder = reinterpret_cast(lparam); + CString type; + + pFinder->m_info.Empty(); + + // The type may be a string or an number. + if (IS_INTRESOURCE(typeName)) + type << reinterpret_cast(typeName); + else + type << typeName; + + pFinder->m_info.typeName = type; + + // Find the names of all resources. + EnumResourceNames(static_cast(module), typeName, + reinterpret_cast(EnumNamesProc), + lparam); + + return TRUE; +} + +// Resource name callback procedure. +BOOL CResourceFinder::EnumNamesProc(HANDLE module, LPCWSTR typeName, + LPCWSTR resourceName, LONG_PTR lparam) +{ + CResourceFinder* pFinder = reinterpret_cast(lparam); + CString name; + + // The type may be a string or an number. + if (IS_INTRESOURCE(resourceName)) + { + pFinder->m_info.resourceID = reinterpret_cast(resourceName); + name << reinterpret_cast(resourceName); + } + else + name << resourceName; + + pFinder->m_info.resourceName = name; + + // Find the languages of all resources. + EnumResourceLanguages(static_cast(module), typeName, resourceName, + reinterpret_cast(EnumLangsProc), lparam); + + return TRUE; +} + +// Resource language callback procedure. +BOOL CResourceFinder::EnumLangsProc(HANDLE module, LPCWSTR typeName, LPCWSTR resourceName, + WORD languageID, LONG_PTR lparam) +{ + CResourceFinder* pFinder = reinterpret_cast(lparam); + if (0 != FindResourceEx(static_cast(module), typeName, resourceName, languageID)) + { + pFinder->m_info.languageID = languageID; + pFinder->m_allInfo.push_back(pFinder->m_info); + } + + return TRUE; +} \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/ResourceFinder.h b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/ResourceFinder.h new file mode 100644 index 00000000..d6e2b3cb --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/ResourceFinder.h @@ -0,0 +1,51 @@ +//////////////////////////////////////////////////// +// ResourceFinder.h - Declaration of CResourceFinder +// + +#ifndef _RESOURCE_FINDER_H_ +#define _RESOURCE_FINDER_H_ + +struct ResourceInfo +{ + ResourceInfo() : languageID(0), resourceID(0), typeID(0) {} + void Empty() + { + typeName.Empty(); + resourceName.Empty(); + languageID = 0; + resourceID = 0; + typeID = 0; + } + + CString typeName; + CString resourceName; + int languageID; + size_t resourceID; + size_t typeID; +}; + +////////////////////////////////////////////////////////// +// CResourceFinder finds the resources contained within an +// executable or DLL file. +class CResourceFinder +{ +public: + CResourceFinder() = default; + ~CResourceFinder() = default; + + void FindResources(LPCWSTR fileName); + const std::vector& GetAllInfo() const { return m_allInfo; } + +private: + // Callback procedures + static BOOL EnumTypesProc(HANDLE, LPWSTR, LONG_PTR); + static BOOL EnumNamesProc(HANDLE, LPCWSTR, LPCWSTR, LONG_PTR); + static BOOL EnumLangsProc(HANDLE, LPCWSTR, LPCWSTR, WORD, LONG_PTR); + + // private member variables + ResourceInfo m_info; + std::vector m_allInfo; + CString m_fileName; +}; + +#endif // _RESOURCE_FINDER_H_ \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/RichView.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/RichView.cpp new file mode 100644 index 00000000..e0c45092 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/RichView.cpp @@ -0,0 +1,268 @@ +///////////////////////////// +// RichView.cpp +// + +#include "stdafx.h" +#include "RichView.h" +#include "UserMessages.h" + + +///////////////////////////////// +// CRichView function definitions +// + +// Calculates the character position of the page breaks, and returns +// the number of pages. +int CRichView::CollatePages() +{ + m_pageBreaks.clear(); + CPrintDialog printDlg; + CDC printerDC = printDlg.GetPrinterDC(); + + FORMATRANGE fr; + fr.hdcTarget = printerDC; + fr.hdc = printerDC; + fr.rcPage = GetPageRect(); + fr.rc = GetPrintRect(); + fr.chrg.cpMin = 0; + fr.chrg.cpMax = -1; + + // Find out real size of document in characters. + LONG textLength; // Length of document. + textLength = GetTextLengthEx(GTL_NUMCHARS); + + // Calculate the page breaks + LONG lastChar; // The index of the last char which fits on the page. + do + { + lastChar = FormatRange(fr, FALSE); + + if (lastChar < textLength) + { + fr.chrg.cpMin = lastChar; + fr.chrg.cpMax = -1; + m_pageBreaks.push_back(lastChar); // store the page break index in the vector + } + } while (lastChar < textLength); + + // Add the final page break. + m_pageBreaks.push_back(-1); + + // return the number of pages. + return static_cast(m_pageBreaks.size()); +} + +// Choose the printer and print the document. +void CRichView::DoPrint(LPCWSTR docName) +{ + // Prepare the print dialog + CPrintDialog printDlg; + PRINTDLG pd = printDlg.GetParameters(); + pd.nCopies = 1; + pd.nFromPage = 0xFFFF; + pd.nToPage = 0xFFFF; + pd.nMinPage = 1; + pd.nMaxPage = 0xFFFF; + printDlg.SetParameters(pd); + + // Display the print dialog. Can throw if there is no printer. + if (printDlg.DoModal(*this) == IDOK) + QuickPrint(docName); +} + +// Returns a CRect of the entire printable area. Units are measured in twips. +CRect CRichView::GetPageRect() +{ + + CRect rcPage; + + // Get the device context of the default or currently chosen printer + CPrintDialog printDlg; + CDC dcPrinter = printDlg.GetPrinterDC(); + + // Get the printer page specifications + int horizRes = dcPrinter.GetDeviceCaps(HORZRES); // in pixels + int vertRes = dcPrinter.GetDeviceCaps(VERTRES); // in pixels + int logPixelsX = dcPrinter.GetDeviceCaps(LOGPIXELSX); // in pixels per logical inch + int logPixelsY = dcPrinter.GetDeviceCaps(LOGPIXELSY); // in pixels per logical inch + + int tpi = 1440; // twips per inch + + rcPage.right = (horizRes / logPixelsX) * tpi; + rcPage.bottom = (vertRes / logPixelsY) * tpi; + + return rcPage; +} + +// Returns the print area within the page. Units are measured in twips. +CRect CRichView::GetPrintRect() +{ + int margin = 200; + + CRect rcPage = GetPageRect(); + CRect rcPrintArea; + + if (!rcPage.IsRectEmpty()) + { + rcPrintArea.left = rcPage.left + margin; + rcPrintArea.top = rcPage.top + margin; + rcPrintArea.right = rcPage.right - margin; + rcPrintArea.bottom = rcPage.bottom - margin; + } + + return rcPrintArea; +} + +// OnAttach is called when the rich edit window is created. +void CRichView::OnAttach() +{ + CHARFORMAT cf{}; + cf.cbSize = sizeof(cf); + cf.dwMask = CFM_COLOR | CFM_FACE | CFM_EFFECTS; + + // Set the font to Consolas + GetDefaultCharFormat(cf); + cf.dwEffects = 0; + StrCopy(cf.szFaceName, L"Consolas", LF_FACESIZE); + constexpr int twipsPerPoint = 20; + constexpr int fontSize = 10; + cf.yHeight = fontSize * twipsPerPoint; + SetDefaultCharFormat(cf); + + // Support Drag and Drop on this window + DragAcceptFiles(TRUE); +} + +// Called when a file is dropped on the view window. +LRESULT CRichView::OnDropFiles(UINT, WPARAM wparam, LPARAM) +{ + HDROP hDrop = (HDROP)wparam; + UINT length = DragQueryFile(hDrop, 0, 0, 0); + + if (length > 0) + { + CString FileName; + DragQueryFile(hDrop, 0, FileName.GetBuffer(length), length + 1); + FileName.ReleaseBuffer(); + + // Send a user defined message to the frame window + GetAncestor().SendMessage(UWM_DROPFILE, (WPARAM)FileName.c_str(), 0); + } + + DragFinish(hDrop); + return 0; +} + +// Sets the CREATESTRUCT parameters before the window is created. +// Preforming this is optional, but doing so allows us to +// take more precise control over the window we create. +void CRichView::PreCreate(CREATESTRUCT& cs) +{ + cs.style = ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE | WS_CHILD | + WS_HSCROLL | WS_VSCROLL | WS_VISIBLE | ES_READONLY; + + cs.dwExStyle = WS_EX_CLIENTEDGE; +} + +// Prints the specified page to specified dc. +// Called by CPrintPreview, and also used for printing. +void CRichView::PrintPage(CDC& dc, int page) +{ + CPrintDialog printDlg; + CDC printerDC = printDlg.GetPrinterDC(); + + // Assign values to the FORMATRANGE struct + FORMATRANGE fr{}; + fr.hdcTarget = printerDC; + fr.hdc = dc; + fr.rcPage = GetPageRect(); + fr.rc = GetPrintRect(); + fr.chrg.cpMin = (page > 0) ? m_pageBreaks[page - 1] : 0; + fr.chrg.cpMax = m_pageBreaks[page]; + + // Display text from the richedit control on the memory dc + FormatRange(fr, TRUE); + DisplayBand(GetPrintRect()); + + // Tell the control to release the cached information. + FormatRange(); +} + +void CRichView::QuickPrint(LPCWSTR docName) +{ + // Acquire the currently selected printer and page settings + CPrintDialog printDlg; + CDC printerDC = printDlg.GetPrinterDC(); + + // Assign values to the FORMATRANGE struct + FORMATRANGE fr{}; + fr.hdc = printerDC; + fr.hdcTarget = printerDC; + + fr.rcPage = GetPageRect(); + fr.rc = GetPrintRect(); + + // Default the range of text to print as the entire document. + fr.chrg.cpMin = 0; + fr.chrg.cpMax = -1; + + // Start print job. + DOCINFO di{}; + di.cbSize = sizeof(DOCINFO); + di.lpszDocName = docName; + di.lpszOutput = nullptr; // Do not print to file. + printerDC.StartDoc(&di); + + UINT maxPages = CollatePages(); + for (UINT page = 0; page < maxPages; ++page) + { + // Start the page. + printerDC.StartPage(); + + // Print the page. + PrintPage(printerDC, page); + + // End the page/ + printerDC.EndPage(); + } + + // End the print job + printerDC.EndDoc(); +} + +// All window messages for this window pass through WndProc. +LRESULT CRichView::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case WM_DROPFILES: return OnDropFiles(msg, wparam, lparam); + } + + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/RichView.h b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/RichView.h new file mode 100644 index 00000000..8314e310 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/RichView.h @@ -0,0 +1,42 @@ +///////////////////////////// +// View.h +// + +#ifndef VIEW_H +#define VIEW_H + + +/////////////////////////////////////////////////////// +// CRichview manages CMainFrame's Richedit view window. +class CRichView : public CRichEdit +{ +public: + CRichView() = default; + virtual ~CRichView() override = default; + int CollatePages(); + void DoPrint(LPCWSTR docName); + void PrintPage(CDC& dc, int page = 1); + void QuickPrint(LPCWSTR docName); + +protected: + virtual void OnAttach() override; + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CRichView(const CRichView&) = delete; + CRichView& operator=(const CRichView&) = delete; + + // Message handlers + LRESULT OnDropFiles(UINT, WPARAM wparam, LPARAM); + + // Private member functions + CRect GetPageRect(); + CRect GetPrintRect(); + + // Private members variables + std::vector m_pageBreaks; +}; + + +#endif // VIEW_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/StdAfx.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/StdAfx.cpp new file mode 100644 index 00000000..8957144d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/StdAfx.cpp @@ -0,0 +1,16 @@ +///////////////////////////// +// StdAfx.cpp +// + +// This file is used for precompiled hearders. Precompiled headers allow +// programs to be recompiled more quickly + +// To use precompiled headers, do the following: +// 1) Add the set of rarely changed headers to stdafx.h +// 2) Include stdafx.h in each cpp file. It must be included first. +// 3) Add stdafx.cpp to your project. +// 4) Turn on precompiled hearders in the project + + +#include "stdafx.h" + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/UserMessages.h b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/UserMessages.h new file mode 100644 index 00000000..97a5652d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/UserMessages.h @@ -0,0 +1,15 @@ +///////////////////////////// +// UserMessages.h +// + +#ifndef _USER_MESSAGES_H_ +#define _USER_MESSAGES_H_ + + +#define UWM_DROPFILE (WM_APP + 0x0001) + +// Messages called by CTreeList +#define UWM_ONSELECTTREEITEM (WM_APP + 0x0002) + + +#endif // _USER_MESSAGES_H_ diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/main.cpp b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/main.cpp new file mode 100644 index 00000000..2e067d59 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/main.cpp @@ -0,0 +1,40 @@ +///////////////////////////// +// main.cpp +// + +#include "stdafx.h" +#include "FrameApp.h" + +int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPWSTR, _In_ int) +{ + try + { + // Start Win32++. + CFrameApp theApp; + + // Run the application and the message loop. + return theApp.Run(); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return -1; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/res/Magnifier.ico b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/res/Magnifier.ico new file mode 100644 index 00000000..6c355f1b Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/res/Magnifier.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/res/MenuIcons.bmp b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/res/MenuIcons.bmp new file mode 100644 index 00000000..2c2d5b1f Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/res/MenuIcons.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/res/PerMonitorV2.manifest b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/res/PerMonitorV2.manifest new file mode 100644 index 00000000..1831ddb6 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/res/PerMonitorV2.manifest @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + PerMonitorV2, PerMonitor + + + + + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/res/SplitH.cur b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/res/SplitH.cur new file mode 100644 index 00000000..bb03d773 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/res/SplitH.cur differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/res/SplitV.cur b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/res/SplitV.cur new file mode 100644 index 00000000..1fd0d55c Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/res/SplitV.cur differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/res/Toolbar.bmp b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/res/Toolbar.bmp new file mode 100644 index 00000000..f0c734c4 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/res/Toolbar.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/res/Windows.ico b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/res/Windows.ico new file mode 100644 index 00000000..fe6989cc Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/res/Windows.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/resource.h b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/resource.h new file mode 100644 index 00000000..422d1224 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/resource.h @@ -0,0 +1,40 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Resource.rc +// + +// include the Resource IDs defined by Win32++ +#include "default_resource.h" + +#define IDM_FILE_NEW 121 +#define IDM_FILE_OPEN 122 +#define IDM_FILE_SAVE 123 +#define IDM_FILE_SAVEAS 124 +#define IDM_FILE_PREVIEW 125 +#define IDM_FILE_PRINT 126 +#define IDM_FILE_CLOSE 127 +#define IDM_FILE_EXIT 128 +#define IDM_EDIT_UNDO 130 +#define IDM_EDIT_REDO 131 +#define IDM_EDIT_CUT 132 +#define IDM_EDIT_COPY 133 +#define IDM_EDIT_PASTE 134 +#define IDM_EDIT_DELETE 135 +#define IDM_HELP_ABOUT 140 +#define IDB_MENUICONS 150 + +#define IDI_WINDOWS 160 +#define IDC_STATIC1 162 +#define IDC_STATIC2 163 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 130 +#endif +#endif diff --git a/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/stdafx.h b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/stdafx.h new file mode 100644 index 00000000..08450116 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DialogTemplate/src/stdafx.h @@ -0,0 +1,90 @@ +///////////////////////////// +// StdAfx.h +// + +// This file is used for precompiled headers. +// Rarely modified header files should be included. +// Based on code provided by Lynn Allan. + + +#ifndef STDAFX_H +#define STDAFX_H + + +// Predefinitions for windows.h go here +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +// Specify Win32xx specific predefinitions here +//#define NO_USING_NAMESPACE // Don't use Win32xx namespace + +// Rarely modified header files should be included here +#include // Add support for std::vector +#include // Add support for std::map +#include // Add support for std::string +#include // Add support for stringstream +#include // Add support for the assert macro +#include // Add support for C style printf, sprintf, etc. +#include // Add support for C style character conversions atoi etc. +#include // Add support for C style TCHARs. + +// Add the Win32++ library +#include // Add CWinApp +#include // Add CArchive +#include // Add CAnimation, CComboBox, CComboBoxEx, CDateTime, CHeader, CHotKey, CIPAddress, CProgressBar, CSpinButton, CScrollBar, CSlider, CToolTip +#include // Add CCriticalSection, CThreadLock +#include // Add CString, CStringA, CStringW +#include // Add CDataExchange +#include // Add CDialog, CResizer +#include // Add CDockFrame, CMDIDockFrame +#include // Add CDocker, CDockContainer +#include // Add CException, CFileException, CNotSupportedException, CResourceException, CUserException, CWinException +#include // Add CFile +#include // Add CFileFind +#include // Add CFolderDialog +#include // Add CFrame +#include // Add CDC, CGDIObject, CBitmap, CBrush, CFont, CPalatte, CPen, CRgn +#include // Add CHGlobal +#include // Add CImageList +#include // Add CListView +#include // Add CMDIChild, CMDIFrame, CDockMDIFrame +#include // Add CMenu +#include // Add CMenuBar +#include // Add CMetaFile, CEnhMetaFile +#include // Add CEvent, CMutex, CSemaphore +#include // Add CPropertyPage, CPropertySheet +#include // Add CRebar +#include // Add CPoint, CRect, CSize +#include // Add CRegKey +#include // Add CRichEdit +#include // Add CScrollView +#include // Adds macros, windows header files, and CObject +#include // Add CSocket +#include // Add CStatusBar +#include // Add CButton, CEdit, CListBox +#include // Add CTab, CTabbedMDI +#include // Add AtoT, AtoW, TtoA, TtoW, WtoA, WtoT etc. +#include // Add MenuTheme, ReBarTheme, StatusBarTheme, ToolBarTheme +#include // Add CWinThread +#include // Add CTime +#include // Add CToolBar +#include // Add CTreeView +#include // Add CWebBrowser, CAXHost +#include // Add CWnd + +// WIN32_LEAN_AND_MEAN can't be used with these +#ifndef WIN32_LEAN_AND_MEAN + #include // Add CCommonDialog, CColorDialog, CFileDialog, CFindReplace, CFontDialog + #include // Add CFolderDialogEx + #include // Add CPrintPreview + #include // Add CPageSetupDialog, CPrintDialog + #include // Add CPrintDialogEx + #include // Add CTaskDialog + + // Visual Studio + #if defined (_MSC_VER) + #include // Add CRibbon, CRibbonFrame + #endif + +#endif // define WIN32_LEAN_AND_MEAN + +#endif // define STDAFX_H diff --git a/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2015.sln b/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2015.sln new file mode 100644 index 00000000..e298fc89 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2015.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Direct2D", "Direct2D_2015.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2015.vcxproj b/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2015.vcxproj new file mode 100644 index 00000000..cdf19880 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2015.vcxproj @@ -0,0 +1,247 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Direct2D + Direct2D + 8.1 + + + + Application + Unicode + v140 + + + Application + Unicode + v140 + + + Application + true + Unicode + v140 + + + Application + true + Unicode + v140 + + + + + + + + + + + + + + + + + + + true + false + + + true + false + + + false + false + + + false + false + + + + Use + Level4 + true + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d2d1.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d2d1.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d2d1.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d2d1.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2015.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2015.vcxproj.filters new file mode 100644 index 00000000..f5247410 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2015.vcxproj.filters @@ -0,0 +1,215 @@ + + + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + {4b33bf11-a789-44ab-84fc-25e42aeb3566} + + + {2bcb4923-70d9-45dd-9bbe-58deefa2929c} + + + {175079c0-8ffb-4c1e-9784-f7c4f6a99390} + + + {41aad11e-81bd-4a4d-9c27-54b295b6c33d} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2019.sln b/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2019.sln new file mode 100644 index 00000000..f09a46c0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2019.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Direct2D", "Direct2D_2019.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {0B5546D1-8123-476E-9661-44D78F381542} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2019.vcxproj b/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2019.vcxproj new file mode 100644 index 00000000..8accdb9e --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2019.vcxproj @@ -0,0 +1,224 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Direct2D + Direct2D + + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d2d1.lib + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d2d1.lib + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d2d1.lib + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d2d1.lib + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2019.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2019.vcxproj.filters new file mode 100644 index 00000000..b5511b14 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2019.vcxproj.filters @@ -0,0 +1,215 @@ + + + + + {9dfdcac2-5c70-4911-939a-085d377aa41a} + + + {3140c988-0ad2-4415-998f-3661855d9119} + + + {4ca25b61-d095-4831-8cb3-8fac94e9d2d3} + + + {35fca43e-e84c-406a-9235-8b65336a0865} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2022.sln b/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2022.sln new file mode 100644 index 00000000..f5baa762 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2022.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Direct2D", "Direct2D_2022.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {23654F22-6560-40B3-9014-021FBFFF099A} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2022.vcxproj b/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2022.vcxproj new file mode 100644 index 00000000..d2e0e8e6 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2022.vcxproj @@ -0,0 +1,235 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Direct2D + Direct2D + 10.0 + + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d2d1.lib + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d2d1.lib + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d2d1.lib + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d2d1.lib + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2022.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2022.vcxproj.filters new file mode 100644 index 00000000..b5511b14 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2022.vcxproj.filters @@ -0,0 +1,215 @@ + + + + + {9dfdcac2-5c70-4911-939a-085d377aa41a} + + + {3140c988-0ad2-4415-998f-3661855d9119} + + + {4ca25b61-d095-4831-8cb3-8fac94e9d2d3} + + + {35fca43e-e84c-406a-9235-8b65336a0865} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2026.slnx b/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2026.slnx new file mode 100644 index 00000000..d2308de3 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2026.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2026.vcxproj b/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2026.vcxproj new file mode 100644 index 00000000..89b32535 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2026.vcxproj @@ -0,0 +1,235 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Direct2D + Direct2D + 10.0 + + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d2d1.lib + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d2d1.lib + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d2d1.lib + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d2d1.lib + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2026.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2026.vcxproj.filters new file mode 100644 index 00000000..1934db90 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Direct2D/ProjectFiles/Direct2D_2026.vcxproj.filters @@ -0,0 +1,215 @@ + + + + + {9dfdcac2-5c70-4911-939a-085d377aa41a} + + + {3140c988-0ad2-4415-998f-3661855d9119} + + + {4ca25b61-d095-4831-8cb3-8fac94e9d2d3} + + + {35fca43e-e84c-406a-9235-8b65336a0865} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Direct2D/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/Direct2D/Readme.txt new file mode 100644 index 00000000..73c6e60b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Direct2D/Readme.txt @@ -0,0 +1,18 @@ +Direct2D Demo +============= +This sample demonstrates the use of Direct2D in an application. + +About Direct2D +-------------- +Direct2D is a hardware-accelerated, immediate-mode 2-D graphics API that +provides high performance and high-quality rendering for 2-D geometry, bitmaps, +and text. The Direct2D API is designed to interoperate with existing code that +uses GDI, GDI+, or Direct3D. + +Direct2D is implemented in Windows Vista, Windows 7, Windows 8, Windows 10 +and Windows 11. To compile this demo, use a Microsoft compiler with the +Windows 7 SDK. + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/D2DApp.cpp b/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/D2DApp.cpp new file mode 100644 index 00000000..b57bdf92 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/D2DApp.cpp @@ -0,0 +1,54 @@ +///////////////////////////// +// D2DApp.cpp +// + +#include "stdafx.h" +#include "D2DApp.h" + + +/////////////////////////////// +// CD2DApp function definitions +// + +// Constructor. +CD2DApp::CD2DApp() : m_pDirect2dFactory(nullptr) +{ +} + +// Destructor. +CD2DApp::~CD2DApp() +{ + SafeRelease(&m_pDirect2dFactory); + CoUninitialize(); +} + +// Create a Direct2D factory. +HRESULT CD2DApp::CreateDeviceIndependentResources() +{ + return D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &m_pDirect2dFactory); +} + +// Called when the application starts. +BOOL CD2DApp::InitInstance() +{ + HRESULT hr = CoInitialize(nullptr); + if (SUCCEEDED(hr)) + { + // Initialize device-independent resources, such as the Direct2D factory. + hr = CreateDeviceIndependentResources(); + + if (SUCCEEDED(hr)) + { + m_view.Create(); // Throws a CWinException on failure. + m_view.SetWindowText(L"Direct2D Demo"); + return TRUE; + } + else + ::MessageBox(nullptr, L"Failed to start DirectX", L"Error", MB_OK); + } + else + ::MessageBox(nullptr, L"Failed to initialize COM", L"Error", MB_OK); + + return FALSE; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/D2DApp.h b/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/D2DApp.h new file mode 100644 index 00000000..603ebc71 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/D2DApp.h @@ -0,0 +1,45 @@ +///////////////////////////// +// D2DApp.h +// + +#ifndef _D2DAPP_H_ +#define _D2DAPP_H_ + +#include +#include +#include "D2DView.h" + + +/////////////////////////////////////////////////////////////// +// CD2DApp manages the application. It initializes the Win32++ +// framework when it is constructed, and creates the main +// window when it runs. +class CD2DApp : public CWinApp +{ +public: + CD2DApp(); + virtual ~CD2DApp() override; + ID2D1Factory* GetD2DFactory() { return m_pDirect2dFactory; } + +protected: + virtual BOOL InitInstance() override; + +private: + CD2DApp(const CD2DApp&) = delete; + CD2DApp& operator=(const CD2DApp&) = delete; + + HRESULT CreateDeviceIndependentResources(); + + // Member variables + CD2DView m_view; + ID2D1Factory* m_pDirect2dFactory; +}; + +inline ID2D1Factory* GetD2DFactory() +{ + return ((CD2DApp*)GetApp())->GetD2DFactory(); +} + + +#endif // _D2DAPP_H_ + diff --git a/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/D2DView.cpp b/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/D2DView.cpp new file mode 100644 index 00000000..05569ffe --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/D2DView.cpp @@ -0,0 +1,253 @@ +///////////////////////////// +// D2DView.cpp +// + +#include "stdafx.h" +#include "D2DApp.h" +#include "D2DView.h" + +//////////////////////////////// +// CD2DView function definitions +// + +// Constructor +CD2DView::CD2DView() : m_pRenderTarget(nullptr), m_pLightSlateGrayBrush(nullptr), m_pCornflowerBlueBrush(nullptr) +{ +} + +// Destructor + CD2DView::~CD2DView() +{ + DiscardDeviceResources(); +} + +// Create the resources used by OnRender +HRESULT CD2DView::CreateDeviceResources() +{ + HRESULT hr = S_OK; + + if (!m_pRenderTarget) + { + CRect rc = GetClientRect(); + + D2D1_SIZE_U size = D2D1::SizeU( + rc.right - rc.left, + rc.bottom - rc.top + ); + + // Create a Direct2D render target. + hr = GetD2DFactory()->CreateHwndRenderTarget( + D2D1::RenderTargetProperties(), + D2D1::HwndRenderTargetProperties(*this, size), + &m_pRenderTarget + ); + + if (SUCCEEDED(hr)) + { + // Create a gray brush. + hr = m_pRenderTarget->CreateSolidColorBrush( + D2D1::ColorF(D2D1::ColorF::LightSlateGray), + &m_pLightSlateGrayBrush + ); + } + if (SUCCEEDED(hr)) + { + // Create a blue brush. + hr = m_pRenderTarget->CreateSolidColorBrush( + D2D1::ColorF(D2D1::ColorF::CornflowerBlue), + &m_pCornflowerBlueBrush + ); + } + } + + return hr; +} + +// Release memory allocated to resources. +void CD2DView::DiscardDeviceResources() +{ + SafeRelease(&m_pRenderTarget); + SafeRelease(&m_pLightSlateGrayBrush); + SafeRelease(&m_pCornflowerBlueBrush); +} + +// Called when the window is created. +int CD2DView::OnCreate(CREATESTRUCT&) +{ + // Set the window's icon + SetIconSmall(IDW_MAIN); + SetIconLarge(IDW_MAIN); + + return 0; +} + +// Called when the window is destroyed. +void CD2DView::OnDestroy() +{ + // End the application. + PostQuitMessage(0); +} + +// Called when the display resolution has changed. +LRESULT CD2DView::OnDisplayChange(UINT, WPARAM, LPARAM) +{ + + Invalidate(); + return 0; +} + +// Called when the effective dots per inch (dpi) for a window has changed. +// This occurs when: +// - The window is moved to a new monitor that has a different DPI. +// - The DPI of the monitor hosting the window changes. +LRESULT CD2DView::OnDpiChanged(UINT, WPARAM, LPARAM lparam) +{ + LPRECT prc = (LPRECT)lparam; + SetWindowPos(HWND_TOP, *prc, SWP_SHOWWINDOW); + return 0; +} + +// Called when part of the window needs to be redrawn. +LRESULT CD2DView::OnPaint(UINT, WPARAM, LPARAM) +{ + OnRender(); + ValidateRect(); + return 0; +} + +// Perform the drawing. +HRESULT CD2DView::OnRender() +{ + float zoom = static_cast(GetWindowDpi(*this)) / static_cast(GetWindowDpi(HWND_DESKTOP)); + HRESULT hr = CreateDeviceResources(); + if (SUCCEEDED(hr)) + { + m_pRenderTarget->BeginDraw(); + m_pRenderTarget->Clear(D2D1::ColorF(D2D1::ColorF::White)); + + D2D1_SIZE_F rtSize = m_pRenderTarget->GetSize(); + float width = rtSize.width; + float height = rtSize.height; + + // Draw horizontal lines + for (float x = 0.0f; x < width; x += 16.0f * zoom) + { + m_pRenderTarget->DrawLine( + D2D1::Point2F(x, 0.0f), + D2D1::Point2F(x, height), + m_pLightSlateGrayBrush, + zoom + ); + } + + // Draw vertical lines + for (float y = 0.0f; y < height; y += 16.0f * zoom) + { + m_pRenderTarget->DrawLine( + D2D1::Point2F(0.0f, y), + D2D1::Point2F(width, y), + m_pLightSlateGrayBrush, + zoom + ); + } + + // Draw two rectangles. + D2D1_RECT_F rectangle1 = D2D1::RectF( + rtSize.width / (2.0f) - 40.0f * zoom, + rtSize.height / (2.0f) - 40.0f * zoom, + rtSize.width / (2.0f) + 40.0f * zoom, + rtSize.height / (2.0f) + 40.0f * zoom + ); + + D2D1_RECT_F rectangle2 = D2D1::RectF( + rtSize.width / (2.0f) - 80.0f * zoom, + rtSize.height / (2.0f) - 80.0f * zoom, + rtSize.width / (2.0f) + 80.0f * zoom, + rtSize.height / (2.0f) + 80.0f * zoom + ); + + // Draw a filled rectangle. + m_pRenderTarget->FillRectangle(&rectangle1, m_pLightSlateGrayBrush); + + // Draw the outline of a rectangle. + m_pRenderTarget->DrawRectangle(&rectangle2, m_pCornflowerBlueBrush, 4 * zoom); + hr = m_pRenderTarget->EndDraw(); + } + + if (hr == D2DERR_RECREATE_TARGET) + { + hr = S_OK; + DiscardDeviceResources(); + } + + return hr; +} + +// Resize the render target when the window is resized. +void CD2DView::OnResize(UINT width, UINT height) +{ + if (m_pRenderTarget) + { + // Note: This method can fail, but it's okay to ignore the + // error here, because the error will be returned again + // the next time EndDraw is called. + m_pRenderTarget->Resize(D2D1::SizeU(width, height)); + } +} + +// Called when the window is resized. +LRESULT CD2DView::OnSize(UINT, WPARAM, LPARAM lparam) +{ + UINT width = LOWORD(lparam); + UINT height = HIWORD(lparam); + OnResize(width, height); + return 0; +} + +// Specify the initial window size. +void CD2DView::PreCreate(CREATESTRUCT&cs) +{ + // Scale the window to the DPI of the primary monitor + cs.x = DpiScaleInt(80); // top x + cs.y = DpiScaleInt(80); // top y + cs.cx = DpiScaleInt(640); // width + cs.cy = DpiScaleInt(480); // height +} + +// Set the WNDCLASS parameters before the window is created. +void CD2DView::PreRegisterClass(WNDCLASS& wc) +{ + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.hCursor = ::LoadCursor(nullptr, IDI_APPLICATION); + wc.lpszClassName = L"Direct2D"; +} + +// Process the window messages. +LRESULT CD2DView::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case WM_DISPLAYCHANGE: return OnDisplayChange(msg, wparam, lparam); + case WM_DPICHANGED: return OnDpiChanged(msg, wparam, lparam); + case WM_SIZE: return OnSize(msg, wparam, lparam); + } + + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + TaskDialogBox(nullptr, str1, str2, TD_ERROR_ICON); + } + + return 0; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/D2DView.h b/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/D2DView.h new file mode 100644 index 00000000..990864d1 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/D2DView.h @@ -0,0 +1,61 @@ +///////////////////////////// +// D2DView.h +// + +#ifndef _D2DVIEW_H_ +#define _D2DVIEW_H_ + + +#include +#include + + +template +inline void SafeRelease( Interface **ppInterfaceToRelease ) +{ + if (*ppInterfaceToRelease != nullptr) + { + (*ppInterfaceToRelease)->Release(); + (*ppInterfaceToRelease) = nullptr; + } +} + + +/////////////////////////////////////////////// +// CD2DView manages the window that renders the +// Direct2D images. +class CD2DView : public CWnd +{ +public: + CD2DView(); + virtual ~CD2DView() override; + +protected: + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual void OnDestroy() override; + virtual LRESULT OnDpiChanged(UINT, WPARAM, LPARAM); + virtual LRESULT OnPaint(UINT, WPARAM, LPARAM) override; + virtual void PreCreate(CREATESTRUCT&cs) override; + virtual void PreRegisterClass(WNDCLASS& wc) override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CD2DView(const CD2DView&) = delete; + CD2DView& operator=(const CD2DView&) = delete; + + // Message handlers + LRESULT OnDisplayChange(UINT, WPARAM, LPARAM); + LRESULT OnSize(UINT, WPARAM wparam, LPARAM lparm); + + HRESULT CreateDeviceResources(); + void DiscardDeviceResources(); + HRESULT OnRender(); + void OnResize(UINT width, UINT height); + + // Member variables + ID2D1HwndRenderTarget* m_pRenderTarget; + ID2D1SolidColorBrush* m_pLightSlateGrayBrush; + ID2D1SolidColorBrush* m_pCornflowerBlueBrush; +}; + +#endif // _D2DVIEW_H_ diff --git a/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/Resource.rc b/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/Resource.rc new file mode 100644 index 00000000..6a59fe43 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/Resource.rc @@ -0,0 +1,79 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "../src/res/PerMonitorV2.manifest" + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDW_MAIN ICON "../src/res/directx.ico" + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDW_MAIN "Direct2D Application" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// diff --git a/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/StdAfx.cpp b/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/StdAfx.cpp new file mode 100644 index 00000000..8957144d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/StdAfx.cpp @@ -0,0 +1,16 @@ +///////////////////////////// +// StdAfx.cpp +// + +// This file is used for precompiled hearders. Precompiled headers allow +// programs to be recompiled more quickly + +// To use precompiled headers, do the following: +// 1) Add the set of rarely changed headers to stdafx.h +// 2) Include stdafx.h in each cpp file. It must be included first. +// 3) Add stdafx.cpp to your project. +// 4) Turn on precompiled hearders in the project + + +#include "stdafx.h" + diff --git a/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/main.cpp b/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/main.cpp new file mode 100644 index 00000000..da89df7a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/main.cpp @@ -0,0 +1,14 @@ +///////////////////////////// +// main.cpp +// + +#include "stdafx.h" +#include "D2DApp.h" + +int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPWSTR, _In_ int) +{ + CD2DApp app; + app.Run(); + + return 0; +} \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/res/PerMonitorV2.manifest b/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/res/PerMonitorV2.manifest new file mode 100644 index 00000000..d303e5c0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/res/PerMonitorV2.manifest @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + PerMonitorV2, PerMonitor + + + + + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/res/directx.ico b/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/res/directx.ico new file mode 100644 index 00000000..edbb285e Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/res/directx.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/resource.h b/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/resource.h new file mode 100644 index 00000000..bd31872d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/resource.h @@ -0,0 +1,22 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Resource.rc +// + + +// include the Resource IDs defined by Win32++ +#include "default_resource.h" + + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 130 +#endif +#endif + diff --git a/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/stdafx.h b/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/stdafx.h new file mode 100644 index 00000000..08450116 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Direct2D/src/stdafx.h @@ -0,0 +1,90 @@ +///////////////////////////// +// StdAfx.h +// + +// This file is used for precompiled headers. +// Rarely modified header files should be included. +// Based on code provided by Lynn Allan. + + +#ifndef STDAFX_H +#define STDAFX_H + + +// Predefinitions for windows.h go here +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +// Specify Win32xx specific predefinitions here +//#define NO_USING_NAMESPACE // Don't use Win32xx namespace + +// Rarely modified header files should be included here +#include // Add support for std::vector +#include // Add support for std::map +#include // Add support for std::string +#include // Add support for stringstream +#include // Add support for the assert macro +#include // Add support for C style printf, sprintf, etc. +#include // Add support for C style character conversions atoi etc. +#include // Add support for C style TCHARs. + +// Add the Win32++ library +#include // Add CWinApp +#include // Add CArchive +#include // Add CAnimation, CComboBox, CComboBoxEx, CDateTime, CHeader, CHotKey, CIPAddress, CProgressBar, CSpinButton, CScrollBar, CSlider, CToolTip +#include // Add CCriticalSection, CThreadLock +#include // Add CString, CStringA, CStringW +#include // Add CDataExchange +#include // Add CDialog, CResizer +#include // Add CDockFrame, CMDIDockFrame +#include // Add CDocker, CDockContainer +#include // Add CException, CFileException, CNotSupportedException, CResourceException, CUserException, CWinException +#include // Add CFile +#include // Add CFileFind +#include // Add CFolderDialog +#include // Add CFrame +#include // Add CDC, CGDIObject, CBitmap, CBrush, CFont, CPalatte, CPen, CRgn +#include // Add CHGlobal +#include // Add CImageList +#include // Add CListView +#include // Add CMDIChild, CMDIFrame, CDockMDIFrame +#include // Add CMenu +#include // Add CMenuBar +#include // Add CMetaFile, CEnhMetaFile +#include // Add CEvent, CMutex, CSemaphore +#include // Add CPropertyPage, CPropertySheet +#include // Add CRebar +#include // Add CPoint, CRect, CSize +#include // Add CRegKey +#include // Add CRichEdit +#include // Add CScrollView +#include // Adds macros, windows header files, and CObject +#include // Add CSocket +#include // Add CStatusBar +#include // Add CButton, CEdit, CListBox +#include // Add CTab, CTabbedMDI +#include // Add AtoT, AtoW, TtoA, TtoW, WtoA, WtoT etc. +#include // Add MenuTheme, ReBarTheme, StatusBarTheme, ToolBarTheme +#include // Add CWinThread +#include // Add CTime +#include // Add CToolBar +#include // Add CTreeView +#include // Add CWebBrowser, CAXHost +#include // Add CWnd + +// WIN32_LEAN_AND_MEAN can't be used with these +#ifndef WIN32_LEAN_AND_MEAN + #include // Add CCommonDialog, CColorDialog, CFileDialog, CFindReplace, CFontDialog + #include // Add CFolderDialogEx + #include // Add CPrintPreview + #include // Add CPageSetupDialog, CPrintDialog + #include // Add CPrintDialogEx + #include // Add CTaskDialog + + // Visual Studio + #if defined (_MSC_VER) + #include // Add CRibbon, CRibbonFrame + #endif + +#endif // define WIN32_LEAN_AND_MEAN + +#endif // define STDAFX_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11.fx b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11.fx new file mode 100644 index 00000000..fa6b97a6 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11.fx @@ -0,0 +1,44 @@ +//-------------------------------------------------------------------------------------- +// File: DirectX11.fx +// +// Copyright (c) Microsoft Corporation. All rights reserved. +//-------------------------------------------------------------------------------------- + +//-------------------------------------------------------------------------------------- +// Constant Buffer Variables +//-------------------------------------------------------------------------------------- +cbuffer ConstantBuffer : register( b0 ) +{ + matrix World; + matrix View; + matrix Projection; +} + +//-------------------------------------------------------------------------------------- +struct VS_OUTPUT +{ + float4 Pos : SV_POSITION; + float4 Color : COLOR0; +}; + +//-------------------------------------------------------------------------------------- +// Vertex Shader +//-------------------------------------------------------------------------------------- +VS_OUTPUT VS( float4 Pos : POSITION, float4 Color : COLOR ) +{ + VS_OUTPUT output = (VS_OUTPUT)0; + output.Pos = mul( Pos, World ); + output.Pos = mul( output.Pos, View ); + output.Pos = mul( output.Pos, Projection ); + output.Color = Color; + return output; +} + + +//-------------------------------------------------------------------------------------- +// Pixel Shader +//-------------------------------------------------------------------------------------- +float4 PS( VS_OUTPUT input ) : SV_Target +{ + return input.Color; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2015.sln b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2015.sln new file mode 100644 index 00000000..652ac8bd --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2015.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectX11", "DirectX11_2015.vcxproj", "{B8FF81B5-9B26-4931-8353-07795FDC4043}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Profile|x64 = Profile|x64 + Profile|x86 = Profile|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Debug|x64.ActiveCfg = Debug|x64 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Debug|x64.Build.0 = Debug|x64 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Debug|x86.ActiveCfg = Debug|Win32 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Debug|x86.Build.0 = Debug|Win32 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Profile|x64.ActiveCfg = Profile|x64 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Profile|x64.Build.0 = Profile|x64 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Profile|x86.ActiveCfg = Profile|Win32 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Profile|x86.Build.0 = Profile|Win32 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Release|x64.ActiveCfg = Release|x64 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Release|x64.Build.0 = Release|x64 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Release|x86.ActiveCfg = Release|Win32 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2015.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2015.vcxproj new file mode 100644 index 00000000..75b11e4c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2015.vcxproj @@ -0,0 +1,435 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Profile + Win32 + + + Profile + x64 + + + Release + Win32 + + + Release + x64 + + + + DirectX11 + {B8FF81B5-9B26-4931-8353-07795FDC4043} + Tutorial04 + Win32Proj + 8.1 + + + + Unicode + v140 + + + Application + Unicode + v140 + + + Unicode + v140 + + + Application + true + Unicode + v140 + + + Unicode + v140 + + + Application + true + Unicode + v140 + + + + + + + + + + + + + + + + + + + + + + + + true + false + + + true + true + false + + + true + false + + + false + true + false + + + true + false + + + false + true + false + + + + Level4 + MultiThreadedDebugDLL + %(AdditionalOptions) + WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + ..\..\..\include + + + %(AdditionalOptions) + d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies) + Windows + true + true + true + true + MachineX86 + AsInvoker + + + + + + + + + + + + + + Level4 + Disabled + MultiThreadedDebugDLL + false + true + Fast + Sync + %(AdditionalOptions) + WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + EnableFastChecks + ..\..\..\include + + + %(AdditionalOptions) + d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies) + Windows + true + true + true + true + MachineX64 + AsInvoker + %(DelayLoadDLLs) + + + + + + + + + + + + + + Level4 + MultiThreadedDLL + true + %(AdditionalOptions) + WIN32;NDEBUG;_WINDOWS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + ..\..\..\include + + + %(AdditionalOptions) + d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies) + true + Windows + true + true + true + MachineX86 + AsInvoker + + + + + + + + + + + + + + Level4 + MaxSpeed + MultiThreadedDLL + false + true + true + Fast + Sync + %(AdditionalOptions) + WIN32;NDEBUG;_WINDOWS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + ..\..\..\include + + + %(AdditionalOptions) + d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies) + true + Windows + true + true + true + true + true + MachineX64 + AsInvoker + %(DelayLoadDLLs) + + + + + + + + + + + + + + Level4 + MultiThreadedDLL + true + %(AdditionalOptions) + WIN32;NDEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + ..\..\..\include + + + %(AdditionalOptions) + d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies) + true + Windows + true + true + true + MachineX86 + AsInvoker + + + + + + + + + + + + + + Level4 + MaxSpeed + MultiThreadedDLL + false + true + true + Fast + Sync + %(AdditionalOptions) + WIN32;NDEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + ..\..\..\include + + + %(AdditionalOptions) + d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies) + true + Windows + true + true + true + true + true + MachineX64 + AsInvoker + %(DelayLoadDLLs) + + + + + + + + + + + + + + true + true + true + true + true + true + + + PS + Pixel + 4.0 + PS + Pixel + 4.0 + PS + Pixel + 4.0 + PS + Pixel + 4.0 + PS + Pixel + 4.0 + PS + Pixel + 4.0 + + + VS + Vertex + 4.0 + VS + Vertex + 4.0 + VS + Vertex + 4.0 + VS + Vertex + 4.0 + VS + Vertex + 4.0 + VS + Vertex + 4.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2015.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2015.vcxproj.filters new file mode 100644 index 00000000..54e3924d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2015.vcxproj.filters @@ -0,0 +1,228 @@ + + + + + {8e114980-c1a3-4ada-ad7c-83caadf5daeb} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe + + + {2c3d4c8c-5d1a-459a-a05a-a4e4b608a44e} + fx;fxh;hlsl + + + {72d04a34-8e0e-424e-8590-4a08a561f150} + + + {2f3439ae-44f2-42bf-a98d-2207c18421cc} + + + {a6a4ca71-ea07-4c1b-b4a4-c97e9c6083e0} + + + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Shaders + + + Shaders + + + Shaders + + + + + Source Files + + + Source Files + + + Source Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2019.sln b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2019.sln new file mode 100644 index 00000000..414df613 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2019.sln @@ -0,0 +1,37 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectX11", "DirectX11_2019.vcxproj", "{B8FF81B5-9B26-4931-8353-07795FDC4043}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Profile|x64 = Profile|x64 + Profile|x86 = Profile|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Debug|x64.ActiveCfg = Debug|x64 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Debug|x64.Build.0 = Debug|x64 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Debug|x86.ActiveCfg = Debug|Win32 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Debug|x86.Build.0 = Debug|Win32 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Profile|x64.ActiveCfg = Profile|x64 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Profile|x64.Build.0 = Profile|x64 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Profile|x86.ActiveCfg = Profile|Win32 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Profile|x86.Build.0 = Profile|Win32 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Release|x64.ActiveCfg = Release|x64 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Release|x64.Build.0 = Release|x64 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Release|x86.ActiveCfg = Release|Win32 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {AA8A4B02-95F9-46D5-8849-7CBC61023CDE} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2019.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2019.vcxproj new file mode 100644 index 00000000..ce3d0a38 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2019.vcxproj @@ -0,0 +1,429 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Profile + Win32 + + + Profile + x64 + + + Release + Win32 + + + Release + x64 + + + + DirectX11 + {B8FF81B5-9B26-4931-8353-07795FDC4043} + DirectX11 + Win32Proj + + + + Unicode + v142 + + + Application + Unicode + v142 + + + Unicode + v142 + + + Application + true + Unicode + v142 + + + Unicode + v142 + + + Application + true + Unicode + v142 + + + + + + + + + + + + + + + + + + + + + + + + false + + + true + true + false + + + false + + + false + true + false + + + false + + + false + true + false + + + + Level4 + MultiThreadedDebugDLL + false + %(AdditionalOptions) + WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + ..\..\..\include + + + %(AdditionalOptions) + d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies) + Windows + true + true + true + true + MachineX86 + + + + + + + + + + + + + + Level4 + Disabled + MultiThreadedDebugDLL + false + true + Fast + Sync + %(AdditionalOptions) + WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + EnableFastChecks + ..\..\..\include + + + %(AdditionalOptions) + d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies) + Windows + true + true + true + true + MachineX64 + AsInvoker + %(DelayLoadDLLs) + + + + + + + + + + + + + + Level4 + MultiThreadedDLL + false + %(AdditionalOptions) + WIN32;NDEBUG;_WINDOWS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + ..\..\..\include + + + %(AdditionalOptions) + d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies) + true + Windows + true + true + true + MachineX86 + + + + + + + + + + + + + + Level4 + MaxSpeed + MultiThreadedDLL + false + true + true + Fast + Sync + %(AdditionalOptions) + WIN32;NDEBUG;_WINDOWS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + ..\..\..\include + + + %(AdditionalOptions) + d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies) + true + Windows + true + true + true + true + true + MachineX64 + AsInvoker + %(DelayLoadDLLs) + + + + + + + + + + + + + + Level4 + MultiThreadedDLL + false + %(AdditionalOptions) + WIN32;NDEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + ..\..\..\include + + + %(AdditionalOptions) + d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies) + true + Windows + true + true + true + MachineX86 + + + + + + + + + + + + + + Level4 + MaxSpeed + MultiThreadedDLL + false + true + true + Fast + Sync + %(AdditionalOptions) + WIN32;NDEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + ..\..\..\include + + + %(AdditionalOptions) + d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies) + true + Windows + true + true + true + true + true + MachineX64 + AsInvoker + %(DelayLoadDLLs) + + + + + + + + + + + + + + true + true + true + true + true + true + + + PS + Pixel + 4.0 + PS + Pixel + 4.0 + PS + Pixel + 4.0 + PS + Pixel + 4.0 + PS + Pixel + 4.0 + PS + Pixel + 4.0 + + + VS + Vertex + 4.0 + VS + Vertex + 4.0 + VS + Vertex + 4.0 + VS + Vertex + 4.0 + VS + Vertex + 4.0 + VS + Vertex + 4.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2019.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2019.vcxproj.filters new file mode 100644 index 00000000..54e3924d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2019.vcxproj.filters @@ -0,0 +1,228 @@ + + + + + {8e114980-c1a3-4ada-ad7c-83caadf5daeb} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe + + + {2c3d4c8c-5d1a-459a-a05a-a4e4b608a44e} + fx;fxh;hlsl + + + {72d04a34-8e0e-424e-8590-4a08a561f150} + + + {2f3439ae-44f2-42bf-a98d-2207c18421cc} + + + {a6a4ca71-ea07-4c1b-b4a4-c97e9c6083e0} + + + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Shaders + + + Shaders + + + Shaders + + + + + Source Files + + + Source Files + + + Source Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2022.sln b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2022.sln new file mode 100644 index 00000000..c516d094 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2022.sln @@ -0,0 +1,37 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectX11", "DirectX11_2022.vcxproj", "{B8FF81B5-9B26-4931-8353-07795FDC4043}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Profile|x64 = Profile|x64 + Profile|x86 = Profile|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Debug|x64.ActiveCfg = Debug|x64 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Debug|x64.Build.0 = Debug|x64 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Debug|x86.ActiveCfg = Debug|Win32 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Debug|x86.Build.0 = Debug|Win32 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Profile|x64.ActiveCfg = Profile|x64 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Profile|x64.Build.0 = Profile|x64 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Profile|x86.ActiveCfg = Profile|Win32 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Profile|x86.Build.0 = Profile|Win32 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Release|x64.ActiveCfg = Release|x64 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Release|x64.Build.0 = Release|x64 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Release|x86.ActiveCfg = Release|Win32 + {B8FF81B5-9B26-4931-8353-07795FDC4043}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D0D4E45F-653E-4E01-BE0B-29485F133B6D} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2022.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2022.vcxproj new file mode 100644 index 00000000..f779dae1 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2022.vcxproj @@ -0,0 +1,438 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Profile + Win32 + + + Profile + x64 + + + Release + Win32 + + + Release + x64 + + + + DirectX11 + {B8FF81B5-9B26-4931-8353-07795FDC4043} + DirectX11 + Win32Proj + 10.0 + + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + true + Unicode + v143 + + + Unicode + v143 + + + true + Unicode + v143 + + + + + + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + true + true + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + true + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + true + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Level4 + MultiThreadedDebugDLL + %(AdditionalOptions) + WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + %(AdditionalOptions) + d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies) + Windows + true + true + true + true + MachineX86 + + + true + + + + + + + + + + + + + Level4 + MultiThreadedDebugDLL + %(AdditionalOptions) + WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + %(AdditionalOptions) + d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies) + Windows + true + true + true + true + MachineX64 + AsInvoker + %(DelayLoadDLLs) + + + true + + + + + + + + + + + + + + + + Level4 + MultiThreadedDLL + %(AdditionalOptions) + WIN32;NDEBUG;_WINDOWS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + %(AdditionalOptions) + d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies) + true + Windows + true + true + true + MachineX86 + + + true + + + + + + + + + + + + + Level4 + MultiThreadedDLL + %(AdditionalOptions) + WIN32;NDEBUG;_WINDOWS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + %(AdditionalOptions) + d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies) + true + Windows + true + true + true + true + true + MachineX64 + AsInvoker + %(DelayLoadDLLs) + + + true + + + + + + + + + + + + + Level4 + MultiThreadedDLL + %(AdditionalOptions) + WIN32;NDEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + %(AdditionalOptions) + d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies) + true + Windows + true + true + true + MachineX86 + + + true + + + + + + + + + + + + + Level4 + MultiThreadedDLL + %(AdditionalOptions) + WIN32;NDEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + %(AdditionalOptions) + d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies) + true + Windows + true + true + true + true + true + MachineX64 + AsInvoker + %(DelayLoadDLLs) + + + true + + + + + + + + + + + + + true + true + true + true + true + true + + + PS + Pixel + 4.0 + PS + Pixel + 4.0 + PS + Pixel + 4.0 + PS + Pixel + 4.0 + PS + Pixel + 4.0 + PS + Pixel + 4.0 + + + VS + Vertex + 4.0 + VS + Vertex + 4.0 + VS + Vertex + 4.0 + VS + Vertex + 4.0 + VS + Vertex + 4.0 + VS + Vertex + 4.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2022.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2022.vcxproj.filters new file mode 100644 index 00000000..54e3924d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2022.vcxproj.filters @@ -0,0 +1,228 @@ + + + + + {8e114980-c1a3-4ada-ad7c-83caadf5daeb} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe + + + {2c3d4c8c-5d1a-459a-a05a-a4e4b608a44e} + fx;fxh;hlsl + + + {72d04a34-8e0e-424e-8590-4a08a561f150} + + + {2f3439ae-44f2-42bf-a98d-2207c18421cc} + + + {a6a4ca71-ea07-4c1b-b4a4-c97e9c6083e0} + + + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Shaders + + + Shaders + + + Shaders + + + + + Source Files + + + Source Files + + + Source Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2026.slnx b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2026.slnx new file mode 100644 index 00000000..84ccd349 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2026.slnx @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2026.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2026.vcxproj new file mode 100644 index 00000000..1886c897 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2026.vcxproj @@ -0,0 +1,438 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Profile + Win32 + + + Profile + x64 + + + Release + Win32 + + + Release + x64 + + + + DirectX11 + {B8FF81B5-9B26-4931-8353-07795FDC4043} + DirectX11 + Win32Proj + 10.0 + + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + true + Unicode + v145 + + + Unicode + v145 + + + true + Unicode + v145 + + + + + + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + true + true + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + true + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + true + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Level4 + MultiThreadedDebugDLL + %(AdditionalOptions) + WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + %(AdditionalOptions) + d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies) + Windows + true + true + true + true + MachineX86 + + + true + + + + + + + + + + + + + Level4 + MultiThreadedDebugDLL + %(AdditionalOptions) + WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + %(AdditionalOptions) + d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies) + Windows + true + true + true + true + MachineX64 + AsInvoker + %(DelayLoadDLLs) + + + true + + + + + + + + + + + + + + + + Level4 + MultiThreadedDLL + %(AdditionalOptions) + WIN32;NDEBUG;_WINDOWS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + %(AdditionalOptions) + d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies) + true + Windows + true + true + true + MachineX86 + + + true + + + + + + + + + + + + + Level4 + MultiThreadedDLL + %(AdditionalOptions) + WIN32;NDEBUG;_WINDOWS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + %(AdditionalOptions) + d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies) + true + Windows + true + true + true + true + true + MachineX64 + AsInvoker + %(DelayLoadDLLs) + + + true + + + + + + + + + + + + + Level4 + MultiThreadedDLL + %(AdditionalOptions) + WIN32;NDEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + %(AdditionalOptions) + d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies) + true + Windows + true + true + true + MachineX86 + + + true + + + + + + + + + + + + + Level4 + MultiThreadedDLL + %(AdditionalOptions) + WIN32;NDEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + %(AdditionalOptions) + d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies) + true + Windows + true + true + true + true + true + MachineX64 + AsInvoker + %(DelayLoadDLLs) + + + true + + + + + + + + + + + + + true + true + true + true + true + true + + + PS + Pixel + 4.0 + PS + Pixel + 4.0 + PS + Pixel + 4.0 + PS + Pixel + 4.0 + PS + Pixel + 4.0 + PS + Pixel + 4.0 + + + VS + Vertex + 4.0 + VS + Vertex + 4.0 + VS + Vertex + 4.0 + VS + Vertex + 4.0 + VS + Vertex + 4.0 + VS + Vertex + 4.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2026.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2026.vcxproj.filters new file mode 100644 index 00000000..4c410362 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_2026.vcxproj.filters @@ -0,0 +1,228 @@ + + + + + {8e114980-c1a3-4ada-ad7c-83caadf5daeb} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe + + + {2c3d4c8c-5d1a-459a-a05a-a4e4b608a44e} + fx;fxh;hlsl + + + {72d04a34-8e0e-424e-8590-4a08a561f150} + + + {2f3439ae-44f2-42bf-a98d-2207c18421cc} + + + {a6a4ca71-ea07-4c1b-b4a4-c97e9c6083e0} + + + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + + + Shaders + + + Shaders + + + Shaders + + + + + Source Files + + + Source Files + + + Source Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_PS.hlsl b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_PS.hlsl new file mode 100644 index 00000000..04ff9c3e --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_PS.hlsl @@ -0,0 +1 @@ +#include "DirectX11.fx" diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_VS.hlsl b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_VS.hlsl new file mode 100644 index 00000000..04ff9c3e --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX11/ProjectFiles/DirectX11_VS.hlsl @@ -0,0 +1 @@ +#include "DirectX11.fx" diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX11/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/DirectX11/Readme.txt new file mode 100644 index 00000000..04cbf69e --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX11/Readme.txt @@ -0,0 +1,22 @@ +DirectX11 Example +================== +This project displays a moving DirectX picture in a simple window. The code +in this example is based on DirectX version 11. + +The Visual Studio Community development environments include +the DirectX11 SDK, so no additional software is required to compiler this +code if VS Community is used. + +DirectX11 is supported on Windows Vista Service Pack 2 and later operating +systems. The DirectX runtime is normally delivered via Windows Update. + +This example displays a rotating square using DirectX within the DXView window. + +Note: The DirectX11.fx shader file is required for the compiled program to run. + +Features demonstrated in this example +===================================== +* Displaying a moving DirectX picture in a window. +* Customizing the application's message loop. + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/DXApp.cpp b/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/DXApp.cpp new file mode 100644 index 00000000..b470dfa8 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/DXApp.cpp @@ -0,0 +1,41 @@ +///////////////////////////// +// DXApp.cpp +// + +#include "DXApp.h" + +////////////////////////////// +// CDXApp function definitions +// + +// Called when the application starts. +BOOL CDXApp::InitInstance() +{ + // Creates the DirectX view window + m_dxView.Create(); + + return TRUE; +} + +// Overrides the application's default message loop. +// Calls Render during idle processing +int CDXApp::MessageLoop() +{ + // Main message loop + MSG msg{}; + while (WM_QUIT != msg.message) + { + if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + else + { + m_dxView.Render(); + } + } + + return LOWORD(msg.wParam); +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/DXApp.h b/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/DXApp.h new file mode 100644 index 00000000..05d75ae4 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/DXApp.h @@ -0,0 +1,32 @@ +///////////////////////////// +// DXApp.h +// + +#ifndef DXAPP_H +#define DXAPP_H + +#include "DXView.h" + + +///////////////////////////////////////////////////////////// +// CDXApp manages the application. It initializes the Win32++ +// framework when it is constructed, and creates the main +// window when it runs. +class CDXApp : public CWinApp +{ +public: + CDXApp() = default; + virtual ~CDXApp() override = default; + +protected: + virtual BOOL InitInstance() override; + virtual int MessageLoop() override; + +private: + CDXApp(const CDXApp&) = delete; + CDXApp& operator=(const CDXApp&) = delete; + + CDXView m_dxView; +}; + +#endif // DXAPP_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/DXView.cpp b/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/DXView.cpp new file mode 100644 index 00000000..26173b5a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/DXView.cpp @@ -0,0 +1,496 @@ +///////////////////////////// +// DXView.cpp +// + +#include "DXView.h" + +///////////////////////////// +// Global helper function for compiling shaders with D3DCompile +// +HRESULT CompileShaderFromFile(WCHAR* szFileName, LPCSTR szEntryPoint, LPCSTR szShaderModel, ID3DBlob** ppBlobOut) +{ + HRESULT hr = S_OK; + + DWORD dwShaderFlags = D3DCOMPILE_ENABLE_STRICTNESS; +#ifdef _DEBUG + // Set the D3DCOMPILE_DEBUG flag to embed debug information in the shaders. + // Setting this flag improves the shader debugging experience, but still allows + // the shaders to be optimized and to run exactly the way they will run in + // the release configuration of this program. + dwShaderFlags |= D3DCOMPILE_DEBUG; + + // Disable optimizations to further improve shader debugging + dwShaderFlags |= D3DCOMPILE_SKIP_OPTIMIZATION; +#endif + + ID3DBlob* pErrorBlob = nullptr; + hr = D3DCompileFromFile(szFileName, nullptr, nullptr, szEntryPoint, szShaderModel, + dwShaderFlags, 0, ppBlobOut, &pErrorBlob); + if (FAILED(hr)) + { + if (pErrorBlob) + { + OutputDebugStringA( reinterpret_cast( pErrorBlob->GetBufferPointer() ) ); + pErrorBlob->Release(); + } + return hr; + } + if (pErrorBlob) pErrorBlob->Release(); + + return S_OK; +} + +/////////////////////////////// +// CDXView function definitions +// + +// CDXView Constructor. +CDXView::CDXView() +{ + m_world = {}; + m_view = {}; + m_projection = {}; +} + +// CDXView Destructor. +CDXView::~CDXView() +{ + CleanupDevice(); +} + +// Clean up the objects we've created. +void CDXView::CleanupDevice() +{ + if (m_pImmediateContext) m_pImmediateContext->ClearState(); + + if (m_pConstantBuffer) m_pConstantBuffer->Release(); + if (m_pVertexBuffer) m_pVertexBuffer->Release(); + if (m_pIndexBuffer) m_pIndexBuffer->Release(); + if (m_pVertexLayout) m_pVertexLayout->Release(); + if (m_pVertexShader) m_pVertexShader->Release(); + if (m_pPixelShader) m_pPixelShader->Release(); + if (m_pRenderTargetView) m_pRenderTargetView->Release(); + if (m_pSwapChain1) m_pSwapChain1->Release(); + if (m_pSwapChain) m_pSwapChain->Release(); + if (m_pImmediateContext1) m_pImmediateContext1->Release(); + if (m_pImmediateContext) m_pImmediateContext->Release(); + if (m_pd3dDevice1) m_pd3dDevice1->Release(); + if (m_pd3dDevice) m_pd3dDevice->Release(); +} + +// Create Direct3D device and swap chain. +HRESULT CDXView::InitDevice() +{ + HRESULT hr = S_OK; + + RECT rc; + ::GetClientRect( *this, &rc ); + UINT width = rc.right - rc.left; + UINT height = rc.bottom - rc.top; + + UINT createDeviceFlags = 0; +#ifdef _DEBUG + createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG; +#endif + + D3D_DRIVER_TYPE driverTypes[] = + { + D3D_DRIVER_TYPE_HARDWARE, + D3D_DRIVER_TYPE_WARP, + D3D_DRIVER_TYPE_REFERENCE, + }; + UINT numDriverTypes = ARRAYSIZE(driverTypes); + + D3D_FEATURE_LEVEL featureLevels[] = + { + D3D_FEATURE_LEVEL_11_1, + D3D_FEATURE_LEVEL_11_0, + D3D_FEATURE_LEVEL_10_1, + D3D_FEATURE_LEVEL_10_0, + }; + UINT numFeatureLevels = ARRAYSIZE(featureLevels); + + for (UINT driverTypeIndex = 0; driverTypeIndex < numDriverTypes; driverTypeIndex++) + { + m_driverType = driverTypes[driverTypeIndex]; + hr = D3D11CreateDevice(nullptr, m_driverType, nullptr, createDeviceFlags, featureLevels, numFeatureLevels, + D3D11_SDK_VERSION, &m_pd3dDevice, &m_featureLevel, &m_pImmediateContext); + + if (hr == E_INVALIDARG) + { + // DirectX 11.0 platforms will not recognize D3D_FEATURE_LEVEL_11_1 so we need to retry without it + hr = D3D11CreateDevice(nullptr, m_driverType, nullptr, createDeviceFlags, &featureLevels[1], numFeatureLevels - 1, + D3D11_SDK_VERSION, &m_pd3dDevice, &m_featureLevel, &m_pImmediateContext); + } + + if (SUCCEEDED(hr)) + break; + } + if (FAILED(hr)) + return hr; + + // Obtain DXGI factory from device (since we used nullptr for pAdapter above) + IDXGIFactory1* dxgiFactory = nullptr; + { + IDXGIDevice* dxgiDevice = nullptr; + hr = m_pd3dDevice->QueryInterface(__uuidof(IDXGIDevice), reinterpret_cast(&dxgiDevice)); + if (SUCCEEDED(hr)) + { + IDXGIAdapter* adapter = nullptr; + hr = dxgiDevice->GetAdapter(&adapter); + if (SUCCEEDED(hr)) + { + hr = adapter->GetParent(__uuidof(IDXGIFactory1), reinterpret_cast(&dxgiFactory)); + adapter->Release(); + } + dxgiDevice->Release(); + } + } + if (FAILED(hr)) + return hr; + + // Create swap chain + IDXGIFactory2* dxgiFactory2 = nullptr; + hr = dxgiFactory->QueryInterface(__uuidof(IDXGIFactory2), reinterpret_cast(&dxgiFactory2)); + if (SUCCEEDED(hr)) + { + // DirectX 11.1 or later + hr = m_pd3dDevice->QueryInterface(__uuidof(ID3D11Device1), reinterpret_cast(&m_pd3dDevice1)); + if (SUCCEEDED(hr)) + { + m_pImmediateContext->QueryInterface(__uuidof(ID3D11DeviceContext1), reinterpret_cast(&m_pImmediateContext1)); + } + + DXGI_SWAP_CHAIN_DESC1 sd{}; + sd.Width = width; + sd.Height = height; + sd.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + sd.SampleDesc.Count = 1; + sd.SampleDesc.Quality = 0; + sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + sd.BufferCount = 1; + + hr = dxgiFactory2->CreateSwapChainForHwnd(m_pd3dDevice, *this, &sd, nullptr, nullptr, &m_pSwapChain1); + if (SUCCEEDED(hr)) + { + hr = m_pSwapChain1->QueryInterface(__uuidof(IDXGISwapChain), reinterpret_cast(&m_pSwapChain)); + } + + dxgiFactory2->Release(); + } + else + { + // DirectX 11.0 systems + DXGI_SWAP_CHAIN_DESC sd{}; + sd.BufferCount = 1; + sd.BufferDesc.Width = width; + sd.BufferDesc.Height = height; + sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + sd.BufferDesc.RefreshRate.Numerator = 60; + sd.BufferDesc.RefreshRate.Denominator = 1; + sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + sd.OutputWindow = *this; + sd.SampleDesc.Count = 1; + sd.SampleDesc.Quality = 0; + sd.Windowed = TRUE; + + hr = dxgiFactory->CreateSwapChain(m_pd3dDevice, &sd, &m_pSwapChain); + } + + // Note this tutorial doesn't handle full-screen swapchains so we block the ALT+ENTER shortcut + dxgiFactory->MakeWindowAssociation(*this, DXGI_MWA_NO_ALT_ENTER); + + dxgiFactory->Release(); + + if (FAILED(hr)) + return hr; + + // Create a render target view + ID3D11Texture2D* pBackBuffer = nullptr; + hr = m_pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast(&pBackBuffer)); + if (FAILED(hr)) + return hr; + + hr = m_pd3dDevice->CreateRenderTargetView(pBackBuffer, nullptr, &m_pRenderTargetView); + pBackBuffer->Release(); + if (FAILED(hr)) + return hr; + + m_pImmediateContext->OMSetRenderTargets(1, &m_pRenderTargetView, nullptr); + + // Setup the viewport + D3D11_VIEWPORT vp; + vp.Width = (FLOAT)width; + vp.Height = (FLOAT)height; + vp.MinDepth = 0.0f; + vp.MaxDepth = 1.0f; + vp.TopLeftX = 0; + vp.TopLeftY = 0; + m_pImmediateContext->RSSetViewports(1, &vp); + + // Compile the vertex shader + ID3DBlob* pVSBlob = nullptr; + hr = CompileShaderFromFile((LPWSTR)L"DirectX11.fx", "VS", "vs_4_0", &pVSBlob); + if (FAILED(hr)) + { + ::MessageBox( nullptr, + L"The FX file cannot be compiled. Please run this executable from the directory that contains the FX file.", L"Error", MB_OK ); + return hr; + } + + // Create the vertex shader + hr = m_pd3dDevice->CreateVertexShader(pVSBlob->GetBufferPointer(), pVSBlob->GetBufferSize(), nullptr, &m_pVertexShader); + if (FAILED(hr)) + { + pVSBlob->Release(); + return hr; + } + + // Define the input layout + D3D11_INPUT_ELEMENT_DESC layout[] = + { + { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + }; + UINT numElements = ARRAYSIZE( layout ); + + // Create the input layout + hr = m_pd3dDevice->CreateInputLayout(layout, numElements, pVSBlob->GetBufferPointer(), + pVSBlob->GetBufferSize(), &m_pVertexLayout); + pVSBlob->Release(); + if (FAILED(hr)) + return hr; + + // Set the input layout + m_pImmediateContext->IASetInputLayout(m_pVertexLayout); + + // Compile the pixel shader + ID3DBlob* pPSBlob = nullptr; + hr = CompileShaderFromFile((LPWSTR)L"DirectX11.fx", "PS", "ps_4_0", &pPSBlob); + if (FAILED(hr)) + { + ::MessageBox( nullptr, + L"The FX file cannot be compiled. Please run this executable from the directory that contains the FX file.", L"Error", MB_OK ); + return hr; + } + + // Create the pixel shader + hr = m_pd3dDevice->CreatePixelShader(pPSBlob->GetBufferPointer(), pPSBlob->GetBufferSize(), nullptr, &m_pPixelShader); + pPSBlob->Release(); + if (FAILED(hr)) + return hr; + + // Create vertex buffer + SimpleVertex vertices[] = + { + { XMFLOAT3( -1.0f, 1.0f, -1.0f ), XMFLOAT4( 0.0f, 0.0f, 1.0f, 1.0f ) }, + { XMFLOAT3( 1.0f, 1.0f, -1.0f ), XMFLOAT4( 0.0f, 1.0f, 0.0f, 1.0f ) }, + { XMFLOAT3( 1.0f, 1.0f, 1.0f ), XMFLOAT4( 0.0f, 1.0f, 1.0f, 1.0f ) }, + { XMFLOAT3( -1.0f, 1.0f, 1.0f ), XMFLOAT4( 1.0f, 0.0f, 0.0f, 1.0f ) }, + { XMFLOAT3( -1.0f, -1.0f, -1.0f ), XMFLOAT4( 1.0f, 0.0f, 1.0f, 1.0f ) }, + { XMFLOAT3( 1.0f, -1.0f, -1.0f ), XMFLOAT4( 1.0f, 1.0f, 0.0f, 1.0f ) }, + { XMFLOAT3( 1.0f, -1.0f, 1.0f ), XMFLOAT4( 1.0f, 1.0f, 1.0f, 1.0f ) }, + { XMFLOAT3( -1.0f, -1.0f, 1.0f ), XMFLOAT4( 0.0f, 0.0f, 0.0f, 1.0f ) }, + }; + D3D11_BUFFER_DESC bd{}; + bd.Usage = D3D11_USAGE_DEFAULT; + bd.ByteWidth = sizeof(SimpleVertex) * 8; + bd.BindFlags = D3D11_BIND_VERTEX_BUFFER; + bd.CPUAccessFlags = 0; + + D3D11_SUBRESOURCE_DATA InitData{}; + InitData.pSysMem = vertices; + hr = m_pd3dDevice->CreateBuffer( &bd, &InitData, &m_pVertexBuffer ); + if (FAILED(hr)) + return hr; + + // Set vertex buffer + UINT stride = sizeof(SimpleVertex); + UINT offset = 0; + m_pImmediateContext->IASetVertexBuffers(0, 1, &m_pVertexBuffer, &stride, &offset); + + // Create index buffer + WORD indices[] = + { + 3,1,0, + 2,1,3, + + 0,5,4, + 1,5,0, + + 3,4,7, + 0,4,3, + + 1,6,5, + 2,6,1, + + 2,7,6, + 3,7,2, + + 6,4,5, + 7,4,6, + }; + bd.Usage = D3D11_USAGE_DEFAULT; + bd.ByteWidth = sizeof(WORD) * 36; // 36 vertices needed for 12 triangles in a triangle list + bd.BindFlags = D3D11_BIND_INDEX_BUFFER; + bd.CPUAccessFlags = 0; + InitData.pSysMem = indices; + hr = m_pd3dDevice->CreateBuffer(&bd, &InitData, &m_pIndexBuffer); + if (FAILED(hr)) + return hr; + + // Set index buffer + m_pImmediateContext->IASetIndexBuffer(m_pIndexBuffer, DXGI_FORMAT_R16_UINT, 0); + + // Set primitive topology + m_pImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + + // Create the constant buffer + bd.Usage = D3D11_USAGE_DEFAULT; + bd.ByteWidth = sizeof(ConstantBuffer); + bd.BindFlags = D3D11_BIND_CONSTANT_BUFFER; + bd.CPUAccessFlags = 0; + hr = m_pd3dDevice->CreateBuffer(&bd, nullptr, &m_pConstantBuffer); + if (FAILED(hr)) + return hr; + + // Initialize the world matrix + m_world = XMMatrixIdentity(); + + // Initialize the view matrix + XMVECTOR Eye = XMVectorSet(0.0f, 1.0f, -5.0f, 0.0f); + XMVECTOR At = XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f); + XMVECTOR Up = XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f); + m_view = XMMatrixLookAtLH(Eye, At, Up); + + // Initialize the projection matrix + m_projection = XMMatrixPerspectiveFovLH(XM_PIDIV2, width / (FLOAT)height, 0.01f, 100.0f); + + return S_OK; +} + +// OnCreate is called automatically during window creation when a +// WM_CREATE message received. +// Tasks such as setting the icon, creating child windows, or anything +// associated with creating windows are normally performed here. +int CDXView::OnCreate(CREATESTRUCT&) +{ + // Set the window's icon + SetIconSmall(IDI_DIRECTX11); + SetIconLarge(IDI_DIRECTX11); + + // Set the window title + SetWindowText(LoadString(IDS_APP_TITLE)); + + if (FAILED(InitDevice())) + { + MessageBox(L"DirectX Failed to Initialize", L"Error", MB_OK); + + // Window creation failed + return -1; + } + + TRACE("OnCreate\n"); + return 0; +} + +// Set the window creation parameters. +void CDXView::PreCreate(CREATESTRUCT& cs) +{ + cs.x = DpiScaleInt(80); + cs.y = DpiScaleInt(60); + cs.cx = DpiScaleInt(800); + cs.cy = DpiScaleInt(600); +} + +// Render a frame. +void CDXView::Render() +{ + // Update our time + static float t = 0.0f; + if (m_driverType == D3D_DRIVER_TYPE_REFERENCE) + { + t += static_cast(XM_PI) * 0.0125f; + } + else + { + static ULONGLONG timeStart = 0; + ULONGLONG timeCur = GetTickCount64(); + if (timeStart == 0) + timeStart = timeCur; + t = (timeCur - timeStart) / 1000.0f; + } + + // Animate the cube + m_world = XMMatrixRotationY( t ); + + // Clear the back buffer + m_pImmediateContext->ClearRenderTargetView(m_pRenderTargetView, Colors::MidnightBlue); + + // Update variables + ConstantBuffer cb; + cb.mWorld = XMMatrixTranspose(m_world); + cb.mView = XMMatrixTranspose(m_view); + cb.mProjection = XMMatrixTranspose(m_projection); + m_pImmediateContext->UpdateSubresource(m_pConstantBuffer, 0, nullptr, &cb, 0, 0); + + // Renders a triangle + m_pImmediateContext->VSSetShader(m_pVertexShader, nullptr, 0); + m_pImmediateContext->VSSetConstantBuffers(0, 1, &m_pConstantBuffer); + m_pImmediateContext->PSSetShader(m_pPixelShader, nullptr, 0); + m_pImmediateContext->DrawIndexed(36, 0, 0); // 36 vertices needed for 12 triangles in a triangle list + + // Present our back buffer to our front buffer + m_pSwapChain->Present(0, 0); +} + +// Window Procedure. Handles window messages. +LRESULT CDXView::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + PAINTSTRUCT ps; + + switch (msg) + { + case WM_PAINT: + BeginPaint(ps); + EndPaint(ps); + break; + + case WM_DESTROY: + PostQuitMessage(0); + break; + + case WM_DPICHANGED: + { + LPRECT prc = reinterpret_cast(lparam); + SetWindowPos(HWND_TOP, *prc, SWP_SHOWWINDOW); + break; + } + } + + return WndProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/DXView.h b/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/DXView.h new file mode 100644 index 00000000..2d9abc59 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/DXView.h @@ -0,0 +1,80 @@ +///////////////////////////// +// DXView.h +// + +#ifndef DXVIEW_H +#define DXVIEW_H + +#include "wxx_wincore.h" + +#include +#include +#include +#include + +#include "resource.h" + +using namespace DirectX; + +//////////// +// Structures +// +struct SimpleVertex +{ + XMFLOAT3 Pos; + XMFLOAT4 Color; +}; + + +struct ConstantBuffer +{ + XMMATRIX mWorld; + XMMATRIX mView; + XMMATRIX mProjection; +}; + + +//////////////////////////////////////////// +// CView manages main window. It renders the +// DirectX11 images. +class CDXView : public CWnd +{ +public: + CDXView(); + virtual ~CDXView() override; + void Render(); + +protected: + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CDXView(const CDXView&) = delete; + CDXView& operator=(const CDXView&) = delete; + + void CleanupDevice(); + HRESULT InitDevice(); + + // Member variables + D3D_DRIVER_TYPE m_driverType = D3D_DRIVER_TYPE_NULL; + D3D_FEATURE_LEVEL m_featureLevel = D3D_FEATURE_LEVEL_11_0; + ID3D11Device* m_pd3dDevice = nullptr; + ID3D11Device1* m_pd3dDevice1 = nullptr; + ID3D11DeviceContext* m_pImmediateContext = nullptr; + ID3D11DeviceContext1* m_pImmediateContext1 = nullptr; + IDXGISwapChain* m_pSwapChain = nullptr; + IDXGISwapChain1* m_pSwapChain1 = nullptr; + ID3D11RenderTargetView* m_pRenderTargetView = nullptr; + ID3D11VertexShader* m_pVertexShader = nullptr; + ID3D11PixelShader* m_pPixelShader = nullptr; + ID3D11InputLayout* m_pVertexLayout = nullptr; + ID3D11Buffer* m_pVertexBuffer = nullptr; + ID3D11Buffer* m_pIndexBuffer = nullptr; + ID3D11Buffer* m_pConstantBuffer = nullptr; + XMMATRIX m_world; + XMMATRIX m_view; + XMMATRIX m_projection; +}; + +#endif // DXVIEW_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/Resource.rc b/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/Resource.rc new file mode 100644 index 00000000..baae52b7 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/Resource.rc @@ -0,0 +1,89 @@ +//Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#pragma code_page(1252) + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "../src/res/PerMonitorV2.manifest" + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. + +IDI_DIRECTX11 ICON "res\directx.ico" + + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDS_APP_TITLE "DirectX11 Sample" +END + +#endif +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/main.cpp b/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/main.cpp new file mode 100644 index 00000000..003c5ba3 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/main.cpp @@ -0,0 +1,40 @@ +///////////////////////////// +// main.cpp +// + +#include "DXApp.h" +#include "resource.h" + +int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPWSTR, _In_ int) +{ + try + { + CDXApp theApp; + return theApp.Run(); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return -1; +} + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/res/PerMonitorV2.manifest b/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/res/PerMonitorV2.manifest new file mode 100644 index 00000000..d303e5c0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/res/PerMonitorV2.manifest @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + PerMonitorV2, PerMonitor + + + + + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/res/directx.ico b/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/res/directx.ico new file mode 100644 index 00000000..edbb285e Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/res/directx.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/resource.h b/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/resource.h new file mode 100644 index 00000000..6edf3c39 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX11/src/resource.h @@ -0,0 +1,22 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Resource.rc +// + +#define IDS_APP_TITLE 101 +#define IDI_DIRECTX11 102 +#define IDI_SMALL 103 +#define IDC_DIRECTX11 104 +#define IDC_STATIC -1 +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS + +#define _APS_NO_MFC 130 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2015.sln b/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2015.sln new file mode 100644 index 00000000..2404b406 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2015.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectX9", "DirectX9_2015.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2015.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2015.vcxproj new file mode 100644 index 00000000..cc50cf62 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2015.vcxproj @@ -0,0 +1,260 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DirectX9 + DirectX9 + + + + Application + Unicode + v140_xp + + + Application + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + + + + + + + + + + + + + + + + + true + false + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;$(IncludePath) + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;$(LibraryPath) + + + true + false + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;$(IncludePath) + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;$(LibraryPath) + + + false + false + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;$(IncludePath) + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;$(LibraryPath) + + + false + false + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;$(IncludePath) + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;$(LibraryPath) + + + + Use + Level4 + true + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d3d9.lib;d3dx9.lib;Winmm.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d3d9.lib;d3dx9.lib;Winmm.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d3d9.lib;d3dx9.lib;Winmm.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d3d9.lib;d3dx9.lib;Winmm.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2015.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2015.vcxproj.filters new file mode 100644 index 00000000..061b1364 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2015.vcxproj.filters @@ -0,0 +1,233 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Win32++ + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Header Files + + + Win32++ + + + Header Files + + + + + {05b7549f-3965-4493-bcf1-14630c428a6e} + + + {f2fd2f51-dc75-403c-8c5d-88ca30f50555} + + + {c950d17f-591f-44c1-8d01-a488c42fd2b8} + + + {b747b258-ba5d-444b-9104-3f8b1e07857f} + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2019.sln b/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2019.sln new file mode 100644 index 00000000..9aae8f90 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2019.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectX9", "DirectX9_2019.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4732002F-55E3-4387-B9ED-2BDDFD844F69} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2019.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2019.vcxproj new file mode 100644 index 00000000..63fe9cbb --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2019.vcxproj @@ -0,0 +1,237 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DirectX9 + DirectX9 + + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + + + + + + + + + + + + + + + + + false + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;$(IncludePath) + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;$(LibraryPath) + + + false + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;$(IncludePath) + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;$(LibraryPath) + + + false + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;$(IncludePath) + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;$(LibraryPath) + + + false + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;$(IncludePath) + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;$(LibraryPath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d3d9.lib;d3dx9.lib;Winmm.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d3d9.lib;d3dx9.lib;Winmm.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d3d9.lib;d3dx9.lib;Winmm.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d3d9.lib;d3dx9.lib;Winmm.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2019.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2019.vcxproj.filters new file mode 100644 index 00000000..3fe78fc1 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2019.vcxproj.filters @@ -0,0 +1,230 @@ + + + + + {beab6285-27b1-4ced-bc99-fde0f471fc2f} + + + {3e6d8e3c-acfe-4b09-a5b0-51b6bffa9bd0} + + + {39093a86-9fa7-49c4-a97d-5e296fe8f01b} + + + {61799212-4cc4-4f1f-85be-adf0e1991391} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Header Files + + + Win32++ + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2022.sln b/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2022.sln new file mode 100644 index 00000000..f0f6fa3c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2022.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectX9", "DirectX9_2022.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {1361E058-D79F-4D7C-AC6A-564E0CA629A6} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2022.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2022.vcxproj new file mode 100644 index 00000000..ad74914e --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2022.vcxproj @@ -0,0 +1,244 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DirectX9 + DirectX9 + 10.0 + + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + + + + + + + + + + + + + + + + + false + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;..\src;$(IncludePath) + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;$(LibraryPath) + + + false + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;..\src;$(IncludePath) + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;$(LibraryPath) + $(SolutionDir)$(Platform)\$(Configuration)\ + + + false + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;..\src;$(IncludePath) + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;$(LibraryPath) + + + false + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;..\src;$(IncludePath) + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;$(LibraryPath) + $(SolutionDir)$(Platform)\$(Configuration)\ + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d3d9.lib;d3dx9.lib;Winmm.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d3d9.lib;d3dx9.lib;Winmm.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d3d9.lib;d3dx9.lib;Winmm.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d3d9.lib;d3dx9.lib;Winmm.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2022.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2022.vcxproj.filters new file mode 100644 index 00000000..5b581227 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2022.vcxproj.filters @@ -0,0 +1,230 @@ + + + + + {beab6285-27b1-4ced-bc99-fde0f471fc2f} + + + {3e6d8e3c-acfe-4b09-a5b0-51b6bffa9bd0} + + + {39093a86-9fa7-49c4-a97d-5e296fe8f01b} + + + {61799212-4cc4-4f1f-85be-adf0e1991391} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Header Files + + + Win32++ + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2026.slnx b/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2026.slnx new file mode 100644 index 00000000..44a93cfa --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2026.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2026.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2026.vcxproj new file mode 100644 index 00000000..24fc4b35 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2026.vcxproj @@ -0,0 +1,244 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DirectX9 + DirectX9 + 10.0 + + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + + + + + + + + + + + + + + + + + false + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;..\src;$(IncludePath) + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;$(LibraryPath) + + + false + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;..\src;$(IncludePath) + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;$(LibraryPath) + $(SolutionDir)$(Platform)\$(Configuration)\ + + + false + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;..\src;$(IncludePath) + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;$(LibraryPath) + + + false + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;..\src;$(IncludePath) + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;$(LibraryPath) + $(SolutionDir)$(Platform)\$(Configuration)\ + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d3d9.lib;d3dx9.lib;Winmm.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d3d9.lib;d3dx9.lib;Winmm.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d3d9.lib;d3dx9.lib;Winmm.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;d3d9.lib;d3dx9.lib;Winmm.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2026.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2026.vcxproj.filters new file mode 100644 index 00000000..97ac2472 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/ProjectFiles/DirectX9_2026.vcxproj.filters @@ -0,0 +1,230 @@ + + + + + {beab6285-27b1-4ced-bc99-fde0f471fc2f} + + + {3e6d8e3c-acfe-4b09-a5b0-51b6bffa9bd0} + + + {39093a86-9fa7-49c4-a97d-5e296fe8f01b} + + + {61799212-4cc4-4f1f-85be-adf0e1991391} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Header Files + + + Win32++ + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/DirectX9/Readme.txt new file mode 100644 index 00000000..1705e531 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/Readme.txt @@ -0,0 +1,29 @@ +DirectX9 Example +================== +This project displays a moving DirectX picture in a frame window. The code +in this example is based on DirectX version 9. + +Additional software is required to run this example. +For MS compilers you will need the DirectX SDK v9 + +Microsoft makes the the DirectX Software Development Kit available for download +without charge. The latest version is of the DirectX SDK was published in +June 2010. This version supports Window XP through to Windows 11. Users will +need install the DirectX End-User Runtimes (June 2010 for Win2000 and higher). + +This example displays a rotating triangle using DirectX within the DXView window. +- CDXView is the view window of CMainFrame. It runs in a separate thread. +- CDXThread inherits from CWinThread. It creates a separate thread for the + CDXView window, and customizes the message loop to support DirectX. + + +Features demonstrated in this example +===================================== +* Displaying a moving DirectX picture in a window. +* Putting the view window of a frame in a separate thread. +* Using a message loop in a separate thread to support DirectX. +* Customizing a thread's message loop. +* Using PostThreadMessage to post WM_QUIT and end a GUI thread. +* The use of CEvent to signal when a window has been created. +* The use of WaitForSingleObject detect when a thread has ended. +* Using a window that utilizes DirectX as the view window for a frame. diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/AboutDialog.h b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/AboutDialog.h new file mode 100644 index 00000000..71e4364d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/AboutDialog.h @@ -0,0 +1,31 @@ +///////////////////////////////////////////// +// AboutDialog.h + +#ifndef _ABOUTDIALOG_H_ +#define _ABOUTDIALOG_H_ + +#include "resource.h" + +//////////////////////////////////////////////////////// +// CAboutDialog manages the dialog which displays +// information about this program. +class CAboutDialog : public CDialog +{ +public: + CAboutDialog() : CDialog(IDW_ABOUT) {} + virtual BOOL OnInitDialog() override + { + // Set the Win32++ version string. + UINT ver = _WIN32XX_VER; + CString Win32xxVersion; + Win32xxVersion << "Win32++ Version " << ver / 0x100 << "." << + (ver % 0x100) / 0x10 << "." << (ver % 0x10); + + SetDlgItemText(IDC_STATIC1, Win32xxVersion); + SetDlgItemText(IDC_STATIC2, L"by David Nash"); + + return TRUE; + } +}; + +#endif // _ABOUTDIALOG_H_ diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/DXApp.cpp b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/DXApp.cpp new file mode 100644 index 00000000..0606d3f1 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/DXApp.cpp @@ -0,0 +1,20 @@ +///////////////////////////// +// DXApp.cpp +// + +#include "stdafx.h" +#include "DXApp.h" + +////////////////////////////// +// CDXApp function definitions +// + +// Called when the application starts. +BOOL CDXApp::InitInstance() +{ + // Create the frame window. + m_frame.Create(); + + return TRUE; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/DXApp.h b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/DXApp.h new file mode 100644 index 00000000..9373559f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/DXApp.h @@ -0,0 +1,36 @@ +///////////////////////////// +// DXApp.h +// + +#ifndef DXAPP_H +#define DXAPP_H + +#include "Mainfrm.h" + + +/////////////////////////////////////////////////////////////// +// CDXApp manages the application. It initializes the Win32++ +// framework when it is constructed, and creates the main frame +// window when it runs. +class CDXApp : public CWinApp +{ +public: + CDXApp() = default; + virtual ~CDXApp() override = default; + CMainFrame& GetMainFrame() { return m_frame; } + +protected: + virtual BOOL InitInstance() override; + +private: + CDXApp(const CDXApp&) = delete; + CDXApp& operator=(const CDXApp&) = delete; + + CMainFrame m_frame; +}; + + +// returns a pointer to the CDXApp object +inline CDXApp* GetDXApp() { return static_cast(GetApp()); } + +#endif diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/DXThread.cpp b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/DXThread.cpp new file mode 100644 index 00000000..202a46a5 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/DXThread.cpp @@ -0,0 +1,53 @@ +///////////////////////////// +// DXThread.cpp +// + +#include "stdafx.h" +#include "DXApp.h" + + +//////////////////////////////////////// +// CDXThread function definitions +// + +// Constructor +CDXThread::CDXThread() : m_pView(nullptr) +{ +} + +// This function runs when the thread starts +BOOL CDXThread::InitInstance() +{ + CMainFrame& frame = GetDXApp()->GetMainFrame(); + CDXView& view = frame.GetDXView(); + + // Set this thread's priority lower than the frame's thread. + SetThreadPriority(THREAD_PRIORITY_BELOW_NORMAL); + + // Set CDXView as this thread's window. + m_pView = &view; + view.CreateEx(0, L"DXView", nullptr, WS_CHILD | WS_VISIBLE, CRect(), frame, 0); + + return TRUE; // return TRUE to run the message loop +} + +// Here we override CWinThread::MessageLoop to accommodate the special needs of DirectX +int CDXThread::MessageLoop() +{ + MSG msg = {}; + while( msg.message != WM_QUIT ) + { + if ( PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) + { + ::TranslateMessage(&msg); + ::DispatchMessage(&msg); + } + else + { + m_pView->Render(); + } + } + + return LOWORD(msg.wParam); +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/DXThread.h b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/DXThread.h new file mode 100644 index 00000000..8d14b7b4 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/DXThread.h @@ -0,0 +1,32 @@ +///////////////////////////// +// DXThread.h +// + +#ifndef DXTHREAD_H +#define DXTHREAD_H + + +// Forward declaration of the CDXView class. +class CDXView; + +///////////////////////////////////////// +// CDXThread runs the thread for CDXView +// +class CDXThread : public CWinThread +{ +public: + CDXThread(); + virtual ~CDXThread() override = default; + +protected: + virtual BOOL InitInstance() override; + virtual int MessageLoop() override; + +private: + CDXThread(const CDXThread&) = delete; + CDXThread& operator=(const CDXThread&) = delete; + + CDXView* m_pView; +}; + +#endif diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/DXView.cpp b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/DXView.cpp new file mode 100644 index 00000000..0d033cde --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/DXView.cpp @@ -0,0 +1,287 @@ +///////////////////////////// +// DXView.cpp +// + + +// NOTE: for MS compilers you will need the DirectX SDK v9 +// for Dev-C++ you will need the DirecX v9.0c DevPak + + +#include "stdafx.h" +#include // see the note above +#include "DXApp.h" + + +///////////////////////////// +// CDXView function definitions +// +CDXView::CDXView() : m_pD3D(nullptr), m_pd3dDevice(nullptr), m_pVB(nullptr) +{ + m_d3dpp = {}; +} + +CDXView::~CDXView() +{ + if(m_pVB != nullptr) + m_pVB->Release(); + + if( m_pd3dDevice != nullptr) + m_pd3dDevice->Release(); + + if( m_pD3D != nullptr) + m_pD3D->Release(); +} + +// Here we override the Create function and use it to create the DXThread. +// The DXView window is automatically created when the thread starts. +HWND CDXView::Create(HWND) +{ + // Create and start our thread. The thread runs its own message loop. + m_DXThread.CreateThread(); + + // Wait for the DXView window to be created. + ::WaitForSingleObject(m_windowCreated, INFINITE); + + return GetHwnd(); +} + +// End the view window's thread. +void CDXView::EndThread() +{ + m_DXThread.PostThreadMessage(WM_QUIT, 0, 0); + ::WaitForSingleObject(m_DXThread, INFINITE); +} + +// Initializes Direct3D +HRESULT CDXView::InitD3D( HWND wnd ) +{ + // Create the D3D object. + m_pD3D = Direct3DCreate9(D3D_SDK_VERSION); + if (m_pD3D == nullptr) + return E_FAIL; + + CRect rc = GetClientRect(); + + // Set up the structure used to create the D3DDevice + m_d3dpp = {}; + m_d3dpp.Windowed = TRUE; + m_d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; + m_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; + m_d3dpp.BackBufferFormat = D3DFMT_UNKNOWN; + m_d3dpp.BackBufferWidth = rc.Width(); + m_d3dpp.BackBufferHeight = rc.Height(); + + // Create the D3DDevice + if (FAILED(m_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, wnd, + D3DCREATE_HARDWARE_VERTEXPROCESSING, &m_d3dpp, &m_pd3dDevice))) + { + // Attempt CreateDevice with different options. + if (FAILED(m_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, wnd, + D3DCREATE_SOFTWARE_VERTEXPROCESSING, &m_d3dpp, &m_pd3dDevice))) + { + return E_FAIL; + } + } + + SetupDefaultRenderStates(); + + return S_OK; +} + +// Creates the scene geometry. +HRESULT CDXView::InitGeometry() +{ + // Initialize three vertices for rendering a triangle + CUSTOMVERTEX vertices[] = + { + { -1.0f,-1.0f, 0.0f, 0xffff0000, }, + { 1.0f,-1.0f, 0.0f, 0xff0000ff, }, + { 0.0f, 1.0f, 0.0f, 0xffffffff, } + }; + + // Create the vertex buffer. + if (FAILED(m_pd3dDevice->CreateVertexBuffer(3 * sizeof(CUSTOMVERTEX), + 0, D3DFVF_XYZ | D3DFVF_DIFFUSE, + D3DPOOL_MANAGED, &m_pVB, nullptr))) + { + return E_FAIL; + } + + // Fill the vertex buffer. + VOID* pVertices; + if (FAILED(m_pVB->Lock(0, sizeof(vertices), &pVertices, 0))) + return E_FAIL; + memcpy(pVertices, vertices, sizeof(vertices)); + m_pVB->Unlock(); + + return S_OK; +} + +// Called when the window is created. +int CDXView::OnCreate(CREATESTRUCT&) +{ + m_windowCreated.SetEvent(); + + // Resize this window to fill the parent window. + CRect rc = GetParent().GetClientRect(); + SetWindowPos(HWND_TOP, 0, 0, rc.Width(), rc.Height(), SWP_SHOWWINDOW); + + // Initialize Direct3D + if (SUCCEEDED(InitD3D(*this))) + { + // Create the scene geometry + if (SUCCEEDED(InitGeometry())) + { + // Show the window + ShowWindow(SW_SHOWDEFAULT); + UpdateWindow(); + } + } + else + TRACE("Failed to initialize DirectX\n"); + + return 0; +} + +// Sets up the world, view, and projection transform Matrices. +void CDXView::SetupMatrices() +{ + // For our world matrix, we will just rotate the object about the y-axis. + D3DXMATRIXA16 matWorld; + + // Set up the rotation matrix to generate 1 full rotation (2*PI radians) + // every 2000 ms. To avoid the loss of precision inherent in very high + // floating point numbers, the system time is modulated by the rotation + // period before conversion to a radian angle. + UINT iTime = timeGetTime() % 2000; + + FLOAT fAngle = iTime * (2.0f * D3DX_PI) / 2000.0f; + D3DXMatrixRotationY( &matWorld, fAngle ); + m_pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld ); + + // Set up our view matrix. A view matrix can be defined given an eye point, + // a point to look at, and a direction for which way is up. Here, we set the + // eye five units back along the z-axis and up three units, look at the + // origin, and define "up" to be in the y-direction. + D3DXVECTOR3 vEyePt( 0.0f, 3.0f,-5.0f ); + D3DXVECTOR3 vLookatPt( 0.0f, 0.0f, 0.0f ); + D3DXVECTOR3 vUpVec( 0.0f, 1.0f, 0.0f ); + D3DXMATRIXA16 matView; + D3DXMatrixLookAtLH( &matView, &vEyePt, &vLookatPt, &vUpVec ); + m_pd3dDevice->SetTransform( D3DTS_VIEW, &matView ); + + // For the projection matrix, we set up a perspective transform (which + // transforms geometry from 3D view space to 2D viewport space, with + // a perspective divide making objects smaller in the distance). To build + // a perspective transform, we need the field of view (1/4 pi is common), + // the aspect ratio, and the near and far clipping planes (which define at + // what distances geometry should be no longer be rendered). + D3DXMATRIXA16 matProj; + D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI/4, 1.0f, 1.0f, 100.0f ); + m_pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj ); +} + +// Draws the scene. +void CDXView::Render() +{ + if (IsWindow() && m_pd3dDevice) + { + HRESULT hResult = m_pd3dDevice->TestCooperativeLevel(); + switch (hResult) + { + case D3D_OK: + { + CRect rcClient = GetClientRect(); + int backBufferWidth = static_cast(m_d3dpp.BackBufferWidth); + int backBufferHeight = static_cast(m_d3dpp.BackBufferHeight); + bool isResizeNeeded = backBufferWidth != rcClient.Width() || backBufferHeight != rcClient.Height(); + if (isResizeNeeded) + { + m_d3dpp.BackBufferWidth = rcClient.Width(); + m_d3dpp.BackBufferHeight = rcClient.Height(); + if ( !SUCCEEDED( m_pd3dDevice->Reset(&m_d3dpp) ) ) + TRACE("Failed to reset the DirectX device\n"); + } + + // Clear the backbuffer to a black color + if (D3D_OK !=m_pd3dDevice->Clear( 0, nullptr, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0), 1.0f, 0 )) + TRACE("Failed to clear back buffer\n"); + + // Begin the scene + if( SUCCEEDED( m_pd3dDevice->BeginScene() ) ) + { + // Setup the world, view, and projection Matrices + SetupMatrices(); + + SetupDefaultRenderStates(); + + // Render the vertex buffer contents + m_pd3dDevice->SetStreamSource( 0, m_pVB, 0, sizeof(CUSTOMVERTEX) ); + m_pd3dDevice->SetFVF( D3DFVF_XYZ | D3DFVF_DIFFUSE ); + m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 1 ); + + // End the scene + m_pd3dDevice->EndScene(); + } + else + TRACE("Failed to render the scene\n"); + + // Present the backbuffer contents to the display + m_pd3dDevice->Present( nullptr, nullptr, 0, nullptr ); + } + break; + case D3DERR_DEVICELOST: + TRACE("Got D3DERR_DEVICELOST\n"); + break; + case D3DERR_DEVICENOTRESET: + TRACE("Got D3DERR_DEVICENOTRESET\n"); + m_pd3dDevice->Reset(&m_d3dpp); // Reset the DX device + break; + default: + TRACE("Direct3D device is in an invalid state\n"); + break; + } + } +} + +void CDXView::SetupDefaultRenderStates() +{ + // Turn off culling, so we see the front and back of the triangle + m_pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE ); + + // Turn off D3D lighting, since we are providing our own vertex colors + m_pd3dDevice->SetRenderState( D3DRS_LIGHTING, FALSE ); +} + +// Process the window's messages. +LRESULT CDXView::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + // Catch any exceptions thrown when handling messages. + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/DXView.h b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/DXView.h new file mode 100644 index 00000000..00d9e787 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/DXView.h @@ -0,0 +1,61 @@ +///////////////////////////// +// DXView.h +// + +#ifndef DXVIEW_H +#define DXVIEW_H + +// NOTE: for MS compilers you will need the DirectX SDK v9 +// for Dev-C++ you will need the DirecX v9.0c DevPak + +#include // See the note above +#include "DXThread.h" // Declares the CDXThread class + + +// A structure for our custom vertex type +struct CUSTOMVERTEX +{ + FLOAT x, y, z; // The untransformed, 3D position for the vertex + DWORD color; // The vertex color +}; + + +//////////////////////////////////////////// +// CDXView is the view window of CMainFrame. +// It runs in its own thread, and renders the directX image. +// +class CDXView : public CWnd +{ +public: + CDXView(); + virtual ~CDXView() override; + + void EndThread(); + void Render(); + +protected: + virtual HWND Create(HWND parent = nullptr) override; + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CDXView(const CDXView&) = delete; + CDXView& operator=(const CDXView&) = delete; + + // Member functions + HRESULT InitD3D(HWND wnd); + HRESULT InitGeometry(); + void SetupDefaultRenderStates(); + void SetupMatrices(); + + // Member variables + LPDIRECT3D9 m_pD3D; // Used to create the D3DDevice + LPDIRECT3DDEVICE9 m_pd3dDevice; // Our rendering device + LPDIRECT3DVERTEXBUFFER9 m_pVB; // Buffer to hold vertices + D3DPRESENT_PARAMETERS m_d3dpp; + CDXThread m_DXThread; + CEvent m_windowCreated; +}; + + +#endif diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/Mainfrm.cpp b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/Mainfrm.cpp new file mode 100644 index 00000000..4bd11bf2 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/Mainfrm.cpp @@ -0,0 +1,157 @@ +///////////////////////////// +// Mainfrm.cpp +// + +#include "stdafx.h" +#include "Mainfrm.h" +#include "resource.h" + + +////////////////////////////////// +// CMainFrame function definitions +// + +// Create the frame window. +HWND CMainFrame::Create(HWND parent) +{ + // Set CDXView as the view window of the frame. + SetView(m_DXView); + + // Set the registry key name, and load the initial window position. + // Use a registry key name like "CompanyName\\Application". + LoadRegistrySettings(L"Win32++\\DirectX"); + + return CFrame::Create(parent); +} + +// OnCommand responds to menu and and toolbar input. +BOOL CMainFrame::OnCommand(WPARAM wparam, LPARAM) +{ + UINT id = LOWORD(wparam); + switch(id) + { + case IDM_FILE_EXIT: return OnFileExit(); + case IDW_VIEW_STATUSBAR: return OnViewStatusBar(); + case IDW_VIEW_TOOLBAR: return OnViewToolBar(); + case IDM_HELP_ABOUT: return OnHelp(); + } + + return FALSE; +} + +// OnCreate controls the way the frame is created. +// Overriding CFrame::OnCreate is optional. +int CMainFrame::OnCreate(CREATESTRUCT& cs) +{ + // A menu is added if the IDW_MAIN menu resource is defined. + // Frames have all options enabled by default. + // Use the following functions to disable options. + + UseIndicatorStatus(FALSE); // Don't show keyboard indicators in the StatusBar + // UseMenuStatus(FALSE); // Don't show menu descriptions in the StatusBar + // UseReBar(FALSE); // Don't use a ReBar + UseStatusBar(FALSE); // Don't use a StatusBar + // UseThemes(FALSE); // Don't use themes + // UseToolBar(FALSE); // Don't use a ToolBar + + // call the base class function + return CFrame::OnCreate(cs); +} + +// Called when the frame window is destroyed. +void CMainFrame::OnDestroy() +{ + CFrame::OnDestroy(); + m_DXView.EndThread(); +} + +// Display the help about dialog. +BOOL CMainFrame::OnHelp() +{ + // Ensure only one dialog displayed even for multiple hits of the F1 button. + if (!m_aboutDialog.IsWindow()) + { + m_aboutDialog.DoModal(*this); + } + + return TRUE; +} + +// Called after the window is created. +void CMainFrame::OnInitialUpdate() +{ + // The frame is now created. + // Place any additional startup code here. + + TRACE("Frame created\n"); +} + +// Issue a close request to the frame to end the application. +BOOL CMainFrame::OnFileExit() +{ + Close(); + return TRUE; +} + +// Specify the icons used in popup menus. +void CMainFrame::SetupMenuIcons() +{ + std::vector data = GetToolBarData(); + if (GetMenuIconHeight() >= 24) + SetMenuIcons(data, RGB(192, 192, 192), IDW_MAIN); + else + SetMenuIcons(data, RGB(192, 192, 192), IDB_MENUICONS16); +} + +// Setup the icons and resource IDs for the toolbar. +void CMainFrame::SetupToolBar() +{ + // Set the Resource IDs for the toolbar buttons + AddToolBarButton( IDM_FILE_NEW ); + AddToolBarButton( IDM_FILE_OPEN, FALSE); // disabled button + AddToolBarButton( IDM_FILE_SAVE, FALSE); // disabled button + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_EDIT_CUT, FALSE ); // disabled button + AddToolBarButton( IDM_EDIT_COPY, FALSE ); // disabled button + AddToolBarButton( IDM_EDIT_PASTE, FALSE ); // disabled button + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_FILE_PRINT, FALSE); // disabled button + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_HELP_ABOUT ); +} + +// Process the frame's window messages. +LRESULT CMainFrame::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + // Catch any exceptions thrown when handling messages. + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/Mainfrm.h b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/Mainfrm.h new file mode 100644 index 00000000..4fdd0fad --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/Mainfrm.h @@ -0,0 +1,48 @@ +///////////////////////////// +// Mainfrm.h +// + +#ifndef MAINFRM_H +#define MAINFRM_H + +#include "DXView.h" +#include "AboutDialog.h" + + +/////////////////////////////////////////////////////////// +// CMainFrame manages the application's main window. +// The main window is a frame which has a menubar, toolbar, +// statusbar and view window. +class CMainFrame : public CFrame +{ +public: + CMainFrame() = default; + virtual ~CMainFrame() override = default; + virtual HWND Create(HWND parent = nullptr) override; + CDXView& GetDXView() { return m_DXView; } + +protected: + virtual BOOL OnCommand(WPARAM wparam, LPARAM lparam) override; + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual void OnDestroy() override; + virtual BOOL OnHelp() override; + virtual void OnInitialUpdate() override; + virtual void SetupMenuIcons() override; + virtual void SetupToolBar() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CMainFrame(const CMainFrame&) = delete; + CMainFrame& operator=(const CMainFrame&) = delete; + + // Command handlers + BOOL OnFileExit(); + + // Member variables + CAboutDialog m_aboutDialog; + CDXView m_DXView; + CImageList m_normalImages; +}; + +#endif //MAINFRM_H + diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/Resource.rc b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/Resource.rc new file mode 100644 index 00000000..10523d41 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/Resource.rc @@ -0,0 +1,205 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "../src/res/PerMonitorV2.manifest" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDW_MAIN MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "New\tCtrl+N", IDM_FILE_NEW + MENUITEM "&Open...\tCtrl+O", IDM_FILE_OPEN, GRAYED + MENUITEM "&Save\tCtrl+S", IDM_FILE_SAVE, GRAYED + MENUITEM "Save &As...", IDM_FILE_SAVEAS, GRAYED + MENUITEM SEPARATOR + MENUITEM "&Print...\tCtrl+P", IDM_FILE_PRINT, GRAYED + MENUITEM SEPARATOR + MENUITEM "E&xit\tAlt+F4", IDM_FILE_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "Undo\tCtrl+Z", IDM_EDIT_UNDO, GRAYED + MENUITEM "Redo\tCtrl+Y", IDM_EDIT_REDO, GRAYED + MENUITEM SEPARATOR + MENUITEM "Cut\tCtrl+X", IDM_EDIT_CUT, GRAYED + MENUITEM "Copy\tCtrl+C", IDM_EDIT_COPY, GRAYED + MENUITEM "Paste\tCtrl+V", IDM_EDIT_PASTE, GRAYED + MENUITEM "Delete\tDel", IDM_EDIT_DELETE, GRAYED + END + POPUP "&View" + BEGIN + MENUITEM "&Tool Bar", IDW_VIEW_TOOLBAR, CHECKED + MENUITEM "&Status Bar", IDW_VIEW_STATUSBAR, CHECKED + END + POPUP "&Help" + BEGIN + MENUITEM "&About\tF1", IDM_HELP_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDW_MAIN ICON "../src/res/directx.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDW_MAIN BITMAP "../src/res/Toolbar.bmp" +IDB_MENUICONS16 BITMAP "../src/res/MenuIcons16.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDW_ABOUT DIALOGEX 0, 0, 186, 109 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "MS Shell Dlg", 400, 0 +BEGIN + DEFPUSHBUTTON "OK",IDOK,68,60,50,14 + CTEXT "DirectX9 Application",IDC_STATIC,43,22,99,8 + ICON IDW_MAIN,0,4,4,20,20 + CTEXT "",IDC_STATIC1,53,32,80,8 + CTEXT "",IDC_STATIC2,53,42,80,8 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDW_MAIN ACCELERATORS +BEGIN + "N", IDM_FILE_NEW, VIRTKEY, CONTROL, NOINVERT + "O", IDM_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT + "P", IDM_FILE_PRINT, VIRTKEY, CONTROL, NOINVERT + "S", IDM_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT + "C", IDM_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + "X", IDM_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT + "V", IDM_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT + "Z", IDM_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT + "Y", IDM_EDIT_REDO, VIRTKEY, CONTROL, NOINVERT +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDW_MAIN "DirectX Application" + IDW_VIEW_TOOLBAR "Show or hide the tool bar" + IDW_VIEW_STATUSBAR "Show or hide the status bar" + IDW_INDICATOR_CAPS "CAP" + IDW_INDICATOR_NUM "NUM" + IDW_INDICATOR_SCRL "SCRL" + IDW_READY "Ready" +END + +STRINGTABLE +BEGIN + IDM_FILE_NEW "Create a New Document" + IDM_FILE_OPEN "Open Existing Document" + IDM_FILE_SAVE "Save the Document" + IDM_FILE_SAVEAS "Save the Document with a new name" + IDM_FILE_PRINT "Print the Document" + IDM_FILE_EXIT "End the Program" + IDM_EDIT_UNDO "Undo the last action" + IDM_EDIT_REDO "Redo the previously undone action" +END + +STRINGTABLE +BEGIN + IDM_EDIT_CUT "Cut the Selected Contents to the Clipboard" + IDM_EDIT_COPY "Copy the Selected Contents to the Clipboard" + IDM_EDIT_PASTE "Paste the Clipboard Contents to the Document" + IDM_EDIT_DELETE "Erase the selected Contents" + IDM_HELP_ABOUT "Display Information about this program" +END + +STRINGTABLE +BEGIN + SC_CLOSE "Close the Window" + SC_MAXIMIZE "Maximize the Window" + SC_MINIMIZE "Minimize the Window" + SC_MOVE "Move the Window" + SC_NEXTWINDOW "Select Next Window" + SC_PREVWINDOW "Select Previous Window" + SC_RESTORE "Restore the Window" + SC_SIZE "Resize the Window" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/StdAfx.cpp b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/StdAfx.cpp new file mode 100644 index 00000000..8957144d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/StdAfx.cpp @@ -0,0 +1,16 @@ +///////////////////////////// +// StdAfx.cpp +// + +// This file is used for precompiled hearders. Precompiled headers allow +// programs to be recompiled more quickly + +// To use precompiled headers, do the following: +// 1) Add the set of rarely changed headers to stdafx.h +// 2) Include stdafx.h in each cpp file. It must be included first. +// 3) Add stdafx.cpp to your project. +// 4) Turn on precompiled hearders in the project + + +#include "stdafx.h" + diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/main.cpp b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/main.cpp new file mode 100644 index 00000000..98f4aa21 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/main.cpp @@ -0,0 +1,40 @@ +///////////////////////////// +// main.cpp +// + +#include "stdafx.h" +#include "DXApp.h" + +int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPWSTR, _In_ int) +{ + try + { + // Start Win32++. + CDXApp MyApp; + + // Run the application. + return MyApp.Run(); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return -1; +} \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/res/MenuIcons16.bmp b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/res/MenuIcons16.bmp new file mode 100644 index 00000000..79ad442f Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/res/MenuIcons16.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/res/PerMonitorV2.manifest b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/res/PerMonitorV2.manifest new file mode 100644 index 00000000..d303e5c0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/res/PerMonitorV2.manifest @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + PerMonitorV2, PerMonitor + + + + + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/res/Toolbar.bmp b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/res/Toolbar.bmp new file mode 100644 index 00000000..4000d938 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/res/Toolbar.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/res/directx.ico b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/res/directx.ico new file mode 100644 index 00000000..edbb285e Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/res/directx.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/resource.h b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/resource.h new file mode 100644 index 00000000..76ac6116 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/resource.h @@ -0,0 +1,38 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Resource.rc +// + +// include the Resource IDs defined by Win32++ +#include "default_resource.h" + +#define IDM_FILE_NEW 121 +#define IDM_FILE_OPEN 122 +#define IDM_FILE_SAVE 123 +#define IDM_FILE_SAVEAS 124 +#define IDM_FILE_PRINT 125 +#define IDM_FILE_CLOSE 126 +#define IDM_FILE_EXIT 127 +#define IDM_EDIT_UNDO 130 +#define IDM_EDIT_REDO 131 +#define IDM_EDIT_CUT 132 +#define IDM_EDIT_COPY 133 +#define IDM_EDIT_PASTE 134 +#define IDM_EDIT_DELETE 135 +#define IDM_HELP_ABOUT 140 +#define IDB_MENUICONS16 150 + +#define IDC_STATIC1 160 +#define IDC_STATIC2 161 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 130 +#endif +#endif diff --git a/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/stdafx.h b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/stdafx.h new file mode 100644 index 00000000..08450116 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DirectX9/src/stdafx.h @@ -0,0 +1,90 @@ +///////////////////////////// +// StdAfx.h +// + +// This file is used for precompiled headers. +// Rarely modified header files should be included. +// Based on code provided by Lynn Allan. + + +#ifndef STDAFX_H +#define STDAFX_H + + +// Predefinitions for windows.h go here +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +// Specify Win32xx specific predefinitions here +//#define NO_USING_NAMESPACE // Don't use Win32xx namespace + +// Rarely modified header files should be included here +#include // Add support for std::vector +#include // Add support for std::map +#include // Add support for std::string +#include // Add support for stringstream +#include // Add support for the assert macro +#include // Add support for C style printf, sprintf, etc. +#include // Add support for C style character conversions atoi etc. +#include // Add support for C style TCHARs. + +// Add the Win32++ library +#include // Add CWinApp +#include // Add CArchive +#include // Add CAnimation, CComboBox, CComboBoxEx, CDateTime, CHeader, CHotKey, CIPAddress, CProgressBar, CSpinButton, CScrollBar, CSlider, CToolTip +#include // Add CCriticalSection, CThreadLock +#include // Add CString, CStringA, CStringW +#include // Add CDataExchange +#include // Add CDialog, CResizer +#include // Add CDockFrame, CMDIDockFrame +#include // Add CDocker, CDockContainer +#include // Add CException, CFileException, CNotSupportedException, CResourceException, CUserException, CWinException +#include // Add CFile +#include // Add CFileFind +#include // Add CFolderDialog +#include // Add CFrame +#include // Add CDC, CGDIObject, CBitmap, CBrush, CFont, CPalatte, CPen, CRgn +#include // Add CHGlobal +#include // Add CImageList +#include // Add CListView +#include // Add CMDIChild, CMDIFrame, CDockMDIFrame +#include // Add CMenu +#include // Add CMenuBar +#include // Add CMetaFile, CEnhMetaFile +#include // Add CEvent, CMutex, CSemaphore +#include // Add CPropertyPage, CPropertySheet +#include // Add CRebar +#include // Add CPoint, CRect, CSize +#include // Add CRegKey +#include // Add CRichEdit +#include // Add CScrollView +#include // Adds macros, windows header files, and CObject +#include // Add CSocket +#include // Add CStatusBar +#include // Add CButton, CEdit, CListBox +#include // Add CTab, CTabbedMDI +#include // Add AtoT, AtoW, TtoA, TtoW, WtoA, WtoT etc. +#include // Add MenuTheme, ReBarTheme, StatusBarTheme, ToolBarTheme +#include // Add CWinThread +#include // Add CTime +#include // Add CToolBar +#include // Add CTreeView +#include // Add CWebBrowser, CAXHost +#include // Add CWnd + +// WIN32_LEAN_AND_MEAN can't be used with these +#ifndef WIN32_LEAN_AND_MEAN + #include // Add CCommonDialog, CColorDialog, CFileDialog, CFindReplace, CFontDialog + #include // Add CFolderDialogEx + #include // Add CPrintPreview + #include // Add CPageSetupDialog, CPrintDialog + #include // Add CPrintDialogEx + #include // Add CTaskDialog + + // Visual Studio + #if defined (_MSC_VER) + #include // Add CRibbon, CRibbonFrame + #endif + +#endif // define WIN32_LEAN_AND_MEAN + +#endif // define STDAFX_H diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock.cbp b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock.cbp new file mode 100644 index 00000000..1572b1be --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock.cbp @@ -0,0 +1,143 @@ + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock.cbproj b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock.cbproj new file mode 100644 index 00000000..12840aa7 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock.cbproj @@ -0,0 +1,1533 @@ + + + {39461456-1040-43CB-9B40-5962EF847BB0} + 20.1 + None + True + Release + Win64x + 1048579 + Application + Dock + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + JPHNE + .\Embarcadero\$(Platform)\$(Config) + .\Embarcadero\$(Platform)\$(Config) + false + true + true + $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + CppGuiApplication + System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + true + <_TCHARMapping>wchar_t + Dock + ..\..\..\include\;..\src\;$(IncludePath) + ..\..\..\include\;..\src\;$(ILINK_LibraryPath) + 3081 + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + $(BDSINCLUDE)\windows\sdk;$(BRCC_IncludePath) + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + ..\src\stdafx.h + none + + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + false + true + false + true + _DEBUG;$(Defines) + false + None + DEBUG + true + true + true + true + Full + true + true + true + true + true + $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) + $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + + + PerMonitorV2 + false + $(BDSLIB)\$(PLATFORM)$(CC_SUFFIX)\debug;$(ILINK_LibraryPath) + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + + + NDEBUG;$(Defines) + None + + + PerMonitorV2 + false + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 66 + + + 67 + + + 0 + + + 1 + + + 2 + + + 3 + + + 4 + + + 5 + + + 6 + + + 7 + + +
Resource.res
+ 8 +
+ + 9 + + + 10 + true + + + 12 + + + 13 + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + +
+ + CPlusPlusBuilder.Personality.12 + CppGuiApplication + + + + False + True + True + False + + + Embarcadero C++Builder Office 2000 Servers Package + Embarcadero C++Builder Office XP Servers Package + + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + Assets\ + Logo150x150.png + true + + + + + Assets\ + Logo44x44.png + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + Dock.exe + true + + + + + Dock.exe + true + + + + + Dock.exe + true + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 64 + + + classes + 64 + + + + + res\xml + 1 + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\mips + 1 + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-v21 + 1 + + + res\values-v21 + 1 + + + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + Contents + 1 + + + Contents + 1 + + + Contents + 1 + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + library\lib\armeabi-v7a + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen + 64 + + + ..\$(PROJECTNAME).launchscreen + 64 + + + + + 1 + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + + + + + + + + + + + + + True + True + True + + + 12 + + + + +
diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2015.sln b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2015.sln new file mode 100644 index 00000000..ac9b76da --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2015.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Dock", "Dock_2015.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2015.vcxproj b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2015.vcxproj new file mode 100644 index 00000000..7a382887 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2015.vcxproj @@ -0,0 +1,252 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Dock + Dock + + + + Application + Unicode + v140_xp + + + Application + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + + + + + + + + + + + + + + + + + true + false + + + true + false + + + false + false + + + false + false + + + + Use + Level4 + true + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2015.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2015.vcxproj.filters new file mode 100644 index 00000000..09ee4e1d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2015.vcxproj.filters @@ -0,0 +1,233 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + + + {f1cf6593-ba9e-49ad-a241-da28348c0de6} + + + {4f9664ad-7660-4cd6-bc4c-cdb4a403322d} + + + {7cb09aa6-5085-458a-b843-c9c684f4556a} + + + {f54ea049-6145-46ee-bc61-8e0171ff52bf} + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2019.sln b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2019.sln new file mode 100644 index 00000000..32d46ff0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2019.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Dock", "Dock_2019.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {AEB3F701-4EFE-4775-9CB5-ED63AE2B19E9} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2019.vcxproj b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2019.vcxproj new file mode 100644 index 00000000..c9020335 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2019.vcxproj @@ -0,0 +1,229 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Dock + Dock + + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2019.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2019.vcxproj.filters new file mode 100644 index 00000000..18022a28 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2019.vcxproj.filters @@ -0,0 +1,230 @@ + + + + + {994c875f-8c79-42ba-ac9e-eef99442a4b4} + + + {2c2452c8-1610-4505-ba67-6f6fc185ad9e} + + + {c378abc8-1ff0-4430-b8bb-544d77187f0f} + + + {0edc5ef7-9771-402d-ad76-267f2313bce4} + + + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2022.sln b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2022.sln new file mode 100644 index 00000000..567b0262 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2022.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Dock", "Dock_2022.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {315AC221-EE48-46B5-AA5F-03E8C04D6D7A} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2022.vcxproj b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2022.vcxproj new file mode 100644 index 00000000..e0c17da3 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2022.vcxproj @@ -0,0 +1,240 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Dock + Dock + 10.0 + + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2022.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2022.vcxproj.filters new file mode 100644 index 00000000..18022a28 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2022.vcxproj.filters @@ -0,0 +1,230 @@ + + + + + {994c875f-8c79-42ba-ac9e-eef99442a4b4} + + + {2c2452c8-1610-4505-ba67-6f6fc185ad9e} + + + {c378abc8-1ff0-4430-b8bb-544d77187f0f} + + + {0edc5ef7-9771-402d-ad76-267f2313bce4} + + + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2026.slnx b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2026.slnx new file mode 100644 index 00000000..876f59fc --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2026.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2026.vcxproj b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2026.vcxproj new file mode 100644 index 00000000..82a62c6a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2026.vcxproj @@ -0,0 +1,240 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Dock + Dock + 10.0 + + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2026.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2026.vcxproj.filters new file mode 100644 index 00000000..160ace6b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Dock_2026.vcxproj.filters @@ -0,0 +1,230 @@ + + + + + {994c875f-8c79-42ba-ac9e-eef99442a4b4} + + + {2c2452c8-1610-4505-ba67-6f6fc185ad9e} + + + {c378abc8-1ff0-4430-b8bb-544d77187f0f} + + + {0edc5ef7-9771-402d-ad76-267f2313bce4} + + + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Docking_DEBUG.dev b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Docking_DEBUG.dev new file mode 100644 index 00000000..eb4fbc70 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Docking_DEBUG.dev @@ -0,0 +1,342 @@ +[Project] +FileName=Docking_DEBUG.dev +Name=Docking +UnitCount=14 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=ContainerDocking_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D _DEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@__@@__@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Debug +ObjectOutput=.\Dev-C++\Debug +OverrideOutput=1 +OverrideOutputName=Docking.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=4 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[Unit2] +FileName=..\src\Dockers.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\Mainfrm.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\Mainfrm.h +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit10] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit11] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit13] +FileName=..\src\Views.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit14] +FileName=..\src\AboutDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit15] +FileName=Text.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit16] +FileName=Text.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit17] +FileName=Output.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit18] +FileName=Output.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit19] +FileName=MyCombo.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit20] +FileName=MyCombo.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit21] +FileName=resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit22] +FileName=Simple.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit23] +FileName=Simple.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit24] +FileName=Text.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit25] +FileName=Text.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit26] +FileName=Output.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit1] +FileName=..\src\Dockers.cpp +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit3] +FileName=..\src\DockingApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\DockingApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit8] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\Resource.rc +CompileCpp=1 +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit12] +FileName=..\src\Views.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit27] +FileName=Output.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit30] +FileName=ComboBoxEx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit31] +FileName=ComboBoxEx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Docking_RELEASE.dev b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Docking_RELEASE.dev new file mode 100644 index 00000000..85bae58b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/ProjectFiles/Docking_RELEASE.dev @@ -0,0 +1,272 @@ +[Project] +FileName=Docking_RELEASE.dev +Name=Docking +UnitCount=14 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=ContainerDocking_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D NDEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-s_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Release +ObjectOutput=.\Dev-C++\Release +OverrideOutput=1 +OverrideOutputName=Docking.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=3 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[Unit3] +FileName=..\src\DockingApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\DockingApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\Mainfrm.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\Mainfrm.h +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit8] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\Resource.rc +CompileCpp=1 +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit10] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit11] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit12] +FileName=..\src\Views.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit13] +FileName=..\src\Views.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit14] +FileName=..\src\AboutDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit15] +FileName=Text.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit16] +FileName=Text.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit17] +FileName=Output.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit18] +FileName=Output.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit1] +FileName=..\src\Dockers.cpp +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit2] +FileName=..\src\Dockers.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit19] +FileName=MyCombo.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit20] +FileName=MyCombo.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit30] +FileName=ComboBoxEx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit31] +FileName=ComboBoxEx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/Dock/Readme.txt new file mode 100644 index 00000000..f319b6da --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/Readme.txt @@ -0,0 +1,36 @@ +Dock Example +============ +This example demonstrates simple docking (docking without containers). A +collection of different "view windows" are used by the CDocker class. + +Dockers are capable of allowing other Dockers to dock to and undock from them. +When docking, the undocked Docker is dragged over another Docker. Various +visual clues such has the dock targeting (small arrow-like images), and the +dock hinting (where a portion of the destination window turns blue) provide a +hint as to where the Docker will be docked. To facilitate undocking, the +caption of the docked window is dragged and dropped. + +Every Docker has a view window. These views can be any child window, and are +set in the same way as views for Frames and MDI children. Containers +(provided by the CDockContainer class) are a specialized view which add +additional docking features when used as the view window for a Docker. + +Classes titled CDockXXXX are inherited from CDocker. Classes titled CViewXXXX +are the various view windows inherited from CListView, CTreeView, CRichEdit or +CWnd. + +CMainFrame inherits from CDockFrame. CDockFrame adds support for docking +to CMainFrame. + +Refer to the documentation for further information on the use of the CDocker +class. + + +Features demonstrated in this example +===================================== +* Use of CDockFrame to provide a frame window. +* Use of CDockFrame to provide docking support. +* Use of RichEdit, ListView and TreeView windows as view windows for CDocker. +* Saving the dock layout in the registry. +* Use of OnMenuUpdate to manage menu item check boxes. +* Demonstrates the effects of the various dock styles. diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/AboutDialog.h b/packages/media/cpp/packages/Win32xx/samples/Dock/src/AboutDialog.h new file mode 100644 index 00000000..71e4364d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/src/AboutDialog.h @@ -0,0 +1,31 @@ +///////////////////////////////////////////// +// AboutDialog.h + +#ifndef _ABOUTDIALOG_H_ +#define _ABOUTDIALOG_H_ + +#include "resource.h" + +//////////////////////////////////////////////////////// +// CAboutDialog manages the dialog which displays +// information about this program. +class CAboutDialog : public CDialog +{ +public: + CAboutDialog() : CDialog(IDW_ABOUT) {} + virtual BOOL OnInitDialog() override + { + // Set the Win32++ version string. + UINT ver = _WIN32XX_VER; + CString Win32xxVersion; + Win32xxVersion << "Win32++ Version " << ver / 0x100 << "." << + (ver % 0x100) / 0x10 << "." << (ver % 0x10); + + SetDlgItemText(IDC_STATIC1, Win32xxVersion); + SetDlgItemText(IDC_STATIC2, L"by David Nash"); + + return TRUE; + } +}; + +#endif // _ABOUTDIALOG_H_ diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/Dockers.cpp b/packages/media/cpp/packages/Win32xx/samples/Dock/src/Dockers.cpp new file mode 100644 index 00000000..f7439673 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/src/Dockers.cpp @@ -0,0 +1,288 @@ +///////////////////////////// +// Dockers.cpp +// + +#include "stdafx.h" +#include "Dockers.h" + + +//////////////////////////////////// +// CDockSimple function definitions +// + +// Constructor. +CDockSimple::CDockSimple() +{ + // Set the view window for the simple docker. + SetView(m_view); + + // Set the width of the splitter bar. + SetBarWidth(8); + + SetCaption (L"Simple View - Docking"); +} + +// This function overrides CDocker::RecalcDockLayout to eliminate jitter +// when the dockers are resized. The technique used here is is most +// appropriate for a complex arrangement of dockers. It might not suite +// other docking applications. To support this technique the +// WS_EX_COMPOSITED extended style has been added to each docker. +void CDockSimple::RecalcDockLayout() +{ + if (GetWinVersion() >= 3000) // Windows 10 or later. + { + if (GetDockAncestor()->IsWindow()) + { + GetTopmostDocker()->LockWindowUpdate(); + CRect rc = GetTopmostDocker()->GetViewRect(); + GetTopmostDocker()->RecalcDockChildLayout(rc); + GetTopmostDocker()->UnlockWindowUpdate(); + GetTopmostDocker()->UpdateWindow(); + } + } + else + CDocker::RecalcDockLayout(); +} + +// Handle the window's messages. +LRESULT CDockSimple::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + +///////////////////////////////// +// CDockText function definitions +// + +// Constructor. +CDockText::CDockText() +{ + // Set the view window to our edit control. + SetView(m_view); + + // Set the width of the splitter bar. + SetBarWidth(8); + + SetCaption(L"Text View - Docking"); +} + +// This function overrides CDocker::RecalcDockLayout to eliminate jitter +// when the dockers are resized. The technique used here is is most +// appropriate for a complex arrangement of dockers. It might not suite +// other docking applications. To support this technique the +// WS_EX_COMPOSITED extended style has been added to each docker. +void CDockText::RecalcDockLayout() +{ + if (GetWinVersion() >= 3000) // Windows 10 or later. + { + if (GetDockAncestor()->IsWindow()) + { + GetTopmostDocker()->LockWindowUpdate(); + CRect rc = GetTopmostDocker()->GetViewRect(); + GetTopmostDocker()->RecalcDockChildLayout(rc); + GetTopmostDocker()->UnlockWindowUpdate(); + GetTopmostDocker()->UpdateWindow(); + } + } + else + CDocker::RecalcDockLayout(); +} + +// Handle the window's messages. +LRESULT CDockText::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + +//////////////////////////////////// +// CDockClasses function definitions +// + +// Constructor. +CDockClasses::CDockClasses() +{ + // Set the view window to our TreeView control. + SetView(m_view); + + // Set the width of the splitter bar. + SetBarWidth(8); + + SetCaption(L"Class View - Docking"); +} + +// This function overrides CDocker::RecalcDockLayout to eliminate jitter +// when the dockers are resized. The technique used here is is most +// appropriate for a complex arrangement of dockers. It might not suite +// other docking applications. To support this technique the +// WS_EX_COMPOSITED extended style has been added to each docker. +void CDockClasses::RecalcDockLayout() +{ + if (GetWinVersion() >= 3000) // Windows 10 or later. + { + if (GetDockAncestor()->IsWindow()) + { + GetTopmostDocker()->LockWindowUpdate(); + CRect rc = GetTopmostDocker()->GetViewRect(); + GetTopmostDocker()->RecalcDockChildLayout(rc); + GetTopmostDocker()->UnlockWindowUpdate(); + GetTopmostDocker()->UpdateWindow(); + } + } + else + CDocker::RecalcDockLayout(); +} + +// Handle the window's messages. +LRESULT CDockClasses::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + + +/////////////////////////////////// +// CDockFiles function definitions +// + +// Constructor. +CDockFiles::CDockFiles() +{ + // Set the view window to our ListView control. + SetView(m_view); + + // Set the width of the splitter bar. + SetBarWidth(8); + + SetCaption(L"Files View - Docking"); +} + +// This function overrides CDocker::RecalcDockLayout to eliminate jitter +// when the dockers are resized. The technique used here is is most +// appropriate for a complex arrangement of dockers. It might not suite +// other docking applications. To support this technique the +// WS_EX_COMPOSITED extended style has been added to each docker. +void CDockFiles::RecalcDockLayout() +{ + if (GetWinVersion() >= 3000) // Windows 10 or later. + { + if (GetDockAncestor()->IsWindow()) + { + GetTopmostDocker()->LockWindowUpdate(); + CRect rc = GetTopmostDocker()->GetViewRect(); + GetTopmostDocker()->RecalcDockChildLayout(rc); + GetTopmostDocker()->UnlockWindowUpdate(); + GetTopmostDocker()->UpdateWindow(); + } + } + else + CDocker::RecalcDockLayout(); +} + +// Handle the window's messages. +LRESULT CDockFiles::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/Dockers.h b/packages/media/cpp/packages/Win32xx/samples/Dock/src/Dockers.h new file mode 100644 index 00000000..9474bc65 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/src/Dockers.h @@ -0,0 +1,95 @@ +///////////////////////////// +// Dockers.h +// + +#ifndef DOCKABLES_H +#define DOCKABLES_H + +#include "Views.h" + + +///////////////////////////////////////////////////// +// CDockSimple manages the docker with a simple view. +class CDockSimple : public CDocker +{ +public: + CDockSimple(); + virtual ~CDockSimple() override = default; + +protected: + virtual void RecalcDockLayout() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CDockSimple(const CDockSimple&) = delete; + CDockSimple& operator=(const CDockSimple&) = delete; + + CViewSimple m_view; +}; + + +/////////////////////////////////////////////////////// +// CDockClasses manages the docker which uses CViewClasses +// as its view. +class CDockClasses : public CDocker +{ +public: + CDockClasses(); + virtual ~CDockClasses() override = default; + +protected: + virtual void RecalcDockLayout() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CDockClasses(const CDockClasses&) = delete; + CDockClasses& operator=(const CDockClasses&) = delete; + + CViewClasses m_view; +}; + + +///////////////////////////////////////////////////// +// CDockFiles manages the docker which uses CViewFiles +// as its view. +class CDockFiles : public CDocker +{ +public: + CDockFiles(); + virtual ~CDockFiles() override = default; + +protected: + virtual void RecalcDockLayout() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CDockFiles(const CDockFiles&) = delete; + CDockFiles& operator=(const CDockFiles&) = delete; + + CViewFiles m_view; +}; + + +//////////////////////////////////////////////////// +// CDockText manages the docker which uses CViewText +// as its view. +class CDockText : public CDocker +{ +public: + CDockText(); + virtual ~CDockText() override = default; + +protected: + virtual void RecalcDockLayout() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CDockText(const CDockText&) = delete; + CDockText& operator=(const CDockText&) = delete; + + CViewText m_view; +}; + + +#endif // DOCKABLES_H + diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/DockingApp.cpp b/packages/media/cpp/packages/Win32xx/samples/Dock/src/DockingApp.cpp new file mode 100644 index 00000000..1aa330a1 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/src/DockingApp.cpp @@ -0,0 +1,21 @@ +///////////////////////////// +// DockingApp.cpp +// + +#include "stdafx.h" +#include "DockingApp.h" + +/////////////////////////////////// +// CDockingApp function definitions +// + +// Called when the applications starts. +BOOL CDockingApp::InitInstance() +{ + // Create the frame window. + m_MainFrame.Create(); // throws a CWinException on failure + + return TRUE; +} + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/DockingApp.h b/packages/media/cpp/packages/Win32xx/samples/Dock/src/DockingApp.h new file mode 100644 index 00000000..11dd072c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/src/DockingApp.h @@ -0,0 +1,32 @@ +///////////////////////////// +// DockingApp.h +// + +#ifndef DOCKINGAPP_H +#define DOCKINGAPP_H + +#include "Mainfrm.h" + + +//////////////////////////////////////////////////////////// +// CDockingApp manages the application. It initializes the +// Win32++ framework when it is constructed, and creates the +// main frame window when it runs. +class CDockingApp : public CWinApp +{ +public: + CDockingApp() = default; + virtual ~CDockingApp() override = default; + +protected: + virtual BOOL InitInstance() override; + +private: + CDockingApp(const CDockingApp&) = delete; + CDockingApp& operator=(const CDockingApp&) = delete; + + CMainFrame m_MainFrame; +}; + + +#endif // DOCKINGAPP_H diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/Mainfrm.cpp b/packages/media/cpp/packages/Win32xx/samples/Dock/src/Mainfrm.cpp new file mode 100644 index 00000000..4ee4a4a8 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/src/Mainfrm.cpp @@ -0,0 +1,425 @@ +///////////////////////////// +// Mainfrm.cpp +// + +#include "stdafx.h" +#include "Mainfrm.h" +#include "resource.h" + +using namespace std; + +constexpr COLORREF lightgray = RGB(192, 192, 192); + +////////////////////////////////// +// CMainFrame function definitions +// + +// Constructor. +CMainFrame::CMainFrame() +{ + SetDockStylesToDefault(); +} + +// Create the frame window. +HWND CMainFrame::Create(HWND parent) +{ + // Set m_view as the view window of the frame. + SetView(m_view); + + // Set the registry key name, and load the initial window position. + // Use a registry key name like "CompanyName\\Application". + LoadRegistrySettings(L"Win32++\\Dock"); + + return CDockFrame::Create(parent); +} + +// Loads a default configuration of dockers. +void CMainFrame::LoadDefaultDockers() +{ + // Note: The DockIDs are used for saving/restoring the dockers state in the registry + + CDocker* pDockLeft = AddDockedChild(make_unique(), DS_DOCKED_LEFT, DpiScaleInt(200), ID_DOCK_CLASSES1); + CDocker* pDockRight = AddDockedChild(make_unique(), DS_DOCKED_RIGHT, DpiScaleInt(200), ID_DOCK_CLASSES2); + CDocker* pDockTop = AddDockedChild(make_unique(), DS_DOCKED_TOP, DpiScaleInt(100), ID_DOCK_TEXT1); + CDocker* pDockBottom = AddDockedChild(make_unique(), DS_DOCKED_BOTTOM, DpiScaleInt(100), ID_DOCK_TEXT2); + + pDockLeft->AddDockedChild(make_unique(), DS_DOCKED_BOTTOM, DpiScaleInt(150), ID_DOCK_FILES1); + pDockRight->AddDockedChild(make_unique(), DS_DOCKED_BOTTOM, DpiScaleInt(150), ID_DOCK_FILES2); + pDockTop->AddDockedChild(make_unique(), DS_DOCKED_RIGHT, DpiScaleInt(100), ID_DOCK_SIMPLE1); + pDockBottom->AddDockedChild(make_unique(), DS_DOCKED_RIGHT, DpiScaleInt(100), ID_DOCK_SIMPLE2); + + // Adjust dock styles as per menu selections + SetDockStyles(); +} + +// Adds a new docker. The id specifies the dock type. +DockPtr CMainFrame::NewDockerFromID(int id) +{ + DockPtr docker; + switch (id) + { + case ID_DOCK_CLASSES1: + docker = make_unique(); + break; + case ID_DOCK_CLASSES2: + docker = make_unique(); + break; + case ID_DOCK_FILES1: + docker = make_unique(); + break; + case ID_DOCK_FILES2: + docker = make_unique(); + break; + case ID_DOCK_SIMPLE1: + docker = make_unique(); + break; + case ID_DOCK_SIMPLE2: + docker = make_unique(); + break; + case ID_DOCK_TEXT1: + docker = make_unique(); + break; + case ID_DOCK_TEXT2: + docker = make_unique(); + break; + default: + TRACE("Unknown Dock ID\n"); + break; + } + + return docker; +} + +// Toggle the display of a 3D border. +BOOL CMainFrame::On3DBorder() +{ + m_use3DBorder = !m_use3DBorder; + SetDockStyles(); + return TRUE; +} + +// OnCommand responds to menu and and toolbar input. +BOOL CMainFrame::OnCommand(WPARAM wparam, LPARAM) +{ + UINT id = LOWORD(wparam); + switch(id) + { + case IDM_FILE_EXIT: return OnFileExit(); + case IDM_DOCK_DEFAULT: return OnDockDefault(); + case IDM_STYLES_DEFAULT: return OnStylesDefault(); + case IDM_DOCK_CLOSEALL: return OnDockCloseAll(); + case IDM_3DBORDER: return On3DBorder(); + case IDM_NO_UNDOCK: return OnNoUndocking(); + case IDM_NO_RESIZE: return OnNoResize(); + case IDM_NO_DOCK_LR: return OnNoDockLR(); + case IDM_NO_DOCK_CAPTION: return OnNoDockCaption(); + case IDM_NO_DOCK_CLOSE: return OnNoDockClose(); + case IDW_VIEW_STATUSBAR: return OnViewStatusBar(); + case IDW_VIEW_TOOLBAR: return OnViewToolBar(); + case IDM_HELP_ABOUT: return OnHelp(); + } + + return FALSE; +} + +// OnCreate controls the way the frame is created. +// Overriding CFrame::OnCreate is optional. +int CMainFrame::OnCreate(CREATESTRUCT& cs) +{ + // A menu is added if the IDW_MAIN menu resource is defined. + // Frames have all options enabled by default. + // Use the following functions to disable options. + + // UseIndicatorStatus(FALSE); // Don't show keyboard indicators in the StatusBar. + // UseMenuStatus(FALSE); // Don't show menu descriptions in the StatusBar. + // UseOwnerDrawnMenu(FALSE); // Don't use owner draw for popup menu items. + // UseReBar(FALSE); // Don't use a ReBar. + // UseStatusBar(FALSE); // Don't use a StatusBar. + // UseThemes(FALSE); // Don't use themes. + // UseToolBar(FALSE); // Don't use a ToolBar. + + // call the base class function + return CDockFrame::OnCreate(cs); +} + +// Closes all of the dockers. +BOOL CMainFrame::OnDockCloseAll() +{ + CloseAllDockers(); + return TRUE; +} + +// Loads a default arrangement of dockers. +BOOL CMainFrame::OnDockDefault() +{ + // Suppress redraw to render the docking changes smoothly. + SetRedraw(FALSE); + + CloseAllDockers(); + LoadDefaultDockers(); + + // Enable redraw and redraw the frame. + SetRedraw(TRUE); + RedrawWindow(); + return TRUE; +} + +// Issues a close request to the frame to end the program. +BOOL CMainFrame::OnFileExit() +{ + Close(); + return TRUE; +} + +// Limit the minimum size of the window. +LRESULT CMainFrame::OnGetMinMaxInfo(UINT msg, WPARAM wparam, LPARAM lparam) +{ + LPMINMAXINFO lpMMI = (LPMINMAXINFO)lparam; + const CSize minimumSize(600, 400); + lpMMI->ptMinTrackSize.x = DpiScaleInt(minimumSize.cx); + lpMMI->ptMinTrackSize.y = DpiScaleInt(minimumSize.cy); + return FinalWindowProc(msg, wparam, lparam); +} + +// Display the help about dialog. +BOOL CMainFrame::OnHelp() +{ + // Ensure only one dialog displayed even for multiple hits of the F1 button. + if (!m_aboutDialog.IsWindow()) + { + m_aboutDialog.DoModal(*this); + } + + return TRUE; +} + +// Called after the window is created. +void CMainFrame::OnInitialUpdate() +{ + // Attempt to load dock settings from the registry. + if (!LoadDockRegistrySettings(GetRegistryKeyName())) + { + // Load the default dock arrangement if loading from the registry fails. + LoadDefaultDockers(); + } + else + { + // Set menu options from the frame's current dock style. + DWORD style = GetDockStyle(); + + m_use3DBorder = (style & DS_CLIENTEDGE) != 0; + m_disableUndocking = (style & DS_NO_UNDOCK) != 0; + m_disableResize = (style & DS_NO_RESIZE) != 0; + m_disableDockLR = (style & DS_NO_DOCKCHILD_LEFT) != 0; + m_disableDockClose = (style & DS_NO_CLOSE) != 0; + m_disableDockCaption = (style & DS_NO_CAPTION) != 0; + } + + // PreCreate initially set the window as invisible, so show it now. + ShowWindow(GetInitValues().showCmd); +} + +// Updates the menu items before they are displayed. +void CMainFrame::OnMenuUpdate(UINT id) +{ + switch(id) + { + case IDM_3DBORDER: + GetFrameMenu().CheckMenuItem(id, m_use3DBorder ? MF_CHECKED : MF_UNCHECKED); + break; + case IDM_NO_UNDOCK: + GetFrameMenu().CheckMenuItem(id, m_disableUndocking ? MF_CHECKED : MF_UNCHECKED); + break; + case IDM_NO_RESIZE: + GetFrameMenu().CheckMenuItem(id, m_disableResize ? MF_CHECKED : MF_UNCHECKED); + break; + case IDM_NO_DOCK_LR: + GetFrameMenu().CheckMenuItem(id, m_disableDockLR ? MF_CHECKED : MF_UNCHECKED); + break; + case IDM_NO_DOCK_CLOSE: + GetFrameMenu().CheckMenuItem(id, m_disableDockClose ? MF_CHECKED : MF_UNCHECKED); + break; + case IDM_NO_DOCK_CAPTION: + GetFrameMenu().CheckMenuItem(id, m_disableDockCaption ? MF_CHECKED : MF_UNCHECKED); + break; + } + + CDockFrame::OnMenuUpdate(id); +} + +// Toggle the docking caption. +BOOL CMainFrame::OnNoDockCaption() +{ + m_disableDockCaption = !m_disableDockCaption; + SetDockStyles(); + RedrawWindow(); + return TRUE; +} + +// Toggle the ability to close of dockers. +BOOL CMainFrame::OnNoDockClose() +{ + m_disableDockClose = !m_disableDockClose; + SetDockStyles(); + RedrawWindow(); + return TRUE; +} + +// Toggle the ability to dock left or right. +BOOL CMainFrame::OnNoDockLR() +{ + m_disableDockLR = !m_disableDockLR; + SetDockStyles(); + return TRUE; +} + +// Toggle the ability to resize dockers using the splitter bar. +BOOL CMainFrame::OnNoResize() +{ + m_disableResize = !m_disableResize; + SetDockStyles(); + return TRUE; +} + +// Toggle the ability to undock a docker. +BOOL CMainFrame::OnNoUndocking() +{ + m_disableUndocking = !m_disableUndocking; + SetDockStyles(); + return TRUE; +} + +BOOL CMainFrame::OnStylesDefault() +{ + SetDockStylesToDefault(); + RecalcDockLayout(); + return TRUE; +} + +// Specify the CREATESTRUCT parameters before the window is created. +void CMainFrame::PreCreate(CREATESTRUCT& cs) +{ + // Call base class to set defaults + CDockFrame::PreCreate(cs); + + // Hide the window initially by removing the WS_VISIBLE style + cs.style &= ~WS_VISIBLE; +} + +// This function overrides CDocker::RecalcDockLayout to eliminate jitter +// when the dockers are resized. The technique used here is is most +// appropriate for a complex arrangement of dockers. It might not suite +// other docking applications. To support this technique the +// WS_EX_COMPOSITED extended style has been added to each docker. +void CMainFrame::RecalcDockLayout() +{ + if (GetWinVersion() >= 3000) // Windows 10 or later. + { + LockWindowUpdate(); + CDocker::RecalcDockLayout(); + UnlockWindowUpdate(); + UpdateWindow(); + } + else + CDocker::RecalcDockLayout(); +} + +// Save the docking configuration in the registry. +BOOL CMainFrame::SaveRegistrySettings() +{ + if (CDockFrame::SaveRegistrySettings()) + return SaveDockRegistrySettings(GetRegistryKeyName()); + else + return FALSE; +} + +// Sets the style for all the dockers. +void CMainFrame::SetDockStyles() +{ + for (CDocker* docker : GetAllDockers()) + { + DWORD style = docker->GetDockStyle(); + + // Filter unwanted styles + style &= 0xF000F; + + // Add styles selected from the menu + if (m_use3DBorder) style |= DS_CLIENTEDGE; + if (m_disableUndocking) style |= DS_NO_UNDOCK; + if (m_disableResize) style |= DS_NO_RESIZE; + if (m_disableDockLR) style |= DS_NO_DOCKCHILD_LEFT | DS_NO_DOCKCHILD_RIGHT; + if (m_disableDockClose) style |= DS_NO_CLOSE; + if (m_disableDockCaption) style |= DS_NO_CAPTION; + + docker->SetDockStyle(style); + } +} + +void CMainFrame::SetDockStylesToDefault() +{ + m_use3DBorder = true; + m_disableUndocking = false; + m_disableResize = false; + m_disableDockLR = false; + m_disableDockClose = false; + m_disableDockCaption = false; + + SetDockStyles(); +} + +// Specify the icons used in popup menus. +void CMainFrame::SetupMenuIcons() +{ + std::vector data = GetToolBarData(); + if (GetMenuIconHeight() >= 24) + SetMenuIcons(data, lightgray, IDW_MAIN); + else + SetMenuIcons(data, lightgray, IDB_TOOLBAR16); +} + +// Sets the Resource IDs for the toolbar buttons +void CMainFrame::SetupToolBar() +{ + AddToolBarButton( IDM_FILE_NEW, FALSE ); + AddToolBarButton( IDM_FILE_OPEN, FALSE ); + AddToolBarButton( IDM_FILE_SAVE, FALSE ); + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_EDIT_CUT, FALSE ); + AddToolBarButton( IDM_EDIT_COPY, FALSE ); + AddToolBarButton( IDM_EDIT_PASTE, FALSE ); + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_FILE_PRINT, FALSE ); + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_HELP_ABOUT ); +} + +// Process the frame's window messages. +LRESULT CMainFrame::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case WM_GETMINMAXINFO: return OnGetMinMaxInfo(msg, wparam, lparam); + } + + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + return 0; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/Mainfrm.h b/packages/media/cpp/packages/Win32xx/samples/Dock/src/Mainfrm.h new file mode 100644 index 00000000..93203897 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/src/Mainfrm.h @@ -0,0 +1,82 @@ +///////////////////////////// +// Mainfrm.h +// + +#ifndef MAINFRM_H +#define MAINFRM_H + + +#include "Dockers.h" +#include "AboutDialog.h" + +// The docker identifiers (dock IDs) +const int ID_DOCK_CLASSES1 = 1; +const int ID_DOCK_CLASSES2 = 2; +const int ID_DOCK_FILES1 = 3; +const int ID_DOCK_FILES2 = 4; +const int ID_DOCK_SIMPLE1 = 5; +const int ID_DOCK_SIMPLE2 = 6; +const int ID_DOCK_TEXT1 = 7; +const int ID_DOCK_TEXT2 = 8; + + +/////////////////////////////////////////////////////////// +// CMainFrame manages the application's main window. +// The main window is a frame which has a menubar, toolbar, +// statusbar and view window. +class CMainFrame : public CDockFrame +{ +public: + CMainFrame(); + virtual ~CMainFrame() override = default; + virtual HWND Create(HWND parent = 0) override; + +protected: + virtual DockPtr NewDockerFromID(int id) override; + virtual BOOL OnCommand(WPARAM wparam, LPARAM lparam) override; + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual BOOL OnHelp() override; + virtual void OnInitialUpdate() override; + virtual void OnMenuUpdate(UINT id) override; + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual void RecalcDockLayout() override; + virtual BOOL SaveRegistrySettings() override; + virtual void SetupMenuIcons() override; + virtual void SetupToolBar() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CMainFrame(const CMainFrame&) = delete; + CMainFrame& operator=(const CMainFrame&) = delete; + + // Command handlers + BOOL On3DBorder(); + BOOL OnDockCloseAll(); + BOOL OnDockDefault(); + BOOL OnFileExit(); + BOOL OnNoUndocking(); + BOOL OnNoResize(); + BOOL OnNoDockLR(); + BOOL OnNoDockClose(); + BOOL OnNoDockCaption(); + BOOL OnStylesDefault(); + + // Message handles + LRESULT OnGetMinMaxInfo(UINT msg, WPARAM wparam, LPARAM lparam); + + void LoadDefaultDockers(); + void SetDockStyles(); + void SetDockStylesToDefault(); + + // member variables + CAboutDialog m_aboutDialog; + CViewSimple m_view; + bool m_use3DBorder; + bool m_disableUndocking; + bool m_disableResize; + bool m_disableDockLR; + bool m_disableDockClose; + bool m_disableDockCaption; +}; + +#endif //MAINFRM_H diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/Resource.rc b/packages/media/cpp/packages/Win32xx/samples/Dock/src/Resource.rc new file mode 100644 index 00000000..1eaa9c23 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/src/Resource.rc @@ -0,0 +1,237 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "../src/res/PerMonitorV2.manifest" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDW_MAIN MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "E&xit\tAlt+F4", IDM_FILE_EXIT + END + POPUP "&View" + BEGIN + MENUITEM "&Tool Bar", IDW_VIEW_TOOLBAR, CHECKED + MENUITEM "&Status Bar", IDW_VIEW_STATUSBAR, CHECKED + END + POPUP "&Docking" + BEGIN + MENUITEM "&3D Border", IDM_3DBORDER, CHECKED + MENUITEM "Prevent &Undocking", IDM_NO_UNDOCK, CHECKED + MENUITEM "Prevent &Resizing", IDM_NO_RESIZE, CHECKED + MENUITEM "Prevent Dock &Left or Right", IDM_NO_DOCK_LR, CHECKED + MENUITEM "Disable Close Button", IDM_NO_DOCK_CLOSE, CHECKED + MENUITEM "Disable Dock Caption", IDM_NO_DOCK_CAPTION, CHECKED + MENUITEM SEPARATOR + MENUITEM "&Default Dock Layout", IDM_DOCK_DEFAULT + MENUITEM "Default Dock &Styles", IDM_STYLES_DEFAULT + MENUITEM "&Close All", IDM_DOCK_CLOSEALL + END + POPUP "&Help" + BEGIN + MENUITEM "&About\tF1", IDM_HELP_ABOUT + END +END + + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDW_MAIN ICON "../src/res/Docking.ico" +IDI_VIEW ICON "../src/res/view.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_TOOLBAR16 BITMAP "../src/res/Toolbar16.bmp" +IDW_MAIN BITMAP "../src/res/Toolbar24.bmp" +IDW_SDBOTTOM BITMAP "../src/res/SDbottom.bmp" +IDW_SDCENTER BITMAP "../src/res/SDcenter.bmp" +IDW_SDLEFT BITMAP "../src/res/SDleft.bmp" +IDW_SDMIDDLE BITMAP "../src/res/SDmiddle.bmp" +IDW_SDRIGHT BITMAP "../src/res/SDright.bmp" +IDW_SDTOP BITMAP "../src/res/SDtop.bmp" +IDB_CLASSVIEW BITMAP "../src/res/classview.bmp" +IDB_FILEVIEW BITMAP "../src/res/fileview.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Cursor +// + +IDW_SPLITH CURSOR "../src/res/SplitH.cur" +IDW_SPLITV CURSOR "../src/res/SplitV.cur" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDW_ABOUT DIALOGEX 0, 0, 186, 109 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "MS Shell Dlg", 400, 0 +BEGIN + DEFPUSHBUTTON "OK",IDOK,68,60,50,14 + CTEXT "Docking Frame",IDC_STATIC,43,22,99,8 + ICON IDW_MAIN,0,4,4,20,20 + CTEXT "",IDC_STATIC1,53,32,80,8 + CTEXT "",IDC_STATIC2,53,42,80,8 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDW_MAIN ACCELERATORS +BEGIN + "C", IDM_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + "X", IDM_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT + "V", IDM_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT + "Z", IDM_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT + "N", IDM_FILE_NEW, VIRTKEY, CONTROL, NOINVERT + "O", IDM_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT + "P", IDM_FILE_PRINT, VIRTKEY, CONTROL, NOINVERT + "S", IDM_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDW_MAIN "Docking sample" + IDW_VIEW_TOOLBAR "Show or hide the tool bar" + IDW_VIEW_STATUSBAR "Show or hide the status bar" + IDW_INDICATOR_CAPS "CAP" + IDW_INDICATOR_NUM "NUM" + IDW_INDICATOR_SCRL "SCRL" + IDW_READY "Ready" +END + +STRINGTABLE +BEGIN + IDM_FILE_NEW "Create a New Document" + IDM_FILE_OPEN "Open Existing Document" + IDM_FILE_SAVE "Save the Document" + IDM_FILE_SAVEAS "Save the Document with a new name" + IDM_FILE_PRINT "Print the Document" + IDM_FILE_CLOSE "Close Window" + IDM_FILE_EXIT "End the Program" + IDM_EDIT_UNDO "Undo the last action" + IDM_EDIT_REDO "Redo the previously undone action" +END + +STRINGTABLE +BEGIN + IDM_EDIT_CUT "Cut the Selected Contents to the Clipboard" + IDM_EDIT_COPY "Copy the Selected Contents to the Clipboard" + IDM_EDIT_PASTE "Paste the Clipboard Contents to the Document" + IDM_EDIT_DELETE "Erase the selected Contents" +END + +STRINGTABLE +BEGIN + IDM_DOCK_DEFAULT "Restore default dock layout" + IDM_DOCK_CLOSEALL "Close all docked and undocked windows" +END + +STRINGTABLE +BEGIN + IDM_HELP_ABOUT "Display Information about this program" +END + +STRINGTABLE +BEGIN + IDM_3DBORDER "Toggle the display of a 3D border" + IDM_NO_UNDOCK "Toggle the ability to undock a docker" + IDM_NO_RESIZE "Toggle the ability to resize dockers" + IDM_NO_DOCK_LR "Toggle the ability to dock left or right" + IDM_NO_DOCK_CAPTION "Toggle the docking caption" + IDM_NO_DOCK_CLOSE "Toggle the ability to close of dockers" +END + +STRINGTABLE +BEGIN + SC_CLOSE "Close the Window" + SC_MAXIMIZE "Maximize the Window" + SC_MINIMIZE "Minimize the Window" + SC_MOVE "Move the Window" + SC_NEXTWINDOW "Select Next Window" + SC_PREVWINDOW "Select Previous Window" + SC_RESTORE "Restore the Window" + SC_SIZE "Resize the Window" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/StdAfx.cpp b/packages/media/cpp/packages/Win32xx/samples/Dock/src/StdAfx.cpp new file mode 100644 index 00000000..8957144d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/src/StdAfx.cpp @@ -0,0 +1,16 @@ +///////////////////////////// +// StdAfx.cpp +// + +// This file is used for precompiled hearders. Precompiled headers allow +// programs to be recompiled more quickly + +// To use precompiled headers, do the following: +// 1) Add the set of rarely changed headers to stdafx.h +// 2) Include stdafx.h in each cpp file. It must be included first. +// 3) Add stdafx.cpp to your project. +// 4) Turn on precompiled hearders in the project + + +#include "stdafx.h" + diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/Views.cpp b/packages/media/cpp/packages/Win32xx/samples/Dock/src/Views.cpp new file mode 100644 index 00000000..c2a4f3a2 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/src/Views.cpp @@ -0,0 +1,380 @@ +///////////////////////////// +// Views.cpp +// + +#include "stdafx.h" +#include "Views.h" +#include "resource.h" + +constexpr COLORREF red = RGB(255, 0, 0); +constexpr COLORREF magenta = RGB(255, 0, 255); + +///////////////////////////////// +// CViewClasses function definitions +// + +// Destructor. +CViewClasses::~CViewClasses() +{ + if (IsWindow()) + DeleteAllItems(); +} + +// Called when a window handle (HWND) is attached to this object. +void CViewClasses::OnAttach() +{ + // Set the image lists. + SetDPIImages(); + + // Adjust style to show lines and [+] button. + DWORD dwStyle = GetStyle(); + dwStyle |= TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT; + SetStyle(dwStyle); + + DeleteAllItems(); + + // Add some tree-view items. + HTREEITEM htiRoot = InsertItem(L"TreeView", 0, 0); + HTREEITEM htiCTreeViewApp = InsertItem(L"CTreeViewApp", 1, 1, htiRoot); + InsertItem(L"CTreeViewApp()", 3, 3, htiCTreeViewApp); + InsertItem(L"GetMainFrame()", 3, 3, htiCTreeViewApp); + InsertItem(L"InitInstance()", 3, 3, htiCTreeViewApp); + HTREEITEM htiMainFrame = InsertItem(L"CMainFrame", 1, 1, htiRoot); + InsertItem(L"CMainFrame()", 3, 3, htiMainFrame); + InsertItem(L"OnCommand()", 4, 4, htiMainFrame); + InsertItem(L"OnInitialUpdate()", 4, 4, htiMainFrame); + HTREEITEM htiView = InsertItem(L"CView", 1, 1, htiRoot); + InsertItem(L"CView()", 3, 3, htiView); + InsertItem(L"OnInitialUpdate()", 4, 4, htiView); + InsertItem(L"WndProc()", 4, 4, htiView); + + // Expand some tree-view items. + Expand(htiRoot, TVE_EXPAND); + Expand(htiCTreeViewApp, TVE_EXPAND); +} + +// Called in response to a WM_DPICHANGED_BEFOREPARENT message which is sent to child +// windows after a DPI change. A WM_DPICHANGED_BEFOREPARENT is only received when the +// application is DPI_AWARENESS_PER_MONITOR_AWARE. +LRESULT CViewClasses::OnDpiChangedBeforeParent(UINT msg, WPARAM wparam, LPARAM lparam) +{ + SetDPIImages(); + return FinalWindowProc(msg, wparam, lparam); +} + +// Called when the mouse is clicked on the window. +LRESULT CViewClasses::OnMouseActivate(UINT msg, WPARAM wparam, LPARAM lparam) +{ + // Set window focus. The docker will now report this as active. + SetFocus(); + return FinalWindowProc(msg, wparam, lparam); +} + +// Set the CREATESTURCT parameters before the window is created. +void CViewClasses::PreCreate(CREATESTRUCT& cs) +{ + // Call base class to set defaults. + CTreeView::PreCreate(cs); + + if (GetWinVersion() >= 3000) // Windows 10 or later. + cs.dwExStyle |= WS_EX_COMPOSITED; +} + +// Adjusts the listview image sizes in response to window DPI changes. +void CViewClasses::SetDPIImages() +{ + // Resize the image list. + CBitmap bmImage(IDB_CLASSVIEW); + bmImage = DpiScaleUpBitmap(bmImage); + int scale = bmImage.GetSize().cy / 15; + CImageList normalImages; + normalImages.Create(scale * 16, scale * 15, ILC_COLOR32 | ILC_MASK, 1, 0); + normalImages.Add(bmImage, red); + SetImageList(normalImages, TVSIL_NORMAL); + + // Reset the item indentation. + int imageWidth = normalImages.GetIconSize().cx; + SetIndent(imageWidth); +} + +// Process window messages for the tree-view control. +LRESULT CViewClasses::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case WM_DPICHANGED_BEFOREPARENT: return OnDpiChangedBeforeParent(msg, wparam, lparam); + case WM_MOUSEACTIVATE: return OnMouseActivate(msg, wparam, lparam); + } + + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str; + str << e.GetText() << L'\n' << e.GetErrorString(); + ::MessageBox(nullptr, str, L"An exception occurred", MB_ICONERROR); + + return 0; + } +} + + +///////////////////////////////// +// CViewFiles function definitions +// + +// Destructor. +CViewFiles::~CViewFiles() +{ + if (IsWindow()) DeleteAllItems(); +} + +// Insert 4 list view items. +void CViewFiles::InsertItems() +{ + // Add 4th item. + int item = InsertItem(0, L"ListViewApp.h", 2); + SetItemText(item, 1, L"1 KB"); + SetItemText(item, 2, L"C Header file"); + + // add 3rd item. + item = InsertItem(item, L"ListViewApp.cpp", 1); + SetItemText(item, 1, L"3 KB"); + SetItemText(item, 2, L"C++ Source file"); + + // add 2nd item. + item = InsertItem(item, L"main.cpp", 1); + SetItemText(item, 1, L"1 KB"); + SetItemText(item, 2, L"C++ Source file"); + + // add 1st item. + item = InsertItem(item, L"ListView", 0); + SetItemText(item, 2, L"Folder"); +} + +// Called when a window handle (HWND) is attached to the List-View. +void CViewFiles::OnAttach() +{ + // Call the base class function. + CListView::OnAttach(); + + // Set the image lists. + SetDPIImages(); + + // Set the report style. + DWORD dwStyle = GetStyle(); + SetStyle((dwStyle & ~LVS_TYPEMASK) | LVS_REPORT); + + SetColumns(); + InsertItems(); + SetDPIColumnWidths(); + + // Set the extended style to double buffer. + SetExtendedStyle(LVS_EX_DOUBLEBUFFER); +} + +// Called in response to a WM_DPICHANGED_BEFOREPARENT message which is sent to child +// windows after a DPI change. A WM_DPICHANGED_BEFOREPARENT is only received when the +// application is DPI_AWARENESS_PER_MONITOR_AWARE. +LRESULT CViewFiles::OnDpiChangedBeforeParent(UINT msg, WPARAM wparam, LPARAM lparam) +{ + SetDPIImages(); + SetDPIColumnWidths(); + return FinalWindowProc(msg, wparam, lparam); +} + +// Called when the mouse is clicked on the window. +LRESULT CViewFiles::OnMouseActivate(UINT msg, WPARAM wparam, LPARAM lparam) +{ + // Set window focus. The docker will now report this as active. + SetFocus(); + return FinalWindowProc(msg, wparam, lparam); +} + +// Configure the List-view's columns. +void CViewFiles::SetColumns() +{ + // Empty the list. + DeleteAllItems(); + + // Add the column items. + InsertColumn(0, L"Name"); + InsertColumn(1, L"Size"); + InsertColumn(2, L"Type"); + SetDPIColumnWidths(); +} + +// Adjusts the listview column widths in response to window DPI changes. +void CViewFiles::SetDPIColumnWidths() +{ + SetColumnWidth(0, DpiScaleInt(120)); + SetColumnWidth(1, DpiScaleInt(50)); + SetColumnWidth(2, DpiScaleInt(100)); +} + +// Adjusts the listview image sizes in response to window DPI changes. +void CViewFiles::SetDPIImages() +{ + // Set the image lists + CBitmap bmImage(IDB_FILEVIEW); + bmImage = DpiScaleUpBitmap(bmImage); + int scale = bmImage.GetSize().cy / 15; + CImageList smallImages; + smallImages.Create(scale * 16, scale * 15, ILC_COLOR32 | ILC_MASK, 1, 0); + smallImages.Add(bmImage, magenta); + SetImageList(smallImages, LVSIL_SMALL); +} + +// Process the listview window messages. +LRESULT CViewFiles::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case WM_DPICHANGED_BEFOREPARENT: return OnDpiChangedBeforeParent(msg, wparam, lparam); + case WM_MOUSEACTIVATE: return OnMouseActivate(msg, wparam, lparam); + } + + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str; + str << e.GetText() << L'\n' << e.GetErrorString(); + ::MessageBox(nullptr, str, L"An exception occurred", MB_ICONERROR); + + return 0; + } +} + + +/////////////////////////////////// +// CViewSimple function definitions +// + +// Called when part of the window needs to be redrawn. +void CViewSimple::OnDraw(CDC& dc) +{ + // Use the message font for Windows 7 and higher. + if (GetWinVersion() >= 2601) + { + NONCLIENTMETRICS info = GetNonClientMetrics(); + LOGFONT lf = DpiScaleLogfont(info.lfMessageFont, 10); + dc.CreateFontIndirect(lf); + } + + // Centre some text in the window. + CRect rc = GetClientRect(); + dc.DrawText(L"Simple View", -1, rc, DT_CENTER | DT_VCENTER | DT_SINGLELINE); +} + +// Respond to a mouse click on the window. +LRESULT CViewSimple::OnMouseActivate(UINT msg, WPARAM wparam, LPARAM lparam) +{ + // Set window focus. The docker will now report this as active. + SetFocus(); + return FinalWindowProc(msg, wparam, lparam); +} + +// Called when the window is resized. +LRESULT CViewSimple::OnSize(UINT, WPARAM, LPARAM) +{ + Invalidate(); + return 0; +} + +// Set the CREATESTURCT parameters before the window is created. +void CViewSimple::PreCreate(CREATESTRUCT& cs) +{ + // Call base class to set defaults. + CWnd::PreCreate(cs); + + if (GetWinVersion() >= 3000) // Windows 10 or later. + cs.dwExStyle |= WS_EX_COMPOSITED; +} + +// Process the window's messages. +LRESULT CViewSimple::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case WM_MOUSEACTIVATE: return OnMouseActivate(msg, wparam, lparam); + case WM_SIZE: return OnSize(msg, wparam, lparam); + } + + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str; + str << e.GetText() << L'\n' << e.GetErrorString(); + ::MessageBox(nullptr, str, L"An exception occurred", MB_ICONERROR); + + return 0; + } +} + + +///////////////////////////////// +// CViewText function definitions +// + +// Called when a window handle (HWND) is attached to this object. +void CViewText::OnAttach() +{ + SetDPIFont(); + SetWindowText(L"Text Edit Window\r\n\r\n You can type some text here ..."); +} + +// Adjusts the font size in response to window DPI changes. +void CViewText::SetDPIFont() +{ + m_font.CreatePointFont(100, L"Courier New"); + m_font = DpiScaleFont(m_font, 9); + SetFont(m_font); +} + +// Handle the window's messages. +LRESULT CViewText::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/Views.h b/packages/media/cpp/packages/Win32xx/samples/Dock/src/Views.h new file mode 100644 index 00000000..08fc4f41 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/src/Views.h @@ -0,0 +1,108 @@ +////////////////////////////////////////////// +// Views.h +// Declaration of the CViewSimple, CViewText, +// CViewClasses and CViewFiles classes. + +#ifndef VIEWS_H +#define VIEWS_H + + +////////////////////////////////////////// +// CViewClasses manages a tree view control. +// The tree view control displays classes. +class CViewClasses : public CTreeView +{ +public: + CViewClasses() = default; + virtual ~CViewClasses() override; + void SetDPIImages(); + +protected: + virtual void OnAttach() override; + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CViewClasses(const CViewClasses&) = delete; + CViewClasses& operator=(const CViewClasses&) = delete; + + // Message handlers + LRESULT OnDpiChangedBeforeParent(UINT msg, WPARAM wparam, LPARAM lparam); + LRESULT OnMouseActivate(UINT msg, WPARAM wparam, LPARAM lparam); +}; + + +///////////////////////////////////////// +// CViewFiles manages a list view control. +// The list view control displays files. +class CViewFiles : public CListView +{ +public: + CViewFiles() = default; + virtual ~CViewFiles() override; + void SetDPIColumnWidths(); + void SetDPIImages(); + +protected: + virtual void OnAttach() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CViewFiles(const CViewFiles&) = delete; + CViewFiles& operator=(const CViewFiles&) = delete; + + // Message handlers + LRESULT OnDpiChangedBeforeParent(UINT msg, WPARAM wparam, LPARAM lparam); + LRESULT OnMouseActivate(UINT msg, WPARAM wparam, LPARAM lparam); + + void InsertItems(); + void SetColumns(); +}; + + +//////////////////////////////////////// +// CViewSimple manages an simple window. +// Text is rendered by OnDraw. +class CViewSimple : public CWnd +{ +public: + CViewSimple() = default; + virtual ~CViewSimple() override = default; + +protected: + virtual void OnDraw(CDC& dc) override; + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CViewSimple(const CViewSimple&) = delete; + CViewSimple& operator=(const CViewSimple&) = delete; + + // Message handlers + LRESULT OnMouseActivate(UINT msg, WPARAM wparam, LPARAM lparam); + LRESULT OnSize(UINT msg, WPARAM wparam, LPARAM lparam); +}; + + +///////////////////////////////////// +// CViewText manages an edit control. +// The edit control displays text. +class CViewText : public CRichEdit +{ +public: + CViewText() = default; + virtual ~CViewText() override = default; + void SetDPIFont(); + +protected: + virtual void OnAttach() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CViewText(const CViewText&) = delete; + CViewText& operator=(const CViewText&) = delete; + + CFont m_font; +}; + +#endif // VIEWS_H diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/main.cpp b/packages/media/cpp/packages/Win32xx/samples/Dock/src/main.cpp new file mode 100644 index 00000000..4b5ceead --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/src/main.cpp @@ -0,0 +1,40 @@ +///////////////////////////// +// main.cpp +// + +#include "stdafx.h" +#include "DockingApp.h" + +int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPWSTR, _In_ int) +{ + try + { + // Start Win32++. + CDockingApp theApp; + + // Run the application. + return theApp.Run(); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return -1; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/Docking.ico b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/Docking.ico new file mode 100644 index 00000000..575558c8 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/Docking.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/PerMonitorV2.manifest b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/PerMonitorV2.manifest new file mode 100644 index 00000000..d303e5c0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/PerMonitorV2.manifest @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + PerMonitorV2, PerMonitor + + + + + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/SDbottom.bmp b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/SDbottom.bmp new file mode 100644 index 00000000..0942ef90 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/SDbottom.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/SDcenter.bmp b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/SDcenter.bmp new file mode 100644 index 00000000..a1bf71dd Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/SDcenter.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/SDleft.bmp b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/SDleft.bmp new file mode 100644 index 00000000..ec3a4c29 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/SDleft.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/SDmiddle.bmp b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/SDmiddle.bmp new file mode 100644 index 00000000..71fc66ff Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/SDmiddle.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/SDright.bmp b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/SDright.bmp new file mode 100644 index 00000000..12810dfa Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/SDright.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/SDtop.bmp b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/SDtop.bmp new file mode 100644 index 00000000..1f92af41 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/SDtop.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/SplitH.cur b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/SplitH.cur new file mode 100644 index 00000000..bb03d773 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/SplitH.cur differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/SplitV.cur b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/SplitV.cur new file mode 100644 index 00000000..1fd0d55c Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/SplitV.cur differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/Toolbar16.bmp b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/Toolbar16.bmp new file mode 100644 index 00000000..79ad442f Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/Toolbar16.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/Toolbar24.bmp b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/Toolbar24.bmp new file mode 100644 index 00000000..4000d938 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/Toolbar24.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/View.ico b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/View.ico new file mode 100644 index 00000000..c1a1a0fc Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/View.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/classview.bmp b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/classview.bmp new file mode 100644 index 00000000..6b22e786 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/classview.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/fileview.bmp b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/fileview.bmp new file mode 100644 index 00000000..b60f4838 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/Dock/src/res/fileview.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/resource.h b/packages/media/cpp/packages/Win32xx/samples/Dock/src/resource.h new file mode 100644 index 00000000..085541f9 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/src/resource.h @@ -0,0 +1,70 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Resource.rc +// + +// include the Resource IDs defined by Win32++ +#include "default_resource.h" + +//Resource IDs for menu items and ToolBar items +#define IDM_FILE_NEW 121 +#define IDM_FILE_OPEN 122 +#define IDM_FILE_SAVE 123 +#define IDM_FILE_SAVEAS 124 +#define IDM_FILE_PRINT 125 +#define IDM_FILE_CLOSE 126 +#define IDM_FILE_EXIT 127 +#define IDM_EDIT_UNDO 130 +#define IDM_EDIT_REDO 131 +#define IDM_EDIT_CUT 132 +#define IDM_EDIT_COPY 133 +#define IDM_EDIT_PASTE 134 +#define IDM_EDIT_DELETE 135 +#define IDM_HELP_ABOUT 140 + +// Bitmap for small menu icons +#define IDB_TOOLBAR16 142 + +// Icon Resource +#define IDI_VIEW 150 + +// Cursor Resource +#define IDC_SPLITH 151 +#define IDC_SPLITV 152 + +// Bitmap Resource +#define IDB_CLASSVIEW 154 +#define IDB_FILEVIEW 155 + +// Menu Resource +#define IDM_3DBORDER 161 +#define IDM_NO_UNDOCK 162 +#define IDM_NO_RESIZE 163 +#define IDM_NO_DOCK_LR 164 +#define IDM_NO_DOCK_CLOSE 165 +#define IDM_NO_DOCK_CAPTION 166 +#define IDM_DOCK_DEFAULT 167 +#define IDM_STYLES_DEFAULT 168 +#define IDM_DOCK_CLOSEALL 169 + +// About dialog +#define IDC_STATIC1 170 +#define IDC_STATIC2 171 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 159 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 160 +#endif +#endif + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/Dock/src/stdafx.h b/packages/media/cpp/packages/Win32xx/samples/Dock/src/stdafx.h new file mode 100644 index 00000000..08450116 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/Dock/src/stdafx.h @@ -0,0 +1,90 @@ +///////////////////////////// +// StdAfx.h +// + +// This file is used for precompiled headers. +// Rarely modified header files should be included. +// Based on code provided by Lynn Allan. + + +#ifndef STDAFX_H +#define STDAFX_H + + +// Predefinitions for windows.h go here +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +// Specify Win32xx specific predefinitions here +//#define NO_USING_NAMESPACE // Don't use Win32xx namespace + +// Rarely modified header files should be included here +#include // Add support for std::vector +#include // Add support for std::map +#include // Add support for std::string +#include // Add support for stringstream +#include // Add support for the assert macro +#include // Add support for C style printf, sprintf, etc. +#include // Add support for C style character conversions atoi etc. +#include // Add support for C style TCHARs. + +// Add the Win32++ library +#include // Add CWinApp +#include // Add CArchive +#include // Add CAnimation, CComboBox, CComboBoxEx, CDateTime, CHeader, CHotKey, CIPAddress, CProgressBar, CSpinButton, CScrollBar, CSlider, CToolTip +#include // Add CCriticalSection, CThreadLock +#include // Add CString, CStringA, CStringW +#include // Add CDataExchange +#include // Add CDialog, CResizer +#include // Add CDockFrame, CMDIDockFrame +#include // Add CDocker, CDockContainer +#include // Add CException, CFileException, CNotSupportedException, CResourceException, CUserException, CWinException +#include // Add CFile +#include // Add CFileFind +#include // Add CFolderDialog +#include // Add CFrame +#include // Add CDC, CGDIObject, CBitmap, CBrush, CFont, CPalatte, CPen, CRgn +#include // Add CHGlobal +#include // Add CImageList +#include // Add CListView +#include // Add CMDIChild, CMDIFrame, CDockMDIFrame +#include // Add CMenu +#include // Add CMenuBar +#include // Add CMetaFile, CEnhMetaFile +#include // Add CEvent, CMutex, CSemaphore +#include // Add CPropertyPage, CPropertySheet +#include // Add CRebar +#include // Add CPoint, CRect, CSize +#include // Add CRegKey +#include // Add CRichEdit +#include // Add CScrollView +#include // Adds macros, windows header files, and CObject +#include // Add CSocket +#include // Add CStatusBar +#include // Add CButton, CEdit, CListBox +#include // Add CTab, CTabbedMDI +#include // Add AtoT, AtoW, TtoA, TtoW, WtoA, WtoT etc. +#include // Add MenuTheme, ReBarTheme, StatusBarTheme, ToolBarTheme +#include // Add CWinThread +#include // Add CTime +#include // Add CToolBar +#include // Add CTreeView +#include // Add CWebBrowser, CAXHost +#include // Add CWnd + +// WIN32_LEAN_AND_MEAN can't be used with these +#ifndef WIN32_LEAN_AND_MEAN + #include // Add CCommonDialog, CColorDialog, CFileDialog, CFindReplace, CFontDialog + #include // Add CFolderDialogEx + #include // Add CPrintPreview + #include // Add CPageSetupDialog, CPrintDialog + #include // Add CPrintDialogEx + #include // Add CTaskDialog + + // Visual Studio + #if defined (_MSC_VER) + #include // Add CRibbon, CRibbonFrame + #endif + +#endif // define WIN32_LEAN_AND_MEAN + +#endif // define STDAFX_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer.cbp b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer.cbp new file mode 100644 index 00000000..050dc726 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer.cbp @@ -0,0 +1,149 @@ + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer.cbproj b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer.cbproj new file mode 100644 index 00000000..fbb475c2 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer.cbproj @@ -0,0 +1,1548 @@ + + + {39461456-1040-43CB-9B40-5962EF847BB0} + 20.1 + None + True + Release + Win64x + 1048579 + Application + DockContainer + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + JPHNE + .\Embarcadero\$(Platform)\$(Config) + .\Embarcadero\$(Platform)\$(Config) + false + true + true + $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + CppGuiApplication + System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + true + <_TCHARMapping>wchar_t + DockContainer + ..\..\..\include\;..\src\;$(IncludePath) + ..\..\..\include\;..\src\;$(ILINK_LibraryPath) + 3081 + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + $(BDSINCLUDE)\windows\sdk;$(BRCC_IncludePath) + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + ..\src\stdafx.h + none + + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + false + true + false + true + _DEBUG;$(Defines) + false + None + DEBUG + true + true + true + true + Full + true + true + true + true + true + $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) + $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + + + PerMonitorV2 + false + $(BDSLIB)\$(PLATFORM)$(CC_SUFFIX)\debug;$(ILINK_LibraryPath) + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + + + NDEBUG;$(Defines) + None + + + PerMonitorV2 + false + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 72 + + + 0 + + + 1 + + + 2 + + + 3 + + + 4 + + + 5 + + + 6 + + + 7 + + + 8 + + + 9 + + + 10 + + + 11 + + + 12 + + + 13 + + +
Resource.res
+ 14 +
+ + 15 + + + 16 + true + + + 18 + + + 19 + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + +
+ + CPlusPlusBuilder.Personality.12 + CppGuiApplication + + + + False + True + True + False + + + Embarcadero C++Builder Office 2000 Servers Package + Embarcadero C++Builder Office XP Servers Package + + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + Assets\ + Logo150x150.png + true + + + + + Assets\ + Logo44x44.png + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + DockContainer.exe + true + + + + + DockContainer.exe + true + + + + + DockContainer.exe + true + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 64 + + + classes + 64 + + + + + res\xml + 1 + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\mips + 1 + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-v21 + 1 + + + res\values-v21 + 1 + + + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + Contents + 1 + + + Contents + 1 + + + Contents + 1 + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + library\lib\armeabi-v7a + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen + 64 + + + ..\$(PROJECTNAME).launchscreen + 64 + + + + + 1 + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + + + + + + + + + + + + + True + True + True + + + 12 + + + + +
diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2015.sln b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2015.sln new file mode 100644 index 00000000..bb4529a3 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2015.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DockContainer", "DockContainer_2015.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2015.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2015.vcxproj new file mode 100644 index 00000000..fae79215 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2015.vcxproj @@ -0,0 +1,258 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DockContainer + DockContainer + + + + Application + Unicode + v140_xp + + + Application + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + + + + + + + + + + + + + + + + + true + false + + + true + false + + + false + false + + + false + false + + + + Use + Level4 + true + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2015.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2015.vcxproj.filters new file mode 100644 index 00000000..efd04f84 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2015.vcxproj.filters @@ -0,0 +1,251 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Win32++ + + + + + {3ede9f97-a0ad-47e9-9a86-a431187a760c} + + + {ff707498-582b-4617-85e9-a1ddb105c3f4} + + + {9e82f325-6d79-44e9-bf64-7ca5a59e6bd5} + + + {76418c0e-5b3f-4ee4-b181-b7515bece856} + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2019.sln b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2019.sln new file mode 100644 index 00000000..f99f3527 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2019.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DockContainer", "DockContainer_2019.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5514E3AE-DD6F-4210-AEE7-745A509E3C4C} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2019.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2019.vcxproj new file mode 100644 index 00000000..ec511833 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2019.vcxproj @@ -0,0 +1,234 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DockContainer + DockContainer + + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2019.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2019.vcxproj.filters new file mode 100644 index 00000000..efd7bcad --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2019.vcxproj.filters @@ -0,0 +1,245 @@ + + + + + {e44c1756-6903-4f29-a26f-cd093215f6dc} + + + {030d4f83-96a5-4d23-a4ce-77c544a3bb8d} + + + {a47f7abb-ff98-49f7-8d1b-44afddc3b905} + + + {3cd59aef-3353-4eb8-88fb-e6383ff7839c} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2022.sln b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2022.sln new file mode 100644 index 00000000..aa6ce140 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2022.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DockContainer", "DockContainer_2022.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {94374FA6-430E-4ABD-B381-8668FE781CFD} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2022.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2022.vcxproj new file mode 100644 index 00000000..822e577c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2022.vcxproj @@ -0,0 +1,245 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DockContainer + DockContainer + 10.0 + + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2022.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2022.vcxproj.filters new file mode 100644 index 00000000..efd7bcad --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2022.vcxproj.filters @@ -0,0 +1,245 @@ + + + + + {e44c1756-6903-4f29-a26f-cd093215f6dc} + + + {030d4f83-96a5-4d23-a4ce-77c544a3bb8d} + + + {a47f7abb-ff98-49f7-8d1b-44afddc3b905} + + + {3cd59aef-3353-4eb8-88fb-e6383ff7839c} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2026.slnx b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2026.slnx new file mode 100644 index 00000000..59c19f0d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2026.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2026.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2026.vcxproj new file mode 100644 index 00000000..ed8e91c5 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2026.vcxproj @@ -0,0 +1,245 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DockContainer + DockContainer + 10.0 + + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2026.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2026.vcxproj.filters new file mode 100644 index 00000000..aa434fff --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_2026.vcxproj.filters @@ -0,0 +1,245 @@ + + + + + {e44c1756-6903-4f29-a26f-cd093215f6dc} + + + {030d4f83-96a5-4d23-a4ce-77c544a3bb8d} + + + {a47f7abb-ff98-49f7-8d1b-44afddc3b905} + + + {3cd59aef-3353-4eb8-88fb-e6383ff7839c} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Win32++ + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_DEBUG.dev b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_DEBUG.dev new file mode 100644 index 00000000..ee1fd00a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_DEBUG.dev @@ -0,0 +1,342 @@ +[Project] +FileName=DockContainer_DEBUG.dev +Name=ContainerDocking +UnitCount=19 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=ContainerDocking_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D _DEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@__@@__@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Debug +ObjectOutput=.\Dev-C++\Debug +OverrideOutput=1 +OverrideOutputName=ContainerDocking.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=4 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[Unit2] +FileName=..\src\Classes.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\Files.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\Files.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\main.cpp +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit10] +FileName=..\src\Output.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit11] +FileName=..\src\Output.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit13] +FileName=..\src\Resource.rc +CompileCpp=1 +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit14] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit15] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit16] +FileName=..\src\Text.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit17] +FileName=..\src\Text.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit18] +FileName=..\src\MainContainer.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit19] +FileName=..\src\MainContainer.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit20] +FileName=..\src\MainContainer.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit21] +FileName=..\src\Text.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit22] +FileName=..\src\Text.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit23] +FileName=Simple.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit24] +FileName=Text.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit25] +FileName=Text.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit26] +FileName=Output.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit1] +FileName=..\src\Classes.cpp +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit3] +FileName=..\src\ContainerApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\ContainerApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit8] +FileName=..\src\Mainfrm.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\Mainfrm.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit12] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit27] +FileName=Output.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit30] +FileName=ComboBoxEx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit31] +FileName=ComboBoxEx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_RELEASE.dev b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_RELEASE.dev new file mode 100644 index 00000000..90440887 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/ProjectFiles/DockContainer_RELEASE.dev @@ -0,0 +1,292 @@ +[Project] +FileName=DockContainer_RELEASE.dev +Name=ContainerDocking +UnitCount=19 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=ContainerDocking_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D NDEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-s_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Release +ObjectOutput=.\Dev-C++\Release +OverrideOutput=1 +OverrideOutputName=ContainerDocking.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=3 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[Unit3] +FileName=..\src\ContainerApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\ContainerApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\Files.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\Files.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\main.cpp +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit8] +FileName=..\src\Mainfrm.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\Mainfrm.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit10] +FileName=..\src\Output.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit11] +FileName=..\src\Output.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit12] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit13] +FileName=..\src\Resource.rc +CompileCpp=1 +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit14] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit15] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit16] +FileName=..\src\Text.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit17] +FileName=..\src\Text.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit18] +FileName=..\src\MainContainer.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit1] +FileName=..\src\Classes.cpp +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit2] +FileName=..\src\Classes.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit19] +FileName=..\src\MainContainer.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit20] +FileName=..\src\MainContainer.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit30] +FileName=ComboBoxEx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit31] +FileName=ComboBoxEx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit21] +FileName=..\src\Text.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit22] +FileName=..\src\Text.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/DockContainer/Readme.txt new file mode 100644 index 00000000..f9fe49e0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/Readme.txt @@ -0,0 +1,31 @@ +DockContainer Example +===================== +This example demonstrates "container" docking. Dock containers are a +specialised view window for dockers. They are a tab control which provide +support for tab undocking, and "container within container docking" where +docking the container adds a tab to the container. They also provide an +optional toolbar. Containers in turn have their own "view window" + +The dock containers are the view window for dockers, allowing them to be +undocked and docked as required. + +Classes titled CDockXXXX are inherited from CDocker. Classes titled +CContainerXXXX are inherited from CDockContainer. Classes titled CViewXXXX +are the various view windows inherited from CListView, CTreeView, CRichEdit. + +CMainFrame inherits from CDockFrame. + +Refer to the documentation for further information on the use of the CDocker +and CDockContainer classes. + + +Features demonstrated in this example +===================================== +* Use of CDockFrame to provide a frame window. +* Use of CDockFrame as a docker. +* Use of CContainer as a view window for CDocker. +* Use of RichEdit, ListView and TreeViews as view windows for CDockContainer. +* Use of the container's optional toolbar. +* Displaying tabs at the top or bottom of the container. +* The use of several docking styles. +* Saving the dock layout in the registry. diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/AboutDialog.h b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/AboutDialog.h new file mode 100644 index 00000000..71e4364d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/AboutDialog.h @@ -0,0 +1,31 @@ +///////////////////////////////////////////// +// AboutDialog.h + +#ifndef _ABOUTDIALOG_H_ +#define _ABOUTDIALOG_H_ + +#include "resource.h" + +//////////////////////////////////////////////////////// +// CAboutDialog manages the dialog which displays +// information about this program. +class CAboutDialog : public CDialog +{ +public: + CAboutDialog() : CDialog(IDW_ABOUT) {} + virtual BOOL OnInitDialog() override + { + // Set the Win32++ version string. + UINT ver = _WIN32XX_VER; + CString Win32xxVersion; + Win32xxVersion << "Win32++ Version " << ver / 0x100 << "." << + (ver % 0x100) / 0x10 << "." << (ver % 0x10); + + SetDlgItemText(IDC_STATIC1, Win32xxVersion); + SetDlgItemText(IDC_STATIC2, L"by David Nash"); + + return TRUE; + } +}; + +#endif // _ABOUTDIALOG_H_ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Classes.cpp b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Classes.cpp new file mode 100644 index 00000000..fb08d5f4 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Classes.cpp @@ -0,0 +1,305 @@ +/////////////////////////////////////////////////// +// Classes.cpp - Definitions for the CViewClasses, CContainClasses +// and CDockClasses classes +// + + +#include "stdafx.h" +#include "Classes.h" +#include "resource.h" + +constexpr COLORREF lightgray = RGB(192, 192, 192); +constexpr COLORREF red = RGB(255, 0, 0); + +//////////////////////////////////// +// CViewClasses function definitions +// + +// Destructor. +CViewClasses::~CViewClasses() +{ + if (IsWindow()) DeleteAllItems(); +} + +// Called when a window handle (HWND) is attached to CViewClasses. +void CViewClasses::OnAttach() +{ + // Set the image lists + SetDPIImages(); + + // Adjust style to show lines and [+] button + DWORD dwStyle = GetStyle(); + dwStyle |= TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT; + SetStyle(dwStyle); + + DeleteAllItems(); + + // Add some tree-view items + HTREEITEM htiRoot = InsertItem(L"TreeView", 0, 0); + HTREEITEM htiCTreeViewApp = InsertItem(L"CTreeViewApp", 1, 1, htiRoot); + InsertItem(L"CTreeViewApp()", 3, 3, htiCTreeViewApp); + InsertItem(L"GetMainFrame()", 3, 3, htiCTreeViewApp); + InsertItem(L"InitInstance()", 3, 3, htiCTreeViewApp); + HTREEITEM htiMainFrame = InsertItem(L"CMainFrame", 1, 1, htiRoot); + InsertItem(L"CMainFrame()", 3, 3, htiMainFrame); + InsertItem(L"OnCommand()", 4, 4, htiMainFrame); + InsertItem(L"OnInitialUpdate()", 4, 4, htiMainFrame); + HTREEITEM htiView = InsertItem(L"CView", 1, 1, htiRoot); + InsertItem(L"CView()", 3, 3, htiView); + InsertItem(L"OnInitialUpdate()", 4, 4, htiView); + InsertItem(L"WndProc()", 4, 4, htiView); + + // Expand some tree-view items + Expand(htiRoot, TVE_EXPAND); + Expand(htiCTreeViewApp, TVE_EXPAND); +} + +// Respond to a mouse click on the window. +LRESULT CViewClasses::OnMouseActivate(UINT msg, WPARAM wparam, LPARAM lparam) +{ + // Set window focus. The docker will now report this as active. + SetFocus(); + return FinalWindowProc(msg, wparam, lparam); +} + +// Called in response to a WM_DPICHANGED_BEFOREPARENT message which is sent to child +// windows after a DPI change. A WM_DPICHANGED_BEFOREPARENT is only received when the +// application is DPI_AWARENESS_PER_MONITOR_AWARE. +LRESULT CViewClasses::OnDpiChangedBeforeParent(UINT msg, WPARAM wparam, LPARAM lparam) +{ + SetDPIImages(); + return FinalWindowProc(msg, wparam, lparam); +} + +// Adjusts the treeview image sizes in response to window DPI changes. +void CViewClasses::SetDPIImages() +{ + // Resize the image list. + CBitmap bmImage(IDB_CLASSVIEW); + bmImage = DpiScaleUpBitmap(bmImage); + int scale = bmImage.GetSize().cy / 15; + CImageList normalImages; + normalImages.Create(scale * 16, scale * 15, ILC_COLOR32 | ILC_MASK, 1, 0); + normalImages.Add(bmImage, red); + SetImageList(normalImages, TVSIL_NORMAL); + + // Reset the item indentation. + int imageWidth = normalImages.GetIconSize().cx; + SetIndent(imageWidth); +} + +void CViewClasses::PreCreate(CREATESTRUCT& cs) +{ + // Call base class to set defaults. + CTreeView::PreCreate(cs); + + // Add the WS_EX_COMPOSITED to reduce flicker. + if (GetWinVersion() >= 3000) // Windows 10 or later. + cs.dwExStyle |= WS_EX_COMPOSITED; +} + +// Process the tree-view's window messages. +LRESULT CViewClasses::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case WM_MOUSEACTIVATE: return OnMouseActivate(msg, wparam, lparam); + case WM_DPICHANGED_BEFOREPARENT: return OnDpiChangedBeforeParent(msg, wparam, lparam); + } + + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + + +/////////////////////////////////////// +// CContainClasses function definitions +// + +// Constructor. +CContainClasses::CContainClasses() +{ + SetTabText(L"ClassView"); + SetTabIcon(IDI_CLASSVIEW); + SetDockCaption (L"Class View - Docking container"); + SetView(m_viewClasses); +} + +// Process the command messages (WM_COMMAND). +BOOL CContainClasses::OnCommand(WPARAM wparam, LPARAM) +{ + // OnCommand responds to menu and and toolbar input + UINT id = LOWORD(wparam); + switch(id) + { + case IDM_FILE_NEW: return OnFileNew(); + case IDM_HELP_ABOUT: return OnHelpAbout(); + } + + return FALSE; +} + +// Demonstrates responding to the container's toolbar. +BOOL CContainClasses::OnFileNew() +{ + TRACE("File New\n"); + MessageBox(L"File New", L"Button Pressed", MB_OK); + return TRUE; +} + +// Demonstrates responding to the container's toolbar. +// Invokes the program's Help About dialog. +BOOL CContainClasses::OnHelpAbout() +{ + // Send a message to the frame requesting the help dialog + GetAncestor().SendMessage(WM_HELP); + return TRUE; +} + +// Set the Bitmap resource for the toolbar +void CContainClasses::SetupToolBar() +{ + SetToolBarImages(lightgray, IDW_MAIN, 0, 0); + + // Set the Resource IDs for the toolbar buttons + AddToolBarButton(IDM_FILE_NEW); + AddToolBarButton(IDM_FILE_OPEN, FALSE); + + AddToolBarButton(0); // Separator + AddToolBarButton(IDM_FILE_SAVE, FALSE); + + AddToolBarButton(0); // Separator + AddToolBarButton(IDM_EDIT_CUT); + AddToolBarButton(IDM_EDIT_COPY); + AddToolBarButton(IDM_EDIT_PASTE); + + AddToolBarButton(0); // Separator + AddToolBarButton(IDM_FILE_PRINT, FALSE); + + AddToolBarButton(0); // Separator + AddToolBarButton(IDM_HELP_ABOUT); +} + +// Handle the window's messages. +LRESULT CContainClasses::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + + +//////////////////////////////////// +// CDockClasses function definitions +// + +// Constructor. +CDockClasses::CDockClasses() +{ + SetView(m_classes); + + // Set the width of the splitter bar + SetBarWidth(8); +} + +// This function overrides CDocker::RecalcDockLayout to eliminate jitter +// when the dockers are resized. The technique used here is is most +// appropriate for a complex arrangement of dockers. It might not suite +// other docking applications. To support this technique the +// WS_EX_COMPOSITED extended style has been added to each docker. +void CDockClasses::RecalcDockLayout() +{ + if (GetWinVersion() >= 3000) // Windows 10 or later. + { + if (GetDockAncestor()->IsWindow()) + { + GetTopmostDocker()->LockWindowUpdate(); + CRect rc = GetTopmostDocker()->GetViewRect(); + GetTopmostDocker()->RecalcDockChildLayout(rc); + GetTopmostDocker()->UnlockWindowUpdate(); + GetTopmostDocker()->UpdateWindow(); + } + } + else + CDocker::RecalcDockLayout(); +} + +// Handle the window's messages. +LRESULT CDockClasses::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Classes.h b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Classes.h new file mode 100644 index 00000000..37b994dd --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Classes.h @@ -0,0 +1,84 @@ +////////////////////////////////////////////////////////// +// Classes.h - Declaration of CViewClasses, CContainClasses, +// and CDockClasses classes +// + +#ifndef CLASSES_H +#define CLASSES_H + + +/////////////////////////////////////////////// +// CViewClasses manages a tree view control. +// This is the view window for CContainClasses, +// and is used to display classes. +class CViewClasses : public CTreeView +{ +public: + CViewClasses() = default; + virtual ~CViewClasses() override; + void SetDPIImages(); + +protected: + virtual void OnAttach() override; + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CViewClasses(const CViewClasses&) = delete; + CViewClasses& operator=(const CViewClasses&) = delete; + + // Command handlers + LRESULT OnDpiChangedBeforeParent(UINT msg, WPARAM wparam, LPARAM lparam); + LRESULT OnMouseActivate(UINT msg, WPARAM wparam, LPARAM lparam); +}; + + +//////////////////////////////////////////////////// +// CContainClasses manages a dock container. It uses +// CViewClasses as its view. +class CContainClasses : public CDockContainer +{ +public: + CContainClasses(); + virtual ~CContainClasses() override = default; + +protected: + virtual BOOL OnCommand(WPARAM, LPARAM) override; + virtual void SetupToolBar() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CContainClasses(const CContainClasses&) = delete; + CContainClasses& operator=(const CContainClasses&) = delete; + + // Command handlers + BOOL OnFileNew(); + BOOL OnHelpAbout(); + + // Member variables + CViewClasses m_viewClasses; +}; + + +///////////////////////////////////////// +// CDockClasses manages a docker. It uses +// CContainClasses as its view. +class CDockClasses : public CDocker +{ +public: + CDockClasses(); + virtual ~CDockClasses() override = default; + +protected: + virtual void RecalcDockLayout() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CDockClasses(const CDockClasses&) = delete; + CDockClasses& operator=(const CDockClasses&) = delete; + + CContainClasses m_classes; +}; + + +#endif //CLASSES_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/ContainerApp.cpp b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/ContainerApp.cpp new file mode 100644 index 00000000..5aa6353c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/ContainerApp.cpp @@ -0,0 +1,22 @@ +///////////////////////////// +// ContainerApp.cpp +// + +#include "stdafx.h" +#include "ContainerApp.h" + + +////////////////////////////////////////////// +// CDockContainerApp function definitions +// + +// Called when the application starts. +BOOL CDockContainerApp::InitInstance() +{ + // Create the frame window. + m_frame.Create(); // throws a CWinException on failure + + return TRUE; +} + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/ContainerApp.h b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/ContainerApp.h new file mode 100644 index 00000000..02b99e3c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/ContainerApp.h @@ -0,0 +1,32 @@ +///////////////////////////// +// ContainerApp.h +// + +#ifndef CONTAINERAPP_H +#define CONTAINERAPP_H + +#include "Mainfrm.h" + + +///////////////////////////////////////////////////////////////// +// CDockContainerApp manages the application. It initializes the +// Win32++ framework when it is constructed, and creates the main +// frame window when it runs. +class CDockContainerApp : public CWinApp +{ +public: + CDockContainerApp() = default; + virtual ~CDockContainerApp() override = default; + +protected: + virtual BOOL InitInstance() override; + +private: + CDockContainerApp(const CDockContainerApp&) = delete; + CDockContainerApp& operator=(const CDockContainerApp&) = delete; + + CMainFrame m_frame; +}; + + +#endif // CONTAINERAPP_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Files.cpp b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Files.cpp new file mode 100644 index 00000000..4e9fdf04 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Files.cpp @@ -0,0 +1,270 @@ +////////////////////////////////////////////// +// Files.cpp - Definitions for CViewFiles, CContainFiles +// and DockFiles classes + +#include "stdafx.h" +#include "Files.h" +#include "resource.h" + +constexpr COLORREF magenta = RGB(255, 0, 255); + +////////////////////////////////// +// CViewFiles function definitions +// + +// Destructor. +CViewFiles::~CViewFiles() +{ + if (IsWindow()) DeleteAllItems(); +} + +// Insert 4 list view items. +void CViewFiles::InsertItems() +{ + // Add 4th item + int item = InsertItem(0, L"ListViewApp.h", 2); + SetItemText(item, 1, L"1 KB"); + SetItemText(item, 2, L"C Header file"); + + // add 3rd item + item = InsertItem(item, L"ListViewApp.cpp", 1); + SetItemText(item, 1, L"3 KB"); + SetItemText(item, 2, L"C++ Source file"); + + // add 2nd item + item = InsertItem(item, L"main.cpp", 1); + SetItemText(item, 1, L"1 KB"); + SetItemText(item, 2, L"C++ Source file"); + + // add 1st item + item = InsertItem(item, L"ListView", 0); + SetItemText(item, 2, L"Folder"); +} + +// Called when a window handle (HWND) is attached to CViewFiles. +void CViewFiles::OnAttach() +{ + // Call the base class function. + CListView::OnAttach(); + + // Set the image lists. + SetDPIImages(); + + // Set the report style. + DWORD style = GetStyle(); + SetStyle((style & ~LVS_TYPEMASK) | LVS_REPORT); + + SetColumns(); + InsertItems(); + SetDPIColumnWidths(); + + // Set the extended style to double buffer. + SetExtendedStyle(LVS_EX_DOUBLEBUFFER); +} + +// Respond to a mouse click on the window +LRESULT CViewFiles::OnMouseActivate(UINT msg, WPARAM wparam, LPARAM lparam) +{ + // Set window focus. The docker will now report this as active. + SetFocus(); + return FinalWindowProc(msg, wparam, lparam); +} + +// Called in response to a WM_DPICHANGED_BEFOREPARENT message which is sent to child +// windows after a DPI change. A WM_DPICHANGED_BEFOREPARENT is only received when the +// application is DPI_AWARENESS_PER_MONITOR_AWARE. +LRESULT CViewFiles::OnDpiChangedBeforeParent(UINT msg, WPARAM wparam, LPARAM lparam) +{ + SetRedraw(FALSE); + SetDPIImages(); + SetDPIColumnWidths(); + + SetRedraw(TRUE); + RedrawWindow(); + return FinalWindowProc(msg, wparam, lparam); +} + +// Configures the list-view's columns (its header control). +void CViewFiles::SetColumns() +{ + // empty the list + DeleteAllItems(); + + // Add the column items. + InsertColumn(0, L"Name"); + InsertColumn(1, L"Size"); + InsertColumn(2, L"Type"); + SetDPIColumnWidths(); +} + +// Adjusts the listview column widths in response to window DPI changes. +void CViewFiles::SetDPIColumnWidths() +{ + SetColumnWidth(0, DpiScaleInt(120)); + SetColumnWidth(1, DpiScaleInt(50)); + SetColumnWidth(2, DpiScaleInt(100)); +} + +// Adjusts the listview image sizes in response to window DPI changes. +void CViewFiles::SetDPIImages() +{ + // Set the image lists + CBitmap bmImage(IDB_FILEVIEW); + bmImage = DpiScaleUpBitmap(bmImage); + int scale = bmImage.GetSize().cy / 15; + CImageList smallImages; + smallImages.Create(scale * 16, scale * 15, ILC_COLOR32 | ILC_MASK, 1, 0); + smallImages.Add(bmImage, magenta); + SetImageList(smallImages, LVSIL_SMALL); +} + +// Process the list-view's window messages. +LRESULT CViewFiles::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case WM_MOUSEACTIVATE: return OnMouseActivate(msg, wparam, lparam); + case WM_DPICHANGED_BEFOREPARENT: return OnDpiChangedBeforeParent(msg, wparam, lparam); + } + + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + + +///////////////////////////////////// +// CContainFiles function definitions +// + +// Constructor. +CContainFiles::CContainFiles() +{ + SetTabText(L"FileView"); + SetTabIcon(IDI_FILEVIEW); + SetDockCaption (L"File View - Docking container"); + SetView(m_viewFiles); +} + +// Handle the window's messages. +LRESULT CContainFiles::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + + +/////////////////////////////////// +// CDockFiles function definitions +// + +// Constructor. +CDockFiles::CDockFiles() +{ + SetView(m_files); + + // Set the width of the splitter bar. + SetBarWidth(8); +} + +// This function overrides CDocker::RecalcDockLayout to eliminate jitter +// when the dockers are resized. The technique used here is is most +// appropriate for a complex arrangement of dockers. It might not suite +// other docking applications. To support this technique the +// WS_EX_COMPOSITED extended style has been added to each docker. +void CDockFiles::RecalcDockLayout() +{ + if (GetWinVersion() >= 3000) // Windows 10 or later. + { + if (GetDockAncestor()->IsWindow()) + { + GetTopmostDocker()->LockWindowUpdate(); + CRect rc = GetTopmostDocker()->GetViewRect(); + GetTopmostDocker()->RecalcDockChildLayout(rc); + GetTopmostDocker()->UnlockWindowUpdate(); + GetTopmostDocker()->UpdateWindow(); + } + } + else + CDocker::RecalcDockLayout(); +} + +// Handle the window's messages. +LRESULT CDockFiles::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Files.h b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Files.h new file mode 100644 index 00000000..d96bbcfe --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Files.h @@ -0,0 +1,79 @@ +///////////////////////////////////////////////////////// +// Files.h - Declaration of the CViewFiles, CContainFiles +// and CDockFiles classes. +// + +#ifndef FILES_H +#define FILES_H + + +///////////////////////////////////////////////////////////// +// CViewFiles manages a list view control. It displays files. +// This is the view window for CContainClasses. +class CViewFiles : public CListView +{ +public: + CViewFiles() = default; + virtual ~CViewFiles() override; + void SetDPIColumnWidths(); + void SetDPIImages(); + +protected: + virtual void OnAttach() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CViewFiles(const CViewFiles&) = delete; + CViewFiles& operator=(const CViewFiles&) = delete; + + // Command handlers + LRESULT OnMouseActivate(UINT msg, WPARAM wparam, LPARAM lparam); + LRESULT OnDpiChangedBeforeParent(UINT msg, WPARAM wparam, LPARAM lparam); + + void InsertItems(); + void SetColumns(); +}; + + +////////////////////////////////////////////////// +// CContainFiles manages a dock container. It uses +// CViewFiles as its view. +class CContainFiles : public CDockContainer +{ +public: + CContainFiles(); + virtual ~CContainFiles() override = default; + +protected: + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CContainFiles(const CContainFiles&) = delete; + CContainFiles& operator=(const CContainFiles&) = delete; + + CViewFiles m_viewFiles; +}; + + +///////////////////////////////////////////////////// +// CDockFiles manages a docker. It uses CContainFiles +// as its view. +class CDockFiles : public CDocker +{ +public: + CDockFiles(); + virtual ~CDockFiles() override = default; + +protected: + virtual void RecalcDockLayout() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CDockFiles(const CDockFiles&) = delete; + CDockFiles& operator=(const CDockFiles&) = delete; + + CContainFiles m_files; +}; + + +#endif // FILES_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/MainContainer.cpp b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/MainContainer.cpp new file mode 100644 index 00000000..6335d019 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/MainContainer.cpp @@ -0,0 +1,74 @@ +///////////////////////////// +// MainContainer.cpp +// + +#include "stdafx.h" +#include "MainContainer.h" + + +/////////////////////////////////////// +// CMainContainer function definitions +// + + +void CMainContainer::AddContainer(CDockContainer* pContainer, BOOL insert, BOOL selectPage) +{ + // Call the base class function first. + CDockContainer::AddContainer(pContainer, insert, selectPage); + + // Use different dock styles when we have a single tab vs multiple tabs. + DWORD dockStyle = GetDocker()->GetDockStyle(); + if (GetItemCount() > 1) + dockStyle = dockStyle & ~(DS_NO_CLOSE | DS_NO_UNDOCK); + else + dockStyle = dockStyle | DS_NO_CLOSE | DS_NO_UNDOCK; + + GetDocker()->SetDockStyle(dockStyle); +} + +void CMainContainer::RemoveContainer(CDockContainer* pContainer, BOOL updateParent) +{ + // Call the base class function first. + CDockContainer::RemoveContainer(pContainer, updateParent); + + // Use different dock styles when we have a single tab vs multiple tabs. + DWORD dockStyle = GetDocker()->GetDockStyle(); + if (GetItemCount() > 1) + dockStyle = dockStyle & ~(DS_NO_CLOSE | DS_NO_UNDOCK); + else + dockStyle = dockStyle | DS_NO_CLOSE | DS_NO_UNDOCK; + + GetDocker()->SetDockStyle(dockStyle); +} + +// Handle the window's messages. +LRESULT CMainContainer::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/MainContainer.h b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/MainContainer.h new file mode 100644 index 00000000..ef8d86df --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/MainContainer.h @@ -0,0 +1,28 @@ +////////////////////////////////////////////////////////////// +// MainContainer.h - Declaration of the CMainContainer classes +// + +#ifndef _MAIN_CONTAINER_H_ +#define _MAIN_CONTAINER_H_ + +///////////////////////////////////////////////////////////// +// CMainContainer manages the dock frame's dock container. +// It ensures the dock frame's dock container has at least +// one tab that can't be undocked or closed. +class CMainContainer : public CDockContainer +{ +public: + CMainContainer() = default; + virtual ~CMainContainer() override = default; + +protected: + virtual void AddContainer(CDockContainer* pContainer, BOOL insert, BOOL selectPage) override; + virtual void RemoveContainer(CDockContainer* pContainer, BOOL updateParent) override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CMainContainer(const CMainContainer&) = delete; + CMainContainer& operator=(const CMainContainer&) = delete; +}; + +#endif // _MAIN_CONTAINER_H_ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Mainfrm.cpp b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Mainfrm.cpp new file mode 100644 index 00000000..fe2e7973 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Mainfrm.cpp @@ -0,0 +1,371 @@ +///////////////////////////// +// Mainfrm.cpp +// + +#include "stdafx.h" +#include "Mainfrm.h" +#include "Classes.h" +#include "Files.h" +#include "Output.h" +#include "Text.h" +#include "resource.h" + +using namespace std; + +constexpr COLORREF lightgray = RGB(192, 192, 192); + +////////////////////////////////// +// CMainFrame function definitions +// + +// Constructor for CMainFrame. +CMainFrame::CMainFrame() : m_isContainerTabsAtTop(false), m_hideSingleTab(true) +{ +} + +// Create the frame window. +HWND CMainFrame::Create(HWND parent) +{ + // Set m_view as the view window of the frame. + SetView(m_view); + + // Set the registry key name, and load the initial window position. + // Use a registry key name like "CompanyName\\Application". + LoadRegistrySettings(L"Win32++\\DockContainer"); + + return CDockFrame::Create(parent); +} + +// Hides or shows the tab for a container with a single tab. +void CMainFrame::HideSingleContainerTab(bool hideSingle) +{ + m_hideSingleTab = hideSingle; + + // Set the Tab position for each container + for (CDocker* docker : GetAllDockers()) + { + CDockContainer* pContainer = docker->GetContainer(); + if (pContainer && pContainer->IsWindow()) + { + pContainer->SetHideSingleTab(hideSingle); + } + } +} + +// Loads the default arrangement of dockers. +void CMainFrame::LoadDefaultDockers() +{ + // Note: The DockIDs are used for saving/restoring the dockers state in the registry. + + DWORD style = DS_CLIENTEDGE; // The style added to each docker + + // Add the right most dockers. + CDocker* pDockRight = AddDockedChild(make_unique(), DS_DOCKED_RIGHT | style, DpiScaleInt(200), ID_DOCK_CLASSES1); + pDockRight->AddDockedChild(make_unique(), DS_DOCKED_CONTAINER | style, DpiScaleInt(200), ID_DOCK_FILES1); + pDockRight->AddDockedChild(make_unique(), DS_DOCKED_CONTAINER | style, DpiScaleInt(200), ID_DOCK_CLASSES2); + pDockRight->AddDockedChild(make_unique(), DS_DOCKED_CONTAINER | style, DpiScaleInt(200), ID_DOCK_FILES2); + + // Add the bottom dockers. + CDocker* pDockBottom = AddDockedChild(make_unique(), DS_DOCKED_BOTTOM | style, DpiScaleInt(100), ID_DOCK_OUTPUT1); + pDockBottom->AddDockedChild(make_unique(), DS_DOCKED_CONTAINER | style, DpiScaleInt(100), ID_DOCK_OUTPUT2); + + // Add the frame's dockers. + AddDockedChild(make_unique(), DS_DOCKED_CONTAINER | style, DpiScaleInt(100), ID_DOCK_TEXT1); + AddDockedChild(make_unique(), DS_DOCKED_CONTAINER | style, DpiScaleInt(100), ID_DOCK_TEXT2); + + SetDockStyle(style); +} + +// Adds a new docker. The id specifies its type. +DockPtr CMainFrame::NewDockerFromID(int id) +{ + DockPtr docker; + switch(id) + { + case ID_DOCK_CLASSES1: + docker = make_unique(); + break; + case ID_DOCK_CLASSES2: + docker = make_unique(); + break; + case ID_DOCK_FILES1: + docker = make_unique(); + break; + case ID_DOCK_FILES2: + docker = make_unique(); + break; + case ID_DOCK_OUTPUT1: + docker = make_unique(); + break; + case ID_DOCK_OUTPUT2: + docker = make_unique(); + break; + case ID_DOCK_TEXT1: + docker = make_unique(); + break; + case ID_DOCK_TEXT2: + docker = make_unique(); + break; + default: + TRACE("Unknown Dock ID\n"); + break; + } + + return docker; +} + +// OnCommand responds to menu and and toolbar input. +BOOL CMainFrame::OnCommand(WPARAM wparam, LPARAM) +{ + UINT id = LOWORD(wparam); + switch(id) + { + case IDM_CONTAINER_TOP: return OnContainerTabsAtTop(); + case IDM_FILE_EXIT: return OnFileExit(); + case IDM_DOCK_DEFAULT: return OnDockDefault(); + case IDW_VIEW_STATUSBAR: return OnViewStatusBar(); + case IDW_VIEW_TOOLBAR: return OnViewToolBar(); + case IDM_HELP_ABOUT: return OnHelp(); + case IDM_HIDE_SINGLE_TAB: return OnHideSingleTab(); + } + + return FALSE; +} + +// Reposition the tabs in the containers. +BOOL CMainFrame::OnContainerTabsAtTop() +{ + SetContainerTabsAtTop(!m_isContainerTabsAtTop); + return TRUE; +} + +// OnCreate controls the way the frame is created. +// Overriding CFrame::OnCreate is optional. +int CMainFrame::OnCreate(CREATESTRUCT& cs) +{ + // A menu is added if the IDW_MAIN menu resource is defined. + // Frames have all options enabled by default. + // Use the following functions to disable options. + + // UseIndicatorStatus(FALSE); // Don't show keyboard indicators in the StatusBar. + // UseMenuStatus(FALSE); // Don't show menu descriptions in the StatusBar. + // UseOwnerDrawnMenu(FALSE); // Don't use owner draw for popup menu items. + // UseReBar(FALSE); // Don't use a ReBar. + // UseStatusBar(FALSE); // Don't use a StatusBar. + // UseThemes(FALSE); // Don't use themes. + // UseToolBar(FALSE); // Don't use a ToolBar. + + // call the base class function + return CDockFrame::OnCreate(cs); +} + +// Replaces the current docking arrangement with the default. +BOOL CMainFrame::OnDockDefault() +{ + // Suppress redraw to render the docking changes smoothly. + SetRedraw(FALSE); + + CloseAllDockers(); + LoadDefaultDockers(); + HideSingleContainerTab(m_hideSingleTab); + SetContainerTabsAtTop(m_isContainerTabsAtTop); + + // Enable redraw and redraw the frame. + SetRedraw(TRUE); + RedrawWindow(); + return TRUE; +} + +// Issue a close request to the frame to end the program. +BOOL CMainFrame::OnFileExit() +{ + Close(); + return TRUE; +} + +// Limit the minimum size of the window. +LRESULT CMainFrame::OnGetMinMaxInfo(UINT msg, WPARAM wparam, LPARAM lparam) +{ + LPMINMAXINFO lpMMI = (LPMINMAXINFO)lparam; + const CSize minimumSize(500, 350); + lpMMI->ptMinTrackSize.x = DpiScaleInt(minimumSize.cx); + lpMMI->ptMinTrackSize.y = DpiScaleInt(minimumSize.cy); + return FinalWindowProc(msg, wparam, lparam); +} + +// Display the help about dialog. +BOOL CMainFrame::OnHelp() +{ + // Ensure only one dialog displayed even for multiple hits of the F1 button. + if (!m_aboutDialog.IsWindow()) + { + m_aboutDialog.DoModal(*this); + } + + return TRUE; +} + +// Toggle the hiding of tabs for containers with a single tab. +BOOL CMainFrame::OnHideSingleTab() +{ + HideSingleContainerTab(!m_hideSingleTab); + return TRUE; +} + +// Called after the frame's window is created. +void CMainFrame::OnInitialUpdate() +{ + // Load dock settings + if (!LoadDockRegistrySettings(GetRegistryKeyName())) + LoadDefaultDockers(); + + // Set the various options. + HideSingleContainerTab(true); + SetContainerTabsAtTop(false); + + // PreCreate initially set the window as invisible, so show it now. + ShowWindow( GetInitValues().showCmd ); +} + +// Called when menu items are about to be displayed. +void CMainFrame::OnMenuUpdate(UINT id) +{ + UINT check; + switch (id) + { + case IDM_CONTAINER_TOP: + check = (m_isContainerTabsAtTop) ? MF_CHECKED : MF_UNCHECKED; + GetFrameMenu().CheckMenuItem(id, check); + break; + + case IDM_HIDE_SINGLE_TAB: + check = (m_hideSingleTab) ? MF_CHECKED : MF_UNCHECKED; + GetFrameMenu().CheckMenuItem(id, check); + break; + } + + CDockFrame::OnMenuUpdate(id); +} + +// Sets the CREATESTRUCT parameters before the window is created. +void CMainFrame::PreCreate(CREATESTRUCT& cs) +{ + // Call base clase to set defaults + CDockFrame::PreCreate(cs); + + // Hide the window initially by removing the WS_VISIBLE style + cs.style &= ~WS_VISIBLE; +} + +// This function overrides CDocker::RecalcDockLayout to eliminate jitter +// when the dockers are resized. The technique used here is is most +// appropriate for a complex arrangement of dockers. It might not suite +// other docking applications. To support this technique the +// WS_EX_COMPOSITED extended style has been added to some view windows. +void CMainFrame::RecalcDockLayout() +{ + if (GetWinVersion() >= 3000) // Windows 10 or later. + { + LockWindowUpdate(); + CDocker::RecalcDockLayout(); + UnlockWindowUpdate(); + UpdateWindow(); + } + else + CDocker::RecalcDockLayout(); +} + +// Saves the docking arrangement and other settings in the registry. +BOOL CMainFrame::SaveRegistrySettings() +{ + if (CDockFrame::SaveRegistrySettings()) + return SaveDockRegistrySettings(GetRegistryKeyName()); + else + return FALSE; +} + +// Positions the tabs at the top or bottom of all containers. +void CMainFrame::SetContainerTabsAtTop(bool isAtTop) +{ + m_isContainerTabsAtTop = isAtTop; + + // Set the Tab position for each container + for (CDocker* docker : GetAllDockers()) + { + CDockContainer* pContainer = docker->GetContainer(); + if (pContainer && pContainer->IsWindow()) + { + pContainer->SetTabsAtTop(isAtTop); + } + } +} + +// Specify the icons used in popup menus. +void CMainFrame::SetupMenuIcons() +{ + std::vector data = GetToolBarData(); + if (GetMenuIconHeight() >= 24) + SetMenuIcons(data, lightgray, IDW_MAIN); + else + SetMenuIcons(data, lightgray, IDB_TOOLBAR16); +} + +// Set the Resource IDs for the toolbar buttons +void CMainFrame::SetupToolBar() +{ + AddToolBarButton( IDM_FILE_NEW, FALSE ); + AddToolBarButton( IDM_FILE_OPEN, FALSE ); + AddToolBarButton( IDM_FILE_SAVE, FALSE ); + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_EDIT_CUT, FALSE ); + AddToolBarButton( IDM_EDIT_COPY, FALSE ); + AddToolBarButton( IDM_EDIT_PASTE, FALSE ); + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_FILE_PRINT, FALSE ); + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_HELP_ABOUT ); +} + +// Overrides base class function to suppress container group undocking. +void CMainFrame::UndockContainerGroup() +{ +} + +// Process the frame's window messages. +LRESULT CMainFrame::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case WM_GETMINMAXINFO: return OnGetMinMaxInfo(msg, wparam, lparam); + } + + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Mainfrm.h b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Mainfrm.h new file mode 100644 index 00000000..5cb394b1 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Mainfrm.h @@ -0,0 +1,74 @@ +///////////////////////////// +// Mainfrm.h +// + +#ifndef MAINFRM_H +#define MAINFRM_H + +#include "AboutDialog.h" +#include "MainContainer.h" + + +// The docker identifiers (dock IDs) +const int ID_DOCK_CLASSES1 = 1; +const int ID_DOCK_CLASSES2 = 2; +const int ID_DOCK_FILES1 = 3; +const int ID_DOCK_FILES2 = 4; +const int ID_DOCK_TEXT1 = 5; +const int ID_DOCK_OUTPUT1 = 6; +const int ID_DOCK_TEXT2 = 7; +const int ID_DOCK_OUTPUT2 = 8; + + +/////////////////////////////////////////////////////////// +// CMainFrame manages the application's main window. +// The main window is a frame which has a menubar, toolbar, +// statusbar and view window. It supports docking. +class CMainFrame : public CDockFrame +{ +public: + CMainFrame(); + virtual ~CMainFrame() = default; + virtual HWND Create(HWND parent = nullptr) override; + +protected: + virtual DockPtr NewDockerFromID(int id) override; + virtual BOOL OnCommand(WPARAM wparam, LPARAM lparam) override; + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual BOOL OnHelp() override; + virtual void OnInitialUpdate() override; + virtual void OnMenuUpdate(UINT id) override; + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual void RecalcDockLayout() override; + virtual BOOL SaveRegistrySettings() override; + virtual void SetupMenuIcons() override; + virtual void SetupToolBar() override; + virtual void UndockContainerGroup() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CMainFrame(const CMainFrame&) = delete; + CMainFrame& operator=(const CMainFrame&) = delete; + + // Command handlers + BOOL OnContainerTabsAtTop(); + BOOL OnDockDefault(); + BOOL OnFileExit(); + BOOL OnHideSingleTab(); + + // Message handlers + LRESULT OnGetMinMaxInfo(UINT msg, WPARAM wparam, LPARAM lparam); + + void HideSingleContainerTab(bool hideSingle); + void LoadDefaultDockers(); + void SetContainerTabsAtTop(bool isAtTop); + + // Member variables + CAboutDialog m_aboutDialog; + CMainContainer m_view; + bool m_isContainerTabsAtTop; + bool m_hideSingleTab; +}; + +#endif //MAINFRM_H + diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Output.cpp b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Output.cpp new file mode 100644 index 00000000..d278bfdd --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Output.cpp @@ -0,0 +1,176 @@ +/////////////////////////////////////////////////// +// Output.cpp - Definitions for the CViewOutput, +// and CDockOutput classes +// + + +#include "stdafx.h" +#include "Output.h" +#include "resource.h" + + +/////////////////////////////////// +// CViewOutput function definitions +// + +// Called when a window handle (HWND) is attached to CViewOutput. +void CViewOutput::OnAttach() +{ + SetDPIFont(); + SetWindowText(L"Output Window"); + SetReadOnly(); +} + +// Adjusts the font size in response to window DPI changes. +void CViewOutput::SetDPIFont() +{ + m_font.CreatePointFont(100, L"Courier New"); + m_font = DpiScaleFont(m_font, 9); + SetFont(m_font); +} + +// Handle the window's messages. +LRESULT CViewOutput::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + + +////////////////////////////////////// +// CContainOutput function definitions +// + +// Constructor. +CContainOutput::CContainOutput() +{ + SetView(m_viewOutput); + SetDockCaption(L"Output View - Docking container"); + SetTabText(L"Output"); + SetTabIcon(IDI_TEXT); +} + +// Handle the window's messages. +LRESULT CContainOutput::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + +/////////////////////////////////// +// CDockOutput function definitions +// + +// Constructor. +CDockOutput::CDockOutput() +{ + // Set the view window to our edit control + SetView(m_view); + + // Set the width of the splitter bar + SetBarWidth(8); +} + +// This function overrides CDocker::RecalcDockLayout to eliminate jitter +// when the dockers are resized. The technique used here is is most +// appropriate for a complex arrangement of dockers. It might not suite +// other docking applications. To support this technique the +// WS_EX_COMPOSITED extended style has been added to each docker. +void CDockOutput::RecalcDockLayout() +{ + if (GetWinVersion() >= 3000) // Windows 10 or later. + { + if (GetDockAncestor()->IsWindow()) + { + GetTopmostDocker()->LockWindowUpdate(); + CRect rc = GetTopmostDocker()->GetViewRect(); + GetTopmostDocker()->RecalcDockChildLayout(rc); + GetTopmostDocker()->UnlockWindowUpdate(); + GetTopmostDocker()->UpdateWindow(); + } + } + else + CDocker::RecalcDockLayout(); +} + +// Handle the window's messages. +LRESULT CDockOutput::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Output.h b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Output.h new file mode 100644 index 00000000..00850aac --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Output.h @@ -0,0 +1,75 @@ +/////////////////////////////////////////////////////// +// Output.h - Declaration of the CViewOutput, CContainOutput, +// and CDockOutput classes +// + +#ifndef OUTPUT_H +#define OUTPUT_H + +#include "resource.h" + + +/////////////////////////////////////////////////////////// +// CViewOutput manages an edit control. It displays output. +// This is the view window for CContainOutput. +class CViewOutput : public CRichEdit +{ +public: + CViewOutput() = default; + virtual ~CViewOutput() override = default; + void SetDPIFont(); + +protected: + virtual void OnAttach() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CViewOutput(const CViewOutput&) = delete; + CViewOutput& operator=(const CViewOutput&) = delete; + + CFont m_font; +}; + + +/////////////////////////////////////////////////// +// CContainOutput manages a dock container. It uses +// CViewOutput as its view. +class CContainOutput : public CDockContainer +{ +public: + CContainOutput(); + virtual ~CContainOutput() override = default; + +protected: + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CContainOutput(const CContainOutput&) = delete; + CContainOutput& operator=(const CContainOutput&) = delete; + + CViewOutput m_viewOutput; +}; + + +/////////////////////////////////////////////////////// +// CDockOutput manages a docker. It uses CContainOutput +// as its view. +class CDockOutput : public CDocker +{ +public: + CDockOutput(); + virtual ~CDockOutput() override = default; + +protected: + virtual void RecalcDockLayout() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CDockOutput(const CDockOutput&) = delete; + CDockOutput& operator=(const CDockOutput&) = delete; + + CContainOutput m_view; +}; + + +#endif // OUTPUT_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Resource.rc b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Resource.rc new file mode 100644 index 00000000..5bc99f7e --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Resource.rc @@ -0,0 +1,220 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "../src/res/PerMonitorV2.manifest" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDW_MAIN MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "E&xit\tAlt+F4", IDM_FILE_EXIT + END + POPUP "&View" + BEGIN + MENUITEM "&Tool Bar", IDW_VIEW_TOOLBAR, CHECKED + MENUITEM "&Status Bar", IDW_VIEW_STATUSBAR, CHECKED + END + POPUP "&Docking" + BEGIN + MENUITEM "&Default Layout", IDM_DOCK_DEFAULT + END + POPUP "&Options" + BEGIN + MENUITEM "Container Tabs at Top", IDM_CONTAINER_TOP, CHECKED + MENUITEM "Hide Single Container Tab", IDM_HIDE_SINGLE_TAB, CHECKED + END + POPUP "&Help" + BEGIN + MENUITEM "&About\tF1", IDM_HELP_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDW_MAIN ICON "../src/res/Docking.ico" +IDI_CLASSVIEW ICON "../src/res/classview.ico" +IDI_FILEVIEW ICON "../src/res/fileview.ico" +IDI_TEXT ICON "../src/res/text.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_TOOLBAR16 BITMAP "../src/res/toolbar16.bmp" +IDW_MAIN BITMAP "../src/res/toolbar24.bmp" +IDW_SDBOTTOM BITMAP "../src/res/SDbottom.bmp" +IDW_SDCENTER BITMAP "../src/res/SDcenter.bmp" +IDW_SDLEFT BITMAP "../src/res/SDleft.bmp" +IDW_SDMIDDLE BITMAP "../src/res/SDmiddle.bmp" +IDW_SDRIGHT BITMAP "../src/res/SDright.bmp" +IDW_SDTOP BITMAP "../src/res/SDtop.bmp" +IDB_CLASSVIEW BITMAP "../src/res/classview.bmp" +IDB_FILEVIEW BITMAP "../src/res/fileview.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Cursor +// + +IDW_SPLITH CURSOR "../src/res/SplitH.cur" +IDW_SPLITV CURSOR "../src/res/SplitV.cur" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDW_ABOUT DIALOGEX 0, 0, 186, 109 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "MS Shell Dlg", 400, 0 +BEGIN + DEFPUSHBUTTON "OK",IDOK,68,60,50,14 + CTEXT "Docking Container Application",IDC_STATIC,43,22,99,8 + ICON IDW_MAIN,0,4,4,20,20 + CTEXT "",IDC_STATIC1,53,32,80,8 + CTEXT "",IDC_STATIC2,53,42,80,8 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDW_MAIN ACCELERATORS +BEGIN + "N", IDM_FILE_NEW, VIRTKEY, CONTROL, NOINVERT + "O", IDM_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT + "P", IDM_FILE_PRINT, VIRTKEY, CONTROL, NOINVERT + "S", IDM_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT + "C", IDM_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + "X", IDM_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT + "V", IDM_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT + "Z", IDM_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT + "Y", IDM_EDIT_REDO, VIRTKEY, CONTROL, NOINVERT +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDW_MAIN "Dock Container Demo" + IDW_VIEW_TOOLBAR "Show or hide the tool bar" + IDW_VIEW_STATUSBAR "Show or hide the status bar" + IDW_INDICATOR_CAPS "CAP" + IDW_INDICATOR_NUM "NUM" + IDW_INDICATOR_SCRL "SCRL" + IDW_READY "Ready" +END + +STRINGTABLE +BEGIN + IDM_FILE_NEW "Create a New Document" + IDM_FILE_OPEN "Open Existing Document" + IDM_FILE_SAVE "Save the Document" + IDM_FILE_SAVEAS "Save the Document with a new name" + IDM_FILE_PRINT "Print the Document" + IDM_FILE_EXIT "End the Program" + IDM_EDIT_UNDO "Undo the last action" + IDM_EDIT_REDO "Redo the previously undone action" +END + +STRINGTABLE +BEGIN + IDM_EDIT_CUT "Cut the Selected Contents to the Clipboard" + IDM_EDIT_COPY "Copy the Selected Contents to the Clipboard" + IDM_EDIT_PASTE "Paste the Clipboard Contents to the Document" + IDM_EDIT_DELETE "Erase the selected Contents" + IDM_HELP_ABOUT "Display Information about this program" +END + +STRINGTABLE +BEGIN + IDM_DOCK_DEFAULT "Restore default dock layout" + IDM_CONTAINER_TOP "Reposition the container's tabs" + IDM_HIDE_SINGLE_TAB "Hide tabs for containers with a single tab" +END + +STRINGTABLE +BEGIN + SC_CLOSE "Close the Window" + SC_MAXIMIZE "Maximize the Window" + SC_MINIMIZE "Minimize the Window" + SC_MOVE "Move the Window" + SC_NEXTWINDOW "Select Next Window" + SC_PREVWINDOW "Select Previous Window" + SC_RESTORE "Restore the Window" + SC_SIZE "Resize the Window" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/StdAfx.cpp b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/StdAfx.cpp new file mode 100644 index 00000000..8957144d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/StdAfx.cpp @@ -0,0 +1,16 @@ +///////////////////////////// +// StdAfx.cpp +// + +// This file is used for precompiled hearders. Precompiled headers allow +// programs to be recompiled more quickly + +// To use precompiled headers, do the following: +// 1) Add the set of rarely changed headers to stdafx.h +// 2) Include stdafx.h in each cpp file. It must be included first. +// 3) Add stdafx.cpp to your project. +// 4) Turn on precompiled hearders in the project + + +#include "stdafx.h" + diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Text.cpp b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Text.cpp new file mode 100644 index 00000000..ac4c74c4 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Text.cpp @@ -0,0 +1,175 @@ +/////////////////////////////////////////////////// +// Text.cpp - Definitions for the CViewText, +// and CDockText classes +// + +#include "stdafx.h" +#include "Text.h" +#include "resource.h" + + +///////////////////////////////// +// CViewText function definitions +// + +// Called when a window handle (HWND) is attached to CViewText. +void CViewText::OnAttach() +{ + SetDPIFont(); + SetWindowText(L"Text Edit Window\r\n\r\n You can type some text here ..."); +} + +// Adjusts the font size in response to window DPI changes. +void CViewText::SetDPIFont() +{ + m_font.CreatePointFont(100, L"Courier New"); + m_font = DpiScaleFont(m_font, 9); + SetFont(m_font); +} + +// Handle the window's messages. +LRESULT CViewText::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + + +//////////////////////////////////// +// CContainText function definitions +// + +// Constructor. +CContainText::CContainText() +{ + SetDockCaption(L"Text View - Docking container"); + SetTabText(L"Text"); + SetTabIcon(IDI_TEXT); + SetView(m_viewText); +} + +// Handle the window's messages. +LRESULT CContainText::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + + +///////////////////////////////// +// CDockText function definitions +// + +// Constructor. +CDockText::CDockText() +{ + // Set the view window to our edit control + SetView(m_view); + + // Set the width of the splitter bar + SetBarWidth(8); +} + +// This function overrides CDocker::RecalcDockLayout to eliminate jitter +// when the dockers are resized. The technique used here is is most +// appropriate for a complex arrangement of dockers. It might not suite +// other docking applications. To support this technique the +// WS_EX_COMPOSITED extended style has been added to each docker. +void CDockText::RecalcDockLayout() +{ + if (GetWinVersion() >= 3000) // Windows 10 or later. + { + if (GetDockAncestor()->IsWindow()) + { + GetTopmostDocker()->LockWindowUpdate(); + CRect rc = GetTopmostDocker()->GetViewRect(); + GetTopmostDocker()->RecalcDockChildLayout(rc); + GetTopmostDocker()->UnlockWindowUpdate(); + GetTopmostDocker()->UpdateWindow(); + } + } + else + CDocker::RecalcDockLayout(); +} + +// Handle the window's messages. +LRESULT CDockText::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Text.h b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Text.h new file mode 100644 index 00000000..b831bbc1 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/Text.h @@ -0,0 +1,73 @@ +/////////////////////////////////////////////////////// +// Text.h - Declaration of the CViewText, CContainText, +// and CDockText classes +// + +#ifndef TEXT_H +#define TEXT_H + + +//////////////////////////////////////////////////////////// +// CViewText manages an rich edit control. It displays text. +// This is the view window for CContainText. +class CViewText : public CRichEdit +{ +public: + CViewText() = default; + virtual ~CViewText() override = default; + void SetDPIFont(); + +protected: + virtual void OnAttach() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CViewText(const CViewText&) = delete; + CViewText& operator=(const CViewText&) = delete; + + CFont m_font; +}; + + +///////////////////////////////////////////////// +// CContainText manages a dock container. It uses +// CViewText as its view. +class CContainText : public CDockContainer +{ +public: + CContainText(); + virtual ~CContainText() override = default; + +protected: + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CContainText(const CContainText&) = delete; + CContainText& operator=(const CContainText&) = delete; + + CViewText m_viewText; +}; + + +/////////////////////////////////////////////////// +// CDockText manages a docker. It uses CContainText +// as its view. +class CDockText : public CDocker +{ +public: + CDockText(); + virtual ~CDockText() override = default; + +protected: + virtual void RecalcDockLayout() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CDockText(const CDockText&) = delete; + CDockText& operator=(const CDockText&) = delete; + + CContainText m_view; +}; + + +#endif // TEXT_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/main.cpp b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/main.cpp new file mode 100644 index 00000000..7613e663 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/main.cpp @@ -0,0 +1,40 @@ +///////////////////////////// +// main.cpp +// + +#include "stdafx.h" +#include "ContainerApp.h" + +int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPWSTR, _In_ int) +{ + try + { + // Start Win32++. + CDockContainerApp theApp; + + // Run the application. + return theApp.Run(); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return -1; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/Docking.ico b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/Docking.ico new file mode 100644 index 00000000..575558c8 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/Docking.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/PerMonitorV2.manifest b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/PerMonitorV2.manifest new file mode 100644 index 00000000..d303e5c0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/PerMonitorV2.manifest @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + PerMonitorV2, PerMonitor + + + + + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/SDbottom.bmp b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/SDbottom.bmp new file mode 100644 index 00000000..0942ef90 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/SDbottom.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/SDcenter.bmp b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/SDcenter.bmp new file mode 100644 index 00000000..a1bf71dd Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/SDcenter.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/SDleft.bmp b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/SDleft.bmp new file mode 100644 index 00000000..ec3a4c29 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/SDleft.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/SDmiddle.bmp b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/SDmiddle.bmp new file mode 100644 index 00000000..71fc66ff Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/SDmiddle.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/SDright.bmp b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/SDright.bmp new file mode 100644 index 00000000..12810dfa Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/SDright.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/SDtop.bmp b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/SDtop.bmp new file mode 100644 index 00000000..1f92af41 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/SDtop.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/SplitH.cur b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/SplitH.cur new file mode 100644 index 00000000..bb03d773 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/SplitH.cur differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/SplitV.cur b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/SplitV.cur new file mode 100644 index 00000000..1fd0d55c Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/SplitV.cur differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/Text.ico b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/Text.ico new file mode 100644 index 00000000..9f9d8fa1 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/Text.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/Toolbar16.bmp b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/Toolbar16.bmp new file mode 100644 index 00000000..79ad442f Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/Toolbar16.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/Toolbar24.bmp b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/Toolbar24.bmp new file mode 100644 index 00000000..4000d938 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/Toolbar24.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/classview.bmp b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/classview.bmp new file mode 100644 index 00000000..6b22e786 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/classview.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/classview.ico b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/classview.ico new file mode 100644 index 00000000..b1541c85 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/classview.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/fileview.bmp b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/fileview.bmp new file mode 100644 index 00000000..b60f4838 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/fileview.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/fileview.ico b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/fileview.ico new file mode 100644 index 00000000..9f73b57c Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/res/fileview.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/resource.h b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/resource.h new file mode 100644 index 00000000..2b4f182f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/resource.h @@ -0,0 +1,64 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Resource.rc +// + +// include the Resource IDs defined by Win32++ +#include "default_resource.h" + + +//Resource IDs for menu items and ToolBar items +#define IDM_FILE_NEW 121 +#define IDM_FILE_OPEN 122 +#define IDM_FILE_SAVE 123 +#define IDM_FILE_SAVEAS 124 +#define IDM_FILE_PRINT 125 +#define IDM_FILE_CLOSE 126 +#define IDM_FILE_EXIT 127 +#define IDM_EDIT_UNDO 130 +#define IDM_EDIT_REDO 131 +#define IDM_EDIT_CUT 132 +#define IDM_EDIT_COPY 133 +#define IDM_EDIT_PASTE 134 +#define IDM_EDIT_DELETE 135 +#define IDM_HELP_ABOUT 140 +#define IDM_CONTAINER_TOP 141 +#define IDM_HIDE_SINGLE_TAB 142 + +// Bitmap for small menu icons +#define IDB_TOOLBAR16 143 + +// Bitmaps for the ClassView and FileView +#define IDB_CLASSVIEW 150 +#define IDB_FILEVIEW 151 + +// Icons for container tabs +#define IDI_CLASSVIEW 155 +#define IDI_FILEVIEW 156 +#define IDI_TEXT 157 + +// Menu Resource +#define IDM_DOCK_DEFAULT 160 + +// About dialog +#define IDC_STATIC1 170 +#define IDC_STATIC2 171 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 149 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 150 +#endif +#endif + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/stdafx.h b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/stdafx.h new file mode 100644 index 00000000..08450116 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockContainer/src/stdafx.h @@ -0,0 +1,90 @@ +///////////////////////////// +// StdAfx.h +// + +// This file is used for precompiled headers. +// Rarely modified header files should be included. +// Based on code provided by Lynn Allan. + + +#ifndef STDAFX_H +#define STDAFX_H + + +// Predefinitions for windows.h go here +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +// Specify Win32xx specific predefinitions here +//#define NO_USING_NAMESPACE // Don't use Win32xx namespace + +// Rarely modified header files should be included here +#include // Add support for std::vector +#include // Add support for std::map +#include // Add support for std::string +#include // Add support for stringstream +#include // Add support for the assert macro +#include // Add support for C style printf, sprintf, etc. +#include // Add support for C style character conversions atoi etc. +#include // Add support for C style TCHARs. + +// Add the Win32++ library +#include // Add CWinApp +#include // Add CArchive +#include // Add CAnimation, CComboBox, CComboBoxEx, CDateTime, CHeader, CHotKey, CIPAddress, CProgressBar, CSpinButton, CScrollBar, CSlider, CToolTip +#include // Add CCriticalSection, CThreadLock +#include // Add CString, CStringA, CStringW +#include // Add CDataExchange +#include // Add CDialog, CResizer +#include // Add CDockFrame, CMDIDockFrame +#include // Add CDocker, CDockContainer +#include // Add CException, CFileException, CNotSupportedException, CResourceException, CUserException, CWinException +#include // Add CFile +#include // Add CFileFind +#include // Add CFolderDialog +#include // Add CFrame +#include // Add CDC, CGDIObject, CBitmap, CBrush, CFont, CPalatte, CPen, CRgn +#include // Add CHGlobal +#include // Add CImageList +#include // Add CListView +#include // Add CMDIChild, CMDIFrame, CDockMDIFrame +#include // Add CMenu +#include // Add CMenuBar +#include // Add CMetaFile, CEnhMetaFile +#include // Add CEvent, CMutex, CSemaphore +#include // Add CPropertyPage, CPropertySheet +#include // Add CRebar +#include // Add CPoint, CRect, CSize +#include // Add CRegKey +#include // Add CRichEdit +#include // Add CScrollView +#include // Adds macros, windows header files, and CObject +#include // Add CSocket +#include // Add CStatusBar +#include // Add CButton, CEdit, CListBox +#include // Add CTab, CTabbedMDI +#include // Add AtoT, AtoW, TtoA, TtoW, WtoA, WtoT etc. +#include // Add MenuTheme, ReBarTheme, StatusBarTheme, ToolBarTheme +#include // Add CWinThread +#include // Add CTime +#include // Add CToolBar +#include // Add CTreeView +#include // Add CWebBrowser, CAXHost +#include // Add CWnd + +// WIN32_LEAN_AND_MEAN can't be used with these +#ifndef WIN32_LEAN_AND_MEAN + #include // Add CCommonDialog, CColorDialog, CFileDialog, CFindReplace, CFontDialog + #include // Add CFolderDialogEx + #include // Add CPrintPreview + #include // Add CPageSetupDialog, CPrintDialog + #include // Add CPrintDialogEx + #include // Add CTaskDialog + + // Visual Studio + #if defined (_MSC_VER) + #include // Add CRibbon, CRibbonFrame + #endif + +#endif // define WIN32_LEAN_AND_MEAN + +#endif // define STDAFX_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI.cbp b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI.cbp new file mode 100644 index 00000000..071d31c2 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI.cbp @@ -0,0 +1,155 @@ + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI.cbproj b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI.cbproj new file mode 100644 index 00000000..3b88dab4 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI.cbproj @@ -0,0 +1,1570 @@ + + + {39461456-1040-43CB-9B40-5962EF847BB0} + 20.1 + None + True + Release + Win64x + 1048579 + Application + DockTabbedMDI + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + JPHNE + .\Embarcadero\$(Platform)\$(Config) + .\Embarcadero\$(Platform)\$(Config) + false + true + true + $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + CppGuiApplication + System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + true + <_TCHARMapping>wchar_t + DockTabbedMDI + ..\..\..\include\;..\src\;$(IncludePath) + ..\..\..\include\;..\src\;$(ILINK_LibraryPath) + 3081 + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + $(BDSINCLUDE)\windows\sdk;$(BRCC_IncludePath) + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + ..\src\stdafx.h + none + + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + false + true + false + true + _DEBUG;$(Defines) + false + None + DEBUG + true + true + true + true + Full + true + true + true + true + true + $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) + $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + + + PerMonitorV2 + false + $(BDSLIB)\$(PLATFORM)$(CC_SUFFIX)\debug;$(ILINK_LibraryPath) + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + <_TCHARMapping>wchar_t + + + PerMonitorV2 + true + 1033 + + + NDEBUG;$(Defines) + None + + + PerMonitorV2 + false + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 78 + + + 79 + + + 0 + + + 1 + + + 2 + + + 3 + + + 4 + + + 5 + + + 6 + + + 7 + + + 8 + + + 9 + + + 10 + + + 11 + + + 12 + + + 13 + + + 14 + + + 15 + + + 16 + + + 17 + + +
Resource.res
+ 18 +
+ + 19 + + + 20 + true + + + 21 + + + 22 + + + 24 + + + 25 + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + +
+ + CPlusPlusBuilder.Personality.12 + CppGuiApplication + + + + False + True + True + False + + + Embarcadero C++Builder Office 2000 Servers Package + Embarcadero C++Builder Office XP Servers Package + + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + Assets\ + Logo150x150.png + true + + + + + Assets\ + Logo44x44.png + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + DockTabbedMDI.exe + true + + + + + DockTabbedMDI.exe + true + + + + + NewProject.exe + true + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 64 + + + classes + 64 + + + + + res\xml + 1 + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\mips + 1 + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-v21 + 1 + + + res\values-v21 + 1 + + + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + Contents + 1 + + + Contents + 1 + + + Contents + 1 + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + library\lib\armeabi-v7a + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen + 64 + + + ..\$(PROJECTNAME).launchscreen + 64 + + + + + 1 + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + + + + + + + + + + + + + True + True + True + + + 12 + + + + +
diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2015.sln b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2015.sln new file mode 100644 index 00000000..6b59e723 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2015.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DockTabbedMDI", "DockTabbedMDI_2015.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2015.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2015.vcxproj new file mode 100644 index 00000000..eebf1b20 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2015.vcxproj @@ -0,0 +1,264 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DockTabbedMDI + DockTabbedMDI + + + + Application + Unicode + v140_xp + + + Application + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + + + + + + + + + + + + + + + + + true + false + + + true + false + + + false + false + + + false + false + + + + Use + Level4 + true + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2015.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2015.vcxproj.filters new file mode 100644 index 00000000..dcdf7be1 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2015.vcxproj.filters @@ -0,0 +1,269 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + + + {751b591c-b199-4f48-8103-0a3f874b81d8} + + + {145fab5d-59ca-4460-85ae-78b0576a8175} + + + {b49afa43-63f6-4052-ab8d-1b86992c6bc1} + + + {867b234f-4b28-4b6a-8452-b84e68e758d8} + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2019.sln b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2019.sln new file mode 100644 index 00000000..12355c3f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2019.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DockTabbedMDI", "DockTabbedMDI_2019.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {7D094E28-9B1A-407E-8A33-A3B9831A825C} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2019.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2019.vcxproj new file mode 100644 index 00000000..034c4df8 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2019.vcxproj @@ -0,0 +1,241 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DockTabbedMDI + DockTabbedMDI + + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2019.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2019.vcxproj.filters new file mode 100644 index 00000000..9db8377b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2019.vcxproj.filters @@ -0,0 +1,266 @@ + + + + + {6b135b85-9b58-4e82-abcb-925cf5d39f1a} + + + {400b7ae6-fcd7-4149-86bd-2d202d4fe5d5} + + + {73057276-29f7-4945-ad2f-17042f48d2e0} + + + {4d6a51d5-b205-466e-b0c3-2f9cb9ac8efc} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2022.sln b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2022.sln new file mode 100644 index 00000000..ecb575d3 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2022.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DockTabbedMDI", "DockTabbedMDI_2022.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {9253BE03-EA5A-41F9-9E49-8F78EFD4344A} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2022.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2022.vcxproj new file mode 100644 index 00000000..5474b550 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2022.vcxproj @@ -0,0 +1,252 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DockTabbedMDI + DockTabbedMDI + 10.0 + + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2022.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2022.vcxproj.filters new file mode 100644 index 00000000..9db8377b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2022.vcxproj.filters @@ -0,0 +1,266 @@ + + + + + {6b135b85-9b58-4e82-abcb-925cf5d39f1a} + + + {400b7ae6-fcd7-4149-86bd-2d202d4fe5d5} + + + {73057276-29f7-4945-ad2f-17042f48d2e0} + + + {4d6a51d5-b205-466e-b0c3-2f9cb9ac8efc} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2026.slnx b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2026.slnx new file mode 100644 index 00000000..81b23406 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2026.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2026.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2026.vcxproj new file mode 100644 index 00000000..9eb676e1 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2026.vcxproj @@ -0,0 +1,252 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DockTabbedMDI + DockTabbedMDI + 10.0 + + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2026.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2026.vcxproj.filters new file mode 100644 index 00000000..2e76af25 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/DockTabbedMDI_2026.vcxproj.filters @@ -0,0 +1,266 @@ + + + + + {6b135b85-9b58-4e82-abcb-925cf5d39f1a} + + + {400b7ae6-fcd7-4149-86bd-2d202d4fe5d5} + + + {73057276-29f7-4945-ad2f-17042f48d2e0} + + + {4d6a51d5-b205-466e-b0c3-2f9cb9ac8efc} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/TabbedMDI_DEBUG.dev b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/TabbedMDI_DEBUG.dev new file mode 100644 index 00000000..2377c1b3 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/TabbedMDI_DEBUG.dev @@ -0,0 +1,442 @@ +[Project] +FileName=TabbedMDI_DEBUG.dev +Name=TabbedMDI +UnitCount=26 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=TabbedMDI_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D _DEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@__@@__@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Debug +ObjectOutput=.\Dev-C++\Debug +OverrideOutput=1 +OverrideOutputName=TabbedMDI.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=4 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[Unit2] +FileName=..\src\Browser.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\Files.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\Files.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\main.cpp +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit10] +FileName=..\src\MyDialog.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit11] +FileName=..\src\MyDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit13] +FileName=..\src\MyTabbedMDI.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit14] +FileName=..\src\Output.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit15] +FileName=..\src\Output.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit16] +FileName=..\src\Rect.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit17] +FileName=..\src\Rect.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit18] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit19] +FileName=..\src\Resource.rc +CompileCpp=1 +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit20] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit21] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit22] +FileName=..\src\TabbedMDIApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit23] +FileName=..\src\TabbedMDIApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit24] +FileName=..\src\Text.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit25] +FileName=..\src\Text.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit26] +FileName=..\src\AboutDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit1] +FileName=..\src\Browser.cpp +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit3] +FileName=..\src\Classes.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\Classes.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit8] +FileName=..\src\Mainfrm.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\Mainfrm.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit12] +FileName=..\src\MyTabbedMDI.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit27] +FileName=..\src\Text.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit28] +FileName=..\src\Text.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit29] +FileName=Browser.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit32] +FileName=Rect.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit33] +FileName=Rect.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit34] +FileName=TabbedMDIApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit35] +FileName=TabbedMDIApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit36] +FileName=ComboBoxEx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit37] +FileName=ComboBoxEx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit38] +FileName=TabbedMDIApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit39] +FileName=TabbedMDIApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit30] +FileName=MyTabbedMDI.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit31] +FileName=MyTabbedMDI.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/TabbedMDI_RELEASE.dev b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/TabbedMDI_RELEASE.dev new file mode 100644 index 00000000..218434cc --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/ProjectFiles/TabbedMDI_RELEASE.dev @@ -0,0 +1,422 @@ +[Project] +FileName=TabbedMDI_RELEASE.dev +Name=TabbedMDI +UnitCount=26 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=TabbedMDI_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D NDEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-s_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Release +ObjectOutput=.\Dev-C++\Release +OverrideOutput=1 +OverrideOutputName=TabbedMDI.exe +HostApplication= +Folders=Header,Header/Win32++,Resource,Source +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=3 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[Unit3] +FileName=..\src\Classes.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\Classes.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\Files.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\Files.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\main.cpp +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit8] +FileName=..\src\Mainfrm.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\Mainfrm.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit10] +FileName=..\src\MyDialog.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit11] +FileName=..\src\MyDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit12] +FileName=..\src\MyTabbedMDI.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit13] +FileName=..\src\MyTabbedMDI.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit14] +FileName=..\src\Output.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit15] +FileName=..\src\Output.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit16] +FileName=..\src\Rect.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit17] +FileName=..\src\Rect.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit18] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit1] +FileName=..\src\Browser.cpp +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= +CompileCpp=1 + +[Unit2] +FileName=..\src\Browser.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit19] +FileName=..\src\Resource.rc +CompileCpp=1 +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit20] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit21] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit22] +FileName=..\src\TabbedMDIApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit23] +FileName=..\src\TabbedMDIApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit24] +FileName=..\src\Text.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit25] +FileName=..\src\Text.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit26] +FileName=..\src\AboutDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit27] +FileName=..\src\Text.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit28] +FileName=..\src\Text.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit29] +FileName=Browser.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit30] +FileName=MyTabbedMDI.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit31] +FileName=Rect.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit32] +FileName=TabbedMDIApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit33] +FileName=DockTabbedMDI.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit34] +FileName=MyTabbedMDI.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit35] +FileName=Rect.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit36] +FileName=ComboBoxEx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit37] +FileName=ComboBoxEx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/Readme.txt new file mode 100644 index 00000000..66d569d1 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/Readme.txt @@ -0,0 +1,51 @@ +DockTabbedMDI Example +===================== +This example demonstrates tabbed MDIs in addition to "container" docking. + +Dock containers are a specialised view window for dockers. They are a tab +control which provide support for tab undocking, and "container within container +docking" where docking the container adds a tab to the container. +Dock containers have their own "view window". They also provide an optional +toolbar. + +The dock containers are the view window for dockers, allowing them to be +undocked and docked as required. + +A TabbedMDI is a specialised view window which provides support for a tabbed +MDI (Multiple Document Interface). It uses a tab control to display the MDI +children, and also provides optional close and list buttons. The tabs can be +display either at the top or bottom of the window. + +Classes titled CDockXXXX are inherited from CDocker. +Classes titled CContainerXXXX are inherited from CDockContainer. +Classes titled CViewXXXX are the various view windows inherited from CListView, +CTreeView, CRichEdit, and CWebBrowser. +The CMyTabbedMDI class is inherited from CTabbedMDI. + +Refer to the documentation for further information on the use of the CDocker, +CContainer and CTabbedMDI classes. + + +Features demonstrated in this example +===================================== +* Use of RichEdit, ListView and TreeView windows as view windows. +* Adding containers as view windows to CDocker. +* Adding view windows to CDockContainer. +* Adding view windows to CTabbedMDI. +* Use of the container's optional toolbar. +* Use of CWebBrowser as a view window for a TabbedMDI. +* Displaying tabs at the top or bottom of the container. +* Displaying tabs at the top or bottom of the TabbedMDI. +* Hiding tabs for dock containers with a single tab. +* The use of several docking styles. +* Saving the dock layout and TabbedMDI layout in the registry. +* Adding a "Window" menu item to the frame menu, updated in runtime. + +Note: +This sample uses the IWebBrowser2 interface to display web pages. The IWebBrowser2 +provides access to the same features as used by the Microsoft's Internet Explorer. +Support for Internet Explorer ended on June 15, 2022, so this sample might not render +web pages properly. + +Consider using using the EdgeBrowser and EdgeBrowserEx samples to display modern +web pages instead. diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/AboutDialog.h b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/AboutDialog.h new file mode 100644 index 00000000..71e4364d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/AboutDialog.h @@ -0,0 +1,31 @@ +///////////////////////////////////////////// +// AboutDialog.h + +#ifndef _ABOUTDIALOG_H_ +#define _ABOUTDIALOG_H_ + +#include "resource.h" + +//////////////////////////////////////////////////////// +// CAboutDialog manages the dialog which displays +// information about this program. +class CAboutDialog : public CDialog +{ +public: + CAboutDialog() : CDialog(IDW_ABOUT) {} + virtual BOOL OnInitDialog() override + { + // Set the Win32++ version string. + UINT ver = _WIN32XX_VER; + CString Win32xxVersion; + Win32xxVersion << "Win32++ Version " << ver / 0x100 << "." << + (ver % 0x100) / 0x10 << "." << (ver % 0x10); + + SetDlgItemText(IDC_STATIC1, Win32xxVersion); + SetDlgItemText(IDC_STATIC2, L"by David Nash"); + + return TRUE; + } +}; + +#endif // _ABOUTDIALOG_H_ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Browser.cpp b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Browser.cpp new file mode 100644 index 00000000..2df932e8 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Browser.cpp @@ -0,0 +1,58 @@ +///////////////////////////// +// Browser.cpp +// + +#include "stdafx.h" +#include "Browser.h" +#include "resource.h" + + +//////////////////////////////// +// CViewWeb function definitions +// + +// Called when the window is created. +int CViewWeb::OnCreate(CREATESTRUCT& cs) +{ + CWebBrowser::OnCreate(cs); + + // Suppress Java script errors + GetIWebBrowser2()->put_Silent(VARIANT_TRUE); + + // Load the web page. + Navigate2(L"www.google.com"); + + return 0; +} + +// Handle the window's messages. +LRESULT CViewWeb::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Browser.h b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Browser.h new file mode 100644 index 00000000..7c343581 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Browser.h @@ -0,0 +1,28 @@ +///////////////////////////// +// Browser.h +// + +#ifndef BROWSER_H +#define BROWSER_H + + +////////////////////////////////////////////////////// +// CViewWeb manages a window that displays a web page. +// This a view window used by CMyTabbedMDI. +class CViewWeb : public CWebBrowser +{ +public: + CViewWeb() = default; + virtual ~CViewWeb() override = default; + +protected: + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CViewWeb(const CViewWeb&) = delete; + CViewWeb& operator=(const CViewWeb&) = delete; +}; + + +#endif // BROWSER_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Classes.cpp b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Classes.cpp new file mode 100644 index 00000000..3ae0361c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Classes.cpp @@ -0,0 +1,307 @@ +/////////////////////////////////////////////////// +// Classes.cpp - Definitions for the CViewClasses, CContainClasses +// and CDockClasses classes +// + + +#include "stdafx.h" +#include "Classes.h" +#include "resource.h" +#include "TabbedMDIApp.h" +#include "resource.h" + +constexpr COLORREF lightgray = RGB(192, 192, 192); +constexpr COLORREF red = RGB(255, 0, 0); + +//////////////////////////////////// +// CViewClasses function definitions +// + +// Destructor. +CViewClasses::~CViewClasses() +{ + if (IsWindow()) DeleteAllItems(); +} + +// Called when a window handle (HWND) is attached to CViewClasses. +void CViewClasses::OnAttach() +{ + SetDPIImages(); + + // Adjust style to show lines and [+] button + DWORD style = GetStyle(); + style |= TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT; + SetStyle(style); + + DeleteAllItems(); + + // Add some tree-view items + HTREEITEM htiRoot = InsertItem(L"TreeView", 0, 0); + HTREEITEM htiCTreeViewApp = InsertItem(L"CTreeViewApp", 1, 1, htiRoot); + InsertItem(L"CTreeViewApp()", 3, 3, htiCTreeViewApp); + InsertItem(L"GetMainFrame()", 3, 3, htiCTreeViewApp); + InsertItem(L"InitInstance()", 3, 3, htiCTreeViewApp); + HTREEITEM htiMainFrame = InsertItem(L"CMainFrame", 1, 1, htiRoot); + InsertItem(L"CMainFrame()", 3, 3, htiMainFrame); + InsertItem(L"OnCommand()", 4, 4, htiMainFrame); + InsertItem(L"OnInitialUpdate()", 4, 4, htiMainFrame); + HTREEITEM htiView = InsertItem(L"CView", 1, 1, htiRoot); + InsertItem(L"CView()", 3, 3, htiView); + InsertItem(L"OnInitialUpdate()", 4, 4, htiView); + InsertItem(L"WndProc()", 4, 4, htiView); + + // Expand some tree-view items + Expand(htiRoot, TVE_EXPAND); + Expand(htiCTreeViewApp, TVE_EXPAND); +} + +// Respond to a mouse click on the window. +LRESULT CViewClasses::OnMouseActivate(UINT msg, WPARAM wparam, LPARAM lparam) +{ + // Set window focus. The docker will now report this as active. + SetFocus(); + return FinalWindowProc(msg, wparam, lparam); +} + +// Called in response to a WM_DPICHANGED_BEFOREPARENT message which is sent to child +// windows after a DPI change. A WM_DPICHANGED_BEFOREPARENT is only received when the +// application is DPI_AWARENESS_PER_MONITOR_AWARE. +LRESULT CViewClasses::OnDpiChangedBeforeParent(UINT msg, WPARAM wparam, LPARAM lparam) +{ + SetDPIImages(); + return FinalWindowProc(msg, wparam, lparam); +} + +// Adjusts the treeview image sizes in response to window DPI changes. +void CViewClasses::SetDPIImages() +{ + // Resize the image list. + CBitmap bmImage(IDB_CLASSVIEW); + bmImage = DpiScaleUpBitmap(bmImage); + int scale = bmImage.GetSize().cy / 15; + CImageList normalImages; + normalImages.Create(scale * 16, scale * 15, ILC_COLOR32 | ILC_MASK, 1, 0); + normalImages.Add(bmImage, red); + SetImageList(normalImages, TVSIL_NORMAL); + + // Reset the item indentation. + int imageWidth = normalImages.GetIconSize().cx; + SetIndent(imageWidth); +} + +void CViewClasses::PreCreate(CREATESTRUCT& cs) +{ + // Call base class to set defaults. + CTreeView::PreCreate(cs); + + // Add the WS_EX_COMPOSITED to reduce flicker. + if (GetWinVersion() >= 3000) // Windows 10 or later. + cs.dwExStyle |= WS_EX_COMPOSITED; +} + +// Processes the tree-view's window messages. +LRESULT CViewClasses::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case WM_MOUSEACTIVATE: return OnMouseActivate(msg, wparam, lparam); + case WM_DPICHANGED_BEFOREPARENT: return OnDpiChangedBeforeParent(msg, wparam, lparam); + } + + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + + +/////////////////////////////////////// +// CContainClasses function definitions +// + +// Constructor. +CContainClasses::CContainClasses() +{ + SetTabText(L"ClassView"); + SetTabIcon(IDI_CLASSVIEW); + SetDockCaption(L"Class View - Docking container"); + SetView(m_viewClasses); +} + +// Responds to menu and and toolbar input. +BOOL CContainClasses::OnCommand(WPARAM wparam, LPARAM) +{ + UINT id = LOWORD(wparam); + switch(id) + { + case IDM_FILE_NEW: return OnFileNew(); + case IDM_HELP_ABOUT: return OnHelpAbout(); + } + + return FALSE; +} + +// Respond to the New button in the container's toolbar. +BOOL CContainClasses::OnFileNew() +{ + TRACE("File New\n"); + MessageBox(L"File New", L"Button Pressed", MB_OK); + + return TRUE; +} + +// Respond to the help button on the container's toolbar. +// Displays the application's help about dialog. +BOOL CContainClasses::OnHelpAbout() +{ + // Send a message to the frame requesting the help dialog + GetAncestor().SendMessage(WM_HELP); + + return TRUE; +} + +// Set the Bitmap resource for the toolbar +void CContainClasses::SetupToolBar() +{ + SetToolBarImages(lightgray, IDW_MAIN, 0, 0); + + // Set the Resource IDs for the toolbar buttons + AddToolBarButton( IDM_FILE_NEW ); + AddToolBarButton( IDM_FILE_OPEN, FALSE ); + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_FILE_SAVE, FALSE ); + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_EDIT_CUT ); + AddToolBarButton( IDM_EDIT_COPY ); + AddToolBarButton( IDM_EDIT_PASTE ); + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_FILE_PRINT, FALSE ); + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_HELP_ABOUT ); +} + +// Handle the window's messages. +LRESULT CContainClasses::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + + +//////////////////////////////////// +// CDockClasses function definitions +// + +// Constructor. +CDockClasses::CDockClasses() +{ + SetView(m_classes); + + // Set the width of the splitter bar + SetBarWidth(8); +} + +// This function overrides CDocker::RecalcDockLayout to eliminate jitter +// when the dockers are resized. The technique used here is is most +// appropriate for a complex arrangement of dockers. It might not suite +// other docking applications. To support this technique the +// WS_EX_COMPOSITED extended style has been added to some view windows. +void CDockClasses::RecalcDockLayout() +{ + if (GetWinVersion() >= 3000) // Windows 10 or later. + { + if (GetDockAncestor()->IsWindow()) + { + GetTopmostDocker()->LockWindowUpdate(); + CRect rc = GetTopmostDocker()->GetViewRect(); + GetTopmostDocker()->RecalcDockChildLayout(rc); + GetTopmostDocker()->UnlockWindowUpdate(); + GetTopmostDocker()->UpdateWindow(); + } + } + else + CDocker::RecalcDockLayout(); +} + +// Handle the window's messages. +LRESULT CDockClasses::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Classes.h b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Classes.h new file mode 100644 index 00000000..f9e25f87 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Classes.h @@ -0,0 +1,84 @@ +////////////////////////////////////////////////////////// +// Classes.h - Declaration of CViewClasses, CContainClasses, +// and CDockClasses classes +// + + +#ifndef CLASSES_H +#define CLASSES_H + + +//////////////////////////////////////////// +// CViewClasses manages a tree view control. +// This is the view window CContainClasses, +// uses to display classes. +class CViewClasses : public CTreeView +{ +public: + CViewClasses() = default; + virtual ~CViewClasses() override; + void SetDPIImages(); + +protected: + virtual void OnAttach() override; + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CViewClasses(const CViewClasses&) = delete; + CViewClasses& operator=(const CViewClasses&) = delete; + + // Command handlers + LRESULT OnDpiChangedBeforeParent(UINT msg, WPARAM wparam, LPARAM lparam); + LRESULT OnMouseActivate(UINT msg, WPARAM wparam, LPARAM lparam); +}; + + +///////////////////////////////////////////////////// +// CContainClasses manages a dock container. It has a +// CViewClasses view. +class CContainClasses : public CDockContainer +{ +public: + CContainClasses(); + virtual ~CContainClasses() override = default; + +protected: + virtual BOOL OnCommand(WPARAM wparam, LPARAM lparam) override; + virtual void SetupToolBar() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CContainClasses(const CContainClasses&) = delete; + CContainClasses& operator=(const CContainClasses&) = delete; + + // Command handlers + BOOL OnFileNew(); + BOOL OnHelpAbout(); + + CViewClasses m_viewClasses; +}; + + +/////////////////////////////////////////// +// CDockClasses manages a docker that has a +// CContainClasses view. +class CDockClasses : public CDocker +{ +public: + CDockClasses(); + virtual ~CDockClasses() override = default; + +protected: + virtual void RecalcDockLayout() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CDockClasses(const CDockClasses&) = delete; + CDockClasses& operator=(const CDockClasses&) = delete; + + CContainClasses m_classes; +}; + + +#endif //CLASSES_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Files.cpp b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Files.cpp new file mode 100644 index 00000000..8d916e57 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Files.cpp @@ -0,0 +1,265 @@ +////////////////////////////////////////////// +// Files.cpp - Definitions for CViewFiles, CContainFiles +// and DockFiles classes +// + +#include "stdafx.h" +#include "Files.h" +#include "resource.h" + +constexpr COLORREF magenta = RGB(255, 0, 255); + +////////////////////////////////// +// CViewFiles function definitions +// + +// Destructor. +CViewFiles::~CViewFiles() +{ + if (IsWindow()) DeleteAllItems(); +} + +// Insert 4 list view items. +void CViewFiles::InsertItems() +{ + // Add 4th item + int item = InsertItem(0, L"ListViewApp.h", 2); + SetItemText(item, 1, L"1 KB"); + SetItemText(item, 2, L"C Header file"); + + // add 3rd item + item = InsertItem(item, L"ListViewApp.cpp", 1); + SetItemText(item, 1, L"3 KB"); + SetItemText(item, 2, L"C++ Source file"); + + // add 2nd item + item = InsertItem(item, L"main.cpp", 1); + SetItemText(item, 1, L"1 KB"); + SetItemText(item, 2, L"C++ Source file"); + + // add 1st item + item = InsertItem(item, L"ListView", 0); + SetItemText(item, 2, L"Folder"); +} + +// Called when a window handle (HWND) is attached to CViewFiles. +void CViewFiles::OnAttach() +{ + // Call the base class function. + CListView::OnAttach(); + + SetDPIImages(); + + // Set the report style + DWORD style = GetStyle(); + SetStyle((style & ~LVS_TYPEMASK) | LVS_REPORT); + + SetColumns(); + InsertItems(); + + // Set the extended style to double buffer. + SetExtendedStyle(LVS_EX_DOUBLEBUFFER); +} + +// Respond to a mouse click on the window +LRESULT CViewFiles::OnMouseActivate(UINT msg, WPARAM wparam, LPARAM lparam) +{ + // Set window focus. The docker will now report this as active. + SetFocus(); + return FinalWindowProc(msg, wparam, lparam); +} + +// Called in response to a WM_DPICHANGED_BEFOREPARENT message which is sent to child +// windows after a DPI change. A WM_DPICHANGED_BEFOREPARENT is only received when the +// application is DPI_AWARENESS_PER_MONITOR_AWARE. +LRESULT CViewFiles::OnDpiChangedBeforeParent(UINT msg, WPARAM wparam, LPARAM lparam) +{ + SetDPIImages(); + SetDPIColumnWidths(); + return FinalWindowProc(msg, wparam, lparam); +} + +// Configures the columns (header control) of the list view. +void CViewFiles::SetColumns() +{ + // empty the list + DeleteAllItems(); + + // Add the column items. + InsertColumn(0, L"Name"); + InsertColumn(1, L"Size"); + InsertColumn(2, L"Type"); + SetDPIColumnWidths(); +} + +// Adjusts the listview column widths in response to window DPI changes. +void CViewFiles::SetDPIColumnWidths() +{ + SetColumnWidth(0, DpiScaleInt(120)); + SetColumnWidth(1, DpiScaleInt(50)); + SetColumnWidth(2, DpiScaleInt(100)); +} + +// Adjusts the listview image sizes in response to window DPI changes. +void CViewFiles::SetDPIImages() +{ + // Set the image lists + CBitmap bmImage(IDB_FILEVIEW); + bmImage = DpiScaleUpBitmap(bmImage); + int scale = bmImage.GetSize().cy / 15; + CImageList smallImages; + smallImages.Create(scale * 16, scale * 15, ILC_COLOR32 | ILC_MASK, 1, 0); + smallImages.Add(bmImage, magenta); + SetImageList(smallImages, LVSIL_SMALL); +} + +// Process the list-view's window messages. +LRESULT CViewFiles::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case WM_MOUSEACTIVATE: return OnMouseActivate(msg, wparam, lparam); + case WM_DPICHANGED_BEFOREPARENT: return OnDpiChangedBeforeParent(msg, wparam, lparam); + } + + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + + +///////////////////////////////////// +// CContainFiles function definitions +// + +// Constructor. +CContainFiles::CContainFiles() +{ + SetTabText(L"FileView"); + SetTabIcon(IDI_FILEVIEW); + SetDockCaption (L"File View - Docking container"); + SetView(m_viewFiles); +} + +// Handle the window's messages. +LRESULT CContainFiles::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + + +////////////////////////////////// +// CDockFiles function definitions +// + +// Constructor. +CDockFiles::CDockFiles() +{ + SetView(m_files); + + // Set the width of the splitter bar. + SetBarWidth(8); +} + +// This function overrides CDocker::RecalcDockLayout to eliminate jitter +// when the dockers are resized. The technique used here is is most +// appropriate for a complex arrangement of dockers. It might not suite +// other docking applications. To support this technique the +// WS_EX_COMPOSITED extended style has been added to some view windows. +void CDockFiles::RecalcDockLayout() +{ + if (GetWinVersion() >= 3000) // Windows 10 or later. + { + if (GetDockAncestor()->IsWindow()) + { + GetTopmostDocker()->LockWindowUpdate(); + CRect rc = GetTopmostDocker()->GetViewRect(); + GetTopmostDocker()->RecalcDockChildLayout(rc); + GetTopmostDocker()->UnlockWindowUpdate(); + GetTopmostDocker()->UpdateWindow(); + } + } + else + CDocker::RecalcDockLayout(); +} + +// Handle the window's messages. +LRESULT CDockFiles::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Files.h b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Files.h new file mode 100644 index 00000000..722a322b --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Files.h @@ -0,0 +1,79 @@ +///////////////////////////////////////////////// +// Files.h - Declaration of the CViewFiles, CContainFiles +// and CDockFiles classes +// + +#ifndef FILES_H +#define FILES_H + + +///////////////////////////////////////////////////////////// +// CViewFiles manages a list view control. It displays files. +// This is the view window used by CContainFiles. +class CViewFiles : public CListView +{ +public: + CViewFiles() = default; + virtual ~CViewFiles() override; + void SetDPIColumnWidths(); + void SetDPIImages(); + +protected: + virtual void OnAttach() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CViewFiles(const CViewFiles&) = delete; + CViewFiles& operator=(const CViewFiles&) = delete; + + // Command handlers + LRESULT OnMouseActivate(UINT msg, WPARAM wparam, LPARAM lparam); + LRESULT OnDpiChangedBeforeParent(UINT msg, WPARAM wparam, LPARAM lparam); + + void InsertItems(); + void SetColumns(); +}; + + +////////////////////////////////////////////////// +// CContainFiles manages a dock container. It uses +// CViewFiles as its view. +class CContainFiles : public CDockContainer +{ +public: + CContainFiles(); + virtual ~CContainFiles() override = default; + +protected: + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CContainFiles(const CContainFiles&) = delete; + CContainFiles& operator=(const CContainFiles&) = delete; + + CViewFiles m_viewFiles; +}; + + +///////////////////////////////////////// +// CDockFiles manages a docker that has a +// CContainFiles view. +class CDockFiles : public CDocker +{ +public: + CDockFiles(); + virtual ~CDockFiles() override = default; + +protected: + virtual void RecalcDockLayout() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CDockFiles(const CDockFiles&) = delete; + CDockFiles& operator=(const CDockFiles&) = delete; + + CContainFiles m_files; +}; + + +#endif // FILES_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Mainfrm.cpp b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Mainfrm.cpp new file mode 100644 index 00000000..a741604d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Mainfrm.cpp @@ -0,0 +1,579 @@ +///////////////////////////// +// Mainfrm.cpp +// + +#include "stdafx.h" +#include "Mainfrm.h" +#include "Browser.h" +#include "Classes.h" +#include "Files.h" +#include "MyDialog.h" +#include "Output.h" +#include "Rect.h" +#include "Text.h" +#include "resource.h" + +using namespace std; + +constexpr COLORREF lightgray = RGB(192, 192, 192); + +////////////////////////////////// +// CMainFrame function definitions +// + +// Constructor for CMainFrame. +CMainFrame::CMainFrame() : m_isContainerTabsAtTop(FALSE), m_isHideSingleTab(TRUE), + m_isMDITabsAtTop(TRUE), m_pActiveDocker(nullptr) +{ +} + +// Create the frame window. +HWND CMainFrame::Create(HWND parent) +{ + // Set m_myTabbedMDI as the view window of the frame. + SetView(m_myTabbedMDI); + + // Set the registry key name, and load the initial window position. + // Use a registry key name like "CompanyName\\Application". + LoadRegistrySettings(L"Win32++\\TabbedMDI Docking"); + + return CDockFrame::Create(parent); +} + +// Hides or shows tabs for containers with a single tab. +void CMainFrame::HideSingleContainerTab(bool hideSingle) +{ + m_isHideSingleTab = hideSingle; + + // Set the Tab position for each container. + for (const DockPtr& ptr : GetAllDockChildren()) + { + CDockContainer* pContainer = ptr->GetContainer(); + if (pContainer && pContainer->IsWindow()) + { + pContainer->SetHideSingleTab(hideSingle); + } + } +} + +// Loads the default arrangement of dockers. +void CMainFrame::LoadDefaultDockers() +{ + // Note: The DockIDs are used for saving/restoring the dockers state in the registry. + + DWORD style = DS_CLIENTEDGE; // The style added to each docker + + // Add the parent dockers + CDocker* pDockRight = AddDockedChild(make_unique(), DS_DOCKED_RIGHT | style, DpiScaleInt(250), ID_DOCK_CLASSES1); + CDocker* pDockBottom = AddDockedChild(make_unique(), DS_DOCKED_BOTTOM | style, DpiScaleInt(100), ID_DOCK_TEXT1); + + // Add the remaining dockers + pDockRight->AddDockedChild(make_unique(), DS_DOCKED_CONTAINER | style, DpiScaleInt(250), ID_DOCK_FILES1); + pDockRight->AddDockedChild(make_unique(), DS_DOCKED_CONTAINER | style, DpiScaleInt(250), ID_DOCK_DIALOG); + + pDockBottom->AddDockedChild(make_unique(), DS_DOCKED_CONTAINER | style, DpiScaleInt(100), ID_DOCK_OUTPUT1); + pDockBottom->AddDockedChild(make_unique(), DS_DOCKED_CONTAINER | style, DpiScaleInt(100), ID_DOCK_TEXT2); + pDockBottom->AddDockedChild(make_unique(), DS_DOCKED_CONTAINER | style, DpiScaleInt(100), ID_DOCK_OUTPUT2); + + SetDockStyle(style); +} + +// Loads the default arrangement of MDIs. +void CMainFrame::LoadDefaultMDIs() +{ + // Add some MDI tabs + m_myTabbedMDI.AddMDIChild(make_unique(), L"Browser", ID_MDI_WEB); + m_myTabbedMDI.AddMDIChild(make_unique(), L"Rectangles", ID_MDI_RECT); + m_myTabbedMDI.AddMDIChild(make_unique(), L"TextView", ID_MDI_TEXT); + m_myTabbedMDI.AddMDIChild(make_unique(), L"Classes", ID_MDI_CLASSES); + m_myTabbedMDI.AddMDIChild(make_unique(), L"Files", ID_MDI_FILES); + + if (m_myTabbedMDI.IsWindow()) + m_myTabbedMDI.SetActiveMDITab(0); +} + +// Adds a new docker. The dockID parameter specifies the docker type. +DockPtr CMainFrame::NewDockerFromID(int dockID) +{ + DockPtr docker; + switch (dockID) + { + case ID_DOCK_CLASSES1: + docker = make_unique(); + break; + case ID_DOCK_CLASSES2: + docker = make_unique(); + break; + case ID_DOCK_FILES1: + docker = make_unique(); + break; + case ID_DOCK_FILES2: + docker = make_unique(); + break; + case ID_DOCK_OUTPUT1: + docker = make_unique(); + break; + case ID_DOCK_OUTPUT2: + docker = make_unique(); + break; + case ID_DOCK_TEXT1: + docker = make_unique(); + break; + case ID_DOCK_TEXT2: + docker = make_unique(); + break; + case ID_DOCK_DIALOG: + docker = make_unique(); + break; + default: + TRACE("Unknown Dock ID\n"); + break; + } + + return docker; +} + +// Close all the dockers. +BOOL CMainFrame::OnCloseDockers() +{ + CloseAllDockers(); + return TRUE; +} + +// Close all the MDIs. +BOOL CMainFrame::OnCloseMDIs() +{ + m_myTabbedMDI.CloseAllMDIChildren(); + return TRUE; +} + +// Called when the main window is asked to close. +void CMainFrame::OnClose() +{ + SaveRegistrySettings(); + Destroy(); +} + +// OnCommand responds to menu and and toolbar input. +BOOL CMainFrame::OnCommand(WPARAM wparam, LPARAM lparam) +{ + UINT id = LOWORD(wparam); + switch (id) + { + case IDM_CLOSE_DOCKERS: return OnCloseDockers(); + case IDM_CLOSE_MDIS: return OnCloseMDIs(); + case IDM_CONTAINER_TOP: return OnContainerTabsAtTop(); + case IDM_DEFAULT_LAYOUT: return OnDefaultLayout(); + case IDM_FILE_NEW: return OnFileNew(); + case IDM_FILE_NEWBROWSER: return OnFileNewBrowser(); + case IDM_FILE_NEWRECT: return OnFileNewRect(); + case IDM_FILE_NEWTEXT: return OnFileNewText(); + case IDM_FILE_NEWTREE: return OnFileNewTree(); + case IDM_FILE_NEWLIST: return OnFileNewList(); + case IDM_FILE_EXIT: return OnFileExit(); + case IDM_HELP_ABOUT: return OnHelp(); + case IDM_HIDE_SINGLE_TAB: return OnHideSingleTab(); + case IDM_TABBEDMDI_TOP: return OnMDITabsAtTop(); + case IDW_VIEW_STATUSBAR: return OnViewStatusBar(); + case IDW_VIEW_TOOLBAR: return OnViewToolBar(); + case IDW_FIRSTCHILD: + case IDW_FIRSTCHILD + 1: + case IDW_FIRSTCHILD + 2: + case IDW_FIRSTCHILD + 3: + case IDW_FIRSTCHILD + 4: + case IDW_FIRSTCHILD + 5: + case IDW_FIRSTCHILD + 6: + case IDW_FIRSTCHILD + 7: + case IDW_FIRSTCHILD + 8: + { + int tab = LOWORD(wparam) - IDW_FIRSTCHILD; + m_myTabbedMDI.SetActiveMDITab(tab); + return TRUE; + } + case IDW_FIRSTCHILD + 9: + { + m_myTabbedMDI.ShowListDialog(); + return TRUE; + } + + default: + { + // Pass the command on to the view of the active docker + m_pActiveDocker->GetActiveView()->SendMessage(WM_COMMAND, wparam, lparam); + } + } + + return FALSE; +} + +// Reposition the tabs in the containers. +BOOL CMainFrame::OnContainerTabsAtTop() +{ + SetContainerTabsAtTop(!m_isContainerTabsAtTop); + return TRUE; +} + +// OnCreate controls the way the frame is created. +// Overriding CFrame::OnCreate is optional. +int CMainFrame::OnCreate(CREATESTRUCT& cs) +{ + // A menu is added if the IDW_MAIN menu resource is defined. + // Frames have all options enabled by default. + // Use the following functions to disable options. + + // UseIndicatorStatus(FALSE); // Don't show keyboard indicators in the StatusBar. + // UseMenuStatus(FALSE); // Don't show menu descriptions in the StatusBar. + // UseOwnerDrawnMenu(FALSE); // Don't use owner draw for popup menu items. + // UseReBar(FALSE); // Don't use a ReBar. + // UseStatusBar(FALSE); // Don't use a StatusBar. + // UseThemes(FALSE); // Don't use themes. + // UseToolBar(FALSE); // Don't use a ToolBar. + + // call the base class function + return CDockFrame::OnCreate(cs); +} + +// Replaces the current docking arrangement with the default one. +BOOL CMainFrame::OnDefaultLayout() +{ + SetRedraw(FALSE); + + CloseAllDockers(); + m_myTabbedMDI.CloseAllMDIChildren(); + LoadDefaultDockers(); + LoadDefaultMDIs(); + + SetContainerTabsAtTop(m_isContainerTabsAtTop); + HideSingleContainerTab(m_isHideSingleTab); + SetRedraw(TRUE); + RedrawWindow(); + return TRUE; +} + +// Called when a docker is activated. Stores the active docker in preparation for menu input. +// Excludes active docker change for undocked dockers when using the menu. +LRESULT CMainFrame::OnDockActivated(UINT msg, WPARAM wparam, LPARAM lparam) +{ + CPoint pt = GetCursorPos(); + if (WindowFromPoint(pt) != GetMenuBar()) + m_pActiveDocker = GetActiveDocker(); + + return CDockFrame::OnDockActivated(msg, wparam, lparam); +} + +// Issue a close request to the frame to end the program. +BOOL CMainFrame::OnFileExit() +{ + Close(); + return TRUE; +} + +// Creates the popup menu when the "New" toolbar button is pressed. +BOOL CMainFrame::OnFileNew() +{ + // Position the popup menu + CToolBar& tb = GetToolBar(); + RECT rc = tb.GetItemRect(tb.CommandToIndex(IDM_FILE_NEW)); + tb.ClientToScreen(rc); + + TPMPARAMS tpm; + tpm.cbSize = sizeof(TPMPARAMS); + tpm.rcExclude = rc; + + // Load the popup menu + CMenu topMenu(IDM_NEWMENU); + CMenu popupMenu = topMenu.GetSubMenu(0); + + // Start the popup menu + popupMenu.TrackPopupMenuEx(TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_VERTICAL, rc.left, rc.bottom, *this, &tpm); + return TRUE; +} + +// Adds a MDI with a list-view. +BOOL CMainFrame::OnFileNewList() +{ + m_myTabbedMDI.AddMDIChild(make_unique(), L"Files", ID_MDI_FILES); + return TRUE; +} + +// Adds a MDI with a Rectangles view. +BOOL CMainFrame::OnFileNewRect() +{ + m_myTabbedMDI.AddMDIChild(make_unique(), L"Rectangles", ID_MDI_RECT); + return TRUE; +} + +// Adds a MDI with a Browser view. +BOOL CMainFrame::OnFileNewBrowser() +{ + m_myTabbedMDI.AddMDIChild(make_unique(), L"Browser", ID_MDI_WEB); + return TRUE; +} + +// Adds a MDI with a Text view. +BOOL CMainFrame::OnFileNewText() +{ + m_myTabbedMDI.AddMDIChild(make_unique(), L"TextView", ID_MDI_TEXT); + return TRUE; +} + +// Adds a MDI with a tree-view. +BOOL CMainFrame::OnFileNewTree() +{ + m_myTabbedMDI.AddMDIChild(make_unique(), L"Classes", ID_MDI_CLASSES); + return TRUE; +} + +// Limit the minimum size of the window. +LRESULT CMainFrame::OnGetMinMaxInfo(UINT msg, WPARAM wparam, LPARAM lparam) +{ + LPMINMAXINFO lpMMI = (LPMINMAXINFO)lparam; + const CSize minimumSize(600, 400); + lpMMI->ptMinTrackSize.x = DpiScaleInt(minimumSize.cx); + lpMMI->ptMinTrackSize.y = DpiScaleInt(minimumSize.cy); + return FinalWindowProc(msg, wparam, lparam); +} + +// Display the help about dialog. +BOOL CMainFrame::OnHelp() +{ + // Ensure only one dialog displayed even for multiple hits of the F1 button. + if (!m_aboutDialog.IsWindow()) + { + m_aboutDialog.DoModal(*this); + } + + return TRUE; +} + +// Toggle hiding of tabs for containers with a single tab. +BOOL CMainFrame::OnHideSingleTab() +{ + HideSingleContainerTab(!m_isHideSingleTab); + return TRUE; +} + +// Called after the frame window is created. +void CMainFrame::OnInitialUpdate() +{ + // Load dock settings + if (!LoadDockRegistrySettings(GetRegistryKeyName())) + LoadDefaultDockers(); + + // Load MDI child settings + if (!m_myTabbedMDI.LoadRegistrySettings(GetRegistryKeyName())) + LoadDefaultMDIs(); + + // Set the various options. + HideSingleContainerTab(true); + SetContainerTabsAtTop(false); + SetMDITabsAtTop(true); + + // Get a copy of the Frame's menu + CMenu frameMenu = GetFrameMenu(); + + // Modify the menu + int menuPos = frameMenu.GetMenuItemCount() - 1; + CMenu winMenu = m_myTabbedMDI.GetListMenu(); + frameMenu.InsertPopupMenu(menuPos, MF_BYPOSITION, winMenu, L"&Window"); + + // Replace the frame's menu with our modified menu + SetFrameMenu(frameMenu); + + // PreCreate initially set the window as invisible, so show it now. + ShowWindow(GetInitValues().showCmd); + RedrawWindow(); +} + +// Updates menu items before they are displayed. +LRESULT CMainFrame::OnInitMenuPopup(UINT msg, WPARAM wparam, LPARAM lparam) +{ + // Update the "Window" menu + m_myTabbedMDI.GetListMenu(); + + return CDockFrame::OnInitMenuPopup(msg, wparam, lparam); +} + +// Reposition TabbedMDI's tabs. +BOOL CMainFrame::OnMDITabsAtTop() +{ + SetMDITabsAtTop(!m_isMDITabsAtTop); + return TRUE; +} + +// Called when menu items are about to be displayed. +void CMainFrame::OnMenuUpdate(UINT id) +{ + // Only for the Menu IDs we wish to modify + if (id >= IDM_EDIT_UNDO && id <= IDM_EDIT_DELETE) + { + // Get the pointer to the active view + CWnd* pView = m_pActiveDocker->GetActiveView(); + + // Enable the Edit menu items for CViewText views, disable them otherwise + CMenu editMenu = GetFrameMenu().GetSubMenu(1); + UINT flags = (dynamic_cast(pView))? MF_ENABLED : MF_GRAYED; + editMenu.EnableMenuItem(id, MF_BYCOMMAND | flags); + } + + UINT check; + switch (id) + { + case IDM_CONTAINER_TOP: + check = (m_isContainerTabsAtTop) ? MF_CHECKED : MF_UNCHECKED; + GetFrameMenu().CheckMenuItem(id, check); + break; + + case IDM_HIDE_SINGLE_TAB: + check = (m_isHideSingleTab) ? MF_CHECKED : MF_UNCHECKED; + GetFrameMenu().CheckMenuItem(id, check); + break; + + case IDM_TABBEDMDI_TOP: + check = (m_isMDITabsAtTop) ? MF_CHECKED : MF_UNCHECKED; + GetFrameMenu().CheckMenuItem(id, check); + break; + } + + CDockFrame::OnMenuUpdate(id); +} + +// Sets the CREATESTRUCT parameters before the window is created. +void CMainFrame::PreCreate(CREATESTRUCT& cs) +{ + // Call base class to set defaults + CDockFrame::PreCreate(cs); + + // Hide the window initially by removing the WS_VISIBLE style + cs.style &= ~WS_VISIBLE; +} + +// This function overrides CDocker::RecalcDockLayout to eliminate jitter +// when the dockers are resized. The technique used here is is most +// appropriate for a complex arrangement of dockers. It might not suite +// other docking applications. To support this technique the +// WS_EX_COMPOSITED extended style has been added to some view windows. +void CMainFrame::RecalcDockLayout() +{ + if (GetWinVersion() >= 3000) // Windows 10 or later. + { + LockWindowUpdate(); + CDocker::RecalcDockLayout(); + UnlockWindowUpdate(); + UpdateWindow(); + } + else + CDocker::RecalcDockLayout(); +} + +// Saves the docking arrangement and other settings in the registry. +BOOL CMainFrame::SaveRegistrySettings() +{ + CDockFrame::SaveRegistrySettings(); + + // Save the docker settings + SaveDockRegistrySettings(GetRegistryKeyName()); + + // Save the tabbedMDI settings + m_myTabbedMDI.SaveRegistrySettings(GetRegistryKeyName()); + + return TRUE; +} + +// Positions the tabs at the top or bottom of the container. +void CMainFrame::SetContainerTabsAtTop(bool atTop) +{ + m_isContainerTabsAtTop = atTop; + + // Set the Tab position for each container + for (const DockPtr& ptr : GetAllDockChildren()) + { + CDockContainer* pContainer = ptr->GetContainer(); + if (pContainer && pContainer->IsWindow()) + { + pContainer->SetTabsAtTop(atTop); + } + } +} + +// Positions the MDI tabs at the top or bottom of the container. +void CMainFrame::SetMDITabsAtTop(bool atTop) +{ + m_isMDITabsAtTop = atTop; + m_myTabbedMDI.GetTab().SetTabsAtTop(atTop); +} + +// Specifies the images for some of the menu items. +void CMainFrame::SetupMenuIcons() +{ + // Load the default set of icons from the toolbar + std::vector data = GetToolBarData(); + if (GetMenuIconHeight() >= 24) + SetMenuIcons(data, lightgray, IDW_MAIN); + else + SetMenuIcons(data, lightgray, IDB_TOOLBAR16); + + // Add some extra icons for menu items + AddMenuIcon(IDM_FILE_NEWBROWSER, IDI_GLOBE); + AddMenuIcon(IDM_FILE_NEWRECT, IDI_RECT); + AddMenuIcon(IDM_FILE_NEWTEXT, IDI_TEXT); + AddMenuIcon(IDM_FILE_NEWLIST, IDI_FILEVIEW); + AddMenuIcon(IDM_FILE_NEWTREE, IDI_CLASSVIEW); +} + +// Set the Resource IDs for the toolbar buttons +void CMainFrame::SetupToolBar() +{ + AddToolBarButton( IDM_FILE_NEW ); + AddToolBarButton( IDM_FILE_OPEN, FALSE ); + AddToolBarButton( IDM_FILE_SAVE, FALSE ); + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_EDIT_CUT, FALSE ); + AddToolBarButton( IDM_EDIT_COPY, FALSE ); + AddToolBarButton( IDM_EDIT_PASTE, FALSE ); + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_FILE_PRINT, FALSE ); + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_HELP_ABOUT ); +} + +// Process the frame's window messages. +LRESULT CMainFrame::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case WM_GETMINMAXINFO: return OnGetMinMaxInfo(msg, wparam, lparam); + } + + // Always pass unhandled messages on to WndProcDefault. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Mainfrm.h b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Mainfrm.h new file mode 100644 index 00000000..3b8cee55 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Mainfrm.h @@ -0,0 +1,93 @@ +///////////////////////////// +// Mainfrm.h +// + +#ifndef MAINFRM_H +#define MAINFRM_H + + +#include "AboutDialog.h" +#include "MyTabbedMDI.h" + +// The docker identifiers (dock IDs) +const int ID_DOCK_CLASSES1 = 1; +const int ID_DOCK_CLASSES2 = 2; +const int ID_DOCK_FILES1 = 3; +const int ID_DOCK_FILES2 = 4; +const int ID_DOCK_OUTPUT1 = 5; +const int ID_DOCK_OUTPUT2 = 6; +const int ID_DOCK_TEXT1 = 7; +const int ID_DOCK_TEXT2 = 8; +const int ID_DOCK_BROWSER = 9; +const int ID_DOCK_RECT = 10; +const int ID_DOCK_DIALOG = 11; + + + +/////////////////////////////////////////////////////////// +// CMainFrame manages the application's main window. +// The main window is a frame which has a menubar, toolbar, +// statusbar and view window. It supports docking. +class CMainFrame : public CDockFrame +{ +public: + CMainFrame(); + virtual ~CMainFrame() override = default; + virtual HWND Create(HWND parent = nullptr) override; + +protected: + virtual DockPtr NewDockerFromID(int dockID) override; + virtual void OnClose() override; + virtual BOOL OnCommand(WPARAM wparam, LPARAM lparam) override; + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual LRESULT OnDockActivated(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual BOOL OnHelp() override; + virtual void OnInitialUpdate() override; + virtual LRESULT OnInitMenuPopup(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual void OnMenuUpdate(UINT id) override; + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual void RecalcDockLayout() override; + virtual BOOL SaveRegistrySettings() override; + virtual void SetupMenuIcons() override; + virtual void SetupToolBar() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CMainFrame(const CMainFrame&) = delete; + CMainFrame& operator=(const CMainFrame&) = delete; + + // Command handlers + BOOL OnCloseMDIs(); + BOOL OnCloseDockers(); + BOOL OnContainerTabsAtTop(); + BOOL OnDefaultLayout(); + BOOL OnFileNew(); + BOOL OnFileExit(); + BOOL OnFileNewBrowser(); + BOOL OnFileNewRect(); + BOOL OnFileNewList(); + BOOL OnFileNewText(); + BOOL OnFileNewTree(); + BOOL OnHideSingleTab(); + BOOL OnMDITabsAtTop(); + + // Message handlers + LRESULT OnGetMinMaxInfo(UINT msg, WPARAM wparam, LPARAM lparam); + + void HideSingleContainerTab(bool hideSingle); + void LoadDefaultDockers(); + void LoadDefaultMDIs(); + void SetContainerTabsAtTop(bool atTop); + void SetMDITabsAtTop(bool atTop); + + // Member variables + CAboutDialog m_aboutDialog; + CMyTabbedMDI m_myTabbedMDI; + bool m_isContainerTabsAtTop; + bool m_isHideSingleTab; + bool m_isMDITabsAtTop; + CDocker* m_pActiveDocker; +}; + +#endif //MAINFRM_H + diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/MyDialog.cpp b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/MyDialog.cpp new file mode 100644 index 00000000..e528c714 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/MyDialog.cpp @@ -0,0 +1,319 @@ +///////////////////////////// +// CViewDialog.cpp +// + +#include "stdafx.h" +#include "MyDialog.h" +#include "resource.h" + + +/////////////////////////////////// +// CViewDialog function definitions +// + +// Constructor. +CViewDialog::CViewDialog(UINT resID) : CDialog(resID) +{ +} + +// This function appends text to an edit control. +void CViewDialog::AppendText(int id, LPCWSTR text) +{ + // Append Line Feed + LRESULT dx = SendDlgItemMessage(id, WM_GETTEXTLENGTH, 0, 0); + if (dx) + { + SendDlgItemMessage(id, EM_SETSEL, dx, dx); + SendDlgItemMessage(id, EM_REPLACESEL, 0, reinterpret_cast(L"\r\n")); + } + + // Append text + dx = SendDlgItemMessage(id, WM_GETTEXTLENGTH, 0, 0); + SendDlgItemMessage(id, EM_SETSEL, dx, dx); + SendDlgItemMessage(id, EM_REPLACESEL, 0, reinterpret_cast(text)); +} + +// Process the dialog's window messages. +INT_PTR CViewDialog::DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass resizing messages on to the resizer + m_resizer.HandleMessage(msg, wparam, lparam); + + switch (msg) + { + case WM_MOUSEACTIVATE: return OnMouseActivate(msg, wparam, lparam); + } + + // Pass unhandled messages on to parent DialogProc + return DialogProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + +// Suppress closing the dialog when the Esc key is pressed. +void CViewDialog::OnCancel() +{ + AppendText(IDC_RICHEDIT2, L"Cancel Pressed"); + TRACE("Cancel Pressed\n"); +} + +// Suppress closing the dialog when an Esc key is pressed in the RichEdit controls. +void CViewDialog::OnClose() +{ +} + +// Process the command messages (WM_COMMAND) sent by the dialog's controls. +BOOL CViewDialog::OnCommand(WPARAM wparam, LPARAM) +{ + UINT id = LOWORD(wparam); + + switch (id) + { + case IDC_BUTTON1: return OnButton(); + case IDC_CHECK1: return OnCheck1(); + case IDC_CHECK2: return OnCheck2(); + case IDC_CHECK3: return OnCheck3(); + + case IDC_RADIO1: // intentionally blank + case IDC_RADIO2: + case IDC_RADIO3: return OnRangeOfRadioIDs(IDC_RADIO1, IDC_RADIO3, id); + } + + return FALSE; +} + +// Called before the dialog is displayed. +BOOL CViewDialog::OnInitDialog() +{ + // Attach CWnd objects to the dialog items + AttachItem(IDC_BUTTON1, m_button); + AttachItem(IDC_CHECK1, m_checkA); + AttachItem(IDC_CHECK2, m_checkB); + AttachItem(IDC_CHECK3, m_checkC); + AttachItem(IDC_RADIO1, m_radioA); + AttachItem(IDC_RADIO2, m_radioB); + AttachItem(IDC_RADIO3, m_radioC); + AttachItem(IDC_RICHEDIT1, m_richEdit1); + AttachItem(IDC_RICHEDIT2, m_richEdit2); + + // Put some text in the edit boxes + m_richEdit1.SetWindowText(L"Rich Edit Window"); + m_richEdit2.SetWindowText(L"Rich Edit Window"); + + // Initialize dialog resizing + m_resizer.Initialize( *this, CRect(0, 0, 300, 200) ); + m_resizer.AddChild(m_radioA, CResizer::topleft, 0); + m_resizer.AddChild(m_radioB, CResizer::topleft, 0); + m_resizer.AddChild(m_radioC, CResizer::topleft, 0); + m_resizer.AddChild(m_button, CResizer::topleft, 0); + m_resizer.AddChild(m_checkA, CResizer::bottomright, 0); + m_resizer.AddChild(m_checkB, CResizer::bottomright, 0); + m_resizer.AddChild(m_checkC, CResizer::bottomright, 0); + m_resizer.AddChild(m_richEdit1, CResizer::topright, RD_STRETCH_WIDTH); + m_resizer.AddChild(m_richEdit2, CResizer::bottomleft, RD_STRETCH_WIDTH| RD_STRETCH_HEIGHT); + + // Select the first radio button. + CheckRadioButton(IDC_RADIO1, IDC_RADIO3, IDC_RADIO1); + + return TRUE; +} + +// Respond to a mouse click on the dialog window. +LRESULT CViewDialog::OnMouseActivate(UINT msg, WPARAM wparam, LPARAM lparam) +{ + if (!IsChild(::GetFocus())) + SetFocus(); + + return FinalWindowProc(msg, wparam, lparam); +} + +// Suppress closing the dialog when the enter key is pressed. +void CViewDialog::OnOK() +{ + AppendText(IDC_RICHEDIT2, L"OK Button Pressed"); + TRACE("OK Button Pressed\n"); +} + +// Called when the button is pressed. +BOOL CViewDialog::OnButton() +{ + AppendText(IDC_RICHEDIT2, L"Button Pressed"); + TRACE("Button Pressed\n"); + return TRUE; +} + +// Called when check box 1 is clicked. +BOOL CViewDialog::OnCheck1() +{ + AppendText(IDC_RICHEDIT2, L"Check Box 1"); + TRACE("Check Box 1\n"); + return TRUE; +} + +// Called when check box 2 is clicked. +BOOL CViewDialog::OnCheck2() +{ + AppendText(IDC_RICHEDIT2, L"Check Box 2"); + TRACE("Check Box 2\n"); + return TRUE; +} + +// Called when check box 3 is clicked. +BOOL CViewDialog::OnCheck3() +{ + AppendText(IDC_RICHEDIT2, L"Check Box 3"); + TRACE("Check Box 3\n"); + return TRUE; +} + +// Called when a radio button is selected. +BOOL CViewDialog::OnRangeOfRadioIDs(UINT idFirst, UINT idLast, UINT idClicked) +{ + CheckRadioButton(idFirst, idLast, idClicked); + + CString str; + int button = idClicked - idFirst + 1; + str.Format(L"Radio%d", button); + AppendText(IDC_RICHEDIT2, str); + TRACE(str); TRACE("\n"); + + return TRUE; +} + + +////////////////////////////////////// +// CContainDialog function definitions +// + +// Constructor. +CContainDialog::CContainDialog() : m_viewDialog(IDD_MYDIALOG) +{ + SetView(m_viewDialog); + SetDockCaption (L"Dialog View - Docking container"); + SetTabText(L"Dialog"); + SetTabIcon(IDI_DIALOGVIEW); +} + +// Handle the window's messages. +LRESULT CContainDialog::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + + +/////////////////////////////////// +// CDockDialog function definitions +// + +// Constructor. +CDockDialog::CDockDialog() +{ + // Set the view window to our edit control + SetView(m_view); + + // Set the width of the splitter bar + SetBarWidth(8); +} + +// This function overrides CDocker::RecalcDockLayout to eliminate jitter +// when the dockers are resized. The technique used here is is most +// appropriate for a complex arrangement of dockers. It might not suite +// other docking applications. To support this technique the +// WS_EX_COMPOSITED extended style has been added to some view windows. +void CDockDialog::RecalcDockLayout() +{ + if (GetWinVersion() >= 3000) // Windows 10 or later. + { + if (GetDockAncestor()->IsWindow()) + { + GetTopmostDocker()->LockWindowUpdate(); + CRect rc = GetTopmostDocker()->GetViewRect(); + GetTopmostDocker()->RecalcDockChildLayout(rc); + GetTopmostDocker()->UnlockWindowUpdate(); + GetTopmostDocker()->UpdateWindow(); + } + } + else + CDocker::RecalcDockLayout(); +} + +// Handle the window's messages. +LRESULT CDockDialog::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/MyDialog.h b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/MyDialog.h new file mode 100644 index 00000000..f872a737 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/MyDialog.h @@ -0,0 +1,98 @@ +///////////////////////////// +// CViewDialog.h +// + +#ifndef MYDIALOG_H +#define MYDIALOG_H + + +//////////////////////////////////////////////////////// +// CViewDialog manages a dialog. This is the view window +// that CContainDialog uses. +class CViewDialog : public CDialog +{ +public: + CViewDialog(UINT resID); + virtual ~CViewDialog() override = default; + +protected: + virtual BOOL OnInitDialog() override; + virtual INT_PTR DialogProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual void OnCancel() override; + virtual void OnClose() override; + virtual BOOL OnCommand(WPARAM wparam, LPARAM lparam) override; + virtual void OnOK() override; + +private: + CViewDialog(const CViewDialog&) = delete; + CViewDialog& operator=(const CViewDialog&) = delete; + + // Command handlers + BOOL OnButton(); + BOOL OnCheck1(); + BOOL OnCheck2(); + BOOL OnCheck3(); + BOOL OnRangeOfRadioIDs(UINT idFirst, UINT idLast, UINT idClicked); + + // Message handlers + virtual LRESULT OnMouseActivate(UINT msg, WPARAM wparam, LPARAM lparam); + + void AppendText(int id, LPCWSTR text); + + // Member variables + CResizer m_resizer; + + // Dialog controls. + CButton m_radioA; + CButton m_radioB; + CButton m_radioC; + CButton m_checkA; + CButton m_checkB; + CButton m_checkC; + CButton m_button; + CRichEdit m_richEdit1; + CRichEdit m_richEdit2; +}; + + +//////////////////////////////////////////////////// +// CContainDialog manages a dock container. It has a +// CViewDialog view. +class CContainDialog : public CDockContainer +{ +public: + CContainDialog(); + virtual ~CContainDialog() override = default; + +protected: + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CContainDialog(const CContainDialog&) = delete; + CContainDialog& operator=(const CContainDialog&) = delete; + + CViewDialog m_viewDialog; +}; + + +///////////////////////////////////////// +// CDockDialog manages a docker that has a +// CContainDialog view. +class CDockDialog : public CDocker +{ +public: + CDockDialog(); + virtual ~CDockDialog() override = default; + +protected: + virtual void RecalcDockLayout() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CDockDialog(const CDockDialog&) = delete; + CDockDialog& operator=(const CDockDialog&) = delete; + + CContainDialog m_view; +}; + +#endif //MYDIALOG_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/MyTabbedMDI.cpp b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/MyTabbedMDI.cpp new file mode 100644 index 00000000..307503a7 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/MyTabbedMDI.cpp @@ -0,0 +1,92 @@ +///////////////////////////// +// MyTabbedMDI.cpp +// + +#include "stdafx.h" +#include "MyTabbedMDI.h" +#include "Browser.h" +#include "Classes.h" +#include "Files.h" +#include "Output.h" +#include "Rect.h" +#include "Text.h" + +using namespace std; + +//////////////////////////////////// +// CMyTabbedMDI function definitions +// + +// Adds a new MDI. The mdiChild parameter specifies the MDI type. +WndPtr CMyTabbedMDI::NewMDIChildFromID(int mdiChild) +{ + WndPtr view; + switch(mdiChild) + { + case ID_MDI_CLASSES: + view = make_unique(); + break; + case ID_MDI_FILES: + view = make_unique(); + break; + case ID_MDI_OUTPUT: + view = make_unique(); + break; + case ID_MDI_TEXT: + view = make_unique(); + break; + case ID_MDI_RECT: + view = make_unique(); + break; + case ID_MDI_WEB: + view = make_unique(); + break; + default: + TRACE("Unknown TabbedMDI id\n"); + break; + } + + return view; +} + +// Called after the window is moved or resized. +LRESULT CMyTabbedMDI::OnWindowPosChanged(UINT msg, WPARAM wparam, LPARAM lparam) +{ + LockWindowUpdate(); + CTabbedMDI::OnWindowPosChanged(msg, wparam, lparam); + UnlockWindowUpdate(); + UpdateWindow(); + return 0; +} + +// Handle the window's messages. +LRESULT CMyTabbedMDI::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/MyTabbedMDI.h b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/MyTabbedMDI.h new file mode 100644 index 00000000..d7355ae0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/MyTabbedMDI.h @@ -0,0 +1,36 @@ +///////////////////////////// +// MyTabbedMDI.h +// + +#ifndef MYTABBEDMDI_H +#define MYTABBEDMDI_H + +// The docker identifiers (dock IDs) +const int ID_MDI_CLASSES = 1; +const int ID_MDI_FILES = 2; +const int ID_MDI_OUTPUT = 3; +const int ID_MDI_TEXT = 4; +const int ID_MDI_WEB = 5; +const int ID_MDI_RECT = 6; + + +//////////////////////////////////////// +// Declaration of the CMyTabbedMDI class +// +class CMyTabbedMDI : public CTabbedMDI +{ +public: + CMyTabbedMDI() = default; + virtual ~CMyTabbedMDI() override = default; + +protected: + virtual WndPtr NewMDIChildFromID(int mdiChild) override; + virtual LRESULT OnWindowPosChanged(UINT msg, WPARAM wparam, LPARAM lparam) override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CMyTabbedMDI(const CMyTabbedMDI&) = delete; + CMyTabbedMDI& operator=(const CMyTabbedMDI&) = delete; +}; + +#endif diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Output.cpp b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Output.cpp new file mode 100644 index 00000000..74a26736 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Output.cpp @@ -0,0 +1,177 @@ +/////////////////////////////////////////////////// +// Output.cpp - Definitions for the CViewOutput, CContainOutput +// and CDockOutput classes +// + + +#include "stdafx.h" +#include "Output.h" +#include "resource.h" + + +/////////////////////////////////// +// CViewOutput function definitions +// + +// Called when a window handle (HWND) is attached to CViewOutput. +void CViewOutput::OnAttach() +{ + CFont font; + font.CreatePointFont(100, L"Courier New"); + SetFont(font); + SetWindowText(L"Read Only Output Window"); +} + +// Sets the CREATESTRUCT parameters before the window is created. +void CViewOutput::PreCreate(CREATESTRUCT& cs) +{ + cs.style = ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE | WS_CHILD | + WS_CLIPCHILDREN | WS_HSCROLL | WS_VISIBLE | WS_VSCROLL | ES_READONLY; +} + +// Handle the window's messages. +LRESULT CViewOutput::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + + +////////////////////////////////////// +// CContainOutput function definitions +// + +// Constructor. +CContainOutput::CContainOutput() +{ + SetView(m_viewOutput); + SetDockCaption (L"Output View - Docking container"); + SetTabText(L"Output"); + SetTabIcon(IDI_TEXT); +} + +// Handle the window's messages. +LRESULT CContainOutput::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + + +/////////////////////////////////// +// CDockOutput function definitions +// + +// Constructor. +CDockOutput::CDockOutput() +{ + // Set the view window to our edit control + SetView(m_view); + + // Set the width of the splitter bar + SetBarWidth(8); +} + +// This function overrides CDocker::RecalcDockLayout to eliminate jitter +// when the dockers are resized. The technique used here is is most +// appropriate for a complex arrangement of dockers. It might not suite +// other docking applications. To support this technique the +// WS_EX_COMPOSITED extended style has been added to some view windows. +void CDockOutput::RecalcDockLayout() +{ + if (GetWinVersion() >= 3000) // Windows 10 or later. + { + if (GetDockAncestor()->IsWindow()) + { + GetTopmostDocker()->LockWindowUpdate(); + CRect rc = GetTopmostDocker()->GetViewRect(); + GetTopmostDocker()->RecalcDockChildLayout(rc); + GetTopmostDocker()->UnlockWindowUpdate(); + GetTopmostDocker()->UpdateWindow(); + } + } + else + CDocker::RecalcDockLayout(); +} + +// Handle the window's messages. +LRESULT CDockOutput::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Output.h b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Output.h new file mode 100644 index 00000000..11bdf590 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Output.h @@ -0,0 +1,72 @@ +/////////////////////////////////////////////////////// +// Output.h - Declaration of the CViewOutput, CContainOutput, +// and CDockOutput classes +// + +#ifndef OUTPUT_H +#define OUTPUT_H + +#include + + +//////////////////////////////////////////////////////////////// +// CViewOutput manages an rich edit control. It displays output. +// This is the view window for CContainOutput. +class CViewOutput : public CRichEdit +{ +public: + CViewOutput() = default; + virtual ~CViewOutput() override = default; + +protected: + virtual void OnAttach() override; + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CViewOutput(const CViewOutput&) = delete; + CViewOutput& operator=(const CViewOutput&) = delete; +}; + + +/////////////////////////////////////////////////// +// CContainOutput manages a dock container. It uses +// CViewOutput as its view. +class CContainOutput : public CDockContainer +{ +public: + CContainOutput(); + virtual ~CContainOutput() override {} + +protected: + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CContainOutput(const CContainOutput&) = delete; + CContainOutput& operator=(const CContainOutput&) = delete; + + CViewOutput m_viewOutput; +}; + + +////////////////////////////////////////// +// CDockOutput manages a docker that uses +// CContainOutput as its view. +class CDockOutput : public CDocker +{ +public: + CDockOutput(); + virtual ~CDockOutput() override = default; + +protected: + virtual void RecalcDockLayout() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CDockOutput(const CDockOutput&) = delete; + CDockOutput& operator=(const CDockOutput&) = delete; + + CContainOutput m_view; +}; + +#endif // OUTPUT_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Rect.cpp b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Rect.cpp new file mode 100644 index 00000000..22912b08 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Rect.cpp @@ -0,0 +1,146 @@ +///////////////////////////// +// Rect.cpp +// + +#include "stdafx.h" +#include "Rect.h" +#include "resource.h" + + +///////////////////////////////// +// CViewRect function definitions +// + +// Called when the window is created. +int CViewRect::OnCreate(CREATESTRUCT&) +{ + SetTimer(1, 250, nullptr) ; + return 0; +} + +// Called when the window is destroyed. +void CViewRect::OnDestroy() +{ + KillTimer(1); +} + +void CViewRect::OnDraw(CDC& dc) +{ + for (const RectData& rd : m_rects) + { + dc.CreateSolidBrush(rd.color); + CRect rc = rd.rect; + dc.Rectangle(rc.left, rc.top, rc.right, rc.bottom); + } +} + +// Respond to a mouse click on the window. +LRESULT CViewRect::OnMouseActivate(UINT msg, WPARAM wparam, LPARAM lparam) +{ + SetFocus(); + return FinalWindowProc(msg, wparam, lparam); +} + +// Called when the window is resized. +LRESULT CViewRect::OnSize(UINT, WPARAM wparam, LPARAM lparam) +{ + // If not minimized, save the window size. + if (wparam != SIZE_MINIMIZED) + { + m_cxClientMax = LOWORD (lparam) ; + if (m_cxClientMax < 1) + m_cxClientMax = 1; + + m_cyClientMax = HIWORD (lparam) ; + if (m_cyClientMax < 1) + m_cyClientMax = 1; + } + + return 0; +} + +// Responds to the timer event. Displays a random rectangle. +LRESULT CViewRect::OnTimer(UINT, WPARAM, LPARAM) +{ + if (m_rects.size() < 100) + { + int red, green, blue; + int left, right, top, bottom; + left = rand() % m_cxClientMax; + right = rand() % m_cxClientMax; + top = rand() % m_cyClientMax; + bottom = rand() % m_cyClientMax; + red = rand() & 255; + green = rand() & 255; + blue = rand() & 255; + + CClientDC RectDC(*this); + COLORREF color(RGB(red, green, blue)); + RectDC.CreateSolidBrush(color); + + int rcLeft = (left < right) ? left : right; + int rcTop = (top < bottom) ? top : bottom; + int rcRight = (left > right) ? left : right; + int rcBottom = (top > bottom) ? top : bottom; + RectDC.Rectangle(rcLeft, rcTop, rcRight, rcBottom); + + RectData rectData(color, CRect(rcLeft, rcTop, rcRight, rcBottom)); + m_rects.push_back(rectData); + } + else + KillTimer(1); + + return 0; +} + +// Set the CREATESTURCT parameters before the window is created. +void CViewRect::PreCreate(CREATESTRUCT& cs) +{ + // Call base class to set defaults. + CWnd::PreCreate(cs); + cs.style |= WS_CLIPCHILDREN; + + // Add the WS_EX_COMPOSITED to reduce flicker. + if (GetWinVersion() >= 3000) // Windows 10 or later. + cs.dwExStyle |= WS_EX_COMPOSITED; +} + +// Processes the window's window messages. +LRESULT CViewRect::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case WM_MOUSEACTIVATE: return OnMouseActivate(msg, wparam, lparam); + case WM_SIZE: return OnSize(msg, wparam, lparam); + case WM_TIMER: return OnTimer(msg, wparam, lparam); + } + + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Rect.h b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Rect.h new file mode 100644 index 00000000..7ad14876 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Rect.h @@ -0,0 +1,46 @@ +///////////////////////////// +// Rect.h +// + +#ifndef RECT_H +#define RECT_H + +struct RectData +{ + RectData(COLORREF clr, CRect rc) : color(clr), rect(rc) {} + COLORREF color; + CRect rect; +}; + +////////////////////////////////////////////////////////////// +// CViewRect manages a window that displays random rectangles. +// This a view window used by CMyTabbedMDI. +class CViewRect : public CWnd +{ +public: + CViewRect() : m_cxClientMax(0), m_cyClientMax(0) {} + virtual ~CViewRect() override = default; + +protected: + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual void OnDestroy() override; + virtual void OnDraw(CDC& dc) override; + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CViewRect(const CViewRect&) = delete; + CViewRect& operator=(const CViewRect&) = delete; + + // Command handlers + virtual LRESULT OnMouseActivate(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnSize(UINT msg, WPARAM wparam, LPARAM lparam); + virtual LRESULT OnTimer(UINT msg, WPARAM wparam, LPARAM lparam); + + // Member variables + std::vector m_rects; + int m_cxClientMax; + int m_cyClientMax; +}; + +#endif //RECT_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Resource.rc b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Resource.rc new file mode 100644 index 00000000..2045949a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Resource.rc @@ -0,0 +1,296 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "../src/res/PerMonitorV2.manifest" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDW_MAIN MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "New &Browser", IDM_FILE_NEWBROWSER + MENUITEM "New &Rectangle", IDM_FILE_NEWRECT + MENUITEM "New &Text", IDM_FILE_NEWTEXT + MENUITEM "New Classes", IDM_FILE_NEWTREE + MENUITEM "New Files", IDM_FILE_NEWLIST + MENUITEM SEPARATOR + MENUITEM "E&xit\tAlt+F4", IDM_FILE_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "Undo\tCtrl+Z", IDM_EDIT_UNDO, GRAYED + MENUITEM "Redo\tCtrl+Y", IDM_EDIT_REDO, GRAYED + MENUITEM SEPARATOR + MENUITEM "Cut\tCtrl+X", IDM_EDIT_CUT, GRAYED + MENUITEM "Copy\tCtrl+C", IDM_EDIT_COPY, GRAYED + MENUITEM "Paste\tCtrl+V", IDM_EDIT_PASTE, GRAYED + MENUITEM "Delete\tDel", IDM_EDIT_DELETE, GRAYED + END + POPUP "&View" + BEGIN + MENUITEM "&Tool Bar", IDW_VIEW_TOOLBAR, CHECKED + MENUITEM "&Status Bar", IDW_VIEW_STATUSBAR, CHECKED + END + POPUP "&Options" + BEGIN + MENUITEM "MDI Tabs at Top", IDM_TABBEDMDI_TOP, CHECKED + MENUITEM "Container Tabs at Top", IDM_CONTAINER_TOP, CHECKED + MENUITEM "Hide Single Container Tab", IDM_HIDE_SINGLE_TAB, CHECKED + END + POPUP "&Layout" + BEGIN + MENUITEM "&Default Layout", IDM_DEFAULT_LAYOUT + MENUITEM "Close All &Containers", IDM_CLOSE_DOCKERS + MENUITEM "Close All &MDI Children", IDM_CLOSE_MDIS + END + POPUP "&Help" + BEGIN + MENUITEM "&About\tF1", IDM_HELP_ABOUT + END +END + +IDM_NEWMENU MENU +BEGIN + POPUP "New" + BEGIN + MENUITEM "New &Browser", IDM_FILE_NEWBROWSER + MENUITEM "New &Rectangle", IDM_FILE_NEWRECT + MENUITEM "New &Text", IDM_FILE_NEWTEXT + MENUITEM "New Classes", IDM_FILE_NEWTREE + MENUITEM "New Files", IDM_FILE_NEWLIST + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDW_MAIN ICON "../src/res/Docking.ico" +IDI_CLASSVIEW ICON "../src/res/classview.ico" +IDI_DIALOGVIEW ICON "../src/res/Dialog.ico" +IDI_FILEVIEW ICON "../src/res/fileview.ico" +IDI_GLOBE ICON "../src/res/Globe.ico" +IDI_RECT ICON "../src/res/rect.ico" +IDI_TEXT ICON "../src/res/text.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_TOOLBAR16 BITMAP "../src/res/toolbar16.bmp" +IDW_MAIN BITMAP "../src/res/toolbar24.bmp" +IDW_SDBOTTOM BITMAP "../src/res/SDbottom.bmp" +IDW_SDCENTER BITMAP "../src/res/SDcenter.bmp" +IDW_SDLEFT BITMAP "../src/res/SDleft.bmp" +IDW_SDMIDDLE BITMAP "../src/res/SDmiddle.bmp" +IDW_SDRIGHT BITMAP "../src/res/SDright.bmp" +IDW_SDTOP BITMAP "../src/res/SDtop.bmp" +IDB_CLASSVIEW BITMAP "../src/res/classview.bmp" +IDB_FILEVIEW BITMAP "../src/res/fileview.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Cursor +// + +IDW_SPLITH CURSOR "../src/res/SplitH.cur" +IDW_SPLITV CURSOR "../src/res/SplitV.cur" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_MYDIALOG DIALOGEX 0, 0, 203, 127 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN +FONT 8, "MS Shell Dlg", 0, 0 +BEGIN + CONTROL "Radio1",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,16,12,38,10 + CONTROL "Radio2",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,16,24,38,10 + CONTROL "Radio3",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,16,36,38,10 + PUSHBUTTON "Button",IDC_BUTTON1,14,56,49,11 + CONTROL "Check Box 1",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,77,55,10 + CONTROL "Check Box 2",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,91,55,10 + CONTROL "Check Box 3",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,105,55,10 + CONTROL "",IDC_RICHEDIT1,"RichEdit50W" ,ES_MULTILINE | ES_WANTRETURN | ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | WS_VSCROLL | WS_HSCROLL,97,12,84,42 + CONTROL "",IDC_RICHEDIT2,"RichEdit50W" ,ES_MULTILINE | ES_WANTRETURN | ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | WS_VSCROLL | WS_HSCROLL,13,76,84,42 +END + +IDW_ABOUT DIALOGEX 0, 0, 186, 109 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "MS Shell Dlg", 400, 0 +BEGIN + DEFPUSHBUTTON "OK",IDOK,68,60,50,14 + CTEXT "Docking Tabbed MDI Application",IDC_STATIC,43,22,99,8 + ICON IDW_MAIN,0,4,4,20,20 + CTEXT "",IDC_STATIC1,53,32,80,8 + CTEXT "",IDC_STATIC2,53,42,80,8 +END + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDW_MAIN ACCELERATORS +BEGIN + "N", IDM_FILE_NEW, VIRTKEY, CONTROL, NOINVERT + "O", IDM_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT + "P", IDM_FILE_PRINT, VIRTKEY, CONTROL, NOINVERT + "S", IDM_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT + "C", IDM_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + "X", IDM_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT + "V", IDM_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT + "Z", IDM_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT + "Y", IDM_EDIT_REDO, VIRTKEY, CONTROL, NOINVERT +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDW_MAIN "Tabbed MDI" + IDW_VIEW_TOOLBAR "Show or hide the tool bar" + IDW_VIEW_STATUSBAR "Show or hide the status bar" + IDW_INDICATOR_CAPS "CAP" + IDW_INDICATOR_NUM "NUM" + IDW_INDICATOR_SCRL "SCRL" + IDW_READY "Ready" +END + +STRINGTABLE +BEGIN + IDM_FILE_NEW "Create a New Document" + IDM_FILE_OPEN "Open Existing Document" + IDM_FILE_SAVE "Save the Document" + IDM_FILE_SAVEAS "Save the Document with a new name" + IDM_FILE_PRINT "Print the Document" + IDM_FILE_EXIT "End the Program" + IDM_EDIT_UNDO "Undo the last action" + IDM_EDIT_REDO "Redo the previously undone action" +END + +STRINGTABLE +BEGIN + IDM_FILE_NEWBROWSER "Create Simple MDI Child" + IDM_FILE_NEWRECT "Create Rect MDI Child" + IDM_FILE_NEWTEXT "Create Text MDI Child" +END + +STRINGTABLE +BEGIN + IDM_FILE_NEWTREE "Create Tree-View MDI Child" + IDM_FILE_NEWLIST "Create List-View MDI Child" + IDM_CONTAINER_TOP "Place Tabs at the top of the containers" + IDM_TABBEDMDI_TOP "Place Tabs at the top of the MDITab" + IDM_HIDE_SINGLE_TAB "Hide single tabs in containers" + IDM_DEFAULT_LAYOUT "Restore default dock layout" + IDM_CLOSE_DOCKERS "Close all docked and undocked windows" + IDM_CLOSE_MDIS "Close all MDI Children" +END + +STRINGTABLE +BEGIN + IDM_EDIT_CUT "Cut the Selected Contents to the Clipboard" + IDM_EDIT_COPY "Copy the Selected Contents to the Clipboard" + IDM_EDIT_PASTE "Paste the Clipboard Contents to the Document" + IDM_EDIT_DELETE "Erase the selected Contents" + IDM_HELP_ABOUT "Display Information about this program" +END + +STRINGTABLE +BEGIN + IDW_FIRSTCHILD "Activate this window" + IDW_CHILD2 "Activate this window" + IDW_CHILD3 "Activate this window" + IDW_CHILD4 "Activate this window" + IDW_CHILD5 "Activate this window" + IDW_CHILD6 "Activate this window" + IDW_CHILD7 "Activate this window" + IDW_CHILD8 "Activate this window" + IDW_CHILD9 "Activate this window" + IDW_CHILD10 "Select a window" +END + +STRINGTABLE +BEGIN + SC_CLOSE "Close the Window" + SC_MAXIMIZE "Maximize the Window" + SC_MINIMIZE "Minimize the Window" + SC_MOVE "Move the Window" + SC_NEXTWINDOW "Select Next Window" + SC_PREVWINDOW "Select Previous Window" + SC_RESTORE "Restore the Window" + SC_SIZE "Resize the Window" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/StdAfx.cpp b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/StdAfx.cpp new file mode 100644 index 00000000..8957144d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/StdAfx.cpp @@ -0,0 +1,16 @@ +///////////////////////////// +// StdAfx.cpp +// + +// This file is used for precompiled hearders. Precompiled headers allow +// programs to be recompiled more quickly + +// To use precompiled headers, do the following: +// 1) Add the set of rarely changed headers to stdafx.h +// 2) Include stdafx.h in each cpp file. It must be included first. +// 3) Add stdafx.cpp to your project. +// 4) Turn on precompiled hearders in the project + + +#include "stdafx.h" + diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/TabbedMDIApp.cpp b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/TabbedMDIApp.cpp new file mode 100644 index 00000000..31ae096f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/TabbedMDIApp.cpp @@ -0,0 +1,20 @@ +///////////////////////////// +// TabbedMDIApp.cpp +// + +#include "stdafx.h" +#include "TabbedMDIApp.h" + +///////////////////////////////////////// +// CDockContainerApp function definitions +// + +// Called when the application starts. +BOOL CTabbedMDIApp::InitInstance() +{ + // Create the frame window. + m_frame.Create(); // throws a CWinException on failure + + return TRUE; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/TabbedMDIApp.h b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/TabbedMDIApp.h new file mode 100644 index 00000000..95c8e35f --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/TabbedMDIApp.h @@ -0,0 +1,32 @@ +///////////////////////////// +// TabbedMDIApp.h +// + +#ifndef TABBEDMDIAPP_H +#define TABBEDMDIAPP_H + +#include "Mainfrm.h" + + +//////////////////////////////////////////////////////////// +// CTabbedMDIApp manages the application. It initializes the +// Win32++ framework when it is constructed, and creates the +// main frame window when it runs. +class CTabbedMDIApp : public CWinApp +{ +public: + CTabbedMDIApp() = default; + virtual ~CTabbedMDIApp() override = default; + +protected: + virtual BOOL InitInstance() override; + +private: + CTabbedMDIApp(const CTabbedMDIApp&) = delete; + CTabbedMDIApp& operator=(const CTabbedMDIApp&) = delete; + + CMainFrame m_frame; +}; + + +#endif // TABBEDMDIAPP_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Text.cpp b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Text.cpp new file mode 100644 index 00000000..0aebcbf4 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Text.cpp @@ -0,0 +1,240 @@ +/////////////////////////////////////////////////// +// Text.cpp - Definitions for the CViewText, +// and CDockText classes +// + +#include "stdafx.h" +#include "Text.h" +#include "resource.h" + + +///////////////////////////////// +// CViewText function definitions +// + +// Called when a window handle (HWND) is attached to CViewText. +void CViewText::OnAttach() +{ + CFont font; + font.CreatePointFont(100, L"Courier New"); + SetFont(font); + SetWindowText(L"Text Edit Window\r\n\r\n You can type some text here ..."); + + // Advises the control to be per-monitor DPI aware. + // This affects the initial font size on a second monitor with different DPI. + SendMessage(WM_DPICHANGED_BEFOREPARENT); +} + +// Respond to keyboard accelerator keys. +BOOL CViewText::OnCommand(WPARAM wparam, LPARAM) +{ + UINT id = LOWORD(wparam); + + switch (id) + { + case IDM_EDIT_COPY: return OnEditCopy(); + case IDM_EDIT_PASTE: return OnEditPaste(); + case IDM_EDIT_CUT: return OnEditCut(); + case IDM_EDIT_DELETE: return OnEditDelete(); + case IDM_EDIT_REDO: return OnEditRedo(); + case IDM_EDIT_UNDO: return OnEditUndo(); + } + + // return FALSE for unhandled commands + return FALSE; +} + +// Copies the selected text to the windows clipboard. +BOOL CViewText::OnEditCopy() +{ + Copy(); + return TRUE; +} + +// Copies text from the windows clipboard. +BOOL CViewText::OnEditPaste() +{ + PasteSpecial(CF_TEXT); + return TRUE; +} + +// Deletes the selected text and copies it to the windows clipboard. +BOOL CViewText::OnEditCut() +{ + Cut(); + return TRUE; +} + +// Deletes the selected text. +BOOL CViewText::OnEditDelete() +{ + Clear(); + return TRUE; +} + +// Redoes the next action in the control's redo queue. +BOOL CViewText::OnEditRedo() +{ + Redo(); + return TRUE; +} + +// Undoes the last edit control operation in the control's undo queue. +BOOL CViewText::OnEditUndo() +{ + Undo(); + return TRUE; +} + +// Sets the CREATESTRUCT parameters before the window is created. +void CViewText::PreCreate(CREATESTRUCT& cs) +{ + cs.style = ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE | WS_CHILD | + WS_CLIPCHILDREN | WS_HSCROLL | WS_VISIBLE | WS_VSCROLL; +} + +// Handle the window's messages. +LRESULT CViewText::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + + +//////////////////////////////////// +// CContainText function definitions + +// Constructor. +CContainText::CContainText() +{ + SetDockCaption (L"Text View - Docking container"); + SetTabText(L"Text"); + SetTabIcon(IDI_TEXT); + SetView(m_viewText); +} + +// Handle the window's messages. +LRESULT CContainText::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + + +///////////////////////////////// +// CDockText function definitions +// + +// Constructor. +CDockText::CDockText() +{ + // Set the view window to our edit control + SetView(m_view); + + // Set the width of the splitter bar + SetBarWidth(8); +} + +// This function overrides CDocker::RecalcDockLayout to eliminate jitter +// when the dockers are resized. The technique used here is is most +// appropriate for a complex arrangement of dockers. It might not suite +// other docking applications. To support this technique the +// WS_EX_COMPOSITED extended style has been added to some view windows. +void CDockText::RecalcDockLayout() +{ + if (GetWinVersion() >= 3000) // Windows 10 or later. + { + if (GetDockAncestor()->IsWindow()) + { + GetTopmostDocker()->LockWindowUpdate(); + CRect rc = GetTopmostDocker()->GetViewRect(); + GetTopmostDocker()->RecalcDockChildLayout(rc); + GetTopmostDocker()->UnlockWindowUpdate(); + GetTopmostDocker()->UpdateWindow(); + } + } + else + CDocker::RecalcDockLayout(); +} + +// Handle the window's messages. +LRESULT CDockText::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // Pass unhandled messages on for default processing. + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Text.h b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Text.h new file mode 100644 index 00000000..b5daf661 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/Text.h @@ -0,0 +1,83 @@ +/////////////////////////////////////////////////////// +// Text.h - Declaration of the CViewText, CContainText, +// and CDockText classes +// + +#ifndef TEXT_H +#define TEXT_H + +#include + + +/////////////////////////////////////////////////////////// +// CViewText manages a rich edit control. It displays text. +// This is the view window used by CContainText. +class CViewText : public CRichEdit +{ +public: + CViewText() = default; + virtual ~CViewText() override = default; + +protected: + virtual void OnAttach() override; + virtual BOOL OnCommand(WPARAM wparam, LPARAM lparam) override; + virtual void PreCreate(CREATESTRUCT& cs) override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CViewText(const CViewText&) = delete; + CViewText& operator=(const CViewText&) = delete; + + // Command handlers + BOOL OnEditCopy(); + BOOL OnEditPaste(); + BOOL OnEditCut(); + BOOL OnEditDelete(); + BOOL OnEditRedo(); + BOOL OnEditUndo(); +}; + + +///////////////////////////////////////////////// +// CContainText manages a dock container. It uses +// CViewText as its view. +class CContainText : public CDockContainer +{ +public: + CContainText(); + virtual ~CContainText() override = default; + +protected: + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CContainText(const CContainText&) = delete; + CContainText& operator=(const CContainText&) = delete; + + CViewText m_viewText; +}; + + +//////////////////////////////////////////////////// +// CDockText manages a docker that uses CContainText +// as its view. +class CDockText : public CDocker +{ +public: + CDockText(); + virtual ~CDockText() override = default; + +protected: + virtual void RecalcDockLayout() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CDockText(const CDockText&) = delete; + CDockText& operator=(const CDockText&) = delete; + + CContainText m_view; +}; + + +#endif // TEXT_H + diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/main.cpp b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/main.cpp new file mode 100644 index 00000000..75053b07 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/main.cpp @@ -0,0 +1,40 @@ +///////////////////////////// +// main.cpp +// + +#include "stdafx.h" +#include "TabbedMDIApp.h" + +int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPWSTR, _In_ int) +{ + try + { + // Start Win32++. + CTabbedMDIApp theApp; + + // Run the application. + return theApp.Run(); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return -1; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/Dialog.ico b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/Dialog.ico new file mode 100644 index 00000000..bfdb38b7 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/Dialog.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/Docking.ico b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/Docking.ico new file mode 100644 index 00000000..575558c8 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/Docking.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/Globe.ico b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/Globe.ico new file mode 100644 index 00000000..2b272875 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/Globe.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/PerMonitorV2.manifest b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/PerMonitorV2.manifest new file mode 100644 index 00000000..d303e5c0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/PerMonitorV2.manifest @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + PerMonitorV2, PerMonitor + + + + + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/SDbottom.bmp b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/SDbottom.bmp new file mode 100644 index 00000000..0942ef90 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/SDbottom.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/SDcenter.bmp b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/SDcenter.bmp new file mode 100644 index 00000000..a1bf71dd Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/SDcenter.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/SDleft.bmp b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/SDleft.bmp new file mode 100644 index 00000000..ec3a4c29 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/SDleft.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/SDmiddle.bmp b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/SDmiddle.bmp new file mode 100644 index 00000000..71fc66ff Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/SDmiddle.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/SDright.bmp b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/SDright.bmp new file mode 100644 index 00000000..12810dfa Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/SDright.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/SDtop.bmp b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/SDtop.bmp new file mode 100644 index 00000000..1f92af41 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/SDtop.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/SplitH.cur b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/SplitH.cur new file mode 100644 index 00000000..bb03d773 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/SplitH.cur differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/SplitV.cur b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/SplitV.cur new file mode 100644 index 00000000..1fd0d55c Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/SplitV.cur differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/Text.ico b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/Text.ico new file mode 100644 index 00000000..9f9d8fa1 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/Text.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/Toolbar16.bmp b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/Toolbar16.bmp new file mode 100644 index 00000000..79ad442f Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/Toolbar16.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/Toolbar24.bmp b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/Toolbar24.bmp new file mode 100644 index 00000000..4000d938 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/Toolbar24.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/classview.bmp b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/classview.bmp new file mode 100644 index 00000000..6b22e786 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/classview.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/classview.ico b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/classview.ico new file mode 100644 index 00000000..b1541c85 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/classview.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/fileview.bmp b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/fileview.bmp new file mode 100644 index 00000000..b60f4838 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/fileview.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/fileview.ico b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/fileview.ico new file mode 100644 index 00000000..9f73b57c Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/fileview.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/rect.ico b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/rect.ico new file mode 100644 index 00000000..f928305e Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/res/rect.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/resource.h b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/resource.h new file mode 100644 index 00000000..93a6c712 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/resource.h @@ -0,0 +1,84 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Resource.rc +// + +// include the Resource IDs defined by Win32++ +#include "default_resource.h" + + +//Resource IDs for menu items and ToolBar items +#define IDM_FILE_NEW 101 +#define IDM_FILE_OPEN 102 +#define IDM_FILE_SAVE 103 +#define IDM_FILE_SAVEAS 104 +#define IDM_FILE_PRINT 105 +#define IDM_FILE_CLOSE 106 +#define IDM_FILE_EXIT 107 +#define IDM_EDIT_UNDO 110 +#define IDM_EDIT_REDO 111 +#define IDM_EDIT_CUT 112 +#define IDM_EDIT_COPY 113 +#define IDM_EDIT_PASTE 114 +#define IDM_EDIT_DELETE 115 +#define IDM_HELP_ABOUT 120 + +// Bitmaps for the ClassView and FileFiew +#define IDB_CLASSVIEW 130 +#define IDB_FILEVIEW 131 + +// Bitmap for small menu icons +#define IDB_TOOLBAR16 133 + +// Icons for container tabs +#define IDI_GLOBE 133 +#define IDI_RECT 134 +#define IDI_DIALOGVIEW 135 +#define IDI_CLASSVIEW 136 +#define IDI_FILEVIEW 137 +#define IDI_TEXT 138 + +// Menu Resource +#define IDM_NEWMENU 140 +#define IDM_FILE_NEWBROWSER 141 +#define IDM_FILE_NEWRECT 142 +#define IDM_FILE_NEWTEXT 143 +#define IDM_FILE_NEWTREE 144 +#define IDM_FILE_NEWLIST 145 +#define IDM_CONTAINER_TOP 146 +#define IDM_TABBEDMDI_TOP 147 +#define IDM_HIDE_SINGLE_TAB 148 +#define IDM_DEFAULT_LAYOUT 149 +#define IDM_CLOSE_DOCKERS 150 +#define IDM_CLOSE_MDIS 151 + +// Resource IDs for the dialog +#define IDD_MYDIALOG 161 +#define IDC_RADIO1 162 +#define IDC_RADIO2 163 +#define IDC_RADIO3 164 +#define IDC_CHECK1 165 +#define IDC_CHECK2 166 +#define IDC_CHECK3 167 +#define IDC_EDIT1 170 +#define IDC_LIST1 171 +#define IDC_BUTTON1 172 +#define IDC_RICHEDIT1 173 +#define IDC_RICHEDIT2 174 +#define IDC_STATIC1 180 +#define IDC_STATIC2 181 +#define IDC_STATIC3 182 +#define IDC_HOTKEY1 183 +#define IDB_BITMAP1 184 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 159 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 160 +#endif +#endif diff --git a/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/stdafx.h b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/stdafx.h new file mode 100644 index 00000000..08450116 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DockTabbedMDI/src/stdafx.h @@ -0,0 +1,90 @@ +///////////////////////////// +// StdAfx.h +// + +// This file is used for precompiled headers. +// Rarely modified header files should be included. +// Based on code provided by Lynn Allan. + + +#ifndef STDAFX_H +#define STDAFX_H + + +// Predefinitions for windows.h go here +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +// Specify Win32xx specific predefinitions here +//#define NO_USING_NAMESPACE // Don't use Win32xx namespace + +// Rarely modified header files should be included here +#include // Add support for std::vector +#include // Add support for std::map +#include // Add support for std::string +#include // Add support for stringstream +#include // Add support for the assert macro +#include // Add support for C style printf, sprintf, etc. +#include // Add support for C style character conversions atoi etc. +#include // Add support for C style TCHARs. + +// Add the Win32++ library +#include // Add CWinApp +#include // Add CArchive +#include // Add CAnimation, CComboBox, CComboBoxEx, CDateTime, CHeader, CHotKey, CIPAddress, CProgressBar, CSpinButton, CScrollBar, CSlider, CToolTip +#include // Add CCriticalSection, CThreadLock +#include // Add CString, CStringA, CStringW +#include // Add CDataExchange +#include // Add CDialog, CResizer +#include // Add CDockFrame, CMDIDockFrame +#include // Add CDocker, CDockContainer +#include // Add CException, CFileException, CNotSupportedException, CResourceException, CUserException, CWinException +#include // Add CFile +#include // Add CFileFind +#include // Add CFolderDialog +#include // Add CFrame +#include // Add CDC, CGDIObject, CBitmap, CBrush, CFont, CPalatte, CPen, CRgn +#include // Add CHGlobal +#include // Add CImageList +#include // Add CListView +#include // Add CMDIChild, CMDIFrame, CDockMDIFrame +#include // Add CMenu +#include // Add CMenuBar +#include // Add CMetaFile, CEnhMetaFile +#include // Add CEvent, CMutex, CSemaphore +#include // Add CPropertyPage, CPropertySheet +#include // Add CRebar +#include // Add CPoint, CRect, CSize +#include // Add CRegKey +#include // Add CRichEdit +#include // Add CScrollView +#include // Adds macros, windows header files, and CObject +#include // Add CSocket +#include // Add CStatusBar +#include // Add CButton, CEdit, CListBox +#include // Add CTab, CTabbedMDI +#include // Add AtoT, AtoW, TtoA, TtoW, WtoA, WtoT etc. +#include // Add MenuTheme, ReBarTheme, StatusBarTheme, ToolBarTheme +#include // Add CWinThread +#include // Add CTime +#include // Add CToolBar +#include // Add CTreeView +#include // Add CWebBrowser, CAXHost +#include // Add CWnd + +// WIN32_LEAN_AND_MEAN can't be used with these +#ifndef WIN32_LEAN_AND_MEAN + #include // Add CCommonDialog, CColorDialog, CFileDialog, CFindReplace, CFontDialog + #include // Add CFolderDialogEx + #include // Add CPrintPreview + #include // Add CPageSetupDialog, CPrintDialog + #include // Add CPrintDialogEx + #include // Add CTaskDialog + + // Visual Studio + #if defined (_MSC_VER) + #include // Add CRibbon, CRibbonFrame + #endif + +#endif // define WIN32_LEAN_AND_MEAN + +#endif // define STDAFX_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer.cbp b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer.cbp new file mode 100644 index 00000000..738ae32d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer.cbp @@ -0,0 +1,141 @@ + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer.cbproj b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer.cbproj new file mode 100644 index 00000000..98c9091e --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer.cbproj @@ -0,0 +1,1527 @@ + + + {39461456-1040-43CB-9B40-5962EF847BB0} + 20.1 + None + True + Release + Win64x + 1048579 + Application + DoubleBuffer + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + JPHNE + .\Embarcadero\$(Platform)\$(Config) + .\Embarcadero\$(Platform)\$(Config) + false + true + true + $(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + CppGuiApplication + System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + true + <_TCHARMapping>wchar_t + DoubleBuffer + ..\..\..\include\;..\src\;$(IncludePath) + ..\..\..\include\;..\src\;$(ILINK_LibraryPath) + 3081 + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + $(BDSINCLUDE)\windows\sdk;$(BRCC_IncludePath) + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + adortl;appanalytics;bcbie;bcbsmp;bindcomp;bindcompdbx;bindcompfmx;bindcompvcl;bindcompvclsmp;bindcompvclwinx;bindengine;CloudService;CustomIPTransport;dbexpress;dbrtl;dbxcds;DbxClientDriver;DbxCommonDriver;DBXInterBaseDriver;DBXMySQLDriver;DBXSqliteDriver;dsnap;dsnapcon;dsnapxml;FireDAC;FireDACADSDriver;FireDACCommon;FireDACCommonDriver;FireDACCommonODBC;FireDACIBDriver;FireDACMSAccDriver;FireDACMySQLDriver;FireDACPgDriver;FireDACSqliteDriver;fmx;fmxase;fmxdae;fmxFireDAC;fmxobj;IndyCore;IndyIPClient;IndyIPCommon;IndyIPServer;IndyProtocols;IndySystem;inet;inetdb;inetdbxpress;RESTBackendComponents;RESTComponents;rtl;soapmidas;soaprtl;soapserver;tethering;vcl;vclactnband;vcldb;vcldsnap;vcledge;vclFireDAC;vclie;vclimg;VCLRESTComponents;VclSmp;vcltouch;vclwinx;vclx;xmlrtl;$(PackageImports) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + ..\src\stdafx.h + none + + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + 1033 + (None) + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\cppreg_UwpDefault_150.png + none + ..\src\stdafx.h + + + false + true + false + true + _DEBUG;$(Defines) + false + None + DEBUG + true + true + true + true + Full + true + true + true + true + true + $(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath) + $(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath) + + + PerMonitorV2 + false + $(BDSLIB)\$(PLATFORM)$(CC_SUFFIX)\debug;$(ILINK_LibraryPath) + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + + + NDEBUG;$(Defines) + None + + + PerMonitorV2 + false + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + (None) + + + PerMonitorV2 + true + 1033 + + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 64 + + + 65 + + + 0 + + + 1 + + + 2 + + + 3 + + + 4 + + + 5 + + +
Resource.res
+ 6 +
+ + 7 + + + 8 + true + + + 10 + + + 11 + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + +
+ + CPlusPlusBuilder.Personality.12 + CppGuiApplication + + + + False + True + True + False + + + Embarcadero C++Builder Office 2000 Servers Package + Embarcadero C++Builder Office XP Servers Package + + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + Assets\ + Logo150x150.png + true + + + + + Assets\ + Logo44x44.png + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + DoubleBuffer.exe + true + + + + + DoubleBuffer.exe + true + + + + + NewProject.exe + true + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 64 + + + classes + 64 + + + + + res\xml + 1 + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\mips + 1 + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-v21 + 1 + + + res\values-v21 + 1 + + + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + Contents + 1 + + + Contents + 1 + + + Contents + 1 + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + library\lib\armeabi-v7a + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen + 64 + + + ..\$(PROJECTNAME).launchscreen + 64 + + + + + 1 + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + Assets + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + + + + + + + + + + + + + True + True + True + + + 12 + + + + +
diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2015.sln b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2015.sln new file mode 100644 index 00000000..89759017 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2015.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DoubleBuffer", "DoubleBuffer_2015.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2015.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2015.vcxproj new file mode 100644 index 00000000..30286137 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2015.vcxproj @@ -0,0 +1,254 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DoubleBuffer + DoubleBuffer + + + + Application + Unicode + v140_xp + + + Application + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + Application + true + Unicode + v140_xp + + + + + + + + + + + + + + + + + + + true + false + + + true + false + + + false + false + + + false + false + + + + Use + Level4 + true + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + Disabled + EnableFastChecks + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MaxSpeed + MultiThreaded + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + true + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2015.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2015.vcxproj.filters new file mode 100644 index 00000000..da2f4144 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2015.vcxproj.filters @@ -0,0 +1,235 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + + + Resource Files + + + Resource Files + + + + + {4b33bf11-a789-44ab-84fc-25e42aeb3566} + + + {2bcb4923-70d9-45dd-9bbe-58deefa2929c} + + + {175079c0-8ffb-4c1e-9784-f7c4f6a99390} + + + {41aad11e-81bd-4a4d-9c27-54b295b6c33d} + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2019.sln b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2019.sln new file mode 100644 index 00000000..3c148909 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2019.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DoubleBuffer", "DoubleBuffer_2019.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4BA80696-9327-4D2A-A62D-F83B3386DA7D} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2019.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2019.vcxproj new file mode 100644 index 00000000..487a60ca --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2019.vcxproj @@ -0,0 +1,227 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DoubleBuffer + DoubleBuffer + + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2019.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2019.vcxproj.filters new file mode 100644 index 00000000..d65896ce --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2019.vcxproj.filters @@ -0,0 +1,224 @@ + + + + + {86f9c332-508a-49e8-8e9d-b9fda76adb00} + + + {c624c101-d060-4bcd-8c66-887c0ada4dda} + + + {130f999b-e1a7-4ad0-8022-a7b6e70282db} + + + {c095f094-05a9-48fa-a6fb-cce28a91e2a8} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2022.sln b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2022.sln new file mode 100644 index 00000000..4f1f3e49 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2022.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DoubleBuffer", "DoubleBuffer_2022.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4977ABF6-FDDB-42E2-B7C9-FA94860CACEE} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2022.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2022.vcxproj new file mode 100644 index 00000000..b59246a7 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2022.vcxproj @@ -0,0 +1,238 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DoubleBuffer + DoubleBuffer + 10.0 + + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2022.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2022.vcxproj.filters new file mode 100644 index 00000000..d65896ce --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2022.vcxproj.filters @@ -0,0 +1,224 @@ + + + + + {86f9c332-508a-49e8-8e9d-b9fda76adb00} + + + {c624c101-d060-4bcd-8c66-887c0ada4dda} + + + {130f999b-e1a7-4ad0-8022-a7b6e70282db} + + + {c095f094-05a9-48fa-a6fb-cce28a91e2a8} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2026.slnx b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2026.slnx new file mode 100644 index 00000000..7f524115 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2026.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2026.vcxproj b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2026.vcxproj new file mode 100644 index 00000000..1d3be24d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2026.vcxproj @@ -0,0 +1,238 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + DoubleBuffer + DoubleBuffer + 10.0 + + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2026.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2026.vcxproj.filters new file mode 100644 index 00000000..cb781490 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_2026.vcxproj.filters @@ -0,0 +1,224 @@ + + + + + {86f9c332-508a-49e8-8e9d-b9fda76adb00} + + + {c624c101-d060-4bcd-8c66-887c0ada4dda} + + + {130f999b-e1a7-4ad0-8022-a7b6e70282db} + + + {c095f094-05a9-48fa-a6fb-cce28a91e2a8} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_DEBUG.dev b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_DEBUG.dev new file mode 100644 index 00000000..c755b40a --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_DEBUG.dev @@ -0,0 +1,171 @@ +[Project] +FileName=DoubleBuffer_DEBUG.dev +Name=DoubleBuffer +UnitCount=12 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=DoubleBuffer_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D _DEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@__@@__@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Debug +ObjectOutput=.\Dev-C++\Debug +OverrideOutput=1 +OverrideOutputName=DoubleBuffer.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=4 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[Unit1] +FileName=..\src\DoubleBufferApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\DoubleBufferApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\Mainfrm.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\Mainfrm.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\Resource.rc +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit8] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit10] +FileName=..\src\View.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit11] +FileName=..\src\View.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit12] +FileName=..\src\AboutDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_RELEASE.dev b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_RELEASE.dev new file mode 100644 index 00000000..e4c01bf8 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/ProjectFiles/DoubleBuffer_RELEASE.dev @@ -0,0 +1,171 @@ +[Project] +FileName=DoubleBuffer_RELEASE.dev +Name=DoubleBuffer +UnitCount=12 +Type=0 +Ver=2 +ObjFiles= +Includes=..\..\..\include +Libs= +PrivateResource=DoubleBuffer_private.rc +ResourceIncludes=..\..\..\include +MakeIncludes= +Compiler= +CppCompiler=-D NDEBUG_@@_-DUNICODE_@@_-D_UNICODE_@@_ +Linker=-lComctl32_@@_-lOle32_@@_-lOleaut32_@@_-lUuid_@@_-lWs2_32_@@_-s_@@_-municode_@@_ +IsCpp=1 +Icon= +ExeOutput=.\Dev-C++\Release +ObjectOutput=.\Dev-C++\Release +OverrideOutput=1 +OverrideOutputName=DoubleBuffer.exe +HostApplication= +Folders=Header,Resource,Source,Win32++ +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=3 +CompilerSettings=0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0 +LogOutput= +LogOutputEnabled=0 + +[Unit1] +FileName=..\src\DoubleBufferApp.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=..\src\DoubleBufferApp.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=..\src\main.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=..\src\Mainfrm.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=..\src\Mainfrm.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=..\src\resource.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=..\src\Resource.rc +Folder=Resource +Compile=1 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit8] +FileName=..\src\StdAfx.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit9] +FileName=..\src\stdafx.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=0.1.1.1 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 +SyncProduct=0 + +[Unit10] +FileName=..\src\View.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit11] +FileName=..\src\View.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit12] +FileName=..\src\AboutDialog.h +CompileCpp=1 +Folder=Header +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/Readme.txt new file mode 100644 index 00000000..1956be03 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/Readme.txt @@ -0,0 +1,16 @@ +Double Buffer Demo +================== +This sample demonstrates double buffering. Two moving balls are drawn to +a memory DC. The second ball drawn is drawn with a mask so it neatly +overlaps first ball. + + +Note: GDI drawing is not particularly fast. If you require faster graphics +rendering for animations, consider using GDIPlus or DirectX. + + +Features demonstrated in this example +===================================== +* Using CMemDC to create a memory DC for double buffering +* Creating a mask bitmap +* Using the mask bitmap to clip a bitmap image. \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/AboutDialog.h b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/AboutDialog.h new file mode 100644 index 00000000..71e4364d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/AboutDialog.h @@ -0,0 +1,31 @@ +///////////////////////////////////////////// +// AboutDialog.h + +#ifndef _ABOUTDIALOG_H_ +#define _ABOUTDIALOG_H_ + +#include "resource.h" + +//////////////////////////////////////////////////////// +// CAboutDialog manages the dialog which displays +// information about this program. +class CAboutDialog : public CDialog +{ +public: + CAboutDialog() : CDialog(IDW_ABOUT) {} + virtual BOOL OnInitDialog() override + { + // Set the Win32++ version string. + UINT ver = _WIN32XX_VER; + CString Win32xxVersion; + Win32xxVersion << "Win32++ Version " << ver / 0x100 << "." << + (ver % 0x100) / 0x10 << "." << (ver % 0x10); + + SetDlgItemText(IDC_STATIC1, Win32xxVersion); + SetDlgItemText(IDC_STATIC2, L"by David Nash"); + + return TRUE; + } +}; + +#endif // _ABOUTDIALOG_H_ diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/DoubleBufferApp.cpp b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/DoubleBufferApp.cpp new file mode 100644 index 00000000..dc1a10e6 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/DoubleBufferApp.cpp @@ -0,0 +1,20 @@ +///////////////////////////// +// DoubleBufferApp.cpp +// + +#include "stdafx.h" +#include "DoubleBufferApp.h" + +//////////////////////////////////////// +// CDoubleBufferApp function definitions +// + +// Called after the window is created. +BOOL CDoubleBufferApp::InitInstance() +{ + // Create the frame window. + m_frame.Create(); // throws a CWinException on failure + + return TRUE; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/DoubleBufferApp.h b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/DoubleBufferApp.h new file mode 100644 index 00000000..733d1997 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/DoubleBufferApp.h @@ -0,0 +1,31 @@ +///////////////////////////// +// DoubleBufferApp.h +// + +#ifndef DOUBLEBUFFERAPP_H +#define DOUBLEBUFFERAPP_H + +#include "Mainfrm.h" + + +/////////////////////////////////////////////////////////////// +// CDoubleBufferApp manages the application. It initializes the +// Win32++ framework when it is constructed, and creates the +// main window when it runs. +class CDoubleBufferApp : public CWinApp +{ +public: + CDoubleBufferApp() = default; + virtual ~CDoubleBufferApp() override = default; + +protected: + virtual BOOL InitInstance() override; + +private: + CDoubleBufferApp(const CDoubleBufferApp&) = delete; + CDoubleBufferApp& operator=(const CDoubleBufferApp&) = delete; + + CMainFrame m_frame; +}; + +#endif // define DOUBLEBUFFERAPP_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/Mainfrm.cpp b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/Mainfrm.cpp new file mode 100644 index 00000000..97cc2de0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/Mainfrm.cpp @@ -0,0 +1,156 @@ +///////////////////////////// +// Mainfrm.cpp +// + +#include "stdafx.h" +#include "Mainfrm.h" +#include "resource.h" + +constexpr COLORREF lightgray = RGB(192, 192, 192); + +////////////////////////////////// +// CMainFrame function definitions +// + +// Create the frame window. +HWND CMainFrame::Create(HWND parent) +{ + //Set m_view as the view window of the frame. + SetView(m_view); + + // Set the registry key name, and load the initial window position + // Use a registry key name like "CompanyName\\Application" + LoadRegistrySettings(L"Win32++\\Double Buffer"); + + return CFrame::Create(parent); +} + +// OnCommand responds to menu and and toolbar input. +BOOL CMainFrame::OnCommand(WPARAM wparam, LPARAM) +{ + UINT id = LOWORD(wparam); + + switch(id) + { + case IDM_FILE_EXIT: return OnFileExit(); + case IDW_VIEW_STATUSBAR: return OnViewStatusBar(); + case IDW_VIEW_TOOLBAR: return OnViewToolBar(); + case IDM_HELP_ABOUT: return OnHelp(); + } + + return FALSE; +} + +// OnCreate controls the way the frame is created. +// Overriding CFrame::OnCreate is optional. +int CMainFrame::OnCreate(CREATESTRUCT& cs) +{ + // A menu is added if the IDW_MAIN menu resource is defined. + // Frames have all options enabled by default. + // Use the following functions to disable options. + + // UseIndicatorStatus(FALSE); // Don't show keyboard indicators in the StatusBar + // UseMenuStatus(FALSE); // Don't show menu descriptions in the StatusBar + // UseReBar(FALSE); // Don't use a ReBar + // UseStatusBar(FALSE); // Don't use a StatusBar + // UseThemes(FALSE); // Don't use themes + // UseToolBar(FALSE); // Don't use a ToolBar + + // call the base class function + return CFrame::OnCreate(cs); +} + +// Issue a close request to the frame to end the program. +BOOL CMainFrame::OnFileExit() +{ + Close(); + return TRUE; +} + +// Display the help about dialog. +BOOL CMainFrame::OnHelp() +{ + // Ensure only one dialog displayed even for multiple hits of the F1 button. + if (!m_aboutDialog.IsWindow()) + { + m_aboutDialog.DoModal(*this); + } + + return TRUE; +} + +// Called after the frame window is created. +void CMainFrame::OnInitialUpdate() +{ + // The frame is now created. + // Place any additional startup code here. + + TRACE("Frame created\n"); +} + +// Specifies the images for some of the menu items. +void CMainFrame::SetupMenuIcons() +{ + std::vector data = GetToolBarData(); + if (GetMenuIconHeight() >= 24) + SetMenuIcons(data, lightgray, IDW_MAIN); + else + SetMenuIcons(data, lightgray, IDB_MENUICONS); +} + +// Set the Resource IDs for the toolbar buttons +void CMainFrame::SetupToolBar() +{ + AddToolBarButton( IDM_FILE_NEW ); + AddToolBarButton( IDM_FILE_OPEN, FALSE); // disabled button + AddToolBarButton( IDM_FILE_SAVE, FALSE); // disabled button + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_EDIT_CUT, FALSE ); // disabled button + AddToolBarButton( IDM_EDIT_COPY, FALSE ); // disabled button + AddToolBarButton( IDM_EDIT_PASTE, FALSE ); // disabled button + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_FILE_PRINT, FALSE); // disabled button + + AddToolBarButton( 0 ); // Separator + AddToolBarButton( IDM_HELP_ABOUT ); +} + +// Process the frame's window messages. +LRESULT CMainFrame::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + // switch (msg) + // { + // Add case statements for each messages to be handled here + // } + + // pass unhandled messages on for default processing + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/Mainfrm.h b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/Mainfrm.h new file mode 100644 index 00000000..3025e16c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/Mainfrm.h @@ -0,0 +1,44 @@ +///////////////////////////// +// Mainfrm.h +// + +#ifndef MAINFRM_H +#define MAINFRM_H + +#include "AboutDialog.h" +#include "View.h" + + +/////////////////////////////////////////////////////////// +// CMainFrame manages the application's main window. +// The main window is a frame which has a menubar, toolbar, +// statusbar and view window. +class CMainFrame : public CFrame +{ +public: + CMainFrame() = default; + virtual ~CMainFrame() override = default; + virtual HWND Create(HWND parent = nullptr) override; + +protected: + virtual BOOL OnCommand(WPARAM wparam, LPARAM lparam) override; + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual BOOL OnHelp() override; + virtual void OnInitialUpdate() override; + virtual void SetupMenuIcons() override; + virtual void SetupToolBar() override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CMainFrame(const CMainFrame&) = delete; + CMainFrame& operator=(const CMainFrame&) = delete; + + // Command handlers + BOOL OnFileExit(); + + // Member variables + CAboutDialog m_aboutDialog; + CView m_view; +}; + +#endif //MAINFRM_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/Resource.rc b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/Resource.rc new file mode 100644 index 00000000..fc6fbd84 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/Resource.rc @@ -0,0 +1,207 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "../src/res/PerMonitorV2.manifest" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDW_MAIN MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "New\tCtrl+N", IDM_FILE_NEW, GRAYED + MENUITEM "&Open...\tCtrl+O", IDM_FILE_OPEN, GRAYED + MENUITEM "&Save\tCtrl+S", IDM_FILE_SAVE, GRAYED + MENUITEM "Save &As...", IDM_FILE_SAVEAS, GRAYED + MENUITEM SEPARATOR + MENUITEM "&Print...\tCtrl+P", IDM_FILE_PRINT, GRAYED + MENUITEM SEPARATOR + MENUITEM "E&xit\tAlt+F4", IDM_FILE_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "Undo\tCtrl+Z", IDM_EDIT_UNDO, GRAYED + MENUITEM "Redo\tCtrl+Y", IDM_EDIT_REDO, GRAYED + MENUITEM SEPARATOR + MENUITEM "Cut\tCtrl+X", IDM_EDIT_CUT, GRAYED + MENUITEM "Copy\tCtrl+C", IDM_EDIT_COPY, GRAYED + MENUITEM "Paste\tCtrl+V", IDM_EDIT_PASTE, GRAYED + MENUITEM "Delete\tDel", IDM_EDIT_DELETE, GRAYED + END + POPUP "&View" + BEGIN + MENUITEM "&Tool Bar", IDW_VIEW_TOOLBAR, CHECKED + MENUITEM "&Status Bar", IDW_VIEW_STATUSBAR, CHECKED + END + POPUP "&Help" + BEGIN + MENUITEM "&About\tF1", IDM_HELP_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDW_MAIN ICON "../src/res/Blue.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDW_MAIN BITMAP "../src/res/toolbar.bmp" +IDB_MENUICONS BITMAP "../src/res/MenuIcons.bmp" +IDB_BLUE BITMAP "../src/res/Blue.bmp" +IDB_ORANGE BITMAP "../src/res/Orange.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDW_ABOUT DIALOGEX 0, 0, 186, 109 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "MS Shell Dlg", 400, 0 +BEGIN + DEFPUSHBUTTON "OK",IDOK,68,60,50,14 + CTEXT "Double Buffer Demo",IDC_STATIC,43,22,99,8 + ICON IDW_MAIN,0,4,4,20,20 + CTEXT "",IDC_STATIC1,53,32,80,8 + CTEXT "",IDC_STATIC2,53,42,80,8 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDW_MAIN ACCELERATORS +BEGIN + "N", IDM_FILE_NEW, VIRTKEY, CONTROL, NOINVERT + "O", IDM_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT + "P", IDM_FILE_PRINT, VIRTKEY, CONTROL, NOINVERT + "S", IDM_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT + "C", IDM_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + "X", IDM_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT + "V", IDM_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT + "Z", IDM_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT + "Y", IDM_EDIT_REDO, VIRTKEY, CONTROL, NOINVERT +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDW_MAIN "Double Buffer Demo" + IDW_INDICATOR_CAPS "CAP" + IDW_INDICATOR_NUM "NUM" + IDW_INDICATOR_SCRL "SCRL" + IDW_READY "Ready" + IDW_VIEW_TOOLBAR "Show or hide the tool bar" + IDW_VIEW_STATUSBAR "Show or hide the status bar" +END + +STRINGTABLE +BEGIN + IDM_FILE_NEW "Create a New Document" + IDM_FILE_OPEN "Open Existing Document" + IDM_FILE_SAVE "Save the Document" + IDM_FILE_SAVEAS "Save the Document with a new name" + IDM_FILE_PRINT "Print the Document" + IDM_FILE_EXIT "End the Program" + IDM_EDIT_UNDO "Undo the last action" + IDM_EDIT_REDO "Redo the previously undone action" +END + +STRINGTABLE +BEGIN + IDM_EDIT_CUT "Cut the Selected Contents to the Clipboard" + IDM_EDIT_COPY "Copy the Selected Contents to the Clipboard" + IDM_EDIT_PASTE "Paste the Clipboard Contents to the Document" + IDM_EDIT_DELETE "Erase the selected Contents" + IDM_HELP_ABOUT "Display Information about this program" +END + +STRINGTABLE +BEGIN + SC_CLOSE "Close the Window" + SC_MAXIMIZE "Maximize the Window" + SC_MINIMIZE "Minimize the Window" + SC_MOVE "Move the Window" + SC_NEXTWINDOW "Select Next Window" + SC_PREVWINDOW "Select Previous Window" + SC_RESTORE "Restore the Window" + SC_SIZE "Resize the Window" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/StdAfx.cpp b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/StdAfx.cpp new file mode 100644 index 00000000..8957144d --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/StdAfx.cpp @@ -0,0 +1,16 @@ +///////////////////////////// +// StdAfx.cpp +// + +// This file is used for precompiled hearders. Precompiled headers allow +// programs to be recompiled more quickly + +// To use precompiled headers, do the following: +// 1) Add the set of rarely changed headers to stdafx.h +// 2) Include stdafx.h in each cpp file. It must be included first. +// 3) Add stdafx.cpp to your project. +// 4) Turn on precompiled hearders in the project + + +#include "stdafx.h" + diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/View.cpp b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/View.cpp new file mode 100644 index 00000000..0ab3b7ca --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/View.cpp @@ -0,0 +1,180 @@ +///////////////////////////// +// View.cpp +// + +#include "stdafx.h" +#include "View.h" +#include "resource.h" + +constexpr COLORREF white = RGB(255, 255, 255); + +///////////////////////////// +// CView function definitions +// + +// Creates the mask bitmap for the ball. +CBitmap CView::CreateMaskBitmap() +{ + BITMAP bm = m_blue.GetBitmapData(); + CBitmap mask; + mask.CreateBitmap(bm.bmWidth, bm.bmHeight, 1, 1, nullptr); + m_ballSize.cx = bm.bmWidth; + m_ballSize.cy = bm.bmHeight; + + CMemDC dcMem(nullptr); + CMemDC dcMem2(nullptr); + + SelectObject(dcMem, m_blue); + dcMem2.SelectObject(mask); + + COLORREF transparent = white; + SetBkColor(dcMem, transparent); + dcMem2.BitBlt(0, 0, bm.bmWidth, bm.bmHeight, dcMem, 0, 0, SRCCOPY); + dcMem.BitBlt(0, 0, bm.bmWidth, bm.bmHeight, dcMem2, 0, 0, SRCINVERT); + + return mask; +} + +// Called when the window is created. +int CView::OnCreate(CREATESTRUCT&) +{ + m_blue.LoadBitmap(IDB_BLUE); + m_orange.LoadBitmap(IDB_ORANGE); + m_mask = CreateMaskBitmap(); + + return 0; +} + +// OnInitialUpdate is called immediately after the window is created. +void CView::OnInitialUpdate() +{ + TRACE("View window created\n"); + + // Start the timer + SetTimer(ID_TIMER, 10, nullptr); +} + +// Redraws the balls in new positions when a timer event occurs. +LRESULT CView::OnTimer(UINT msg, WPARAM wparam, LPARAM lparam) +{ + CClientDC dc(*this); + CRect rc = GetClientRect(); + + static int x = 0; // x position + static int y = 0; // y position + static int cx = DpiScaleInt(1); // x increment or decrement + static int cy = DpiScaleInt(1); // y increment or decrement + + x = x + cx; + if (x > rc.Width() - m_ballSize.cx) + { + x = rc.Width() - m_ballSize.cx; + cx = -DpiScaleInt(1); + } + else if (x < 0) + { + x = 0; + cx = DpiScaleInt(1); + } + + y = y + cy; + if (y > rc.Height() - m_ballSize.cy) + { + y = rc.Height() - m_ballSize.cy; + cy = -DpiScaleInt(1); + } + else if (y < 0) + { + y = 0; + cy = DpiScaleInt(1); + } + + CMemDC dcMemMask(dc); + CBitmap mask = DpiScaleUpBitmap(m_mask); + dcMemMask.SelectObject(mask); + + CMemDC dcMemOrange(dc); + CBitmap orange = DpiScaleUpBitmap(m_orange); + dcMemOrange.SelectObject(orange); + + CMemDC dcMemBlue(dc); + CBitmap blue = DpiScaleUpBitmap(m_blue); + dcMemBlue.SelectObject(blue); + + CMemDC dcMem3(dc); + dcMem3.CreateCompatibleBitmap(dc, rc.Width(), rc.Height()); + dcMem3.SolidFill(white, rc); + + // Copy the orange ball to the memory DC + CSize orangeSize = orange.GetSize(); + dcMem3.BitBlt(x, 0, orangeSize.cx, orangeSize.cy, dcMemOrange, 0, 0, SRCCOPY); + + // Copy the blue ball to the memory DC with mask + CSize blueSize = blue.GetSize(); + dcMem3.BitBlt(0, y, blueSize.cx, blueSize.cy, dcMemMask, 0, 0, SRCERASE); + dcMem3.BitBlt(0, y, blueSize.cx, blueSize.cy, dcMemMask, 0, 0, SRCINVERT); + dcMem3.BitBlt(0, y, blueSize.cx, blueSize.cy, dcMemBlue, 0, 0, SRCINVERT); + + // Copy the memory DC to the client DC + dc.BitBlt(0,0, rc.Width(), rc.Height(), dcMem3, 0, 0, SRCCOPY); + + return FinalWindowProc(msg, wparam, lparam); +} + +// Set the WNDCLASS parameters before the window is created. +void CView::PreRegisterClass(WNDCLASS& wc) +{ + // Here we set the Window class parameters. + // Preforming this is optional, but doing so allows us to + // take more precise control over the type of window we create. + + // Set the Window Class name + wc.lpszClassName = L"Win32++ View"; + + // Set a background brush to white + wc.hbrBackground = static_cast(::GetStockObject(WHITE_BRUSH)); + + // Set the default cursor + wc.hCursor = ::LoadCursor(nullptr, IDC_ARROW); + + // Set the class style (not to be confused with the window styles set in PreCreate) + wc.style = CS_DBLCLKS; // Generate left button double click messages +} + +// All window messages for this window pass through WndProc +LRESULT CView::WndProc(UINT msg, WPARAM wparam, LPARAM lparam) +{ + try + { + switch (msg) + { + case WM_TIMER: return OnTimer(msg, wparam, lparam); + } + + // pass unhandled messages on for default processing + return WndProcDefault(msg, wparam, lparam); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return 0; +} + diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/View.h b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/View.h new file mode 100644 index 00000000..39f69b10 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/View.h @@ -0,0 +1,39 @@ +///////////////////////////// +// View.h +// + +#ifndef VIEW_H +#define VIEW_H + +////////////////////////////////////////// +// CView manages CMainFrame's view window. +class CView : public CWnd +{ +public: + CView() = default; + virtual ~CView() override = default; + +protected: + virtual int OnCreate(CREATESTRUCT& cs) override; + virtual void OnInitialUpdate() override; + virtual void PreRegisterClass(WNDCLASS& wc) override; + virtual LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override; + +private: + CView(const CView&) = delete; + CView& operator=(const CView&) = delete; + + // Command handlers + LRESULT OnTimer(UINT msg, WPARAM wparam, LPARAM lparam); + + CBitmap CreateMaskBitmap(); + + // Member variables + CBitmap m_blue; + CBitmap m_orange; + CBitmap m_mask; + CSize m_ballSize; +}; + + +#endif // VIEW_H diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/main.cpp b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/main.cpp new file mode 100644 index 00000000..8565bc58 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/main.cpp @@ -0,0 +1,40 @@ +///////////////////////////// +// main.cpp +// + +#include "stdafx.h" +#include "DoubleBufferApp.h" + +int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPWSTR, _In_ int) +{ + try + { + // Start Win32++. + CDoubleBufferApp theApp; + + // Run the application and the message loop. + return theApp.Run(); + } + + // Catch all unhandled CException types. + catch (const CException& e) + { + // Display the exception and continue. + CString str1; + str1 << e.GetText() << L'\n' << e.GetErrorString(); + + CString str2; + str2 << "Error: " << e.what(); + ::MessageBox(nullptr, str1, str2, MB_ICONERROR); + } + + // Catch all unhandled std::exception types. + catch (const std::exception& e) + { + // Display the exception and continue. + CString str1 = e.what(); + ::MessageBox(nullptr, str1, L"Error: std::exception", MB_ICONERROR); + } + + return -1; +} diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/res/Blue.bmp b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/res/Blue.bmp new file mode 100644 index 00000000..52387ad2 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/res/Blue.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/res/Blue.ico b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/res/Blue.ico new file mode 100644 index 00000000..574485eb Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/res/Blue.ico differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/res/MenuIcons.bmp b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/res/MenuIcons.bmp new file mode 100644 index 00000000..79ad442f Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/res/MenuIcons.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/res/Orange.bmp b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/res/Orange.bmp new file mode 100644 index 00000000..9ba9422c Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/res/Orange.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/res/PerMonitorV2.manifest b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/res/PerMonitorV2.manifest new file mode 100644 index 00000000..d303e5c0 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/res/PerMonitorV2.manifest @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + PerMonitorV2, PerMonitor + + + + + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/res/Toolbar.bmp b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/res/Toolbar.bmp new file mode 100644 index 00000000..4000d938 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/res/Toolbar.bmp differ diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/resource.h b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/resource.h new file mode 100644 index 00000000..05c6889c --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/resource.h @@ -0,0 +1,42 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Resource.rc +// + +// include the Resource IDs defined by Win32++ +#include "default_resource.h" + +#define IDM_FILE_NEW 121 +#define IDM_FILE_OPEN 122 +#define IDM_FILE_SAVE 123 +#define IDM_FILE_SAVEAS 124 +#define IDM_FILE_PRINT 125 +#define IDM_FILE_CLOSE 126 +#define IDM_FILE_EXIT 127 +#define IDM_EDIT_UNDO 130 +#define IDM_EDIT_REDO 131 +#define IDM_EDIT_CUT 132 +#define IDM_EDIT_COPY 133 +#define IDM_EDIT_PASTE 134 +#define IDM_EDIT_DELETE 135 +#define IDM_HELP_ABOUT 140 +#define IDB_MENUICONS 150 +#define IDB_BLUE 151 +#define IDB_ORANGE 152 +#define ID_TIMER 160 + +// About dialog +#define IDC_STATIC1 170 +#define IDC_STATIC2 171 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 130 +#endif +#endif diff --git a/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/stdafx.h b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/stdafx.h new file mode 100644 index 00000000..08450116 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/DoubleBuffer/src/stdafx.h @@ -0,0 +1,90 @@ +///////////////////////////// +// StdAfx.h +// + +// This file is used for precompiled headers. +// Rarely modified header files should be included. +// Based on code provided by Lynn Allan. + + +#ifndef STDAFX_H +#define STDAFX_H + + +// Predefinitions for windows.h go here +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +// Specify Win32xx specific predefinitions here +//#define NO_USING_NAMESPACE // Don't use Win32xx namespace + +// Rarely modified header files should be included here +#include // Add support for std::vector +#include // Add support for std::map +#include // Add support for std::string +#include // Add support for stringstream +#include // Add support for the assert macro +#include // Add support for C style printf, sprintf, etc. +#include // Add support for C style character conversions atoi etc. +#include // Add support for C style TCHARs. + +// Add the Win32++ library +#include // Add CWinApp +#include // Add CArchive +#include // Add CAnimation, CComboBox, CComboBoxEx, CDateTime, CHeader, CHotKey, CIPAddress, CProgressBar, CSpinButton, CScrollBar, CSlider, CToolTip +#include // Add CCriticalSection, CThreadLock +#include // Add CString, CStringA, CStringW +#include // Add CDataExchange +#include // Add CDialog, CResizer +#include // Add CDockFrame, CMDIDockFrame +#include // Add CDocker, CDockContainer +#include // Add CException, CFileException, CNotSupportedException, CResourceException, CUserException, CWinException +#include // Add CFile +#include // Add CFileFind +#include // Add CFolderDialog +#include // Add CFrame +#include // Add CDC, CGDIObject, CBitmap, CBrush, CFont, CPalatte, CPen, CRgn +#include // Add CHGlobal +#include // Add CImageList +#include // Add CListView +#include // Add CMDIChild, CMDIFrame, CDockMDIFrame +#include // Add CMenu +#include // Add CMenuBar +#include // Add CMetaFile, CEnhMetaFile +#include // Add CEvent, CMutex, CSemaphore +#include // Add CPropertyPage, CPropertySheet +#include // Add CRebar +#include // Add CPoint, CRect, CSize +#include // Add CRegKey +#include // Add CRichEdit +#include // Add CScrollView +#include // Adds macros, windows header files, and CObject +#include // Add CSocket +#include // Add CStatusBar +#include // Add CButton, CEdit, CListBox +#include // Add CTab, CTabbedMDI +#include // Add AtoT, AtoW, TtoA, TtoW, WtoA, WtoT etc. +#include // Add MenuTheme, ReBarTheme, StatusBarTheme, ToolBarTheme +#include // Add CWinThread +#include // Add CTime +#include // Add CToolBar +#include // Add CTreeView +#include // Add CWebBrowser, CAXHost +#include // Add CWnd + +// WIN32_LEAN_AND_MEAN can't be used with these +#ifndef WIN32_LEAN_AND_MEAN + #include // Add CCommonDialog, CColorDialog, CFileDialog, CFindReplace, CFontDialog + #include // Add CFolderDialogEx + #include // Add CPrintPreview + #include // Add CPageSetupDialog, CPrintDialog + #include // Add CPrintDialogEx + #include // Add CTaskDialog + + // Visual Studio + #if defined (_MSC_VER) + #include // Add CRibbon, CRibbonFrame + #endif + +#endif // define WIN32_LEAN_AND_MEAN + +#endif // define STDAFX_H diff --git a/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2019.sln b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2019.sln new file mode 100644 index 00000000..5f4571f5 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2019.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EdgeBrowser", "EdgeBrowser_2019.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {EA60A549-E66C-4EBE-8D5D-9EF0CAF31CC9} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2019.vcxproj b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2019.vcxproj new file mode 100644 index 00000000..618c3efb --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2019.vcxproj @@ -0,0 +1,224 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Simple + EdgeBrowser + + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + Unicode + v142 + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + NotUsing + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + NotUsing + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + NotUsing + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + NotUsing + ProgramDatabase + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2019.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2019.vcxproj.filters new file mode 100644 index 00000000..ecfd7f90 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2019.vcxproj.filters @@ -0,0 +1,200 @@ + + + + + {77616736-17a9-46e9-aa36-a07286d6bdeb} + + + {65cb0a1b-3278-4933-b75a-9ad93fbaeaa6} + + + {0f762e3c-3bda-4644-9d3b-4a2e7e3d1c44} + + + {e9fa149d-372f-4d29-885e-af6d2a09c917} + + + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Win32++ + + + + + Source Files + + + Source Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2022.sln b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2022.sln new file mode 100644 index 00000000..474480b2 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2022.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EdgeBrowser", "EdgeBrowser_2022.vcxproj", "{19CEEA56-2973-4E6A-818E-17DB81197AB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.ActiveCfg = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x64.Build.0 = Debug|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.ActiveCfg = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Debug|x86.Build.0 = Debug|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.ActiveCfg = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x64.Build.0 = Release|x64 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.ActiveCfg = Release|Win32 + {19CEEA56-2973-4E6A-818E-17DB81197AB5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3CB00DF8-43DA-4489-83E8-B23559A7AFBD} + EndGlobalSection +EndGlobal diff --git a/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2022.vcxproj b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2022.vcxproj new file mode 100644 index 00000000..d1d18e34 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2022.vcxproj @@ -0,0 +1,242 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Simple + EdgeBrowser + 10.0 + + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + Unicode + v143 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level3 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2022.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2022.vcxproj.filters new file mode 100644 index 00000000..d86967f5 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2022.vcxproj.filters @@ -0,0 +1,209 @@ + + + + + {77616736-17a9-46e9-aa36-a07286d6bdeb} + + + {65cb0a1b-3278-4933-b75a-9ad93fbaeaa6} + + + {0f762e3c-3bda-4644-9d3b-4a2e7e3d1c44} + + + {e9fa149d-372f-4d29-885e-af6d2a09c917} + + + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + + + Source Files + + + Source Files + + + Source Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2026.slnx b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2026.slnx new file mode 100644 index 00000000..38df08eb --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2026.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2026.vcxproj b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2026.vcxproj new file mode 100644 index 00000000..e6103400 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2026.vcxproj @@ -0,0 +1,242 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + {19CEEA56-2973-4E6A-818E-17DB81197AB5} + Win32Proj + Simple + EdgeBrowser + 10.0 + + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + Unicode + v145 + + + + + + + + + + + + + + + + + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + false + ..\src;$(IncludePath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + ..\src;$(IncludePath) + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Use + Level4 + MultiThreadedDebug + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + Disabled + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level4 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + Level3 + Use + MultiThreaded + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + ..\..\..\include + stdcpp20 + + + Windows + true + false + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + + + ..\..\..\include + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2026.vcxproj.filters b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2026.vcxproj.filters new file mode 100644 index 00000000..1ecfc4ac --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/ProjectFiles/EdgeBrowser_2026.vcxproj.filters @@ -0,0 +1,209 @@ + + + + + {77616736-17a9-46e9-aa36-a07286d6bdeb} + + + {65cb0a1b-3278-4933-b75a-9ad93fbaeaa6} + + + {0f762e3c-3bda-4644-9d3b-4a2e7e3d1c44} + + + {e9fa149d-372f-4d29-885e-af6d2a09c917} + + + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Win32++ + + + Header Files + + + Header Files + + + Header Files + + + Win32++ + + + + + Source Files + + + Source Files + + + Source Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/Readme.txt b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/Readme.txt new file mode 100644 index 00000000..18b2baf6 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/Readme.txt @@ -0,0 +1,48 @@ +EdgeBrowser Sample +================== +This sample uses the Microsoft Edge WebView2 control to display a browser in a +window. The WebView2 control uses Microsoft Edge as the rendering engine to +display the web content in native apps. + + +Features demonstrated in this example +===================================== +* Use of a of a WebView2 control to display a Microsoft Edge browser. +* Use of a simple window to host the WebView2 control. +* Use of Per Monitor DPI Version 2 added as manifest resource. + + +About the WebView2 Runtime. +=========================== +The WebView2 Runtime is required to run applications using the WebView2 control. +The Evergreen Runtime is preinstalled onto all Windows 11 devices as a part of +the Windows 11 operating system. Microsoft installed the WebView2 Runtime to all +eligible Windows 10 devices, as described in Delivering Microsoft Edge WebView2 +Runtime to managed Windows 10 devices. Even if your app uses the Evergreen +distribution mode, Microsoft recommends that you distribute the WebView2 Runtime, +to cover edge cases where the Runtime wasn't already installed. + +WebView2 Runtime version 109 is the final version that supports the following +versions of Windows. WebView2 Runtime and SDK version 110.0.1519.0 and higher +don't support these operating systems. + Windows 8/8.1 + Windows 7 + Windows Server 2012 R2 + Windows Server 2012 + Windows Server 2008 R2 + + +Refer here for information on distributing the runtime with your application: +https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution + + +Refer her for additional information on WebView2: +https://learn.microsoft.com/en-us/microsoft-edge/webview2/ + + +About this sample +================= +This sample was adapted from the information provided in the +"Get started with WebView2 in Win32 apps" article by Microsoft: +https://learn.microsoft.com/microsoft-edge/webview2/get-started/win32 + diff --git a/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/packages/Microsoft.Web.WebView2.1.0.902.49/.signature.p7s b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/packages/Microsoft.Web.WebView2.1.0.902.49/.signature.p7s new file mode 100644 index 00000000..66488604 Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/packages/Microsoft.Web.WebView2.1.0.902.49/.signature.p7s differ diff --git a/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/packages/Microsoft.Web.WebView2.1.0.902.49/LICENSE.txt b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/packages/Microsoft.Web.WebView2.1.0.902.49/LICENSE.txt new file mode 100644 index 00000000..45f02978 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/packages/Microsoft.Web.WebView2.1.0.902.49/LICENSE.txt @@ -0,0 +1,27 @@ +Copyright (C) Microsoft Corporation. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * The name of Microsoft Corporation, or the names of its contributors +may not be used to endorse or promote products derived from this +software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/packages/Microsoft.Web.WebView2.1.0.902.49/Microsoft.Web.WebView2.1.0.902.49.nupkg b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/packages/Microsoft.Web.WebView2.1.0.902.49/Microsoft.Web.WebView2.1.0.902.49.nupkg new file mode 100644 index 00000000..6da0316f Binary files /dev/null and b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/packages/Microsoft.Web.WebView2.1.0.902.49/Microsoft.Web.WebView2.1.0.902.49.nupkg differ diff --git a/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/packages/Microsoft.Web.WebView2.1.0.902.49/WebView2.idl b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/packages/Microsoft.Web.WebView2.1.0.902.49/WebView2.idl new file mode 100644 index 00000000..77a6eb79 --- /dev/null +++ b/packages/media/cpp/packages/Win32xx/samples/EdgeBrowser/packages/Microsoft.Web.WebView2.1.0.902.49/WebView2.idl @@ -0,0 +1,4979 @@ +// Copyright (C) Microsoft Corporation. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import "objidl.idl"; +import "oaidl.idl"; +import "EventToken.idl"; + +[uuid(26d34152-879f-4065-bea2-3daa2cfadfb8), version(1.0)] +library WebView2 { + +// Interface forward declarations + +interface ICoreWebView2AcceleratorKeyPressedEventArgs; +interface ICoreWebView2AcceleratorKeyPressedEventHandler; +interface ICoreWebView2AddScriptToExecuteOnDocumentCreatedCompletedHandler; +interface ICoreWebView2CallDevToolsProtocolMethodCompletedHandler; +interface ICoreWebView2CapturePreviewCompletedHandler; +interface ICoreWebView2; +interface ICoreWebView2_2; +interface ICoreWebView2_3; +interface ICoreWebView2_4; +interface ICoreWebView2BytesReceivedChangedEventHandler; +interface ICoreWebView2CompositionController; +interface ICoreWebView2CompositionController2; +interface ICoreWebView2Controller; +interface ICoreWebView2Controller2; +interface ICoreWebView2Controller3; +interface ICoreWebView2ContentLoadingEventArgs; +interface ICoreWebView2ContentLoadingEventHandler; +interface ICoreWebView2Cookie; +interface ICoreWebView2CookieList; +interface ICoreWebView2CookieManager; +interface ICoreWebView2CreateCoreWebView2CompositionControllerCompletedHandler; +interface ICoreWebView2CreateCoreWebView2ControllerCompletedHandler; +interface ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler; +interface ICoreWebView2ContainsFullScreenElementChangedEventHandler; +interface ICoreWebView2CursorChangedEventHandler; +interface ICoreWebView2DocumentTitleChangedEventHandler; +interface ICoreWebView2DOMContentLoadedEventArgs; +interface ICoreWebView2DOMContentLoadedEventHandler; +interface ICoreWebView2Deferral; +interface ICoreWebView2DevToolsProtocolEventReceivedEventArgs; +interface ICoreWebView2DevToolsProtocolEventReceivedEventHandler; +interface ICoreWebView2DevToolsProtocolEventReceiver; +interface ICoreWebView2DownloadOperation; +interface ICoreWebView2DownloadStartingEventArgs; +interface ICoreWebView2DownloadStartingEventHandler; +interface ICoreWebView2Environment; +interface ICoreWebView2Environment2; +interface ICoreWebView2Environment3; +interface ICoreWebView2Environment4; +interface ICoreWebView2EnvironmentOptions; +interface ICoreWebView2EstimatedEndTimeChangedEventHandler; +interface ICoreWebView2ExecuteScriptCompletedHandler; +interface ICoreWebView2Frame; +interface ICoreWebView2FrameCreatedEventArgs; +interface ICoreWebView2FrameCreatedEventHandler; +interface ICoreWebView2FrameDestroyedEventHandler; +interface ICoreWebView2FrameNameChangedEventHandler; +interface ICoreWebView2FrameInfo; +interface ICoreWebView2FrameInfoCollection; +interface ICoreWebView2FrameInfoCollectionIterator; +interface ICoreWebView2FocusChangedEventHandler; +interface ICoreWebView2GetCookiesCompletedHandler; +interface ICoreWebView2HistoryChangedEventHandler; +interface ICoreWebView2HttpHeadersCollectionIterator; +interface ICoreWebView2HttpRequestHeaders; +interface ICoreWebView2HttpResponseHeaders; +interface ICoreWebView2Interop; +interface ICoreWebView2MoveFocusRequestedEventArgs; +interface ICoreWebView2MoveFocusRequestedEventHandler; +interface ICoreWebView2NavigationCompletedEventArgs; +interface ICoreWebView2NavigationCompletedEventHandler; +interface ICoreWebView2NavigationStartingEventArgs; +interface ICoreWebView2NavigationStartingEventHandler; +interface ICoreWebView2NewBrowserVersionAvailableEventHandler; +interface ICoreWebView2NewWindowRequestedEventArgs; +interface ICoreWebView2NewWindowRequestedEventHandler; +interface ICoreWebView2PermissionRequestedEventArgs; +interface ICoreWebView2PermissionRequestedEventHandler; +interface ICoreWebView2PointerInfo; +interface ICoreWebView2ProcessFailedEventArgs; +interface ICoreWebView2ProcessFailedEventArgs2; +interface ICoreWebView2ProcessFailedEventHandler; +interface ICoreWebView2RasterizationScaleChangedEventHandler; +interface ICoreWebView2ScriptDialogOpeningEventArgs; +interface ICoreWebView2ScriptDialogOpeningEventHandler; +interface ICoreWebView2Settings; +interface ICoreWebView2Settings2; +interface ICoreWebView2Settings3; +interface ICoreWebView2Settings4; +interface ICoreWebView2Settings5; +interface ICoreWebView2SourceChangedEventArgs; +interface ICoreWebView2SourceChangedEventHandler; +interface ICoreWebView2StateChangedEventHandler; +interface ICoreWebView2TrySuspendCompletedHandler; +interface ICoreWebView2WebMessageReceivedEventArgs; +interface ICoreWebView2WebMessageReceivedEventHandler; +interface ICoreWebView2WebResourceRequest; +interface ICoreWebView2WebResourceRequestedEventArgs; +interface ICoreWebView2WebResourceRequestedEventHandler; +interface ICoreWebView2WebResourceResponse; +interface ICoreWebView2WebResourceResponseReceivedEventHandler; +interface ICoreWebView2WebResourceResponseReceivedEventArgs; +interface ICoreWebView2WebResourceResponseView; +interface ICoreWebView2WebResourceResponseViewGetContentCompletedHandler; +interface ICoreWebView2WindowCloseRequestedEventHandler; +interface ICoreWebView2WindowFeatures; +interface ICoreWebView2ZoomFactorChangedEventHandler; + +// Enums and structs + +/// Specifies the image format for the `ICoreWebView2::CapturePreview` method. + +[v1_enum] +typedef enum COREWEBVIEW2_CAPTURE_PREVIEW_IMAGE_FORMAT { + + /// Indicates that the PNG image format is used. + + COREWEBVIEW2_CAPTURE_PREVIEW_IMAGE_FORMAT_PNG, + + /// Indicates the JPEG image format is used. + + COREWEBVIEW2_CAPTURE_PREVIEW_IMAGE_FORMAT_JPEG, +} COREWEBVIEW2_CAPTURE_PREVIEW_IMAGE_FORMAT; + +/// Kind of cookie SameSite status used in the ICoreWebView2Cookie interface. +/// These fields match those as specified in https://developer.mozilla.org/docs/Web/HTTP/Cookies#. +/// Learn more about SameSite cookies here: https://tools.ietf.org/html/draft-west-first-party-cookies-07 +[v1_enum] +typedef enum COREWEBVIEW2_COOKIE_SAME_SITE_KIND { + /// None SameSite type. No restrictions on cross-site requests. + COREWEBVIEW2_COOKIE_SAME_SITE_KIND_NONE, + /// Lax SameSite type. The cookie will be sent with "same-site" requests, and with "cross-site" top level navigation. + COREWEBVIEW2_COOKIE_SAME_SITE_KIND_LAX, + /// Strict SameSite type. The cookie will only be sent along with "same-site" requests. + COREWEBVIEW2_COOKIE_SAME_SITE_KIND_STRICT, +} COREWEBVIEW2_COOKIE_SAME_SITE_KIND; + +/// Kind of cross origin resource access allowed for host resources during download. +/// Note that other normal access checks like same origin DOM access check and [Content +/// Security Policy](https://developer.mozilla.org/docs/Web/HTTP/CSP) still apply. +/// The following table illustrates the host resource cross origin access according to +/// access context and `COREWEBVIEW2_HOST_RESOURCE_ACCESS_KIND`. +/// Cross Origin Access Context | DENY | ALLOW | DENY_CORS +/// --- | --- | --- | --- +/// From DOM like src of img, script or iframe element| Deny | Allow | Allow +/// From Script like Fetch or XMLHttpRequest| Deny | Allow | Deny +[v1_enum] +typedef enum COREWEBVIEW2_HOST_RESOURCE_ACCESS_KIND { + /// All cross origin resource access is denied, including normal sub resource access + /// as src of a script or image element. + COREWEBVIEW2_HOST_RESOURCE_ACCESS_KIND_DENY, + + /// All cross origin resource access is allowed, including accesses that are + /// subject to Cross-Origin Resource Sharing(CORS) check. The behavior is similar to + /// a web site sends back http header Access-Control-Allow-Origin: *. + COREWEBVIEW2_HOST_RESOURCE_ACCESS_KIND_ALLOW, + + /// Cross origin resource access is allowed for normal sub resource access like + /// as src of a script or image element, while any access that subjects to CORS check + /// will be denied. + /// See [Cross-Origin Resource Sharing](https://developer.mozilla.org/docs/Web/HTTP/CORS) + /// for more information. + COREWEBVIEW2_HOST_RESOURCE_ACCESS_KIND_DENY_CORS, +} COREWEBVIEW2_HOST_RESOURCE_ACCESS_KIND; + +/// Specifies the JavaScript dialog type used in the +/// `ICoreWebView2ScriptDialogOpeningEventHandler` interface. + +[v1_enum] +typedef enum COREWEBVIEW2_SCRIPT_DIALOG_KIND { + + /// Indicates that the dialog uses the `window.alert` JavaScript function. + + COREWEBVIEW2_SCRIPT_DIALOG_KIND_ALERT, + + /// Indicates that the dialog uses the `window.confirm` JavaScript function. + + COREWEBVIEW2_SCRIPT_DIALOG_KIND_CONFIRM, + + /// Indicates that the dialog uses the `window.prompt` JavaScript function. + + COREWEBVIEW2_SCRIPT_DIALOG_KIND_PROMPT, + + /// Indicates that the dialog uses the `beforeunload` JavaScript event. + + COREWEBVIEW2_SCRIPT_DIALOG_KIND_BEFOREUNLOAD, +} COREWEBVIEW2_SCRIPT_DIALOG_KIND; + +/// Specifies the process failure type used in the +/// `ICoreWebView2ProcessFailedEventHandler` interface. The values in this enum +/// make reference to the process kinds in the Chromium architecture. For more +/// information about what these processes are and what they do, see +/// [Browser Architecture - Inside look at modern web browser](https://developers.google.com/web/updates/2018/09/inside-browser-part1). + +[v1_enum] +typedef enum COREWEBVIEW2_PROCESS_FAILED_KIND { + + /// Indicates that the browser process ended unexpectedly. The WebView + /// automatically moves to the Closed state. The app has to recreate a new + /// WebView to recover from this failure. + + COREWEBVIEW2_PROCESS_FAILED_KIND_BROWSER_PROCESS_EXITED, + + /// Indicates that the main frame's render process ended unexpectedly. A new + /// render process is created automatically and navigated to an error page. + /// You can use the `Reload` method to try to reload the page that failed. + + COREWEBVIEW2_PROCESS_FAILED_KIND_RENDER_PROCESS_EXITED, + + /// Indicates that the main frame's render process is unresponsive. + + // Note that this does not seem to work right now. + // Does not fire for simple long running script case, the only related test + // SitePerProcessBrowserTest::NoCommitTimeoutForInvisibleWebContents is + // disabled. + + COREWEBVIEW2_PROCESS_FAILED_KIND_RENDER_PROCESS_UNRESPONSIVE, + + /// Indicates that a frame-only render process ended unexpectedly. The process + /// exit does not affect the top-level document, only a subset of the + /// subframes within it. The content in these frames is replaced with an error + /// page in the frame. + + COREWEBVIEW2_PROCESS_FAILED_KIND_FRAME_RENDER_PROCESS_EXITED, + + /// Indicates that a utility process ended unexpectedly. + + COREWEBVIEW2_PROCESS_FAILED_KIND_UTILITY_PROCESS_EXITED, + + /// Indicates that a sandbox helper process ended unexpectedly. + + COREWEBVIEW2_PROCESS_FAILED_KIND_SANDBOX_HELPER_PROCESS_EXITED, + + /// Indicates that the GPU process ended unexpectedly. + + COREWEBVIEW2_PROCESS_FAILED_KIND_GPU_PROCESS_EXITED, + + /// Indicates that a PPAPI plugin process ended unexpectedly. + + COREWEBVIEW2_PROCESS_FAILED_KIND_PPAPI_PLUGIN_PROCESS_EXITED, + + /// Indicates that a PPAPI plugin broker process ended unexpectedly. + + COREWEBVIEW2_PROCESS_FAILED_KIND_PPAPI_BROKER_PROCESS_EXITED, + + /// Indicates that a process of unspecified kind ended unexpectedly. + + COREWEBVIEW2_PROCESS_FAILED_KIND_UNKNOWN_PROCESS_EXITED, +} COREWEBVIEW2_PROCESS_FAILED_KIND; + +/// Specifies the process failure reason used in the +/// `ICoreWebView2ProcessFailedEventHandler` interface. + +[v1_enum] +typedef enum COREWEBVIEW2_PROCESS_FAILED_REASON { + + /// An unexpected process failure occurred. + COREWEBVIEW2_PROCESS_FAILED_REASON_UNEXPECTED, + + /// The process became unresponsive. + /// This only applies to the main frame's render process. + + COREWEBVIEW2_PROCESS_FAILED_REASON_UNRESPONSIVE, + + /// The process was terminated. For example, from Task Manager. + + COREWEBVIEW2_PROCESS_FAILED_REASON_TERMINATED, + + /// The process crashed. + + COREWEBVIEW2_PROCESS_FAILED_REASON_CRASHED, + + /// The process failed to launch. + + COREWEBVIEW2_PROCESS_FAILED_REASON_LAUNCH_FAILED, + + /// The process died due to running out of memory. + + COREWEBVIEW2_PROCESS_FAILED_REASON_OUT_OF_MEMORY, +} COREWEBVIEW2_PROCESS_FAILED_REASON; + +/// Indicates the type of a permission request. + +[v1_enum] +typedef enum COREWEBVIEW2_PERMISSION_KIND { + + /// Indicates an unknown permission. + + COREWEBVIEW2_PERMISSION_KIND_UNKNOWN_PERMISSION, + + /// Indicates permission to capture audio. + + COREWEBVIEW2_PERMISSION_KIND_MICROPHONE, + + /// Indicates permission to capture video. + + COREWEBVIEW2_PERMISSION_KIND_CAMERA, + + /// Indicates permission to access geolocation. + + COREWEBVIEW2_PERMISSION_KIND_GEOLOCATION, + + /// Indicates permission to send web notifications. This permission request + /// is currently auto-rejected and no event is run for it. + + COREWEBVIEW2_PERMISSION_KIND_NOTIFICATIONS, + + /// Indicates permission to access generic sensor. Generic Sensor covering + /// ambient-light-sensor, accelerometer, gyroscope, and magnetometer. + + COREWEBVIEW2_PERMISSION_KIND_OTHER_SENSORS, + + /// Indicates permission to read the system clipboard without a user gesture. + + COREWEBVIEW2_PERMISSION_KIND_CLIPBOARD_READ, +} COREWEBVIEW2_PERMISSION_KIND; + +/// Specifies the response to a permission request. + +[v1_enum] +typedef enum COREWEBVIEW2_PERMISSION_STATE { + + /// Specifies that the default browser behavior is used, which normally + /// prompt users for decision. + + COREWEBVIEW2_PERMISSION_STATE_DEFAULT, + + /// Specifies that the permission request is granted. + + COREWEBVIEW2_PERMISSION_STATE_ALLOW, + + /// Specifies that the permission request is denied. + + COREWEBVIEW2_PERMISSION_STATE_DENY, +} COREWEBVIEW2_PERMISSION_STATE; + +/// Indicates the error status values for web navigations. + +[v1_enum] +typedef enum COREWEBVIEW2_WEB_ERROR_STATUS { + + /// Indicates that an unknown error occurred. + + COREWEBVIEW2_WEB_ERROR_STATUS_UNKNOWN, + + /// Indicates that the SSL certificate common name does not match the web + /// address. + + COREWEBVIEW2_WEB_ERROR_STATUS_CERTIFICATE_COMMON_NAME_IS_INCORRECT, + + /// Indicates that the SSL certificate has expired. + + COREWEBVIEW2_WEB_ERROR_STATUS_CERTIFICATE_EXPIRED, + + /// Indicates that the SSL client certificate contains errors. + + COREWEBVIEW2_WEB_ERROR_STATUS_CLIENT_CERTIFICATE_CONTAINS_ERRORS, + + /// Indicates that the SSL certificate has been revoked. + + COREWEBVIEW2_WEB_ERROR_STATUS_CERTIFICATE_REVOKED, + + /// Indicates that the SSL certificate is not valid. The certificate may not + /// match the public key pins for the host name, the certificate is signed + /// by an untrusted authority or using a weak sign algorithm, the certificate + /// claimed DNS names violate name constraints, the certificate contains a + /// weak key, the validity period of the certificate is too long, lack of + /// revocation information or revocation mechanism, non-unique host name, + /// lack of certificate transparency information, or the certificate is + /// chained to a + /// \[legacy Symantec root\]\[GoogleblogSecurity201803DistrustSymantecPkiImmediateHtml\]. + /// + /// \[GoogleblogSecurity201803DistrustSymantecPkiImmediateHtml\]: https://security.googleblog.com/2018/03/distrust-of-symantec-pki-immediate.html "Distrust of the Symantec PKI: Immediate action needed by site operators | Google Security Blog" + + COREWEBVIEW2_WEB_ERROR_STATUS_CERTIFICATE_IS_INVALID, + + /// Indicates that the host is unreachable. + + COREWEBVIEW2_WEB_ERROR_STATUS_SERVER_UNREACHABLE, + + /// Indicates that the connection has timed out. + + COREWEBVIEW2_WEB_ERROR_STATUS_TIMEOUT, + + /// Indicates that the server returned an invalid or unrecognized response. + + COREWEBVIEW2_WEB_ERROR_STATUS_ERROR_HTTP_INVALID_SERVER_RESPONSE, + + /// Indicates that the connection was stopped. + + COREWEBVIEW2_WEB_ERROR_STATUS_CONNECTION_ABORTED, + + /// Indicates that the connection was reset. + + COREWEBVIEW2_WEB_ERROR_STATUS_CONNECTION_RESET, + + /// Indicates that the Internet connection has been lost. + + COREWEBVIEW2_WEB_ERROR_STATUS_DISCONNECTED, + + /// Indicates that a connection to the destination was not established. + + COREWEBVIEW2_WEB_ERROR_STATUS_CANNOT_CONNECT, + + /// Indicates that the provided host name was not able to be resolved. + + COREWEBVIEW2_WEB_ERROR_STATUS_HOST_NAME_NOT_RESOLVED, + + /// Indicates that the operation was canceled. + + COREWEBVIEW2_WEB_ERROR_STATUS_OPERATION_CANCELED, + + /// Indicates that the request redirect failed. + + COREWEBVIEW2_WEB_ERROR_STATUS_REDIRECT_FAILED, + + /// Indicates that an unexpected error occurred. + + COREWEBVIEW2_WEB_ERROR_STATUS_UNEXPECTED_ERROR, +} COREWEBVIEW2_WEB_ERROR_STATUS; + +/// Specifies the web resource request contexts. + +[v1_enum] +typedef enum COREWEBVIEW2_WEB_RESOURCE_CONTEXT { + + /// Specifies all resources. + + COREWEBVIEW2_WEB_RESOURCE_CONTEXT_ALL, + + /// Specifies a document resource. + + COREWEBVIEW2_WEB_RESOURCE_CONTEXT_DOCUMENT, + + /// Specifies a CSS resource. + + COREWEBVIEW2_WEB_RESOURCE_CONTEXT_STYLESHEET, + + /// Specifies an image resource. + + COREWEBVIEW2_WEB_RESOURCE_CONTEXT_IMAGE, + + /// Specifies another media resource such as a video. + + COREWEBVIEW2_WEB_RESOURCE_CONTEXT_MEDIA, + + /// Specifies a font resource. + + COREWEBVIEW2_WEB_RESOURCE_CONTEXT_FONT, + + /// Specifies a script resource. + + COREWEBVIEW2_WEB_RESOURCE_CONTEXT_SCRIPT, + + /// Specifies an XML HTTP request. + + COREWEBVIEW2_WEB_RESOURCE_CONTEXT_XML_HTTP_REQUEST, + + /// Specifies a Fetch API communication. + + COREWEBVIEW2_WEB_RESOURCE_CONTEXT_FETCH, + + /// Specifies a TextTrack resource. + + COREWEBVIEW2_WEB_RESOURCE_CONTEXT_TEXT_TRACK, + + /// Specifies an EventSource API communication. + + COREWEBVIEW2_WEB_RESOURCE_CONTEXT_EVENT_SOURCE, + + /// Specifies a WebSocket API communication. + + COREWEBVIEW2_WEB_RESOURCE_CONTEXT_WEBSOCKET, + + /// Specifies a Web App Manifest. + + COREWEBVIEW2_WEB_RESOURCE_CONTEXT_MANIFEST, + + /// Specifies a Signed HTTP Exchange. + + COREWEBVIEW2_WEB_RESOURCE_CONTEXT_SIGNED_EXCHANGE, + + /// Specifies a Ping request. + + COREWEBVIEW2_WEB_RESOURCE_CONTEXT_PING, + + /// Specifies a CSP Violation Report. + + COREWEBVIEW2_WEB_RESOURCE_CONTEXT_CSP_VIOLATION_REPORT, + + /// Specifies an other resource. + + COREWEBVIEW2_WEB_RESOURCE_CONTEXT_OTHER +} COREWEBVIEW2_WEB_RESOURCE_CONTEXT; + +/// Specifies the reason for moving focus. + +[v1_enum] +typedef enum COREWEBVIEW2_MOVE_FOCUS_REASON { + + /// Specifies that the code is setting focus into WebView. + + COREWEBVIEW2_MOVE_FOCUS_REASON_PROGRAMMATIC, + + /// Specifies that the focus is moving due to Tab traversal forward. + + COREWEBVIEW2_MOVE_FOCUS_REASON_NEXT, + + /// Specifies that the focus is moving due to Tab traversal backward. + + COREWEBVIEW2_MOVE_FOCUS_REASON_PREVIOUS, +} COREWEBVIEW2_MOVE_FOCUS_REASON; + +/// Specifies the key event type that triggered an `AcceleratorKeyPressed` +/// event. + +[v1_enum] +typedef enum COREWEBVIEW2_KEY_EVENT_KIND { + + /// Specifies that the key event type corresponds to window message + /// `WM_KEYDOWN`. + + COREWEBVIEW2_KEY_EVENT_KIND_KEY_DOWN, + + /// Specifies that the key event type corresponds to window message + /// `WM_KEYUP`. + + COREWEBVIEW2_KEY_EVENT_KIND_KEY_UP, + + /// Specifies that the key event type corresponds to window message + /// `WM_SYSKEYDOWN`. + + COREWEBVIEW2_KEY_EVENT_KIND_SYSTEM_KEY_DOWN, + + /// Specifies that the key event type corresponds to window message + /// `WM_SYSKEYUP`. + + COREWEBVIEW2_KEY_EVENT_KIND_SYSTEM_KEY_UP, +} COREWEBVIEW2_KEY_EVENT_KIND; + +/// Contains the information packed into the `LPARAM` sent to a Win32 key +/// event. For more information about `WM_KEYDOWN`, navigate to +/// \[WM_KEYDOWN message\]\[WindowsWin32InputdevWmKeydown\]. +/// +/// \[WindowsWin32InputdevWmKeydown\]: /windows/win32/inputdev/wm-keydown "WM_KEYDOWN message | Microsoft Docs" + +typedef struct COREWEBVIEW2_PHYSICAL_KEY_STATUS { + + /// Specifies the repeat count for the current message. + + UINT32 RepeatCount; + + /// Specifies the scan code. + + UINT32 ScanCode; + + /// Indicates that the key is an extended key. + + BOOL IsExtendedKey; + + /// Indicates that a menu key is held down (context code). + + BOOL IsMenuKeyDown; + + /// Indicates that the key was held down. + + BOOL WasKeyDown; + + /// Indicates that the key was released. + + BOOL IsKeyReleased; +} COREWEBVIEW2_PHYSICAL_KEY_STATUS; + +/// A value representing RGBA color (Red, Green, Blue, Alpha) for WebView2. +/// Each component takes a value from 0 to 255, with 0 being no intensity +/// and 255 being the highest intensity. + +typedef struct COREWEBVIEW2_COLOR { + + /// Specifies the intensity of the Alpha ie. opacity value. 0 is transparent, + /// 255 is opaque. + + BYTE A; + + /// Specifies the intensity of the Red color + + BYTE R; + + /// Specifies the intensity of the Green color + + BYTE G; + + /// Specifies the intensity of the Blue color + + BYTE B; +} COREWEBVIEW2_COLOR; + +/// Mouse event type used by SendMouseInput to convey the type of mouse event +/// being sent to WebView. The values of this enum align with the matching +/// WM_* window messages. + +[v1_enum] +typedef enum COREWEBVIEW2_MOUSE_EVENT_KIND { + + /// Mouse horizontal wheel scroll event, WM_MOUSEHWHEEL. + + COREWEBVIEW2_MOUSE_EVENT_KIND_HORIZONTAL_WHEEL = 0x020E, + + /// Left button double click mouse event, WM_LBUTTONDBLCLK. + + COREWEBVIEW2_MOUSE_EVENT_KIND_LEFT_BUTTON_DOUBLE_CLICK = 0x0203, + + /// Left button down mouse event, WM_LBUTTONDOWN. + + COREWEBVIEW2_MOUSE_EVENT_KIND_LEFT_BUTTON_DOWN = 0x0201, + + /// Left button up mouse event, WM_LBUTTONUP. + + COREWEBVIEW2_MOUSE_EVENT_KIND_LEFT_BUTTON_UP = 0x0202, + + /// Mouse leave event, WM_MOUSELEAVE. + + COREWEBVIEW2_MOUSE_EVENT_KIND_LEAVE = 0x02A3, + + /// Middle button double click mouse event, WM_MBUTTONDBLCLK. + + COREWEBVIEW2_MOUSE_EVENT_KIND_MIDDLE_BUTTON_DOUBLE_CLICK = 0x0209, + + /// Middle button down mouse event, WM_MBUTTONDOWN. + + COREWEBVIEW2_MOUSE_EVENT_KIND_MIDDLE_BUTTON_DOWN = 0x0207, + + /// Middle button up mouse event, WM_MBUTTONUP. + + COREWEBVIEW2_MOUSE_EVENT_KIND_MIDDLE_BUTTON_UP = 0x0208, + + /// Mouse move event, WM_MOUSEMOVE. + + COREWEBVIEW2_MOUSE_EVENT_KIND_MOVE = 0x0200, + + /// Right button double click mouse event, WM_RBUTTONDBLCLK. + + COREWEBVIEW2_MOUSE_EVENT_KIND_RIGHT_BUTTON_DOUBLE_CLICK = 0x0206, + + /// Right button down mouse event, WM_RBUTTONDOWN. + + COREWEBVIEW2_MOUSE_EVENT_KIND_RIGHT_BUTTON_DOWN = 0x0204, + + /// Right button up mouse event, WM_RBUTTONUP. + + COREWEBVIEW2_MOUSE_EVENT_KIND_RIGHT_BUTTON_UP = 0x0205, + + /// Mouse wheel scroll event, WM_MOUSEWHEEL. + + COREWEBVIEW2_MOUSE_EVENT_KIND_WHEEL = 0x020A, + + /// First or second X button double click mouse event, WM_XBUTTONDBLCLK. + + COREWEBVIEW2_MOUSE_EVENT_KIND_X_BUTTON_DOUBLE_CLICK = 0x020D, + + /// First or second X button down mouse event, WM_XBUTTONDOWN. + + COREWEBVIEW2_MOUSE_EVENT_KIND_X_BUTTON_DOWN = 0x020B, + + /// First or second X button up mouse event, WM_XBUTTONUP. + + COREWEBVIEW2_MOUSE_EVENT_KIND_X_BUTTON_UP = 0x020C, +} COREWEBVIEW2_MOUSE_EVENT_KIND; + +/// Mouse event virtual keys associated with a COREWEBVIEW2_MOUSE_EVENT_KIND for +/// SendMouseInput. These values can be combined into a bit flag if more than +/// one virtual key is pressed for the event. The values of this enum align +/// with the matching MK_* mouse keys. + +[v1_enum] +typedef enum COREWEBVIEW2_MOUSE_EVENT_VIRTUAL_KEYS { + + /// No additional keys pressed. + + COREWEBVIEW2_MOUSE_EVENT_VIRTUAL_KEYS_NONE = 0x0, + + /// Left mouse button is down, MK_LBUTTON. + + COREWEBVIEW2_MOUSE_EVENT_VIRTUAL_KEYS_LEFT_BUTTON = 0x0001, + + /// Right mouse button is down, MK_RBUTTON. + + COREWEBVIEW2_MOUSE_EVENT_VIRTUAL_KEYS_RIGHT_BUTTON = 0x0002, + + /// SHIFT key is down, MK_SHIFT. + + COREWEBVIEW2_MOUSE_EVENT_VIRTUAL_KEYS_SHIFT = 0x0004, + + /// CTRL key is down, MK_CONTROL. + + COREWEBVIEW2_MOUSE_EVENT_VIRTUAL_KEYS_CONTROL = 0x0008, + + /// Middle mouse button is down, MK_MBUTTON. + + COREWEBVIEW2_MOUSE_EVENT_VIRTUAL_KEYS_MIDDLE_BUTTON = 0x0010, + + /// First X button is down, MK_XBUTTON1 + + COREWEBVIEW2_MOUSE_EVENT_VIRTUAL_KEYS_X_BUTTON1 = 0x0020, + + /// Second X button is down, MK_XBUTTON2 + + COREWEBVIEW2_MOUSE_EVENT_VIRTUAL_KEYS_X_BUTTON2 = 0x0040, +} COREWEBVIEW2_MOUSE_EVENT_VIRTUAL_KEYS; +cpp_quote("DEFINE_ENUM_FLAG_OPERATORS(COREWEBVIEW2_MOUSE_EVENT_VIRTUAL_KEYS);") + +/// Pointer event type used by SendPointerInput to convey the type of pointer +/// event being sent to WebView. The values of this enum align with the +/// matching WM_POINTER* window messages. + +[v1_enum] +typedef enum COREWEBVIEW2_POINTER_EVENT_KIND { + + /// Corresponds to WM_POINTERACTIVATE. + + COREWEBVIEW2_POINTER_EVENT_KIND_ACTIVATE = 0x024B, + + /// Corresponds to WM_POINTERDOWN. + + COREWEBVIEW2_POINTER_EVENT_KIND_DOWN = 0x0246, + + /// Corresponds to WM_POINTERENTER. + + COREWEBVIEW2_POINTER_EVENT_KIND_ENTER = 0x0249, + + /// Corresponds to WM_POINTERLEAVE. + + COREWEBVIEW2_POINTER_EVENT_KIND_LEAVE = 0x024A, + + /// Corresponds to WM_POINTERUP. + + COREWEBVIEW2_POINTER_EVENT_KIND_UP = 0x0247, + + /// Corresponds to WM_POINTERUPDATE. + + COREWEBVIEW2_POINTER_EVENT_KIND_UPDATE = 0x0245, +} COREWEBVIEW2_POINTER_EVENT_KIND; + +/// Mode for how the Bounds property is interpreted in relation to the RasterizationScale property. +[v1_enum] +typedef enum COREWEBVIEW2_BOUNDS_MODE { + + /// Bounds property represents raw pixels. Physical size of Webview is not impacted by RasterizationScale. + + COREWEBVIEW2_BOUNDS_MODE_USE_RAW_PIXELS, + + /// Bounds property represents logicl pixels and the RasterizationScale property is used to get the physical size of the WebView. + + COREWEBVIEW2_BOUNDS_MODE_USE_RASTERIZATION_SCALE, +} COREWEBVIEW2_BOUNDS_MODE; + +/// State of the download operation. +[v1_enum] +typedef enum COREWEBVIEW2_DOWNLOAD_STATE { + /// The download is in progress. + COREWEBVIEW2_DOWNLOAD_STATE_IN_PROGRESS, + /// The connection with the file host was broken. The `InterruptReason` property + /// can be accessed from `ICoreWebView2DownloadOperation`. See + /// `COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON` for descriptions of kinds of + /// interrupt reasons. Host can check whether an interrupted download can be + /// resumed with the `CanResume` property on the `ICoreWebView2DownloadOperation`. + /// Once resumed, a download is in the `COREWEBVIEW2_DOWNLOAD_STATE_IN_PROGRESS` state. + COREWEBVIEW2_DOWNLOAD_STATE_INTERRUPTED, + /// The download completed successfully. + COREWEBVIEW2_DOWNLOAD_STATE_COMPLETED, +} COREWEBVIEW2_DOWNLOAD_STATE; + +/// Reason why a download was interrupted. +[v1_enum] +typedef enum COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON { + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_NONE, + + /// Generic file error. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, + /// Access denied due to security restrictions. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_FILE_ACCESS_DENIED, + /// Disk full. User should free some space or choose a different location to + /// store the file. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE, + /// Result file path with file name is too long. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_FILE_NAME_TOO_LONG, + /// File is too large for file system. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_FILE_TOO_LARGE, + /// Microsoft Defender Smartscreen detected a virus in the file. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_FILE_MALICIOUS, + /// File was in use, too many files opened, or out of memory. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_FILE_TRANSIENT_ERROR, + /// File blocked by local policy. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_FILE_BLOCKED_BY_POLICY, + /// Security check failed unexpectedly. Microsoft Defender SmartScreen could + /// not scan this file. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_FILE_SECURITY_CHECK_FAILED, + /// Seeking past the end of a file in opening a file, as part of resuming an + /// interrupted download. The file did not exist or was not as large as + /// expected. Partially downloaded file was truncated or deleted, and download + /// will be restarted automatically. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_FILE_TOO_SHORT, + /// Partial file did not match the expected hash and was deleted. Download + /// will be restarted automatically. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_FILE_HASH_MISMATCH, + + /// Generic network error. User can retry the download manually. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, + /// Network operation timed out. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_NETWORK_TIMEOUT, + /// Network connection lost. User can retry the download manually. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED, + /// Server has gone down. User can retry the download manually. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_NETWORK_SERVER_DOWN, + /// Network request invalid because original or redirected URI is invalid, has + /// an unsupported scheme, or is disallowed by network policy. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST, + + /// Generic server error. User can retry the download manually. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_SERVER_FAILED, + /// Server does not support range requests. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE, + /// Server does not have the requested data. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT, + /// Server did not authorize access to resource. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_SERVER_UNAUTHORIZED, + /// Server certificate problem. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_SERVER_CERTIFICATE_PROBLEM, + /// Server access forbidden. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_SERVER_FORBIDDEN, + /// Unexpected server response. Responding server may not be intended server. + /// User can retry the download manually. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_SERVER_UNEXPECTED_RESPONSE, + /// Server sent fewer bytes than the Content-Length header. Content-length + /// header may be invalid or connection may have closed. Download is treated + /// as complete unless there are + /// [strong validators](https://tools.ietf.org/html/rfc7232#section-2) present + /// to interrupt the download. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_SERVER_CONTENT_LENGTH_MISMATCH, + /// Unexpected cross-origin redirect. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_SERVER_CROSS_ORIGIN_REDIRECT, + + /// User canceled the download. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_USER_CANCELED, + /// User shut down the WebView. Resuming downloads that were interrupted + /// during shutdown is not yet supported. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_USER_SHUTDOWN, + /// User paused the download. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_USER_PAUSED, + + /// WebView crashed. + COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_DOWNLOAD_PROCESS_CRASHED, +} COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON; + +// End of enums and structs + +/// WebView2 enables you to host web content using the latest Microsoft Edge +/// browser and web technology. + +[uuid(76eceacb-0462-4d94-ac83-423a6793775e), object, pointer_default(unique)] +interface ICoreWebView2 : IUnknown { + + /// The `ICoreWebView2Settings` object contains various modifiable settings + /// for the running WebView. + + [propget] HRESULT Settings([out, retval] ICoreWebView2Settings** settings); + + /// The URI of the current top level document. This value potentially + /// changes as a part of the `SourceChanged` event that runs for some cases + /// such as navigating to a different site or fragment navigations. It + /// remains the same for other types of navigations such as page refreshes + /// or `history.pushState` with the same URL as the current page. + /// + /// \snippet ControlComponent.cpp SourceChanged + + [propget] HRESULT Source([out, retval] LPWSTR* uri); + + /// Cause a navigation of the top-level document to run to the specified URI. + /// For more information, navigate to \[Navigation events\]\[MicrosoftEdgeWebview2ConceptsNavigationevents\]. + /// + /// \[MicrosoftEdgeWebview2ConceptsNavigationevents\]: /microsoft-edge/webview2/concepts/navigation-events "Navigation events | Microsoft Docs" + /// + /// > [!NOTE] + /// This operation starts a navigation and the corresponding + /// `NavigationStarting` event triggers sometime after `Navigate` runs. + /// + /// \snippet ControlComponent.cpp Navigate + + HRESULT Navigate([in] LPCWSTR uri); + + /// Initiates a navigation to htmlContent as source HTML of a new document. + /// The `htmlContent` parameter may not be larger than 2 MB in total size. + /// The origin of the new page is `about:blank`. + /// + /// \snippet SettingsComponent.cpp NavigateToString + + HRESULT NavigateToString([in] LPCWSTR htmlContent); + + /// Add an event handler for the `NavigationStarting` event. + /// `NavigationStarting` runs when the WebView main frame is requesting + /// permission to navigate to a different URI. Redirects trigger this + /// operation as well, and the navigation id is the same as the original + /// one. + /// + /// You may block corresponding navigations until the event handler returns. + /// + /// \snippet SettingsComponent.cpp NavigationStarting + + HRESULT add_NavigationStarting( + [in] ICoreWebView2NavigationStartingEventHandler* eventHandler, + [out] EventRegistrationToken* token); + + /// Remove an event handler previously added with `add_NavigationStarting`. + + HRESULT remove_NavigationStarting( + [in] EventRegistrationToken token); + + /// Add an event handler for the `ContentLoading` event. `ContentLoading` + /// triggers before any content is loaded, including scripts added with + /// `AddScriptToExecuteOnDocumentCreated`. `ContentLoading` does not trigger + /// if a same page navigation occurs (such as through `fragment` + /// navigations or `history.pushState` navigations). This operation + /// follows the `NavigationStarting` and `SourceChanged` events and precedes + /// the `HistoryChanged` and `NavigationCompleted` events. + + HRESULT add_ContentLoading( + [in] ICoreWebView2ContentLoadingEventHandler* eventHandler, + [out] EventRegistrationToken* token); + + /// Remove an event handler previously added with `add_ContentLoading`. + + HRESULT remove_ContentLoading( + [in] EventRegistrationToken token); + + /// Add an event handler for the `SourceChanged` event. `SourceChanged` + /// triggers when the `Source` property changes. `SourceChanged` runs when + /// navigating to a different site or fragment navigations. It does not + /// trigger for other types of navigations such as page refreshes or + /// `history.pushState` with the same URL as the current page. + /// `SourceChanged` runs before `ContentLoading` for navigation to a new + /// document. + /// + /// \snippet ControlComponent.cpp SourceChanged + + HRESULT add_SourceChanged( + [in] ICoreWebView2SourceChangedEventHandler* eventHandler, + [out] EventRegistrationToken* token); + + /// Remove an event handler previously added with `add_SourceChanged`. + + HRESULT remove_SourceChanged( + [in] EventRegistrationToken token); + + /// Add an event handler for the `HistoryChanged` event. `HistoryChanged` + /// listens to the change of navigation history for the top level document. + /// Use `HistoryChanged` to verify that the `CanGoBack` or `CanGoForward` + /// value has changed. `HistoryChanged` also runs for using `GoBack`or + /// `GoForward`. `HistoryChanged` runs after `SourceChanged` and + /// `ContentLoading`. + /// + /// \snippet ControlComponent.cpp HistoryChanged + + HRESULT add_HistoryChanged( + [in] ICoreWebView2HistoryChangedEventHandler* eventHandler, + [out] EventRegistrationToken* token); + + /// Remove an event handler previously added with `add_HistoryChanged`. + + HRESULT remove_HistoryChanged( + [in] EventRegistrationToken token); + + /// Add an event handler for the `NavigationCompleted` event. + /// `NavigationCompleted` runs when the WebView has completely loaded + /// (`body.onload` runs) or loading stopped with error. + /// + /// \snippet ControlComponent.cpp NavigationCompleted + + HRESULT add_NavigationCompleted( + [in] ICoreWebView2NavigationCompletedEventHandler* eventHandler, + [out] EventRegistrationToken* token); + + /// Remove an event handler previously added with `add_NavigationCompleted`. + + HRESULT remove_NavigationCompleted( + [in] EventRegistrationToken token); + + /// Add an event handler for the `FrameNavigationStarting` event. + /// `FrameNavigationStarting` triggers when a child frame in the WebView + /// requests permission to navigate to a different URI. Redirects trigger + /// this operation as well, and the navigation id is the same as the original + /// one. + /// + /// You may block corresponding navigations until the event handler returns. + /// + /// \snippet SettingsComponent.cpp FrameNavigationStarting + + HRESULT add_FrameNavigationStarting( + [in] ICoreWebView2NavigationStartingEventHandler* eventHandler, + [out] EventRegistrationToken* token); + + /// Remove an event handler previously added with + /// `add_FrameNavigationStarting`. + + HRESULT remove_FrameNavigationStarting( + [in] EventRegistrationToken token); + + /// Add an event handler for the `FrameNavigationCompleted` event. + /// `FrameNavigationCompleted` triggers when a child frame has completely + /// loaded (`body.onload` has triggered) or loading stopped with error. + /// + /// \snippet ControlComponent.cpp FrameNavigationCompleted + + HRESULT add_FrameNavigationCompleted( + [in] ICoreWebView2NavigationCompletedEventHandler* eventHandler, + [out] EventRegistrationToken* token); + + /// Remove an event handler previously added with + /// `add_FrameNavigationCompleted`. + + HRESULT remove_FrameNavigationCompleted( + [in] EventRegistrationToken token); + + /// Add an event handler for the `ScriptDialogOpening` event. + /// `ScriptDialogOpening` runs when a JavaScript dialog (`alert`, `confirm`, + /// `prompt`, or `beforeunload`) displays for the webview. This event only + /// triggers if the `ICoreWebView2Settings::AreDefaultScriptDialogsEnabled` + /// property is set to `FALSE`. The `ScriptDialogOpening` event suppresses + /// dialogs or replaces default dialogs with custom dialogs. + /// + /// If a deferral is not taken on the event args, the subsequent scripts are + /// blocked until the event handler returns. If a deferral is taken, the + /// scripts are blocked until the deferral is completed. + /// + /// \snippet SettingsComponent.cpp ScriptDialogOpening + + HRESULT add_ScriptDialogOpening( + [in] ICoreWebView2ScriptDialogOpeningEventHandler* eventHandler, + [out] EventRegistrationToken* token); + + /// Remove an event handler previously added with `add_ScriptDialogOpening`. + + HRESULT remove_ScriptDialogOpening( + [in] EventRegistrationToken token); + + /// Add an event handler for the `PermissionRequested` event. + /// `PermissionRequested` runs when content in a WebView requests permission + /// to access some privileged resources. + /// + /// If a deferral is not taken on the event args, the subsequent scripts are + /// blocked until the event handler returns. If a deferral is taken, the + /// scripts are blocked until the deferral is completed. + /// + /// \snippet SettingsComponent.cpp PermissionRequested + + HRESULT add_PermissionRequested( + [in] ICoreWebView2PermissionRequestedEventHandler* eventHandler, + [out] EventRegistrationToken* token); + + /// Remove an event handler previously added with `add_PermissionRequested`. + + HRESULT remove_PermissionRequested( + [in] EventRegistrationToken token); + + /// Add an event handler for the `ProcessFailed` event. `ProcessFailed` runs + /// when a WebView process ends unexpectedly or becomes unresponsive. + /// + /// \snippet ProcessComponent.cpp ProcessFailed + + HRESULT add_ProcessFailed( + [in] ICoreWebView2ProcessFailedEventHandler* eventHandler, + [out] EventRegistrationToken* token); + + /// Remove an event handler previously added with add_ProcessFailed. + + HRESULT remove_ProcessFailed( + [in] EventRegistrationToken token); + + /// Add the provided JavaScript to a list of scripts that should be run after + /// the global object has been created, but before the HTML document has + /// been parsed and before any other script included by the HTML document is + /// run. This method injects a script that runs on all top-level document + /// and child frame page navigations. This method runs asynchronously, and + /// you must wait for the completion handler to finish before the injected + /// script is ready to run. When this method completes, the `Invoke` method + /// of the handler is run with the `id` of the injected script. `id` is a + /// string. To remove the injected script, use + /// `RemoveScriptToExecuteOnDocumentCreated`. + /// + /// If the method is run in add_NewWindowRequested handler it should be called + /// after the new window deferral is completed. For more details see `ICoreWebView2NewWindowRequestedEventArgs::put_NewWindow`. + /// + /// > [!NOTE] + /// If an HTML document is running in a sandbox of some kind using + /// \[sandbox\]\[MdnDocsWebHtmlElementIframeAttrSandbox\] + /// properties or the + /// \[Content-Security-Policy\]\[MdnDocsWebHttpHeadersContentSecurityPolicy\] + /// HTTP header affects the script that runs. For example, if the + /// `allow-modals` keyword is not set then requests to run the `alert` + /// function are ignored. + /// + /// \snippet ScriptComponent.cpp AddScriptToExecuteOnDocumentCreated + /// + /// \[MdnDocsWebHtmlElementIframeAttrSandbox\]: https://developer.mozilla.org/docs/Web/HTML/Element/iframe#attr-sandbox "sandbox - <iframe>: The Inline Frame element | MDN" + /// + /// \[MdnDocsWebHttpHeadersContentSecurityPolicy\]: https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy "Content-Security-Policy | MDN" + + HRESULT AddScriptToExecuteOnDocumentCreated( + [in] LPCWSTR javaScript, + [in] ICoreWebView2AddScriptToExecuteOnDocumentCreatedCompletedHandler* handler); + + /// Remove the corresponding JavaScript added using + /// `AddScriptToExecuteOnDocumentCreated` with the specified script ID. + + HRESULT RemoveScriptToExecuteOnDocumentCreated([in] LPCWSTR id); + + /// Run JavaScript code from the javascript parameter in the current + /// top-level document rendered in the WebView. The result of evaluating + /// the provided JavaScript is used in this parameter. The result value is + /// a JSON encoded string. If the result is undefined, contains a reference + /// cycle, or otherwise is not able to be encoded into JSON, the JSON `null` + /// value is returned as the `null` string. + /// + /// > [!NOTE] + /// A function that has no explicit return value returns undefined. If the + /// script that was run throws an unhandled exception, then the result is + /// also `null`. This method is applied asynchronously. If the method is + /// run after the `NavigationStarting` event during a navigation, the script + /// runs in the new document when loading it, around the time + /// `ContentLoading` is run. This operation works even if + /// `ICoreWebView2Settings::IsScriptEnabled` is set to `FALSE`. + /// + /// \snippet ScriptComponent.cpp ExecuteScript + + HRESULT ExecuteScript( + [in] LPCWSTR javaScript, + [in] ICoreWebView2ExecuteScriptCompletedHandler* handler); + + /// Capture an image of what WebView is displaying. Specify the format of + /// the image with the `imageFormat` parameter. The resulting image binary + /// data is written to the provided `imageStream` parameter. When + /// `CapturePreview` finishes writing to the stream, the `Invoke` method on + /// the provided `handler` parameter is run. This method fails if called + /// before the first ContentLoading event. For example if this is called in + /// the NavigationStarting event for the first navigation it will fail. + /// For subsequent navigations, the method may not fail, but will not capture + /// an image of a given webpage until the ContentLoading event has been fired + /// for it. Any call to this method prior to that will result in a capture of + /// the page being navigated away from. + /// + /// \snippet FileComponent.cpp CapturePreview + + HRESULT CapturePreview( + [in] COREWEBVIEW2_CAPTURE_PREVIEW_IMAGE_FORMAT imageFormat, + [in] IStream* imageStream, + [in] ICoreWebView2CapturePreviewCompletedHandler* handler); + + /// Reload the current page. This is similar to navigating to the URI of + /// current top level document including all navigation events firing and + /// respecting any entries in the HTTP cache. But, the back or forward + /// history are not modified. + + HRESULT Reload(); + + /// Post the specified webMessage to the top level document in this WebView. + /// Runs the message event of the `window.chrome.webview` of the top-level + /// document. JavaScript in that document may subscribe and unsubscribe to + /// the event using the following code. + /// + /// ```cpp + /// window.chrome.webview.addEventListener('message', handler) + /// window.chrome.webview.removeEventListener('message', handler) + /// ``` + /// + /// The event args is an instance of `MessageEvent`. The + /// `ICoreWebView2Settings::IsWebMessageEnabled` setting must be `TRUE` or + /// this method fails with `E_INVALIDARG`. The `data` property of the event + /// arg is the `webMessage` string parameter parsed as a JSON string into a + /// JavaScript object. The `source` property of the event arg is a reference + /// to the `window.chrome.webview` object. For information about sending + /// messages from the HTML document in the WebView to the host, navigate to + /// \[add_WebMessageReceived]. The message is sent asynchronously. If a + /// navigation occurs before the message is posted to the page, the message + /// is not sent. + /// + /// \snippet ScenarioWebMessage.cpp WebMessageReceived + + HRESULT PostWebMessageAsJson([in] LPCWSTR webMessageAsJson); + + /// Posts a message that is a simple string rather than a JSON string + /// representation of a JavaScript object. This behaves in exactly the same + /// manner as `PostWebMessageAsJson`, but the `data` property of the event + /// arg of the `window.chrome.webview` message is a string with the same + /// value as `webMessageAsString`. Use this instead of + /// `PostWebMessageAsJson` if you want to communicate using simple strings + /// rather than JSON objects. + + HRESULT PostWebMessageAsString([in] LPCWSTR webMessageAsString); + + /// Add an event handler for the `WebMessageReceived` event. + /// `WebMessageReceived` runs when the + /// `ICoreWebView2Settings::IsWebMessageEnabled` setting is set and the + /// top-level document of the WebView runs + /// `window.chrome.webview.postMessage`. The `postMessage` function is + /// `void postMessage(object)` where object is any object supported by JSON + /// conversion. + /// + /// \snippet assets\ScenarioWebMessage.html chromeWebView + /// + /// When `postMessage` is run, the `Invoke` method of the `handler` is run + /// with the `object` parameter of the `postMessage` converted to a JSON + /// string. + /// + /// \snippet ScenarioWebMessage.cpp WebMessageReceived + + HRESULT add_WebMessageReceived( + [in] ICoreWebView2WebMessageReceivedEventHandler* handler, + [out] EventRegistrationToken* token); + + /// Remove an event handler previously added with `add_WebMessageReceived`. + + HRESULT remove_WebMessageReceived( + [in] EventRegistrationToken token); + + /// Runs an asynchronous `DevToolsProtocol` method. For more information + /// about available methods, navigate to + /// \[DevTools Protocol Viewer\]\[GithubChromedevtoolsDevtoolsProtocolTot\] + /// . The `methodName` parameter is the full name of the method in the + /// `{domain}.{method}` format. The `parametersAsJson` parameter is a JSON + /// formatted string containing the parameters for the corresponding method. + /// The `Invoke` method of the `handler` is run when the method + /// asynchronously completes. `Invoke` is run with the return object of the + /// method as a JSON string. + /// + /// \snippet ScriptComponent.cpp CallDevToolsProtocolMethod + /// + /// + /// \[GithubChromedevtoolsDevtoolsProtocolTot\]: https://chromedevtools.github.io/devtools-protocol/tot "latest (tip-of-tree) protocol - Chrome DevTools Protocol | GitHub" + + HRESULT CallDevToolsProtocolMethod( + [in] LPCWSTR methodName, + [in] LPCWSTR parametersAsJson, + [in] ICoreWebView2CallDevToolsProtocolMethodCompletedHandler* handler); + + /// The process ID of the browser process that hosts the WebView. + + [propget] HRESULT BrowserProcessId([out, retval] UINT32* value); + + /// `TRUE` if the WebView is able to navigate to a previous page in the + /// navigation history. If `CanGoBack` changes value, the `HistoryChanged` + /// event runs. + + [propget] HRESULT CanGoBack([out, retval] BOOL* canGoBack); + + /// `TRUE` if the WebView is able to navigate to a next page in the + /// navigation history. If `CanGoForward` changes value, the + /// `HistoryChanged` event runs. + + [propget] HRESULT CanGoForward([out, retval] BOOL* canGoForward); + + /// Navigates the WebView to the previous page in the navigation history. + + HRESULT GoBack(); + + /// Navigates the WebView to the next page in the navigation history. + + HRESULT GoForward(); + + /// Get a DevTools Protocol event receiver that allows you to subscribe to a + /// DevTools Protocol event. The `eventName` parameter is the full name of + /// the event in the format `{domain}.{event}`. For more information about + /// DevTools Protocol events description and event args, navigate to + /// \[DevTools Protocol Viewer\]\[GithubChromedevtoolsDevtoolsProtocolTot\]. + /// + /// \snippet ScriptComponent.cpp DevToolsProtocolEventReceived + /// + /// + /// \[GithubChromedevtoolsDevtoolsProtocolTot\]: https://chromedevtools.github.io/devtools-protocol/tot "latest (tip-of-tree) protocol - Chrome DevTools Protocol | GitHub" + + HRESULT GetDevToolsProtocolEventReceiver( + [in] LPCWSTR eventName, + [out, retval] ICoreWebView2DevToolsProtocolEventReceiver** receiver); + + /// Stop all navigations and pending resource fetches. Does not stop scripts. + + HRESULT Stop(); + + /// Add an event handler for the `NewWindowRequested` event. + /// `NewWindowRequested` runs when content inside the WebView requests to + /// open a new window, such as through `window.open`. The app passes a + /// target WebView that is considered the opened window. + /// + /// If a deferral is not taken on the event args, scripts that resulted in + /// the new window that are requested are blocked until the event handler + /// returns. If a deferral is taken, then scripts are blocked until the + /// deferral is completed. + /// + /// For more details and considerations on the target WebView to be supplied + /// at the opened window, see `ICoreWebView2NewWindowRequestedEventArgs::put_NewWindow`. + /// + /// \snippet AppWindow.cpp NewWindowRequested + + HRESULT add_NewWindowRequested( + [in] ICoreWebView2NewWindowRequestedEventHandler* eventHandler, + [out] EventRegistrationToken* token); + + /// Remove an event handler previously added with `add_NewWindowRequested`. + + HRESULT remove_NewWindowRequested( + [in] EventRegistrationToken token); + + /// Add an event handler for the `DocumentTitleChanged` event. + /// `DocumentTitleChanged` runs when the `DocumentTitle` property of the + /// WebView changes and may run before or after the `NavigationCompleted` + /// event. + /// + /// \snippet FileComponent.cpp DocumentTitleChanged + + HRESULT add_DocumentTitleChanged( + [in] ICoreWebView2DocumentTitleChangedEventHandler* eventHandler, + [out] EventRegistrationToken* token); + + /// Remove an event handler previously added with `add_DocumentTitleChanged`. + + HRESULT remove_DocumentTitleChanged( + [in] EventRegistrationToken token); + + /// The title for the current top-level document. If the document has no + /// explicit title or is otherwise empty, a default that may or may not match + /// the URI of the document is used. + + [propget] HRESULT DocumentTitle([out, retval] LPWSTR* title); + + /// Add the provided host object to script running in the WebView with the + /// specified name. Host objects are exposed as host object proxies using + /// `window.chrome.webview.hostObjects.{name}`. Host object proxies are + /// promises and resolves to an object representing the host object. The + /// promise is rejected if the app has not added an object with the name. + /// When JavaScript code access a property or method of the object, a promise + /// is return, which resolves to the value returned from the host for the + /// property or method, or rejected in case of error, for example, no + /// property or method on the object or parameters are not valid. + /// + /// > [!NOTE] + /// While simple types, `IDispatch` and array are supported, generic + /// `IUnknown`, `VT_DECIMAL`, or `VT_RECORD` variant is not supported. + /// Remote JavaScript objects like callback functions are represented as an + /// `VT_DISPATCH` `VARIANT` with the object implementing `IDispatch`. The + /// JavaScript callback method may be invoked using `DISPID_VALUE` for the + /// `DISPID`. Nested arrays are supported up to a depth of 3. Arrays of by + /// reference types are not supported. `VT_EMPTY` and `VT_NULL` are mapped + /// into JavaScript as `null`. In JavaScript, `null` and undefined are + /// mapped to `VT_EMPTY`. + /// + /// Additionally, all host objects are exposed as + /// `window.chrome.webview.hostObjects.sync.{name}`. Here the host objects + /// are exposed as synchronous host object proxies. These are not promises + /// and function runtimes or property access synchronously block running + /// script waiting to communicate cross process for the host code to run. + /// Accordingly the result may have reliability issues and it is recommended + /// that you use the promise-based asynchronous + /// `window.chrome.webview.hostObjects.{name}` API. + /// + /// Synchronous host object proxies and asynchronous host object proxies may + /// both use a proxy to the same host object. Remote changes made by one + /// proxy propagates to any other proxy of that same host object whether + /// the other proxies and synchronous or asynchronous. + /// + /// While JavaScript is blocked on a synchronous run to native code, that + /// native code is unable to run back to JavaScript. Attempts to do so fail + /// with `HRESULT_FROM_WIN32(ERROR_POSSIBLE_DEADLOCK)`. + /// + /// Host object proxies are JavaScript Proxy objects that intercept all + /// property get, property set, and method invocations. Properties or methods + /// that are a part of the Function or Object prototype are run locally. + /// Additionally any property or method in the + /// `chrome.webview.hostObjects.options.forceLocalProperties` + /// array are also run locally. This defaults to including optional methods + /// that have meaning in JavaScript like `toJSON` and `Symbol.toPrimitive`. + /// Add more to the array as required. + /// + /// The `chrome.webview.hostObjects.cleanupSome` method performs a best + /// effort garbage collection on host object proxies. + /// + /// Host object proxies additionally have the following methods which run + /// locally. + /// + /// Method name | Details + /// ---|--- + ///`applyHostFunction`, `getHostProperty`, `setHostProperty` | Perform a method invocation, property get, or property set on the host object. Use the methods to explicitly force a method or property to run remotely if a conflicting local method or property exists. For instance, `proxy.toString()` runs the local `toString` method on the proxy object. But proxy.applyHostFunction('toString') runs `toString` on the host proxied object instead. + ///`getLocalProperty`, `setLocalProperty` | Perform property get, or property set locally. Use the methods to force getting or setting a property on the host object proxy rather than on the host object it represents. For instance, `proxy.unknownProperty` gets the property named `unknownProperty` from the host proxied object. But proxy.getLocalProperty('unknownProperty') gets the value of the property `unknownProperty` on the proxy object. + ///`sync` | Asynchronous host object proxies expose a sync method which returns a promise for a synchronous host object proxy for the same host object. For example, `chrome.webview.hostObjects.sample.methodCall()` returns an asynchronous host object proxy. Use the `sync` method to obtain a synchronous host object proxy instead: `const syncProxy = await chrome.webview.hostObjects.sample.methodCall().sync()`. + ///`async` | Synchronous host object proxies expose an async method which blocks and returns an asynchronous host object proxy for the same host object. For example, `chrome.webview.hostObjects.sync.sample.methodCall()` returns a synchronous host object proxy. Running the `async` method on this blocks and then returns an asynchronous host object proxy for the same host object: `const asyncProxy = chrome.webview.hostObjects.sync.sample.methodCall().async()`. + ///`then` | Asynchronous host object proxies have a `then` method. Allows proxies to be awaitable. `then` returns a promise that resolves with a representation of the host object. If the proxy represents a JavaScript literal, a copy of that is returned locally. If the proxy represents a function, a non-awaitable proxy is returned. If the proxy represents a JavaScript object with a mix of literal properties and function properties, the a copy of the object is returned with some properties as host object proxies. + /// + /// All other property and method invocations (other than the above Remote + /// object proxy methods, `forceLocalProperties` list, and properties on + /// Function and Object prototypes) are run remotely. Asynchronous host + /// object proxies return a promise representing asynchronous completion of + /// remotely invoking the method, or getting the property. The promise + /// resolves after the remote operations complete and the promises resolve to + /// the resulting value of the operation. Synchronous host object proxies + /// work similarly, but block running JavaScript and wait for the remote + /// operation to complete. + /// + /// Setting a property on an asynchronous host object proxy works slightly + /// differently. The set returns immediately and the return value is the + /// value that is set. This is a requirement of the JavaScript Proxy object. + /// If you need to asynchronously wait for the property set to complete, use + /// the `setHostProperty` method which returns a promise as described above. + /// Synchronous object property set property synchronously blocks until the + /// property is set. + /// + /// For example, suppose you have a COM object with the following interface. + /// + /// \snippet HostObjectSample.idl AddHostObjectInterface + /// + /// Add an instance of this interface into your JavaScript with + /// `AddHostObjectToScript`. In this case, name it `sample`. + /// + /// \snippet ScenarioAddHostObject.cpp AddHostObjectToScript + /// + /// In the HTML document, use the COM object using + /// `chrome.webview.hostObjects.sample`. + /// + /// \snippet assets\ScenarioAddHostObject.html HostObjectUsage + /// + /// Exposing host objects to script has security risk. For more information + /// about best practices, navigate to + /// \[Best practices for developing secure WebView2 applications\]\[MicrosoftEdgeWebview2ConceptsSecurity\]. + /// + /// \[MicrosoftEdgeWebview2ConceptsSecurity\]: /microsoft-edge/webview2/concepts/security "Best practices for developing secure WebView2 applications | Microsoft Docs" + + HRESULT AddHostObjectToScript([in] LPCWSTR name, [in] VARIANT* object); + + /// Remove the host object specified by the name so that it is no longer + /// accessible from JavaScript code in the WebView. While new access + /// attempts are denied, if the object is already obtained by JavaScript code + /// in the WebView, the JavaScript code continues to have access to that + /// object. Run this method for a name that is already removed or never + /// added fails. + + HRESULT RemoveHostObjectFromScript([in] LPCWSTR name); + + /// Opens the DevTools window for the current document in the WebView. Does + /// nothing if run when the DevTools window is already open. + + HRESULT OpenDevToolsWindow(); + + /// Add an event handler for the `ContainsFullScreenElementChanged` event. + /// `ContainsFullScreenElementChanged` triggers when the + /// `ContainsFullScreenElement` property changes. An HTML element inside the + /// WebView may enter fullscreen to the size of the WebView or leave + /// fullscreen. This event is useful when, for example, a video element + /// requests to go fullscreen. The listener of + /// `ContainsFullScreenElementChanged` may resize the WebView in response. + /// + /// \snippet AppWindow.cpp ContainsFullScreenElementChanged + + HRESULT add_ContainsFullScreenElementChanged( + [in] ICoreWebView2ContainsFullScreenElementChangedEventHandler* eventHandler, + [out] EventRegistrationToken* token); + + /// Remove an event handler previously added with + /// `add_ContainsFullScreenElementChanged`. + + HRESULT remove_ContainsFullScreenElementChanged( + [in] EventRegistrationToken token); + + /// Indicates if the WebView contains a fullscreen HTML element. + + [propget] HRESULT ContainsFullScreenElement( + [out, retval] BOOL* containsFullScreenElement); + + /// Add an event handler for the `WebResourceRequested` event. + /// `WebResourceRequested` runs when the WebView is performing a URL request + /// to a matching URL and resource context filter that was added with + /// `AddWebResourceRequestedFilter`. At least one filter must be added for + /// the event to run. + /// + /// The web resource requested may be blocked until the event handler returns + /// if a deferral is not taken on the event args. If a deferral is taken, + /// then the web resource requested is blocked until the deferral is + /// completed. + /// + /// If the method is run in add_NewWindowRequested handler it should be called + /// after the new window deferral is completed. For more details see `ICoreWebView2NewWindowRequestedEventArgs::put_NewWindow`. + /// + /// \snippet SettingsComponent.cpp WebResourceRequested0 + /// \snippet SettingsComponent.cpp WebResourceRequested1 + + HRESULT add_WebResourceRequested( + [in] ICoreWebView2WebResourceRequestedEventHandler* eventHandler, + [out] EventRegistrationToken* token); + + /// Remove an event handler previously added with `add_WebResourceRequested`. + + HRESULT remove_WebResourceRequested( + [in] EventRegistrationToken token); + + /// Adds a URI and resource context filter to the `WebResourceRequested` + /// event. The `URI` parameter value may be set to a wildcard string + /// (`*`: zero or more, `?`: exactly one). `nullptr` is equivalent to + /// `L""`. For more information about resource context filters, navigate to + /// [COREWEBVIEW2_WEB_RESOURCE_CONTEXT]. + + HRESULT AddWebResourceRequestedFilter( + [in] LPCWSTR const uri, + [in] COREWEBVIEW2_WEB_RESOURCE_CONTEXT const resourceContext); + + /// Removes a matching WebResource filter that was previously added for the + /// `WebResourceRequested` event. If the same filter was added multiple + /// times, then it must be removed as many times as it was added for the + /// removal to be effective. Returns `E_INVALIDARG` for a filter that was + /// never added. + + HRESULT RemoveWebResourceRequestedFilter( + [in] LPCWSTR const uri, + [in] COREWEBVIEW2_WEB_RESOURCE_CONTEXT const resourceContext); + + /// Add an event handler for the `WindowCloseRequested` event. + /// `WindowCloseRequested` triggers when content inside the WebView + /// requested to close the window, such as after `window.close` is run. The + /// app should close the WebView and related app window if that makes sense + /// to the app. + /// + /// \snippet AppWindow.cpp WindowCloseRequested + + HRESULT add_WindowCloseRequested( + [in] ICoreWebView2WindowCloseRequestedEventHandler* eventHandler, + [out] EventRegistrationToken* token); + + /// Remove an event handler previously added with `add_WindowCloseRequested`. + + HRESULT remove_WindowCloseRequested( + [in] EventRegistrationToken token); +} + +/// A continuation of the ICoreWebView2 interface. +[uuid(9E8F0CF8-E670-4B5E-B2BC-73E061E3184C), object, pointer_default(unique)] +interface ICoreWebView2_2 : ICoreWebView2 { + /// Add an event handler for the WebResourceResponseReceived event. + /// WebResourceResponseReceived is raised when the WebView receives the + /// response for a request for a web resource (any URI resolution performed by + /// the WebView; such as HTTP/HTTPS, file and data requests from redirects, + /// navigations, declarations in HTML, implicit favicon lookups, and fetch API + /// usage in the document). The host app can use this event to view the actual + /// request and response for a web resource. There is no guarantee about the + /// order in which the WebView processes the response and the host app's + /// handler runs. The app's handler will not block the WebView from processing + /// the response. + /// \snippet ScenarioAuthentication.cpp WebResourceResponseReceived + HRESULT add_WebResourceResponseReceived( + [in] ICoreWebView2WebResourceResponseReceivedEventHandler* eventHandler, + [out] EventRegistrationToken* token); + /// Remove an event handler previously added with + /// add_WebResourceResponseReceived. + HRESULT remove_WebResourceResponseReceived( + [in] EventRegistrationToken token); + + /// Navigates using a constructed WebResourceRequest object. This lets you + /// provide post data or additional request headers during navigation. + /// The headers in the WebResourceRequest override headers + /// added by WebView2 runtime except for Cookie headers. + /// Method can only be either "GET" or "POST". Provided post data will only + /// be sent only if the method is "POST" and the uri scheme is HTTP(S). + /// \snippet ScenarioNavigateWithWebResourceRequest.cpp NavigateWithWebResourceRequest + HRESULT NavigateWithWebResourceRequest([in] ICoreWebView2WebResourceRequest* request); + + /// Add an event handler for the DOMContentLoaded event. + /// DOMContentLoaded is raised when the initial html document has been parsed. + /// This aligns with the the document's DOMContentLoaded event in html. + /// + /// \snippet ScenarioDOMContentLoaded.cpp DOMContentLoaded + HRESULT add_DOMContentLoaded( + [in] ICoreWebView2DOMContentLoadedEventHandler* eventHandler, + [out] EventRegistrationToken* token); + /// Remove an event handler previously added with add_DOMContentLoaded. + HRESULT remove_DOMContentLoaded( + [in] EventRegistrationToken token); + + /// Gets the cookie manager object associated with this ICoreWebView2. + /// See ICoreWebView2CookieManager. + /// + /// \snippet ScenarioCookieManagement.cpp CookieManager + [propget] HRESULT CookieManager([out, retval] ICoreWebView2CookieManager** cookieManager); + + /// Exposes the CoreWebView2Environment used to create this CoreWebView2. + [propget] HRESULT Environment([out, retval] ICoreWebView2Environment** environment); +} + +/// A continuation of the ICoreWebView2_2 interface. +[uuid(A0D6DF20-3B92-416D-AA0C-437A9C727857), object, pointer_default(unique)] +interface ICoreWebView2_3 : ICoreWebView2_2 { + /// An app may call the `TrySuspend` API to have the WebView2 consume less memory. + /// This is useful when a Win32 app becomes invisible, or when a Universal Windows + /// Platform app is being suspended, during the suspended event handler before completing + /// the suspended event. + /// The CoreWebView2Controller's IsVisible property must be false when the API is called. + /// Otherwise, the API fails with `HRESULT_FROM_WIN32(ERROR_INVALID_STATE)`. + /// Suspending is similar to putting a tab to sleep in the Edge browser. Suspending pauses + /// WebView script timers and animations, minimizes CPU usage for the associated + /// browser renderer process and allows the operating system to reuse the memory that was + /// used by the renderer process for other processes. + /// Note that Suspend is best effort and considered completed successfully once the request + /// is sent to browser renderer process. If there is a running script, the script will continue + /// to run and the renderer process will be suspended after that script is done. + /// See [Sleeping Tabs FAQ](https://techcommunity.microsoft.com/t5/articles/sleeping-tabs-faq/m-p/1705434) + /// for conditions that might prevent WebView from being suspended. In those situations, + /// the completed handler will be invoked with isSuccessful as false and errorCode as S_OK. + /// The WebView will be automatically resumed when it becomes visible. Therefore, the + /// app normally does not have to call `Resume` explicitly. + /// The app can call `Resume` and then `TrySuspend` periodically for an invisible WebView so that + /// the invisible WebView can sync up with latest data and the page ready to show fresh content + /// when it becomes visible. + /// All WebView APIs can still be accessed when a WebView is suspended. Some APIs like Navigate + /// will auto resume the WebView. To avoid unexpected auto resume, check `IsSuspended` property + /// before calling APIs that might change WebView state. + /// + /// \snippet ViewComponent.cpp ToggleIsVisibleOnMinimize + /// + /// \snippet ViewComponent.cpp Suspend + /// + HRESULT TrySuspend([in] ICoreWebView2TrySuspendCompletedHandler* handler); + + /// Resumes the WebView so that it resumes activities on the web page. + /// This API can be called while the WebView2 controller is invisible. + /// The app can interact with the WebView immediately after `Resume`. + /// WebView will be automatically resumed when it becomes visible. + /// + /// \snippet ViewComponent.cpp ToggleIsVisibleOnMinimize + /// + /// \snippet ViewComponent.cpp Resume + /// + HRESULT Resume(); + + /// Whether WebView is suspended. + /// `TRUE` when WebView is suspended, from the time when TrySuspend has completed + /// successfully until WebView is resumed. + [propget] HRESULT IsSuspended([out, retval] BOOL* isSuspended); + + /// Sets a mapping between a virtual host name and a folder path to make available to web sites + /// via that host name. + /// + /// After setting the mapping, documents loaded in the WebView can use HTTP or HTTPS URLs at + /// the specified host name specified by hostName to access files in the local folder specified + /// by folderPath. + /// + /// This mapping applies to both top-level document and iframe navigations as well as subresource + /// references from a document. This also applies to dedicated and shared worker scripts but does + /// not apply to service worker scripts. + /// Due to a current implementation limitation, media files accessed using virtual host name can be + /// very slow to load. + /// As the resource loaders for the current page might have already been created and running, + /// changes to the mapping might not be applied to the current page and a reload of the page is + /// needed to apply the new mapping. + /// + /// Both absolute and relative paths are supported for folderPath. Relative paths are interpreted + /// as relative to the folder where the exe of the app is in. + /// + /// accessKind specifies the level of access to resources under the virtual host from other sites. + /// + /// For example, after calling + /// ```cpp + /// SetVirtualHostNameToFolderMapping( + /// L"appassets.example", L"assets", + /// COREWEBVIEW2_HOST_RESOURCE_ACCESS_KIND_DENY); + /// ``` + /// navigating to `https://appassets.example/my-local-file.html` will + /// show content from my-local-file.html in the assets subfolder located on disk under the same + /// path as the app's executable file. + /// + /// You should typically choose virtual host names that are never used by real sites. + /// If you own a domain such as example.com, another option is to use a subdomain reserved for + /// the app (like my-app.example.com). + /// + /// [RFC 6761](https://tools.ietf.org/html/rfc6761) has reserved several special-use domain + /// names that are guaranteed to not be used by real sites (for example, .example, .test, and + /// .invalid.) + /// + /// Apps should use distinct domain names when mapping folder from different sources that + /// should be isolated from each other. For instance, the app might use app-file.example for + /// files that ship as part of the app, and book1.example might be used for files containing + /// books from a less trusted source that were previously downloaded and saved to the disk by + /// the app. + /// + /// The host name used in the APIs is canonicalized using Chromium's host name parsing logic + /// before being used internally. + /// + /// All host names that are canonicalized to the same string are considered identical. + /// For example, `EXAMPLE.COM` and `example.com` are treated as the same host name. + /// An international host name and its Punycode-encoded host name are considered the same host + /// name. There is no DNS resolution for host name and the trailing '.' is not normalized as + /// part of canonicalization. + /// + /// Therefore `example.com` and `example.com.` are treated as different host names. Similarly, + /// `virtual-host-name` and `virtual-host-name.example.com` are treated as different host names + /// even if the machine has a DNS suffix of `example.com`. + /// + /// Specify the minimal cross-origin access necessary to run the app. If there is not a need to + /// access local resources from other origins, use COREWEBVIEW2_HOST_RESOURCE_ACCESS_KIND_DENY. + /// + /// \snippet AppWindow.cpp AddVirtualHostNameToFolderMapping + /// + /// \snippet AppWindow.cpp LocalUrlUsage + HRESULT SetVirtualHostNameToFolderMapping( + [in] LPCWSTR hostName, + [in] LPCWSTR folderPath, + [in] COREWEBVIEW2_HOST_RESOURCE_ACCESS_KIND accessKind); + /// Clears a host name mapping for local folder that was added by `SetVirtualHostNameToFolderMapping`. + HRESULT ClearVirtualHostNameToFolderMapping( + [in] LPCWSTR hostName); +} + +/// A continuation of the ICoreWebView2_3 interface to support FrameCreated and +/// DownloadStarting events. +[uuid(20d02d59-6df2-42dc-bd06-f98a694b1302), object, pointer_default(unique)] +interface ICoreWebView2_4 : ICoreWebView2_3 { + /// Raised when a new iframe is created. Use the + /// CoreWebView2Frame.add_Destroyed to listen for when this iframe goes + /// away. + HRESULT add_FrameCreated( + [in] ICoreWebView2FrameCreatedEventHandler * eventHandler, + [out] EventRegistrationToken * token); + + /// Remove an event handler previously added with add_FrameCreated. + HRESULT remove_FrameCreated([in] EventRegistrationToken token); + + /// Add an event handler for the `DownloadStarting` event. This event is + /// raised when a download has begun, blocking the default download dialog, + /// but not blocking the progress of the download. + /// + /// The host can choose to cancel a download, change the result file path, + /// and hide the default download dialog. + /// If the host chooses to cancel the download, the download is not saved, no + /// dialog is shown, and the state is changed to + /// COREWEBVIEW2_DOWNLOAD_STATE_INTERRUPTED with interrupt reason + /// COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_USER_CANCELED. Otherwise, the + /// download is saved to the default path after the event completes, + /// and default download dialog is shown if the host did not choose to hide it. + /// The host can change the visibility of the download dialog using the + /// `Handled` property. If the event is not handled, downloads complete + /// normally with the default dialog shown. + /// + /// \snippet ScenarioCustomDownloadExperience.cpp DownloadStarting + HRESULT add_DownloadStarting( + [in] ICoreWebView2DownloadStartingEventHandler* eventHandler, + [out] EventRegistrationToken* token); + + /// Remove an event handler previously added with `add_DownloadStarting`. + HRESULT remove_DownloadStarting( + [in] EventRegistrationToken token); +} + +/// The caller implements this interface to receive the TrySuspend result. +[uuid(00F206A7-9D17-4605-91F6-4E8E4DE192E3), object, pointer_default(unique)] +interface ICoreWebView2TrySuspendCompletedHandler : IUnknown { + + /// Provides the result of the TrySuspend operation. + /// See [Sleeping Tabs FAQ](https://techcommunity.microsoft.com/t5/articles/sleeping-tabs-faq/m-p/1705434) + /// for conditions that might prevent WebView from being suspended. In those situations, + /// isSuccessful will be false and errorCode is S_OK. + HRESULT Invoke([in] HRESULT errorCode, [in] BOOL isSuccessful); + +} + +/// The owner of the `CoreWebView2` object that provides support for resizing, +/// showing and hiding, focusing, and other functionality related to +/// windowing and composition. The `CoreWebView2Controller` owns the +/// `CoreWebView2`, and if all references to the `CoreWebView2Controller` go +/// away, the WebView is closed. + +[uuid(4d00c0d1-9434-4eb6-8078-8697a560334f), object, pointer_default(unique)] +interface ICoreWebView2Controller : IUnknown { + + /// The `IsVisible` property determines whether to show or hide the WebView2. + /// If `IsVisible` is set to `FALSE`, the WebView2 is transparent and is + /// not rendered. However, this does not affect the window containing the + /// WebView2 (the `HWND` parameter that was passed to + /// `CreateCoreWebView2Controller`). If you want that window to disappear + /// too, run `ShowWindow` on it directly in addition to modifying the + /// `IsVisible` property. WebView2 as a child window does not get window + /// messages when the top window is minimized or restored. For performance + /// reason, developer should set `IsVisible` property of the WebView to + /// `FALSE` when the app window is minimized and back to `TRUE` when app + /// window is restored. App window does this by handling + /// `SC_MINIMIZE and SC_RESTORE` command upon receiving `WM_SYSCOMMAND` + /// message. + /// + /// \snippet ViewComponent.cpp ToggleIsVisible + + [propget] HRESULT IsVisible([out, retval] BOOL* isVisible); + + /// Sets the `IsVisible` property. + /// + /// \snippet ViewComponent.cpp ToggleIsVisibleOnMinimize + + [propput] HRESULT IsVisible([in] BOOL isVisible); + + /// The WebView bounds. Bounds are relative to the parent `HWND`. The app + /// has two ways to position a WebView. + /// + /// * Create a child `HWND` that is the WebView parent `HWND`. Position + /// the window where the WebView should be. Use `(0, 0)` for the + /// top-left corner (the offset) of the `Bounds` of the WebView. + /// * Use the top-most window of the app as the WebView parent HWND. For + /// example, to position WebView correctly in the app, set the top-left + /// corner of the Bound of the WebView. + /// + /// The values of `Bounds` are limited by the coordinate space of the host. + + [propget] HRESULT Bounds([out, retval] RECT* bounds); + + /// Sets the `Bounds` property. + /// + /// \snippet ViewComponent.cpp ResizeWebView + + [propput] HRESULT Bounds([in] RECT bounds); + + /// The zoom factor for the WebView. + /// + /// > [!NOTE] + /// Changing zoom factor may cause `window.innerWidth`, + /// `window.innerHeight`, both, and page layout to change. A zoom factor + /// that is applied by the host by running `ZoomFactor` becomes the new + /// default zoom for the WebView. The zoom factor applies across navigations + /// and is the zoom factor WebView is returned to when the user chooses + /// Ctrl+0. When the zoom factor is changed by the user (resulting in + /// the app receiving `ZoomFactorChanged`), that zoom applies only for the + /// current page. Any user applied zoom is only for the current page and is + /// reset on a navigation. Specifying a `zoomFactor` less than or equal to + /// `0` is not allowed. WebView also has an internal supported zoom factor + /// range. When a specified zoom factor is out of that range, it is + /// normalized to be within the range, and a `ZoomFactorChanged` event is + /// triggered for the real applied zoom factor. When the range normalization + /// happens, the `ZoomFactor` property reports the zoom factor specified + /// during the previous modification of the `ZoomFactor` property until the + /// `ZoomFactorChanged` event is received after WebView applies the + /// normalized zoom factor. + + [propget] HRESULT ZoomFactor([out, retval] double* zoomFactor); + + /// Sets the `ZoomFactor` property. + + [propput] HRESULT ZoomFactor([in] double zoomFactor); + + /// Adds an event handler for the `ZoomFactorChanged` event. + /// `ZoomFactorChanged` runs when the `ZoomFactor` property of the WebView + /// changes. The event may run because the `ZoomFactor` property was + /// modified, or due to the user manually modifying the zoom. When it is + /// modified using the `ZoomFactor` property, the internal zoom factor is + /// updated immediately and no `ZoomFactorChanged` event is triggered. + /// WebView associates the last used zoom factor for each site. It is + /// possible for the zoom factor to change when navigating to a different + /// page. When the zoom factor changes due to a navigation change, the + /// `ZoomFactorChanged` event runs right after the `ContentLoading` event. + /// + /// \snippet ViewComponent.cpp ZoomFactorChanged + + HRESULT add_ZoomFactorChanged( + [in] ICoreWebView2ZoomFactorChangedEventHandler* eventHandler, + [out] EventRegistrationToken* token); + + /// Remove an event handler previously added with `add_ZoomFactorChanged`. + + HRESULT remove_ZoomFactorChanged( + [in] EventRegistrationToken token); + + /// Updates `Bounds` and `ZoomFactor` properties at the same time. This + /// operation is atomic from the perspective of the host. After returning + /// from this function, the `Bounds` and `ZoomFactor` properties are both + /// updated if the function is successful, or neither is updated if the + /// function fails. If `Bounds` and `ZoomFactor` are both updated by the + /// same scale (for example, `Bounds` and `ZoomFactor` are both doubled), + /// then the page does not display a change in `window.innerWidth` or + /// `window.innerHeight` and the WebView renders the content at the new size + /// and zoom without intermediate renderings. This function also updates + /// just one of `ZoomFactor` or `Bounds` by passing in the new value for one + /// and the current value for the other. + /// + /// \snippet ViewComponent.cpp SetBoundsAndZoomFactor + + HRESULT SetBoundsAndZoomFactor([in] RECT bounds, [in] double zoomFactor); + + /// Moves focus into WebView. WebView gets focus and focus is set to + /// correspondent element in the page hosted in the WebView. For + /// Programmatic reason, focus is set to previously focused element or the + /// default element if no previously focused element exists. For `Next` + /// reason, focus is set to the first element. For `Previous` reason, focus + /// is set to the last element. WebView changes focus through user + /// interaction including selecting into a WebView or Tab into it. For + /// tabbing, the app runs MoveFocus with Next or Previous to align with Tab + /// and Shift+Tab respectively when it decides the WebView is the next + /// element that may exist in a tab. Or, the app runs `IsDialogMessage` + /// as part of the associated message loop to allow the platform to auto + /// handle tabbing. The platform rotates through all windows with + /// `WS_TABSTOP`. When the WebView gets focus from `IsDialogMessage`, it is + /// internally put the focus on the first or last element for tab and + /// Shift+Tab respectively. + /// + /// \snippet App.cpp MoveFocus0 + /// + /// \snippet ControlComponent.cpp MoveFocus1 + /// + /// \snippet ControlComponent.cpp MoveFocus2 + + HRESULT MoveFocus([in] COREWEBVIEW2_MOVE_FOCUS_REASON reason); + + /// Adds an event handler for the `MoveFocusRequested` event. + /// `MoveFocusRequested` runs when user tries to tab out of the WebView. The + /// focus of the WebView has not changed when this event is run. + /// + /// \snippet ControlComponent.cpp MoveFocusRequested + + HRESULT add_MoveFocusRequested( + [in] ICoreWebView2MoveFocusRequestedEventHandler* eventHandler, + [out] EventRegistrationToken* token); + + /// Removes an event handler previously added with `add_MoveFocusRequested`. + + HRESULT remove_MoveFocusRequested( + [in] EventRegistrationToken token); + + /// Adds an event handler for the `GotFocus` event. `GotFocus` runs when + /// WebView has focus. + + HRESULT add_GotFocus( + [in] ICoreWebView2FocusChangedEventHandler* eventHandler, + [out] EventRegistrationToken* token); + + /// Removes an event handler previously added with `add_GotFocus`. + + HRESULT remove_GotFocus( + [in] EventRegistrationToken token); + + /// Adds an event handler for the `LostFocus` event. `LostFocus` runs when + /// WebView loses focus. In the case where `MoveFocusRequested` event is + /// run, the focus is still on WebView when `MoveFocusRequested` event runs. + /// `LostFocus` only runs afterwards when code of the app or default action + /// of `MoveFocusRequested` event set focus away from WebView. + + HRESULT add_LostFocus( + [in] ICoreWebView2FocusChangedEventHandler* eventHandler, + [out] EventRegistrationToken* token); + + /// Removes an event handler previously added with `add_LostFocus`. + + HRESULT remove_LostFocus( + [in] EventRegistrationToken token); + + /// Adds an event handler for the `AcceleratorKeyPressed` event. + /// `AcceleratorKeyPressed` runs when an accelerator key or key combo is + /// pressed or released while the WebView is focused. A key is considered an + /// accelerator if either of the following conditions are true. + /// + /// * Ctrl or Alt is currently being held. + /// * The pressed key does not map to a character. + /// + /// A few specific keys are never considered accelerators, such as Shift. + /// The `Escape` key is always considered an accelerator. + /// + /// Auto-repeated key events caused by holding the key down also triggers + /// this event. Filter out the auto-repeated key events by verifying the + /// `KeyEventLParam` or `PhysicalKeyStatus` event args. + /// + /// In windowed mode, the event handler is run synchronously. Until you + /// run `Handled()` on the event args or the event handler returns, the + /// browser process is blocked and outgoing cross-process COM requests fail + /// with `RPC_E_CANTCALLOUT_ININPUTSYNCCALL`. All `CoreWebView2` API methods + /// work, however. + /// + /// In windowless mode, the event handler is run asynchronously. Further + /// input do not reach the browser until the event handler returns or + /// `Handled()` is run, but the browser process is not blocked, and outgoing + /// COM requests work normally. + /// + /// It is recommended to run `Handled(TRUE)` as early as are able to know + /// that you want to handle the accelerator key. + /// + /// \snippet ControlComponent.cpp AcceleratorKeyPressed + + HRESULT add_AcceleratorKeyPressed( + [in] ICoreWebView2AcceleratorKeyPressedEventHandler* eventHandler, + [out] EventRegistrationToken* token); + + /// Removes an event handler previously added with + /// `add_AcceleratorKeyPressed`. + + HRESULT remove_AcceleratorKeyPressed( + [in] EventRegistrationToken token); + + /// The parent window provided by the app that this WebView is using to + /// render content. This API initially returns the window passed into + /// `CreateCoreWebView2Controller`. + + [propget] HRESULT ParentWindow([out, retval] HWND* parentWindow); + + /// Sets the parent window for the WebView. This causes the WebView to + /// re-parent the main WebView window to the newly provided window. + + [propput] HRESULT ParentWindow([in] HWND parentWindow); + + /// This is a notification separate from `Bounds` that tells WebView that the + /// main WebView parent (or any ancestor) `HWND` moved. This is needed + /// for accessibility and certain dialogs in WebView to work correctly. + /// + /// \snippet ViewComponent.cpp NotifyParentWindowPositionChanged + + HRESULT NotifyParentWindowPositionChanged(); + + /// Closes the WebView and cleans up the underlying browser instance. + /// Cleaning up the browser instance releases the resources powering the + /// WebView. The browser instance is shut down if no other WebViews are + /// using it. + /// + /// After running `Close`, most methods will fail and event handlers stop + /// running. Specifically, the WebView releases the associated references to + /// any associated event handlers when `Close` is run. + /// + /// `Close` is implicitly run when the `CoreWebView2Controller` loses the + /// final reference and is destructed. But it is best practice to + /// explicitly run `Close` to avoid any accidental cycle of references + /// between the WebView and the app code. Specifically, if you capture a + /// reference to the WebView in an event handler you create a reference cycle + /// between the WebView and the event handler. Run `Close` to break the + /// cycle by releasing all event handlers. But to avoid the situation, it is + /// best to both explicitly run `Close` on the WebView and to not capture a + /// reference to the WebView to ensure the WebView is cleaned up correctly. + /// + /// \snippet AppWindow.cpp Close + + HRESULT Close(); + + /// Gets the `CoreWebView2` associated with this `CoreWebView2Controller`. + + [propget] HRESULT CoreWebView2([out, retval] ICoreWebView2** coreWebView2); +} + +/// A continuation of the ICoreWebView2Controller interface. +[uuid(c979903e-d4ca-4228-92eb-47ee3fa96eab), object, pointer_default(unique)] +interface ICoreWebView2Controller2 : ICoreWebView2Controller { + /// The `DefaultBackgroundColor` property is the color WebView renders + /// underneath all web content. This means WebView renders this color when + /// there is no web content loaded such as before the initial navigation or + /// between navigations. This also means web pages with undefined css + /// background properties or background properties containing transparent + /// pixels will render their contents over this color. Web pages with defined + /// and opaque background properties that span the page will obscure the + /// `DefaultBackgroundColor` and display normally. The default value for this + /// property is white to resemble the native browser experience. + /// + /// The Color is specified by the COREWEBVIEW2_COLOR that represents an RGBA + /// value. The `A` represents an Alpha value, meaning + /// `DefaultBackgroundColor` can be transparent. In the case of a transparent + /// `DefaultBackgroundColor` WebView will render hosting app content as the + /// background. This Alpha value is not supported on Windows 7. Any `A` value + /// other than 255 will result in E_INVALIDARG on Windows 7. + /// It is supported on all other WebView compatible platforms. + /// + /// Semi-transparent colors are not currently supported by this API and + /// setting `DefaultBackgroundColor` to a semi-transparent color will fail + /// with E_INVALIDARG. The only supported alpha values are 0 and 255, all + /// other values will result in E_INVALIDARG. + /// `DefaultBackgroundColor` can only be an opaque color or transparent. + /// + /// \snippet ViewComponent.cpp DefaultBackgroundColor + + [propget] HRESULT DefaultBackgroundColor( + [out, retval] COREWEBVIEW2_COLOR* backgroundColor); + + /// Sets the `DefaultBackgroundColor` property. + + [propput] HRESULT DefaultBackgroundColor( + [in] COREWEBVIEW2_COLOR backgroundColor); +} + +/// A continuation of the ICoreWebView2Controller2 interface. +[uuid(f9614724-5d2b-41dc-aef7-73d62b51543b), object, pointer_default(unique)] +interface ICoreWebView2Controller3 : ICoreWebView2Controller2 { + /// The rasterization scale for the WebView. The rasterization scale is the + /// combination of the monitor DPI scale and text scaling set by the user. + /// This value should be updated when the DPI scale of the app's top level + /// window changes (i.e. monitor DPI scale changes or window changes monitor) + /// or when the text scale factor of the system changes. + /// + /// \snippet AppWindow.cpp DPIChanged + /// + /// \snippet AppWindow.cpp TextScaleChanged1 + /// + /// \snippet AppWindow.cpp TextScaleChanged2 + /// + /// Rasterization scale applies to the WebView content, as well as + /// popups, context menus, scroll bars, and so on. Normal app scaling + /// scenarios should use the ZoomFactor property or SetBoundsAndZoomFactor + /// API which only scale the rendered HTML content and not popups, context + /// menus, scroll bars, and so on. + /// + /// \snippet ViewComponent.cpp RasterizationScale + [propget] HRESULT RasterizationScale([out, retval] double* scale); + /// Set the rasterization scale property. + [propput] HRESULT RasterizationScale([in] double scale); + + /// ShouldDetectMonitorScaleChanges property determines whether the WebView + /// attempts to track monitor DPI scale changes. When true, the WebView will + /// track monitor DPI scale changes, update the RasterizationScale property, + /// and raises RasterizationScaleChanged event. When false, the WebView will + /// not track monitor DPI scale changes, and the app must update the + /// RasterizationScale property itself. RasterizationScaleChanged event will + /// never raise when ShouldDetectMonitorScaleChanges is false. + [propget] HRESULT ShouldDetectMonitorScaleChanges([out, retval] BOOL* value); + /// Set the ShouldDetectMonitorScaleChanges property. + [propput] HRESULT ShouldDetectMonitorScaleChanges([in] BOOL value); + + /// Add an event handler for the RasterizationScaleChanged event. + /// The event is raised when the WebView detects that the monitor DPI scale + /// has changed, ShouldDetectMonitorScaleChanges is true, and the WebView has + /// changed the RasterizationScale property. + /// + /// \snippet ViewComponent.cpp RasterizationScaleChanged + HRESULT add_RasterizationScaleChanged( + [in] ICoreWebView2RasterizationScaleChangedEventHandler* eventHandler, + [out] EventRegistrationToken* token); + /// Remove an event handler previously added with + /// add_RasterizationScaleChanged. + HRESULT remove_RasterizationScaleChanged( + [in] EventRegistrationToken token); + + /// BoundsMode affects how setting the Bounds and RasterizationScale + /// properties work. Bounds mode can either be in COREWEBVIEW2_BOUNDS_MODE_USE_RAW_PIXELS + /// mode or COREWEBVIEW2_BOUNDS_MODE_USE_RASTERIZATION_SCALE mode. + /// + /// When the mode is in COREWEBVIEW2_BOUNDS_MODE_USE_RAW_PIXELS, setting the bounds + /// property will set the size of the WebView in raw screen pixels. Changing + /// the rasterization scale in this mode won't change the raw pixel size of + /// the WebView and will only change the rasterization scale. + /// + /// When the mode is in COREWEBVIEW2_BOUNDS_MODE_USE_RASTERIZATION_SCALE, setting the + /// bounds property will change the logical size of the WebView which can be + /// described by the following equation: + /// ```text + /// Logical size * rasterization scale = Raw Pixel size + /// ``` + /// In this case, changing the rasterization scale will keep the logical size + /// the same and change the raw pixel size. + /// + /// \snippet ViewComponent.cpp BoundsMode + [propget] HRESULT BoundsMode( + [out, retval] COREWEBVIEW2_BOUNDS_MODE* boundsMode); + /// Set the BoundsMode property. + [propput] HRESULT BoundsMode([in] COREWEBVIEW2_BOUNDS_MODE boundsMode); +} + +/// This interface is an extension of the ICoreWebView2Controller interface to +/// support visual hosting. An object implementing the +/// ICoreWebView2CompositionController interface will also implement +/// ICoreWebView2Controller. Callers are expected to use +/// ICoreWebView2Controller for resizing, visibility, focus, and so on, and +/// then use ICoreWebView2CompositionController to connect to a composition +/// tree and provide input meant for the WebView. +[uuid(3df9b733-b9ae-4a15-86b4-eb9ee9826469), object, pointer_default(unique)] +interface ICoreWebView2CompositionController : IUnknown { + /// The RootVisualTarget is a visual in the hosting app's visual tree. This + /// visual is where the WebView will connect its visual tree. The app uses + /// this visual to position the WebView within the app. The app still needs + /// to use the Bounds property to size the WebView. The RootVisualTarget + /// property can be an IDCompositionVisual or a + /// Windows::UI::Composition::ContainerVisual. WebView will connect its visual + /// tree to the provided visual before returning from the property setter. The + /// app needs to commit on its device setting the RootVisualTarget property. + /// The RootVisualTarget property supports being set to nullptr to disconnect + /// the WebView from the app's visual tree. + /// \snippet ViewComponent.cpp SetRootVisualTarget + /// \snippet ViewComponent.cpp BuildDCompTree + [propget] HRESULT RootVisualTarget([out, retval] IUnknown** target); + /// Set the RootVisualTarget property. + [propput] HRESULT RootVisualTarget([in] IUnknown* target); + + /// If eventKind is COREWEBVIEW2_MOUSE_EVENT_KIND_HORIZONTAL_WHEEL or + /// COREWEBVIEW2_MOUSE_EVENT_KIND_WHEEL, then mouseData specifies the amount of + /// wheel movement. A positive value indicates that the wheel was rotated + /// forward, away from the user; a negative value indicates that the wheel was + /// rotated backward, toward the user. One wheel click is defined as + /// WHEEL_DELTA, which is 120. + /// If eventKind is COREWEBVIEW2_MOUSE_EVENT_KIND_X_BUTTON_DOUBLE_CLICK + /// COREWEBVIEW2_MOUSE_EVENT_KIND_X_BUTTON_DOWN, or + /// COREWEBVIEW2_MOUSE_EVENT_KIND_X_BUTTON_UP, then mouseData specifies which X + /// buttons were pressed or released. This value should be 1 if the first X + /// button is pressed/released and 2 if the second X button is + /// pressed/released. + /// If eventKind is COREWEBVIEW2_MOUSE_EVENT_KIND_LEAVE, then virtualKeys, + /// mouseData, and point should all be zero. + /// If eventKind is any other value, then mouseData should be zero. + /// Point is expected to be in the client coordinate space of the WebView. + /// To track mouse events that start in the WebView and can potentially move + /// outside of the WebView and host application, calling SetCapture and + /// ReleaseCapture is recommended. + /// To dismiss hover popups, it is also recommended to send + /// COREWEBVIEW2_MOUSE_EVENT_KIND_LEAVE messages. + /// \snippet ViewComponent.cpp SendMouseInput + HRESULT SendMouseInput( + [in] COREWEBVIEW2_MOUSE_EVENT_KIND eventKind, + [in] COREWEBVIEW2_MOUSE_EVENT_VIRTUAL_KEYS virtualKeys, + [in] UINT32 mouseData, + [in] POINT point); + + /// SendPointerInput accepts touch or pen pointer input of types defined in + /// COREWEBVIEW2_POINTER_EVENT_KIND. Any pointer input from the system must be + /// converted into an ICoreWebView2PointerInfo first. + HRESULT SendPointerInput( + [in] COREWEBVIEW2_POINTER_EVENT_KIND eventKind, + [in] ICoreWebView2PointerInfo* pointerInfo); + + /// The current cursor that WebView thinks it should be. The cursor should be + /// set in WM_SETCURSOR through ::SetCursor or set on the corresponding + /// parent/ancestor HWND of the WebView through ::SetClassLongPtr. The HCURSOR + /// can be freed so CopyCursor/DestroyCursor is recommended to keep your own + /// copy if you are doing more than immediately setting the cursor. + [propget] HRESULT Cursor([out, retval] HCURSOR* cursor); + + /// The current system cursor ID reported by the underlying rendering engine + /// for WebView. For example, most of the time, when the cursor is over text, + /// this will return the int value for IDC_IBEAM. The systemCursorId is only + /// valid if the rendering engine reports a default Windows cursor resource + /// value. Navigate to + /// /[LoadCursorW/]/[WindowsWin32ApiWinuserNfwinuserloadcursorw/] for more + /// details. Otherwise, if custom CSS cursors are being used, this will return + /// 0. To actually use systemCursorId in LoadCursor or LoadImage, + /// MAKEINTRESOURCE must be called on it first. + /// + /// [WindowsWin32ApiWinuserNfwinuserloadcursorw]: /windows/win32/api/winuser/nf-winuser-loadcursorw "LoadCursorW function (winuser.h) - Win32 apps | Microsoft Docs" + /// + /// \snippet ViewComponent.cpp SystemCursorId + [propget] HRESULT SystemCursorId([out, retval] UINT32* systemCursorId); + + /// Add an event handler for the CursorChanged event. + /// The event is raised when WebView thinks the cursor should be changed. For + /// example, when the mouse cursor is currently the default cursor but is then + /// moved over text, it may try to change to the IBeam cursor. + /// + /// It is expected for the developer to send + /// COREWEBVIEW2_MOUSE_EVENT_KIND_LEAVE messages (in addition to + /// COREWEBVIEW2_MOUSE_EVENT_KIND_MOVE messages) through the SendMouseInput + /// API. This is to ensure that the mouse is actually within the WebView that + /// sends out CursorChanged events. + /// + /// \snippet ViewComponent.cpp CursorChanged + HRESULT add_CursorChanged( + [in] ICoreWebView2CursorChangedEventHandler* eventHandler, + [out] EventRegistrationToken* token); + /// Remove an event handler previously added with add_CursorChanged. + HRESULT remove_CursorChanged( + [in] EventRegistrationToken token); +} + +/// A continuation of the ICoreWebView2CompositionController interface. +[uuid(0b6a3d24-49cb-4806-ba20-b5e0734a7b26), object, pointer_default(unique)] +interface ICoreWebView2CompositionController2 : ICoreWebView2CompositionController { + /// Returns the UI Automation Provider for the WebView. + [propget] HRESULT UIAProvider([out, retval] IUnknown** provider); +} + +/// This interface is used to complete deferrals on event args that support +/// getting deferrals using the `GetDeferral` method. + +[uuid(c10e7f7b-b585-46f0-a623-8befbf3e4ee0), object, pointer_default(unique)] +interface ICoreWebView2Deferral : IUnknown { + + /// Completes the associated deferred event. Complete should only be run + /// once for each deferral taken. + + HRESULT Complete(); +} + +/// Defines properties that enable, disable, or modify WebView features. +/// Setting changes made after `NavigationStarting` event does not apply +/// until the next top-level navigation. + +[uuid(e562e4f0-d7fa-43ac-8d71-c05150499f00), object, pointer_default(unique)] +interface ICoreWebView2Settings : IUnknown { + + /// Controls if running JavaScript is enabled in all future navigations in + /// the WebView. This only affects scripts in the document. Scripts + /// injected with `ExecuteScript` runs even if script is disabled. + /// The default value is `TRUE`. + /// + /// \snippet SettingsComponent.cpp IsScriptEnabled + + [propget] HRESULT IsScriptEnabled( + [out, retval] BOOL* isScriptEnabled); + + /// Sets the `IsScriptEnabled` property. + + [propput] HRESULT IsScriptEnabled([in] BOOL isScriptEnabled); + + /// The `IsWebMessageEnabled` property is used when loading a new HTML + /// document. If set to `TRUE`, communication from the host to the top-level + /// HTML document of the WebView is allowed using `PostWebMessageAsJson`, + /// `PostWebMessageAsString`, and message event of `window.chrome.webview`. + /// For more information, navigate to [PostWebMessageAsJson]. Communication + /// from the top-level HTML document of the WebView to the host is allowed + /// using the postMessage function of `window.chrome.webview` and + /// `add_WebMessageReceived` method. For more information, navigate to + /// [add_WebMessageReceived]. If set to false, then communication is + /// disallowed. `PostWebMessageAsJson` and `PostWebMessageAsString` fails + /// with `E_ACCESSDENIED` and `window.chrome.webview.postMessage` fails by + /// throwing an instance of an `Error` object. + /// The default value is `TRUE`. + /// + /// \snippet ScenarioWebMessage.cpp IsWebMessageEnabled + + [propget] HRESULT IsWebMessageEnabled( + [out, retval] BOOL* isWebMessageEnabled); + + /// Sets the `IsWebMessageEnabled` property. + + [propput] HRESULT IsWebMessageEnabled([in] BOOL isWebMessageEnabled); + + /// `AreDefaultScriptDialogsEnabled` is used when loading a new HTML + /// document. If set to `FALSE`, WebView2 does not render the default JavaScript + /// dialog box (Specifically those displayed by the JavaScript alert, + /// confirm, prompt functions and `beforeunload` event). Instead, if an + /// event handler is set using `add_ScriptDialogOpening`, WebView sends an + /// event that contains all of the information for the dialog and allow the + /// host app to show a custom UI. + /// The default value is `TRUE`. + + [propget] HRESULT AreDefaultScriptDialogsEnabled( + [out, retval] BOOL* areDefaultScriptDialogsEnabled); + + /// Sets the `AreDefaultScriptDialogsEnabled` property. + + [propput] HRESULT AreDefaultScriptDialogsEnabled( + [in] BOOL areDefaultScriptDialogsEnabled); + + /// `IsStatusBarEnabled` controls whether the status bar is displayed. The + /// status bar is usually displayed in the lower left of the WebView and + /// shows things such as the URI of a link when the user hovers over it and + /// other information. + /// The default value is `TRUE`. + + [propget] HRESULT IsStatusBarEnabled([out, retval] BOOL* isStatusBarEnabled); + + /// Sets the `IsStatusBarEnabled` property. + + [propput] HRESULT IsStatusBarEnabled([in] BOOL isStatusBarEnabled); + + /// `AreDevToolsEnabled` controls whether the user is able to use the context + /// menu or keyboard shortcuts to open the DevTools window. + /// The default value is `TRUE`. + + [propget] HRESULT AreDevToolsEnabled([out, retval] BOOL* areDevToolsEnabled); + + /// Sets the `AreDevToolsEnabled` property. + + [propput] HRESULT AreDevToolsEnabled([in] BOOL areDevToolsEnabled); + + /// The `AreDefaultContextMenusEnabled` property is used to prevent default + /// context menus from being shown to user in WebView. + /// The default value is `TRUE`. + /// + /// \snippet SettingsComponent.cpp DisableContextMenu + + [propget] HRESULT AreDefaultContextMenusEnabled([out, retval] BOOL* enabled); + + /// Sets the `AreDefaultContextMenusEnabled` property. + + [propput] HRESULT AreDefaultContextMenusEnabled([in] BOOL enabled); + + /// The `AreHostObjectsAllowed` property is used to control whether host + /// objects are accessible from the page in WebView. + /// The default value is `TRUE`. + /// + /// \snippet SettingsComponent.cpp HostObjectsAccess + + [propget] HRESULT AreHostObjectsAllowed([out, retval] BOOL* allowed); + + /// Sets the `AreHostObjectsAllowed` property. + + [propput] HRESULT AreHostObjectsAllowed([in] BOOL allowed); + + /// The `IsZoomControlEnabled` property is used to prevent the user from + /// impacting the zoom of the WebView. When disabled, the user is not able + /// to zoom using Ctrl++, Ctrl+-, or Ctrl+mouse wheel, but the zoom + /// is set using `ZoomFactor` API. The default value is `TRUE`. + /// + /// \snippet SettingsComponent.cpp DisableZoomControl + + [propget] HRESULT IsZoomControlEnabled([out, retval] BOOL* enabled); + + /// Sets the `IsZoomControlEnabled` property. + + [propput] HRESULT IsZoomControlEnabled([in] BOOL enabled); + + /// The `IsBuiltInErrorPageEnabled` property is used to disable built in + /// error page for navigation failure and render process failure. When + /// disabled, a blank page is displayed when the related error happens. + /// The default value is `TRUE`. + /// + /// \snippet SettingsComponent.cpp BuiltInErrorPageEnabled + + [propget] HRESULT IsBuiltInErrorPageEnabled([out, retval] BOOL* enabled); + + /// Sets the `IsBuiltInErrorPageEnabled` property. + + [propput] HRESULT IsBuiltInErrorPageEnabled([in] BOOL enabled); +} + +/// A continuation of the ICoreWebView2Settings interface that manages the user agent. + +[uuid(ee9a0f68-f46c-4e32-ac23-ef8cac224d2a), object, pointer_default(unique)] +interface ICoreWebView2Settings2 : ICoreWebView2Settings { + /// Returns the User Agent. The default value is the default User Agent of the + /// Microsoft Edge browser. + /// + /// \snippet SettingsComponent.cpp UserAgent + [propget] HRESULT UserAgent([out, retval] LPWSTR* userAgent); + /// Sets the `UserAgent` property. This property may be overriden if + /// the User-Agent header is set in a request. If the parameter is empty + /// the User Agent will not be updated and the current User Agent will remain. + [propput] HRESULT UserAgent([in] LPCWSTR userAgent); +} + +/// A continuation of the ICoreWebView2Settings interface that manages whether +/// browser accelerator keys are enabled. +[uuid(fdb5ab74-af33-4854-84f0-0a631deb5eba), object, pointer_default(unique)] +interface ICoreWebView2Settings3 : ICoreWebView2Settings2 { + /// When this setting is set to FALSE, it disables all accelerator keys that + /// access features specific to a web browser, including but not limited to: + /// - Ctrl-F and F3 for Find on Page + /// - Ctrl-P for Print + /// - Ctrl-R and F5 for Reload + /// - Ctrl-Plus and Ctrl-Minus for zooming + /// - Ctrl-Shift-C and F12 for DevTools + /// - Special keys for browser functions, such as Back, Forward, and Search + /// + /// It does not disable accelerator keys related to movement and text editing, + /// such as: + /// - Home, End, Page Up, and Page Down + /// - Ctrl-X, Ctrl-C, Ctrl-V + /// - Ctrl-A for Select All + /// - Ctrl-Z for Undo + /// + /// Those accelerator keys will always be enabled unless they are handled in + /// the `AcceleratorKeyPressed` event. + /// + /// This setting has no effect on the `AcceleratorKeyPressed` event. The event + /// will be fired for all accelerator keys, whether they are enabled or not. + /// + /// The default value for `AreBrowserAcceleratorKeysEnabled` is TRUE. + /// + /// \snippet SettingsComponent.cpp AreBrowserAcceleratorKeysEnabled + [propget] HRESULT AreBrowserAcceleratorKeysEnabled( + [out, retval] BOOL* areBrowserAcceleratorKeysEnabled); + + /// Sets the `AreBrowserAcceleratorKeysEnabled` property. + [propput] HRESULT AreBrowserAcceleratorKeysEnabled( + [in] BOOL areBrowserAcceleratorKeysEnabled); +} + +/// A continuation of the ICoreWebView2Settings interface. +[uuid(cb56846c-4168-4d53-b04f-03b6d6796ff2), object, pointer_default(unique)] +interface ICoreWebView2Settings4 : ICoreWebView2Settings3 { + /// IsPasswordAutosaveEnabled controls whether autosave for password + /// information is enabled. The IsPasswordAutosaveEnabled property behaves + /// independently of the IsGeneralAutofillEnabled property. When IsPasswordAutosaveEnabled is + /// false, no new password data is saved and no Save/Update Password prompts are displayed. + /// However, if there was password data already saved before disabling this setting, + /// then that password information is auto-populated, suggestions are shown and clicking on + /// one will populate the fields. + /// When IsPasswordAutosaveEnabled is true, password information is auto-populated, + /// suggestions are shown and clicking on one will populate the fields, new data + /// is saved, and a Save/Update Password prompt is displayed. + /// The default value is `FALSE`. + /// + /// \snippet SettingsComponent.cpp PasswordAutosaveEnabled + [propget] HRESULT IsPasswordAutosaveEnabled([out, retval] BOOL* value); + /// Set the IsPasswordAutosaveEnabled property. + [propput] HRESULT IsPasswordAutosaveEnabled([in] BOOL value); + + /// IsGeneralAutofillEnabled controls whether autofill for information + /// like names, street and email addresses, phone numbers, and arbitrary input + /// is enabled. This excludes password and credit card information. When + /// IsGeneralAutofillEnabled is false, no suggestions appear, and no new information + /// is saved. When IsGeneralAutofillEnabled is true, information is saved, suggestions + /// appear and clicking on one will populate the form fields. + /// The default value is `TRUE`. + /// + /// \snippet SettingsComponent.cpp GeneralAutofillEnabled + [propget] HRESULT IsGeneralAutofillEnabled([out, retval] BOOL* value); + /// Set the IsGeneralAutofillEnabled property. + [propput] HRESULT IsGeneralAutofillEnabled([in] BOOL value); +} + +/// A continuation of the ICoreWebView2Settings interface. +[uuid(183e7052-1d03-43a0-ab99-98e043b66b39), object, pointer_default(unique)] +interface ICoreWebView2Settings5 : ICoreWebView2Settings4 { + /// Pinch-zoom, referred to as “Page Scale” zoom, is performed as a post-rendering step, + /// it changes the page scale factor property and scales the surface the web page is + /// rendered onto when user performs a pinch zooming action. It does not change the layout + /// but rather changes the viewport and clips the web content, the content outside of the + /// viewport isn't visible onscreen and users can't reach this content using mouse. + /// + /// The `IsPinchZoomEnabled` property enables or disables the ability of + /// the end user to use a pinching motion on touch input enabled devices + /// to scale the web content in the WebView2. It defaults to `TRUE`. + /// When set to `FALSE`, the end user cannot pinch zoom after the next navigation. + /// Disabling/Enabling `IsPinchZoomEnabled` only affects the end user's ability to use + /// pinch motions and does not change the page scale factor. + /// This API only affects the Page Scale zoom and has no effect on the + /// existing browser zoom properties (`IsZoomControlEnabled` and `ZoomFactor`) + /// or other end user mechanisms for zooming. + /// + /// \snippet SettingsComponent.cpp TogglePinchZoomEnabled + [propget] HRESULT IsPinchZoomEnabled([out, retval] BOOL* enabled); + /// Set the `IsPinchZoomEnabled` property + [propput] HRESULT IsPinchZoomEnabled([in] BOOL enabled); +} + +/// Event args for the `ProcessFailed` event. + +[uuid(8155a9a4-1474-4a86-8cae-151b0fa6b8ca), object, pointer_default(unique)] +interface ICoreWebView2ProcessFailedEventArgs : IUnknown { + + /// The kind of process failure that has occurred. `processFailedKind` is + /// `COREWEBVIEW2_PROCESS_FAILED_KIND_RENDER_PROCESS_EXITED` if the + /// failed process is the main frame's renderer, even if there were subframes + /// rendered by such process; all frames are gone when this happens. + + [propget] HRESULT ProcessFailedKind( + [out, retval] COREWEBVIEW2_PROCESS_FAILED_KIND* processFailedKind); +} + +/// Receives `ProcessFailed` events. + +[uuid(79e0aea4-990b-42d9-aa1d-0fcc2e5bc7f1), object, pointer_default(unique)] +interface ICoreWebView2ProcessFailedEventHandler : IUnknown { + + /// Provides the event args for the corresponding event. + + HRESULT Invoke( + [in] ICoreWebView2* sender, + [in] ICoreWebView2ProcessFailedEventArgs* args); +} + +/// Implements the interface to receive `ZoomFactorChanged` events. Use the +/// `ICoreWebView2Controller.ZoomFactor` property to get the modified zoom +/// factor. + +[uuid(b52d71d6-c4df-4543-a90c-64a3e60f38cb), object, pointer_default(unique)] +interface ICoreWebView2ZoomFactorChangedEventHandler : IUnknown { + + /// Provides the event args for the corresponding event. No event args exist + /// and the `args` parameter is set to `null`. + + HRESULT Invoke([in] ICoreWebView2Controller* sender, [in] IUnknown* args); +} + +/// Iterator for a collection of HTTP headers. For more information, navigate +/// to ICoreWebView2HttpRequestHeaders and ICoreWebView2HttpResponseHeaders. +/// +/// \snippet ScenarioWebViewEventMonitor.cpp HttpRequestHeaderIterator + +[uuid(0702fc30-f43b-47bb-ab52-a42cb552ad9f), object, pointer_default(unique)] +interface ICoreWebView2HttpHeadersCollectionIterator : IUnknown { + + /// Get the name and value of the current HTTP header of the iterator. If + /// the previous `MoveNext` operation set the `hasNext` parameter to `FALSE`, + /// this method fails. + + HRESULT GetCurrentHeader([out] LPWSTR* name, [out] LPWSTR* value); + + /// `TRUE` when the iterator has not run out of headers. If the collection + /// over which the iterator is iterating is empty or if the iterator has gone + /// past the end of the collection then this is `FALSE`. + + [propget] HRESULT HasCurrentHeader([out, retval] BOOL* hasCurrent); + + /// Move the iterator to the next HTTP header in the collection. + /// + /// > [!NOTE] + /// If no more HTTP headers exist, the `hasNext` parameter is set to + /// `FALSE`. After this occurs the `GetCurrentHeader` method fails. + + HRESULT MoveNext([out, retval] BOOL* hasNext); +} + +/// HTTP request headers. Used to inspect the HTTP request on +/// `WebResourceRequested` event and `NavigationStarting` event. +/// +/// > [!NOTE] +/// It is possible to modify the HTTP request from a `WebResourceRequested` +/// event, but not from a `NavigationStarting` event. + +[uuid(e86cac0e-5523-465c-b536-8fb9fc8c8c60), object, pointer_default(unique)] +interface ICoreWebView2HttpRequestHeaders : IUnknown { + + /// Gets the header value matching the name. + + HRESULT GetHeader([in] LPCWSTR name, [out, retval] LPWSTR* value); + + /// Gets the header value matching the name using an iterator. + + HRESULT GetHeaders([in] LPCWSTR name, [out, retval] ICoreWebView2HttpHeadersCollectionIterator** iterator); + + /// Verifies that the headers contain an entry that matches the header name. + + HRESULT Contains([in] LPCWSTR name, [out, retval] BOOL* contains); + + /// Adds or updates header that matches the name. + + HRESULT SetHeader([in] LPCWSTR name, [in] LPCWSTR value); + + /// Removes header that matches the name. + + HRESULT RemoveHeader([in] LPCWSTR name); + + /// Gets an iterator over the collection of request headers. + + HRESULT GetIterator( + [out, retval] ICoreWebView2HttpHeadersCollectionIterator** iterator); +} + +/// HTTP response headers. Used to construct a `WebResourceResponse` for the +/// `WebResourceRequested` event. + +[uuid(03c5ff5a-9b45-4a88-881c-89a9f328619c), object, pointer_default(unique)] +interface ICoreWebView2HttpResponseHeaders : IUnknown { + + /// Appends header line with name and value. + + HRESULT AppendHeader([in] LPCWSTR name, [in] LPCWSTR value); + + /// Verifies that the headers contain entries that match the header name. + + HRESULT Contains([in] LPCWSTR name, [out, retval] BOOL* contains); + + /// Gets the first header value in the collection matching the name. + + HRESULT GetHeader([in] LPCWSTR name, [out, retval] LPWSTR* value); + + /// Gets the header values matching the name. + + HRESULT GetHeaders([in] LPCWSTR name, [out, retval] ICoreWebView2HttpHeadersCollectionIterator** iterator); + + /// Gets an iterator over the collection of entire response headers. + + HRESULT GetIterator( + [out, retval] ICoreWebView2HttpHeadersCollectionIterator** iterator); +} + +/// An HTTP request used with the `WebResourceRequested` event. + +[uuid(97055cd4-512c-4264-8b5f-e3f446cea6a5), object, pointer_default(unique)] +interface ICoreWebView2WebResourceRequest : IUnknown { + + /// The request URI. + + [propget] HRESULT Uri([out, retval] LPWSTR* uri); + + /// Sets the `Uri` property. + + [propput] HRESULT Uri([in] LPCWSTR uri); + + /// The HTTP request method. + + [propget] HRESULT Method([out, retval] LPWSTR* method); + + /// Sets the `Method` property. + + [propput] HRESULT Method([in] LPCWSTR method); + + /// The HTTP request message body as stream. POST data should be here. If a + /// stream is set, which overrides the message body, the stream must have + /// all the content data available by the time the `WebResourceRequested` + /// event deferral of this response is completed. Stream should be agile or + /// be created from a background STA to prevent performance impact to the UI + /// thread. `Null` means no content data. `IStream` semantics apply + /// (return `S_OK` to `Read` runs until all data is exhausted). + + [propget] HRESULT Content([out, retval] IStream** content); + + /// Sets the `Content` property. + + [propput] HRESULT Content([in] IStream* content); + + /// The mutable HTTP request headers + + [propget] HRESULT Headers([out, retval] ICoreWebView2HttpRequestHeaders** headers); +} + +/// An HTTP response used with the `WebResourceRequested` event. + +[uuid(aafcc94f-fa27-48fd-97df-830ef75aaec9), object, pointer_default(unique)] +interface ICoreWebView2WebResourceResponse : IUnknown { + + /// HTTP response content as stream. Stream must have all the content data + /// available by the time the `WebResourceRequested` event deferral of this + /// response is completed. Stream should be agile or be created from a + /// background thread to prevent performance impact to the UI thread. `Null` + /// means no content data. `IStream` semantics apply (return `S_OK` to + /// `Read` runs until all data is exhausted). + + [propget] HRESULT Content([out, retval] IStream** content); + + /// Sets the `Content` property. + + [propput] HRESULT Content([in] IStream* content); + + /// Overridden HTTP response headers. + + [propget] HRESULT Headers([out, retval] ICoreWebView2HttpResponseHeaders** headers); + + /// The HTTP response status code. + + [propget] HRESULT StatusCode([out, retval] int* statusCode); + + /// Sets the `StatusCode` property. + + [propput] HRESULT StatusCode([in] int statusCode); + + /// The HTTP response reason phrase. + + [propget] HRESULT ReasonPhrase([out, retval] LPWSTR* reasonPhrase); + + /// Sets the `ReasonPhrase` property. + + [propput] HRESULT ReasonPhrase([in] LPCWSTR reasonPhrase); +} + +/// Event args for the `NavigationStarting` event. + +[uuid(5b495469-e119-438a-9b18-7604f25f2e49), object, pointer_default(unique)] +interface ICoreWebView2NavigationStartingEventArgs : IUnknown { + + /// The uri of the requested navigation. + + [propget] HRESULT Uri([out, retval] LPWSTR* uri); + + /// `TRUE` when the navigation was initiated through a user gesture as + /// opposed to programmatic navigation by page script. Navigations initiated + /// via WebView2 APIs are considered as user initiated. + + [propget] HRESULT IsUserInitiated([out, retval] BOOL* isUserInitiated); + + /// `TRUE` when the navigation is redirected. + + [propget] HRESULT IsRedirected([out, retval] BOOL* isRedirected); + + /// The HTTP request headers for the navigation. + /// + /// > [!NOTE] + /// You are not able to modify the HTTP request headers in a + /// `NavigationStarting` event. + + [propget] HRESULT RequestHeaders([out, retval] ICoreWebView2HttpRequestHeaders** requestHeaders); + + /// The host may set this flag to cancel the navigation. If set, the + /// navigation is not longer present and the content of the current page is + /// intact. For performance reasons, `GET` HTTP requests may happen, while + /// the host is responding. You may set cookies and use part of a request + /// for the navigation. Cancellation for navigation to `about:blank` or + /// frame navigation to `srcdoc` is not supported. Such attempts are + /// ignored. + + [propget] HRESULT Cancel([out, retval] BOOL* cancel); + + /// Sets the `Cancel` property. + + [propput] HRESULT Cancel([in] BOOL cancel); + + /// The ID of the navigation. + + [propget] HRESULT NavigationId([out, retval] UINT64* navigationId); +} + +/// Receives `NavigationStarting` events. + +[uuid(9adbe429-f36d-432b-9ddc-f8881fbd76e3), object, pointer_default(unique)] +interface ICoreWebView2NavigationStartingEventHandler : IUnknown { + + /// Provides the event args for the corresponding event. + + HRESULT Invoke( + [in] ICoreWebView2* sender, + [in] ICoreWebView2NavigationStartingEventArgs* args); +} + +/// Event args for the `ContentLoading` event. + +[uuid(0c8a1275-9b6b-4901-87ad-70df25bafa6e), object, pointer_default(unique)] +interface ICoreWebView2ContentLoadingEventArgs : IUnknown { + + /// `TRUE` if the loaded content is an error page. + + [propget] HRESULT IsErrorPage([out, retval] BOOL* isErrorPage); + + /// The ID of the navigation. + + [propget] HRESULT NavigationId([out, retval] UINT64* navigationId); +} + +/// Receives `ContentLoading` events. + +[uuid(364471e7-f2be-4910-bdba-d72077d51c4b), object, pointer_default(unique)] +interface ICoreWebView2ContentLoadingEventHandler : IUnknown { + + /// Provides the event args for the corresponding event. + + HRESULT Invoke([in] ICoreWebView2* sender, [in] ICoreWebView2ContentLoadingEventArgs* args); +} + +/// Event args for the `SourceChanged` event. + +[uuid(31e0e545-1dba-4266-8914-f63848a1f7d7), object, pointer_default(unique)] +interface ICoreWebView2SourceChangedEventArgs : IUnknown { + + /// `TRUE` if the page being navigated to is a new document. + + [propget] HRESULT IsNewDocument([out, retval] BOOL* isNewDocument); +} + +/// Receives `SourceChanged` events. + +[uuid(3c067f9f-5388-4772-8b48-79f7ef1ab37c), object, pointer_default(unique)] +interface ICoreWebView2SourceChangedEventHandler : IUnknown { + + /// Provides the event args for the corresponding event. + + HRESULT Invoke([in] ICoreWebView2* sender, [in] ICoreWebView2SourceChangedEventArgs* args); +} + +/// Receives `HistoryChanged` events. + +[uuid(c79a420c-efd9-4058-9295-3e8b4bcab645), object, pointer_default(unique)] +interface ICoreWebView2HistoryChangedEventHandler : IUnknown { + + /// Provides the event args for the corresponding event. No event args exist + /// and the `args` parameter is set to `null`. + + HRESULT Invoke([in] ICoreWebView2* sender, [in] IUnknown* args); +} + +/// Event args for the `ScriptDialogOpening` event. + +[uuid(7390bb70-abe0-4843-9529-f143b31b03d6), object, pointer_default(unique)] +interface ICoreWebView2ScriptDialogOpeningEventArgs : IUnknown { + + /// The URI of the page that requested the dialog box. + + [propget] HRESULT Uri([out, retval] LPWSTR* uri); + + /// The kind of JavaScript dialog box. `alert`, `confirm`, `prompt`, or + /// `beforeunload`. + + [propget] HRESULT Kind([out, retval] COREWEBVIEW2_SCRIPT_DIALOG_KIND* kind); + + /// The message of the dialog box. From JavaScript this is the first + /// parameter passed to `alert`, `confirm`, and `prompt` and is empty for + /// `beforeunload`. + + [propget] HRESULT Message([out, retval] LPWSTR* message); + + /// The host may run this to respond with **OK** to `confirm`, `prompt`, and + /// `beforeunload` dialogs. Do not run this method to indicate cancel. + /// From JavaScript, this means that the `confirm` and `beforeunload` function + /// returns `TRUE` if `Accept` is run. And for the prompt function it returns + /// the value of `ResultText` if `Accept` is run and otherwise returns + /// `FALSE`. + + HRESULT Accept(); + + /// The second parameter passed to the JavaScript prompt dialog. + /// The result of the prompt JavaScript function uses this value as the + /// default value. + + [propget] HRESULT DefaultText([out, retval] LPWSTR* defaultText); + + /// The return value from the JavaScript prompt function if `Accept` is run. + /// This value is ignored for dialog kinds other than prompt. If `Accept` + /// is not run, this value is ignored and `FALSE` is returned from prompt. + + [propget] HRESULT ResultText([out, retval] LPWSTR* resultText); + + /// Sets the `ResultText` property. + + [propput] HRESULT ResultText([in] LPCWSTR resultText); + + /// Returns an `ICoreWebView2Deferral` object. Use this operation to + /// complete the event at a later time. + + HRESULT GetDeferral([out, retval] ICoreWebView2Deferral** deferral); +} + +/// Receives `ScriptDialogOpening` events. + +[uuid(ef381bf9-afa8-4e37-91c4-8ac48524bdfb), object, pointer_default(unique)] +interface ICoreWebView2ScriptDialogOpeningEventHandler : IUnknown { + + /// Provides the event args for the corresponding event. + + HRESULT Invoke( + [in] ICoreWebView2* sender, + [in] ICoreWebView2ScriptDialogOpeningEventArgs* args); +} + +/// Event args for the `NavigationCompleted` event. + +[uuid(30d68b7d-20d9-4752-a9ca-ec8448fbb5c1), object, pointer_default(unique)] +interface ICoreWebView2NavigationCompletedEventArgs : IUnknown { + + /// `TRUE` when the navigation is successful. `FALSE` for a navigation that + /// ended up in an error page (failures due to no network, DNS lookup + /// failure, HTTP server responds with 4xx), but may also be `FALSE` for + /// additional scenarios such as `window.stop()` run on navigated page. + + [propget] HRESULT IsSuccess([out, retval] BOOL* isSuccess); + + /// The error code if the navigation failed. + + [propget] HRESULT WebErrorStatus([out, retval] COREWEBVIEW2_WEB_ERROR_STATUS* + webErrorStatus); + + /// The ID of the navigation. + + [propget] HRESULT NavigationId([out, retval] UINT64* navigationId); +} + +/// Receives `NavigationCompleted` events. + +[uuid(d33a35bf-1c49-4f98-93ab-006e0533fe1c), object, pointer_default(unique)] +interface ICoreWebView2NavigationCompletedEventHandler : IUnknown { + + /// Provides the event args for the corresponding event. + + HRESULT Invoke( + [in] ICoreWebView2* sender, + [in] ICoreWebView2NavigationCompletedEventArgs* args); +} + +/// Event args for the `PermissionRequested` event. + +[uuid(973ae2ef-ff18-4894-8fb2-3c758f046810), object, pointer_default(unique)] +interface ICoreWebView2PermissionRequestedEventArgs : IUnknown { + + /// The origin of the web content that requests the permission. + + [propget] HRESULT Uri([out, retval] LPWSTR* uri); + + /// The type of the permission that is requested. + + [propget] HRESULT PermissionKind([out, retval] COREWEBVIEW2_PERMISSION_KIND* permissionKind); + + /// `TRUE` when the permission request was initiated through a user gesture. + /// + /// > [!NOTE] + /// Being initiated through a user gesture does not mean that user intended + /// to access the associated resource. + + [propget] HRESULT IsUserInitiated([out, retval] BOOL* isUserInitiated); + + /// The status of a permission request, (for example is the request is granted). + /// The default value is `COREWEBVIEW2_PERMISSION_STATE_DEFAULT`. + + [propget] HRESULT State([out, retval] COREWEBVIEW2_PERMISSION_STATE* state); + + /// Sets the `State` property. + + [propput] HRESULT State([in] COREWEBVIEW2_PERMISSION_STATE state); + + /// Gets an `ICoreWebView2Deferral` object. Use the deferral object to make + /// the permission decision at a later time. + + HRESULT GetDeferral([out, retval] ICoreWebView2Deferral** deferral); +} + +/// Receives `PermissionRequested` events. + +[uuid(15e1c6a3-c72a-4df3-91d7-d097fbec6bfd), object, pointer_default(unique)] +interface ICoreWebView2PermissionRequestedEventHandler : IUnknown { + + /// Provides the event args for the corresponding event. + + HRESULT Invoke( + [in] ICoreWebView2* sender, + [in] ICoreWebView2PermissionRequestedEventArgs* args); +} + +/// Receives the result of the `AddScriptToExecuteOnDocumentCreated` method. + +[uuid(b99369f3-9b11-47b5-bc6f-8e7895fcea17), object, pointer_default(unique)] +interface ICoreWebView2AddScriptToExecuteOnDocumentCreatedCompletedHandler : IUnknown { + + /// Provide the completion status and result of the corresponding + /// asynchronous method. + + HRESULT Invoke([in] HRESULT errorCode, [in] LPCWSTR id); +} + +/// Receives the result of the `ExecuteScript` method. + +[uuid(49511172-cc67-4bca-9923-137112f4c4cc), object, pointer_default(unique)] +interface ICoreWebView2ExecuteScriptCompletedHandler : IUnknown { + + /// Provide the implementer with the completion status and result of the + /// corresponding asynchronous method. + + HRESULT Invoke([in] HRESULT errorCode, [in] LPCWSTR resultObjectAsJson); +} + +/// Event args for the `WebResourceRequested` event. + +[uuid(453e667f-12c7-49d4-be6d-ddbe7956f57a), object, pointer_default(unique)] +interface ICoreWebView2WebResourceRequestedEventArgs : IUnknown +{ + + /// The Web resource request. The request object may be missing some headers + /// that are added by network stack at a later time. + + [propget] HRESULT Request([out, retval] ICoreWebView2WebResourceRequest** request); + + /// A placeholder for the web resource response object. If this object is + /// set, the web resource request is completed with the specified response. + + [propget] HRESULT Response([out, retval] ICoreWebView2WebResourceResponse** response); + + /// Sets the `Response` property. Create an empty web resource response + /// object with `CreateWebResourceResponse` and then modify it to construct + /// the response. + + [propput] HRESULT Response([in] ICoreWebView2WebResourceResponse* response); + + /// Obtain an `ICoreWebView2Deferral` object and put the event into a + /// deferred state. Use the `ICoreWebView2Deferral` object to complete the + /// request at a later time. + + HRESULT GetDeferral([out, retval] ICoreWebView2Deferral** deferral); + + /// The web resource request context. + + [propget] HRESULT ResourceContext([out, retval] COREWEBVIEW2_WEB_RESOURCE_CONTEXT* context); +} + +/// Runs when a URL request (through network, file, and so on) is made in +/// the webview for a Web resource matching resource context filter and URL +/// specified in `AddWebResourceRequestedFilter`. The host views and modifies +/// the request or provide a response in a similar pattern to HTTP, in which +/// case the request immediately completed. This may not contain any request +/// headers that are added by the network stack, such as an `Authorization` +/// header. + +[uuid(ab00b74c-15f1-4646-80e8-e76341d25d71), object, pointer_default(unique)] +interface ICoreWebView2WebResourceRequestedEventHandler : IUnknown +{ + + /// Provides the event args for the corresponding event. + + HRESULT Invoke( + [in] ICoreWebView2* sender, + [in] ICoreWebView2WebResourceRequestedEventArgs* args); +} + +/// Receives the result of the `CapturePreview` method. The result is written +/// to the stream provided in the `CapturePreview` method. + +[uuid(697e05e9-3d8f-45fa-96f4-8ffe1ededaf5), object, pointer_default(unique)] +interface ICoreWebView2CapturePreviewCompletedHandler : IUnknown { + + /// Provides the completion status of the corresponding asynchronous method. + + HRESULT Invoke([in] HRESULT errorCode); +} + +/// Receives `GotFocus` and `LostFocus` events. + +[uuid(05ea24bd-6452-4926-9014-4b82b498135d), object, pointer_default(unique)] +interface ICoreWebView2FocusChangedEventHandler : IUnknown { + + /// Provides the event args for the corresponding event. No event args exist + /// and the `args` parameter is set to `null`. + + HRESULT Invoke( + [in] ICoreWebView2Controller* sender, + [in] IUnknown* args); +} + +/// Event args for the `MoveFocusRequested` event. + +[uuid(2d6aa13b-3839-4a15-92fc-d88b3c0d9c9d), object, pointer_default(unique)] +interface ICoreWebView2MoveFocusRequestedEventArgs : IUnknown { + + /// The reason for WebView to run the `MoveFocusRequested` event. + + [propget] HRESULT Reason([out, retval] COREWEBVIEW2_MOVE_FOCUS_REASON* reason); + + /// Indicates whether the event has been handled by the app. If the app has + /// moved the focus to another desired location, it should set the `Handled` + /// property to `TRUE`. When the `Handled` property is `FALSE` after the + /// event handler returns, default action is taken. The default action is to + /// try to find the next tab stop child window in the app and try to move + /// focus to that window. If no other window exists to move focus, focus is + /// cycled within the web content of the WebView. + + [propget] HRESULT Handled([out, retval] BOOL* value); + + /// Sets the `Handled` property. + + [propput] HRESULT Handled([in] BOOL value); +} + +/// Receives `MoveFocusRequested` events. + +[uuid(69035451-6dc7-4cb8-9bce-b2bd70ad289f), object, pointer_default(unique)] +interface ICoreWebView2MoveFocusRequestedEventHandler : IUnknown { + + /// Provides the event args for the corresponding event. + + HRESULT Invoke( + [in] ICoreWebView2Controller* sender, + [in] ICoreWebView2MoveFocusRequestedEventArgs* args); +} + +/// Event args for the `WebMessageReceived` event. + +[uuid(0f99a40c-e962-4207-9e92-e3d542eff849), object, pointer_default(unique)] +interface ICoreWebView2WebMessageReceivedEventArgs : IUnknown { + + /// The URI of the document that sent this web message. + + [propget] HRESULT Source([out, retval] LPWSTR* source); + + /// The message posted from the WebView content to the host converted to a + /// JSON string. Run this operation to communicate using JavaScript objects. + /// + /// For example, the following `postMessage` runs result in the following + /// `WebMessageAsJson` values. + /// + /// ```json + /// postMessage({'a': 'b'}) L"{\"a\": \"b\"}" + /// postMessage(1.2) L"1.2" + /// postMessage('example') L"\"example\"" + /// ``` + + [propget] HRESULT WebMessageAsJson([out, retval] LPWSTR* webMessageAsJson); + + /// If the message posted from the WebView content to the host is a string + /// type, this method returns the value of that string. If the message + /// posted is some other kind of JavaScript type this method fails with the + /// following error. + /// + /// ```text + /// E_INVALIDARG + /// ``` + /// + /// Run this operation to communicate using simple strings. + /// + /// For example, the following `postMessage` runs result in the following + /// `WebMessageAsString` values. + /// + /// ```json + /// postMessage({'a': 'b'}) E_INVALIDARG + /// postMessage(1.2) E_INVALIDARG + /// postMessage('example') L"example" + /// ``` + + HRESULT TryGetWebMessageAsString([out, retval] LPWSTR* webMessageAsString); +} + +/// Receives `WebMessageReceived` events. + +[uuid(57213f19-00e6-49fa-8e07-898ea01ecbd2), object, pointer_default(unique)] +interface ICoreWebView2WebMessageReceivedEventHandler : IUnknown { + + /// Provides the event args for the corresponding event. + + HRESULT Invoke( + [in] ICoreWebView2* sender, + [in] ICoreWebView2WebMessageReceivedEventArgs* args); +} + +/// Event args for the `DevToolsProtocolEventReceived` event. + +[uuid(653c2959-bb3a-4377-8632-b58ada4e66c4), object, pointer_default(unique)] +interface ICoreWebView2DevToolsProtocolEventReceivedEventArgs : IUnknown { + + /// The parameter object of the corresponding `DevToolsProtocol` event + /// represented as a JSON string. + + [propget] HRESULT ParameterObjectAsJson([out, retval] LPWSTR* + parameterObjectAsJson); +} + +/// Receives `DevToolsProtocolEventReceived` events from the WebView. + +[uuid(e2fda4be-5456-406c-a261-3d452138362c), object, pointer_default(unique)] +interface ICoreWebView2DevToolsProtocolEventReceivedEventHandler : IUnknown { + + /// Provides the event args for the corresponding event. + + HRESULT Invoke( + [in] ICoreWebView2* sender, + [in] ICoreWebView2DevToolsProtocolEventReceivedEventArgs* args); +} + +/// Receives `CallDevToolsProtocolMethod` completion results. + +[uuid(5c4889f0-5ef6-4c5a-952c-d8f1b92d0574), object, pointer_default(unique)] +interface ICoreWebView2CallDevToolsProtocolMethodCompletedHandler : IUnknown { + + /// Provides the completion status and result of the corresponding + /// asynchronous method. + + HRESULT Invoke([in] HRESULT errorCode, [in] LPCWSTR returnObjectAsJson); +} + +/// Receives the `CoreWebView2Controller` created using `CreateCoreWebView2Controller`. + +[uuid(6c4819f3-c9b7-4260-8127-c9f5bde7f68c), object, pointer_default(unique)] +interface ICoreWebView2CreateCoreWebView2ControllerCompletedHandler : IUnknown { + + /// Provides the completion status and result of the corresponding + /// asynchronous method. + + HRESULT Invoke(HRESULT errorCode, ICoreWebView2Controller* createdController); +} + +/// The caller implements this interface to receive the CoreWebView2Controller +/// created via CreateCoreWebView2CompositionController. +[uuid(02fab84b-1428-4fb7-ad45-1b2e64736184), object, pointer_default(unique)] +interface ICoreWebView2CreateCoreWebView2CompositionControllerCompletedHandler : IUnknown { + /// Called to provide the implementer with the completion status and result + /// of the corresponding asynchronous method call. + HRESULT Invoke( + HRESULT errorCode, + ICoreWebView2CompositionController* webView); +} + +/// Event args for the `NewWindowRequested` event. The event is run when +/// content inside webview requested to a open a new window (through +/// `window.open()` and so on). + +[uuid(34acb11c-fc37-4418-9132-f9c21d1eafb9), object, pointer_default(unique)] +interface ICoreWebView2NewWindowRequestedEventArgs : IUnknown +{ + + /// The target uri of the new window requested. + + [propget] HRESULT Uri([out, retval] LPWSTR* uri); + + /// Sets a CoreWebView2 as a result of the NewWindowRequested event. If the + /// `NewWindow` is set, the top-level window returns as the opened `WindowProxy`. + /// The NewWindow property should be set to a CoreWebView2 that has not been + /// navigated previously. Don't use methods that cause navigation or interact + /// with the DOM on this CoreWebView2. Setting event handlers, changing + /// Settings properties, or other methods are fine to call. Once the + /// NewWindowRequested event handler completes or its deferral completes, + /// the underlying web contents of this CoreWebView2 will be replaced and + /// navigated as appropriate for the new window. + /// + /// The methods which should affect the new web contents like + /// AddScriptToExecuteOnDocumentCreated and add_WebResourceRequested + /// have to be called after the deferral is completed. + + [propput] HRESULT NewWindow([in] ICoreWebView2* newWindow); + + /// Gets the new window. + + [propget] HRESULT NewWindow([out, retval] ICoreWebView2** newWindow); + + /// Sets whether the `NewWindowRequested` event is handled by host. If this + /// is `FALSE` and no `NewWindow` is set, the WebView opens a popup window + /// and it returns as opened `WindowProxy`. If set to `TRUE` and no + /// `NewWindow` is set for `window.open`, the opened `WindowProxy` is for an + /// testing window object and no window loads. + /// The default value is `FALSE`. + + [propput] HRESULT Handled([in] BOOL handled); + + /// Gets whether the `NewWindowRequested` event is handled by host. + + [propget] HRESULT Handled([out, retval] BOOL* handled); + + /// `TRUE` when the new window request was initiated through a user gesture + /// such as selecting an anchor tag with target. The Microsoft Edge popup + /// blocker is disabled for WebView so the app is able to use this flag to + /// block non-user initiated popups. + + [propget] HRESULT IsUserInitiated([out, retval] BOOL* isUserInitiated); + + /// Obtain an `ICoreWebView2Deferral` object and put the event into a + /// deferred state. Use the `ICoreWebView2Deferral` object to complete the + /// window open request at a later time. While this event is deferred the + /// opener window returns a `WindowProxy` to an un-navigated window, which + /// navigates when the deferral is complete. + + HRESULT GetDeferral([out, retval] ICoreWebView2Deferral** deferral); + + /// Window features specified by the `window.open`. The features should be + /// considered for positioning and sizing of new webview windows. + + [propget] HRESULT WindowFeatures([out, retval] ICoreWebView2WindowFeatures** value); +} + +/// The window features for a WebView popup window. The fields match the +/// `windowFeatures` passed to `window.open` as specified in +/// \[Window features\]\[MdnDocsWebApiWindowOpenWindowFeatures\] +/// on MDN. +/// There is no requirement for you to respect the values. If your app does +/// not have corresponding UI features (for example, no toolbar) or if all +/// instance of WebView are opened in tabs and do not have distinct size or +/// positions, then your app does not respect the values. You may want to +/// respect values, but perhaps only some apply to the UI of you app. +/// Accordingly, you may respect all, some, or none of the properties as +/// appropriate for your app. For all numeric properties, if the value that is +/// passed to `window.open` is outside the range of an unsigned 32bit int, the +/// resulting value is the absolute value of the maximum for unsigned 32bit +/// integer. If you are not able to parse the value an integer, it is +/// considered `0`. If the value is a floating point value, it is rounded down +/// to an integer. +/// +/// \[MdnDocsWebApiWindowOpenWindowFeatures\]: https://developer.mozilla.org/docs/Web/API/Window/open#Window_features "Window features - Window.open() | MDN" + +[uuid(5eaf559f-b46e-4397-8860-e422f287ff1e), object, pointer_default(unique)] +interface ICoreWebView2WindowFeatures : IUnknown +{ + + /// Specifies left and top values. + + [propget] HRESULT HasPosition([out, retval] BOOL* value); + + /// Specifiesheight and width values. + + [propget] HRESULT HasSize([out, retval] BOOL* value); + + /// Specifies the left position of the window. If `HasPosition` is set to + /// `FALSE`, this field is ignored. + + [propget] HRESULT Left([out, retval] UINT32* value); + + /// Specifies the top position of the window. If `HasPosition` is set to + /// `FALSE`, this field is ignored. + + [propget] HRESULT Top([out, retval] UINT32* value); + + /// Specifies the height of the window. Minimum value is `100`. If + /// `HasSize` is set to `FALSE`, this field is ignored. + + [propget] HRESULT Height([out, retval] UINT32* value); + + /// Specifies the width of the window. Minimum value is `100`. If `HasSize` + /// is set to `FALSE`, this field is ignored. + + [propget] HRESULT Width([out, retval] UINT32* value); + + /// Indicates that the menu bar is displayed. + + [propget] HRESULT ShouldDisplayMenuBar([out, retval] BOOL* value); + + /// Indicates that the status bar is displayed. + + [propget] HRESULT ShouldDisplayStatus([out, retval] BOOL* value); + + /// Indicates that the browser toolbar is displayed. + + [propget] HRESULT ShouldDisplayToolbar([out, retval] BOOL* value); + + /// Indicates that the scroll bars are displayed. + + [propget] HRESULT ShouldDisplayScrollBars([out, retval] BOOL* value); +} + +/// Receives `NewWindowRequested` events. + +[uuid(d4c185fe-c81c-4989-97af-2d3fa7ab5651), object, pointer_default(unique)] +interface ICoreWebView2NewWindowRequestedEventHandler : IUnknown { + + /// Provides the event args for the corresponding event. + + HRESULT Invoke( + [in] ICoreWebView2* sender, + [in] ICoreWebView2NewWindowRequestedEventArgs* args); +} + +/// Receives `DocumentTitleChanged` events. Use the `DocumentTitle` property +/// to get the modified title. + +[uuid(f5f2b923-953e-4042-9f95-f3a118e1afd4), object, pointer_default(unique)] +interface ICoreWebView2DocumentTitleChangedEventHandler : IUnknown { + + /// Provides the event args for the corresponding event. No event args exist + /// and the `args` parameter is set to `null`. + + HRESULT Invoke([in] ICoreWebView2* sender, [in] IUnknown* args); +} + +/// Event args for the `AcceleratorKeyPressed` event. + +[uuid(9f760f8a-fb79-42be-9990-7b56900fa9c7), object, pointer_default(unique)] +interface ICoreWebView2AcceleratorKeyPressedEventArgs : IUnknown { + + /// The key event type that caused the event to run. + + [propget] HRESULT KeyEventKind([out, retval] COREWEBVIEW2_KEY_EVENT_KIND* keyEventKind); + + /// The Win32 virtual key code of the key that was pressed or released. It + /// is one of the Win32 virtual key constants such as `VK_RETURN` or an + /// (uppercase) ASCII value such as `A`. Verify whether Ctrl or Alt + /// are pressed by running `GetKeyState(VK_CONTROL)` or + /// `GetKeyState(VK_MENU)`. + + [propget] HRESULT VirtualKey([out, retval] UINT* virtualKey); + + /// The `LPARAM` value that accompanied the window message. For more + /// information, navigate to + /// \[WM_KEYDOWN\]\[WindowsWin32InputdevWmKeydown\] + /// and + /// \[WM_KEYUP\]\[WindowsWin32InputdevWmKeyup\]. + /// + /// \[WindowsWin32InputdevWmKeydown\]: /windows/win32/inputdev/wm-keydown "WM_KEYDOWN message | Microsoft Docs" + /// + /// \[WindowsWin32InputdevWmKeyup\]: /windows/win32/inputdev/wm-keyup "WM_KEYUP message | Microsoft Docs" + + [propget] HRESULT KeyEventLParam([out, retval] INT* lParam); + + /// A structure representing the information passed in the `LPARAM` of the + /// window message. + + [propget] HRESULT PhysicalKeyStatus( + [out, retval] COREWEBVIEW2_PHYSICAL_KEY_STATUS* physicalKeyStatus); + + /// During `AcceleratorKeyPressedEvent` handler invocation the WebView is + /// blocked waiting for the decision of if the accelerator is handled by the + /// host (or not). If the `Handled` property is set to `TRUE` then this + /// prevents the WebView from performing the default action for this + /// accelerator key. Otherwise the WebView performs the default action for + /// the accelerator key. + + [propget] HRESULT Handled([out, retval] BOOL* handled); + + /// Sets the `Handled` property. + + [propput] HRESULT Handled([in] BOOL handled); +} + +/// Receives `AcceleratorKeyPressed` events. + +[uuid(b29c7e28-fa79-41a8-8e44-65811c76dcb2), object, pointer_default(unique)] +interface ICoreWebView2AcceleratorKeyPressedEventHandler : IUnknown { + + /// Provides the event args for the corresponding event. + + HRESULT Invoke( + [in] ICoreWebView2Controller* sender, + [in] ICoreWebView2AcceleratorKeyPressedEventArgs* args); +} + +/// Receives `NewBrowserVersionAvailable` events. + +[uuid(f9a2976e-d34e-44fc-adee-81b6b57ca914), object, pointer_default(unique)] +interface ICoreWebView2NewBrowserVersionAvailableEventHandler : IUnknown { + + /// Provides the event args for the corresponding event. + + HRESULT Invoke([in] ICoreWebView2Environment* sender, + [in] IUnknown* args); +} + +/// Receives `ContainsFullScreenElementChanged` events. + +[uuid(e45d98b1-afef-45be-8baf-6c7728867f73), object, pointer_default(unique)] +interface ICoreWebView2ContainsFullScreenElementChangedEventHandler : IUnknown { + + /// Provides the event args for the corresponding event. No event args exist + /// and the `args` parameter is set to `null`. + + HRESULT Invoke([in] ICoreWebView2* sender, [in] IUnknown* args); +} + +/// Receives `WindowCloseRequested` events. + +[uuid(5c19e9e0-092f-486b-affa-ca8231913039), object, pointer_default(unique)] +interface ICoreWebView2WindowCloseRequestedEventHandler : IUnknown { + + /// Provides the event args for the corresponding event. No event args exist + /// and the `args` parameter is set to `null`. + + HRESULT Invoke([in] ICoreWebView2* sender, [in] IUnknown* args); +} + +/// Receives `WebResourceResponseReceived` events. +[uuid(7DE9898A-24F5-40C3-A2DE-D4F458E69828), object, pointer_default(unique)] +interface ICoreWebView2WebResourceResponseReceivedEventHandler : IUnknown { + /// Provides the event args for the corresponding event. + HRESULT Invoke( + [in] ICoreWebView2* sender, + [in] ICoreWebView2WebResourceResponseReceivedEventArgs* args); +} + +/// Event args for the WebResourceResponseReceived event. +[uuid(D1DB483D-6796-4B8B-80FC-13712BB716F4), object, pointer_default(unique)] +interface ICoreWebView2WebResourceResponseReceivedEventArgs : IUnknown { + /// The request object for the web resource, as committed. This includes + /// headers added by the network stack that were not be included during the + /// associated WebResourceRequested event, such as Authentication headers. + /// Modifications to this object have no effect on how the request is + /// processed as it has already been sent. + [propget] HRESULT Request([out, retval] ICoreWebView2WebResourceRequest** request); + /// View of the response object received for the web resource. + [propget] HRESULT Response([out, retval] ICoreWebView2WebResourceResponseView** response); +} + +/// View of the HTTP representation for a web resource response. The properties +/// of this object are not mutable. This response view is used with the +/// WebResourceResponseReceived event. +[uuid(79701053-7759-4162-8F7D-F1B3F084928D), object, pointer_default(unique)] +interface ICoreWebView2WebResourceResponseView : IUnknown +{ + /// The HTTP response headers as received. + [propget] HRESULT Headers( + [out, retval] ICoreWebView2HttpResponseHeaders** headers); + /// The HTTP response status code. + [propget] HRESULT StatusCode([out, retval] int* statusCode); + /// The HTTP response reason phrase. + [propget] HRESULT ReasonPhrase([out, retval] LPWSTR* reasonPhrase); + + /// Get the response content asynchronously. The handler will receive the + /// response content stream. + /// If this method is being called again before a first call has completed, + /// the handler will be invoked at the same time the handlers from prior calls + /// are invoked. + /// If this method is being called after a first call has completed, the + /// handler will be invoked immediately. + /// \snippet ScenarioWebViewEventMonitor.cpp GetContent + HRESULT GetContent( + [in] ICoreWebView2WebResourceResponseViewGetContentCompletedHandler* handler); +} + +/// Receives the result of the +/// `ICoreWebView2WebResourceResponseView::GetContent` method. +[uuid(875738E1-9FA2-40E3-8B74-2E8972DD6FE7), object, pointer_default(unique)] +interface ICoreWebView2WebResourceResponseViewGetContentCompletedHandler : IUnknown +{ + /// Provides the completion status and result of the corresponding + /// asynchronous method call. A failure `errorCode` will be passed if the + /// content failed to load. `E_ABORT` means the response loading was blocked + /// (e.g., by CORS policy); `ERROR_CANCELLED` means the response loading was + /// cancelled. `ERROR_NO_DATA` means the response has no content data, + /// `content` is `null` in this case. Note content (if any) is ignored for + /// redirects, 204 No Content, 205 Reset Content, and HEAD-request responses. + HRESULT Invoke([in] HRESULT errorCode, [in] IStream* content); +} + +/// Event args for the DOMContentLoaded event. +[uuid(16B1E21A-C503-44F2-84C9-70ABA5031283), object, pointer_default(unique)] +interface ICoreWebView2DOMContentLoadedEventArgs : IUnknown { + /// The ID of the navigation which corresponds to other navigation ID properties on other navigation events. + [propget] HRESULT NavigationId([out, retval] UINT64* navigationId); +} + +/// Receives `DOMContentLoaded` events. +[uuid(4BAC7E9C-199E-49ED-87ED-249303ACF019), object, pointer_default(unique)] +interface ICoreWebView2DOMContentLoadedEventHandler : IUnknown { + /// Provides the event args for the corresponding event. + HRESULT Invoke( + [in] ICoreWebView2* sender, + [in] ICoreWebView2DOMContentLoadedEventArgs* args); +} + +/// Provides a set of properties that are used to manage an +/// ICoreWebView2Cookie. +/// +/// \snippet ScenarioCookieManagement.cpp CookieObject +[uuid(AD26D6BE-1486-43E6-BF87-A2034006CA21), object, pointer_default(unique)] +interface ICoreWebView2Cookie : IUnknown { + /// Cookie name. + [propget] HRESULT Name([out, retval] LPWSTR* name); + + /// Cookie value. + [propget] HRESULT Value([out, retval] LPWSTR* value); + /// Set the cookie value property. + [propput] HRESULT Value([in] LPCWSTR value); + + /// The domain for which the cookie is valid. + /// The default is the host that this cookie has been received from. + /// Note that, for instance, ".bing.com", "bing.com", and "www.bing.com" are + /// considered different domains. + [propget] HRESULT Domain([out, retval] LPWSTR* domain); + + /// The path for which the cookie is valid. The default is "/", which means + /// this cookie will be sent to all pages on the Domain. + [propget] HRESULT Path([out, retval] LPWSTR* path); + + /// The expiration date and time for the cookie as the number of seconds since the UNIX epoch. + /// The default is -1.0, which means cookies are session cookies by default. + [propget] HRESULT Expires([out, retval] double* expires); + /// Set the Expires property. Cookies are session cookies and will not be + /// persistent if Expires is set to -1.0. NaN, infinity, and any negative + /// value set other than -1.0 is disallowed. + [propput] HRESULT Expires([in] double expires); + + /// Whether this cookie is http-only. + /// True if a page script or other active content cannot access this + /// cookie. The default is false. + [propget] HRESULT IsHttpOnly([out, retval] BOOL* isHttpOnly); + /// Set the IsHttpOnly property. + [propput] HRESULT IsHttpOnly([in] BOOL isHttpOnly); + + /// SameSite status of the cookie which represents the enforcement mode of the cookie. + /// The default is COREWEBVIEW2_COOKIE_SAME_SITE_KIND_LAX. + [propget] HRESULT SameSite([out, retval] COREWEBVIEW2_COOKIE_SAME_SITE_KIND* sameSite); + /// Set the SameSite property. + [propput] HRESULT SameSite([in] COREWEBVIEW2_COOKIE_SAME_SITE_KIND sameSite); + + /// The security level of this cookie. True if the client is only to return + /// the cookie in subsequent requests if those requests use HTTPS. + /// The default is false. + /// Note that cookie that requests COREWEBVIEW2_COOKIE_SAME_SITE_KIND_NONE but + /// is not marked Secure will be rejected. + [propget] HRESULT IsSecure([out, retval] BOOL* isSecure); + /// Set the IsSecure property. + [propput] HRESULT IsSecure([in] BOOL isSecure); + + /// Whether this is a session cookie. The default is false. + [propget] HRESULT IsSession([out, retval] BOOL* isSession); +} + +/// Creates, adds or updates, gets, or or view the cookies. The changes would +/// apply to the context of the user profile. That is, other WebViews under the +/// same user profile could be affected. +[uuid(177CD9E7-B6F5-451A-94A0-5D7A3A4C4141), object, pointer_default(unique)] +interface ICoreWebView2CookieManager : IUnknown { + /// Create a cookie object with a specified name, value, domain, and path. + /// One can set other optional properties after cookie creation. + /// This only creates a cookie object and it is not added to the cookie + /// manager until you call AddOrUpdateCookie. + /// Leading or trailing whitespace(s), empty string, and special characters + /// are not allowed for name. + /// See ICoreWebView2Cookie for more details. + HRESULT CreateCookie( + [in] LPCWSTR name, + [in] LPCWSTR value, + [in] LPCWSTR domain, + [in] LPCWSTR path, + [out, retval] ICoreWebView2Cookie** cookie); + + /// Creates a cookie whose params matches those of the specified cookie. + HRESULT CopyCookie( + [in] ICoreWebView2Cookie* cookieParam, + [out, retval] ICoreWebView2Cookie** cookie); + + /// Gets a list of cookies matching the specific URI. + /// If uri is empty string or null, all cookies under the same profile are + /// returned. + /// You can modify the cookie objects by calling + /// ICoreWebView2CookieManager::AddOrUpdateCookie, and the changes + /// will be applied to the webview. + /// \snippet ScenarioCookieManagement.cpp GetCookies + HRESULT GetCookies( + [in] LPCWSTR uri, + [in] ICoreWebView2GetCookiesCompletedHandler* handler); + + /// Adds or updates a cookie with the given cookie data; may overwrite + /// cookies with matching name, domain, and path if they exist. + /// This method will fail if the domain of the given cookie is not specified. + /// \snippet ScenarioCookieManagement.cpp AddOrUpdateCookie + HRESULT AddOrUpdateCookie([in] ICoreWebView2Cookie* cookie); + + /// Deletes a cookie whose name and domain/path pair + /// match those of the specified cookie. + HRESULT DeleteCookie([in] ICoreWebView2Cookie* cookie); + + /// Deletes cookies with matching name and uri. + /// Cookie name is required. + /// All cookies with the given name where domain + /// and path match provided URI are deleted. + HRESULT DeleteCookies([in] LPCWSTR name, [in] LPCWSTR uri); + + /// Deletes cookies with matching name and domain/path pair. + /// Cookie name is required. + /// If domain is specified, deletes only cookies with the exact domain. + /// If path is specified, deletes only cookies with the exact path. + HRESULT DeleteCookiesWithDomainAndPath([in] LPCWSTR name, [in] LPCWSTR domain, [in] LPCWSTR path); + + /// Deletes all cookies under the same profile. + /// This could affect other WebViews under the same user profile. + HRESULT DeleteAllCookies(); +} + +/// A list of cookie objects. See `ICoreWebView2Cookie`. +/// \snippet ScenarioCookieManagement.cpp GetCookies +[uuid(F7F6F714-5D2A-43C6-9503-346ECE02D186), object, pointer_default(unique)] +interface ICoreWebView2CookieList : IUnknown { + /// The number of cookies contained in the ICoreWebView2CookieList. + [propget] HRESULT Count([out, retval] UINT* count); + + /// Gets the cookie object at the given index. + HRESULT GetValueAtIndex([in] UINT index, [out, retval] ICoreWebView2Cookie** cookie); +} + +/// Receives the result of the `GetCookies` method. The result is written to +/// the cookie list provided in the `GetCookies` method call. +[uuid(5A4F5069-5C15-47C3-8646-F4DE1C116670), object, pointer_default(unique)] +interface ICoreWebView2GetCookiesCompletedHandler : IUnknown { + /// Provides the completion status of the corresponding asynchronous method + /// call. + HRESULT Invoke(HRESULT result, ICoreWebView2CookieList* cookieList); +} + +/// This mostly represents a combined win32 +/// POINTER_INFO/POINTER_TOUCH_INFO/POINTER_PEN_INFO object. It takes fields +/// from all three and excludes some win32 specific data types like HWND and +/// HANDLE. Note, sourceDevice is taken out but we expect the PointerDeviceRect +/// and DisplayRect to cover the existing use cases of sourceDevice. +/// Another big difference is that any of the point or rect locations are +/// expected to be in WebView physical coordinates. That is, coordinates +/// relative to the WebView and no DPI scaling applied. +// +// The PointerId, PointerFlags, ButtonChangeKind, PenFlags, PenMask, TouchFlags, +// and TouchMask are all #defined flags or enums in the +// POINTER_INFO/POINTER_TOUCH_INFO/POINTER_PEN_INFO structure. We define those +// properties here as UINT32 or INT32 and expect the developer to know how to +// populate those values based on the Windows definitions. +[uuid(e6995887-d10d-4f5d-9359-4ce46e4f96b9), object, pointer_default(unique)] +interface ICoreWebView2PointerInfo : IUnknown { + /// Get the PointerKind of the pointer event. This corresponds to the + /// pointerKind property of the POINTER_INFO struct. The values are defined by + /// the POINTER_INPUT_KIND enum in the Windows SDK (winuser.h). Supports + /// PT_PEN and PT_TOUCH. + [propget] HRESULT PointerKind([out, retval] DWORD* pointerKind); + /// Set the PointerKind of the pointer event. This corresponds to the + /// pointerKind property of the POINTER_INFO struct. The values are defined by + /// the POINTER_INPUT_KIND enum in the Windows SDK (winuser.h). Supports + /// PT_PEN and PT_TOUCH. + [propput] HRESULT PointerKind([in] DWORD pointerKind); + + /// Get the PointerId of the pointer event. This corresponds to the pointerId + /// property of the POINTER_INFO struct as defined in the Windows SDK + /// (winuser.h). + [propget] HRESULT PointerId([out, retval] UINT32* pointerId); + /// Set the PointerId of the pointer event. This corresponds to the pointerId + /// property of the POINTER_INFO struct as defined in the Windows SDK + /// (winuser.h). + [propput] HRESULT PointerId([in] UINT32 pointerId); + + /// Get the FrameID of the pointer event. This corresponds to the frameId + /// property of the POINTER_INFO struct as defined in the Windows SDK + /// (winuser.h). + [propget] HRESULT FrameId([out, retval] UINT32* frameId); + /// Set the FrameID of the pointer event. This corresponds to the frameId + /// property of the POINTER_INFO struct as defined in the Windows SDK + /// (winuser.h). + [propput] HRESULT FrameId([in] UINT32 frameId); + + /// Get the PointerFlags of the pointer event. This corresponds to the + /// pointerFlags property of the POINTER_INFO struct. The values are defined + /// by the POINTER_FLAGS constants in the Windows SDK (winuser.h). + [propget] HRESULT PointerFlags([out, retval] UINT32* pointerFlags); + /// Set the PointerFlags of the pointer event. This corresponds to the + /// pointerFlags property of the POINTER_INFO struct. The values are defined + /// by the POINTER_FLAGS constants in the Windows SDK (winuser.h). + [propput] HRESULT PointerFlags([in] UINT32 pointerFlags); + + /// Get the PointerDeviceRect of the sourceDevice property of the + /// POINTER_INFO struct as defined in the Windows SDK (winuser.h). + [propget] HRESULT PointerDeviceRect([out, retval] RECT* pointerDeviceRect); + /// Set the PointerDeviceRect of the sourceDevice property of the + /// POINTER_INFO struct as defined in the Windows SDK (winuser.h). + [propput] HRESULT PointerDeviceRect([in] RECT pointerDeviceRect); + + /// Get the DisplayRect of the sourceDevice property of the POINTER_INFO + /// struct as defined in the Windows SDK (winuser.h). + [propget] HRESULT DisplayRect([out, retval] RECT* displayRect); + /// Set the DisplayRect of the sourceDevice property of the POINTER_INFO + /// struct as defined in the Windows SDK (winuser.h). + [propput] HRESULT DisplayRect([in] RECT displayRect); + + /// Get the PixelLocation of the pointer event. This corresponds to the + /// ptPixelLocation property of the POINTER_INFO struct as defined in the + /// Windows SDK (winuser.h). + [propget] HRESULT PixelLocation([out, retval] POINT* pixelLocation); + /// Set the PixelLocation of the pointer event. This corresponds to the + /// ptPixelLocation property of the POINTER_INFO struct as defined in the + /// Windows SDK (winuser.h). + [propput] HRESULT PixelLocation([in] POINT pixelLocation); + + /// Get the HimetricLocation of the pointer event. This corresponds to the + /// ptHimetricLocation property of the POINTER_INFO struct as defined in the + /// Windows SDK (winuser.h). + [propget] HRESULT HimetricLocation([out, retval] POINT* himetricLocation); + /// Set the HimetricLocation of the pointer event. This corresponds to the + /// ptHimetricLocation property of the POINTER_INFO struct as defined in the + /// Windows SDK (winuser.h). + [propput] HRESULT HimetricLocation([in] POINT himetricLocation); + + /// Get the PixelLocationRaw of the pointer event. This corresponds to the + /// ptPixelLocationRaw property of the POINTER_INFO struct as defined in the + /// Windows SDK (winuser.h). + [propget] HRESULT PixelLocationRaw([out, retval] POINT* pixelLocationRaw); + /// Set the PixelLocationRaw of the pointer event. This corresponds to the + /// ptPixelLocationRaw property of the POINTER_INFO struct as defined in the + /// Windows SDK (winuser.h). + [propput] HRESULT PixelLocationRaw([in] POINT pixelLocationRaw); + + /// Get the HimetricLocationRaw of the pointer event. This corresponds to the + /// ptHimetricLocationRaw property of the POINTER_INFO struct as defined in + /// the Windows SDK (winuser.h). + [propget] HRESULT HimetricLocationRaw([out, retval] POINT* himetricLocationRaw); + /// Set the HimetricLocationRaw of the pointer event. This corresponds to the + /// ptHimetricLocationRaw property of the POINTER_INFO struct as defined in + /// the Windows SDK (winuser.h). + [propput] HRESULT HimetricLocationRaw([in] POINT himetricLocationRaw); + + /// Get the Time of the pointer event. This corresponds to the dwTime property + /// of the POINTER_INFO struct as defined in the Windows SDK (winuser.h). + [propget] HRESULT Time([out, retval] DWORD* time); + /// Set the Time of the pointer event. This corresponds to the dwTime property + /// of the POINTER_INFO struct as defined in the Windows SDK (winuser.h). + [propput] HRESULT Time([in] DWORD time); + + /// Get the HistoryCount of the pointer event. This corresponds to the + /// historyCount property of the POINTER_INFO struct as defined in the Windows + /// SDK (winuser.h). + [propget] HRESULT HistoryCount([out, retval] UINT32* historyCount); + /// Set the HistoryCount of the pointer event. This corresponds to the + /// historyCount property of the POINTER_INFO struct as defined in the Windows + /// SDK (winuser.h). + [propput] HRESULT HistoryCount([in] UINT32 historyCount); + + /// Get the InputData of the pointer event. This corresponds to the InputData + /// property of the POINTER_INFO struct as defined in the Windows SDK + /// (winuser.h). + [propget] HRESULT InputData([out, retval] INT32* inputData); + /// Set the InputData of the pointer event. This corresponds to the InputData + /// property of the POINTER_INFO struct as defined in the Windows SDK + /// (winuser.h). + [propput] HRESULT InputData([in] INT32 inputData); + + /// Get the KeyStates of the pointer event. This corresponds to the + /// dwKeyStates property of the POINTER_INFO struct as defined in the Windows + /// SDK (winuser.h). + [propget] HRESULT KeyStates([out, retval] DWORD* keyStates); + /// Set the KeyStates of the pointer event. This corresponds to the + /// dwKeyStates property of the POINTER_INFO struct as defined in the Windows + /// SDK (winuser.h). + [propput] HRESULT KeyStates([in] DWORD keyStates); + + /// Get the PerformanceCount of the pointer event. This corresponds to the + /// PerformanceCount property of the POINTER_INFO struct as defined in the + /// Windows SDK (winuser.h). + [propget] HRESULT PerformanceCount([out, retval] UINT64* performanceCount); + /// Set the PerformanceCount of the pointer event. This corresponds to the + /// PerformanceCount property of the POINTER_INFO struct as defined in the + /// Windows SDK (winuser.h). + [propput] HRESULT PerformanceCount([in] UINT64 performanceCount); + + /// Get the ButtonChangeKind of the pointer event. This corresponds to the + /// ButtonChangeKind property of the POINTER_INFO struct. The values are + /// defined by the POINTER_BUTTON_CHANGE_KIND enum in the Windows SDK + /// (winuser.h). + [propget] HRESULT ButtonChangeKind([out, retval] INT32* buttonChangeKind); + /// Set the ButtonChangeKind of the pointer event. This corresponds to the + /// ButtonChangeKind property of the POINTER_INFO struct. The values are + /// defined by the POINTER_BUTTON_CHANGE_KIND enum in the Windows SDK + /// (winuser.h). + [propput] HRESULT ButtonChangeKind([in] INT32 buttonChangeKind); + + // Pen specific attributes + + /// Get the PenFlags of the pointer event. This corresponds to the penFlags + /// property of the POINTER_PEN_INFO struct. The values are defined by the + /// PEN_FLAGS constants in the Windows SDK (winuser.h). + [propget] HRESULT PenFlags([out, retval] UINT32* penFLags); + /// Set the PenFlags of the pointer event. This corresponds to the penFlags + /// property of the POINTER_PEN_INFO struct. The values are defined by the + /// PEN_FLAGS constants in the Windows SDK (winuser.h). + [propput] HRESULT PenFlags([in] UINT32 penFLags); + + /// Get the PenMask of the pointer event. This corresponds to the penMask + /// property of the POINTER_PEN_INFO struct. The values are defined by the + /// PEN_MASK constants in the Windows SDK (winuser.h). + [propget] HRESULT PenMask([out, retval] UINT32* penMask); + /// Set the PenMask of the pointer event. This corresponds to the penMask + /// property of the POINTER_PEN_INFO struct. The values are defined by the + /// PEN_MASK constants in the Windows SDK (winuser.h). + [propput] HRESULT PenMask([in] UINT32 penMask); + + /// Get the PenPressure of the pointer event. This corresponds to the pressure + /// property of the POINTER_PEN_INFO struct as defined in the Windows SDK + /// (winuser.h). + [propget] HRESULT PenPressure([out, retval] UINT32* penPressure); + /// Set the PenPressure of the pointer event. This corresponds to the pressure + /// property of the POINTER_PEN_INFO struct as defined in the Windows SDK + /// (winuser.h). + [propput] HRESULT PenPressure([in] UINT32 penPressure); + + /// Get the PenRotation of the pointer event. This corresponds to the rotation + /// property of the POINTER_PEN_INFO struct as defined in the Windows SDK + /// (winuser.h). + [propget] HRESULT PenRotation([out, retval] UINT32* penRotation); + /// Set the PenRotation of the pointer event. This corresponds to the rotation + /// property of the POINTER_PEN_INFO struct as defined in the Windows SDK + /// (winuser.h). + [propput] HRESULT PenRotation([in] UINT32 penRotation); + + /// Get the PenTiltX of the pointer event. This corresponds to the tiltX + /// property of the POINTER_PEN_INFO struct as defined in the Windows SDK + /// (winuser.h). + [propget] HRESULT PenTiltX([out, retval] INT32* penTiltX); + /// Set the PenTiltX of the pointer event. This corresponds to the tiltX + /// property of the POINTER_PEN_INFO struct as defined in the Windows SDK + /// (winuser.h). + [propput] HRESULT PenTiltX([in] INT32 penTiltX); + + /// Get the PenTiltY of the pointer event. This corresponds to the tiltY + /// property of the POINTER_PEN_INFO struct as defined in the Windows SDK + /// (winuser.h). + [propget] HRESULT PenTiltY([out, retval] INT32* penTiltY); + /// Set the PenTiltY of the pointer event. This corresponds to the tiltY + /// property of the POINTER_PEN_INFO struct as defined in the Windows SDK + /// (winuser.h). + [propput] HRESULT PenTiltY([in] INT32 penTiltY); + + // Touch specific attributes + + /// Get the TouchFlags of the pointer event. This corresponds to the + /// touchFlags property of the POINTER_TOUCH_INFO struct. The values are + /// defined by the TOUCH_FLAGS constants in the Windows SDK (winuser.h). + [propget] HRESULT TouchFlags([out, retval] UINT32* touchFlags); + /// Set the TouchFlags of the pointer event. This corresponds to the + /// touchFlags property of the POINTER_TOUCH_INFO struct. The values are + /// defined by the TOUCH_FLAGS constants in the Windows SDK (winuser.h). + [propput] HRESULT TouchFlags([in] UINT32 touchFlags); + + /// Get the TouchMask of the pointer event. This corresponds to the + /// touchMask property of the POINTER_TOUCH_INFO struct. The values are + /// defined by the TOUCH_MASK constants in the Windows SDK (winuser.h). + [propget] HRESULT TouchMask([out, retval] UINT32* touchMask); + /// Set the TouchMask of the pointer event. This corresponds to the + /// touchMask property of the POINTER_TOUCH_INFO struct. The values are + /// defined by the TOUCH_MASK constants in the Windows SDK (winuser.h). + [propput] HRESULT TouchMask([in] UINT32 touchMask); + + /// Get the TouchContact of the pointer event. This corresponds to the + /// rcContact property of the POINTER_TOUCH_INFO struct as defined in the + /// Windows SDK (winuser.h). + [propget] HRESULT TouchContact([out, retval] RECT* touchContact); + /// Set the TouchContact of the pointer event. This corresponds to the + /// rcContact property of the POINTER_TOUCH_INFO struct as defined in the + /// Windows SDK (winuser.h). + [propput] HRESULT TouchContact([in] RECT touchContact); + + /// Get the TouchContactRaw of the pointer event. This corresponds to the + /// rcContactRaw property of the POINTER_TOUCH_INFO struct as defined in the + /// Windows SDK (winuser.h). + [propget] HRESULT TouchContactRaw([out, retval] RECT* touchContactRaw); + /// Set the TouchContactRaw of the pointer event. This corresponds to the + /// rcContactRaw property of the POINTER_TOUCH_INFO struct as defined in the + /// Windows SDK (winuser.h). + [propput] HRESULT TouchContactRaw([in] RECT touchContactRaw); + + /// Get the TouchOrientation of the pointer event. This corresponds to the + /// orientation property of the POINTER_TOUCH_INFO struct as defined in the + /// Windows SDK (winuser.h). + [propget] HRESULT TouchOrientation([out, retval] UINT32* touchOrientation); + /// Set the TouchOrientation of the pointer event. This corresponds to the + /// orientation property of the POINTER_TOUCH_INFO struct as defined in the + /// Windows SDK (winuser.h). + [propput] HRESULT TouchOrientation([in] UINT32 touchOrientation); + + /// Get the TouchPressure of the pointer event. This corresponds to the + /// pressure property of the POINTER_TOUCH_INFO struct as defined in the + /// Windows SDK (winuser.h). + [propget] HRESULT TouchPressure([out, retval] UINT32* touchPressure); + /// Set the TouchPressure of the pointer event. This corresponds to the + /// pressure property of the POINTER_TOUCH_INFO struct as defined in the + /// Windows SDK (winuser.h). + [propput] HRESULT TouchPressure([in] UINT32 touchPressure); +} + +/// The caller implements this interface to receive CursorChanged events. Use +/// the Cursor property to get the new cursor. +[uuid(9da43ccc-26e1-4dad-b56c-d8961c94c571), object, pointer_default(unique)] +interface ICoreWebView2CursorChangedEventHandler : IUnknown { + /// Called to provide the implementer with the event args for the + /// corresponding event. There are no event args and the args + /// parameter will be null. + HRESULT Invoke([in] ICoreWebView2CompositionController* sender, [in] IUnknown* args); +} + +/// Receives `RasterizationScaleChanged` events. Use the `RasterizationScale` +/// property to get the modified scale. + +[uuid(9c98c8b1-ac53-427e-a345-3049b5524bbe), object, pointer_default(unique)] +interface ICoreWebView2RasterizationScaleChangedEventHandler : IUnknown { + /// Called to provide the implementer with the event args for the + /// corresponding event. There are no event args and the args + /// parameter will be null. + HRESULT Invoke( + [in] ICoreWebView2Controller* sender, + [in] IUnknown* args); +} + +/// Represents the WebView2 Environment. WebViews created from an environment +/// run on the browser process specified with environment parameters and +/// objects created from an environment should be used in the same +/// environment. Using it in different environments are not guaranteed to be +/// compatible and may fail. + +[uuid(b96d755e-0319-4e92-a296-23436f46a1fc), object, pointer_default(unique)] +interface ICoreWebView2Environment : IUnknown { + + /// Asynchronously create a new WebView. + /// + /// `parentWindow` is the `HWND` in which the WebView should be displayed and + /// from which receive input. The WebView adds a child window to the + /// provided window during WebView creation. Z-order and other things + /// impacted by sibling window order are affected accordingly. + /// + /// It is recommended that the app set Application User Model ID for the + /// process or the app window. If none is set, during WebView creation a + /// generated Application User Model ID is set to root window of + /// `parentWindow`. + /// + /// \snippet AppWindow.cpp CreateCoreWebView2Controller + /// + /// It is recommended that the app handles restart manager messages, to + /// gracefully restart it in the case when the app is using the WebView2 + /// Runtime from a certain installation and that installation is being + /// uninstalled. For example, if a user installs a version of the WebView2 + /// Runtime and opts to use another version of the WebView2 Runtime for + /// testing the app, and then uninstalls the 1st version of the WebView2 + /// Runtime without closing the app, the app restarts to allow + /// un-installation to succeed. + /// + /// \snippet AppWindow.cpp RestartManager + /// + /// When the app retries `CreateCoreWebView2Controller` upon failure, it is + /// recommended that the app restarts from creating a new WebView2 + /// Environment. If an WebView2 Runtime update happens, the version + /// associated with a WebView2 Environment may have been removed and causing + /// the object to no longer work. Creating a new WebView2 Environment works + /// since it uses the latest version. + /// + /// WebView creation fails if a running instance using the same user data + /// folder exists, and the Environment objects have different + /// `EnvironmentOptions`. For example, if a WebView was created with one + /// language, an attempt to create a WebView with a different language using + /// the same user data folder fails. + + HRESULT CreateCoreWebView2Controller( + HWND parentWindow, + ICoreWebView2CreateCoreWebView2ControllerCompletedHandler* handler); + + /// Create a new web resource response object. The `headers` parameter is + /// the raw response header string delimited by newline. It is also possible + /// to create this object with null headers string and then use the + /// `ICoreWebView2HttpResponseHeaders` to construct the headers line by line. + /// For more information about other parameters, navigate to + /// \[ICoreWebView2WebResourceResponse\]\[MicrosoftEdgeWebview2ReferenceWin32Icorewebview2webresourceresponse\]. + /// + /// \snippet SettingsComponent.cpp WebResourceRequested0 + /// \snippet SettingsComponent.cpp WebResourceRequested1 + /// + /// \[MicrosoftEdgeWebview2ReferenceWin32Icorewebview2webresourceresponse\]: /microsoft-edge/webview2/reference/win32/icorewebview2webresourceresponse "interface ICoreWebView2WebResourceResponse | Microsoft Docs" + + HRESULT CreateWebResourceResponse( + [in] IStream* content, + [in] int statusCode, + [in] LPCWSTR reasonPhrase, + [in] LPCWSTR headers, + [out, retval] ICoreWebView2WebResourceResponse** response); + + /// The browser version info of the current `ICoreWebView2Environment`, + /// including channel name if it is not the WebView2 Runtime. It matches the + /// format of the `GetAvailableCoreWebView2BrowserVersionString` API. + /// Channel names are `beta`, `dev`, and `canary`. + /// + /// \snippet AppWindow.cpp GetBrowserVersionString + + [propget] HRESULT BrowserVersionString([out, retval] LPWSTR* versionInfo); + + /// Add an event handler for the `NewBrowserVersionAvailable` event. + /// `NewBrowserVersionAvailable` runs when a newer version of the WebView2 + /// Runtime is installed and available using WebView2. To use the newer + /// version of the browser you must create a new environment and WebView. + /// The event only runs for new version from the same WebView2 Runtime from + /// which the code is running. When not running with installed WebView2 + /// Runtime, no event is run. + /// + /// Because a user data folder is only able to be used by one browser + /// process at a time, if you want to use the same user data folder in the + /// WebView using the new version of the browser, you must close the + /// environment and instance of WebView that are using the older version of + /// the browser first. Or simply prompt the user to restart the app. + /// + /// \snippet AppWindow.cpp NewBrowserVersionAvailable + + HRESULT add_NewBrowserVersionAvailable( + [in] ICoreWebView2NewBrowserVersionAvailableEventHandler* eventHandler, + [out] EventRegistrationToken* token); + + /// Remove an event handler previously added with `add_NewBrowserVersionAvailable`. + + HRESULT remove_NewBrowserVersionAvailable( + [in] EventRegistrationToken token); +} + +/// A continuation of the ICoreWebView2Environment interface. +[uuid(41F3632B-5EF4-404F-AD82-2D606C5A9A21), object, pointer_default(unique)] +interface ICoreWebView2Environment2 : ICoreWebView2Environment { + /// Create a new web resource request object. + /// URI parameter must be absolute URI. + /// The headers string is the raw request header string delimited by CRLF + /// (optional in last header). + /// It's also possible to create this object with null headers string + /// and then use the ICoreWebView2HttpRequestHeaders to construct the headers + /// line by line. + /// For information on other parameters see ICoreWebView2WebResourceRequest. + /// + /// \snippet ScenarioNavigateWithWebResourceRequest.cpp NavigateWithWebResourceRequest + HRESULT CreateWebResourceRequest([in] LPCWSTR uri, + [in] LPCWSTR method, + [in] IStream* postData, + [in] LPCWSTR headers, + [out, retval] ICoreWebView2WebResourceRequest** request); +} + +/// A continuation of the ICoreWebView2Environment2 interface. +[uuid(80a22ae3-be7c-4ce2-afe1-5a50056cdeeb), object, pointer_default(unique)] +interface ICoreWebView2Environment3 : ICoreWebView2Environment2 { + /// Asynchronously create a new WebView for use with visual hosting. + /// + /// parentWindow is the HWND in which the app will connect the visual tree of + /// the WebView. This will be the HWND that the app will receive pointer/ + /// mouse input meant for the WebView (and will need to use SendMouseInput/ + /// SendPointerInput to forward). If the app moves the WebView visual tree to + /// underneath a different window, then it needs to call put_ParentWindow to + /// update the new parent HWND of the visual tree. + /// + /// Use put_RootVisualTarget on the created CoreWebView2CompositionController to + /// provide a visual to host the browser's visual tree. + /// + /// It is recommended that the application set Application User Model ID for + /// the process or the application window. If none is set, during WebView + /// creation a generated Application User Model ID is set to root window of + /// parentWindow. + /// \snippet AppWindow.cpp CreateCoreWebView2Controller + /// + /// It is recommended that the application handles restart manager messages + /// so that it can be restarted gracefully in the case when the app is using + /// Edge for WebView from a certain installation and that installation is + /// being uninstalled. For example, if a user installs Edge from Dev channel + /// and opts to use Edge from that channel for testing the app, and then + /// uninstalls Edge from that channel without closing the app, the app will + /// be restarted to allow uninstallation of the dev channel to succeed. + /// \snippet AppWindow.cpp RestartManager + HRESULT CreateCoreWebView2CompositionController( + HWND parentWindow, + ICoreWebView2CreateCoreWebView2CompositionControllerCompletedHandler* handler); + + /// Create an empty ICoreWebView2PointerInfo. The returned + /// ICoreWebView2PointerInfo needs to be populated with all of the relevant + /// info before calling SendPointerInput. + HRESULT CreateCoreWebView2PointerInfo( + [out, retval] ICoreWebView2PointerInfo** pointerInfo); +} + +/// A continuation of the ICoreWebView2Environment3 interface. +[uuid(20944379-6dcf-41d6-a0a0-abc0fc50de0d), object, pointer_default(unique)] +interface ICoreWebView2Environment4 : ICoreWebView2Environment3 { + /// Returns the UI Automation Provider for the + /// ICoreWebView2CompositionController that corresponds with the given HWND. + HRESULT GetProviderForHwnd([in] HWND hwnd, + [out, retval] IUnknown** provider); +} + +/// Options used to create WebView2 Environment. A default implementation is +/// provided in `WebView2EnvironmentOptions.h`. +/// +/// \snippet AppWindow.cpp CreateCoreWebView2EnvironmentWithOptions + +[uuid(2fde08a8-1e9a-4766-8c05-95a9ceb9d1c5), object, pointer_default(unique)] +interface ICoreWebView2EnvironmentOptions : IUnknown { + + /// Changes the behavior of the WebView. The arguments are passed to the + /// browser process as part of the command. For more information about + /// using command-line switches with Chromium browser processes, navigate to + /// \[Run Chromium with Flags\]\[ChromiumDevelopersHowTosRunWithFlags\]. + /// The value appended to a switch is appended to the browser process, for + /// example, in `--edge-webview-switches=xxx` the value is `xxx`. If you + /// specify a switch that is important to WebView functionality, it is + /// ignored, for example, `--user-data-dir`. Specific features are disabled + /// internally and blocked from being enabled. If a switch is specified + /// multiple times, only the last instance is used. + /// + /// > [!NOTE] + /// A merge of the different values of the same switch is not attempted, + /// except for disabled and enabled features. The features specified by + /// `--enable-features` and `--disable-features` are merged with simple + /// logic.\n> * The features is the union of the specified features + /// and built-in features. If a feature is disabled, it is removed from the + /// enabled features list. + /// + /// If you specify command-line switches and use the + /// `additionalBrowserArguments` parameter, the `--edge-webview-switches` + /// value takes precedence and is processed last. If a switch fails to + /// parse, the switched is ignored. The default state for the operation is + /// to run the browser process with no extra flags. + /// + /// + /// \[ChromiumDevelopersHowTosRunWithFlags\]: https://www.chromium.org/developers/how-tos/run-chromium-with-flags "Run Chromium with flags | The Chromium Projects" + + [propget] HRESULT AdditionalBrowserArguments([out, retval] LPWSTR* value); + + /// Sets the `AdditionalBrowserArguments` property. + + [propput] HRESULT AdditionalBrowserArguments([in] LPCWSTR value); + + /// The default display language for WebView. It applies to browser UI such as + /// context menu and dialogs. It also applies to the `accept-languages` HTTP + /// header that WebView sends to websites. It is in the format of + /// `language[-country]` where `language` is the 2-letter code from + /// + /// \[ISO 639\]\[ISO639LanguageCodesHtml\] + /// and `country` is the + /// 2-letter code from + /// \[ISO 3166\]\[ISOStandard72482Html\]. + /// + /// \[ISO639LanguageCodesHtml\]: https://www.iso.org/iso-639-language-codes.html "ISO 639 | ISO" + /// + /// \[ISOStandard72482Html\]: https://www.iso.org/standard/72482.html "ISO 3166-1:2020 | ISO" + + [propget] HRESULT Language([out, retval] LPWSTR* value); + + /// Sets the `Language` property. + + [propput] HRESULT Language([in] LPCWSTR value); + + /// Specifies the version of the WebView2 Runtime binaries required to be + /// compatible with your app. This defaults to the WebView2 Runtime version + /// that corresponds with the version of the SDK the app is using. The + /// format of this value is the same as the format of the + /// `BrowserVersionString` property and other `BrowserVersion` values. Only + /// the version part of the `BrowserVersion` value is respected. The channel + /// suffix, if it exists, is ignored. The version of the WebView2 Runtime + /// binaries actually used may be different from the specified + /// `TargetCompatibleBrowserVersion`. The binaries are only guaranteed to be + /// compatible. Verify the actual version on the `BrowserVersionString` + /// property on the `ICoreWebView2Environment`. + + [propget] HRESULT TargetCompatibleBrowserVersion([out, retval] LPWSTR* value); + + /// Sets the `TargetCompatibleBrowserVersion` property. + + [propput] HRESULT TargetCompatibleBrowserVersion([in] LPCWSTR value); + + /// The `AllowSingleSignOnUsingOSPrimaryAccount` property is used to enable + /// single sign on with Azure Active Directory (AAD) and personal Microsoft + /// Account (MSA) resources inside WebView. All AAD accounts, connected to + /// Windows and shared for all apps, are supported. For MSA, SSO is only enabled + /// for the account associated for Windows account login, if any. + /// Default is disabled. Universal Windows Platform apps must also declare + /// `enterpriseCloudSSO` + /// \[Restricted capabilities\]\[WindowsUwpPackagingAppCapabilityDeclarationsRestrictedCapabilities\] + /// for the single sign on (SSO) to work. + /// + /// \[WindowsUwpPackagingAppCapabilityDeclarationsRestrictedCapabilities\]: /windows/uwp/packaging/app-capability-declarations#restricted-capabilities "Restricted capabilities - App capability declarations | Microsoft Docs" + + [propget] HRESULT AllowSingleSignOnUsingOSPrimaryAccount([out, retval] BOOL* allow); + + /// Sets the `AllowSingleSignOnUsingOSPrimaryAccount` property. + + [propput] HRESULT AllowSingleSignOnUsingOSPrimaryAccount([in] BOOL allow); +} + +/// Receives the `WebView2Environment` created using +/// `CreateCoreWebView2Environment`. + +[uuid(4e8a3389-c9d8-4bd2-b6b5-124fee6cc14d), object, pointer_default(unique)] +interface ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler : IUnknown { + + /// Provides the completion status and result of the corresponding + /// asynchronous method. + + HRESULT Invoke(HRESULT errorCode, ICoreWebView2Environment* createdEnvironment); +} + +/// A Receiver is created for a particular DevTools Protocol event and allows +/// you to subscribe and unsubscribe from that event. Obtained from the +/// WebView object using `GetDevToolsProtocolEventReceiver`. + +[uuid(b32ca51a-8371-45e9-9317-af021d080367), object, pointer_default(unique)] +interface ICoreWebView2DevToolsProtocolEventReceiver : IUnknown { + + /// Subscribe to a `DevToolsProtocol` event. The `Invoke` method of the + /// `handler` runs whenever the corresponding `DevToolsProtocol` event runs. + /// `Invoke` runs with an event args object containing the parameter object + /// of the DevTools Protocol event as a JSON string. + /// + /// \snippet ScriptComponent.cpp DevToolsProtocolEventReceived + + HRESULT add_DevToolsProtocolEventReceived( + [in] ICoreWebView2DevToolsProtocolEventReceivedEventHandler* handler, + [out] EventRegistrationToken* token); + + /// Remove an event handler previously added with + /// `add_DevToolsProtocolEventReceived`. + + HRESULT remove_DevToolsProtocolEventReceived( + [in] EventRegistrationToken token); + +} + +/// WebView2Frame provides direct access to the iframes information. +[uuid(f1131a5e-9ba9-11eb-a8b3-0242ac130003), object, pointer_default(unique)] +interface ICoreWebView2Frame : IUnknown { + /// The name of the iframe from the iframe html tag declaring it. + /// Calling this method fails if it is called after the iframe is destroyed. + [propget] HRESULT Name([ out, retval ] LPWSTR * name); + /// Raised when the iframe changes its window.name property. + HRESULT add_NameChanged( + [in] ICoreWebView2FrameNameChangedEventHandler * eventHandler, + [out] EventRegistrationToken * token); + /// Remove an event handler previously added with add_NameChanged. + HRESULT remove_NameChanged([in] EventRegistrationToken token); + + /// Add the provided host object to script running in the iframe with the + /// specified name for the list of the specified origins. The host object + /// will be accessible for this iframe only if the iframe's origin during + /// access matches one of the origins which are passed. The provided origins + /// will be normalized before comparing to the origin of the document. + /// So the scheme name is made lower case, the host will be punycode decoded + /// as appropriate, default port values will be removed, and so on. + /// This means the origin's host may be punycode encoded or not and will match + /// regardless. If list contains malformed origin the call will fail. + /// The method can be called multiple times in a row without calling + /// RemoveHostObjectFromScript for the same object name. It will replace + /// the previous object with the new object and new list of origins. + /// List of origins will be treated as following: + /// 1. empty list - call will succeed and object will be added for the iframe + /// but it will not be exposed to any origin; + /// 2. list with origins - during access to host object from iframe the + /// origin will be checked that it belongs to this list; + /// 3. list with "*" element - host object will be available for iframe for + /// all origins. We suggest not to use this feature without understanding + /// security implications of giving access to host object from from iframes + /// with unknown origins. + /// Calling this method fails if it is called after the iframe is destroyed. + /// \snippet ScenarioAddHostObject.cpp AddHostObjectToScriptWithOrigins + /// For more information about host objects navigate to + /// [AddHostObjectToScript] + HRESULT AddHostObjectToScriptWithOrigins( + [in] LPCWSTR name, + [in] VARIANT * object, + [in] UINT32 originsCount, + [ in, size_is(originsCount) ] LPCWSTR * origins); + /// Remove the host object specified by the name so that it is no longer + /// accessible from JavaScript code in the iframe. While new access + /// attempts are denied, if the object is already obtained by JavaScript code + /// in the iframe, the JavaScript code continues to have access to that + /// object. Calling this method for a name that is already removed or was + /// never added fails. If the iframe is destroyed this method will return fail + /// also. + HRESULT RemoveHostObjectFromScript([in] LPCWSTR name); + + /// The Destroyed event is raised when the iframe corresponding + /// to this CoreWebView2Frame object is removed or the document + /// containing that iframe is destroyed. + HRESULT add_Destroyed( + [in] ICoreWebView2FrameDestroyedEventHandler * eventHandler, + [out] EventRegistrationToken * token); + /// Remove an event handler previously added with add_Destroyed. + HRESULT remove_Destroyed([in] EventRegistrationToken token); + /// Check whether a frame is destroyed. Returns true during + /// the Destroyed event. + HRESULT IsDestroyed([ out, retval ] BOOL * destroyed); +} + +/// Receives `FrameCreated` event. +[uuid(38059770-9baa-11eb-a8b3-0242ac130003), object, pointer_default(unique)] +interface ICoreWebView2FrameCreatedEventHandler : IUnknown { + /// Provides the result for the iframe created event. + HRESULT Invoke([in] ICoreWebView2 * sender, + [in] ICoreWebView2FrameCreatedEventArgs * args); +} + +/// Receives `FrameNameChanged` event. +[uuid(435c7dc8-9baa-11eb-a8b3-0242ac130003), object, pointer_default(unique)] +interface ICoreWebView2FrameNameChangedEventHandler : IUnknown { + /// Provides the result for the iframe name changed event. + /// No event args exist and the `args` parameter is set to `null`. + HRESULT Invoke([in] ICoreWebView2Frame * sender, [in] IUnknown * args); +} + +/// Event args for the `FrameCreated` events. +[uuid(4d6e7b5e-9baa-11eb-a8b3-0242ac130003), object, pointer_default(unique)] +interface ICoreWebView2FrameCreatedEventArgs : IUnknown { + /// The frame which was created. + [propget] HRESULT Frame([ out, retval ] ICoreWebView2Frame **frame); +} + +/// Receives `FrameDestroyed` event. +[uuid(59dd7b4c-9baa-11eb-a8b3-0242ac130003), object, pointer_default(unique)] +interface ICoreWebView2FrameDestroyedEventHandler : IUnknown { + /// Provides the result for the iframe destroyed event. + /// No event args exist and the `args` parameter is set to `null`. + HRESULT Invoke([in] ICoreWebView2Frame * sender, [in] IUnknown * args); +} + +/// Add an event handler for the `DownloadStarting` event. +[uuid(efedc989-c396-41ca-83f7-07f845a55724), object, pointer_default(unique)] +interface ICoreWebView2DownloadStartingEventHandler : IUnknown +{ + /// Provides the event args for the corresponding event. + HRESULT Invoke( + [in] ICoreWebView2* sender, + [in] ICoreWebView2DownloadStartingEventArgs* args); +} + +/// Event args for the `DownloadStarting` event. +[uuid(e99bbe21-43e9-4544-a732-282764eafa60), object, pointer_default(unique)] +interface ICoreWebView2DownloadStartingEventArgs : IUnknown +{ + /// Returns the `ICoreWebView2DownloadOperation` for the download that + /// has started. + [propget] HRESULT DownloadOperation( + [out, retval] ICoreWebView2DownloadOperation** downloadOperation); + + /// The host may set this flag to cancel the download. If canceled, the + /// download save dialog is not displayed regardless of the + /// `Handled` property. + [propget] HRESULT Cancel([out, retval] BOOL* cancel); + + /// Sets the `Cancel` property. + [propput] HRESULT Cancel([in] BOOL cancel); + + /// The path to the file. If setting the path, the host should ensure that it + /// is an absolute path, including the file name, and that the path does not + /// point to an existing file. If the path points to an existing file, the + /// file will be overwritten. If the directory does not exist, it is created. + [propget] HRESULT ResultFilePath([out, retval] LPWSTR* resultFilePath); + + /// Sets the `ResultFilePath` property. + [propput] HRESULT ResultFilePath([in] LPCWSTR resultFilePath); + + /// The host may set this flag to `TRUE` to hide the default download dialog + /// for this download. The download will progress as normal if it is not + /// canceled, there will just be no default UI shown. By default the value is + /// `FALSE` and the default download dialog is shown. + [propget] HRESULT Handled([out, retval] BOOL* handled); + + /// Sets the `Handled` property. + [propput] HRESULT Handled([in] BOOL handled); + + /// Returns an `ICoreWebView2Deferral` object. Use this operation to + /// complete the event at a later time. + HRESULT GetDeferral([out, retval] ICoreWebView2Deferral** deferral); +} + +/// Implements the interface to receive `BytesReceivedChanged` event. Use the +/// `ICoreWebView2DownloadOperation.BytesReceived` property to get the received +/// bytes count. +[uuid(828e8ab6-d94c-4264-9cef-5217170d6251), object, pointer_default(unique)] +interface ICoreWebView2BytesReceivedChangedEventHandler : IUnknown +{ + /// Provides the event args for the corresponding event. No event args exist + /// and the `args` parameter is set to `null`. + HRESULT Invoke( + [in] ICoreWebView2DownloadOperation* sender, [in] IUnknown* args); +} + +/// Implements the interface to receive `EstimatedEndTimeChanged` event. Use the +/// `ICoreWebView2DownloadOperation.EstimatedEndTime` property to get the new +/// estimated end time. +[uuid(28f0d425-93fe-4e63-9f8d-2aeec6d3ba1e), object, pointer_default(unique)] +interface ICoreWebView2EstimatedEndTimeChangedEventHandler : IUnknown +{ + /// Provides the event args for the corresponding event. No event args exist + /// and the `args` parameter is set to `null`. + HRESULT Invoke( + [in] ICoreWebView2DownloadOperation* sender, [in] IUnknown* args); +} + +/// Implements the interface to receive `StateChanged` event. Use the +/// `ICoreWebView2DownloadOperation.State` property to get the current state, +/// which can be in progress, interrupted, or completed. Use the +/// `ICoreWebView2DownloadOperation.InterruptReason` property to get the +/// interrupt reason if the download is interrupted. +[uuid(81336594-7ede-4ba9-bf71-acf0a95b58dd), object, pointer_default(unique)] +interface ICoreWebView2StateChangedEventHandler : IUnknown +{ + /// Provides the event args for the corresponding event. No event args exist + /// and the `args` parameter is set to `null`. + HRESULT Invoke( + [in] ICoreWebView2DownloadOperation* sender, [in] IUnknown* args); +} + +/// Represents a download operation. Gives access to the download's metadata +/// and supports a user canceling, pausing, or resuming the download. +[uuid(3d6b6cf2-afe1-44c7-a995-c65117714336), object, pointer_default(unique)] +interface ICoreWebView2DownloadOperation : IUnknown +{ + /// Add an event handler for the `BytesReceivedChanged` event. + /// + /// \snippet ScenarioCustomDownloadExperience.cpp BytesReceivedChanged + HRESULT add_BytesReceivedChanged( + [in] ICoreWebView2BytesReceivedChangedEventHandler* eventHandler, + [out] EventRegistrationToken* token); + + /// Remove an event handler previously added with `add_BytesReceivedChanged`. + HRESULT remove_BytesReceivedChanged( + [in] EventRegistrationToken token); + + /// Add an event handler for the `EstimatedEndTimeChanged` event. + HRESULT add_EstimatedEndTimeChanged( + [in] ICoreWebView2EstimatedEndTimeChangedEventHandler* eventHandler, + [out] EventRegistrationToken* token); + + /// Remove an event handler previously added with `add_EstimatedEndTimeChanged`. + HRESULT remove_EstimatedEndTimeChanged( + [in] EventRegistrationToken token); + + /// Add an event handler for the `StateChanged` event. + /// + /// \snippet ScenarioCustomDownloadExperience.cpp StateChanged + HRESULT add_StateChanged( + [in] ICoreWebView2StateChangedEventHandler* eventHandler, + [out] EventRegistrationToken* token); + + /// Remove an event handler previously added with `add_StateChanged`. + HRESULT remove_StateChanged( + [in] EventRegistrationToken token); + + /// The URI of the download. + [propget] HRESULT Uri([out, retval] LPWSTR* uri); + + /// The Content-Disposition header value from the download's HTTP response. + [propget] HRESULT ContentDisposition([out, retval] LPWSTR* contentDisposition); + + /// MIME type of the downloaded content. + [propget] HRESULT MimeType([out, retval] LPWSTR* mimeType); + + /// The expected size of the download in total number of bytes based on the + /// HTTP Content-Length header. Returns -1 if the size is unknown. + [propget] HRESULT TotalBytesToReceive([out, retval] INT64* totalBytesToReceive); + + /// The number of bytes that have been written to the download file. + [propget] HRESULT BytesReceived([out, retval] INT64* bytesReceived); + + /// The estimated end time in [ISO 8601 Date and Time Format](https://www.iso.org/iso-8601-date-and-time-format.html). + [propget] HRESULT EstimatedEndTime([out, retval] LPWSTR* estimatedEndTime); + + /// The absolute path to the download file, including file name. Host can change + /// this from `ICoreWebView2DownloadStartingEventArgs`. + [propget] HRESULT ResultFilePath([out, retval] LPWSTR* resultFilePath); + + /// The state of the download. A download can be in progress, interrupted, or + /// completed. See `COREWEBVIEW2_DOWNLOAD_STATE` for descriptions of states. + [propget] HRESULT State([out, retval] COREWEBVIEW2_DOWNLOAD_STATE* downloadState); + + /// The reason why connection with file host was broken. + [propget] HRESULT InterruptReason( + [out, retval] COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON* interruptReason); + + /// Cancels the download. If canceled, the default download dialog shows + /// that the download was canceled. Host should set the `Cancel` property from + /// `ICoreWebView2SDownloadStartingEventArgs` if the download should be + /// canceled without displaying the default download dialog. + HRESULT Cancel(); + + /// Pauses the download. If paused, the default download dialog shows that the + /// download is paused. No effect if download is already paused. Pausing a + /// download changes the state to `COREWEBVIEW2_DOWNLOAD_STATE_INTERRUPTED` + /// with `InterruptReason` set to `COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_USER_PAUSED`. + HRESULT Pause(); + + /// Resumes a paused download. May also resume a download that was interrupted + /// for another reason, if `CanResume` returns true. Resuming a download changes + /// the state from `COREWEBVIEW2_DOWNLOAD_STATE_INTERRUPTED` to + /// `COREWEBVIEW2_DOWNLOAD_STATE_IN_PROGRESS`. + HRESULT Resume(); + + /// Returns true if an interrupted download can be resumed. Downloads with + /// the following interrupt reasons may automatically resume without you + /// calling any methods: + /// `COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE`, + /// `COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_FILE_HASH_MISMATCH`, + /// `COREWEBVIEW2_DOWNLOAD_INTERRUPT_REASON_FILE_TOO_SHORT`. + /// In these cases download progress may be restarted with `BytesReceived` + /// reset to 0. + [propget] HRESULT CanResume([out, retval] BOOL* canResume); +} + +/// A continuation of the ICoreWebView2ProcessFailedEventArgs interface. + +[uuid(4dab9422-46fa-4c3e-a5d2-41d2071d3680), object, pointer_default(unique)] +interface ICoreWebView2ProcessFailedEventArgs2 : ICoreWebView2ProcessFailedEventArgs { + + /// The reason for the process failure. The reason is always + /// `COREWEBVIEW2_PROCESS_FAILED_REASON_UNEXPECTED` when `ProcessFailedKind` + /// is `COREWEBVIEW2_PROCESS_FAILED_KIND_BROWSER_PROCESS_EXITED`, and + /// `COREWEBVIEW2_PROCESS_FAILED_REASON_UNRESPONSIVE` when `ProcessFailedKind` + /// is `COREWEBVIEW2_PROCESS_FAILED_KIND_RENDER_PROCESS_UNRESPONSIVE`. + /// For other process failure kinds, the reason may be any of the reason + /// values. + + [propget] HRESULT Reason( + [out, retval] COREWEBVIEW2_PROCESS_FAILED_REASON* reason); + + /// The exit code of the failing process, for telemetry purposes. The exit + /// code is always `1` when `ProcessFailedKind` is + /// `COREWEBVIEW2_PROCESS_FAILED_KIND_BROWSER_PROCESS_EXITED`, and + /// `STILL_ACTIVE` (`259`) when `ProcessFailedKind` is + /// `COREWEBVIEW2_PROCESS_FAILED_KIND_RENDER_PROCESS_UNRESPONSIVE`. + + [propget] HRESULT ExitCode( + [out, retval] int* exitCode); + + /// Description of the process assigned by the WebView2 Runtime. This is a + /// technical English term appropriate for logging or development purposes, + /// and not localized for the end user. It applies to utility processes (for + /// example, "Audio Service", "Video Capture") and plugin processes (for + /// example, "Flash"). The returned `processDescription` is empty if the + /// WebView2 Runtime did not assign a description to the process. + + [propget] HRESULT ProcessDescription( + [out, retval] LPWSTR* processDescription); + + /// The collection of `FrameInfo`s for frames in the `ICoreWebView2` that were + /// being rendered by the failed process. The content in these frames is + /// replaced with an error page. + /// This is only available when `ProcessFailedKind` is + /// `COREWEBVIEW2_PROCESS_FAILED_KIND_FRAME_RENDER_PROCESS_EXITED`; + /// `frames` is `null` for all other process failure kinds, including the case + /// in which the failed process was the renderer for the main frame and + /// subframes within it, for which the failure kind is + /// `COREWEBVIEW2_PROCESS_FAILED_KIND_RENDER_PROCESS_EXITED`. + + [propget] HRESULT FrameInfosForFailedProcess( + [out, retval] ICoreWebView2FrameInfoCollection** frames); +} + +/// Collection of `FrameInfo`s (name and source). Used to list the affected +/// frames' info when a frame-only render process failure occurs in the +/// `ICoreWebView2`. + +[uuid(8f834154-d38e-4d90-affb-6800a7272839), object, pointer_default(unique)] +interface ICoreWebView2FrameInfoCollection : IUnknown { + + /// Gets an iterator over the collection of `FrameInfo`s. + + HRESULT GetIterator( + [out, retval] ICoreWebView2FrameInfoCollectionIterator** iterator); +} + +/// Iterator for a collection of `FrameInfo`s. For more info, see +/// `ICoreWebView2ProcessFailedEventArgs2` and +/// `ICoreWebView2FrameInfoCollection`. + +[uuid(1bf89e2d-1b2b-4629-b28f-05099b41bb03), object, pointer_default(unique)] +interface ICoreWebView2FrameInfoCollectionIterator : IUnknown { + + /// `TRUE` when the iterator has not run out of `FrameInfo`s. If the + /// collection over which the iterator is iterating is empty or if the + /// iterator has gone past the end of the collection, then this is `FALSE`. + + [propget] HRESULT HasCurrent([out, retval] BOOL* hasCurrent); + + /// Get the current `ICoreWebView2FrameInfo` of the iterator. + + HRESULT GetCurrent([out, retval] ICoreWebView2FrameInfo** frameInfo); + + /// Move the iterator to the next `FrameInfo` in the collection. + + HRESULT MoveNext([out, retval] BOOL* hasNext); +} + +/// Provides a set of properties for a frame in the `ICoreWebView2`. + +[uuid(da86b8a1-bdf3-4f11-9955-528cefa59727), object, pointer_default(unique)] +interface ICoreWebView2FrameInfo : IUnknown { + + /// The name attribute of the frame, as in `