aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/Platform.h
diff options
context:
space:
mode:
authorscaraveo <unknown>2007-06-01 00:57:26 +0000
committerscaraveo <unknown>2007-06-01 00:57:26 +0000
commit710f716e96f6e9ee9eb410b343b78b3c4d95bc46 (patch)
tree55e5547869daa67b6a639c89825058baf75545c7 /include/Platform.h
parentcac98b923422b91839f7c285a9b78ea282cd6f0a (diff)
downloadscintilla-mirror-710f716e96f6e9ee9eb410b343b78b3c4d95bc46.tar.gz
integrate OS X support for scintilla. a big patch with a little commit message :)
- now uses namespaces (optionally for non-os x) to avoid conflicts with OS X libraries - several fixes in the OS X layer since the branch was commited in 2005 - used in Komodo since 2005, so pretty stable
Diffstat (limited to 'include/Platform.h')
-rw-r--r--include/Platform.h41
1 files changed, 39 insertions, 2 deletions
diff --git a/include/Platform.h b/include/Platform.h
index 60d7896ac..39e2b6eaf 100644
--- a/include/Platform.h
+++ b/include/Platform.h
@@ -16,6 +16,7 @@
#define PLAT_GTK 0
#define PLAT_GTK_WIN32 0
+#define PLAT_MACOSX 0
#define PLAT_WIN 0
#define PLAT_WX 0
#define PLAT_FOX 0
@@ -37,12 +38,19 @@
#define PLAT_GTK_WIN32 1
#endif
+#elif defined(MACOSX)
+#undef PLAT_MACOSX
+#define PLAT_MACOSX 1
+
#else
#undef PLAT_WIN
#define PLAT_WIN 1
#endif
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
// Underlying the implementation of the platform classes are platform specific types.
// Sometimes these need to be passed around by client code so they are defined here
@@ -360,9 +368,23 @@ typedef void (*CallBackAction)(void*);
class Window {
protected:
WindowID id;
+#ifdef PLAT_MACOSX
+ void *windowRef;
+ void *control;
+#endif
public:
- Window() : id(0), cursorLast(cursorInvalid) {}
- Window(const Window &source) : id(source.id), cursorLast(cursorInvalid) {}
+ Window() : id(0), cursorLast(cursorInvalid) {
+#ifdef PLAT_MACOSX
+ windowRef = 0;
+ control = 0;
+#endif
+ }
+ Window(const Window &source) : id(source.id), cursorLast(cursorInvalid) {
+#ifdef PLAT_MACOSX
+ windowRef = 0;
+ control = 0;
+#endif
+ }
virtual ~Window();
Window &operator=(WindowID id_) {
id = id_;
@@ -383,6 +405,10 @@ public:
enum Cursor { cursorInvalid, cursorText, cursorArrow, cursorUp, cursorWait, cursorHoriz, cursorVert, cursorReverseArrow, cursorHand };
void SetCursor(Cursor curs);
void SetTitle(const char *s);
+#ifdef PLAT_MACOSX
+ void SetWindow(void *ref) { windowRef = ref; };
+ void SetControl(void *_control) { control = _control; };
+#endif
private:
Cursor cursorLast;
};
@@ -474,6 +500,9 @@ public:
static int DefaultFontSize();
static unsigned int DoubleClickTime();
static bool MouseButtonBounce();
+#ifdef __APPLE__
+ static bool WaitMouseMoved(Point pt);
+#endif
static void DebugDisplay(const char *s);
static bool IsKeyDown(int key);
static long SendScintilla(
@@ -506,8 +535,16 @@ public:
#ifdef NDEBUG
#define PLATFORM_ASSERT(c) ((void)0)
#else
+#ifdef SCI_NAMESPACE
+#define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Scintilla::Platform::Assert(#c, __FILE__, __LINE__))
+#else
#define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Platform::Assert(#c, __FILE__, __LINE__))
#endif
+#endif
+
+#ifdef SCI_NAMESPACE
+}
+#endif
// Shut up annoying Visual C++ warnings:
#ifdef _MSC_VER