diff options
| author | Pietro Gagliardi <[email protected]> | 2014-08-09 10:26:42 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-08-09 10:26:42 -0400 |
| commit | b4a97e871a5c6c390927f5bac9b84b0fe6b40c20 (patch) | |
| tree | 0b4499da73aca7e588b9d44c97a57d7be8e76901 /redo/basicctrls_windows.c | |
| parent | 5198f7202f736ff4d2966e7e6051165bb25f72bb (diff) | |
Settled the placement of functions formerly in sizing_windows.c and updated the winapi_windows.h header file to suit.
Diffstat (limited to 'redo/basicctrls_windows.c')
| -rw-r--r-- | redo/basicctrls_windows.c | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/redo/basicctrls_windows.c b/redo/basicctrls_windows.c index cca3f95..3a7a460 100644 --- a/redo/basicctrls_windows.c +++ b/redo/basicctrls_windows.c @@ -3,64 +3,6 @@ #include "winapi_windows.h" #include "_cgo_export.h" -HWND newControl(LPWSTR class, DWORD style, DWORD extstyle) -{ - HWND hwnd; - - hwnd = CreateWindowExW( - extstyle, - class, L"", - style | WS_CHILD | WS_VISIBLE, - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - /* - the following has the consequence of making the control message-only at first - this shouldn't cause any problems... hopefully not - but see the msgwndproc() for caveat info - also don't use low control IDs as they will conflict with dialog boxes (IDCANCEL, etc.) - */ - msgwin, (HMENU) 100, hInstance, NULL); - if (hwnd == NULL) - xpanic("error creating control", GetLastError()); - return hwnd; -} - -void controlSetParent(HWND control, HWND parent) -{ - if (SetParent(control, parent) == NULL) - xpanic("error changing control parent", GetLastError()); -} - -void controlSetControlFont(HWND which) -{ - SendMessageW(which, WM_SETFONT, (WPARAM) controlFont, TRUE); -} - -/* -all controls that have events receive the events themselves through subclasses -to do this, all windows (including the message-only window; see http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q104069) forward WM_COMMAND to each control with this function -*/ -LRESULT forwardCommand(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - HWND control = (HWND) lParam; - - /* don't generate an event if the control (if there is one) is unparented (a child of the message-only window) */ - if (control != NULL && IsChild(msgwin, control) == 0) - return SendMessageW(control, msgCOMMAND, wParam, lParam); - return DefWindowProcW(hwnd, uMsg, wParam, lParam); -} - -LRESULT forwardNotify(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - NMHDR *nmhdr = (NMHDR *) lParam; - HWND control = nmhdr->hwndFrom; - - /* don't generate an event if the control (if there is one) is unparented (a child of the message-only window) */ - if (control != NULL && IsChild(msgwin, control) == 0) - return SendMessageW(control, msgNOTIFY, wParam, lParam); - return DefWindowProcW(hwnd, uMsg, wParam, lParam); -} - static LRESULT CALLBACK buttonSubProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR id, DWORD_PTR data) { switch (uMsg) { |
