2 * Copyright (c) 2000, Red Hat, Inc.
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.
9 * A copy of the GNU General Public License can be found at
12 * Written by DJ Delorie <dj@cygnus.com>
16 /* The purpose of this file is to provide common functionality for
17 all the dialogs in the program. */
27 eget (HWND h
, int id
, char *var
)
30 if (var
&& var
!= get_root_dir ().c_str())
35 if (GetDlgItemText (h
, id
, tmp
, sizeof (tmp
)) > 0)
37 var
= new char [strlen (tmp
) + 1];
38 var
[strlen (tmp
)] = '\0';
45 egetString (HWND h
, int id
)
49 if (GetDlgItemText (h
, id
, tmp
, sizeof (tmp
)) > 0)
50 aString
= std::string (tmp
);
58 int r
= GetDlgItemInt (h
, id
, &s
, TRUE
);
63 eset (HWND h
, int id
, const char *val
)
65 SetDlgItemText (h
, id
, val
);
69 eset (HWND h
, int id
, const std::string aString
)
71 SetDlgItemText (h
, id
, aString
.c_str());
75 eset (HWND h
, int id
, const std::wstring
&aString
)
77 SetDlgItemTextW (h
, id
, aString
.c_str());
81 eset (HWND h
, int id
, int val
)
83 SetDlgItemInt (h
, id
, (UINT
) val
, TRUE
);
87 rbget (HWND h
, int *ids
)
90 for (i
= 0; ids
[i
]; i
++)
91 if (IsDlgButtonChecked (h
, ids
[i
]) == BST_CHECKED
)
97 rbset (HWND h
, int *ids
, int id
)
100 for (i
= 0; ids
[i
]; i
++)
101 CheckDlgButton (h
, ids
[i
], id
== ids
[i
] ? BST_CHECKED
: BST_UNCHECKED
);