![]() |
Sorting Network Verify and Draw
Check Whether Comparator Networks Sort and Draw Them
|
Code for some helpful Windows-specific functions. More...
#include <shobjidl_core.h>
#include <atlbase.h>
#include "WindowsHelpers.h"
#include "Includes.h"
#include "SortingNetwork.h"
#include "resource.h"
Go to the source code of this file.
Functions | |
std::wstring | FileNameBase (const std::wstring &wstrPath) |
void | MinDragRect (HWND hwnd, WPARAM wParam, RECT *pRect, int w, int h) |
Enforce minimum drag rectangle. More... | |
void | InitWindow (HINSTANCE hInst, INT nShow, WNDPROC WndProc) |
Initialize window. More... | |
ULONG_PTR | InitGDIPlus () |
Initialize GDI+. More... | |
HRESULT | GetEncoderClsid (const WCHAR *format, CLSID *pClsid) |
Get encoder CLSID. More... | |
HRESULT | ExportImage (const eExport t, HWND hwnd, CRenderableComparatorNet *pNet, std::wstring &wstrName) |
Export. More... | |
HRESULT | Load (HWND hwnd, CComparatorNetwork *pNet, std::wstring &wstrName) |
Load comparator network. More... | |
void | CreateFileMenu (HMENU hParent) |
Create File menu. More... | |
void | CreateExportMenu (HMENU hParent) |
Create File menu. More... | |
void | CreateGenerateMenu (HMENU hParent) |
Create Generate menu. More... | |
void | CreateViewMenu (HMENU hParent) |
Create View menu. More... | |
void | CreateHelpMenu (HMENU hParent) |
Create Help menu. More... | |
These platform-dependent functions are hidden away so that the faint-of-heart don't have to see them if they're offended by them.
Definition in file WindowsHelpers.cpp.
void CreateExportMenu | ( | HMENU | hParent | ) |
Create the Export
menu.
hParent | Handle to the parent menu. |
Definition at line 374 of file WindowsHelpers.cpp.
void CreateFileMenu | ( | HMENU | hParent | ) |
Create the File
menu.
hParent | Handle to the parent menu. |
Definition at line 354 of file WindowsHelpers.cpp.
void CreateGenerateMenu | ( | HMENU | hParent | ) |
Create the Generate
menu.
hParent | Handle to the parent menu. |
Definition at line 387 of file WindowsHelpers.cpp.
void CreateHelpMenu | ( | HMENU | hParent | ) |
Create the Help
menu.
hParent | Handle to the parent menu. |
Definition at line 417 of file WindowsHelpers.cpp.
void CreateViewMenu | ( | HMENU | hParent | ) |
Create the View
menu.
hParent | Handle to the parent menu. |
Definition at line 405 of file WindowsHelpers.cpp.
HRESULT ExportImage | ( | const eExport | t, |
HWND | hwnd, | ||
CRenderableComparatorNet * | pNet, | ||
std::wstring & | wstrName | ||
) |
Display a Save
dialog box save an image of a comparator network to the file that the user selects. Export an image to a file.
t | Export file type. |
hwnd | Window handle. |
pNet | Pointer to a renderable comparator network. |
wstrName | Default file name. |
Definition at line 225 of file WindowsHelpers.cpp.
std::wstring FileNameBase | ( | const std::wstring & | wstrPath | ) |
Remove the path and the extension from a file name.
wstrPath | File path, possibly with extension. |
Definition at line 41 of file WindowsHelpers.cpp.
HRESULT GetEncoderClsid | ( | const WCHAR * | format, |
CLSID * | pClsid | ||
) |
Get an encoder clsid for an image file format.
format | File format using wide characters. |
pClsid | [OUT] Pointer to clsid. |
S_OK
for success, E_FAIL
for failure. Definition at line 193 of file WindowsHelpers.cpp.
ULONG_PTR InitGDIPlus | ( | ) |
Initialize GDI+ and get a GDI+ token.
Definition at line 174 of file WindowsHelpers.cpp.
void InitWindow | ( | HINSTANCE | hInst, |
INT | nShow, | ||
WNDPROC | WndProc | ||
) |
Create and initialize a window.
hInst | Instance handle. |
nShow | 1 to show window, 0 to hide. |
WndProc | Window procedure. |
Definition at line 131 of file WindowsHelpers.cpp.
HRESULT Load | ( | HWND | hwnd, |
CComparatorNetwork * | pNet, | ||
std::wstring & | wstrName | ||
) |
Pop up a Windows Open
dialog box for the user to pick a text file and read the comparator network from there into a comparator network.
hwnd | Window handle. |
pNet | [OUT] Pointer to a renderable comparator network. |
wstrName | [IN, OUT] File name without extension. |
S_OK
for success, E_FAIL
for failure. Definition at line 303 of file WindowsHelpers.cpp.
void MinDragRect | ( | HWND | hwnd, |
WPARAM | wParam, | ||
RECT * | pRect, | ||
int | w, | ||
int | h | ||
) |
Resize the drag rectangle provided by a WM_SIZING message to ensure a minimum client area width and height.
hwnd | Window handle. |
wParam | WMSZ message telling us which edge is being dragged on. |
pRect | [IN, OUT] Pointer to drag rectangle. |
w | Minimum width of client area. |
h | Minimum height of client area. |
Definition at line 63 of file WindowsHelpers.cpp.