X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e0e5663fe4c8771d7e5d0c212fcf3f6cd9b1a37f..4c509aecb650100d0bca898ec05801a0fbcae1f4:/src/stc/scintilla/include/Platform.h?ds=sidebyside diff --git a/src/stc/scintilla/include/Platform.h b/src/stc/scintilla/include/Platform.h index 279a3df3ed..79be33f6ba 100644 --- a/src/stc/scintilla/include/Platform.h +++ b/src/stc/scintilla/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,18 +38,20 @@ #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 - -#if PLAT_WX -#include // For the global memory operators, if needed. +#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 @@ -69,7 +72,7 @@ public: int x; int y; - Point(int x_=0, int y_=0) : x(x_), y(y_) { + explicit Point(int x_=0, int y_=0) : x(x_), y(y_) { } // Other automatically defined methods (assignment, copy constructor, destructor) are fine @@ -119,6 +122,9 @@ public: } int Width() { return right - left; } int Height() { return bottom - top; } + bool Empty() { + return (Height() <= 0) || (Width() <= 0); + } }; /** @@ -241,12 +247,15 @@ class Window; // Forward declaration for Palette */ class Palette { int used; - enum {numEntries = 100}; - ColourPair entries[numEntries]; + int size; + ColourPair *entries; #if PLAT_GTK void *allocatedPalette; // GdkColor * int allocatedLen; #endif + // Private so Palette objects can not be copied + Palette(const Palette &) {} + Palette &operator=(const Palette &) { return *this; } public: #if PLAT_WIN void *hpal; @@ -284,7 +293,8 @@ public: Font(); virtual ~Font(); - virtual void Create(const char *faceName, int characterSet, int size, bool bold, bool italic, bool extraFontFlag=false); + virtual void Create(const char *faceName, int characterSet, int size, + bool bold, bool italic, bool extraFontFlag=false); virtual void Release(); FontID GetID() { return id; } @@ -323,6 +333,8 @@ public: virtual void FillRectangle(PRectangle rc, ColourAllocated back)=0; virtual void FillRectangle(PRectangle rc, Surface &surfacePattern)=0; virtual void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0; + virtual void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill, + ColourAllocated outline, int alphaOutline, int flags)=0; virtual void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0; virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource)=0; @@ -359,9 +371,23 @@ typedef void (*CallBackAction)(void*); class Window { protected: WindowID id; +#if 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) { +#if PLAT_MACOSX + windowRef = 0; + control = 0; +#endif + } + Window(const Window &source) : id(source.id), cursorLast(cursorInvalid) { +#if PLAT_MACOSX + windowRef = 0; + control = 0; +#endif + } virtual ~Window(); Window &operator=(WindowID id_) { id = id_; @@ -382,6 +408,11 @@ public: enum Cursor { cursorInvalid, cursorText, cursorArrow, cursorUp, cursorWait, cursorHoriz, cursorVert, cursorReverseArrow, cursorHand }; void SetCursor(Cursor curs); void SetTitle(const char *s); + PRectangle GetMonitorRect(Point pt); +#if PLAT_MACOSX + void SetWindow(void *ref) { windowRef = ref; }; + void SetControl(void *_control) { control = _control; }; +#endif private: Cursor cursorLast; }; @@ -397,9 +428,10 @@ public: static ListBox *Allocate(); virtual void SetFont(Font &font)=0; - virtual void Create(Window &parent, int ctrlID, int lineHeight_, bool unicodeMode_)=0; + virtual void Create(Window &parent, int ctrlID, Point location, int lineHeight_, bool unicodeMode_)=0; virtual void SetAverageCharWidth(int width)=0; virtual void SetVisibleRows(int rows)=0; + virtual int GetVisibleRows() const=0; virtual PRectangle GetDesiredRect()=0; virtual int CaretFromEdge()=0; virtual void Clear()=0; @@ -412,6 +444,7 @@ public: virtual void RegisterImage(int type, const char *xpm_data)=0; virtual void ClearRegisteredImages()=0; virtual void SetDoubleClickAction(CallBackAction, void *)=0; + virtual void SetList(const char* list, char separator, char typesep)=0; }; /** @@ -503,8 +536,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