Yast UI
YCP_UI.h
1 /****************************************************************************
2 
3 Copyright (c) 2000 - 2010 Novell, Inc.
4 All Rights Reserved.
5 
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of version 2 of the GNU General Public License as
8 published by the Free Software Foundation.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, contact Novell, Inc.
17 
18 To contact Novell about this file by physical or electronic mail,
19 you may find current contact information at www.novell.com
20 
21 ****************************************************************************
22 
23 
24  File: YCP_UI.cc
25 
26  Authors: Stefan Hundhammer <sh@suse.de>
27 
28 /-*/
29 
30 
31 #ifndef YCP_UI_h
32 #define YCP_UI_h
33 
34 #include <deque>
35 
36 #include <ycp/YCPString.h>
37 #include <ycp/YCPVoid.h>
38 #include <ycp/YCPTerm.h>
39 #include <ycp/YCPInteger.h>
40 #include <ycp/YCPMap.h>
41 #include <ycp/YCPBoolean.h>
42 
43 
44 class YCP_UI
45 {
46 public:
47  //
48  // UI Built-ins. Each function directly corresponds to a YCP UI::Something() call.
49  //
50  // See the documentation at the function definitions for details
51  //
52 
53  static YCPValue AskForExistingDirectory ( const YCPString & startDir, const YCPString & headline );
54  static YCPValue AskForExistingFile ( const YCPString & startDir, const YCPString & filter, const YCPString & headline );
55  static YCPValue AskForSaveFileName ( const YCPString & startDir, const YCPString & filter, const YCPString & headline );
56  static void BusyCursor ();
57  static void Beep ();
58  static YCPValue ChangeWidget ( const YCPValue & widgetId, const YCPValue & property, const YCPValue & new_value );
59  static void CheckShortcuts ();
60  static YCPValue CloseDialog ();
61  static void CloseUI ();
62  static void DumpWidgetTree ();
63  static void FakeUserInput ( const YCPValue & nextInput );
64  static YCPMap GetDisplayInfo ();
65  static YCPString GetLanguage ( const YCPBoolean & stripEncoding );
66  static YCPString GetProductName ();
67  static YCPString Glyph ( const YCPSymbol & symbol );
68  static YCPValue HasSpecialWidget ( const YCPSymbol & widget );
69  static void MakeScreenShot ( const YCPString & filename );
70  static void NormalCursor ();
71  static YCPBoolean OpenContextMenu ( const YCPTerm & term );
72  static YCPBoolean OpenDialog ( const YCPTerm & opts, const YCPTerm & dialogTerm );
73  static void OpenUI ();
74  static void PlayMacro ( const YCPString & filename );
75  static void PostponeShortcutCheck ();
76  static YCPValue QueryWidget ( const YCPValue & widgetId, const YCPValue& property );
77  static void RecalcLayout ();
78  static YCPValue Recode ( const YCPString & fromEncoding, const YCPString & toEncoding, const YCPString & text );
79  static void RecordMacro ( const YCPString & fileName );
80  static void RedrawScreen ();
81  static YCPBoolean ReplaceWidget ( const YCPValue & widgetId, const YCPTerm & term );
82  static YCPValue RunPkgSelection ( const YCPValue & widgetId );
83  static void SetConsoleFont ( const YCPString & magic,
84  const YCPString & font,
85  const YCPString & screen_map,
86  const YCPString & unicode_map,
87  const YCPString & encoding );
88  static void SetKeyboard ();
89  static YCPInteger RunInTerminal ( const YCPString & module);
90  static YCPBoolean SetFocus ( const YCPValue & widgetId );
91  static void SetFunctionKeys ( const YCPMap & functionKeyMap );
92  static void SetLanguage ( const YCPString & lang, const YCPString & encoding = YCPNull() );
93  static void SetProductName ( const YCPString & name );
94  static void StopRecordMacro ();
95  static YCPBoolean WidgetExists ( const YCPValue & widgetId );
96  static YCPValue UserInput ();
97  static YCPValue TimeoutUserInput ( const YCPInteger & timeout );
98  static YCPValue WaitForEvent ( const YCPInteger & timeout = YCPNull() );
99  static YCPValue WizardCommand ( const YCPTerm & command );
100  static YCPValue PollInput ();
101  static YCPBoolean TextMode ();
102  static YCPValue SetReleaseNotes ( const YCPMap & relnotes );
103  static YCPValue SetProductLogo ( const YCPBoolean & show_logo);
104  static YCPValue SetApplicationIcon ( const YCPString & icon);
105  static YCPValue SetApplicationTitle ( const YCPString & text);
106 
107 
108 
112  static YCPValue evaluateCallback ( const YCPTerm & term, bool to_wfm );
113 
114 protected:
115 
135  static YCPValue doUserInput( const char * builtin_name,
136  long timeout_millisec,
137  bool wait,
138  bool detailed );
139 
140  //
141  // Data members
142  //
143 
148  static std::deque<YCPValue> _fakeUserInputQueue;
149 
150 
151 private:
152  YCP_UI() {}
153  ~YCP_UI() {}
154 };
155 
156 #endif // YCP_UI_h
static YCPValue RunPkgSelection(const YCPValue &widgetId)
Initializes and run the PackageSelector widget.
Definition: YCP_UI.cc:1397
static YCPValue WaitForEvent(const YCPInteger &timeout=YCPNull())
Waits for Event.
Definition: YCP_UI.cc:381
static YCPValue SetApplicationTitle(const YCPString &text)
Sets the title for application.
Definition: YCP_UI.cc:1720
static YCPInteger RunInTerminal(const YCPString &module)
runs external program in the same terminal
Definition: YCP_UI.cc:241
static void RedrawScreen()
Redraws the screen.
Definition: YCP_UI.cc:1067
static YCPValue ChangeWidget(const YCPValue &widgetId, const YCPValue &property, const YCPValue &new_value)
Changes widget contents.
Definition: YCP_UI.cc:669
static void SetProductName(const YCPString &name)
Sets Product Name.
Definition: YCP_UI.cc:189
static YCPValue WizardCommand(const YCPTerm &command)
Runs a wizard command.
Definition: YCP_UI.cc:909
static YCPValue doUserInput(const char *builtin_name, long timeout_millisec, bool wait, bool detailed)
Definition: YCP_UI.cc:403
static void CloseUI()
Closes NCurses and enables stdout.
Definition: YCP_UI.cc:645
static void SetLanguage(const YCPString &lang, const YCPString &encoding=YCPNull())
Sets the language of the UI.
Definition: YCP_UI.cc:144
static void BusyCursor()
Sets the mouse cursor to the busy cursor.
Definition: YCP_UI.cc:991
static YCPValue PollInput()
Poll Input.
Definition: YCP_UI.cc:328
static void FakeUserInput(const YCPValue &nextInput)
Fakes User Input.
Definition: YCP_UI.cc:1192
static void RecordMacro(const YCPString &fileName)
Records Macro into a file.
Definition: YCP_UI.cc:1139
Definition: YCP_UI.h:44
static void SetFunctionKeys(const YCPMap &functionKeyMap)
Sets the (default) function keys for a number of buttons.
Definition: YCP_UI.cc:1530
static void DumpWidgetTree()
Debugging function.
Definition: YCP_UI.cc:1102
static void OpenUI()
Opens NCurses and disables stdout.
Definition: YCP_UI.cc:632
static void RecalcLayout()
Recalculates Layout.
Definition: YCP_UI.cc:1277
static void Beep()
Beeps the system bell.
Definition: YCP_UI.cc:1125
static YCPBoolean WidgetExists(const YCPValue &widgetId)
Checks whether or not a widget with the given ID currently exists.
Definition: YCP_UI.cc:1372
static void PlayMacro(const YCPString &filename)
Plays a recorded macro.
Definition: YCP_UI.cc:1172
static std::deque< YCPValue > _fakeUserInputQueue
Definition: YCP_UI.h:148
static YCPValue AskForExistingDirectory(const YCPString &startDir, const YCPString &headline)
Ask user for existing directory.
Definition: YCP_UI.cc:1450
static YCPValue AskForExistingFile(const YCPString &startDir, const YCPString &filter, const YCPString &headline)
Ask user for existing file.
Definition: YCP_UI.cc:1475
static YCPValue TimeoutUserInput(const YCPInteger &timeout)
User Input with Timeout.
Definition: YCP_UI.cc:356
static YCPBoolean SetFocus(const YCPValue &widgetId)
Sets Focus to the specified widget.
Definition: YCP_UI.cc:949
static YCPBoolean ReplaceWidget(const YCPValue &widgetId, const YCPTerm &term)
Definition: YCP_UI.cc:831
static YCPValue AskForSaveFileName(const YCPString &startDir, const YCPString &filter, const YCPString &headline)
Ask user for a file to save data to.
Definition: YCP_UI.cc:1502
static YCPValue evaluateCallback(const YCPTerm &term, bool to_wfm)
Definition: YCP_UI.cc:1604
static void MakeScreenShot(const YCPString &filename)
Makes Screen Shot.
Definition: YCP_UI.cc:1085
static YCPValue Recode(const YCPString &fromEncoding, const YCPString &toEncoding, const YCPString &text)
Recodes encoding of string from or to "UTF-8" encoding.
Definition: YCP_UI.cc:1575
static YCPBoolean OpenContextMenu(const YCPTerm &term)
Definition: YCP_UI.cc:1652
static YCPString Glyph(const YCPSymbol &symbol)
Returns a special character (a &#39;glyph&#39;)
Definition: YCP_UI.cc:1222
static YCPValue QueryWidget(const YCPValue &widgetId, const YCPValue &property)
Queries Widget contents.
Definition: YCP_UI.cc:759
static void StopRecordMacro()
Stops recording macro.
Definition: YCP_UI.cc:1155
static YCPValue UserInput()
User Input.
Definition: YCP_UI.cc:300
static YCPString GetProductName()
Gets Product Name.
Definition: YCP_UI.cc:164
static YCPValue SetReleaseNotes(const YCPMap &relnotes)
Sets the Release Notes to be displayed by a special-purpose button.
Definition: YCP_UI.cc:1672
static YCPBoolean OpenDialog(const YCPTerm &opts, const YCPTerm &dialogTerm)
Opens a Dialog with options.
Definition: YCP_UI.cc:539
static YCPValue CloseDialog()
Closes an open dialog.
Definition: YCP_UI.cc:612
static YCPMap GetDisplayInfo()
Gets Display Info.
Definition: YCP_UI.cc:1239
static void CheckShortcuts()
Performs an explicit shortcut check after postponing shortcut checks.
Definition: YCP_UI.cc:1348
static YCPValue HasSpecialWidget(const YCPSymbol &widget)
Checks for support of a special widget type.
Definition: YCP_UI.cc:90
static YCPBoolean TextMode()
Check if the UI is running in text (NCurses) mode.
Definition: YCP_UI.cc:1046
static void SetKeyboard()
Sets Keyboard.
Definition: YCP_UI.cc:254
static void NormalCursor()
Sets the mouse cursor to the normal cursor.
Definition: YCP_UI.cc:1012
static YCPString GetLanguage(const YCPBoolean &stripEncoding)
Gets Language.
Definition: YCP_UI.cc:281
static void SetConsoleFont(const YCPString &magic, const YCPString &font, const YCPString &screen_map, const YCPString &unicode_map, const YCPString &encoding)
Sets Console Font.
Definition: YCP_UI.cc:212
static void PostponeShortcutCheck()
Postpones Shortcut Check.
Definition: YCP_UI.cc:1320