35 |
|
|
36 |
extern "C" void _SHFree (void *p); |
extern "C" void _SHFree (void *p); |
37 |
|
|
38 |
/* The the text of a menu item. */ |
|
39 |
void |
static void |
40 |
set_menu_text (HMENU menu, int m_uid, const char *text) |
set_menu_text_ext (HMENU menu, int by_pos, int m_uid, const char *text) |
41 |
{ |
{ |
42 |
MENUITEMINFO mii; |
MENUITEMINFO mii; |
|
char menu_text[80]; |
|
|
|
|
|
memset (&mii, 0, sizeof (mii)); |
|
|
mii.cbSize = sizeof (mii); |
|
|
mii.fMask = MIIM_TYPE; |
|
|
mii.dwTypeData = menu_text; |
|
|
mii.cch = sizeof (menu_text); |
|
|
GetMenuItemInfo (menu, m_uid, FALSE, &mii); |
|
43 |
|
|
44 |
memset (&mii, 0, sizeof mii); |
memset (&mii, 0, sizeof mii); |
45 |
mii.cbSize = sizeof mii; |
mii.cbSize = sizeof mii; |
46 |
mii.fMask = MIIM_TYPE; |
mii.fMask = MIIM_TYPE; |
47 |
mii.fType = MFT_STRING; |
mii.fType = MFT_STRING; |
48 |
mii.dwTypeData = (char *) text; |
mii.dwTypeData = (char *) text; |
49 |
SetMenuItemInfo (menu, m_uid, FALSE, &mii); |
SetMenuItemInfo (menu, m_uid, by_pos? TRUE : FALSE, &mii); |
50 |
} /* set_menu_text */ |
} |
51 |
|
|
52 |
|
|
53 |
|
/* Set the text of a menu item @m_uid to @text. */ |
54 |
|
void |
55 |
|
set_menu_text (HMENU menu, int m_uid, const char *text) |
56 |
|
{ |
57 |
|
set_menu_text_ext (menu, 0, m_uid, text); |
58 |
|
} |
59 |
|
|
60 |
|
|
61 |
|
/* Set the text of a menu item with the position @pos to @text. */ |
62 |
|
void |
63 |
|
set_menu_text_bypos (HMENU menu, int pos, const char *text) |
64 |
|
{ |
65 |
|
set_menu_text_ext (menu, 1, pos, text); |
66 |
|
} |
67 |
|
|
68 |
|
|
69 |
|
/* Set the state of a menu item @m_uid to @state. */ |
70 |
void |
void |
71 |
set_menu_state (HMENU menu, int m_uid, int state) |
set_menu_state (HMENU menu, int m_uid, int state) |
72 |
{ |
{ |
77 |
mii.fMask = MIIM_STATE; |
mii.fMask = MIIM_STATE; |
78 |
mii.fState = state; |
mii.fState = state; |
79 |
SetMenuItemInfo (menu, m_uid, FALSE, &mii); |
SetMenuItemInfo (menu, m_uid, FALSE, &mii); |
80 |
} /* set_menu_state */ |
} |
81 |
|
|
82 |
|
|
83 |
|
|
84 |
/* Use the common dialog to request a file from the user. |
/* Use the common dialog to request a file from the user. |
97 |
memset (file, 0, sizeof (file)); |
memset (file, 0, sizeof (file)); |
98 |
if (!filter) |
if (!filter) |
99 |
filter = _("All Files (*.*)\0*.*\0\0"); |
filter = _("All Files (*.*)\0*.*\0\0"); |
100 |
|
/* XXX: problem with gettext because of the 'artificial' |
101 |
|
double string termination!. */ |
102 |
memset (&open, 0, sizeof (open)); |
memset (&open, 0, sizeof (open)); |
103 |
open.lStructSize = sizeof (OPENFILENAME); |
open.lStructSize = sizeof (OPENFILENAME); |
104 |
open.hInstance = glob_hinst; |
open.hInstance = glob_hinst; |
120 |
return NULL; |
return NULL; |
121 |
} |
} |
122 |
|
|
123 |
|
const char* |
124 |
|
get_filesave_dlg (HWND hwnd, const char *title, |
125 |
|
const char *filter, const char *name) |
126 |
|
{ |
127 |
|
return get_filename_dlg (hwnd, FILE_SAVE, title, filter, name); |
128 |
|
} |
129 |
|
|
130 |
|
const char * |
131 |
|
get_fileopen_dlg (HWND hwnd, const char *title, const char *filter, |
132 |
|
const char *name) |
133 |
|
{ |
134 |
|
return get_filename_dlg (hwnd, FILE_OPEN, title, filter, name); |
135 |
|
} |
136 |
|
|
137 |
|
|
138 |
/* Use the common dialog to allow the user to select a folder. |
/* Use the common dialog to allow the user to select a folder. |
139 |
The return value is either the folder path or NULL if cancel was chosen. */ |
The return value is either the folder path or NULL if cancel was chosen. */ |
140 |
const char* |
const char* |
198 |
} |
} |
199 |
|
|
200 |
|
|
201 |
/* Set the the given text to the clipboard. */ |
/* Set @text as the new clipboard content. */ |
202 |
int |
int |
203 |
set_clip_text (HWND hwnd, const char *text, int nbytes) |
set_clip_text (HWND hwnd, const char *text, int nbytes) |
204 |
{ |
{ |