Ejemplo n.º 1
0
static void init_mapping_dialog(HWND hwnd)
{
    int idc_index, i;
    int xpos;
    RECT rect;

    /* translate all dialog items */
    uilib_localize_dialog(hwnd, mapping_dialog_trans);

    /* translate ok and cancel items */
    uilib_localize_dialog(hwnd, ok_cancel_trans);

    /* adjust the size of the elements in the buttons group */
    uilib_adjust_group_width(hwnd, mapping_buttons_group);

    /* adjust the size of the elements in the left group */
    uilib_adjust_group_width(hwnd, mapping_left_group);

    /* get the max x of the left group */
    uilib_get_group_max_x(hwnd, mapping_left_group, &xpos);

    /* move the middle group to the correct position */
    uilib_move_group(hwnd, mapping_middle_group, xpos + 10);

    /* get the max x of the middle group */
    uilib_get_group_max_x(hwnd, mapping_middle_group, &xpos);

    /* move the right group to the correct position */
    uilib_move_group(hwnd, mapping_right_group, xpos + 10);

    /* get the max x of the right group */
    uilib_get_group_max_x(hwnd, mapping_right_group, &xpos);

    /* set the width of the dialog to 'surround' all the elements */
    GetWindowRect(hwnd, &rect);
    MoveWindow(hwnd, rect.left, rect.top, xpos + 10, rect.bottom - rect.top, TRUE);

    /* recenter the buttons in the newly resized dialog window */
    uilib_center_buttons(hwnd, mapping_move_buttons_group, 0);

    /* recenter the ok and cancel buttons in the newly resized dialog window */
    uilib_center_buttons(hwnd, ok_cancel_move_group, 0);

    idc_index = mapping_index_get();

    CheckRadioButton(hwnd, mapping_entry[0].idc_select, mapping_entry[uikeyboard_mapping_num - 1].idc_select, idc_index);

    for (i = 0; i < uikeyboard_mapping_num; i++) {
        const char *fname;
        TCHAR *st_fname;

        resources_get_string(mapping_entry[i].res_filename, &fname);
        st_fname = system_mbstowcs_alloc(fname);
        SetDlgItemText(hwnd, mapping_entry[i].idc_filename, fname != NULL ? st_fname : TEXT(""));
        system_mbstowcs_free(st_fname);
    }

    enable_mapping_controls(hwnd, idc_index);
}
Ejemplo n.º 2
0
static void init_mapping_dialog(HWND hwnd)
{
    int idc_index, i;

    idc_index = mapping_index_get();

    CheckRadioButton(hwnd, mapping_entry[0].idc_select,
                     mapping_entry[uikeyboard_mapping_num - 1].idc_select,
                     idc_index);

    for (i = 0; i < uikeyboard_mapping_num; i++) {
        const char *fname;
        TCHAR *st_fname;

        resources_get_string(mapping_entry[i].res_filename, &fname);
        st_fname = system_mbstowcs_alloc(fname);
        SetDlgItemText(hwnd, mapping_entry[i].idc_filename,
                       fname != NULL ? st_fname : TEXT(""));
        system_mbstowcs_free(st_fname);
    }

    enable_mapping_controls(hwnd, idc_index);
}