]> cygwin.com Git - cygwin-apps/setup.git/blame - dialog.cc
Added dpiAwareness element to manifest
[cygwin-apps/setup.git] / dialog.cc
CommitLineData
23c9e63c
DD
1/*
2 * Copyright (c) 2000, Red Hat, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * A copy of the GNU General Public License can be found at
10 * http://www.gnu.org/
11 *
12 * Written by DJ Delorie <dj@cygnus.com>
13 *
14 */
15
16/* The purpose of this file is to provide common functionality for
17 all the dialogs in the program. */
18
19#include "win32.h"
20#include <stdio.h>
21#include <stdlib.h>
22#include "dialog.h"
5fa64c3c 23#include "LogFile.h"
85b43844 24#include "mount.h"
23c9e63c
DD
25
26char *
27eget (HWND h, int id, char *var)
28{
29 char tmp[4000];
d2a3615c 30 if (var && var != get_root_dir ().c_str())
23c9e63c 31 {
5e0464a1 32 delete [] var;
85b43844 33 var = NULL;
23c9e63c 34 }
42bf5b92 35 if (GetDlgItemText (h, id, tmp, sizeof (tmp)) > 0)
23c9e63c 36 {
5e0464a1
RC
37 var = new char [strlen (tmp) + 1];
38 var [strlen (tmp)] = '\0';
23c9e63c
DD
39 strcpy (var, tmp);
40 }
41 return var;
42}
43
08678720 44std::string
3c054baf
RC
45egetString (HWND h, int id)
46{
08678720 47 std::string aString;
3c054baf
RC
48 char tmp[4000];
49 if (GetDlgItemText (h, id, tmp, sizeof (tmp)) > 0)
08678720 50 aString = std::string (tmp);
3c054baf
RC
51 return aString;
52}
53
23c9e63c
DD
54int
55eget (HWND h, int id)
56{
57 BOOL s;
58 int r = GetDlgItemInt (h, id, &s, TRUE);
59 return r;
60}
61
62void
85b43844 63eset (HWND h, int id, const char *val)
23c9e63c
DD
64{
65 SetDlgItemText (h, id, val);
66}
67
3c054baf 68void
08678720 69eset (HWND h, int id, const std::string aString)
3c054baf 70{
d2a3615c 71 SetDlgItemText (h, id, aString.c_str());
3c054baf
RC
72}
73
b08f9c71
JT
74void
75eset (HWND h, int id, const std::wstring &aString)
76{
77 SetDlgItemTextW (h, id, aString.c_str());
78}
79
23c9e63c
DD
80void
81eset (HWND h, int id, int val)
82{
b24c88b3 83 SetDlgItemInt (h, id, (UINT) val, TRUE);
23c9e63c
DD
84}
85
86int
87rbget (HWND h, int *ids)
88{
89 int i;
b24c88b3 90 for (i = 0; ids[i]; i++)
23c9e63c
DD
91 if (IsDlgButtonChecked (h, ids[i]) == BST_CHECKED)
92 return ids[i];
93 return 0;
94}
95
96void
97rbset (HWND h, int *ids, int id)
98{
99 int i;
b24c88b3
RC
100 for (i = 0; ids[i]; i++)
101 CheckDlgButton (h, ids[i], id == ids[i] ? BST_CHECKED : BST_UNCHECKED);
23c9e63c 102}
This page took 0.136005 seconds and 6 git commands to generate.