Y2UINamespace.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                      __   __    ____ _____ ____                      |
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00005 |                       \ V / _` \___ \ | |   __) |                    |
00006 |                        | | (_| |___) || |  / __/                     |
00007 |                        |_|\__,_|____/ |_| |_____|                    |
00008 |                                                                      |
00009 |                               core system                            |
00010 |                                                        (C) SuSE GmbH |
00011 \----------------------------------------------------------------------/
00012 
00013    File:        Y2UINamespace.h
00014 
00015    Authors:     Stanislav Visnovsky <visnov@suse.cz>
00016 
00017    Maintainer:  Stefan Hundhammer <sh@suse.de>
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     // attachParameter, appendParameter, reset from parent: fine   
00089     // wantedParameterType from parent: kind of fine
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         /* TYPEINFO: void (string) */
00139         YCPValue SetLanguage ( const YCPString & language );
00140 
00141         /* TYPEINFO: void (string, string) */
00142         YCPValue SetLanguage ( const YCPString & language, const YCPString & encoding );
00143 
00144         /* TYPEINFO: string () */
00145         YCPValue GetProductName ();
00146 
00147         /* TYPEINFO: void (string) */
00148         YCPValue SetProductName ( const YCPString & name );
00149 
00150         /* TYPEINFO: void (string, string, string, string, string) */
00151         YCPValue SetConsoleFont ( const YCPString & console_magic, const YCPString & font, const YCPString & screen_map, const YCPString & unicode_map, const YCPString & encoding );
00152 
00153         /* TYPEINFO: void () */
00154         YCPValue SetKeyboard ();
00155 
00156         /* TYPEINFO: string (boolean) */
00157         YCPValue GetLanguage ( const YCPBoolean & strip );
00158 
00159         /* TYPEINFO: any() */
00160         YCPValue UserInput();
00161 
00162         /* TYPEINFO: any () */
00163         YCPValue PollInput ();
00164 
00165         /* TYPEINFO: any (integer) */
00166         YCPValue TimeoutUserInput ( const YCPInteger& timeout );
00167 
00168         /* TYPEINFO: map<string,any> () */
00169         YCPValue WaitForEvent ();
00170 
00171         /* TYPEINFO: map<string,any> (integer) */
00172         YCPValue WaitForEvent( const YCPInteger & timeout );
00173 
00174         /* TYPEINFO: void(term) */
00175         YCPValue OpenDialog( const YCPTerm & dialog_term );
00176 
00177         /* TYPEINFO: void(term,term) */
00178         YCPValue OpenDialog( const YCPTerm & opts, const YCPTerm & dialog_term );
00179 
00180         /* TYPEINFO: boolean() */
00181         YCPValue CloseDialog();
00182 
00183         // TODO DECL_NIL?
00184         /* TYPEINFO: boolean (symbol, symbol, any) */
00185         YCPValue ChangeWidget ( const YCPSymbol & widget_id, const YCPSymbol & property, const YCPValue & new_value );
00186 
00187         // TODO DECL_NIL?
00188         /* TYPEINFO: boolean (term, symbol, any) */
00189         YCPValue ChangeWidget ( const YCPTerm & widget_id, const YCPSymbol & property, const YCPValue & new_value );
00190 
00191         // TODO DECL_NIL?
00192         /* TYPEINFO: boolean (term, term, any) */
00193         YCPValue ChangeWidget ( const YCPTerm & widget_id, const YCPTerm & property, const YCPValue & new_value );
00194 
00195         /* TYPEINFO: any (symbol, symbol) */
00196         YCPValue QueryWidget ( const YCPSymbol & widget_id, const YCPSymbol & property );
00197 
00198         /* TYPEINFO: any (symbol, term) */
00199         YCPValue QueryWidget ( const YCPSymbol & widget_id, const YCPTerm & property );
00200 
00201         /* TYPEINFO: any (term, symbol) */
00202         YCPValue QueryWidget ( const YCPTerm & widget_id, const YCPSymbol & property );
00203 
00204         /* TYPEINFO: any (term, term) */
00205         YCPValue QueryWidget ( const YCPTerm & widget_id, const YCPTerm & property );
00206 
00207         /* TYPEINFO: boolean (symbol, term) */
00208         YCPValue ReplaceWidget ( const YCPSymbol & widget_id, const YCPTerm & new_widget );
00209 
00210         /* TYPEINFO: boolean (term, term) */
00211         YCPValue ReplaceWidget ( const YCPTerm & widget_id, const YCPTerm & new_widget );
00212 
00213         /* TYPEINFO: boolean (symbol) */
00214         YCPValue SetFocus ( const YCPSymbol & widget_id );
00215 
00216         /* TYPEINFO: boolean (term) */
00217         YCPValue SetFocus ( const YCPTerm & widget_id );
00218 
00219         /* TYPEINFO: integer (string) */
00220         YCPValue RunInTerminal ( const YCPString & command );
00221 
00222         /* TYPEINFO: void () */
00223         YCPValue BusyCursor ();
00224 
00225         /* TYPEINFO: void () */
00226         YCPValue RedrawScreen ();
00227 
00228         /* TYPEINFO: void () */
00229         YCPValue NormalCursor ();
00230 
00231         /* TYPEINFO: void (string) */
00232         YCPValue MakeScreenShot ( const YCPString & filename );
00233 
00234         /* TYPEINFO: void () */
00235         YCPValue MakeScreenShot ();
00236 
00237         /* TYPEINFO: void () */
00238         YCPValue DumpWidgetTree ();
00239 
00240         /* TYPEINFO: void () */
00241         YCPValue Beep ();
00242 
00243         /* TYPEINFO: void (string) */
00244         YCPValue RecordMacro ( const YCPString & filename );
00245 
00246         /* TYPEINFO: void () */
00247         YCPValue StopRecordMacro ();
00248 
00249         /* TYPEINFO: void (string) */
00250         YCPValue PlayMacro ( const YCPString & filename );
00251 
00252         /* TYPEINFO: void () */
00253         YCPValue FakeUserInput ();
00254 
00255         /* TYPEINFO: void (any) */
00256         YCPValue FakeUserInput ( const YCPValue & next_input );
00257 
00258         /* TYPEINFO: string (symbol) */
00259         YCPValue Glyph ( const YCPSymbol & glyphSym  );
00260 
00261         /* TYPEINFO: map<string,any> () */
00262         YCPValue GetDisplayInfo ();
00263 
00264         /* TYPEINFO: void () */
00265         YCPValue RecalcLayout ();
00266 
00267         /* TYPEINFO: void () */
00268         YCPValue PostponeShortcutCheck ();
00269 
00270         /* TYPEINFO: void () */
00271         YCPValue CheckShortcuts ();
00272 
00273         /* TYPEINFO: boolean (symbol) */
00274         YCPValue WidgetExists ( const YCPSymbol & widget_id );
00275 
00276         /* TYPEINFO: boolean (term) */
00277         YCPValue WidgetExists ( const YCPTerm & widget_id );
00278 
00279         /* TYPEINFO: any (term) */
00280         YCPValue RunPkgSelection ( const YCPValue & widget_id );
00281 
00282         /* TYPEINFO: string (string, string) */
00283         YCPValue AskForExistingDirectory ( const YCPString & startDir, const YCPString & headline );
00284 
00285         /* TYPEINFO: string (string, string, string) */
00286         YCPValue AskForExistingFile ( const YCPString & startWith, const YCPString & filter, const YCPString & headline  );
00287 
00288         /* TYPEINFO: string (string, string, string) */
00289         YCPValue AskForSaveFileName ( const YCPString & startWith, const YCPString & filter, const YCPString & headline );
00290 
00291         /* TYPEINFO: void (map<string,integer>) */
00292         YCPValue SetFunctionKeys ( const YCPMap & new_fkeys );
00293 
00294         /* TYPEINFO: any (string, string, string) */
00295         YCPValue Recode ( const YCPString & from, const YCPString & to, const YCPString & text );
00296 
00297         /* TYPEINFO: void (string) */
00298         YCPValue SetModulename ( const YCPString & name );
00299 
00300         /* TYPEINFO: boolean (symbol) */
00301         YCPValue HasSpecialWidget ( const YCPSymbol & widget );
00302 
00303         /* TYPEINFO: boolean (term) */
00304         YCPValue WizardCommand ( const YCPTerm & command );
00305 
00306         /* TYPEINFO:list<map<string,any>> () */
00307         YCPValue CollectUserInput ();
00308 
00309         /* TYPEINFO:list<map<string,any>> (term) */
00310         YCPValue CollectUserInput( const YCPTerm & widget_id );
00311 
00312 YCPValue
00313 CallHandler( void * ptr, int argc, YCPValue argv[] );
00314 
00315 };

Generated on Tue Nov 6 01:27:46 2007 for yast2-core by  doxygen 1.5.3