00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <y2/Y2Namespace.h>
00023 #include <y2/Y2Function.h>
00024 #include "ycp/YCPBoolean.h"
00025 #include "ycp/YCPInteger.h"
00026 #include "ycp/YCPVoid.h"
00027 #include "ycp/YCPString.h"
00028 #include "ycp/YCPCode.h"
00029 #include "ycp/StaticDeclaration.h"
00030
00031 #define y2log_component "ui"
00032 #include "ycp/y2log.h"
00033
00034 #include "YUI.h"
00035 #include "YUIComponent.h"
00036
00037 class Y2UINamespace;
00038
00042 class Y2UIFunction: public Y2Function
00043 {
00044 protected:
00045
00046 unsigned int m_position;
00047 Y2UINamespace* m_instance;
00048 YUIComponent* m_comp;
00049 bool m_play_macro_blocks;
00050 YCPValue m_param1;
00051 YCPValue m_param2;
00052 YCPValue m_param3;
00053 YCPValue m_param4;
00054 YCPValue m_param5;
00055 public:
00056
00057 Y2UIFunction (Y2UINamespace* instance, YUIComponent* comp, unsigned int pos, bool play_macro_blocks);
00058
00059 bool attachParameter (const YCPValue& arg, const int position);
00060 constTypePtr wantedParameterType () const;
00061 bool appendParameter (const YCPValue& arg);
00062 bool finishParameters ();
00063 YCPValue evaluateCall ();
00064 YCPValue evaluateCall_int ();
00065 bool reset ();
00066 string name () const;
00067 };
00068
00072 class Y2UIOverloadedFunction: public Y2UIFunction
00073 {
00077 vector<SymbolEntryPtr>::iterator m_candidates_b;
00078 vector<SymbolEntryPtr>::iterator m_candidates_e;
00079
00080 public:
00081 Y2UIOverloadedFunction (
00082 Y2UINamespace* instance, YUIComponent* comp,
00083 unsigned pos_offset,
00084 vector<SymbolEntryPtr>::iterator candidates_b,
00085 vector<SymbolEntryPtr>::iterator candidates_e,
00086 bool play_macro_blocks);
00087
00088
00089
00090
00092 bool finishParameters ();
00093 };
00094
00095 class Y2UINamespace: public Y2Namespace
00096 {
00097 private:
00098 void registerFunctions ();
00099
00100 vector<string> _registered_functions;
00101
00102 YUIComponent* m_comp;
00103
00104 public:
00108 Y2UINamespace (YUIComponent* comp);
00109
00113 virtual ~Y2UINamespace ();
00114
00115 virtual const string name () const
00116 {
00117 return "UI";
00118 }
00119
00120 virtual const string filename () const
00121 {
00122 return "UI";
00123 }
00124
00125 virtual string toString () const
00126 {
00127 return "// not possible toString";
00128 }
00129
00130 virtual YCPValue evaluate (bool cse = false )
00131 {
00132 if (cse) return YCPNull ();
00133 else return YCPVoid ();
00134 }
00135
00136 virtual Y2Function* createFunctionCall (const string name, constFunctionTypePtr type);
00137
00138
00139 YCPValue SetLanguage ( const YCPString & language );
00140
00141
00142 YCPValue SetLanguage ( const YCPString & language, const YCPString & encoding );
00143
00144
00145 YCPValue GetProductName ();
00146
00147
00148 YCPValue SetProductName ( const YCPString & name );
00149
00150
00151 YCPValue SetConsoleFont ( const YCPString & console_magic, const YCPString & font, const YCPString & screen_map, const YCPString & unicode_map, const YCPString & encoding );
00152
00153
00154 YCPValue SetKeyboard ();
00155
00156
00157 YCPValue GetLanguage ( const YCPBoolean & strip );
00158
00159
00160 YCPValue UserInput();
00161
00162
00163 YCPValue PollInput ();
00164
00165
00166 YCPValue TimeoutUserInput ( const YCPInteger& timeout );
00167
00168
00169 YCPValue WaitForEvent ();
00170
00171
00172 YCPValue WaitForEvent( const YCPInteger & timeout );
00173
00174
00175 YCPValue OpenDialog( const YCPTerm & dialog_term );
00176
00177
00178 YCPValue OpenDialog( const YCPTerm & opts, const YCPTerm & dialog_term );
00179
00180
00181 YCPValue CloseDialog();
00182
00183
00184
00185 YCPValue ChangeWidget ( const YCPSymbol & widget_id, const YCPSymbol & property, const YCPValue & new_value );
00186
00187
00188
00189 YCPValue ChangeWidget ( const YCPTerm & widget_id, const YCPSymbol & property, const YCPValue & new_value );
00190
00191
00192
00193 YCPValue ChangeWidget ( const YCPTerm & widget_id, const YCPTerm & property, const YCPValue & new_value );
00194
00195
00196 YCPValue QueryWidget ( const YCPSymbol & widget_id, const YCPSymbol & property );
00197
00198
00199 YCPValue QueryWidget ( const YCPSymbol & widget_id, const YCPTerm & property );
00200
00201
00202 YCPValue QueryWidget ( const YCPTerm & widget_id, const YCPSymbol & property );
00203
00204
00205 YCPValue QueryWidget ( const YCPTerm & widget_id, const YCPTerm & property );
00206
00207
00208 YCPValue ReplaceWidget ( const YCPSymbol & widget_id, const YCPTerm & new_widget );
00209
00210
00211 YCPValue ReplaceWidget ( const YCPTerm & widget_id, const YCPTerm & new_widget );
00212
00213
00214 YCPValue SetFocus ( const YCPSymbol & widget_id );
00215
00216
00217 YCPValue SetFocus ( const YCPTerm & widget_id );
00218
00219
00220 YCPValue RunInTerminal ( const YCPString & command );
00221
00222
00223 YCPValue BusyCursor ();
00224
00225
00226 YCPValue RedrawScreen ();
00227
00228
00229 YCPValue NormalCursor ();
00230
00231
00232 YCPValue MakeScreenShot ( const YCPString & filename );
00233
00234
00235 YCPValue MakeScreenShot ();
00236
00237
00238 YCPValue DumpWidgetTree ();
00239
00240
00241 YCPValue Beep ();
00242
00243
00244 YCPValue RecordMacro ( const YCPString & filename );
00245
00246
00247 YCPValue StopRecordMacro ();
00248
00249
00250 YCPValue PlayMacro ( const YCPString & filename );
00251
00252
00253 YCPValue FakeUserInput ();
00254
00255
00256 YCPValue FakeUserInput ( const YCPValue & next_input );
00257
00258
00259 YCPValue Glyph ( const YCPSymbol & glyphSym );
00260
00261
00262 YCPValue GetDisplayInfo ();
00263
00264
00265 YCPValue RecalcLayout ();
00266
00267
00268 YCPValue PostponeShortcutCheck ();
00269
00270
00271 YCPValue CheckShortcuts ();
00272
00273
00274 YCPValue WidgetExists ( const YCPSymbol & widget_id );
00275
00276
00277 YCPValue WidgetExists ( const YCPTerm & widget_id );
00278
00279
00280 YCPValue RunPkgSelection ( const YCPValue & widget_id );
00281
00282
00283 YCPValue AskForExistingDirectory ( const YCPString & startDir, const YCPString & headline );
00284
00285
00286 YCPValue AskForExistingFile ( const YCPString & startWith, const YCPString & filter, const YCPString & headline );
00287
00288
00289 YCPValue AskForSaveFileName ( const YCPString & startWith, const YCPString & filter, const YCPString & headline );
00290
00291
00292 YCPValue SetFunctionKeys ( const YCPMap & new_fkeys );
00293
00294
00295 YCPValue Recode ( const YCPString & from, const YCPString & to, const YCPString & text );
00296
00297
00298 YCPValue SetModulename ( const YCPString & name );
00299
00300
00301 YCPValue HasSpecialWidget ( const YCPSymbol & widget );
00302
00303
00304 YCPValue WizardCommand ( const YCPTerm & command );
00305
00306
00307 YCPValue CollectUserInput ();
00308
00309
00310 YCPValue CollectUserInput( const YCPTerm & widget_id );
00311
00312 YCPValue
00313 CallHandler( void * ptr, int argc, YCPValue argv[] );
00314
00315 };