dialog-layout 1.1.0
|
Win32 dialog dynamic layout engine API. More...
#include <windows.h>
#include <tchar.h>
Go to the source code of this file.
Macros | |
Anchor flags | |
Anchor bitmasks used to define control layout behavior in a dialog. | |
#define | ANCOR_LEFT 0x0001 |
Anchor control to the left edge. | |
#define | ANCOR_TOP 0x0002 |
Anchor control to the top edge. | |
#define | ANCOR_LEFT_TOP (ANCOR_LEFT | ANCOR_TOP) |
Anchor control to both left and top edges. | |
#define | ANCOR_RIGHT 0x0004 |
Anchor control to the right edge. | |
#define | ANCOR_RIGHT_TOP (ANCOR_RIGHT | ANCOR_TOP) |
Anchor control to both right and top edges. | |
#define | ANCOR_BOTTOM 0x0008 |
Anchor control to the bottom edge. | |
#define | ANCOR_LEFT_BOTTOM (ANCOR_LEFT | ANCOR_BOTTOM) |
Anchor control to both left and bottom edges. | |
#define | ANCOR_RIGHT_BOTTOM (ANCOR_RIGHT | ANCOR_BOTTOM) |
Anchor control to both right and bottom edges. | |
Functions | |
void | attach_layout (HANDLE resource, HWND dialog, LPCTSTR layout_resource_name) |
Attach a dynamic layout to a dialog box using a layout resource. | |
void | init_layout (HWND dialog) |
Initialize dynamic layout management for a dialog. | |
BOOL | anchor_control (HWND dialog, DWORD control_id, WORD anchor_topleft, WORD anchor_bottomright) |
Anchor an individual control to specific edges of the dialog, overriding any previous anchor. | |
Win32 dialog dynamic layout engine API.
This header provides functions and macros for attaching, detaching, and managing dynamic layouts in Win32 dialog boxes. Controls in a dialog can be anchored to dialog edges to provide responsive resizing behavior.
#define ANCOR_BOTTOM 0x0008 |
Anchor control to the bottom edge.
#define ANCOR_LEFT 0x0001 |
Anchor control to the left edge.
#define ANCOR_LEFT_BOTTOM (ANCOR_LEFT | ANCOR_BOTTOM) |
Anchor control to both left and bottom edges.
#define ANCOR_LEFT_TOP (ANCOR_LEFT | ANCOR_TOP) |
Anchor control to both left and top edges.
#define ANCOR_RIGHT 0x0004 |
Anchor control to the right edge.
#define ANCOR_RIGHT_BOTTOM (ANCOR_RIGHT | ANCOR_BOTTOM) |
Anchor control to both right and bottom edges.
#define ANCOR_RIGHT_TOP (ANCOR_RIGHT | ANCOR_TOP) |
Anchor control to both right and top edges.
#define ANCOR_TOP 0x0002 |
Anchor control to the top edge.
BOOL anchor_control | ( | HWND | dialog, |
DWORD | control_id, | ||
WORD | anchor_topleft, | ||
WORD | anchor_bottomright ) |
Anchor an individual control to specific edges of the dialog, overriding any previous anchor.
Registers or overrides the anchor points for the specified control in the layout engine. This function can be used after attach_layout() to override anchors loaded from a resource, or after init_layout() to add anchors manually.
dialog | Handle to the dialog box (HWND). |
control_id | Control ID (e.g., IDC_BUTTON_OK). |
anchor_topleft | Anchor flags for the control's top-left corner (see Anchor flags). |
anchor_bottomright | Anchor flags for the control's bottom-right corner (see Anchor flags). |
Example usage:
void attach_layout | ( | HANDLE | resource, |
HWND | dialog, | ||
LPCTSTR | layout_resource_name ) |
Attach a dynamic layout to a dialog box using a layout resource.
Loads the layout information from the specified resource and applies it to the dialog, so its controls will resize and move according to the layout rules when the dialog is resized.
resource | Handle to the module containing the resource. |
dialog | Handle to the dialog box (HWND). |
layout_resource_name | Name of the layout resource (e.g., MAKEINTRESOURCE(ID_MAINDIALOG_LAYOUT)). |
Example usage:
void init_layout | ( | HWND | dialog | ) |
Initialize dynamic layout management for a dialog.
Prepares the dialog for dynamic layout by creating an internal layout structure. Controls can then be anchored individually using anchor_control().
dialog | Handle to the dialog box (HWND). |
Example usage: