#include "ut_assert.h"
#include "ut_debugmsg.h"
#include "xap_Win32App.h"
#include "xap_Win32LabelledSeparator.h"
#include <commctrl.h>
Defines | |
#define | GWL(hwnd) (HFONT)GetWindowLongPtrW((hwnd), GWLP_USERDATA) |
#define | SWL(hwnd, f) SetWindowLongPtrW((hwnd), GWLP_USERDATA,(LONG_PTR)(f)) |
#define | TEXT_LINE_SPACING 2 |
#define | LINE_HEIGHT 2 |
#define | IDC_LINE_SEPARATOR 1 |
Functions | |
static void | AdaptSeparatorLength (HWND hwnd, const wchar_t *text, HFONT hFont) |
static LRESULT CALLBACK | _LabelledSeparatorWndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) |
bool | XAP_Win32LabelledSeparator_RegisterClass (XAP_Win32App *app) |
Variables | |
static const wchar_t | s_LabelledSeparatorWndClassName [] = "AbiLabelledSeparator" |
static WNDPROC | s_pfnWndProc |
#define GWL | ( | hwnd | ) | (HFONT)GetWindowLongPtrW((hwnd), GWLP_USERDATA) |
Referenced by _LabelledSeparatorWndProc().
#define IDC_LINE_SEPARATOR 1 |
Identifier of the child line separator window.
Referenced by _LabelledSeparatorWndProc(), and AdaptSeparatorLength().
#define LINE_HEIGHT 2 |
Line separator height in pixel
Referenced by _LabelledSeparatorWndProc(), and AdaptSeparatorLength().
#define SWL | ( | hwnd, | ||
f | ||||
) | SetWindowLongPtrW((hwnd), GWLP_USERDATA,(LONG_PTR)(f)) |
Referenced by _LabelledSeparatorWndProc().
#define TEXT_LINE_SPACING 2 |
Spacing between the label text and the line separator part of the control.
static LRESULT CALLBACK _LabelledSeparatorWndProc | ( | HWND | hwnd, | |
UINT | iMsg, | |||
WPARAM | wParam, | |||
LPARAM | lParam | |||
) | [static] |
Window procedure function responsible for implementing the special behavior of the control.
hwnd | the control window handle | |
iMsg | the message identifier to process | |
wParam | first message parameter | |
lParam | second message parameter |
References AdaptSeparatorLength(), GWL, IDC_LINE_SEPARATOR, LINE_HEIGHT, s_pfnWndProc, SWL, text, and UT_ASSERT_HARMLESS.
static void AdaptSeparatorLength | ( | HWND | hwnd, | |
const wchar_t * | text, | |||
HFONT | hFont | |||
) | [static] |
Function to adapt the separator line length to the remaining space available after the displayed text.
hwnd | the conrol window handle | |
text | the text to be shown by the control | |
hFont | the font handle used to represent text |
References IDC_LINE_SEPARATOR, LINE_HEIGHT, and UT_return_if_fail.
Referenced by _LabelledSeparatorWndProc().
bool XAP_Win32LabelledSeparator_RegisterClass | ( | XAP_Win32App * | app | ) |
Register the labelled separator control class with Windows. This function must be called before the first labelled separator control is created.
A labelled separator control is like a static control with a line extending at the end of the text portion. The labelled separator control adapt the separator length to the text width. Thus, localized label can be immediately followed by the separator line.
A labelled separator control can be created in a resource file by a statement like the following:
CONTROL "Actual label",IDC_OF_CONTROL,"AbiLabelledSeparator",0x0,7,17,116,8
The last four numbers are the usual x, y, width and height parameters in windows dialog coordinates.
app | the application object |
References XAP_Win32App::getInstance(), s_LabelledSeparatorWndClassName, s_pfnWndProc, and UT_ASSERT.
Referenced by XAP_Win32Dialog_ListDocuments::runModal(), XAP_Win32Dialog_History::runModal(), XAP_Win32Dialog_DocComparison::runModal(), AP_Win32Dialog_Paragraph::runModal(), AP_Win32Dialog_PageNumbers::runModal(), AP_Win32Dialog_MarkRevisions::runModal(), AP_Win32Dialog_ListRevisions::runModal(), AP_Win32Dialog_FormatFootnotes::runModal(), and AP_Win32Dialog_Break::runModal().
const wchar_t s_LabelledSeparatorWndClassName[] = "AbiLabelledSeparator" [static] |
Windows control class name to use in the creation function or template.
Referenced by XAP_Win32LabelledSeparator_RegisterClass().
WNDPROC s_pfnWndProc [static] |
Window procedure function of the control base class.
Referenced by _LabelledSeparatorWndProc(), and XAP_Win32LabelledSeparator_RegisterClass().