#pragma warning(disable: 4800 4244 4309)
#endif
#include <windows.h>
+#include <commctrl.h>
#include <richedit.h>
#endif
typedef wxMenu* MenuID;
#endif
-#if PLAT_GTK || PLAT_WX
-#define SHIFT_PRESSED 1
-#define LEFT_CTRL_PRESSED 2
-#define LEFT_ALT_PRESSED 4
-#endif
-
// Point is exactly the same as the Win32 POINT and GTK+ GdkPoint so can be used interchangeably
class Point {
};
class Font {
+protected:
FontID id;
#if PLAT_WX
int ascent;
Font &operator=(const Font &) { id=0; return *this; }
public:
Font();
- ~Font();
+ virtual ~Font();
- void Create(const char *faceName, int size, bool bold=false, bool italic=false);
- void Release();
+ virtual void Create(const char *faceName, int characterSet, int size, bool bold, bool italic);
+ virtual void Release();
FontID GetID() { return id; }
+ // Alias another font - caller guarantees not to Release
+ void SetID(FontID id_) { id = id_; }
friend class Surface;
};
// A surface abstracts a place to draw
class Surface {
private:
+ bool unicodeMode;
#if PLAT_GTK
GdkDrawable *drawable;
GdkGC *gc;
bool Initialised();
void PenColour(Colour fore);
int LogPixelsY();
+ int DeviceHeightFont(int points);
void MoveTo(int x_, int y_);
void LineTo(int x_, int y_);
void Polygon(Point *pts, int npts, Colour fore, Colour back);
int SetPalette(Palette *pal, bool inBackGround);
void SetClip(PRectangle rc);
+ void FlushCachedState();
+
+ void SetUnicodeMode(bool unicodeMode_) {
+ unicodeMode=unicodeMode_;
+ }
};
// Class to hide the details of window manipulation
WindowID id;
public:
Window() : id(0) {}
+ Window(const Window &source) : id(source.id) {}
virtual ~Window();
Window &operator=(WindowID id_) {
id = id_;
void Show(bool show=true);
void InvalidateAll();
void InvalidateRectangle(PRectangle rc);
- void SetFont(Font &font);
+ virtual void SetFont(Font &font);
enum Cursor { cursorText, cursorArrow, cursorUp, cursorWait, cursorHoriz, cursorVert, cursorReverseArrow };
void SetCursor(Cursor curs);
void SetTitle(const char *s);
WindowID scroller;
int current;
#endif
+ int desiredVisibleRows;
+ unsigned int maxItemCharacters;
+ unsigned int aveCharWidth;
public:
ListBox();
virtual ~ListBox();
- ListBox &operator=(WindowID id_) {
- id = id_;
- return *this;
- }
void Create(Window &parent, int ctrlID);
+ virtual void SetFont(Font &font);
+ void SetAverageCharWidth(int width);
+ void SetVisibleRows(int rows);
+ PRectangle GetDesiredRect();
void Clear();
void Append(char *s);
int Length();
// These are utility functions not really tied to a platform
static int Minimum(int a, int b);
static int Maximum(int a, int b);
+ // Next three assume 16 bit shorts and 32 bit longs
+ static long LongFromTwoShorts(short a,short b) {
+ return (a) | ((b) << 16);
+ }
+ static short HighShortFromLong(long x) {
+ return static_cast<short>(x >> 16);
+ }
+ static short LowShortFromLong(long x) {
+ return static_cast<short>(x & 0xffff);
+ }
static void DebugPrintf(const char *format, ...);
static int Clamp(int val, int minVal, int maxVal);
};