Hasty Badger
Small UI library (a branch of Turbo Badger)
 All Classes Namespaces Functions Variables Enumerations Enumerator Friends Groups Pages
tb_system.h
1 // ================================================================================
2 // == This file is a part of Turbo Badger. (C) 2011-2014, Emil SegerÃ¥s ==
3 // == See tb_core.h for more information. ==
4 // ================================================================================
5 
6 #ifndef TB_SYSTEM_H
7 #define TB_SYSTEM_H
8 
9 #include "tb_core.h"
10 #include "tb_str.h"
11 
12 namespace tb {
13 
14 // == Platform interface ===================================================
15 
17 class TBSystem
18 {
19 public:
21  static double GetTimeMS();
22 
27  static void RescheduleTimer(double fire_time);
28 
31  static int GetLongClickDelayMS();
32 
34  static int GetPanThreshold();
35 
38  static int GetPixelsPerLine();
39 
41  static int GetDPI();
42 
44  static void SetDPI(int dpi);
45 
46 private:
47  static int _dpi; //< the current dpi value
48 };
49 
52 {
53 public:
55  static void Empty();
56 
58  static bool HasText();
59 
61  static bool SetText(const TBStr & text);
62 
65  static bool GetText(TBStr &text);
66 };
67 
69 class TBFile
70 {
71 public:
72  enum TBFileMode { MODE_READ, MODE_WRITETRUNC };
73  static TBFile *Open(const TBStr & filename, TBFileMode mode);
74 
75  virtual ~TBFile() {}
76  virtual long Size() = 0;
77  virtual size_t Read(void *buf, size_t elemSize, size_t count) = 0;
78  virtual size_t Write(const void *buf, size_t elemSize, size_t count) = 0;
79  virtual size_t Write(const TBStr & str) = 0;
80 };
81 
82 } // namespace tb
83 
84 #endif // TB_SYSTEM_H
static void SetDPI(int dpi)
Set Dots Per Inch for the main screen.
static void Empty()
Empty the contents of the clipboard.
TBSystem is porting interface for the underlaying OS.
Definition: tb_system.h:17
static void RescheduleTimer(double fire_time)
Called when the need to call TBMessageHandler::ProcessMessages has changed due to changes in the mess...
static bool SetText(const TBStr &text)
Set the text of the clipboard in UTF-8 format.
static int GetDPI()
Get Dots Per Inch for the main screen.
static int GetLongClickDelayMS()
Get how many milliseconds it should take after a touch down event should generate a long click event...
static int GetPanThreshold()
Get how many pixels of dragging should start panning scrollable widgets.
static int GetPixelsPerLine()
Get how many pixels a typical line is: The length that should be scrolled when turning a mouse wheel ...
TBStr is a simple string class.
Definition: tb_str.h:62
static bool HasText()
Return true if the clipboard currently contains text.
TBFile is a portable interface for file access.
Definition: tb_system.h:69
static double GetTimeMS()
Get the system time in milliseconds since some undefined epoch.
TBClipboard is a portable interface for the clipboard.
Definition: tb_system.h:51
static bool GetText(TBStr &text)
Get the text from the clipboard in UTF-8 format.