Menu

[b84aab]: / src / platform / common / system.h  Maximize  Restore  History

Download this file

86 lines (76 with data), 2.5 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// This file is part of SmallBASIC
//
// Copyright(C) 2001-2013 Chris Warren-Smith.
//
// This program is distributed under the terms of the GPL v2.0 or later
// Download the GNU Public License (GPL) from www.gnu.org
//
#ifndef SYSTEM_H
#define SYSTEM_H
#include "platform/common/StringLib.h"
#include "platform/common/ansiwidget.h"
struct System : public IButtonListener {
System();
virtual ~System();
void buttonClicked(const char *action);
int getPen(int code);
char *getText(char *dest, int maxSize);
bool isActive() { return _state != kInitState && _state != kDoneState; }
bool isBack() { return _state == kBackState; }
bool isBreak() { return _state >= kBreakState; }
bool isClosing() { return _state >= kClosingState; }
bool isInitial() { return _state == kInitState; }
bool isModal() { return _state == kModalState; }
bool isRestart() { return _state == kRestartState; }
bool isRunning() { return _state == kRunState || _state == kModalState; }
bool isSystemScreen() { return _systemScreen; }
char *readSource(const char *fileName);
void setBack();
void setRunning(bool running);
void systemPrint(const char *msg, ...);
AnsiWidget *_output;
virtual MAEvent processEvents(int waitFlag) = 0;
virtual void setExit(bool quit) = 0;
virtual char *loadResource(const char *fileName);
protected:
MAEvent getNextEvent() { return processEvents(1); }
void handleEvent(MAEvent event);
void handleMenu(int menuId);
void resize();
void runMain(const char *mainBasPath);
void runOnce(const char *startupBas);
void setPath(const char *filename);
bool setParentPath();
void showCompletion(bool success);
void showError();
void checkLoadError();
void showSystemScreen(bool showSrc);
void showMenu();
enum {
kInitState = 0,// thread not active
kActiveState, // thread activated
kRunState, // program is running
kRestartState, // running program should restart
kModalState, // retrieving user input inside program
kConnState, // retrieving remote program source
kBreakState, // running program should abort
kBackState, // back button detected
kClosingState, // thread is terminating
kDoneState // thread has terminated
} _state;
strlib::String _loadPath;
int _lastEventTime;
int _eventTicks;
int _touchX;
int _touchY;
int _touchCurX;
int _touchCurY;
int _initialFontSize;
int _fontScale;
int _overruns;
bool _systemMenu;
bool _systemScreen;
bool _mainBas;
char *_programSrc;
};
#endif
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.