5 #ifndef BALL_VIEW_WIDGETS_PYWIDGET_H
6 #define BALL_VIEW_WIDGETS_PYWIDGET_H
12 #ifndef BALL_DATATYPE_STRING_H
16 #ifndef BALL_VIEW_WIDGETS_DOCKWIDGET_H
20 #ifndef BALL_VIEW_WIDGETS_TEXTEDITORWIDGET_H
24 #include <QtGui/QDragEnterEvent>
25 #include <QtGui/QKeyEvent>
26 #include <QtGui/QDropEvent>
27 #include <QtGui/QLineEdit>
28 #include <QtGui/QComboBox>
29 #include <QtGui/QTabWidget>
30 #include <QtGui/QSyntaxHighlighter>
31 #include <QtGui/QValidator>
32 #include <QtCore/QStringList>
34 #include <QtCore/QThread>
37 #undef BALL_QT_HAS_THREADS
47 class RunPythonThread;
61 void compilePattern();
62 void highlightBlock(
const QString& text);
86 virtual State validate(QString& input,
int& pos)
const;
110 bool& ok,
String comment =
"");
125 bool set(
const String& data);
128 void get(
String& data)
const;
152 void setPyWidget(
PyWidget* pw) { pw_ = pw;}
156 virtual void keyPressEvent(QKeyEvent* event);
168 void setPyWidget(
PyWidget* pw) { pw_ = pw;}
172 virtual void keyPressEvent(QKeyEvent* event);
177 friend class MyLineEdit;
213 virtual void initializeWidget(
MainControl& main_control);
217 virtual void finalizeWidget(
MainControl& main_control);
220 void initializePreferencesTab(
Preferences &preferences);
223 void finalizePreferencesTab(
Preferences &preferences);
226 virtual void applyPreferences();
229 virtual void scriptDialog(
bool run =
false);
232 bool toAbortScript();
244 void insertHotkey(
const Hotkey& hotkey);
247 void removeHotkey(
const Hotkey& hotkey);
250 void reactTo(
const QKeyEvent& e);
257 virtual bool canHandle(
const String& fileformat)
const;
263 virtual bool openFile(
const String& filename);
268 bool openFile(
const String& filename,
bool run,
bool is_current =
false);
271 bool runString(
String command);
274 String getCurrentLine()
const;
277 void dump(std::ostream& s,
Size depth)
const;
283 virtual void fetchPreferences(
INIFile& inifile);
286 virtual void writePreferences(
INIFile& inifile);
292 QString getCurrentScript();
295 bool isInDirectMode()
const;
300 void showEditContextMenu(
const QPoint& point);
303 void showContextMenu(
const QPoint& point);
306 void showCompletion();
312 void exportHistory();
318 void showDocumentation();
321 bool runCurrentScript();
335 virtual void hotkeyItem();
337 virtual void modifyHotkeys();
339 void appendText(
const String& text,
bool output =
false,
bool state_message =
false);
341 bool getMembers(
const String& classname, QStringList& sl,
const String& prefix);
345 virtual bool returnPressed();
347 virtual bool completionSelected_();
349 virtual void showHelp_();
351 virtual void printCursorPosition_();
353 virtual void createScript_();
355 virtual void clearHistory_();
359 bool getClassAndMember_(
String toc);
361 void setError_(
bool state);
368 virtual void startInterpreter();
370 virtual void paste();
373 bool parseLine_(
String line);
375 void appendToHistory_(
const String& line);
384 bool testMultilineStart_(
const String& line);
387 const char* getPrompt_()
const;
403 void retrieveHistoryLine_(
Position index);
405 virtual void contentsDragEnterEvent(QDragEnterEvent* e);
407 virtual void contentsDropEvent(QDropEvent* e);
409 bool keyPressed(QKeyEvent* e);
411 void createMenuHelpEntry_(QMenu* menu,
TextEditorWidget* text_edit,
const QPoint& point);
413 void findError_(
String result);
415 String getCurrentWord_(QTextCursor& text_cursor);
417 QComboBox* getCompletionBox_();
419 std::list<Hotkey>::iterator findKey_(
Hotkey& hotkey);
458 #endif // BALL_VIEW_WIDGETS_PYWIDGET_H
QTextCharFormat my_class_format
QTextCharFormat string_format
QStringList BALL_keywords
Qt::KeyboardModifiers button_state
vector< QRegExp > python_patterns
QTextCharFormat comment_format
vector< QRegExp > BALL_patterns
#define BALL_EMBEDDABLE(TYPE, BASE)
BALL_EXPORT bool operator==(const String &s1, const String &s2)
QTextCharFormat python_format
QStringList python_keywords
BALL_EXPORT bool operator<(const String &s1, const String &s2)