]> git.sesse.net Git - vlc/blob - modules/gui/win32/misc.cpp
* ./modules/gui/familiar/*: compilation fixes. Crashes on directory change.
[vlc] / modules / gui / win32 / misc.cpp
1 /*****************************************************************************\r
2  * misc.cpp: miscellaneous functions.\r
3  *****************************************************************************\r
4  * Copyright (C) 2002 VideoLAN\r
5  *\r
6  * Authors: Olivier Teuliere <ipkiss@via.ecp.fr>\r
7  *\r
8  * This program is free software; you can redistribute it and/or modify\r
9  * it under the terms of the GNU General Public License as published by\r
10  * the Free Software Foundation; either version 2 of the License, or\r
11  * (at your option) any later version.\r
12  *\r
13  * This program is distributed in the hope that it will be useful,\r
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
16  * GNU General Public License for more details.\r
17  *\r
18  * You should have received a copy of the GNU General Public License\r
19  * along with this program; if not, write to the Free Software\r
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.\r
21  *****************************************************************************/\r
22 \r
23 #include <vcl.h>\r
24 #pragma hdrstop\r
25 \r
26 #include "misc.h"\r
27 \r
28 /****************************************************************************\r
29  * This function replaces "Hint", "Caption" and "Text" properties of each\r
30  * component of the form by the appropriate translation.\r
31  ****************************************************************************/\r
32 void __fastcall Translate( TForm *Form )\r
33 {\r
34 #if 0\r
35     Form->Hint = _( Form->Hint );\r
36     Form->Caption = _( Form->Caption );\r
37 \r
38     int i;\r
39     for( i = 0; i < Form->ComponentCount; i++ )\r
40     {\r
41         // Does this component need a translation ?\r
42         if( Form->Components[i]->Tag > 0 )\r
43         {\r
44             TComponent *Component = Form->Components[i];\r
45 \r
46             // Hint property\r
47             if( Component->Tag & 1 )\r
48             {\r
49                 if( Component->InheritsFrom( __classid( TControl ) ) )\r
50                 {\r
51                     TControl *Object = (TControl *) Component;\r
52                     Object->Hint = _( Object->Hint );\r
53                 }\r
54                 else if( Component->InheritsFrom( __classid( TMenuItem ) ) )\r
55                 {\r
56                     TMenuItem *Object = (TMenuItem *) Component;\r
57                     Object->Hint = _( Object->Hint );\r
58                 }\r
59             }\r
60 \r
61             // Caption property\r
62             if( Component->Tag & 2 )\r
63             {\r
64                 if( Component->InheritsFrom( __classid( TMenuItem ) ) )\r
65                 {\r
66                     TMenuItem *Object = (TMenuItem *) Component;\r
67                     Object->Caption = _( Object->Caption );\r
68                 }\r
69                 else if( Component->InheritsFrom( __classid( TLabel ) ) )\r
70                 {\r
71                     TLabel *Object = (TLabel *) Component;\r
72                     Object->Caption = _( Object->Caption );\r
73                 }\r
74                 else if( Component->InheritsFrom( __classid( TButton ) ) )\r
75                 {\r
76                     TButton *Object = (TButton *) Component;\r
77                     Object->Caption = _( Object->Caption );\r
78                 }\r
79                 else if( Component->InheritsFrom( __classid( TToolButton ) ) )\r
80                 {\r
81                     TToolButton *Object = (TToolButton *) Component;\r
82                     Object->Caption = _( Object->Caption );\r
83                 }\r
84                 else if( Component->InheritsFrom( __classid( TRadioButton ) ) )\r
85                 {\r
86                     TRadioButton *Object = (TRadioButton *) Component;\r
87                     Object->Caption = _( Object->Caption );\r
88                 }\r
89                 else if( Component->InheritsFrom( __classid( TCheckBox ) ) )\r
90                 {\r
91                     TCheckBox *Object = (TCheckBox *) Component;\r
92                     Object->Caption = _( Object->Caption );\r
93                 }\r
94                 else if( Component->InheritsFrom( __classid( TRadioGroup ) ) )\r
95                 {\r
96                     TRadioGroup *Object = (TRadioGroup *) Component;\r
97                     Object->Caption = _( Object->Caption );\r
98                 }\r
99                 else if( Component->InheritsFrom( __classid( TGroupBox ) ) )\r
100                 {\r
101                     TGroupBox *Object = (TGroupBox *) Component;\r
102                     Object->Caption = _( Object->Caption );\r
103                 }\r
104                 else if( Component->InheritsFrom( __classid( TTabSheet ) ) )\r
105                 {\r
106                     TTabSheet *Object = (TTabSheet *) Component;\r
107                     Object->Caption = _( Object->Caption );\r
108                 }\r
109                 else if( Component->InheritsFrom( __classid( TListView ) ) )\r
110                 {\r
111                     TListView *Object = (TListView *) Component;\r
112                     int iCol;\r
113                     for( iCol = 0; iCol < Object->Columns->Count; iCol++ )\r
114                         Object->Columns->Items[iCol]->Caption =\r
115                                  _( Object->Columns->Items[iCol]->Caption );\r
116                 }\r
117             }\r
118 \r
119             // Text property\r
120             if( Component->Tag & 4 )\r
121             {\r
122                 if( Component->InheritsFrom( __classid( TEdit ) ) )\r
123                 {\r
124                     TEdit *Object = (TEdit *) Component;\r
125                     Object->Text = _( Object->Text );\r
126                 }\r
127                 else if( Component->InheritsFrom( __classid( TComboBox ) ) )\r
128                 {\r
129                     TComboBox *Object = (TComboBox *) Component;\r
130                     Object->Text = _( Object->Text );\r
131                 }\r
132             }\r
133         }\r
134     }\r
135 #endif\r
136 }\r
137  \r