summaryrefslogtreecommitdiff
path: root/alf/alfedit.cpp
blob: 645cb973f7934fac4efd578230613d052049a3bc (plain)
1
2
3
4
5
6
7
8
9
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
#include "alfpriv.h"

/* EDIT */

HWND
ALF_AddEdit(HWND win, WORD id, int x, int y, const TCHAR *text)
{
    DWORD exstyle;
    DWORD style;

    if (ALF_Compat_Is40()) {
        exstyle = WS_EX_CLIENTEDGE;
        style = 0;
    } else {
        exstyle = 0;
        style = WS_BORDER;
    }

    HWND hwndEdit  = CreateWindowEx(exstyle,
                                    TEXT("EDIT"),
                                    text,
                                    WS_CHILD | WS_VISIBLE | WS_TABSTOP | style,
                                    0, 0, 100, 100,
                                    win,
                                    (HMENU)(ULONG_PTR)id,
                                    (HINSTANCE)GetWindowLongPtr(win, GWLP_HINSTANCE),
                                    NULL);

    SetWindowPos(hwndEdit, NULL, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED);

    ALF_AddControl(win, x, y, hwndEdit, 12000, 0, ALF_LAYOUT_SIZE_EDIT | ALF_LAYOUT_INHERITFONT);

    return hwndEdit;
}