Release 20030408.
[wine/gsoc-2012-control.git] / programs / clock / language.c
blob9558bc79ce8c2a3080b0c6006cfa7fa1f8638f9c
1 /*
2 * Clock
4 * Copyright 1998 Marcel Baur <mbaur@g26.ethz.ch>
5 * Copyright 1998 Karl Backström <karl_b@geocities.com>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <stdio.h>
23 #include "windows.h"
24 #include "main.h"
25 #include "language.h"
26 #include "winnls.h"
28 CHAR STRING_MENU_Xx[] = "MENU_Xx";
30 VOID LANGUAGE_UpdateMenuCheckmarks(VOID) {
32 if(Globals.bAnalog == TRUE) {
34 /* analog clock */
36 CheckMenuItem(Globals.hPropertiesMenu, 0x100, \
37 MF_BYCOMMAND | MF_CHECKED);
38 CheckMenuItem(Globals.hPropertiesMenu, 0x101, \
39 MF_BYCOMMAND | MF_UNCHECKED);
40 EnableMenuItem(Globals.hPropertiesMenu, 0x103, \
41 MF_BYCOMMAND | MF_GRAYED);
43 else
46 /* digital clock */
48 CheckMenuItem(Globals.hPropertiesMenu, 0x100, \
49 MF_BYCOMMAND | MF_UNCHECKED);
50 CheckMenuItem(Globals.hPropertiesMenu, 0x101, \
51 MF_BYCOMMAND | MF_CHECKED);
52 EnableMenuItem(Globals.hPropertiesMenu, 0x103, \
53 MF_BYCOMMAND);
57 CheckMenuItem(Globals.hPropertiesMenu, 0x105, MF_BYCOMMAND | \
58 (Globals.bWithoutTitle ? MF_CHECKED : MF_UNCHECKED));
59 CheckMenuItem(Globals.hSystemMenu, 0x10D, MF_BYCOMMAND | \
60 (Globals.bAlwaysOnTop ? MF_CHECKED : MF_UNCHECKED));
61 CheckMenuItem(Globals.hPropertiesMenu, 0x107, MF_BYCOMMAND | \
62 (Globals.bSeconds ? MF_CHECKED : MF_UNCHECKED));
63 CheckMenuItem(Globals.hPropertiesMenu, 0x108, MF_BYCOMMAND | \
64 (Globals.bDate ? MF_CHECKED : MF_UNCHECKED));
67 VOID LANGUAGE_UpdateWindowCaption(VOID) {
69 CHAR szCaption[MAX_STRING_LEN];
70 CHAR szDate[MAX_STRING_LEN];
72 LPSTR date = szDate;
74 SYSTEMTIME st;
75 LPSYSTEMTIME lpst = &st;
77 GetLocalTime(&st);
78 GetDateFormat(LOCALE_USER_DEFAULT, LOCALE_SLONGDATE, lpst, NULL, date,
79 MAX_STRING_LEN);
81 /* Set frame caption */
82 LoadString(Globals.hInstance, 0x10C, szCaption, sizeof(szCaption));
83 if (Globals.bDate) {
84 lstrcat(szCaption, " - ");
85 lstrcat(szCaption, szDate);
87 SetWindowText(Globals.hMainWnd, szCaption);
91 VOID LANGUAGE_LoadMenus(VOID)
94 CHAR szItem[MAX_STRING_LEN];
95 HMENU hMainMenu;
98 /* Create menu */
99 hMainMenu = LoadMenu(Globals.hInstance, MAKEINTRESOURCE(MAIN_MENU));
100 Globals.hPropertiesMenu = GetSubMenu(hMainMenu, 0);
101 Globals.hLanguageMenu = GetSubMenu(hMainMenu, 1);
102 Globals.hInfoMenu = GetSubMenu(hMainMenu, 2);
104 SetMenu(Globals.hMainWnd, hMainMenu);
106 /* Destroy old menu */
107 if (Globals.hMainMenu) DestroyMenu(Globals.hMainMenu);
108 Globals.hMainMenu = hMainMenu;
110 /* specific for Clock: */
112 LANGUAGE_UpdateMenuCheckmarks();
113 LANGUAGE_UpdateWindowCaption();
115 Globals.hSystemMenu = GetSystemMenu(Globals.hMainWnd, TRUE);
117 /* FIXME: Append a SEPARATOR to Globals.hSystemMenu here */
119 LoadString(Globals.hInstance, 0x10D, szItem, sizeof(szItem));
120 AppendMenu(Globals.hSystemMenu, MF_STRING | MF_BYCOMMAND, 1000, szItem);
124 VOID LANGUAGE_DefaultHandle(WPARAM wParam)
126 if ((wParam >=CL_FIRST_LANGUAGE) && (wParam<=CL_LAST_LANGUAGE))
127 LANGUAGE_SelectByNumber(wParam - CL_FIRST_LANGUAGE);
128 else printf("Unimplemented menu command %i\n", wParam);
132 /* Local Variables: */
133 /* c-file-style: "GNU" */
134 /* End: */