#line 116 "d:\\sdk\\Microsoft SDK\\include\\reason.h" #line 810 "d:\\sdk\\Microsoft SDK\\include\\winreg.h" __declspec(dllimport) BOOL __stdcall InitiateSystemShutdownExA( LPSTR lpMachineName, LPSTR lpMessage, DWORD dwTimeout, BOOL bForceAppsClosed, BOOL bRebootAfterShutdown, DWORD dwReason ); __declspec(dllimport) BOOL __stdcall InitiateSystemShutdownExW( LPWSTR lpMachineName, LPWSTR lpMessage, DWORD dwTimeout, BOOL bForceAppsClosed, BOOL bRebootAfterShutdown, DWORD dwReason ); #line 855 "d:\\sdk\\Microsoft SDK\\include\\winreg.h" __declspec(dllimport) LONG __stdcall RegSaveKeyExA ( HKEY hKey, LPCSTR lpFile, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD Flags ); __declspec(dllimport) LONG __stdcall RegSaveKeyExW ( HKEY hKey, LPCWSTR lpFile, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD Flags ); #line 880 "d:\\sdk\\Microsoft SDK\\include\\winreg.h" __declspec(dllimport) LONG __stdcall Wow64Win32ApiEntry ( DWORD dwFuncNumber, DWORD dwFlag, DWORD dwRes ); } #line 893 "d:\\sdk\\Microsoft SDK\\include\\winreg.h" #line 896 "d:\\sdk\\Microsoft SDK\\include\\winreg.h" #line 4 "u:/idisapp\\Core/Win32Util.h" inline bool IsWinNT() { return GetVersion() < 0x80000000; } bool IsWin2K(); bool IsWinXP(); bool IsWinVista(); #line 16 "u:/idisapp\\Core/Win32Util.h" HINSTANCE AppGetHandle(); void AppSetHandle(HINSTANCE dll_instance); String AsString(const wchar_t *buffer); String AsString(const wchar_t *buffer, int count); String AsString(const wchar_t *buffer, const wchar_t *end); String GetWinRegString(const char *value, const char *path, HKEY base_key = (( HKEY ) (ULONG_PTR)((LONG)0x80000002) )); int GetWinRegInt(const char *value, const char *path, HKEY base_key = (( HKEY ) (ULONG_PTR)((LONG)0x80000002) )); bool SetWinRegString(const String& string, const char *value, const char *path, HKEY base_key = (( HKEY ) (ULONG_PTR)((LONG)0x80000002) )); bool SetWinRegExpandString(const String& string, const char *value, const char *path, HKEY base_key); bool SetWinRegInt(int data, const char *value, const char *path, HKEY base_key = (( HKEY ) (ULONG_PTR)((LONG)0x80000002) )); void DeleteWinReg(const String& key, HKEY base = (( HKEY ) (ULONG_PTR)((LONG)0x80000002) )); String GetSystemDirectoryA(); String GetWindowsDirectoryA(); #line 35 "u:/idisapp\\Core/Win32Util.h" String GetModuleFileNameA(HINSTANCE instance = AppGetHandle()); class SyncObject { protected: HANDLE handle; public: bool Wait(int time_ms); bool Wait(); HANDLE GetHandle() const { return handle; } SyncObject(); ~SyncObject(); }; class Event : public SyncObject { public: void Set(); Event(); }; #line 61 "u:/idisapp\\Core/Win32Util.h" #line 449 "u:/idisapp\\Core/Core.h" #line 453 "u:/idisapp\\Core/Core.h" inline void AssertMoveable0(POINT *) {} inline void AssertMoveable0(SIZE *) {} inline void AssertMoveable0(RECT *) {} #line 459 "u:/idisapp\\Core/Core.h" }; #line 476 "u:/idisapp\\Core/Core.h" inline Upp::int64 abs(Upp::int64 x) { return x < 0 ? -x : x; } #line 482 "u:/idisapp\\Core/Core.h" void RegisterTopic__(const char *topicfile, const char *topic, const char *title, const Upp::byte *data, int len); typedef HMODULE DLLHANDLE; #line 490 "u:/idisapp\\Core/Core.h" DLLHANDLE LoadDll__(Upp::String& fn, const char *const *names, void *const *procs); void FreeDll__(DLLHANDLE dllhandle); using Upp::byte; #line 497 "u:/idisapp\\Core/Core.h" #line 1 "u:/idisapp\\Core/dli_header.h" #line 1 "u:/idisapp\\Core/dli.h" #pragma BLITZ_APPROVE #line 18 "u:/idisapp\\Core/dli.h" #line 25 "u:/idisapp\\Core/dli.h" #line 26 "u:/idisapp\\Core/dli.h" #line 30 "u:/idisapp\\Core/dli.h" #line 37 "u:/idisapp\\Core/dli.h" struct T_UnicodeWin32{ T_UnicodeWin32(); Upp::String GetLibName() const { return libname; } void SetLibName(const char *n) { if(handle) Free(); libname = n; checked = false; } bool Load(); bool Load(const char *n) { SetLibName(n); return Load(); } void Force(); void Free(); operator bool () { return handle; } #line 1 "u:/idisapp\\Core/Kernel32W.dli" typedef UINT (__stdcall GetSystemDirectoryW_type) (LPWSTR lpBuffer, UINT uSize); GetSystemDirectoryW_type *GetSystemDirectoryW; typedef DWORD (__stdcall GetTempPathW_type) (DWORD nBufferLength, LPWSTR lpBuffer); GetTempPathW_type *GetTempPathW; typedef UINT (__stdcall GetWindowsDirectoryW_type) (LPWSTR lpBuffer, UINT uSize); GetWindowsDirectoryW_type *GetWindowsDirectoryW; typedef DWORD (__stdcall GetModuleFileNameW_type) (HMODULE hModule, LPWSTR lpFilename, DWORD nSize); GetModuleFileNameW_type *GetModuleFileNameW; typedef int (__stdcall GetLocaleInfoW_type) (LCID Locale, LCTYPE LCType, LPWSTR lpLCData, int cchData); GetLocaleInfoW_type *GetLocaleInfoW; typedef DWORD (__stdcall GetCurrentDirectoryW_type) (DWORD nBufferLength, LPWSTR lpBuffer); GetCurrentDirectoryW_type *GetCurrentDirectoryW; typedef DWORD (__stdcall GetFullPathNameW_type) (LPCWSTR lpFileName, DWORD nBufferLength, LPWSTR lpBuffer, LPWSTR *lpFilePart); GetFullPathNameW_type *GetFullPathNameW; typedef HANDLE (__stdcall FindFirstFileW_type) (LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData); FindFirstFileW_type *FindFirstFileW; typedef BOOL (__stdcall FindNextFileW_type) (HANDLE hFindFile, LPWIN32_FIND_DATAW lpFindFileData); FindNextFileW_type *FindNextFileW; typedef BOOL (__stdcall GetVolumeInformationA_type) (LPCSTR lpRootPathName, LPSTR lpVolumeNameBuffer, DWORD nVolumeNameSize, LPDWORD lpVolumeSerialNumber, LPDWORD lpMaximumComponentLength, LPDWORD lpFileSystemFlags, LPSTR lpFileSystemNameBuffer, DWORD nFileSystemNameSize); GetVolumeInformationA_type *GetVolumeInformationA; typedef HANDLE (__stdcall CreateFileW_type) (LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile); CreateFileW_type *CreateFileW; typedef BOOL (__stdcall CopyFileW_type) (LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, BOOL bFailIfExists); CopyFileW_type *CopyFileW; typedef BOOL (__stdcall MoveFileW_type) (LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName); MoveFileW_type *MoveFileW; typedef BOOL (__stdcall DeleteFileW_type) (LPCWSTR lpFileName); DeleteFileW_type *DeleteFileW; typedef BOOL (__stdcall RemoveDirectoryW_type) (LPCWSTR lpPathName); RemoveDirectoryW_type *RemoveDirectoryW; typedef BOOL (__stdcall CreateDirectoryW_type) (LPCWSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes); CreateDirectoryW_type *CreateDirectoryW; #line 59 "u:/idisapp\\Core/dli.h" private: Upp::String libname; DLLHANDLE handle; bool checked; }; T_UnicodeWin32& UnicodeWin32(); T_UnicodeWin32& UnicodeWin32_(); #line 74 "u:/idisapp\\Core/dli.h" #line 178 "u:/idisapp\\Core/dli.h" #line 3 "u:/idisapp\\Core/dli_header.h" #line 503 "u:/idisapp\\Core/Core.h" #line 1 "u:/idisapp\\Core/dli_header.h" #line 1 "u:/idisapp\\Core/dli.h" #pragma BLITZ_APPROVE #line 18 "u:/idisapp\\Core/dli.h" #line 25 "u:/idisapp\\Core/dli.h" #line 26 "u:/idisapp\\Core/dli.h" #line 37 "u:/idisapp\\Core/dli.h" struct T_UnicodeWin32Net{ T_UnicodeWin32Net(); Upp::String GetLibName() const { return libname; } void SetLibName(const char *n) { if(handle) Free(); libname = n; checked = false; } bool Load(); bool Load(const char *n) { SetLibName(n); return Load(); } void Force(); void Free(); operator bool () { return handle; } #line 1 "u:/idisapp\\Core/Mpr32W.dli" typedef DWORD (__stdcall WNetEnumResourceW_type) (HANDLE hEnum, LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize); WNetEnumResourceW_type *WNetEnumResourceW; #line 59 "u:/idisapp\\Core/dli.h" private: Upp::String libname; DLLHANDLE handle; bool checked; }; T_UnicodeWin32Net& UnicodeWin32Net(); T_UnicodeWin32Net& UnicodeWin32Net_(); #line 74 "u:/idisapp\\Core/dli.h" #line 178 "u:/idisapp\\Core/dli.h" #line 3 "u:/idisapp\\Core/dli_header.h" #line 508 "u:/idisapp\\Core/Core.h" #line 509 "u:/idisapp\\Core/Core.h" #line 511 "u:/idisapp\\Core/Core.h" #line 5 "u:/uppsrc\\Draw/Draw.h" namespace Upp { class Drawing; class Draw; HDC ScreenHDC(); #line 94 "u:/uppsrc\\Draw/Draw.h" bool ScreenInPaletteMode(); Size GetScreenSize(); #line 1 "u:\\uppsrc\\draw\\Image.h" enum ImageKind { IMAGE_UNKNOWN, IMAGE_EMPTY, IMAGE_ALPHA, IMAGE_MASK, IMAGE_OPAQUE, }; inline bool operator==(const RGBA& a, const RGBA& b) { return a.r == b.r && a.g == b.g && a.b == b.b && a.a == b.a; } inline bool operator!=(const RGBA& a, const RGBA& b) { return !(a == b); } inline RGBA RGBAZero() { RGBA c; c.r = c.g = c.b = c.a = 0; return c; } void Fill(RGBA *t, const RGBA& src, int n); void FillColor(RGBA *t, const RGBA& src, int n); void Copy(RGBA *t, const RGBA *s, int n); int Premultiply(RGBA *t, const RGBA *s, int len); int Unmultiply(RGBA *t, const RGBA *s, int len); void AlphaBlend(RGBA *t, const RGBA *s, int len); void AlphaBlend(RGBA *t, const RGBA *s, int len, Color color); void AlphaBlendOpaque(RGBA *t, const RGBA *s, int len, Color color); void AlphaBlendOpaque(RGBA *t, const RGBA *s, int len); void AlphaBlendStraight(RGBA *b, const RGBA *f, int len); void AlphaBlendStraight(RGBA *b, const RGBA *f, int len, Color color); void AlphaBlendStraightOpaque(RGBA *t, const RGBA *s, int len); void AlphaBlendStraightOpaque(RGBA *t, const RGBA *s, int len, int alpha); int GetChMaskPos32(dword mask); void AlphaBlendOverBgST(RGBA *b, RGBA bg, int len); const byte *UnpackRLE(RGBA *t, const byte *src, int len); String PackRLE(const RGBA *s, int len); inline int Grayscale(int r, int g, int b) { return (77 * r + 151 * g + 28 * b) >> 8; } inline int Grayscale(const RGBA& c) { return Grayscale(c.r, c.g, c.b); } inline byte Saturate255(int x) { return byte(~(x >> 24) & (x | (-(x >> 8) >> 24)) & 0xff); } class Image; class ImageDraw; class ImageBuffer : NoCopy { mutable int kind; Size size; Buffer pixels; Point hotspot; Point spot2; Size dots; void Set(Image& img); void DeepCopy(const ImageBuffer& img); RGBA* Line(int i) const { ; return (RGBA *)~pixels + i * size.cx; } friend void DropPixels___(ImageBuffer& b) { b.pixels.Clear(); } friend class Image; public: void SetKind(int k) { kind = k; } int GetKind() const { return kind; } int ScanKind() const; int GetScanKind() const { return kind == IMAGE_UNKNOWN ? ScanKind() : kind; } void SetHotSpot(Point p) { hotspot = p; } Point GetHotSpot() const { return hotspot; } void Set2ndSpot(Point p) { spot2 = p; } Point Get2ndSpot() const { return spot2; } void SetDots(Size sz) { dots = sz; } Size GetDots() const { return dots; } Size GetSize() const { return size; } int GetWidth() const { return size.cx; } int GetHeight() const { return size.cy; } int GetLength() const { return size.cx * size.cy; } RGBA *operator[](int i) { return Line(i); } const RGBA *operator[](int i) const { return Line(i); } RGBA *operator~() { return pixels; } operator RGBA*() { return pixels; } const RGBA *operator~() const { return pixels; } operator const RGBA*() const { return pixels; } void Create(int cx, int cy); void Create(Size sz) { Create(sz.cx, sz.cy); } bool IsEmpty() const { return (size.cx | size.cy) == 0; } void Clear() { Create(0, 0); } void operator=(Image& img); void operator=(ImageBuffer& img); ImageBuffer() { Create(0, 0); } ImageBuffer(int cx, int cy) { Create(cx, cy); } ImageBuffer(Size sz) { Create(sz.cx, sz.cy); } ImageBuffer(Image& img); ImageBuffer(ImageDraw& w); ImageBuffer(ImageBuffer& b); }; void Premultiply(ImageBuffer& b); void Unmultiply(ImageBuffer& b); void SetSurface(Draw& w, int x, int y, int cx, int cy, const RGBA *pixels); class Image : public AssignValueTypeNo< Image, 150, Moveable > { private: struct Data : Link { Atomic refcount; int64 serial; int paintcount; static Link ResData[1]; static int ResCount; void Retain() { AtomicInc(refcount); } void Release() { if(AtomicDec(refcount) == 0) delete this; } LPCSTR cursor_cheat; HBITMAP hbmp; HBITMAP hmask; HBITMAP himg; RGBA *section; void CreateHBMP(HDC dc, const RGBA *data); int GetResCount() const { return !!hbmp + !!hmask + !!himg; } #line 142 "u:\\uppsrc\\draw\\Image.h" ImageBuffer buffer; bool paintonly; void SysInit(); void SysRelease(); int GetKind(); void Paint(Draw& w, int x, int y, const Rect& src, Color c); void PaintOnlyShrink(); Data(ImageBuffer& b); ~Data(); }; Data *data; static Link ResData[1]; static int ResCount; void Set(ImageBuffer& b); friend class ImageBuffer; friend struct Data; friend class Draw; void PaintImage(Draw& w, int x, int y, const Rect& src, Color c) const; friend void SetPaintOnly___(Image& m); void SetCursorCheat(LPCSTR id) { data->cursor_cheat = id; } LPCSTR GetCursorCheat() const { return data ? data->cursor_cheat : 0; } friend Image Win32IconCursor(LPCSTR id, int iconsize, bool cursor); friend HICON IconWin32(const Image& img, bool cursor); #line 186 "u:\\uppsrc\\draw\\Image.h" #line 187 "u:\\uppsrc\\draw\\Image.h" public: const RGBA* operator~() const; operator const RGBA*() const; const RGBA* operator[](int i) const; Size GetSize() const; int GetWidth() const { return GetSize().cx; } int GetHeight() const { return GetSize().cy; } int GetLength() const; Point GetHotSpot() const; Point Get2ndSpot() const; Size GetDots() const; int GetKindNoScan() const; int GetKind() const; int64 GetSerialId() const { return data ? data->serial : 0; } bool IsSame(const Image& img) const { return GetSerialId() == img.GetSerialId(); } bool operator==(const Image& img) const; bool operator!=(const Image& img) const; dword GetHashValue() const; String ToString() const; void Serialize(Stream& s); void Clear(); Image& operator=(const Image& img); Image& operator=(ImageBuffer& img); bool IsNullInstance() const { Size sz = GetSize(); return (sz.cx|sz.cy) == 0; } bool IsEmpty() const { return IsNullInstance(); } operator Value() const { return RichValue(*this); } Image() { data = 0; } Image(const Nuller&) { data = 0; } Image(const Value& src); Image(const Image& img); Image(Image (*fn)()); Image(ImageBuffer& b); ~Image(); static Image Arrow(); static Image Wait(); static Image IBeam(); static Image No(); static Image SizeAll(); static Image SizeHorz(); static Image SizeVert(); static Image SizeTopLeft(); static Image SizeTop(); static Image SizeTopRight(); static Image SizeLeft(); static Image SizeRight(); static Image SizeBottomLeft(); static Image SizeBottom(); static Image SizeBottomRight(); static Image Cross(); static Image Hand(); struct Init { const char *const *scans; int16 scan_count; char info[24]; }; explicit Image(const Init& init); }; Image Premultiply(const Image& img); Image Unmultiply(const Image& img); Vector UnpackImlData(const void *ptr, int len); Vector UnpackImlData(const String& d); class Iml { struct IImage : Moveable { bool loaded; Image image; IImage() { loaded = false; } }; struct Data : Moveable { const char *data; int len, count; }; Vector data; VectorMap map; const Image::Init *img_init; const char **name; bool premultiply; void Init(int n); public: void Enter(); void Leave(); void Reset(); int GetCount() const { return map.GetCount(); } String GetId(int i) { return map.GetKey(i); } Image Get(int i); int Find(const String& s) const { return map.Find(s); } void Set(int i, const Image& img); void Premultiplied() { premultiply = false; } Iml(const Image::Init *img_init, const char **name, int n); void AddData(const byte *data, int len, int count); }; void Register(const char *imageclass, Iml& iml); int GetImlCount(); String GetImlName(int i); Iml& GetIml(int i); int FindIml(const char *name); Image GetImlImage(const char *name); void SetImlImage(const char *name, const Image& m); String StoreImageAsString(const Image& img); Image LoadImageFromString(const String& s); Size GetImageStringSize(const String& src); Size GetImageStringDots(const String& src); #line 1 "u:\\uppsrc\\draw\\Raster.h" enum { RASTER_1, RASTER_2, RASTER_4, RASTER_8, RASTER_8ALPHA, RASTER_16, RASTER_24, RASTER_32, RASTER_32ALPHA, RASTER_32PREMULTIPLIED, RASTER_MSBFIRST = 0x80, RASTER_MAP_R = 32, RASTER_SHIFT_R = 3, RASTER_MAP_G = 64, RASTER_SHIFT_G = 2, RASTER_MAP_B = 16, RASTER_SHIFT_B = 4, RASTER_MAP_MAX = 64 }; struct PaletteCv { Buffer cv; byte *At(int r, int b) { return cv + (r << 10) + (b << 6); } byte Get(const RGBA& b) const { return cv[(int(b.r >> RASTER_SHIFT_R) << 10) + (int(b.g >> RASTER_SHIFT_G)) + (int(b.b >> RASTER_SHIFT_B) << 6)]; } PaletteCv() { cv.Alloc(RASTER_MAP_R * RASTER_MAP_G * RASTER_MAP_B); } }; struct RasterFormat { byte type; dword rmask, gmask, bmask, amask; void Set1lf() { type = RASTER_1; } void Set1mf() { type = RASTER_1|RASTER_MSBFIRST; } void Set2lf() { type = RASTER_2; } void Set2mf() { type = RASTER_2|RASTER_MSBFIRST; } void Set4lf() { type = RASTER_4; } void Set4mf() { type = RASTER_4|RASTER_MSBFIRST; } void Set8() { type = RASTER_8; } void Set8A() { type = RASTER_8ALPHA; } void Set16le(dword rmask, dword gmask, dword bmask); void Set16be(dword rmask, dword gmask, dword bmask); void Set24le(dword rmask, dword gmask, dword bmask); void Set24be(dword rmask, dword gmask, dword bmask); void Set32le(dword rmask, dword gmask, dword bmask, dword amask = 0); void Set32be(dword rmask, dword gmask, dword bmask, dword amask = 0); void Set32leStraight(dword rmask, dword gmask, dword bmask, dword amask); void Set32beStraight(dword rmask, dword gmask, dword bmask, dword amask); void SetRGBA(); void SetRGBAStraight(); int IsRGBA() const; int GetByteCount(int cx) const; int GetBpp() const; bool HasAlpha() const; int GetColorCount() const; int GetPaletteCount() const; void Read(RGBA *t, const byte *s, int cx, const RGBA *palette) const; void Write(byte *t, const RGBA *s, int cx, const PaletteCv *palcv) const; private: byte rpos, gpos, bpos, apos; static void TailBits(RGBA *t, const byte *src, int cx, byte andm, byte shift, const RGBA *palette); static void TailBitsMSB1st(RGBA *t, const byte *src, int cx, byte shift1, byte andm, byte shift, const RGBA *palette); }; class Raster { public: class Line { mutable const RGBA *data; const byte *fmtdata; Raster *raster; mutable bool free; bool fmtfree; friend class Raster; void MakeRGBA() const; public: const RGBA *GetRGBA() const { if(!data) MakeRGBA(); return data; } const byte *GetRawData() const { return fmtdata; } operator const RGBA *() const { return GetRGBA(); } const RGBA *operator~() const { return GetRGBA(); } Line(const RGBA *data, bool free) : data(data), fmtdata((byte *)data), raster(0), free(free), fmtfree(false) {} Line(const byte *fmtdata, Raster *raster, bool fmtfree) : data(0), fmtdata(fmtdata), raster(raster), free(false), fmtfree(fmtfree) {} Line( Line& b) { Pick(b); } Line() { data = 0; fmtdata = 0; raster = 0; free = fmtfree = false; } ~Line() { Free(); } void Free() { if(free) delete[] data; if(fmtfree) delete[] fmtdata; } void Pick( Line& b); void operator=( Line& b) { Free(); Pick(b); } }; struct Info { int bpp; int colors; Size dots; Point hotspot; int kind; Info(); }; public: virtual void SeekPage(int page); virtual int GetPageCount(); virtual bool Create(); virtual Size GetSize() = 0; virtual Info GetInfo(); virtual Line GetLine(int line) = 0; virtual bool IsError(); virtual int GetPaletteCount(); virtual const RGBA *GetPalette(); virtual const RasterFormat *GetFormat(); int GetWidth() { return GetSize().cx; } int GetHeight() { return GetSize().cy; } Line operator[](int i) { return GetLine(i); } Image GetImage(int x, int y, int cx, int cy, const Gate2 progress = false); Image GetImage(const Gate2 progress = false); virtual ~Raster(); }; typedef Raster::Line RasterLine; typedef Raster::Info RasterInfo; void CreatePaletteCv(const RGBA *palette, int ncolors, PaletteCv& cv_pal); void CreatePalette(Raster& raster, RGBA *palette, int ncolors); void CreatePalette(Raster& raster, RGBA *palette, int ncolors, PaletteCv& cv); class ImageRaster : public Raster { Image img; public: virtual Size GetSize(); virtual Line GetLine(int line); virtual Info GetInfo(); ImageRaster(const Image& img) : img(img) {} }; class MemoryRaster : public Raster { public: MemoryRaster(); MemoryRaster(Raster& raster) { Load(raster); } virtual Size GetSize() { return size; } virtual Info GetInfo() { return info; } virtual Line GetLine(int line); virtual int GetPaletteCount() { return palette.GetCount(); } virtual RGBA *GetPalette() { return palette.Begin(); } virtual const RasterFormat *GetFormat() { return &format; } void Load(Raster& raster); int GetLength() const; private: RasterFormat format; Info info; Size size; Vector< Buffer > lines; Vector palette; }; class StreamRaster : public Raster { Stream *s; bool error; typedef StreamRaster *(*RasterFactory)(); template static StreamRaster *FactoryFn() { return new T; } static void AddFormat(RasterFactory f); static Vector& Map(); public: Stream& GetStream() { return *s; } bool Open(Stream& _s); bool IsError(); void SetError() { error = true; } Image Load(Stream& s, const Gate2 progress = false); Image LoadFile(const char *fn, const Gate2 progress = false); Image LoadStringA(const String& s, const Gate2 progress = false); template static void Register() { AddFormat(&StreamRaster::FactoryFn); } static One OpenAny(Stream& s); static Image LoadAny(Stream& s, const Gate2 progress = false); static Image LoadFileAny(const char *fn, const Gate2 progress = false); static Image LoadStringAny(const String& s, const Gate2 progress = false); StreamRaster() { error = true; } }; class RasterEncoder { Size size, dots; Point hotspot; RGBA *line; Buffer scanline; int line_bytes; Buffer h; Buffer palette; One palette_cv; RGBA *Pal(); protected: RasterFormat format; void SetLine(RGBA *_line); public: virtual int GetPaletteCount(); virtual void Start(Size sz) = 0; virtual void WriteLineRaw(const byte *data) = 0; void WriteLine(); void WriteLine(const RGBA *s); const RasterFormat& GetFormat() const { return format; } const RGBA *GetPalette(); const PaletteCv *GetPaletteCv() { return ~palette_cv; } operator RGBA *() { return line; } RGBA *operator~() { return line; } Size GetSize() const { return size; } int GetWidth() const { return GetSize().cx; } int GetHeight() const { return GetSize().cy; } void SetHotSpot(Point p) { hotspot = p; } Point GetHotSpot() const { return hotspot; } void SetDots(Size _dots) { dots = _dots; } Size GetDots() const { return dots; } void SetPalette(const RGBA *palette); void SetPalette(Raster& pal_raster); void Create(Size sz); void Create(int cx, int cy) { Create(Size(cx, cy)); } void Create(Size sz, const RGBA *palette); void Create(int cx, int cy, const RGBA *palette); void Create(Size sz, Raster& pal_raster); void Create(int cx, int cy, Raster& pal_raster); RasterEncoder(); virtual ~RasterEncoder(); }; class ImageEncoder : public RasterEncoder { int ii; ImageBuffer ib; public: virtual void Start(Size sz); virtual void WriteLineRaw(const byte *data); Size GetSize() const { return ib.GetSize(); } int GetWidth() const { return GetSize().cx; } int GetHeight() const { return GetSize().cy; } operator const RGBA *() { return Image(ib); } operator Image() { return Image(ib); } }; class StreamRasterEncoder : public RasterEncoder { Stream *s; public: Stream& GetStream() { return *s; } void SetStream(Stream& _s) { s = &_s; } void Save(Stream& s, Raster& raster); bool SaveFile(const char *fn, Raster& raster); String SaveString(Raster& raster); void Save(Stream& s, const Image& img); bool SaveFile(const char *fn, const Image& img); String SaveString(const Image& img); }; #line 324 "u:\\uppsrc\\draw\\Image.h" #line 1 "u:\\uppsrc\\draw\\ImageOp.h" Image CreateImage(Size sz, Color color); Image SetColorKeepAlpha(const Image& img, Color c); Image WithHotSpots(const Image& m, int x1, int y1, int x2, int y2); Image WithHotSpot(const Image& m, int x1, int y1); void Over(ImageBuffer& dest, Point p, const Image& src, const Rect& srect); void Copy(ImageBuffer& dest, Point p, const Image& src, const Rect& srect); void Copy(Image& dest, Point p, const Image& src, const Rect& srect); void Over(Image& dest, Point p, const Image& src, const Rect& srect); void OverStraightOpaque(ImageBuffer& dest, Point p, const Image& src, const Rect& srect); void OverStraightOpaque(Image& dest, Point p, const Image& _src, const Rect& srect); void Crop(RasterEncoder& tgt, Raster& img, const Rect& rc); Image Crop(const Image& img, const Rect& rc); Image Crop(const Image& img, int x, int y, int cx, int cy); Image ColorMask(const Image& src, Color transparent); void CanvasSize(RasterEncoder& tgt, Raster& img, int cx, int cy); Image CanvasSize(const Image& img, int cx, int cy); Image AssignAlpha(const Image& img, const Image& new_alpha); Image Grayscale(const Image& img); Image Grayscale(const Image& img, int amount); Image Contrast(const Image& img, int amount = 256); Image HorzFadeOut(int cx, int cy, Color color); Image HorzFadeOut(Size sz, Color color); class RescaleImage { Raster *src; Size tsz; Vector horz; Vector vert; void (*row_proc)(dword *dest, const RGBA *src, const dword *map); Size size; int cx4; int count; int segment; int entry; int step; int segspan; bool bigseg; Buffer row_buffers; int first; int full; const dword *offsets; int offset; int y; struct Ln { RasterLine line; int ii; }; Ln cache[4]; int cii; const RGBA *GetLine(int i); public: void Create(Size sz, Raster& src, const Rect& src_rc); void Get(RGBA *line); }; void DrawRasterData(Draw& w, int x, int y, int cx, int cy, const String& data); void Rescale(RasterEncoder& tgt, Size sz, Raster& src, const Rect& src_rc); Image Rescale(const Image& src, Size sz, const Rect& src_rc); Image Rescale(const Image& src, Size sz); Image Rescale(const Image& src, int cx, int cy); struct ImageFilter9 { virtual RGBA operator()(const RGBA **mx) = 0; virtual ~ImageFilter9() {} }; Image Filter(const Image& img, ImageFilter9& filter); void Filter(RasterEncoder& target, Raster& src, ImageFilter9& filter); Image Etched(const Image& img); Image Sharpen(const Image& img, int amount = 100); Image RotateClockwise(const Image& img); Image RotateAntiClockwise(const Image& img); Image MirrorHorz(const Image& img); Image MirrorVert(const Image& img); Image Rotate(const Image& m, int angle); Image Colorize(const Image& img, Color color, int alpha = 100); Image Equalight(const Image& img, int thold = 10); int Diff(RGBA a, RGBA b); Image Unglyph(const Image& m, Color& c, double& factor); Image Unglyph(const Image& m, Color& c); Image Unglyph(const Image& m); Image VertBlend(Image img1, Image img2, int y0, int y1); Image HorzBlend(Image img1, Image img2, int x0, int x1); Image HorzSymm(Image src); enum { IMAGECONTENT_VERTDUP = 1, IMAGECONTENT_HORZDUP = 2, IMAGECONTENT_OPAQUEBODY = 4, }; int ClassifyContent(const Image& m, const Rect& rect); Image RecreateAlpha(const Image& overwhite, const Image& overblack); int ImageMargin(const Image& m, int p, int dist); struct ChPartMaker { Image image; Color border; Color bg; bool t, b, l, r; byte tl, tr, bl, br; void ResetShape(); Image Make() const; ChPartMaker(const Image& m); }; struct ImageMaker { virtual String Key() const = 0; virtual Image Make() const = 0; virtual ~ImageMaker() {} }; Image MakeImage(const ImageMaker& m); Image MakeImage(const Image& image, Image (*make)(const Image& image)); void SetMakeImageCacheSize(int m); void SetMakeImageCacheMax(int m); Image MakeImagePaintOnly(const ImageMaker& m); Image CachedRescale(const Image& m, Size sz, const Rect& src); Image CachedRescale(const Image& m, Size sz); Image CachedRescalePaintOnly(const Image& m, Size sz, const Rect& src); Image CachedRescalePaintOnly(const Image& m, Size sz); Image Magnify(const Image& img, int nx, int ny); #line 325 "u:\\uppsrc\\draw\\Image.h" Image Win32Icon(LPCSTR id, int iconsize = 0); Image Win32Icon(int id, int iconsize = 0); Image Win32Cursor(LPCSTR id); Image Win32Cursor(int id); HICON IconWin32(const Image& img, bool cursor = false); Image Win32DllIcon(const char *dll, int ii, bool large); #line 337 "u:\\uppsrc\\draw\\Image.h" #line 338 "u:\\uppsrc\\draw\\Image.h" #line 99 "u:/uppsrc\\Draw/Draw.h" void EnterDraw(); void LeaveDraw(); struct DrawLock { DrawLock() { EnterDraw(); } ~DrawLock() { LeaveDraw(); } }; const int FONT_V = 40; class FontInfo; class Font : AssignValueTypeNo >{ word face; word flags; int16 height; int16 width; public: enum { FIXEDPITCH = 0x0001, SCALEABLE = 0x0002, SYMBOLTYPE = 0x0004, COMPOSED = 0x0008, LOCAL = 0x0010, }; static int GetFaceCount(); static String GetFaceName(int index); static int FindFaceNameIndex(const char *name); static dword GetFaceInfo(int index); enum { STDFONT, SCREEN_SERIF, SCREEN_SANS, SCREEN_FIXED, ROMAN, ARIAL, COURIER, SYMBOL, WINGDINGS, TAHOMA, #line 145 "u:/uppsrc\\Draw/Draw.h" OTHER, }; int GetFace() const { return face; } int GetHeight() const { return height; } int GetWidth() const { return width; } bool IsBold() const { return flags & 0x8000; } bool IsItalic() const { return flags & 0x4000; } bool IsUnderline() const { return flags & 0x2000; } bool IsStrikeout() const { return flags & 0x1000; } bool IsNonAntiAliased() const { return flags & 0x800; } bool IsTrueTypeOnly() const { return flags & 0x400; } String GetFaceName() const; dword GetFaceInfo() const; FontInfo Info() const; Font& Face(int n) { face = n; return *this; } Font& Height(int n) { height = n; return *this; } Font& Width(int n) { width = n; return *this; } Font& Bold() { flags |= 0x8000; return *this; } Font& NoBold() { flags &= ~0x8000; return *this; } Font& Bold(bool b) { return b ? Bold() : NoBold(); } Font& Italic() { flags |= 0x4000; return *this; } Font& NoItalic() { flags &= ~0x4000; return *this; } Font& Italic(bool b) { return b ? Italic() : NoItalic(); } Font& Underline() { flags |= 0x2000; return *this; } Font& NoUnderline() { flags &= ~0x2000; return *this; } Font& Underline(bool b) { return b ? Underline() : NoUnderline(); } Font& Strikeout() { flags |= 0x1000; return *this; } Font& NoStrikeout() { flags &= ~0x1000; return *this; } Font& Strikeout(bool b) { return b ? Strikeout() : NoStrikeout(); } Font& NonAntiAliased() { flags |= 0x800; return *this; } Font& NoNonAntiAliased() { flags &= ~0x800; return *this; } Font& NonAntiAliased(bool b) { return b ? NonAntiAliased() : NoNonAntiAliased(); } Font& TrueTypeOnly() { flags |= 0x400; return *this; } Font& NoTrueTypeOnly() { flags &= ~0x400; return *this; } Font& TrueTypeOnly(bool b) { return b ? TrueTypeOnly() : NoTrueTypeOnly(); } Font& FaceName(const String& name); Font operator()() const { return *this; } Font operator()(int n) const { return Font(*this).Height(n); } void Serialize(Stream& s); bool operator==(Font f) const { return face == f.face && flags == f.flags && width == f.width && height == f.height; } bool operator!=(Font f) const { return !operator==(f); } dword GetHashValue() const { return ((LONG)(((WORD)((DWORD_PTR)(flags) & 0xffff)) | ((DWORD)((WORD)((DWORD_PTR)(width) & 0xffff))) << 16)) ^ ((LONG)(((WORD)((DWORD_PTR)(face) & 0xffff)) | ((DWORD)((WORD)((DWORD_PTR)(height) & 0xffff))) << 16)); } bool IsNull() const { return face == 0xffff; } Font() { height = width = 0; face = flags = 0; } Font(int _face, int _height) { face = _face; height = _height; flags = 0; width = 0; } Font(const Nuller&) { face = 0xffff; height = width = 0; flags = 0; } operator Value() const { return RichValue(*this); } Font(const Value& q) { *this = RichValue::Extract(q); } }; template<> inline bool IsNull(const Font& f) { return f.IsNull(); } template<> inline unsigned GetHashValue(const Font& f) { return f.GetHashValue(); } template<> String AsString(const Font& f); class FontInfo : Moveable { struct CharMetrics : Moveable { int width; int lspc; int rspc; bool operator==(const CharMetrics& b) const { return width == b.width && lspc == b.lspc && rspc == b.rspc; } }; struct Kinfo : Moveable { CharMetrics std; byte *flags; Kinfo() { flags = 0; } ~Kinfo() { if(flags) delete[] flags; } }; struct Data : public Link { void GetMetrics(CharMetrics *t, int from, int count); int refcount; Font font; int angle; int device; HFONT hfont; #line 250 "u:/uppsrc\\Draw/Draw.h" int ascent; int descent; int external; int internal; int height; int lineheight; int overhang; Size offset; int avewidth; int maxwidth; int firstchar; int charcount; int default_char; CharMetrics *base[64]; Mutex xmutex; Vector kinfo; VectorMap xx; bool fixedpitch; bool scaleable; int spacebefore; int spaceafter; VectorMap kerning; Data(); ~Data(); }; Data *ptr; int charset; friend class Draw; CharMetrics *CreateMetricsPage(int page) const; CharMetrics *GetPage(int page) const; void ComposeMetrics(Font fnt, CharMetrics *m, int from) const; CharMetrics GetCM(int c) const; void Release(); void Retain(const FontInfo& f); FontInfo(Data *ptr) : ptr(ptr) { charset = 255; } bool IsEqual(byte charset, Font f, int angle, int device) const; CharMetrics GetComposedMetrics(int c); public: int GetAscent() const { return ptr->ascent; } int GetDescent() const { return ptr->descent; } int GetExternal() const { return ptr->external; } int GetInternal() const { return ptr->internal; } int GetHeight() const { return ptr->height; } int GetLineHeight() const { return ptr->lineheight; } int GetOverhang() const { return ptr->overhang; } int GetAveWidth() const { return ptr->avewidth; } int GetMaxWidth() const { return ptr->maxwidth; } int GetWidth(int c) const; int operator[](int c) const { return GetWidth(c); } int GetLeftSpace(int c) const; int GetRightSpace(int c) const; int GetKerning(int c1, int c2) const { return ptr->kerning.Get(((LONG)(((WORD)((DWORD_PTR)(c1) & 0xffff)) | ((DWORD)((WORD)((DWORD_PTR)(c2) & 0xffff))) << 16)), 0); } bool IsFixedPitch() const { return ptr->fixedpitch; } bool IsScaleable() const { return ptr->scaleable; } Font GetFont() const { return ptr->font; } int GetFontHeight() const { return ptr->font.GetHeight(); } HFONT GetHFONT() const { return ptr->hfont; } #line 337 "u:/uppsrc\\Draw/Draw.h" void Clear() { Release(); ptr = 0; } bool IsEmpty() const { return !ptr; } operator bool() const { return ptr; } FontInfo(const FontInfo& f); FontInfo& operator=(const FontInfo& f); FontInfo() { ptr = 0; charset = 255; } ~FontInfo() { Release(); } }; Font StdFont(); inline Font StdFont(int h) { return StdFont().Height(h); } struct ScreenSans : public Font { ScreenSans(int n = 0) : Font(SCREEN_SANS, n) {} }; struct ScreenSerif : public Font { ScreenSerif(int n = 0) : Font(SCREEN_SERIF, n) {} }; struct ScreenFixed : public Font { ScreenFixed(int n = 0) : Font(SCREEN_FIXED, n) {} }; struct Roman : public Font { Roman(int n) : Font(ROMAN, n) {} }; struct Arial : public Font { Arial(int n) : Font(ARIAL, n) {} }; struct Courier : public Font { Courier(int n) : Font(COURIER, n) {} }; struct Symbol : public Font { Symbol(int n) : Font(SYMBOL, n) {} }; struct WingDings : public Font { WingDings(int n) : Font(WINGDINGS, n) {} }; struct Tahoma : public Font { Tahoma(int n) : Font(TAHOMA, n) {} }; #line 366 "u:/uppsrc\\Draw/Draw.h" HPALETTE GetQlibPalette(); #line 371 "u:/uppsrc\\Draw/Draw.h" #line 372 "u:/uppsrc\\Draw/Draw.h" Size GetTextSize(const wchar *text, Font font, int n = -1); Size GetTextSize(const WString& text, Font font); Size GetTextSize(const char *text, byte charset, Font font, int n = -1); Size GetTextSize(const char *text, Font font, int n = -1); Size GetTextSize(const String& text, Font font); enum { PEN_NULL = -1, PEN_SOLID = -2, PEN_DASH = -3, PEN_DOT = -4, PEN_DASHDOT = -5, PEN_DASHDOTDOT = -6, #line 388 "u:/uppsrc\\Draw/Draw.h" }; class Image; struct DrawingPos; Color SBlack(); Color SGray(); Color SLtGray(); Color SWhiteGray(); Color SWhite(); Color SRed(); Color SGreen(); Color SBrown(); Color SBlue(); Color SMagenta(); Color SCyan(); Color SYellow(); Color SLtRed(); Color SLtGreen(); Color SLtYellow(); Color SLtBlue(); Color SLtMagenta(); Color SLtCyan(); Color SColorPaper(); Color SColorText(); Color SColorHighlight(); Color SColorHighlightText(); Color SColorMenu(); Color SColorMenuText(); Color SColorInfo(); Color SColorInfoText(); Color SColorMark(); Color SColorDisabled(); Color SColorLight(); Color SColorFace(); Color SColorShadow(); Color SColorLtFace(); Color SColorDkShadow(); void SBlack_Write(Color c); void SGray_Write(Color c); void SLtGray_Write(Color c); void SWhiteGray_Write(Color c); void SWhite_Write(Color c); void SRed_Write(Color c); void SGreen_Write(Color c); void SBrown_Write(Color c); void SBlue_Write(Color c); void SMagenta_Write(Color c); void SCyan_Write(Color c); void SYellow_Write(Color c); void SLtRed_Write(Color c); void SLtGreen_Write(Color c); void SLtYellow_Write(Color c); void SLtBlue_Write(Color c); void SLtMagenta_Write(Color c); void SLtCyan_Write(Color c); void SColorPaper_Write(Color c); void SColorText_Write(Color c); void SColorHighlight_Write(Color c); void SColorHighlightText_Write(Color c); void SColorMenu_Write(Color c); void SColorMenuText_Write(Color c); void SColorInfo_Write(Color c); void SColorInfoText_Write(Color c); void SColorMark_Write(Color c); void SColorDisabled_Write(Color c); void SColorLight_Write(Color c); void SColorFace_Write(Color c); void SColorShadow_Write(Color c); void SColorLtFace_Write(Color c); void SColorDkShadow_Write(Color c); inline Color InvertColor() { return Color(255, 0); } inline Color DefaultInk() { return Black(); } class Draw { protected: bool palette:1; bool color16:1; bool printer:1; bool pixels:1; bool aborted:1; bool backdraw:1; bool is_mono:1; static bool sFini; enum { LRU, HASH }; static FontInfo::Data *GetFontHash(int hash); static FontInfo::Data *GetFontLru(); static int FontCached; static bool StdFontSizeSet; static Size StdFontSize; static Font AStdFont; typedef Link FontLink; Size pagePixels; Size pageMMs; Size inchPixels; Size sheetPixels; Point pageOffset; Draw(); friend bool DrawDrawing(Draw& w, Stream& s, const Rect& target, Size sz); friend class BackRectDraw; friend class ImageDraw; friend class FontInfo; friend class Font; friend void StaticExitDraw_(); friend Font StdFont(); static void InitColors(); static void InitFonts(); static void FreeFonts(); static void Release(FontInfo::Data *font); int device; FontInfo lastFont; Point actual_offset; struct Cloff : Moveable { Point org; HRGN hrgn; #line 528 "u:/uppsrc\\Draw/Draw.h" Rect drawingclip; }; Array cloff; Rect drawingclip; static void InitPlatformFonts(); enum FontHashConst { FONTHASH = 97 }; void ComposeText(int x, int y, int angle, const wchar *text, Font font, Color ink, int n, const int *dx); static int __stdcall AddFace(const LOGFONT *logfont, const TEXTMETRIC *, dword type, LPARAM param); static int EnumFace(HDC hdc, const char *face); static void ForceFace(HDC hdc, const char *face, const char *aface); static void Win32__InitColors(); static FontInfo Acquire(Font font, HDC hdc, int angle, int device); HDC handle; COLORREF lastTextColor; Color lastColor; HBRUSH orgBrush; HBRUSH actBrush; HFONT orgFont; HPEN orgPen; HPEN actPen; int lastPen; Color lastPenColor; void Unselect0(); void Cinit(); void Init(); void LoadCaps(); void SetDevice(const char *devicename); void SetPrinterMode(); void Reset(); void SetOrg(); friend HPALETTE GetQlibPalette(); static const char *FontScreenSans; static const char *FontScreenSerif; static const char *FontScreenFixed; static const char *FontRoman; static const char *FontArial; static const char *FontCourier; static const char *FontSymbol; static const char *FontWingdings; static const char *FontTahoma; public: static bool AutoPalette(); static void SetAutoPalette(bool ap); #line 590 "u:/uppsrc\\Draw/Draw.h" public: static int FontCacheMax; static void SinCos(int angle, double& sina, double& cosa); static void SetStdFont(Font font); static Font GetStdFont(); static Size GetStdFontSize(); static int GetStdFontCy() { return GetStdFontSize().cy; } static void Flush() { GdiFlush(); } #line 626 "u:/uppsrc\\Draw/Draw.h" #line 627 "u:/uppsrc\\Draw/Draw.h" bool PaletteMode() const { return palette; } bool IsMono() const { return is_mono; } Size GetPagePixels() const { return pagePixels; } Size GetPageMMs() const { return pageMMs; } Size GetPixelsPerInch() const { return inchPixels; } bool Pixels() const { return pixels; } bool Dots() const { return !pixels; } bool IsPrinter() const { return printer; } bool IsAborted() const { return aborted; } bool IsBack() const { return backdraw; } bool IsSystem() const { return handle; } #line 650 "u:/uppsrc\\Draw/Draw.h" bool IsDrawing() const; enum { BEGIN = 1, OFFSET = 2, CLIP = 3, CLIPOFF = 4, EXCLUDECLIP = 5, INTERSECTCLIP = 6, END = 7, DRAWRECT = 8, DRAWIMAGE = 9, DRAWMONOIMAGE = 10, DRAWDRAWING = 11, DRAWLINE = 12, DRAWELLIPSE = 13, DRAWTEXT = 14, DRAWARC = 15, DRAWPOLYPOLYLINE = 16, DRAWPOLYPOLYPOLYGON = 17, DRAWDATA = 18, }; typedef void (*Drawer)(Draw&, Stream&, const DrawingPos&); Stream& DrawingOp(int code); Stream& PutRect(const Rect& r); static void Register(int code, Drawer drawer); virtual void StartPage(); virtual void EndPage(); virtual void BeginOp(); virtual void EndOp(); virtual void OffsetOp(Point p); virtual bool ClipOp(const Rect& r); virtual bool ClipoffOp(const Rect& r); virtual bool ExcludeClipOp(const Rect& r); virtual bool IntersectClipOp(const Rect& r); virtual Rect GetClipOp() const; virtual bool IsPaintingOp(const Rect& r) const; virtual void DrawRectOp(int x, int y, int cx, int cy, Color color); virtual void DrawImageOp(int x, int y, int cx, int cy, const Image& img, const Rect& src, Color color); virtual void DrawDataOp(int x, int y, int cx, int cy, const String& data, const char *id); virtual void DrawLineOp(int x1, int y1, int x2, int y2, int width, Color color); virtual void DrawPolyPolylineOp(const Point *vertices, int vertex_count, const int *counts, int count_count, int width, Color color, Color doxor); virtual void DrawPolyPolyPolygonOp(const Point *vertices, int vertex_count, const int *subpolygon_counts, int scc, const int *disjunct_polygon_counts, int dpcc, Color color, int width, Color outline, uint64 pattern, Color doxor); virtual void DrawArcOp(const Rect& rc, Point start, Point end, int width, Color color); #line 711 "u:/uppsrc\\Draw/Draw.h" virtual void DrawEllipseOp(const Rect& r, Color color, int pen, Color pencolor); virtual void DrawTextOp(int x, int y, int angle, const wchar *text, Font font, Color ink, int n, const int *dx); virtual void DrawDrawingOp(const Rect& target, const Drawing& w); void Begin() { BeginOp(); } void End() { EndOp(); } void Offset(Point p) { OffsetOp(p); } void Offset(int x, int y); bool Clip(const Rect& r) { return ClipOp(r); } bool Clip(int x, int y, int cx, int cy); bool Clipoff(const Rect& r) { return ClipoffOp(r); } bool Clipoff(int x, int y, int cx, int cy); bool ExcludeClip(const Rect& r) { return ExcludeClipOp(r); } bool ExcludeClip(int x, int y, int cx, int cy); bool IntersectClip(const Rect& r) { return IntersectClipOp(r); } bool IntersectClip(int x, int y, int cx, int cy); Rect GetClip() const { return GetClipOp(); } bool IsPainting(const Rect& r) const { return IsPaintingOp(r); } bool IsPainting(int x, int y, int cx, int cy) const; Point GetOffset() const { return actual_offset; } int GetCloffLevel() const { return cloff.GetCount(); } void DrawRect(int x, int y, int cx, int cy, Color color) { DrawRectOp(x, y, cx, cy, color); } void DrawRect(const Rect& rect, Color color); void DrawImage(int x, int y, int cx, int cy, const Image& img, const Rect& src); void DrawImage(int x, int y, int cx, int cy, const Image& img); void DrawImage(int x, int y, int cx, int cy, const Image& img, const Rect& src, Color color); void DrawImage(int x, int y, int cx, int cy, const Image& img, Color color); void DrawImage(const Rect& r, const Image& img, const Rect& src); void DrawImage(const Rect& r, const Image& img); void DrawImage(const Rect& r, const Image& img, const Rect& src, Color color); void DrawImage(const Rect& r, const Image& img, Color color); void DrawImage(int x, int y, const Image& img, const Rect& src); void DrawImage(int x, int y, const Image& img); void DrawImage(int x, int y, const Image& img, const Rect& src, Color color); void DrawImage(int x, int y, const Image& img, Color color); void DrawData(int x, int y, int cx, int cy, const String& data, const char *type); void DrawData(const Rect& r, const String& data, const char *type); void DrawLine(int x1, int y1, int x2, int y2, int width = 0, Color color = DefaultInk) { DrawLineOp(x1, y1, x2, y2, width, color); } void DrawLine(Point p1, Point p2, int width = 0, Color color = DefaultInk); void DrawEllipse(const Rect& r, Color color = DefaultInk, int pen = Null, Color pencolor = DefaultInk) { DrawEllipseOp(r, color, pen, pencolor); } void DrawEllipse(int x, int y, int cx, int cy, Color color = DefaultInk, int pen = Null, Color pencolor = DefaultInk); void DrawArc(const Rect& rc, Point start, Point end, int width = 0, Color color = DefaultInk) { DrawArcOp(rc, start, end, width, color); } void DrawPolyPolyline(const Point *vertices, int vertex_count, const int *counts, int count_count, int width = 0, Color color = DefaultInk, Color doxor = Null) { DrawPolyPolylineOp(vertices, vertex_count, counts, count_count, width, color, doxor); } void DrawPolyPolyline(const Vector& vertices, const Vector& counts, int width = 0, Color color = DefaultInk, Color doxor = Null); void DrawPolyline(const Point *vertices, int count, int width = 0, Color color = DefaultInk, Color doxor = Null); void DrawPolyline(const Vector& vertices, int width = 0, Color color = DefaultInk, Color doxor = Null); void DrawPolyPolyPolygon(const Point *vertices, int vertex_count, const int *subpolygon_counts, int subpolygon_count_count, const int *disjunct_polygon_counts, int disjunct_polygon_count_count, Color color = DefaultInk, int width = 0, Color outline = Null, uint64 pattern = 0, Color doxor = Null) { DrawPolyPolyPolygonOp(vertices, vertex_count, subpolygon_counts, subpolygon_count_count, disjunct_polygon_counts, disjunct_polygon_count_count, color, width, outline, pattern, doxor); } void DrawPolyPolyPolygon(const Vector& vertices, const Vector& subpolygon_counts, const Vector& disjunct_polygon_counts, Color color = DefaultInk, int width = 0, Color outline = Null, uint64 pattern = 0, Color doxor = Null); void DrawPolyPolygon(const Point *vertices, int vertex_count, const int *subpolygon_counts, int subpolygon_count_count, Color color = DefaultInk, int width = 0, Color outline = Null, uint64 pattern = 0, Color doxor = Null); void DrawPolyPolygon(const Vector& vertices, const Vector& subpolygon_counts, Color color = DefaultInk, int width = 0, Color outline = Null, uint64 pattern = 0, Color doxor = Null); void DrawPolygons(const Point *vertices, int vertex_count, const int *polygon_counts, int polygon_count_count, Color color = DefaultInk, int width = 0, Color outline = Null, uint64 pattern = 0, Color doxor = Null); void DrawPolygons(const Vector& vertices, const Vector& polygon_counts, Color color = DefaultInk, int width = 0, Color outline = Null, uint64 pattern = 0, Color doxor = Null); void DrawPolygon(const Point *vertices, int vertex_count, Color color = DefaultInk, int width = 0, Color outline = Null, uint64 pattern = 0, Color doxor = Null); void DrawPolygon(const Vector& vertices, Color color = DefaultInk, int width = 0, Color outline = Null, uint64 pattern = 0, Color doxor = Null); #line 812 "u:/uppsrc\\Draw/Draw.h" void DrawDrawing(const Rect& r, const Drawing& iw) { DrawDrawingOp(r, iw); } void DrawDrawing(int x, int y, int cx, int cy, const Drawing& iw); void DrawTextA(int x, int y, int angle, const wchar *text, Font font = StdFont(), Color ink = DefaultInk, int n = -1, const int *dx = 0); void DrawTextA(int x, int y, const wchar *text, Font font = StdFont(), Color ink = DefaultInk, int n = -1, const int *dx = 0); void DrawTextA(int x, int y, const WString& text, Font font = StdFont(), Color ink = DefaultInk, const int *dx = 0); void DrawTextA(int x, int y, int angle, const WString& text, Font font = StdFont(), Color ink = DefaultInk, const int *dx = 0); void DrawTextA(int x, int y, int angle, const char *text, byte charset, Font font = StdFont(), Color ink = DefaultInk, int n = -1, const int *dx = 0); void DrawTextA(int x, int y, const char *text, byte charset, Font font = StdFont(), Color ink = DefaultInk, int n = -1, const int *dx = 0); void DrawTextA(int x, int y, int angle, const char *text, Font font = StdFont(), Color ink = DefaultInk, int n = -1, const int *dx = 0); void DrawTextA(int x, int y, const char *text, Font font = StdFont(), Color ink = DefaultInk, int n = -1, const int *dx = 0); void DrawTextA(int x, int y, const String& text, Font font = StdFont(), Color ink = DefaultInk, const int *dx = 0); void DrawTextA(int x, int y, int angle, const String& text, Font font = StdFont(), Color ink = DefaultInk, const int *dx = 0); bool IsMetaFile() const { return device == -1; } COLORREF GetColor(Color color) const; Point LPtoDP(Point p) const; Point DPtoLP(Point p) const; Rect LPtoDP(const Rect& r) const; Rect DPtoLP(const Rect& r) const; #line 851 "u:/uppsrc\\Draw/Draw.h" void SetColor(Color color); void SetFont(Font font, int angle = 0); void SetDrawPen(int width, Color color); Size GetSizeCaps(int i, int j) const; HDC BeginGdi(); void EndGdi(); HDC GetHandle() { return handle; } operator HDC() const { return handle; } void Unselect(); void Attach(HDC ahandle) { handle = ahandle; Init(); } HDC Detach() { Unselect(); HDC h = handle; handle = 0; return h; } Draw(HDC hdc); virtual ~Draw(); #line 867 "u:/uppsrc\\Draw/Draw.h" private: FontInfo GetFontInfo(byte charset, Font font = StdFont()); FontInfo GetFontInfo(Font font = StdFont()); FontInfo GetFontInfoW(Font font = StdFont()); Size GetTextSize(const wchar *text, Font font = StdFont(), int n = -1) { return Upp::GetTextSize(text, font, n); } Size GetTextSize(const WString& text, Font font = StdFont()) { return Upp::GetTextSize(text, font); } Size GetTextSize(const char *text, byte charset, Font font = StdFont(), int n = -1) { return Upp::GetTextSize(text, charset, font); } Size GetTextSize(const char *text, Font font = StdFont(), int n = -1) { return Upp::GetTextSize(text, font, n); } Size GetTextSize(const String& text, Font font = StdFont()) { return Upp::GetTextSize(text, font); } private: Draw(const Draw&); void operator=(const Draw&); }; void DrawImageBandRLE(Draw& w, int x, int y, const Image& m, int minp); class DataDrawer { typedef DataDrawer *(*Factory)(); template static DataDrawer *FactoryFn() { return new T; } static void AddFormat(const char *id, Factory f); static VectorMap& Map(); public: virtual void Open(const String& data, int cx, int cy) = 0; virtual void Render(ImageBuffer& ib) = 0; virtual ~DataDrawer(); static One Create(const String& id); template static void Register(const char *id) { AddFormat(id, &DataDrawer::FactoryFn); } }; struct DrawingPos { Size source; Size target; Point srcoff; Point trgoff; Point trgini; Vector stack; bool Identity() const { return source == target; } int GetX(int x) const; int GetY(int y) const; int GetCx(int cx) const; int GetCy(int cy) const; int GetW(int w) const; Point Get(int x, int y) const; Point Get(Point p) const; Size Get(Size sz) const; Rect Get(const Rect& r) const; Rect Get(int x, int y, int cx, int cy) const; Point operator()(int x, int y) const { return Get(x, y); } Point operator()(Point p) const { return Get(p); } Size operator()(Size sz) const { return Get(sz); } Rect operator()(const Rect& r) const { return Get(r); } Rect operator()(int x, int y, int cx, int cy) const { return Get(x, y, cx, cy); } void TransformX(int& x) const { x = GetX(x); } void TransformY(int& y) const { y = GetY(y); } void TransformW(int& w) const { w = GetW(w); } void Transform(int& x, int& y) const { TransformX(x); TransformY(y); } void Transform(Point& p) const { p = Get(p); } void Transform(Size& sz) const { sz = Get(sz); } void Transform(Rect& r) const { r = Get(r); } }; class DrawerRegistrator { public: DrawerRegistrator(int code, Draw::Drawer w) { Draw::Register(code, w); } }; class WinMetaFile; #line 968 "u:/uppsrc\\Draw/Draw.h" class Drawing : Moveable { Size size; String data; friend class DrawingDraw; friend class Draw; public: operator bool() const { return !data.IsEmpty(); } Size GetSize() const { return size; } void SetSize(Size sz) { size = sz; } void SetSize(int cx, int cy) { size = Size(cx, cy); } Size RatioSize(int cx, int cy) const; Size RatioSize(Size sz) const { return RatioSize(sz.cx, sz.cy); } void Clear() { data.Clear(); size = Null; } void Append(Drawing& dw); void Serialize(Stream& s); bool IsNullInstance() const { return data.IsEmpty(); } operator Value() const { return RawValue(*this); } Drawing(const Value& src) { if(!IsNull(src)) *this = RawValue::Extract(src); } Drawing() { size = Null; } Drawing(const Nuller&) { size = Null; } static Drawing FromWMF(const WinMetaFile& wmf); static Drawing LoadWMF(const char *file); static Drawing ReadClipboardWMF(); WinMetaFile AsWMF() const; void WriteClipboardWMF() const; #line 1008 "u:/uppsrc\\Draw/Draw.h" #line 1009 "u:/uppsrc\\Draw/Draw.h" }; class DrawingDraw : public Draw { public: virtual void BeginOp(); virtual void EndOp(); virtual void OffsetOp(Point p); virtual bool ClipOp(const Rect& r); virtual bool ClipoffOp(const Rect& r); virtual bool ExcludeClipOp(const Rect& r); virtual bool IntersectClipOp(const Rect& r); virtual Rect GetClipOp() const; virtual bool IsPaintingOp(const Rect& r) const; virtual void DrawRectOp(int x, int y, int cx, int cy, Color color); virtual void DrawImageOp(int x, int y, int cx, int cy, const Image& img, const Rect& src, Color color); virtual void DrawDataOp(int x, int y, int cx, int cy, const String& data, const char *id); virtual void DrawLineOp(int x1, int y1, int x2, int y2, int width, Color color); virtual void DrawPolyPolylineOp(const Point *vertices, int vertex_count, const int *counts, int count_count, int width, Color color, Color doxor); virtual void DrawPolyPolyPolygonOp(const Point *vertices, int vertex_count, const int *subpolygon_counts, int scc, const int *disjunct_polygon_counts, int dpcc, Color color, int width, Color outline, uint64 pattern, Color doxor); virtual void DrawEllipseOp(const Rect& r, Color color, int pen, Color pencolor); virtual void DrawArcOp(const Rect& rc, Point start, Point end, int pen, Color pencolor); virtual void DrawTextOp(int x, int y, int angle, const wchar *text, Font font, Color ink, int n, const int *dx); virtual void DrawDrawingOp(const Rect& target, const Drawing& w); private: Size size; StringStream drawing; void DInit(); void DrawingBegin(); public: void SetPixels(bool b = true) { pixels = b; } Stream& GetStream() { return drawing; } void Create(int cx, int cy); void Create(Size sz); Size GetSize() const { return size; } Drawing GetResult(); operator Drawing() { return GetResult(); } DrawingDraw(); DrawingDraw(int cx, int cy); DrawingDraw(Size sz); ~DrawingDraw(); }; class NilDraw : public Draw { public: virtual void BeginOp(); virtual void EndOp(); virtual void OffsetOp(Point p); virtual bool ClipOp(const Rect& r); virtual bool ClipoffOp(const Rect& r); virtual bool ExcludeClipOp(const Rect& r); virtual bool IntersectClipOp(const Rect& r); virtual Rect GetClipOp() const; virtual bool IsPaintingOp(const Rect& r) const; virtual void DrawRectOp(int x, int y, int cx, int cy, Color color); virtual void DrawImageOp(int x, int y, int cx, int cy, const Image& img, const Rect& src, Color color); virtual void DrawLineOp(int x1, int y1, int x2, int y2, int width, Color color); virtual void DrawEllipseOp(const Rect& r, Color color, int pen, Color pencolor); virtual void DrawTextOp(int x, int y, int angle, const wchar *text, Font font, Color ink, int n, const int *dx); virtual void DrawDrawingOp(const Rect& target, const Drawing& w); NilDraw(); ~NilDraw(); }; class BackDraw : public Draw { public: virtual bool IsPaintingOp(const Rect& r) const; protected: HBITMAP hbmpold; HBITMAP hbmp; #line 1103 "u:/uppsrc\\Draw/Draw.h" Size size; Draw *painting; Point painting_offset; public: void Put(Draw& w, int x, int y); void Put(Draw& w, Point p) { Put(w, p.x, p.y); } void Create(Draw& draw, int cx, int cy); void Create(Draw& draw, Size sz) { Create(draw, sz.cx, sz.cy); } void Create(int cx, int cy); void Create(Size sz) { Create(sz.cx, sz.cy); } void Destroy(); void SetPaintingDraw(Draw& w, Point off) { painting = &w; painting_offset = off; } BackDraw(); ~BackDraw(); }; void AddNotEmpty(Vector& result, int left, int right, int top, int bottom); bool Subtract(const Rect& r, const Rect& sub, Vector& result); bool Subtract(const Vector& rr, const Rect& sub, Vector& result); Vector Subtract(const Vector& rr, const Rect& sub, bool& changed); Vector Intersect(const Vector& b, const Rect& a, bool& changed); void Subtract(Vector& rr, const Rect& sub); void Union(Vector& rr, const Rect& add); void DrawRect(Draw& w, const Rect& rect, const Image& img, bool ralgn = false); void DrawRect(Draw& w, int x, int y, int cx, int cy, const Image& img, bool ra = false); void DrawTiles(Draw& w, int x, int y, int cx, int cy, const Image& img); void DrawTiles(Draw& w, const Rect& rect, const Image& img); void DrawFatFrame(Draw& w, int x, int y, int cx, int cy, Color color, int n); void DrawFatFrame(Draw& w, const Rect& r, Color color, int n); void DrawFrame(Draw& w, int x, int y, int cx, int cy, Color leftcolor, Color topcolor, Color rightcolor, Color bottomcolor); void DrawFrame(Draw& w, const Rect& r, Color leftcolor, Color topcolor, Color rightcolor, Color bottomcolor); void DrawFrame(Draw& w, int x, int y, int cx, int cy, Color topleftcolor, Color bottomrightcolor); void DrawFrame(Draw& w, const Rect& r, Color topleftcolor, Color bottomrightcolor); void DrawFrame(Draw& w, int x, int y, int cx, int cy, Color color); void DrawFrame(Draw& w, const Rect& r, Color color); void DrawBorder(Draw& w, int x, int y, int cx, int cy, const ColorF *colors_ltrd); void DrawBorder(Draw& w, const Rect& r, const ColorF *colors_ltrd); const ColorF *BlackBorder(); const ColorF *ButtonPushBorder(); const ColorF *EdgeButtonBorder(); const ColorF *DefButtonBorder(); const ColorF *ButtonBorder(); const ColorF *InsetBorder(); const ColorF *OutsetBorder(); const ColorF *ThinOutsetBorder(); const ColorF *ThinInsetBorder(); void DrawBorder(Draw& w, int x, int y, int cx, int cy, const ColorF *(*colors_ltrd)()); void DrawBorder(Draw& w, const Rect& r, const ColorF *(*colors_ltrd)()); void DrawRectMinusRect(Draw& w, const Rect& rect, const Rect& inner, Color color); void DrawHighlightImage(Draw& w, int x, int y, const Image& img, bool highlight = true, bool enabled = true, Color maskcolor = SColorPaper); Color GradientColor(Color fc, Color tc, int i, int n); void DrawDragRect(Draw& w, const Rect& rect1, const Rect& rect2, const Rect& clip, int n, Color color, uint64 pattern); enum { BUTTON_NORMAL, BUTTON_OK, BUTTON_HIGHLIGHT, BUTTON_PUSH, BUTTON_DISABLED, BUTTON_CHECKED, BUTTON_VERTICAL = 0x100, BUTTON_EDGE = 0x200, BUTTON_TOOL = 0x400, BUTTON_SCROLL = 0x800, }; void DrawXPButton(Draw& w, Rect r, int type); void DrawTextEllipsis(Draw& w, int x, int y, int cx, const char *text, const char *ellipsis, Font font = StdFont(), Color ink = SColorText(), int n = -1); void DrawTextEllipsis(Draw& w, int x, int y, int cx, const wchar *text, const char *ellipsis, Font font = StdFont(), Color ink = SColorText(), int n = -1); Size GetTLTextSize(const wchar *text, Font font = StdFont()); int GetTLTextHeight(const wchar *s, Font font = StdFont()); void DrawTLText(Draw& draw, int x, int y, int cx, const wchar *text, Font font = StdFont(), Color ink = SColorText(), int accesskey = 0); typedef String (*DrawingToPdfFnType)(const Array& report, Size pagesize, int margin); void SetDrawingToPdfFn(DrawingToPdfFnType Pdf); DrawingToPdfFnType GetDrawingToPdfFn(); #line 1 "u:\\uppsrc\\draw\\DrawWin32.h" class WinMetaFile { Size size; mutable HENHMETAFILE hemf; void ChkP() const { ; } void Init(); void Pick( WinMetaFile& src); void Copy(const WinMetaFile& src); public: void Attach(HENHMETAFILE emf); HENHMETAFILE *Detach(); bool IsPicked() const { return (uintptr_t) hemf == 0xffffffff; } operator bool() const { ChkP(); return hemf; } Size GetSize() const { ChkP(); return hemf ? size : Size(0, 0); } void Clear(); void Paint(Draw& w, const Rect& r) const; void Paint(Draw& w, int x, int y, int cx, int cy) const; void Serialize(Stream& s); void ReadClipboard(); void WriteClipboard() const; bool Load(const char *file); WinMetaFile() { Init(); } WinMetaFile(HENHMETAFILE hemf); WinMetaFile(HENHMETAFILE hemf, Size sz); WinMetaFile(const char *file); WinMetaFile( WinMetaFile& src) { Pick(src); } WinMetaFile(const WinMetaFile& src, int) { Copy(src); } void operator=( WinMetaFile& src) { Clear(); Pick(src); } void operator<<=(const WinMetaFile& src) { Clear(); Copy(src); } ~WinMetaFile() { Clear(); } HENHMETAFILE GetHEMF() const { ChkP(); return hemf; } }; class WinMetaFileDraw : public Draw { Size size; public: bool Create(HDC hdc, int cx, int cy, const char *app = 0, const char *name = 0, const char *file = 0); bool Create(int cx, int cy, const char *app = 0, const char *name = 0, const char *file = 0); WinMetaFile Close(); WinMetaFileDraw() {} WinMetaFileDraw(HDC hdc, int cx, int cy, const char *app = 0, const char *name = 0, const char *file = 0); WinMetaFileDraw(int cx, int cy, const char *app = 0, const char *name = 0, const char *file = 0); ~WinMetaFileDraw(); }; #line 60 "u:\\uppsrc\\draw\\DrawWin32.h" class ScreenDraw : public Draw { public: ScreenDraw(bool ic = false); ~ScreenDraw(); }; class PrintDraw : public Draw { public: virtual void StartPage(); virtual void EndPage(); private: void InitPrinter(); public: void Abort() { aborted = true; } PrintDraw(HDC hdc, const char *jobname); ~PrintDraw(); }; #line 82 "u:\\uppsrc\\draw\\DrawWin32.h" inline bool BitBlt(HDC ddc, Point d, HDC sdc, const Rect& s, dword rop = (DWORD)0x00CC0020) { return BitBlt(ddc, d.x, d.y, s.Width(), s.Height(), sdc, s.left, s.top, rop); } inline bool StretchBlt(HDC ddc, const Rect& r, HDC sdc, const Rect& s, dword rop = (DWORD)0x00CC0020) { return StretchBlt(ddc, r.left, r.top, r.Width(), r.Height(), sdc, s.left, s.top, s.Width(), s.Height(), rop); } inline bool PatBlt(HDC dc, const Rect& r, dword rop = (DWORD)0x00F00021) { return PatBlt(dc, r.left, r.top, r.Width(), r.Height(), rop); } inline void MoveTo(HDC hdc, Point pt) { MoveToEx(hdc, pt.x, pt.y, 0); } inline void LineTo(HDC hdc, Point pt) { LineTo(hdc, pt.x, pt.y); } inline void DrawLine(HDC hdc, Point p, Point q) { MoveTo(hdc, p); LineTo(hdc, q); } inline void DrawLine(HDC hdc, int px, int py, int qx, int qy) { MoveToEx(hdc, px, py, 0); LineTo(hdc, qx, qy); } inline void DrawArc(HDC hdc, const Rect& rc, Point p, Point q){ Arc(hdc, rc.left, rc.top, rc.right, rc.bottom, p.x, p.y, q.x, q.y); } #line 101 "u:\\uppsrc\\draw\\DrawWin32.h" inline void DrawCircle(HDC hdc, int x, int y, int radius) { Ellipse(hdc, x - radius, y - radius, x + radius + 1, y + radius + 1); } inline void DrawCircle(HDC hdc, Point centre, int radius) { DrawCircle(hdc, centre.x, centre.y, radius); } inline void DrawEllipse(HDC hdc, const Rect& rc) { Ellipse(hdc, rc.left, rc.top, rc.right, rc.bottom); } inline void DrawRect(HDC hdc, const Rect& rc) { Rectangle(hdc, rc.left, rc.top, rc.right, rc.bottom); } #line 1213 "u:/uppsrc\\Draw/Draw.h" #line 1215 "u:/uppsrc\\Draw/Draw.h" #line 1 "u:\\uppsrc\\draw\\Display.h" class Display { public: enum { CURSOR = 0x01, FOCUS = 0x02, SELECT = 0x04, READONLY = 0x08, }; virtual void PaintBackground(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const; virtual void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const; virtual Size GetStdSize(const Value& q) const; virtual Size RatioSize(const Value& q, int cx, int cy) const; virtual ~Display(); }; struct AttrText { WString text; Font font; Color ink; Color paper; int align; AttrText& Ink(Color c) { ink = c; return *this; } AttrText& Paper(Color c) { paper = c; return *this; } AttrText& SetFont(Font f) { font = f; return *this; } AttrText& Align(int a) { align = a; return *this; } AttrText& Left() { return Align(ALIGN_LEFT); } AttrText& Center() { return Align(ALIGN_CENTER); } AttrText& Right() { return Align(ALIGN_RIGHT); } operator Value() const; AttrText(const char *text); AttrText(const wchar *text); AttrText(const WString& text); private: void Init(); }; const Display& StdDisplay(); const Display& StdCenterDisplay(); const Display& StdRightDisplay(); const Display& ColorDisplay(); const Display& SizeTextDisplay(); const Display& ImageDisplay(); const Display& FittedImageDisplay(); const Display& CenteredImageDisplay(); const Display& CenteredHighlightImageDisplay(); const Display& DrawingDisplay(); class ColorDisplayNull : public Display { public: ColorDisplayNull(String nulltext = Null) : nulltext(nulltext) {} #line 67 "u:\\uppsrc\\draw\\Display.h" virtual void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const; private: String nulltext; }; class PaintRect : Moveable { protected: Value value; const Display *display; public: void Paint(Draw& w, const Rect& r, Color ink = SColorText, Color paper = SColorPaper, dword style = 0) const; void Paint(Draw& w, int x, int y, int cx, int cy, Color ink = SColorText, Color paper = SColorPaper, dword style = 0) const; Size GetStdSize() const; Size RatioSize(int cx, int cy) const; Size RatioSize(Size sz) const { return RatioSize(sz.cx, sz.cy); } void SetDisplay(const Display& d) { display = &d; } void SetValue(const Value& v) { value = v; } void Set(const Display& d, const Value& v) { display = &d; value = v; } void Clear() { display = 0; } const Value& GetValue() const { return value; } const Display& GetDisplay() const { return *display; } operator bool() const { return display; } PaintRect(); PaintRect(const Display& display); PaintRect(const Display& display, const Value& val); }; #line 1217 "u:/uppsrc\\Draw/Draw.h" #line 1 "u:\\uppsrc\\draw\\ImageDraw.h" class ImageDraw : public Draw, NoCopy { Size size; struct Section { HDC dc; HBITMAP hbmp, hbmpOld; RGBA *pixels; void Init(int cx, int cy); ~Section(); }; Section rgb; Section a; Draw alpha; #line 18 "u:\\uppsrc\\draw\\ImageDraw.h" bool has_alpha; void Init(); Image Get(bool pm) const; public: Draw& Alpha(); operator Image() const; Image GetStraight() const; ImageDraw(Size sz); ImageDraw(int cx, int cy); ~ImageDraw(); }; #line 1218 "u:/uppsrc\\Draw/Draw.h" #line 1 "u:\\uppsrc\\draw\\Debug.h" String DumpLanguage(int language); String DumpColor(Color color); String DumpFont(Font font); String DumpFontInfo(FontInfo fi); String DumpAlign(int align); class SimpleTiming { public: SimpleTiming(const char *name) : name(name) { last_ticks = start_ticks = GetTickCount(); Upp::LockLog(), Upp::VppLog() << name << " (open) & " << start_ticks << EOL, Upp::UnlockLog(); } void Show(const char *part) { int ticks = GetTickCount(); Upp::LockLog(), Upp::VppLog() << name << " in " << (ticks - start_ticks) << ", " << part << " in " << (ticks - last_ticks) << EOL, Upp::UnlockLog(); last_ticks = ticks; } ~SimpleTiming() { int ticks = GetTickCount(); String out; Upp::LockLog(), Upp::VppLog() << name << " done in " << (ticks - start_ticks) << ", last part in " << (ticks - last_ticks) << EOL, Upp::UnlockLog(); } private: String name; int start_ticks; int last_ticks; }; int GdiGetFreeSpace(); #line 1219 "u:/uppsrc\\Draw/Draw.h" #line 1 "u:\\uppsrc\\draw\\Cham.h" enum LookOp { LOOK_PAINT, LOOK_MARGINS, LOOK_PAINTEDGE, LOOK_ISOPAQUE, LOOK_ISBODYOPAQUE, }; void ChLookFn(Value (*fn)(Draw& w, const Rect& r, const Value& look, int lookop)); Image AdjustColors(const Image& img); void Override(Iml& target, Iml& source, bool colored = false); void ColoredOverride(Iml& target, Iml& source); void ChReset(); void ChFinish(); void ChPaint(Draw& w, const Rect& r, const Value& look); void ChPaint(Draw& w, int x, int y, int cx, int cy, const Value& look); void ChPaintEdge(Draw& w, const Rect& r, const Value& look); void ChPaintEdge(Draw& w, int x, int y, int cx, int cy, const Value& look); void ChPaintBody(Draw& w, const Rect& r, const Value& look); void ChPaintBody(Draw& w, int x, int y, int cx, int cy, const Value& look); Rect ChMargins(const Value& look); bool ChIsOpaque(const Value& look); bool ChIsBodyOpaque(const Value& look); void DeflateMargins(Rect& r, const Rect& margin); void ChDeflateMargins(Rect& r, const Value& look); void DeflateMargins(Size& sz, const Rect& m); void ChDeflateMargins(Size& sz, const Value& look); void InflateMargins(Rect& r, const Rect& m); void ChInflateMargins(Rect& r, const Value& look); void InflateMargins(Size& sz, const Rect& m); void ChInflateMargins(Size& sz, const Value& look); template struct ChStyle { byte status; byte registered; T *standard; const T& Standard() const { return *standard; } T& Write() const { T& x = *(T *)this; x.status = 2; return x; } void Assign(const T& src) { *(T *)this = src; } ChStyle() { status = 0; registered = 0; standard = 0; } }; struct ChColor : ChStyle { Color value; }; struct ChInt : ChStyle { int value; }; struct ChValue : ChStyle { Value value; }; struct ChImage : ChStyle { Image value; }; void ChPaint(Draw& w, const Rect& r, const Value& element); void ChPaint(Draw& w, int x, int y, int cx, int cy, const Value& element); Value ChLookWith(const Value& look, const Image& img, Point offset = Point(0, 0)); Value ChLookWith(const Value& look, const Image& img, Color color, Point offset = Point(0, 0)); Value ChLookWith(const Value& look, const Image& img, Color (*color)(int i), int i, Point offset = Point(0, 0)); void ChRegisterStyle__(byte& state, byte& registered, void (*init)()); Value ChBorder(const ColorF *colors, const Value& face = SColorFace()); #line 1220 "u:/uppsrc\\Draw/Draw.h" }; #line 1224 "u:/uppsrc\\Draw/Draw.h" #line 5 "u:/uppsrc\\CtrlCore/CtrlCore.h" namespace Upp { enum { K_DELTA = 0x010000, K_ALT = 0x080000, K_SHIFT = 0x040000, K_CTRL = 0x020000, K_KEYUP = 0x100000, K_MOUSEMIDDLE = 0x200000, K_MOUSERIGHT = 0x400000, K_MOUSELEFT = 0x800000, K_MOUSEDOUBLE = 0x1000000, K_MOUSETRIPLE = 0x2000000, K_SHIFT_CTRL = K_SHIFT|K_CTRL, }; #line 1 "u:\\uppsrc\\ctrlcore\\MKeys.h" enum { #line 1 "u:\\uppsrc\\ctrlcore\\Win32Keys.i" K_BACK = 0x08 + K_DELTA, K_BACKSPACE = 0x08 + K_DELTA, K_TAB = 9, K_SPACE = 32, K_RETURN = 13, K_ENTER = K_RETURN, K_SHIFT_KEY = 0x10 + K_DELTA, K_CTRL_KEY = 0x11 + K_DELTA, K_ALT_KEY = 0x12 + K_DELTA, K_CAPSLOCK = 0x14 + K_DELTA, K_ESCAPE = 0x1B + K_DELTA, K_PRIOR = 0x21 + K_DELTA, K_PAGEUP = 0x21 + K_DELTA, K_NEXT = 0x22 + K_DELTA, K_PAGEDOWN = 0x22 + K_DELTA, K_END = 0x23 + K_DELTA, K_HOME = 0x24 + K_DELTA, K_LEFT = 0x25 + K_DELTA, K_UP = 0x26 + K_DELTA, K_RIGHT = 0x27 + K_DELTA, K_DOWN = 0x28 + K_DELTA, K_INSERT = 0x2D + K_DELTA, K_DELETE = 0x2E + K_DELTA, K_NUMPAD0 = 0x60 + K_DELTA, K_NUMPAD1 = 0x61 + K_DELTA, K_NUMPAD2 = 0x62 + K_DELTA, K_NUMPAD3 = 0x63 + K_DELTA, K_NUMPAD4 = 0x64 + K_DELTA, K_NUMPAD5 = 0x65 + K_DELTA, K_NUMPAD6 = 0x66 + K_DELTA, K_NUMPAD7 = 0x67 + K_DELTA, K_NUMPAD8 = 0x68 + K_DELTA, K_NUMPAD9 = 0x69 + K_DELTA, K_MULTIPLY = 0x6A + K_DELTA, K_ADD = 0x6B + K_DELTA, K_SEPARATOR = 0x6C + K_DELTA, K_SUBTRACT = 0x6D + K_DELTA, K_DECIMAL = 0x6E + K_DELTA, K_DIVIDE = 0x6F + K_DELTA, K_SCROLL = 0x91 + K_DELTA, K_F1 = 0x70 + K_DELTA, K_F2 = 0x71 + K_DELTA, K_F3 = 0x72 + K_DELTA, K_F4 = 0x73 + K_DELTA, K_F5 = 0x74 + K_DELTA, K_F6 = 0x75 + K_DELTA, K_F7 = 0x76 + K_DELTA, K_F8 = 0x77 + K_DELTA, K_F9 = 0x78 + K_DELTA, K_F10 = 0x79 + K_DELTA, K_F11 = 0x7A + K_DELTA, K_F12 = 0x7B + K_DELTA, K_A = 'A' + K_DELTA, K_B = 'B' + K_DELTA, K_C = 'C' + K_DELTA, K_D = 'D' + K_DELTA, K_E = 'E' + K_DELTA, K_F = 'F' + K_DELTA, K_G = 'G' + K_DELTA, K_H = 'H' + K_DELTA, K_I = 'I' + K_DELTA, K_J = 'J' + K_DELTA, K_K = 'K' + K_DELTA, K_L = 'L' + K_DELTA, K_M = 'M' + K_DELTA, K_N = 'N' + K_DELTA, K_O = 'O' + K_DELTA, K_P = 'P' + K_DELTA, K_Q = 'Q' + K_DELTA, K_R = 'R' + K_DELTA, K_S = 'S' + K_DELTA, K_T = 'T' + K_DELTA, K_U = 'U' + K_DELTA, K_V = 'V' + K_DELTA, K_W = 'W' + K_DELTA, K_X = 'X' + K_DELTA, K_Y = 'Y' + K_DELTA, K_Z = 'Z' + K_DELTA, K_0 = '0' + K_DELTA, K_1 = '1' + K_DELTA, K_2 = '2' + K_DELTA, K_3 = '3' + K_DELTA, K_4 = '4' + K_DELTA, K_5 = '5' + K_DELTA, K_6 = '6' + K_DELTA, K_7 = '7' + K_DELTA, K_8 = '8' + K_DELTA, K_9 = '9' + K_DELTA, K_CTRL_LBRACKET = K_CTRL|219|K_DELTA, K_CTRL_RBRACKET = K_CTRL|221|K_DELTA, K_CTRL_MINUS = K_CTRL|0xbd|K_DELTA, K_CTRL_GRAVE = K_CTRL|0xc0|K_DELTA, K_CTRL_SLASH = K_CTRL|0xbf|K_DELTA, K_CTRL_BACKSLASH = K_CTRL|0xdc|K_DELTA, K_CTRL_COMMA = K_CTRL|0xbc|K_DELTA, K_CTRL_PERIOD = K_CTRL|0xbe|K_DELTA, K_CTRL_SEMICOLON = K_CTRL|0xbe|K_DELTA, K_CTRL_EQUAL = K_CTRL|0xbb|K_DELTA, K_CTRL_APOSTROPHE= K_CTRL|0xde|K_DELTA, K_BREAK = 0x03 + K_DELTA, #line 12 "u:\\uppsrc\\ctrlcore\\MKeys.h" #line 13 "u:\\uppsrc\\ctrlcore\\MKeys.h" K_CTRL_BACK = K_CTRL|K_BACKSPACE, K_CTRL_BACKSPACE = K_CTRL|K_BACKSPACE, K_CTRL_TAB = K_CTRL|K_TAB, K_CTRL_RETURN = K_CTRL|K_ENTER, K_CTRL_ENTER = K_CTRL|K_ENTER, K_CTRL_ESCAPE = K_CTRL|K_ESCAPE, K_CTRL_SPACE = K_CTRL|K_SPACE, K_CTRL_PRIOR = K_CTRL|K_PAGEUP, K_CTRL_PAGEUP = K_CTRL|K_PAGEUP, K_CTRL_NEXT = K_CTRL|K_PAGEDOWN, K_CTRL_PAGEDOWN = K_CTRL|K_PAGEDOWN, K_CTRL_END = K_CTRL|K_END, K_CTRL_HOME = K_CTRL|K_HOME, K_CTRL_LEFT = K_CTRL|K_LEFT, K_CTRL_UP = K_CTRL|K_UP, K_CTRL_RIGHT = K_CTRL|K_RIGHT, K_CTRL_DOWN = K_CTRL|K_DOWN, K_CTRL_INSERT = K_CTRL|K_INSERT, K_CTRL_DELETE = K_CTRL|K_DELETE, K_CTRL_NUMPAD0 = K_CTRL|K_NUMPAD0, K_CTRL_NUMPAD1 = K_CTRL|K_NUMPAD1, K_CTRL_NUMPAD2 = K_CTRL|K_NUMPAD2, K_CTRL_NUMPAD3 = K_CTRL|K_NUMPAD3, K_CTRL_NUMPAD4 = K_CTRL|K_NUMPAD4, K_CTRL_NUMPAD5 = K_CTRL|K_NUMPAD5, K_CTRL_NUMPAD6 = K_CTRL|K_NUMPAD6, K_CTRL_NUMPAD7 = K_CTRL|K_NUMPAD7, K_CTRL_NUMPAD8 = K_CTRL|K_NUMPAD8, K_CTRL_NUMPAD9 = K_CTRL|K_NUMPAD9, K_CTRL_MULTIPLY = K_CTRL|K_MULTIPLY, K_CTRL_ADD = K_CTRL|K_ADD, K_CTRL_SEPARATOR = K_CTRL|K_SEPARATOR, K_CTRL_SUBTRACT = K_CTRL|K_SUBTRACT, K_CTRL_DECIMAL = K_CTRL|K_DECIMAL, K_CTRL_DIVIDE = K_CTRL|K_DIVIDE, K_CTRL_F1 = K_CTRL|K_F1, K_CTRL_F2 = K_CTRL|K_F2, K_CTRL_F3 = K_CTRL|K_F3, K_CTRL_F4 = K_CTRL|K_F4, K_CTRL_F5 = K_CTRL|K_F5, K_CTRL_F6 = K_CTRL|K_F6, K_CTRL_F7 = K_CTRL|K_F7, K_CTRL_F8 = K_CTRL|K_F8, K_CTRL_F9 = K_CTRL|K_F9, K_CTRL_F10 = K_CTRL|K_F10, K_CTRL_F11 = K_CTRL|K_F11, K_CTRL_F12 = K_CTRL|K_F12, K_CTRL_SCROLL = K_CTRL|K_SCROLL, K_CTRL_A = K_CTRL|K_A, K_CTRL_B = K_CTRL|K_B, K_CTRL_C = K_CTRL|K_C, K_CTRL_D = K_CTRL|K_D, K_CTRL_E = K_CTRL|K_E, K_CTRL_F = K_CTRL|K_F, K_CTRL_G = K_CTRL|K_G, K_CTRL_H = K_CTRL|K_H, K_CTRL_I = K_CTRL|K_I, K_CTRL_J = K_CTRL|K_J, K_CTRL_K = K_CTRL|K_K, K_CTRL_L = K_CTRL|K_L, K_CTRL_M = K_CTRL|K_M, K_CTRL_N = K_CTRL|K_N, K_CTRL_O = K_CTRL|K_O, K_CTRL_P = K_CTRL|K_P, K_CTRL_Q = K_CTRL|K_Q, K_CTRL_R = K_CTRL|K_R, K_CTRL_S = K_CTRL|K_S, K_CTRL_T = K_CTRL|K_T, K_CTRL_U = K_CTRL|K_U, K_CTRL_V = K_CTRL|K_V, K_CTRL_W = K_CTRL|K_W, K_CTRL_X = K_CTRL|K_X, K_CTRL_Y = K_CTRL|K_Y, K_CTRL_Z = K_CTRL|K_Z, K_CTRL_0 = K_CTRL|K_0, K_CTRL_1 = K_CTRL|K_1, K_CTRL_2 = K_CTRL|K_2, K_CTRL_3 = K_CTRL|K_3, K_CTRL_4 = K_CTRL|K_4, K_CTRL_5 = K_CTRL|K_5, K_CTRL_6 = K_CTRL|K_6, K_CTRL_7 = K_CTRL|K_7, K_CTRL_8 = K_CTRL|K_8, K_CTRL_9 = K_CTRL|K_9, K_SHIFT_BACK = K_SHIFT|K_BACKSPACE, K_SHIFT_BACKSPACE = K_SHIFT|K_BACKSPACE, K_SHIFT_TAB = K_SHIFT|K_TAB, K_SHIFT_RETURN = K_SHIFT|K_ENTER, K_SHIFT_ENTER = K_SHIFT|K_ENTER, K_SHIFT_ESCAPE = K_SHIFT|K_ESCAPE, K_SHIFT_SPACE = K_SHIFT|K_SPACE, K_SHIFT_PRIOR = K_SHIFT|K_PAGEUP, K_SHIFT_PAGEUP = K_SHIFT|K_PAGEUP, K_SHIFT_NEXT = K_SHIFT|K_PAGEDOWN, K_SHIFT_PAGEDOWN = K_SHIFT|K_PAGEDOWN, K_SHIFT_END = K_SHIFT|K_END, K_SHIFT_HOME = K_SHIFT|K_HOME, K_SHIFT_LEFT = K_SHIFT|K_LEFT, K_SHIFT_UP = K_SHIFT|K_UP, K_SHIFT_RIGHT = K_SHIFT|K_RIGHT, K_SHIFT_DOWN = K_SHIFT|K_DOWN, K_SHIFT_INSERT = K_SHIFT|K_INSERT, K_SHIFT_DELETE = K_SHIFT|K_DELETE, K_SHIFT_NUMPAD0 = K_SHIFT|K_NUMPAD0, K_SHIFT_NUMPAD1 = K_SHIFT|K_NUMPAD1, K_SHIFT_NUMPAD2 = K_SHIFT|K_NUMPAD2, K_SHIFT_NUMPAD3 = K_SHIFT|K_NUMPAD3, K_SHIFT_NUMPAD4 = K_SHIFT|K_NUMPAD4, K_SHIFT_NUMPAD5 = K_SHIFT|K_NUMPAD5, K_SHIFT_NUMPAD6 = K_SHIFT|K_NUMPAD6, K_SHIFT_NUMPAD7 = K_SHIFT|K_NUMPAD7, K_SHIFT_NUMPAD8 = K_SHIFT|K_NUMPAD8, K_SHIFT_NUMPAD9 = K_SHIFT|K_NUMPAD9, K_SHIFT_MULTIPLY = K_SHIFT|K_MULTIPLY, K_SHIFT_ADD = K_SHIFT|K_ADD, K_SHIFT_SEPARATOR = K_SHIFT|K_SEPARATOR, K_SHIFT_SUBRACT = K_SHIFT|K_SUBTRACT, K_SHIFT_DECIMAL = K_SHIFT|K_DECIMAL, K_SHIFT_DIVIDE = K_SHIFT|K_DIVIDE, K_SHIFT_F1 = K_SHIFT|K_F1, K_SHIFT_F2 = K_SHIFT|K_F2, K_SHIFT_F3 = K_SHIFT|K_F3, K_SHIFT_F4 = K_SHIFT|K_F4, K_SHIFT_F5 = K_SHIFT|K_F5, K_SHIFT_F6 = K_SHIFT|K_F6, K_SHIFT_F7 = K_SHIFT|K_F7, K_SHIFT_F8 = K_SHIFT|K_F8, K_SHIFT_F9 = K_SHIFT|K_F9, K_SHIFT_F10 = K_SHIFT|K_F10, K_SHIFT_F11 = K_SHIFT|K_F11, K_SHIFT_F12 = K_SHIFT|K_F12, K_SHIFT_SCROLL = K_SHIFT|K_SCROLL, K_SHIFT_A = K_SHIFT|K_A, K_SHIFT_B = K_SHIFT|K_B, K_SHIFT_C = K_SHIFT|K_C, K_SHIFT_D = K_SHIFT|K_D, K_SHIFT_E = K_SHIFT|K_E, K_SHIFT_F = K_SHIFT|K_F, K_SHIFT_G = K_SHIFT|K_G, K_SHIFT_H = K_SHIFT|K_H, K_SHIFT_I = K_SHIFT|K_I, K_SHIFT_J = K_SHIFT|K_J, K_SHIFT_K = K_SHIFT|K_K, K_SHIFT_L = K_SHIFT|K_L, K_SHIFT_M = K_SHIFT|K_M, K_SHIFT_N = K_SHIFT|K_N, K_SHIFT_O = K_SHIFT|K_O, K_SHIFT_P = K_SHIFT|K_P, K_SHIFT_Q = K_SHIFT|K_Q, K_SHIFT_R = K_SHIFT|K_R, K_SHIFT_S = K_SHIFT|K_S, K_SHIFT_T = K_SHIFT|K_T, K_SHIFT_U = K_SHIFT|K_U, K_SHIFT_V = K_SHIFT|K_V, K_SHIFT_W = K_SHIFT|K_W, K_SHIFT_X = K_SHIFT|K_X, K_SHIFT_Y = K_SHIFT|K_Y, K_SHIFT_Z = K_SHIFT|K_Z, K_SHIFT_0 = K_SHIFT|K_0, K_SHIFT_1 = K_SHIFT|K_1, K_SHIFT_2 = K_SHIFT|K_2, K_SHIFT_3 = K_SHIFT|K_3, K_SHIFT_4 = K_SHIFT|K_4, K_SHIFT_5 = K_SHIFT|K_5, K_SHIFT_6 = K_SHIFT|K_6, K_SHIFT_7 = K_SHIFT|K_7, K_SHIFT_8 = K_SHIFT|K_8, K_SHIFT_9 = K_SHIFT|K_9, K_SHIFT_CTRL_BACK = K_SHIFT_CTRL|K_BACKSPACE, K_SHIFT_CTRL_BACKSPACE = K_SHIFT_CTRL|K_BACKSPACE, K_SHIFT_CTRL_TAB = K_SHIFT_CTRL|K_TAB, K_SHIFT_CTRL_RETURN = K_SHIFT_CTRL|K_ENTER, K_SHIFT_CTRL_ENTER = K_SHIFT_CTRL|K_ENTER, K_SHIFT_CTRL_ESCAPE = K_SHIFT_CTRL|K_ESCAPE, K_SHIFT_CTRL_SPACE = K_SHIFT_CTRL|K_SPACE, K_SHIFT_CTRL_PRIOR = K_SHIFT_CTRL|K_PAGEUP, K_SHIFT_CTRL_PAGEUP = K_SHIFT_CTRL|K_PAGEUP, K_SHIFT_CTRL_NEXT = K_SHIFT_CTRL|K_PAGEDOWN, K_SHIFT_CTRL_PAGEDOWN = K_SHIFT_CTRL|K_PAGEDOWN, K_SHIFT_CTRL_END = K_SHIFT_CTRL|K_END, K_SHIFT_CTRL_HOME = K_SHIFT_CTRL|K_HOME, K_SHIFT_CTRL_LEFT = K_SHIFT_CTRL|K_LEFT, K_SHIFT_CTRL_UP = K_SHIFT_CTRL|K_UP, K_SHIFT_CTRL_RIGHT = K_SHIFT_CTRL|K_RIGHT, K_SHIFT_CTRL_DOWN = K_SHIFT_CTRL|K_DOWN, K_SHIFT_CTRL_INSERT = K_SHIFT_CTRL|K_INSERT, K_SHIFT_CTRL_DELETE = K_SHIFT_CTRL|K_DELETE, K_SHIFT_CTRL_LBRACKET = K_SHIFT_CTRL|219|K_DELTA, K_SHIFT_CTRL_RBRACKET = K_SHIFT_CTRL|221|K_DELTA, K_SHIFT_CTRL_NUMPAD0 = K_SHIFT_CTRL|K_NUMPAD0, K_SHIFT_CTRL_NUMPAD1 = K_SHIFT_CTRL|K_NUMPAD1, K_SHIFT_CTRL_NUMPAD2 = K_SHIFT_CTRL|K_NUMPAD2, K_SHIFT_CTRL_NUMPAD3 = K_SHIFT_CTRL|K_NUMPAD3, K_SHIFT_CTRL_NUMPAD4 = K_SHIFT_CTRL|K_NUMPAD4, K_SHIFT_CTRL_NUMPAD5 = K_SHIFT_CTRL|K_NUMPAD5, K_SHIFT_CTRL_NUMPAD6 = K_SHIFT_CTRL|K_NUMPAD6, K_SHIFT_CTRL_NUMPAD7 = K_SHIFT_CTRL|K_NUMPAD7, K_SHIFT_CTRL_NUMPAD8 = K_SHIFT_CTRL|K_NUMPAD8, K_SHIFT_CTRL_NUMPAD9 = K_SHIFT_CTRL|K_NUMPAD9, K_SHIFT_CTRL_MULTIPLY = K_SHIFT_CTRL|K_MULTIPLY, K_SHIFT_CTRL_ADD = K_SHIFT_CTRL|K_ADD, K_SHIFT_CTRL_SEPARATOR = K_SHIFT_CTRL|K_SEPARATOR, K_SHIFT_CTRL_SUBRACT = K_SHIFT_CTRL|K_SUBTRACT, K_SHIFT_CTRL_DECIMAL = K_SHIFT_CTRL|K_DECIMAL, K_SHIFT_CTRL_DIVIDE = K_SHIFT_CTRL|K_DIVIDE, K_SHIFT_CTRL_F1 = K_SHIFT_CTRL|K_F1, K_SHIFT_CTRL_F2 = K_SHIFT_CTRL|K_F2, K_SHIFT_CTRL_F3 = K_SHIFT_CTRL|K_F3, K_SHIFT_CTRL_F4 = K_SHIFT_CTRL|K_F4, K_SHIFT_CTRL_F5 = K_SHIFT_CTRL|K_F5, K_SHIFT_CTRL_F6 = K_SHIFT_CTRL|K_F6, K_SHIFT_CTRL_F7 = K_SHIFT_CTRL|K_F7, K_SHIFT_CTRL_F8 = K_SHIFT_CTRL|K_F8, K_SHIFT_CTRL_F9 = K_SHIFT_CTRL|K_F9, K_SHIFT_CTRL_F10 = K_SHIFT_CTRL|K_F10, K_SHIFT_CTRL_F11 = K_SHIFT_CTRL|K_F11, K_SHIFT_CTRL_F12 = K_SHIFT_CTRL|K_F12, K_SHIFT_CTRL_SCROLL = K_SHIFT_CTRL|K_SCROLL, K_SHIFT_CTRL_A = K_SHIFT_CTRL|K_A, K_SHIFT_CTRL_B = K_SHIFT_CTRL|K_B, K_SHIFT_CTRL_C = K_SHIFT_CTRL|K_C, K_SHIFT_CTRL_D = K_SHIFT_CTRL|K_D, K_SHIFT_CTRL_E = K_SHIFT_CTRL|K_E, K_SHIFT_CTRL_F = K_SHIFT_CTRL|K_F, K_SHIFT_CTRL_G = K_SHIFT_CTRL|K_G, K_SHIFT_CTRL_H = K_SHIFT_CTRL|K_H, K_SHIFT_CTRL_I = K_SHIFT_CTRL|K_I, K_SHIFT_CTRL_J = K_SHIFT_CTRL|K_J, K_SHIFT_CTRL_K = K_SHIFT_CTRL|K_K, K_SHIFT_CTRL_L = K_SHIFT_CTRL|K_L, K_SHIFT_CTRL_M = K_SHIFT_CTRL|K_M, K_SHIFT_CTRL_N = K_SHIFT_CTRL|K_N, K_SHIFT_CTRL_O = K_SHIFT_CTRL|K_O, K_SHIFT_CTRL_P = K_SHIFT_CTRL|K_P, K_SHIFT_CTRL_Q = K_SHIFT_CTRL|K_Q, K_SHIFT_CTRL_R = K_SHIFT_CTRL|K_R, K_SHIFT_CTRL_S = K_SHIFT_CTRL|K_S, K_SHIFT_CTRL_T = K_SHIFT_CTRL|K_T, K_SHIFT_CTRL_U = K_SHIFT_CTRL|K_U, K_SHIFT_CTRL_V = K_SHIFT_CTRL|K_V, K_SHIFT_CTRL_W = K_SHIFT_CTRL|K_W, K_SHIFT_CTRL_X = K_SHIFT_CTRL|K_X, K_SHIFT_CTRL_Y = K_SHIFT_CTRL|K_Y, K_SHIFT_CTRL_Z = K_SHIFT_CTRL|K_Z, K_SHIFT_CTRL_0 = K_SHIFT_CTRL|K_0, K_SHIFT_CTRL_1 = K_SHIFT_CTRL|K_1, K_SHIFT_CTRL_2 = K_SHIFT_CTRL|K_2, K_SHIFT_CTRL_3 = K_SHIFT_CTRL|K_3, K_SHIFT_CTRL_4 = K_SHIFT_CTRL|K_4, K_SHIFT_CTRL_5 = K_SHIFT_CTRL|K_5, K_SHIFT_CTRL_6 = K_SHIFT_CTRL|K_6, K_SHIFT_CTRL_7 = K_SHIFT_CTRL|K_7, K_SHIFT_CTRL_8 = K_SHIFT_CTRL|K_8, K_SHIFT_CTRL_9 = K_SHIFT_CTRL|K_9, K_ALT_BACK = K_ALT|K_BACKSPACE, K_ALT_BACKSPACE = K_ALT|K_BACKSPACE, K_ALT_TAB = K_ALT|K_TAB, K_ALT_RETURN = K_ALT|K_ENTER, K_ALT_ENTER = K_ALT|K_ENTER, K_ALT_ESCAPE = K_ALT|K_ESCAPE, K_ALT_SPACE = K_ALT|K_SPACE, K_ALT_PRIOR = K_ALT|K_PAGEUP, K_ALT_PAGEUP = K_ALT|K_PAGEUP, K_ALT_NEXT = K_ALT|K_PAGEDOWN, K_ALT_PAGEDOWN = K_ALT|K_PAGEDOWN, K_ALT_END = K_ALT|K_END, K_ALT_HOME = K_ALT|K_HOME, K_ALT_LEFT = K_ALT|K_LEFT, K_ALT_UP = K_ALT|K_UP, K_ALT_RIGHT = K_ALT|K_RIGHT, K_ALT_DOWN = K_ALT|K_DOWN, K_ALT_INSERT = K_ALT|K_INSERT, K_ALT_DELETE = K_ALT|K_DELETE, K_ALT_NUMPAD0 = K_ALT|K_NUMPAD0, K_ALT_NUMPAD1 = K_ALT|K_NUMPAD1, K_ALT_NUMPAD2 = K_ALT|K_NUMPAD2, K_ALT_NUMPAD3 = K_ALT|K_NUMPAD3, K_ALT_NUMPAD4 = K_ALT|K_NUMPAD4, K_ALT_NUMPAD5 = K_ALT|K_NUMPAD5, K_ALT_NUMPAD6 = K_ALT|K_NUMPAD6, K_ALT_NUMPAD7 = K_ALT|K_NUMPAD7, K_ALT_NUMPAD8 = K_ALT|K_NUMPAD8, K_ALT_NUMPAD9 = K_ALT|K_NUMPAD9, K_ALT_MULTIPLY = K_ALT|K_MULTIPLY, K_ALT_ADD = K_ALT|K_ADD, K_ALT_SEPARATOR = K_ALT|K_SEPARATOR, K_ALT_SUBTRACT = K_ALT|K_SUBTRACT, K_ALT_DECIMAL = K_ALT|K_DECIMAL, K_ALT_DIVIDE = K_ALT|K_DIVIDE, K_ALT_F1 = K_ALT|K_F1, K_ALT_F2 = K_ALT|K_F2, K_ALT_F3 = K_ALT|K_F3, K_ALT_F4 = K_ALT|K_F4, K_ALT_F5 = K_ALT|K_F5, K_ALT_F6 = K_ALT|K_F6, K_ALT_F7 = K_ALT|K_F7, K_ALT_F8 = K_ALT|K_F8, K_ALT_F9 = K_ALT|K_F9, K_ALT_F10 = K_ALT|K_F10, K_ALT_F11 = K_ALT|K_F11, K_ALT_F12 = K_ALT|K_F12, K_ALT_SCROLL = K_ALT|K_SCROLL, K_ALT_A = K_ALT|K_A, K_ALT_B = K_ALT|K_B, K_ALT_C = K_ALT|K_C, K_ALT_D = K_ALT|K_D, K_ALT_E = K_ALT|K_E, K_ALT_F = K_ALT|K_F, K_ALT_G = K_ALT|K_G, K_ALT_H = K_ALT|K_H, K_ALT_I = K_ALT|K_I, K_ALT_J = K_ALT|K_J, K_ALT_K = K_ALT|K_K, K_ALT_L = K_ALT|K_L, K_ALT_M = K_ALT|K_M, K_ALT_N = K_ALT|K_N, K_ALT_O = K_ALT|K_O, K_ALT_P = K_ALT|K_P, K_ALT_Q = K_ALT|K_Q, K_ALT_R = K_ALT|K_R, K_ALT_S = K_ALT|K_S, K_ALT_T = K_ALT|K_T, K_ALT_U = K_ALT|K_U, K_ALT_V = K_ALT|K_V, K_ALT_W = K_ALT|K_W, K_ALT_X = K_ALT|K_X, K_ALT_Y = K_ALT|K_Y, K_ALT_Z = K_ALT|K_Z, K_ALT_0 = K_ALT|K_0, K_ALT_1 = K_ALT|K_1, K_ALT_2 = K_ALT|K_2, K_ALT_3 = K_ALT|K_3, K_ALT_4 = K_ALT|K_4, K_ALT_5 = K_ALT|K_5, K_ALT_6 = K_ALT|K_6, K_ALT_7 = K_ALT|K_7, K_ALT_8 = K_ALT|K_8, K_ALT_9 = K_ALT|K_9, K_CTRL_BREAK = K_CTRL|K_BREAK, }; #line 27 "u:/uppsrc\\CtrlCore/CtrlCore.h" enum { DELAY_MINIMAL = 0 }; void SetTimeCallback(int delay_ms, Callback cb, void *id = 0); void KillTimeCallback(void *id); bool ExistsTimeCallback(void *id); dword GetTimeClick(); inline void PostCallback(Callback cb, void *id = 0) { SetTimeCallback(1, cb, id); } class TimeCallback { public: ~TimeCallback() { Kill(); } void Set(int delay, Callback cb) { Upp::SetTimeCallback(delay, cb, this); } void Post(Callback cb) { Upp::PostCallback(cb, this); } void Kill() { Upp::KillTimeCallback(this); } void KillSet(int delay, Callback cb) { Kill(); Set(delay, cb); } void KillPost(Callback cb) { Kill(); Post(cb); } private: byte dummy; }; class Ctrl; class CtrlFrame { public: virtual void FrameLayout(Rect& r) = 0; virtual void FrameAddSize(Size& sz) = 0; virtual void FramePaint(Draw& w, const Rect& r); virtual void FrameAdd(Ctrl& parent); virtual void FrameRemove(); virtual int OverPaint() const; CtrlFrame() {} virtual ~CtrlFrame() {} #line 73 "u:/uppsrc\\CtrlCore/CtrlCore.h" private: CtrlFrame(const CtrlFrame&); void operator=(const CtrlFrame&); }; struct NullFrameClass : public CtrlFrame { virtual void FrameLayout(Rect& r); virtual void FramePaint(Draw& draw, const Rect& r); virtual void FrameAddSize(Size& sz); }; CtrlFrame& NullFrame(); class BorderFrame : public CtrlFrame { public: virtual void FrameLayout(Rect& r); virtual void FramePaint(Draw& w, const Rect& r); virtual void FrameAddSize(Size& sz); protected: const ColorF *border; public: BorderFrame(const ColorF *border) : border(border) {} #line 103 "u:/uppsrc\\CtrlCore/CtrlCore.h" }; CtrlFrame& InsetFrame(); CtrlFrame& OutsetFrame(); CtrlFrame& ButtonFrame(); CtrlFrame& ThinInsetFrame(); CtrlFrame& ThinOutsetFrame(); CtrlFrame& BlackFrame(); CtrlFrame& XPFieldFrame(); CtrlFrame& FieldFrame(); CtrlFrame& TopSeparatorFrame(); CtrlFrame& BottomSeparatorFrame(); CtrlFrame& LeftSeparatorFrame(); CtrlFrame& RightSeparatorFrame(); void LayoutFrameLeft(Rect& r, Ctrl *ctrl, int cx); void LayoutFrameRight(Rect& r, Ctrl *ctrl, int cx); void LayoutFrameTop(Rect& r, Ctrl *ctrl, int cy); void LayoutFrameBottom(Rect& r, Ctrl *ctrl, int cy); dword GetMouseFlags(); Point GetMousePos(); dword GetMouseFlags(); inline bool GetShift() { return !!(GetKeyState(0x10) & 0x8000); } inline bool GetCtrl() { return !!(GetKeyState(0x11) & 0x8000); } inline bool GetAlt() { return !!(GetKeyState(0x12) & 0x8000); } inline bool GetCapsLock() { return !!(GetKeyState(0x14) & 1); } inline bool GetMouseLeft() { return !!(GetKeyState(0x01) & 0x8000); } inline bool GetMouseRight() { return !!(GetKeyState(0x02) & 0x8000); } inline bool GetMouseMiddle() { return !!(GetKeyState(0x04) & 0x8000); } #line 150 "u:/uppsrc\\CtrlCore/CtrlCore.h" #line 151 "u:/uppsrc\\CtrlCore/CtrlCore.h" #line 1 "u:/uppsrc\\Draw/iml_header.h" class CtrlCoreImg { public: enum { #line 1 "u:/uppsrc\\CtrlCore/Ctrl.iml" I_DndMove, I_DndMove98, I_DndNone, I_DndNone98, I_DndCopy, I_DndCopy98, I_DndData, #line 20 "u:/uppsrc\\Draw/iml_header.h" COUNT }; public: static Upp::Iml& Iml(); static void Register__() { Register("CtrlCoreImg", Iml()); } static int Find(const Upp::String& s); static int Find(const char *s); static int GetCount() { return Iml().GetCount(); } static Upp::String GetId(int i) { return Iml().GetId(i); } static Upp::Image Get(int i); static Upp::Image Get(const char *s); static Upp::Image Get(const Upp::String& s); static void Set(int i, const Upp::Image& m); static void Set(const char *s, const Upp::Image& m); static void Reset() { Iml().Reset(); } #line 1 "u:/uppsrc\\CtrlCore/Ctrl.iml" static Upp::Image DndMove() { return Get(I_DndMove); } static Upp::Image DndMove98() { return Get(I_DndMove98); } static Upp::Image DndNone() { return Get(I_DndNone); } static Upp::Image DndNone98() { return Get(I_DndNone98); } static Upp::Image DndCopy() { return Get(I_DndCopy); } static Upp::Image DndCopy98() { return Get(I_DndCopy98); } static Upp::Image DndData() { return Get(I_DndData); } #line 47 "u:/uppsrc\\Draw/iml_header.h" }; #line 64 "u:/uppsrc\\Draw/iml_header.h" #line 174 "u:/uppsrc\\CtrlCore/CtrlCore.h" class TopWindow; class TrayIcon; class GLCtrl; enum { DND_NONE = 0, DND_COPY = 1, DND_MOVE = 2, DND_ALL = 3, }; struct UDropTarget; struct ClipData : Moveable { Value data; String (*render)(const Value& data); String Render() const { return (*render)(data); } ClipData(const Value& data, String (*render)(const Value& data)); ClipData(const String& data); ClipData(); }; class PasteClip { friend struct UDropTarget; friend class Ctrl; friend PasteClip sMakeDropClip(bool paste); UDropTarget *dt; #line 209 "u:/uppsrc\\CtrlCore/CtrlCore.h" byte action; byte allowed; bool paste; bool accepted; String fmt; String data; public: bool IsAvailable(const char *fmt) const; String Get(const char *fmt) const; bool Accept(); bool Accept(const char *fmt); String Get() const { return data; } operator String() const { return data; } String operator ~() const { return data; } void Reject() { accepted = false; data.Clear(); } int GetAction() const { return action; } int GetAllowedActions() const { return allowed; } void SetAction(int x) { action = x; } bool IsAccepted() const { return accepted; } bool IsQuery() const { return !paste; } bool IsPaste() const { return paste; } PasteClip(); }; String Unicode__(const WString& w); WString Unicode__(const String& s); const char *ClipFmtsText(); bool AcceptText(PasteClip& clip); String GetString(PasteClip& clip); WString GetWString(PasteClip& clip); String GetTextClip(const String& text, const String& fmt); String GetTextClip(const WString& text, const String& fmt); void Append(VectorMap& data, const String& text); void Append(VectorMap& data, const WString& text); const char *ClipFmtsImage(); bool AcceptImage(PasteClip& clip); Image GetImage(PasteClip& clip); String GetImageClip(const Image& m, const String& fmt); void Append(VectorMap& data, const Image& img); bool AcceptFiles(PasteClip& clip); Vector GetFiles(PasteClip& clip); template String ClipFmt() { return String("U++ type: ") + typeid(T).name(); } template bool Accept(PasteClip& clip) { return clip.Accept(ClipFmt()); } String GetInternalDropId__(const char *type, const char *id); void NewInternalDrop__(const void *ptr); const void *GetInternalDropPtr__(); template VectorMap InternalClip(const T& x, const char *id = "") { NewInternalDrop__(&x); VectorMap d; d.Add(GetInternalDropId__(typeid(T).name(), id)); return d; } template bool IsAvailableInternal(PasteClip& d, const char *id = "") { return d.IsAvailable(GetInternalDropId__(typeid(T).name(), id)); } template bool AcceptInternal(PasteClip& d, const char *id = "") { return d.Accept(GetInternalDropId__(typeid(T).name(), id)); } template const T& GetInternal(PasteClip& d) { return *(T *)GetInternalDropPtr__(); } class Ctrl : public Pte { public: enum PlacementConstants { CENTER = 0, MIDDLE = 0, LEFT = 1, RIGHT = 2, TOP = 1, BOTTOM = 2, SIZE = 3, MINSIZE = -16380, MAXSIZE = -16381, STDSIZE = -16382, }; class Logc { dword data; static int LSGN(dword d) { return int16(d & 0x7fff | ((d & 0x4000) << 1)); } public: bool operator==(Logc q) const { return data == q.data; } bool operator!=(Logc q) const { return data != q.data; } int GetAlign() const { return (data >> 30) & 3; } int GetA() const { return LSGN(data >> 15); } int GetB() const { return LSGN(data); } void SetAlign(int align) { data = (data & ~(3 << 30)) | (align << 30); } void SetA(int a) { data = (data & ~(0x7fff << 15)) | ((a & 0x7fff) << 15); } void SetB(int b) { data = (data & ~0x7fff) | (b & 0x7fff); } bool IsEmpty() const; Logc(int al, int a, int b) { data = (al << 30) | ((a & 0x7fff) << 15) | (b & 0x7fff); } Logc() { data = 0xffffffff; } }; struct LogPos { Logc x, y; bool operator==(LogPos b) const { return x == b.x && y == b.y; } bool operator!=(LogPos b) const { return !(*this == b); } LogPos(Logc x, Logc y) : x(x), y(y) {} LogPos() {} }; static Logc PosLeft(int pos, int size) { return Logc(LEFT, pos, size); } static Logc PosRight(int pos, int size) { return Logc(RIGHT, pos, size); } static Logc PosTop(int pos, int size) { return Logc(TOP, pos, size); } static Logc PosBottom(int pos, int size) { return Logc(BOTTOM, pos, size); } static Logc PosSize(int lpos, int rpos) { return Logc(SIZE, lpos, rpos); } static Logc PosCenter(int size, int offset) { return Logc(CENTER, offset, size); } static Logc PosCenter(int size) { return Logc(CENTER, 0, size); } typedef bool (*MouseHook)(Ctrl *ctrl, bool inframe, int event, Point p, int zdelta, dword keyflags); typedef bool (*KeyHook)(Ctrl *ctrl, dword key, int count); typedef bool (*StateHook)(Ctrl *ctrl, int reason); static dword KEYtoK(dword); private: Ctrl(Ctrl&); void operator=(Ctrl&); private: struct Frame : Moveable { CtrlFrame *frame; Rect16 view; Frame() { view.Clear(); } }; Ctrl *parent; struct Scroll : Moveable { Rect rect; int dx; int dy; }; struct MoveCtrl : Moveable { Ptr ctrl; Rect from; Rect to; }; friend struct UDropTarget; struct Top { HWND hwnd; UDropTarget *dndtgt; #line 401 "u:/uppsrc\\CtrlCore/CtrlCore.h" Vector scroll; VectorMap move; VectorMap scroll_move; Ptr owner; }; Top *top; int exitcode; Ctrl *prev, *next; Ctrl *firstchild, *lastchild; LogPos pos; Rect16 rect; Mitor frame; String info; int16 caretx, carety, caretcx, caretcy; byte overpaint; bool unicode:1; bool activex:1; #line 428 "u:/uppsrc\\CtrlCore/CtrlCore.h" bool fullrefresh:1; bool transparent:1; bool visible:1; bool enabled:1; bool wantfocus:1; bool initfocus:1; bool activepopup:1; bool editable:1; bool modify:1; bool ignoremouse:1; bool inframe:1; bool inloop:1; bool isopen:1; bool popup:1; bool popupgrab:1; byte backpaint:2; bool GLX:1; bool hasdhctrl:1; bool akv:1; bool destroying:1; static Ptr eventCtrl; static Ptr mouseCtrl; static Point mousepos; static Point leftmousepos, rightmousepos, middlemousepos; static Ptr focusCtrl; static Ptr focusCtrlWnd; static Ptr lastActiveWnd; static Ptr caretCtrl; static Rect caretRect; static Ptr captureCtrl; static bool ignoreclick; static bool ignorekeyup; static bool mouseinview; static bool mouseinframe; static bool globalbackpaint; static int LoopLevel; static Ctrl *LoopCtrl; static Ptr defferedSetFocus; static Vector< Ptr > defferedChildLostFocus; static Ptr repeatTopCtrl; static Point repeatMousePos; static Vector& mousehook(); static Vector& keyhook(); static Vector& statehook(); static Ptr FocusCtrl() { return focusCtrl; } static void FocusCtrl(Ptr fc) { focusCtrl = fc; } #line 489 "u:/uppsrc\\CtrlCore/CtrlCore.h" void StateDeep(int state); void RemoveChild0(Ctrl *q); static void ChSync(); static int FindMoveCtrl(const VectorMap& m, Ctrl *x); static MoveCtrl *FindMoveCtrlPtr(VectorMap& m, Ctrl *x); Size PosVal(int v) const; void Lay1(int& pos, int& r, int align, int a, int b, int sz) const; Rect CalcRect(LogPos pos, const Rect& prect, const Rect& pview) const; Rect CalcRect(const Rect& prect, const Rect& pview) const; void UpdateRect0(); void UpdateRect(); void SetPos0(LogPos p, bool inframe); void SetWndRect(const Rect& r); void SyncMoves(); static void EndIgnore(); static void LRep(); static void LHold(); static void LRepeat(); static void RRep(); static void RHold(); static void RRepeat(); static void MRep(); static void MHold(); static void MRepeat(); static void KillRepeat(); static void CheckMouseCtrl(); static void DoCursorShape(); static Image& CursorOverride(); bool IsMouseActive() const; Image MouseEventH(int event, Point p, int zdelta, dword keyflags); Image FrameMouseEventH(int event, Point p, int zdelta, dword keyflags); Image MEvent0(int e, Point p, int zd); Image DispatchMouse(int e, Point p, int zd = 0); Image DispatchMouseEvent(int e, Point p, int zd = 0); void LogMouseEvent(const char *f, const Ctrl *ctrl, int event, Point p, int zdelta, dword keyflags); void StateH(int reason); void RefreshAccessKeys(); void RefreshAccessKeysDo(bool vis); static void DefferedFocusSync(); static void SyncCaret(); static bool DispatchKey(dword keycode, int count); void SetFocusWnd(); void KillFocusWnd(); static Ptr dndctrl; static Point dndpos; static bool dndframe; static PasteClip dndclip; void DnD(Point p, PasteClip& clip); static void DnDRepeat(); static void DnDLeave(); void SyncLayout(int force = 0); bool AddScroll(const Rect& sr, int dx, int dy); Rect GetClippedView(); void ScrollRefresh(const Rect& r, int dx, int dy); void SyncScroll(); void CtrlPaint(Draw& w, const Rect& clip); void RemoveFullRefresh(); bool PaintOpaqueAreas(Draw& w, const Rect& r, const Rect& clip, bool nochild = false); void GatherTransparentAreas(Vector& area, Draw& w, Rect r, const Rect& clip); Ctrl *FindBestOpaque(const Rect& clip); void UpdateArea0(Draw& draw, const Rect& clip, int backpaint); void UpdateArea(Draw& draw, const Rect& clip); Ctrl *GetTopRect(Rect& r, bool inframe); void DoSync(Ctrl *q, Rect r, bool inframe); bool HasDHCtrl() const; void SyncDHCtrl(); void SetInfoPart(int i, const char *txt); String GetInfoPart(int i) const; void WndShow(bool b); void WndSetPos(const Rect& rect); bool IsWndOpen() const; bool SetWndCapture(); bool HasWndCapture() const; bool ReleaseWndCapture(); static void SetMouseCursor(const Image& m); static void DoDeactivate(Ptr pfocusCtrl, Ptr nfocusCtrl); static void DoKillFocus(Ptr pfocusCtrl, Ptr nfocusCtrl); static void DoSetFocus(Ptr pfocusCtrl, Ptr nfocusCtrl, bool activate); void ActivateWnd(); void ClickActivateWnd(); bool SetFocus0(bool activate); bool SetWndFocus(); bool HasWndFocus() const; static void WndDestroyCaret(); void WndCreateCaret(const Rect& cr); void WndInvalidateRect(const Rect& r); void SetWndForeground(); bool IsWndForeground() const; bool WndEnable(bool b); Rect GetWndUpdateRect() const; Rect GetWndScreenRect() const; void WndScrollView(const Rect& r, int dx, int dy); void WndUpdate(); void WndUpdate(const Rect& r); void WndFree(); void WndDestroy(); static void InitTimer(); static String appname; static Size Dsize; static Size Csize; static void Csizeinit(); static void (*skin)(); friend void CtrlSetDefaultSkin(void (*fn1)(), void (*fn2)()); friend class DHCtrl; friend class ViewDraw; friend class TopWindow; friend class TrayIcon; friend class GLCtrl; friend class WaitCursor; friend struct UDropSource; friend class DnDAction; friend class PasteClip; static LRESULT __stdcall UtilityProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); static void RenderFormat(int format); static void RenderAllFormats(); static void DestroyClipboard(); public: static Event& ExitLoopEvent(); static bool& EndSession(); static bool IsEndSession() { return EndSession(); } static HINSTANCE hInstance; protected: static HCURSOR hCursor; static VectorMap< HWND, Ptr >& Windows(); static LRESULT __stdcall WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); static Event OverwatchEndSession; static HWND OverwatchHWND; static HANDLE OverwatchThread; static LRESULT __stdcall OverwatchWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); static DWORD __stdcall Win32OverwatchThread(LPVOID); static Rect GetScreenClient(HWND hwnd); void Create(HWND parent, DWORD style, DWORD exstyle, bool savebits, int show, bool dropshadow); Image DoMouse(int e, Point p, int zd = 0); friend void sSetCursor(Ctrl *ctrl, const Image& m); public: virtual void NcCreate(HWND hwnd); virtual void NcDestroy(); virtual void PreDestroy(); virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); HWND GetHWND() const { return parent ? 0 : top ? top->hwnd : 0; } HWND GetOwnerHWND() const; static Ctrl *CtrlFromHWND(HWND hwnd); #line 673 "u:/uppsrc\\CtrlCore/CtrlCore.h" private: void DoRemove(); protected: static void TimerProc(dword time); Ctrl& Unicode() { unicode = true; return *this; } public: enum StateReason { FOCUS = 10, ACTIVATE = 11, DEACTIVATE = 12, SHOW = 13, ENABLE = 14, EDITABLE = 15, OPEN = 16, CLOSE = 17, POSITION = 100, LAYOUTPOS = 101, }; enum MouseEvents { BUTTON = 0x0F, ACTION = 0xF0, MOUSEENTER = 0x10, MOUSEMOVE = 0x20, MOUSELEAVE = 0x30, CURSORIMAGE = 0x40, MOUSEWHEEL = 0x50, DOWN = 0x80, UP = 0x90, DOUBLE = 0xa0, REPEAT = 0xb0, DRAG = 0xc0, HOLD = 0xd0, TRIPLE = 0xe0, LEFTDOWN = LEFT|DOWN, LEFTDOUBLE = LEFT|DOUBLE, LEFTREPEAT = LEFT|REPEAT, LEFTUP = LEFT|UP, LEFTDRAG = LEFT|DRAG, LEFTHOLD = LEFT|HOLD, LEFTTRIPLE = LEFT|TRIPLE, RIGHTDOWN = RIGHT|DOWN, RIGHTDOUBLE = RIGHT|DOUBLE, RIGHTREPEAT = RIGHT|REPEAT, RIGHTUP = RIGHT|UP, RIGHTDRAG = RIGHT|DRAG, RIGHTHOLD = RIGHT|HOLD, RIGHTTRIPLE = RIGHT|TRIPLE, MIDDLEDOWN = MIDDLE|DOWN, MIDDLEDOUBLE = MIDDLE|DOUBLE, MIDDLEREPEAT = MIDDLE|REPEAT, MIDDLEUP = MIDDLE|UP, MIDDLEDRAG = MIDDLE|DRAG, MIDDLEHOLD = MIDDLE|HOLD, MIDDLETRIPLE = MIDDLE|TRIPLE }; enum { NOBACKPAINT, FULLBACKPAINT, TRANSPARENTBACKPAINT, EXCLUDEPAINT, }; static Vector GetTopCtrls(); static Vector GetTopWindows(); static void CloseTopCtrls(); static void InstallMouseHook(MouseHook hook); static void DeinstallMouseHook(MouseHook hook); static void InstallKeyHook(KeyHook hook); static void DeinstallKeyHook(KeyHook hook); static void InstallStateHook(StateHook hook); static void DeinstallStateHook(StateHook hook); virtual bool Accept(); virtual void Reject(); virtual void SetData(const Value& data); virtual Value GetData() const; virtual void Serialize(Stream& s); virtual void SetModify(); virtual void ClearModify(); virtual bool IsModified() const; virtual void Paint(Draw& draw); virtual int OverPaint() const; virtual void CancelMode(); virtual void Activate(); virtual void Deactivate(); virtual Image FrameMouseEvent(int event, Point p, int zdelta, dword keyflags); virtual Image MouseEvent(int event, Point p, int zdelta, dword keyflags); virtual void MouseEnter(Point p, dword keyflags); virtual void MouseMove(Point p, dword keyflags); virtual void LeftDown(Point p, dword keyflags); virtual void LeftDouble(Point p, dword keyflags); virtual void LeftTriple(Point p, dword keyflags); virtual void LeftRepeat(Point p, dword keyflags); virtual void LeftDrag(Point p, dword keyflags); virtual void LeftHold(Point p, dword keyflags); virtual void LeftUp(Point p, dword keyflags); virtual void RightDown(Point p, dword keyflags); virtual void RightDouble(Point p, dword keyflags); virtual void RightTriple(Point p, dword keyflags); virtual void RightRepeat(Point p, dword keyflags); virtual void RightDrag(Point p, dword keyflags); virtual void RightHold(Point p, dword keyflags); virtual void RightUp(Point p, dword keyflags); virtual void MiddleDown(Point p, dword keyflags); virtual void MiddleDouble(Point p, dword keyflags); virtual void MiddleTriple(Point p, dword keyflags); virtual void MiddleRepeat(Point p, dword keyflags); virtual void MiddleDrag(Point p, dword keyflags); virtual void MiddleHold(Point p, dword keyflags); virtual void MiddleUp(Point p, dword keyflags); virtual void MouseWheel(Point p, int zdelta, dword keyflags); virtual void MouseLeave(); virtual void DragAndDrop(Point p, PasteClip& d); virtual void FrameDragAndDrop(Point p, PasteClip& d); virtual void DragRepeat(Point p); virtual void DragEnter(); virtual void DragLeave(); virtual String GetDropData(const String& fmt) const; virtual String GetSelectionData(const String& fmt) const; virtual Image CursorImage(Point p, dword keyflags); virtual bool Key(dword key, int count); virtual void GotFocus(); virtual void LostFocus(); virtual bool HotKey(dword key); virtual dword GetAccessKeys() const; virtual void AssignAccessKeys(dword used); virtual void PostInput(); virtual void ChildFrameMouseEvent(Ctrl *child, int event, Point p, int zdelta, dword keyflags); virtual void ChildMouseEvent(Ctrl *child, int event, Point p, int zdelta, dword keyflags); virtual void ChildGotFocus(); virtual void ChildLostFocus(); virtual void ChildAdded(Ctrl *child); virtual void ChildRemoved(Ctrl *child); virtual void ParentChange(); virtual void State(int reason); virtual void Layout(); virtual Size GetMinSize() const; virtual Size GetStdSize() const; virtual Size GetMaxSize() const; virtual bool IsShowEnabled() const; virtual Rect GetOpaqueRect(); virtual Rect GetVoidRect(); virtual void Updated(); virtual void Close(); virtual bool IsOcxChild(); virtual String GetDesc() const; Callback WhenAction; void AddChild(Ctrl *child); void AddChild(Ctrl *child, Ctrl *insafter); void AddChildBefore(Ctrl *child, Ctrl *insbefore); void RemoveChild(Ctrl *child); Ctrl *GetParent() const { return parent; } Ctrl *GetLastChild() const { return lastchild; } Ctrl *GetFirstChild() const { return firstchild; } Ctrl *GetPrev() const { return parent ? prev : 0; } Ctrl *GetNext() const { return parent ? next : 0; } bool IsChild() const { return parent; } Ctrl *ChildFromPoint(Point& pt) const; bool IsForeground() const; void SetForeground(); const Ctrl *GetTopCtrl() const; Ctrl *GetTopCtrl(); const Ctrl *GetOwner() const; Ctrl *GetOwner(); const Ctrl *GetTopCtrlOwner() const; Ctrl *GetTopCtrlOwner(); Ctrl *GetOwnerCtrl(); const Ctrl *GetOwnerCtrl() const; const TopWindow *GetTopWindow() const; TopWindow *GetTopWindow(); const TopWindow *GetMainWindow() const; TopWindow *GetMainWindow(); Ctrl& SetFrame(int i, CtrlFrame& frm); Ctrl& SetFrame(CtrlFrame& frm) { return SetFrame(0, frm); } Ctrl& AddFrame(CtrlFrame& frm); const CtrlFrame& GetFrame(int i = 0) const { return *frame[i].frame; } CtrlFrame& GetFrame(int i = 0) { return *frame[i].frame; } void RemoveFrame(int i); void RemoveFrame(CtrlFrame& frm); void InsertFrame(int i, CtrlFrame& frm); int FindFrame(CtrlFrame& frm); int GetFrameCount() const { return frame.GetCount(); } void ClearFrames(); bool IsOpen() const; void Shutdown() { destroying = true; } bool IsShutdown() const { return destroying; } Ctrl& SetPos(LogPos p, bool inframe); Ctrl& SetPos(LogPos p); Ctrl& SetPos(Logc x, Logc y) { return SetPos(LogPos(x, y)); } Ctrl& SetPosX(Logc x); Ctrl& SetPosY(Logc y); void SetRect(const Rect& r); void SetRect(int x, int y, int cx, int cy); void SetRectX(int x, int cx); void SetRectY(int y, int cy); Ctrl& SetFramePos(LogPos p); Ctrl& SetFramePos(Logc x, Logc y) { return SetFramePos(LogPos(x, y)); } Ctrl& SetFramePosX(Logc x); Ctrl& SetFramePosY(Logc y); void SetFrameRect(const Rect& r); void SetFrameRect(int x, int y, int cx, int cy); void SetFrameRectX(int x, int cx); void SetFrameRectY(int y, int cy); bool InFrame() const { return inframe; } bool InView() const { return !inframe; } LogPos GetPos() const { return pos; } void RefreshLayout() { SyncLayout(1); } void RefreshLayoutDeep() { SyncLayout(2); } void RefreshParentLayout() { if(parent) parent->RefreshLayout(); } Ctrl& LeftPos(int a, int size = STDSIZE); Ctrl& RightPos(int a, int size = STDSIZE); Ctrl& TopPos(int a, int size = STDSIZE); Ctrl& BottomPos(int a, int size = STDSIZE); Ctrl& HSizePos(int a = 0, int b = 0); Ctrl& VSizePos(int a = 0, int b = 0); Ctrl& SizePos(); Ctrl& HCenterPos(int size = STDSIZE, int delta = 0); Ctrl& VCenterPos(int size = STDSIZE, int delta = 0); Ctrl& LeftPosZ(int a, int size = STDSIZE); Ctrl& RightPosZ(int a, int size = STDSIZE); Ctrl& TopPosZ(int a, int size = STDSIZE); Ctrl& BottomPosZ(int a, int size = STDSIZE); Ctrl& HSizePosZ(int a = 0, int b = 0); Ctrl& VSizePosZ(int a = 0, int b = 0); Ctrl& HCenterPosZ(int size = STDSIZE, int delta = 0); Ctrl& VCenterPosZ(int size = STDSIZE, int delta = 0); Rect GetRect() const; Rect GetScreenRect() const; Rect GetView() const; Rect GetScreenView() const; Size GetSize() const; Rect GetVisibleScreenRect() const; Rect GetVisibleScreenView() const; Rect GetWorkArea() const; Size AddFrameSize(int cx, int cy) const; Size AddFrameSize(Size sz) const { return AddFrameSize(sz.cx, sz.cy); } void Refresh(const Rect& r); void Refresh(int x, int y, int cx, int cy); void Refresh(); bool IsFullRefresh() const { return fullrefresh; } void RefreshFrame(const Rect& r); void RefreshFrame(int x, int y, int cx, int cy); void RefreshFrame(); void ScrollView(const Rect& r, int dx, int dy); void ScrollView(int x, int y, int cx, int cy, int dx, int dy); void ScrollView(int dx, int dy); void ScrollView(const Rect& r, Size delta) { ScrollView(r, delta.cx, delta.cy); } void ScrollView(Size delta) { ScrollView(delta.cx, delta.cy); } void Sync(); void Sync(const Rect& r); static Image OverrideCursor(const Image& m); void DrawCtrl(Draw& w, int x = 0, int y = 0); void DrawCtrlWithParent(Draw& w, int x = 0, int y = 0); bool HasChild(Ctrl *ctrl) const; bool HasChildDeep(Ctrl *ctrl) const; Ctrl& IgnoreMouse(bool b = true) { ignoremouse = b; return *this; } Ctrl& NoIgnoreMouse() { return IgnoreMouse(false); } bool HasMouse() const; bool HasMouseDeep() const; bool HasMouseInFrame(const Rect& r); bool HasMouseIn(const Rect& r) const; Point GetMouseViewPos() const; static Ctrl *GetMouseCtrl(); static void IgnoreMouseClick(); static void IgnoreMouseUp(); bool SetCapture(); bool ReleaseCapture(); bool HasCapture() const; static bool ReleaseCtrlCapture(); bool SetFocus(); bool HasFocus() const { return FocusCtrl() == this; } bool HasFocusDeep() const; Ctrl& WantFocus(bool ft = true) { wantfocus = ft; return *this; } Ctrl& NoWantFocus() { return WantFocus(false); } bool IsWantFocus() const { return wantfocus; } bool SetWantFocus(); Ctrl& InitFocus(bool ft = true) { initfocus = ft; return *this; } Ctrl& NoInitFocus() { return InitFocus(false); } bool IsInitFocus() { return initfocus; } Ctrl *GetFocusChild() const { return HasChild(FocusCtrl()) ? ~FocusCtrl() : 0; } Ctrl *GetFocusChildDeep() const { return HasChildDeep(FocusCtrl()) ? ~FocusCtrl() : 0; } void CancelModeDeep(); void SetCaret(int x, int y, int cx, int cy); void SetCaret(const Rect& r); Rect GetCaret() const; void KillCaret(); static Ctrl *GetFocusCtrl() { return FocusCtrl(); } static Ctrl *GetEventTopCtrl() { return eventCtrl; } static bool IterateFocusForward(Ctrl *ctrl, Ctrl *top, bool noframe = false, bool init = false, bool all = false); static bool IterateFocusBackward(Ctrl *ctrl, Ctrl *top, bool noframe = false, bool all = false); static dword AccessKeyBit(byte accesskey); dword GetAccessKeysDeep() const; void DistributeAccessKeys(); bool VisibleAccessKeys(); void Show(bool show = true); void Hide() { Show(false); } bool IsShown() const { return visible; } bool IsVisible() const; void Enable(bool enable = true); void Disable() { Enable(false); } bool IsEnabled() const { return enabled; } Ctrl& SetEditable(bool editable = true); Ctrl& SetReadOnly() { return SetEditable(false); } bool IsEditable() const { return editable; } bool IsReadOnly() const { return !editable; } void ResetModify() { modify = false; } bool IsModifySet() const { return modify; } void UpdateRefresh(); void Update(); void Action(); void UpdateAction(); void UpdateActionRefresh(); Ctrl& BackPaint(int bp = FULLBACKPAINT) { backpaint = bp; return *this; } Ctrl& TransparentBackPaint() { backpaint = TRANSPARENTBACKPAINT; return *this; } Ctrl& NoBackPaint() { return BackPaint(NOBACKPAINT); } Ctrl& BackPaintHint(); int GetBackPaint() { return backpaint; } Ctrl& Transparent(bool bp = true) { transparent = bp; return *this; } Ctrl& NoTransparent() { return Transparent(false); } bool IsTransparent() const { return transparent; } Ctrl& ActiveX(bool ax = true) { activex = ax; return *this; } Ctrl& NoActiveX() { return ActiveX(false); } bool IsActiveX() const { return activex; } #line 1185 "u:/uppsrc\\CtrlCore/CtrlCore.h" Ctrl& Info(const char *txt) { info = txt; return *this; } String GetInfo() const { return info; } Ctrl& Tip(const char *txt); Ctrl& HelpLine(const char *txt); Ctrl& Description(const char *txt); Ctrl& HelpTopic(const char *txt); Ctrl& LayoutId(const char *txt); String GetTip() const; String GetHelpLine() const; String GetDescription() const; String GetHelpTopic() const; String GetLayoutId() const; void Add(Ctrl& ctrl) { AddChild(&ctrl); } Ctrl& operator<<(Ctrl& ctrl) { Add(ctrl); return *this; } void Remove(); Value operator~() const { return GetData(); } const Value& operator<<=(const Value& v) { SetData(v); return v; } bool IsNullInstance() const { return GetData().IsNull(); } Callback operator<<=(Callback action) { WhenAction = action; return action; } Callback& operator<<(Callback action) { return WhenAction << action; } void SetTimeCallback(int delay_ms, Callback cb, int id = 0); void KillTimeCallback(int id = 0); void KillSetTimeCallback(int delay_ms, Callback cb, int id); bool ExistsTimeCallback(int id = 0) const; void PostCallback(Callback cb, int id = 0); void KillPostCallback(Callback cb, int id); enum { TIMEID_COUNT = 1 }; static void SetTimerGranularity(int ms); static Ctrl *GetActiveCtrl(); static Ctrl *GetActiveWindow(); static Ctrl *GetVisibleChild(Ctrl *ctrl, Point p, bool pointinframe); void PopUpHWND(HWND hwnd, bool savebits = true, bool activate = true, bool dropshadow = false, bool topmost = false); #line 1233 "u:/uppsrc\\CtrlCore/CtrlCore.h" void PopUp(Ctrl *owner = 0, bool savebits = true, bool activate = true, bool dropshadow = false, bool topmost = false); void SetAlpha(byte alpha); static bool IsWaitingEvent(); static bool ProcessEvent(bool *quit = 0); static bool ProcessEvents(bool *quit = 0); bool IsPopUp() const { return popup; } static void EventLoop(Ctrl *loopctrl = 0); static int GetLoopLevel() { return LoopLevel; } static Ctrl *GetLoopCtrl() { return LoopCtrl; } void EndLoop() { inloop = false; } void EndLoop(int code) { ; exitcode = code; EndLoop(); } bool InLoop() const { return inloop; } bool InCurrentLoop() const { return GetLoopCtrl() == this; } int GetExitCode() const { return exitcode; } static PasteClip& Clipboard(); static PasteClip& Selection(); void SetSelectionSource(const char *fmts); int DoDragAndDrop(const char *fmts, const Image& sample, dword actions, const VectorMap& data); int DoDragAndDrop(const char *fmts, const Image& sample = Null, dword actions = DND_ALL); int DoDragAndDrop(const VectorMap& data, const Image& sample = Null, dword actions = DND_ALL); static Ctrl *GetDragAndDropSource(); static Ctrl *GetDragAndDropTarget(); bool IsDragAndDropSource() { return this == GetDragAndDropSource(); } bool IsDragAndDropTarget() { return this == GetDragAndDropTarget(); } static Size StdSampleSize() { return Size(126, 106); } void SetMinSize(Size sz) {} public: static void SetSkin(void (*skin)()); static const char *GetZoomText(); static void SetZoomSize(Size sz, Size bsz = Size(0, 0)); static int HorzLayoutZoom(int cx); static int VertLayoutZoom(int cy); static Size LayoutZoom(int cx, int cy); static Size LayoutZoom(Size sz); static void NoLayoutZoom(); static void GetZoomRatio(Size& m, Size& d); static int HZoom(int cx) { return HorzLayoutZoom(cx); } static bool ClickFocus(); static void ClickFocus(bool cf); static Rect GetVirtualWorkArea(); static Rect GetVirtualScreenArea(); static Rect GetPrimaryWorkArea(); static Rect GetPrimaryScreenArea(); static int GetKbdDelay(); static int GetKbdSpeed(); static bool IsAlphaSupported(); static Rect GetDefaultWindowRect(); static String GetAppName(); static void SetAppName(const String& appname); static bool IsCompositedGui(); static void GlobalBackPaint(bool b = true); static void GlobalBackPaintHint(); String Name() const; static void ShowRepaint(int ms); static bool MemoryCheck; static void InitWin32(HINSTANCE hinst); static void ExitWin32(); static void GuiFlush() { ::GdiFlush(); } #line 1325 "u:/uppsrc\\CtrlCore/CtrlCore.h" #line 1326 "u:/uppsrc\\CtrlCore/CtrlCore.h" static void GuiSleep(int ms); Ctrl(); virtual ~Ctrl(); }; Font FontZ(int face, int height = 0); Font StdFontZ(int height = 0); Font ScreenSansZ(int height = 0); Font ScreenSerifZ(int height = 0); Font ScreenFixedZ(int height = 0); Font RomanZ(int height = 0); Font ArialZ(int height = 0); Font CourierZ(int height = 0); int EditFieldIsThin(); Value TopSeparator1(); Value TopSeparator2(); int FrameButtonWidth(); int ScrollBarArrowSize(); Color FieldFrameColor(); enum { GUISTYLE_FLAT, GUISTYLE_CLASSIC, GUISTYLE_XP, GUISTYLE_X }; int GUI_GlobalStyle(); int GUI_DragFullWindow(); enum { GUIEFFECT_NONE, GUIEFFECT_SLIDE, GUIEFFECT_FADE }; int GUI_PopUpEffect(); int GUI_DropShadows(); int GUI_AltAccessKeys(); int GUI_AKD_Conservative(); int GUI_DragDistance(); int GUI_DblClickTime(); void GUI_GlobalStyle_Write(int); void GUI_DragFullWindow_Write(int); void GUI_PopUpEffect_Write(int); void GUI_DropShadows_Write(int); void GUI_AltAccessKeys_Write(int); void GUI_AKD_Conservative_Write(int); void GUI_DragDistance_Write(int); void GUI_DblClickTime_Write(int); void EditFieldIsThin_Write(int); void TopSeparator1_Write(Value); void TopSeparator2_Write(Value); void FrameButtonWidth_Write(int); void ScrollBarArrowSize_Write(int); void FieldFrameColor_Write(Color); String Name(const Ctrl *ctrl); String Desc(const Ctrl *ctrl); void Dump(const Ctrl *ctrl); inline Ctrl *operator<<(Ctrl *parent, Ctrl& child) { parent->Add(child); return parent; } inline unsigned GetHashValue(Ctrl *x) { return (unsigned)(intptr_t)x; } String GetKeyDesc(dword key); Vector< Ptr > DisableCtrls(const Vector& ctrl, Ctrl *exclude = 0); void EnableCtrls(const Vector< Ptr >& ctrl); template class FrameCtrl : public T, public CtrlFrame { public: virtual void FrameAdd(Ctrl& parent) { parent.Add(*this); } virtual void FrameRemove() { this->Ctrl::Remove(); } FrameCtrl() { this->NoWantFocus(); } }; template class FrameLR : public FrameCtrl { public: virtual void FrameAddSize(Size& sz) { sz.cx += (cx ? cx : sz.cy) * this->IsShown(); } protected: int cx; public: FrameLR& Width(int _cx) { cx = _cx; this->RefreshParentLayout(); return *this; } int GetWidth() const { return cx; } FrameLR() { cx = 0; } }; template class FrameLeft : public FrameLR { public: virtual void FrameLayout(Rect& r) { LayoutFrameLeft(r, this, this->cx ? this->cx : FrameButtonWidth()); } }; template class FrameRight : public FrameLR { public: virtual void FrameLayout(Rect& r) { LayoutFrameRight(r, this, this->cx ? this->cx : FrameButtonWidth()); } }; template class FrameTB : public FrameCtrl { public: virtual void FrameAddSize(Size& sz) { sz.cy += (cy ? cy : sz.cx) * this->IsShown(); } protected: int cy; public: FrameTB& Height(int _cy) { cy = _cy; this->RefreshParentLayout(); return *this; } int GetHeight() const { return cy; } FrameTB() { cy = 0; } }; template class FrameTop : public FrameTB { public: virtual void FrameLayout(Rect& r) { LayoutFrameTop(r, this, this->cy ? this->cy : r.Width()); } }; template class FrameBottom : public FrameTB { public: virtual void FrameLayout(Rect& r) { LayoutFrameBottom(r, this, this->cy ? this->cy : r.Width()); } }; class Modality { Ptr active; bool fore_only; Vector< Ptr > enable; public: void Begin(Ctrl *modal, bool fore_only = false); void End(); ~Modality() { End(); } }; class ViewDraw : public Draw { public: ViewDraw(Ctrl *ctrl); ~ViewDraw(); protected: HWND hwnd; #line 1495 "u:/uppsrc\\CtrlCore/CtrlCore.h" }; inline unsigned GetHashValue(const HWND& hwnd) { return (unsigned)(intptr_t)hwnd; } #line 1507 "u:/uppsrc\\CtrlCore/CtrlCore.h" #line 1508 "u:/uppsrc\\CtrlCore/CtrlCore.h" class LocalLoop : public Ctrl { Ctrl *master; public: void Run(); void SetMaster(Ctrl& m) { master = &m; } Ctrl& GetMaster() const { return *master; } LocalLoop() { master = 0; } }; void DrawDragRect(Ctrl& q, const Rect& rect1, const Rect& rect2, const Rect& clip, int n, Color color, const word *pattern); bool PointLoop(Ctrl& ctrl, const Vector& ani, int ani_ms); bool PointLoop(Ctrl& ctrl, const Image& img); class RectTracker : public LocalLoop { public: virtual void LeftUp(Point, dword); virtual void RightUp(Point, dword); virtual void MouseMove(Point p, dword); virtual Image CursorImage(Point, dword); public: struct Rounder { virtual Rect Round(const Rect& r) = 0; virtual ~Rounder() {} }; protected: Rect rect; int tx, ty; Rect maxrect; Size minsize, maxsize; bool keepratio; Rect clip; Color color; Image cursorimage; int width; uint64 pattern; int animation; int panim; Rounder *rounder; Rect org; Rect o; Point op; Rect Round(const Rect& r) { return rounder ? rounder->Round(r) : r; } virtual void DrawRect(Rect r1, Rect r2); public: Callback1 sync; RectTracker& SetCursorImage(const Image& m) { cursorimage = m; return *this; } RectTracker& MinSize(Size sz) { minsize = sz; return *this; } RectTracker& MaxSize(Size sz) { maxsize = sz; return *this; } RectTracker& MaxRect(const Rect& mr) { maxrect = mr; return *this; } RectTracker& Clip(const Rect& c) { clip = c; return *this; } RectTracker& Width(int n) { width = n; return *this; } RectTracker& SetColor(Color c) { color = c; return *this; } RectTracker& Pattern(uint64 p) { pattern = p; return *this; } RectTracker& Dashed(); RectTracker& Solid(); RectTracker& Animation(int step_ms = 40) { animation = step_ms; return *this; } RectTracker& KeepRatio(bool b) { keepratio = b; return *this; } RectTracker& Round(Rounder& r) { rounder = &r; return *this; } Rect Get() { return rect; } Rect Track(const Rect& r, int tx = ALIGN_RIGHT, int ty = ALIGN_BOTTOM); int TrackHorzLine(int x0, int y0, int cx, int line); int TrackVertLine(int x0, int y0, int cy, int line); RectTracker(Ctrl& master); virtual ~RectTracker(); }; class WaitCursor { Image prev; bool flag; public: void Show(); WaitCursor(bool show = true); ~WaitCursor(); }; class AutoWaitCursor : public WaitCursor { protected: int& avg; int time0; public: void Cancel() { time0 = 0; } AutoWaitCursor(int& avg); ~AutoWaitCursor(); }; void ClearClipboard(); void AppendClipboard(const char *format, const byte *data, int length); void AppendClipboard(const char *format, const String& data); void AppendClipboard(const char *format, const Value& data, String (*render)(const Value& data)); String ReadClipboard(const char *format); bool IsClipboardAvailable(const char *format); inline void WriteClipboard(const char *format, const String& data) { ClearClipboard(); AppendClipboard(format, data); } void AppendClipboardText(const String& s); String ReadClipboardText(); void AppendClipboardUnicodeText(const WString& s); WString ReadClipboardUnicodeText(); bool IsClipboardAvailableText(); inline void WriteClipboardText(const String& s) { ClearClipboard(); AppendClipboardText(s); } inline void WriteClipboardUnicodeText(const WString& s) { ClearClipboard(); AppendClipboardUnicodeText(s); } template inline void AppendClipboardFormat(const T& object) { AppendClipboard(typeid(T).name(), StoreAsString(const_cast(object))); } template inline void WriteClipboardFormat(const T& object) { ClearClipboard(); AppendClipboardFormat(object); } template inline bool ReadClipboardFormat(T& object) { String s = ReadClipboard(typeid(T).name()); return !IsNull(s) && LoadFromString(object, s); } template bool IsClipboardFormatAvailable() { return IsClipboardAvailable(typeid(T).name()); } template inline T ReadClipboardFormat() { T object; ReadClipboardFormat(object); return object; } Image ReadClipboardImage(); void AppendClipboardImage(const Image& img); inline void WriteClipboardImage(const Image& img) { ClearClipboard(); AppendClipboardImage(img); } #line 1 "u:/uppsrc\\CtrlCore/TopWindow.h" enum { IDEXIT = 6 }; class TopWindow : public Ctrl { public: virtual Size GetMinSize() const; virtual Size GetStdSize() const; virtual void Activate(); virtual void Deactivate(); virtual bool Accept(); virtual void Reject(); virtual void Paint(Draw& w); virtual bool IsShowEnabled() const; virtual bool Key(dword key, int count); virtual void Close(); virtual String GetDesc() const; virtual void ChildGotFocus(); public: virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); private: dword style; dword exstyle; HICON ico, lico; void DeleteIco(); #line 48 "u:/uppsrc\\CtrlCore/TopWindow.h" protected: enum { TIMEID_DEFSYNCTITLE = Ctrl::TIMEID_COUNT, TIMEID_COUNT, }; static Rect windowFrameMargin; private: struct Abreak : Pte { int ID; TopWindow *dlg; void Accept() { dlg->AcceptBreak(ID); } void Reject() { dlg->RejectBreak(ID); } void Break() { dlg->Break(ID); } }; Array action; Ptr activefocus; String backup; PaintRect background; Size minsize; bool dokeys; bool fullscreen; byte center:2; void PlaceFocus(); void ActiveFocus0(Ctrl& ctrl); Abreak *FindAddAction(int ID); Abreak *FindAction(int ID); void CenterRect(HWND owner, int center); #line 95 "u:/uppsrc\\CtrlCore/TopWindow.h" Rect overlapped; void SyncSizeHints(); void SyncTitle(); void SyncCaption(); void SetupRect(); void FixIcons(); enum { MINIMIZED, MAXIMIZED, OVERLAPPED }; WString title; bool minimizebox:1; bool maximizebox:1; bool sizeable:1; bool tool:1; byte state; Image icon, largeicon; public: Callback WhenClose; void Backup(); void Restore(); void Break(int ID = IDEXIT); bool AcceptBreak(int ID); void RejectBreak(int ID); void WorkAreaTrim(); Callback Breaker(int ID = IDEXIT); Callback Acceptor(int ID); Callback Rejector(int ID); TopWindow& Breaker(Ctrl& m, int ID = -1); TopWindow& Acceptor(Ctrl& m, int ID); TopWindow& Rejector(Ctrl& m, int ID); TopWindow& NoCenter() { center = 0; return *this; } TopWindow& CenterOwner() { center = 1; return *this; } TopWindow& CenterScreen() { center = 2; return *this; } void SetMinSize(Size sz) { minsize = sz; } void Open(HWND ownerhwnd); TopWindow& Style(dword _style); dword GetStyle() const { return style; } TopWindow& ExStyle(dword _exstyle); dword GetExStyle() const { return exstyle; } #line 159 "u:/uppsrc\\CtrlCore/TopWindow.h" void Open(Ctrl *owner); void Open(); void OpenMain(); int Run(bool appmodal = false); int RunAppModal() { return Run(true); } int Execute(); bool ExecuteOK() { return Execute() == 1; } bool ExecuteCancel() { return Execute() == 2; } void Minimize(bool effect = false); void Maximize(bool effect = false); void Overlap(bool effect = false); bool IsMaximized() const { return state == MAXIMIZED; } bool IsMinimized() const { return state == MINIMIZED; } bool IsOverlapped() const { return state == OVERLAPPED; } TopWindow& ActiveFocus(Ctrl& ctrl) { ActiveFocus0(ctrl); return *this; } TopWindow& Title(const WString& _title); TopWindow& Title(const char *s); const WString& GetTitle() const { return title; } TopWindow& Sizeable(bool b = true); TopWindow& NoSizeable() { return Sizeable(false); } bool IsSizeable() const { return sizeable; } TopWindow& MinimizeBox(bool b = true); TopWindow& MaximizeBox(bool b = true); TopWindow& Zoomable(bool b = true) { MinimizeBox(b); return MaximizeBox(b); } TopWindow& NoZoomable() { return Zoomable(false); } bool IsZoomable() const { return maximizebox; } TopWindow& Background(const PaintRect& prect); const PaintRect& GetBackground() const { return background; } TopWindow& ToolWindow(bool b = true); TopWindow& NoToolWindow() { return ToolWindow(false); } bool IsToolWindow() const { return tool; } TopWindow& TopMost(bool b = true, bool stay_top = true); TopWindow& NoTopMost() { return TopMost(false); } bool IsTopMost() const; TopWindow& FullScreen(bool b = true) { fullscreen = b; return *this; } bool IsFullScreen() const { return fullscreen; } TopWindow& NoAccessKeysDistribution() { dokeys = false; return *this; } TopWindow& Icon(const Image& m); TopWindow& LargeIcon(const Image& m); TopWindow& Icon(const Image& smallicon, const Image& largeicon); Image GetIcon() const { return icon; } Image GetLargeIcon() const { return largeicon; } void SerializePlacement(Stream& s, bool reminimize = false); typedef TopWindow CLASSNAME; TopWindow(); ~TopWindow(); }; void Maxisize(TopWindow& win, int screencxmax); void ArrangeOKCancel(Ctrl& ok, Ctrl& cancel); int SwapOKCancel(); void SwapOKCancel_Write(int b); template void InitLayout(Ctrl& ctrl, L& layout) { InitLayout(ctrl, layout, layout, layout); } template void CtrlLayout(T& ctrl) { InitLayout(ctrl, ctrl, ctrl, ctrl); Size sz = ctrl.AddFrameSize(T::GetLayoutSize()); ctrl.SetMinSize(sz); ctrl.SetRect(sz); } template void CtrlLayout(T& ctrl, const char *title) { CtrlLayout(ctrl); ctrl.Title(title); } template void CtrlLayoutOK(T& ctrl, const char *title) { CtrlLayout(ctrl, title); ctrl.Acceptor(ctrl.ok, 1); ctrl.ok.Ok(); } template void CtrlLayoutCancel(T& ctrl, const char *title) { CtrlLayout(ctrl, title); ctrl.Rejector(ctrl.cancel, 2); ctrl.cancel.Cancel(); } template void CtrlLayoutOKCancel(T& ctrl, const char *title) { CtrlLayoutOK(ctrl, title); ctrl.Rejector(ctrl.cancel, 2); ctrl.cancel.Cancel(); ArrangeOKCancel(ctrl.ok, ctrl.cancel); } template void CtrlLayoutExit(T& ctrl, const char *title) { CtrlLayout(ctrl, title); ctrl.Acceptor(ctrl.exit, IDEXIT); ctrl.exit.Exit(); } #line 1671 "u:/uppsrc\\CtrlCore/CtrlCore.h" bool (*&DisplayErrorFn())(const Value& v); inline bool DisplayError(const Value& v) { return DisplayErrorFn()(v); } Vector& coreCmdLine__(); Vector SplitCmdLine__(const char *cmd); #line 1723 "u:/uppsrc\\CtrlCore/CtrlCore.h" #line 1724 "u:/uppsrc\\CtrlCore/CtrlCore.h" class DHCtrl : public Ctrl { public: virtual void State(int reason); virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); virtual void NcCreate(HWND hwnd); virtual void NcDestroy(); private: HWND hwnd; void CloseHWND(); void OpenHWND(); void SyncHWND(); public: HWND GetHWND() { return hwnd; } DHCtrl(); ~DHCtrl(); }; #line 1771 "u:/uppsrc\\CtrlCore/CtrlCore.h" #line 1772 "u:/uppsrc\\CtrlCore/CtrlCore.h" }; #line 1 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 22 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 23 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 32 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 33 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 42 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 43 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 1 "d:\\sdk\\Microsoft SDK\\include\\pshpack1.h" #pragma warning(disable:4103) #pragma pack(push,1) #line 30 "d:\\sdk\\Microsoft SDK\\include\\pshpack1.h" #line 33 "d:\\sdk\\Microsoft SDK\\include\\pshpack1.h" #line 34 "d:\\sdk\\Microsoft SDK\\include\\pshpack1.h" #line 47 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 48 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" extern "C" { #line 52 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" struct HDROP__ { int unused; }; typedef struct HDROP__ *HDROP; extern "C" __declspec(dllimport) UINT __stdcall DragQueryFileA(HDROP,UINT,LPSTR,UINT); extern "C" __declspec(dllimport) UINT __stdcall DragQueryFileW(HDROP,UINT,LPWSTR,UINT); #line 64 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" extern "C" __declspec(dllimport) BOOL __stdcall DragQueryPoint(HDROP,LPPOINT); extern "C" __declspec(dllimport) void __stdcall DragFinish(HDROP); extern "C" __declspec(dllimport) void __stdcall DragAcceptFiles(HWND,BOOL); extern "C" __declspec(dllimport) HINSTANCE __stdcall ShellExecuteA(HWND hwnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, INT nShowCmd); extern "C" __declspec(dllimport) HINSTANCE __stdcall ShellExecuteW(HWND hwnd, LPCWSTR lpOperation, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd); #line 75 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" extern "C" __declspec(dllimport) HINSTANCE __stdcall FindExecutableA(LPCSTR lpFile, LPCSTR lpDirectory, LPSTR lpResult); extern "C" __declspec(dllimport) HINSTANCE __stdcall FindExecutableW(LPCWSTR lpFile, LPCWSTR lpDirectory, LPWSTR lpResult); #line 82 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" extern "C" __declspec(dllimport) LPWSTR * __stdcall CommandLineToArgvW(LPCWSTR lpCmdLine, int*pNumArgs); extern "C" __declspec(dllimport) INT __stdcall ShellAboutA(HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon); extern "C" __declspec(dllimport) INT __stdcall ShellAboutW(HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff, HICON hIcon); #line 91 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" extern "C" __declspec(dllimport) HICON __stdcall DuplicateIcon(HINSTANCE hInst, HICON hIcon); extern "C" __declspec(dllimport) HICON __stdcall ExtractAssociatedIconA(HINSTANCE hInst, LPSTR lpIconPath, LPWORD lpiIcon); extern "C" __declspec(dllimport) HICON __stdcall ExtractAssociatedIconW(HINSTANCE hInst, LPWSTR lpIconPath, LPWORD lpiIcon); #line 99 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" extern "C" __declspec(dllimport) HICON __stdcall ExtractAssociatedIconExA(HINSTANCE hInst,LPSTR lpIconPath,LPWORD lpiIconIndex, LPWORD lpiIconId); extern "C" __declspec(dllimport) HICON __stdcall ExtractAssociatedIconExW(HINSTANCE hInst,LPWSTR lpIconPath,LPWORD lpiIconIndex, LPWORD lpiIconId); #line 106 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" extern "C" __declspec(dllimport) HICON __stdcall ExtractIconA(HINSTANCE hInst, LPCSTR lpszExeFileName, UINT nIconIndex); extern "C" __declspec(dllimport) HICON __stdcall ExtractIconW(HINSTANCE hInst, LPCWSTR lpszExeFileName, UINT nIconIndex); #line 113 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" typedef struct _DRAGINFOA { UINT uSize; POINT pt; BOOL fNC; LPSTR lpFileList; DWORD grfKeyState; } DRAGINFOA, *LPDRAGINFOA; typedef struct _DRAGINFOW { UINT uSize; POINT pt; BOOL fNC; LPWSTR lpFileList; DWORD grfKeyState; } DRAGINFOW, *LPDRAGINFOW; typedef DRAGINFOA DRAGINFO; typedef LPDRAGINFOA LPDRAGINFO; #line 136 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" typedef struct _AppBarData { DWORD cbSize; HWND hWnd; UINT uCallbackMessage; UINT uEdge; RECT rc; LPARAM lParam; } APPBARDATA, *PAPPBARDATA; extern "C" __declspec(dllimport) UINT_PTR __stdcall SHAppBarMessage(DWORD dwMessage, PAPPBARDATA pData); extern "C" __declspec(dllimport) DWORD __stdcall DoEnvironmentSubstA(LPSTR szString, UINT cchString); extern "C" __declspec(dllimport) DWORD __stdcall DoEnvironmentSubstW(LPWSTR szString, UINT cchString); #line 194 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" extern "C" __declspec(dllimport) UINT __stdcall ExtractIconExA(LPCSTR lpszFile, int nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIcons); extern "C" __declspec(dllimport) UINT __stdcall ExtractIconExW(LPCWSTR lpszFile, int nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIcons); #line 203 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 233 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 236 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" typedef WORD FILEOP_FLAGS; typedef WORD PRINTEROP_FLAGS; #line 253 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" typedef struct _SHFILEOPSTRUCTA { HWND hwnd; UINT wFunc; LPCSTR pFrom; LPCSTR pTo; FILEOP_FLAGS fFlags; BOOL fAnyOperationsAborted; LPVOID hNameMappings; LPCSTR lpszProgressTitle; } SHFILEOPSTRUCTA, *LPSHFILEOPSTRUCTA; typedef struct _SHFILEOPSTRUCTW { HWND hwnd; UINT wFunc; LPCWSTR pFrom; LPCWSTR pTo; FILEOP_FLAGS fFlags; BOOL fAnyOperationsAborted; LPVOID hNameMappings; LPCWSTR lpszProgressTitle; } SHFILEOPSTRUCTW, *LPSHFILEOPSTRUCTW; typedef SHFILEOPSTRUCTA SHFILEOPSTRUCT; typedef LPSHFILEOPSTRUCTA LPSHFILEOPSTRUCT; #line 290 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" extern "C" __declspec(dllimport) int __stdcall SHFileOperationA(LPSHFILEOPSTRUCTA lpFileOp); extern "C" __declspec(dllimport) int __stdcall SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp); #line 298 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" extern "C" __declspec(dllimport) void __stdcall SHFreeNameMappings(HANDLE hNameMappings); typedef struct _SHNAMEMAPPINGA { LPSTR pszOldPath; LPSTR pszNewPath; int cchOldPath; int cchNewPath; } SHNAMEMAPPINGA, *LPSHNAMEMAPPINGA; typedef struct _SHNAMEMAPPINGW { LPWSTR pszOldPath; LPWSTR pszNewPath; int cchOldPath; int cchNewPath; } SHNAMEMAPPINGW, *LPSHNAMEMAPPINGW; typedef SHNAMEMAPPINGA SHNAMEMAPPING; typedef LPSHNAMEMAPPINGA LPSHNAMEMAPPING; #line 321 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 341 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 372 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 376 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 379 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 398 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 399 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" typedef struct _SHELLEXECUTEINFOA { DWORD cbSize; ULONG fMask; HWND hwnd; LPCSTR lpVerb; LPCSTR lpFile; LPCSTR lpParameters; LPCSTR lpDirectory; int nShow; HINSTANCE hInstApp; LPVOID lpIDList; LPCSTR lpClass; HKEY hkeyClass; DWORD dwHotKey; union { HANDLE hIcon; HANDLE hMonitor; } ; HANDLE hProcess; } SHELLEXECUTEINFOA, *LPSHELLEXECUTEINFOA; typedef struct _SHELLEXECUTEINFOW { DWORD cbSize; ULONG fMask; HWND hwnd; LPCWSTR lpVerb; LPCWSTR lpFile; LPCWSTR lpParameters; LPCWSTR lpDirectory; int nShow; HINSTANCE hInstApp; LPVOID lpIDList; LPCWSTR lpClass; HKEY hkeyClass; DWORD dwHotKey; union { HANDLE hIcon; HANDLE hMonitor; } ; HANDLE hProcess; } SHELLEXECUTEINFOW, *LPSHELLEXECUTEINFOW; typedef SHELLEXECUTEINFOA SHELLEXECUTEINFO; typedef LPSHELLEXECUTEINFOA LPSHELLEXECUTEINFO; #line 451 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" extern "C" __declspec(dllimport) BOOL __stdcall ShellExecuteExA(LPSHELLEXECUTEINFOA lpExecInfo); extern "C" __declspec(dllimport) BOOL __stdcall ShellExecuteExW(LPSHELLEXECUTEINFOW lpExecInfo); #line 459 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" extern "C" __declspec(dllimport) void __stdcall WinExecErrorA(HWND hwnd, int error, LPCSTR lpstrFileName, LPCSTR lpstrTitle); extern "C" __declspec(dllimport) void __stdcall WinExecErrorW(HWND hwnd, int error, LPCWSTR lpstrFileName, LPCWSTR lpstrTitle); #line 466 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" typedef struct _SHCREATEPROCESSINFOW { DWORD cbSize; ULONG fMask; HWND hwnd; LPCWSTR pszFile; LPCWSTR pszParameters; LPCWSTR pszCurrentDirectory; HANDLE hUserToken; LPSECURITY_ATTRIBUTES lpProcessAttributes; LPSECURITY_ATTRIBUTES lpThreadAttributes; BOOL bInheritHandles; DWORD dwCreationFlags; LPSTARTUPINFOW lpStartupInfo; LPPROCESS_INFORMATION lpProcessInformation; } SHCREATEPROCESSINFOW, *PSHCREATEPROCESSINFOW; extern "C" __declspec(dllimport) BOOL __stdcall SHCreateProcessAsUserW(PSHCREATEPROCESSINFOW pscpi); typedef struct _SHQUERYRBINFO { DWORD cbSize; __int64 i64Size; __int64 i64NumItems; #line 506 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" } SHQUERYRBINFO, *LPSHQUERYRBINFO; extern "C" __declspec(dllimport) HRESULT __stdcall SHQueryRecycleBinA(LPCSTR pszRootPath, LPSHQUERYRBINFO pSHQueryRBInfo); extern "C" __declspec(dllimport) HRESULT __stdcall SHQueryRecycleBinW(LPCWSTR pszRootPath, LPSHQUERYRBINFO pSHQueryRBInfo); #line 523 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" extern "C" __declspec(dllimport) HRESULT __stdcall SHEmptyRecycleBinA(HWND hwnd, LPCSTR pszRootPath, DWORD dwFlags); extern "C" __declspec(dllimport) HRESULT __stdcall SHEmptyRecycleBinW(HWND hwnd, LPCWSTR pszRootPath, DWORD dwFlags); #line 530 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" typedef struct _NOTIFYICONDATAA { DWORD cbSize; HWND hWnd; UINT uID; UINT uFlags; UINT uCallbackMessage; HICON hIcon; CHAR szTip[64]; #line 551 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 562 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 565 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" } NOTIFYICONDATAA, *PNOTIFYICONDATAA; typedef struct _NOTIFYICONDATAW { DWORD cbSize; HWND hWnd; UINT uID; UINT uFlags; UINT uCallbackMessage; HICON hIcon; WCHAR szTip[64]; #line 578 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 589 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 592 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" } NOTIFYICONDATAW, *PNOTIFYICONDATAW; typedef NOTIFYICONDATAA NOTIFYICONDATA; typedef PNOTIFYICONDATAA PNOTIFYICONDATA; #line 600 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 609 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 617 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 624 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 631 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 641 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 649 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 652 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 671 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" extern "C" __declspec(dllimport) BOOL __stdcall Shell_NotifyIconA(DWORD dwMessage, PNOTIFYICONDATAA lpData); extern "C" __declspec(dllimport) BOOL __stdcall Shell_NotifyIconW(DWORD dwMessage, PNOTIFYICONDATAW lpData); #line 679 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" typedef struct _SHFILEINFOA { HICON hIcon; int iIcon; DWORD dwAttributes; CHAR szDisplayName[260]; CHAR szTypeName[80]; } SHFILEINFOA; typedef struct _SHFILEINFOW { HICON hIcon; int iIcon; DWORD dwAttributes; WCHAR szDisplayName[260]; WCHAR szTypeName[80]; } SHFILEINFOW; typedef SHFILEINFOA SHFILEINFO; #line 728 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 732 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 755 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" extern "C" __declspec(dllimport) DWORD_PTR __stdcall SHGetFileInfoA(LPCSTR pszPath, DWORD dwFileAttributes, SHFILEINFOA *psfi, UINT cbFileInfo, UINT uFlags); extern "C" __declspec(dllimport) DWORD_PTR __stdcall SHGetFileInfoW(LPCWSTR pszPath, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT cbFileInfo, UINT uFlags); #line 763 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" extern "C" __declspec(dllimport) BOOL __stdcall SHGetDiskFreeSpaceExA(LPCSTR pszDirectoryName, ULARGE_INTEGER* pulFreeBytesAvailableToCaller, ULARGE_INTEGER* pulTotalNumberOfBytes, ULARGE_INTEGER* pulTotalNumberOfFreeBytes); extern "C" __declspec(dllimport) BOOL __stdcall SHGetDiskFreeSpaceExW(LPCWSTR pszDirectoryName, ULARGE_INTEGER* pulFreeBytesAvailableToCaller, ULARGE_INTEGER* pulTotalNumberOfBytes, ULARGE_INTEGER* pulTotalNumberOfFreeBytes); #line 774 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" extern "C" __declspec(dllimport) BOOL __stdcall SHGetNewLinkInfoA(LPCSTR pszLinkTo, LPCSTR pszDir, LPSTR pszName, BOOL *pfMustCopy, UINT uFlags); extern "C" __declspec(dllimport) BOOL __stdcall SHGetNewLinkInfoW(LPCWSTR pszLinkTo, LPCWSTR pszDir, LPWSTR pszName, BOOL *pfMustCopy, UINT uFlags); #line 781 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 788 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" extern "C" __declspec(dllimport) BOOL __stdcall SHInvokePrinterCommandA(HWND hwnd, UINT uAction, LPCSTR lpBuf1, LPCSTR lpBuf2, BOOL fModal); extern "C" __declspec(dllimport) BOOL __stdcall SHInvokePrinterCommandW(HWND hwnd, UINT uAction, LPCWSTR lpBuf1, LPCWSTR lpBuf2, BOOL fModal); #line 813 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 816 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 861 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" extern "C" __declspec(dllimport) HRESULT __stdcall SHSetLocalizedName(LPWSTR pszPath, LPCWSTR pszResModule, int idsRes); int _cdecl ShellMessageBoxA( HINSTANCE hAppInst, HWND hWnd, LPCSTR lpcText, LPCSTR lpcTitle, UINT fuStyle, ...); int _cdecl ShellMessageBoxW( HINSTANCE hAppInst, HWND hWnd, LPCWSTR lpcText, LPCWSTR lpcTitle, UINT fuStyle, ...); #line 903 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" extern "C" __declspec(dllimport) BOOL __stdcall IsLFNDriveA(LPCSTR pszPath); extern "C" __declspec(dllimport) BOOL __stdcall IsLFNDriveW(LPCWSTR pszPath); #line 911 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 939 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" extern "C" BOOL __stdcall SHTestTokenMembership(HANDLE hToken, ULONG ulRID); #line 959 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" } #line 963 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 1 "d:\\sdk\\Microsoft SDK\\include\\poppack.h" #pragma warning(disable:4103) #pragma pack(pop) #line 33 "d:\\sdk\\Microsoft SDK\\include\\poppack.h" #line 36 "d:\\sdk\\Microsoft SDK\\include\\poppack.h" #line 37 "d:\\sdk\\Microsoft SDK\\include\\poppack.h" #line 966 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 967 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 969 "d:\\sdk\\Microsoft SDK\\include\\ShellAPI.h" #line 1825 "u:/uppsrc\\CtrlCore/CtrlCore.h" #line 1827 "u:/uppsrc\\CtrlCore/CtrlCore.h" #line 1828 "u:/uppsrc\\CtrlCore/CtrlCore.h" #line 1830 "u:/uppsrc\\CtrlCore/CtrlCore.h" #line 5 "u:/uppsrc\\CtrlLib/CtrlLib.h" #line 1 "u:/uppsrc\\RichText/RichText.h" #line 1 "u:/uppsrc\\CtrlCore/CtrlCore.h" #line 5 "u:/uppsrc\\RichText/RichText.h" #line 1 "u:/uppsrc\\plugin/png/png.h" #line 1 "u:/uppsrc\\Draw/Draw.h" #line 5 "u:/uppsrc\\plugin/png/png.h" namespace Upp { class PNGRaster : public StreamRaster { class Data; One data; public: PNGRaster(); ~PNGRaster(); virtual bool Create(); virtual Size GetSize(); virtual Info GetInfo(); virtual Line GetLine(int line); virtual const RGBA *GetPalette(); virtual const RasterFormat *GetFormat(); private: bool Init(); }; class PNGEncoder : public StreamRasterEncoder { class Data; One data; public: PNGEncoder(int bpp = 32, ImageKind kind = IMAGE_UNKNOWN, bool interlace = false); ~PNGEncoder(); virtual int GetPaletteCount(); virtual void Start(Size sz); virtual void WriteLineRaw(const byte *data); PNGEncoder& Bpp(int b) { bpp = b; return *this; } PNGEncoder& Interlace(int b = true) { interlace = b; return *this; } private: int bpp; ImageKind kind; bool interlace; }; }; #line 51 "u:/uppsrc\\plugin/png/png.h" #line 6 "u:/uppsrc\\RichText/RichText.h" namespace Upp { struct Zoom { int m, d; int operator*(int x) const { return d ? iscale(x, m, d) : 0; } int operator&(int x) const { int q = d ? iscale(x, m, d) : 0; return x > 0 ? max(q, 1) : q; } double AsDouble() const { return (double)m / d; } Zoom() { m = d = 1; } Zoom(const Nuller&) { m = d = 0; } Zoom(int _m, int _d) { m = _m, d = _d; } void Serialize(Stream& s) { s % m % d; } bool operator==(Zoom a) { return m == a.m && d == a.d; } bool operator!=(Zoom a) { return m != a.m || d != a.d; } friend int operator/(int x, Zoom z) { return z.m ? iscale(x, z.d, z.m) : 0; } }; inline bool IsNull(Zoom z) { return (z.m | z.d) == 0; } inline int operator*(int x, Zoom m) { return m * x; } inline void operator*=(int& i, Zoom m) { i = m * i; } inline void operator*=(Rect& r, Zoom m) { r.left *= m; r.right *= m; r.top *= m; r.bottom *= m; } inline Size operator*(Zoom m, Size sz) { return Size(m * sz.cx, m * sz.cy); } inline Size operator/(Size sz, Zoom m) { return Size(sz.cx / m, sz.cy / m); } struct PageY : Moveable > { int page; int y; PageY(int page, int y) : page(page), y(y) {} PageY() { page = y = 0; } }; inline bool operator<(PageY a, PageY b) { return a.page < b.page ? true : a.page == b.page ? a.y < b.y : false; } inline bool operator==(PageY a, PageY b) { return a.page == b.page && a.y == b.y; } inline PageY operator+(PageY a, int b) { return PageY(a.page, a.y + b); } struct PageRect : public Rect { int page; operator int() const { return page; } operator PageY() const { return PageY(page, top); } PageRect& operator=(const Rect& r) { (Rect&)(*this) = r; page = 0; return *this; } PageRect(const Rect& r) { (Rect&)(*this) = r; page = 0; } PageRect() { Clear(); page = 0; } }; struct PageDraw { virtual Draw& Info() = 0; virtual Draw& Page(int i) = 0; operator Draw&() { return Info(); } virtual ~PageDraw() {} }; class RichObject; class Bar; struct RichObjectType : Moveable { virtual String GetTypeName(const Value& v) const = 0; virtual String GetCreateName() const; virtual Size GetDefaultSize(const Value& data, Size maxsize) const; virtual Size GetPhysicalSize(const Value& data) const; virtual Size GetPixelSize(const Value& data) const; virtual void Paint(const Value& data, Draw& w, Size sz) const; virtual Image ToImage(const Value& data, Size sz) const; virtual Value Read(const String& s) const; virtual String Write(const Value& v) const; virtual void Menu(Bar& bar, RichObject& ex) const; virtual void DefaultAction(RichObject& ex) const; virtual String GetLink(const Value& data, Point pt, Size sz) const; virtual bool Accept(PasteClip& clip); virtual Value Read(PasteClip& clip); virtual String GetClipFmts() const; virtual String GetClip(const Value& data, const String& fmt) const; RichObjectType(); virtual ~RichObjectType(); }; class RichObject : Moveable { Value data; int ydelta; Size size; Size physical_size; Size pixel_size; bool keepratio; const RichObjectType *type; int64 serial; String type_name; static VectorMap& Map(); void NewSerial(); public: static void Register(const char *name, RichObjectType *type) ; static int GetTypeCount() { return Map().GetCount(); } static int FindType(const String& name) { return Map().Find(name); } static RichObjectType& GetType(int i) { return *Map()[i]; } static String GetTypeName(int i) { return Map().GetKey(i); } void SetSize(int cx, int cy) { size = Size(cx, cy); NewSerial(); } void SetSize(Size sz) { size = sz; NewSerial(); } Size GetSize() const { return size; } void Paint(Draw& w, Size sz) const; Image ToImage(Size sz) const; Size GetPhysicalSize() const { return physical_size; } Size GetPixelSize() const { return pixel_size; } Size GetDefaultSize(Size maxsize) const { return type ? type->GetDefaultSize(data, maxsize) : physical_size; } void Set(RichObjectType *type, const Value& data, Size maxsize = Size(3967, 3967)); bool Set(const String& type_name, const Value& data, Size maxsize = Size(3967, 3967)); String GetTypeName() const; Value GetData() const { return data; } String GetLink(Point pt, Size sz) const { return type ? type->GetLink(data, pt, sz) : String(); } const RichObjectType& GetType() const; bool Read(const String& type, const String& data, Size sz); String Write() const { return type ? type->Write(data) : (String)data; } void KeepRatio(bool b) { keepratio = b; } bool IsKeepRatio() const { return keepratio; } void SetYDelta(int yd) { ydelta = yd; } int GetYDelta() const { return ydelta; } void Menu(Bar& bar) { if(type) type->Menu(bar, *this); } void DefaultAction() { if(type) type->DefaultAction(*this); } operator bool() const { return !IsNull(data); } void Clear(); int64 GetSerialId() const { return serial; } RichObject(); RichObject(RichObjectType *type, const Value& data, Size maxsize = Size(3967, 3967)); RichObject(const String& type, const Value& data, Size maxsize = Size(3967, 3967)); }; RichObject CreateDrawingObject(const Drawing& dwg, Size dot_size, Size size); RichObject CreateDrawingObject(const Drawing& dwg, int cx = 0, int cy = 0); RichObject CreatePNGObject(const Image& img, Size dot_size, Size size); RichObject CreatePNGObject(const Image& img, Size dot_size, Size size); RichObject CreateImageObject(const Image& img, int cx = 0, int cy = 0); struct RichPara; enum { RICHHOT_LM = -1, RICHHOT_RM = -2, }; struct RichHotPos { int table; int column; int delta; int left, cx; int textleft, textcx; RichHotPos() { table = 0; column = Null; } }; struct RichValPos : Moveable { PageY py; int pos; WString data; }; struct PaintInfo { Zoom zoom; int sell, selh; int tablesel; Rect cells; PageY top; PageY bottom; Color hyperlink; Color indexentry; bool usecache; bool sizetracking; Color showcodes; Bits (*spellingchecker)(const RichPara& para); int highlightpara; Color highlight; bool coloroverride; PaintInfo(); }; int LineZoom(Zoom z, int a); class RichTable; #line 1 "u:\\uppsrc\\richtext\\Para.h" struct RichCaret; struct RichPos; struct RichPara { enum Code { NONE, INDEXENTRY = 2, FIELD = 3, FACE = 4, HEIGHT = 5, LANGUAGE = 6, INK = 7, PAPER = 8, TAB = 9, LINK = 10, SSCRIPT = 11, BOLD0 = 12, BOLD1 = 13, BOLDS = 14, ITALIC0 = 15, ITALIC1 = 16, ITALICS = 17, UNDERLINE0 = 18, UNDERLINE1 = 19, UNDERLINES = 20, CAPITALS0 = 21, CAPITALS1 = 22, CAPITALSS = 23, STRIKEOUT0 = 24, STRIKEOUT1 = 25, STRIKEOUTS = 26, DASHED0 = 27, DASHED1 = 28, DASHEDS = 29, OBJECT = 31 }; enum BULLET_STYLE { BULLET_NONE, BULLET_ROUND, BULLET_ROUNDWHITE, BULLET_BOX, BULLET_BOXWHITE, BULLET_TEXT }; enum NUMBER_STYLE { NUMBER_NONE, NUMBER_1, NUMBER_0, NUMBER_a, NUMBER_A, NUMBER_i, NUMBER_I, }; enum LINESPACING { LSP10 = 0, LSP15 = -1, LSP20 = -2, }; struct CharFormat : public Font { int language; Color ink, paper; String link; WString indexentry; dword sscript:2; bool capitals; bool dashed; CharFormat(); }; struct Tab : Moveable { int pos; byte align; byte fillchar; Tab() { align = ALIGN_LEFT; pos = 0; fillchar = 0; } }; struct NumberFormat { String before_number, after_number; bool reset_number; byte number[8]; bool IsNumbered() const; int GetNumberLevel() const; }; struct Format : NumberFormat, CharFormat { int align; int before, lm, indent, rm, after; int tabsize; int bullet; int linespacing; bool newpage, keep, keepnext, orphan; WithDeepCopy< Vector > tab; String label; Uuid styleid; void SortTabs(); Format(); }; struct Number { int n[8]; String AsText(const NumberFormat& format) const; void TestReset(const NumberFormat& format); void Next(const NumberFormat& format); Number(); }; struct Part { RichObject object; WString text; CharFormat format; Id field; String fieldparam; WithDeepCopy< Array > fieldpart; bool NonText() const { return object || field; } bool IsText() const { return !NonText(); } int GetLength() const { return object || field ? 1 : text.GetLength(); } }; struct FieldType { virtual Array Evaluate(const String& param, VectorMap& vars, const CharFormat& fmt) = 0; virtual void Menu(Bar& bar, String *param) const {} virtual void DefaultAction(String *param) const {} virtual ~FieldType() {} }; struct HeightInfo { int ascent; int descent; int external; int ydelta; const RichObject *object; int Sum() const { return ascent + descent + external; } }; struct Line : public HeightInfo { int pos; int len; int ppos; int plen; int xpos; int cx; int objecti; bool withtabs; }; struct Lines { int len; int clen; int cx; Buffer text; Buffer spell; Buffer pos; Buffer width; Buffer height; Buffer format; Array line; Array hformat; int first_indent; int next_indent; int GetCount() const { return line.GetCount(); } Line& operator[](int i) { return line[i]; } const Line& operator[](int i) const { return line[i]; } void Justify(const Format& format); int BodyHeight(); }; static const VectorMap& fieldtype(); static void Register(Id id, FieldType& ft) ; Format format; Array part; static void Charformat(Stream& out, const CharFormat& o, const CharFormat& n, const CharFormat& s); void Cat(const WString& s, const CharFormat& f); void Cat(const char *s, const CharFormat& f); void Cat(const RichObject& o, const CharFormat& f); void Cat(Id fieldtype, const String& param, const CharFormat& f); int GetLength() const; int GetCount() const { return part.GetCount(); } bool IsEmpty() const; String Pack(const Format& style, Array& obj) const; void Unpack(const String& s, const Array& obj, const Format& style); Part& operator[](int i) { return part[i]; } const Part& operator[](int i) const { return part[i]; } int FindPart(int& pos) const; void Trim(int pos); void Mid(int pos); void Append(const RichPara& p) { part.Append(p.part); } void GetRichPos(RichPos& rp, int pos) const; Lines FormatLines(int cx) const; void Paint(PageDraw& pw, const Rect& page, PageY py, const PaintInfo& pi, const Number& n, const Bits& spellerrors, int nbefore, int nline) const; RichCaret GetCaret(int pos, const Rect& page, PageY py, int nbefore, int nline) const; int GetPos(int x, PageY y, const Rect& page, PageY py, int nbefore, int nline) const; void GatherLabels(Vector& info, const Rect& page, PageY py, int pos, int nbefore, int nline) const; void GatherIndexes(Vector& info, const Rect& page, PageY py, int pos, int nbefore, int nline) const; int GetVertMove(int pos, int gx, const Rect& page, int dir) const; WString GetText() const; bool HasPos() const; bool EvaluateFields(VectorMap& vars); void operator<<=(const RichPara& p) { format = p.format; part <<= p.part; } void ApplyZoom(Zoom z); private: Tab GetNextTab(int pos) const; void Smh(Lines& lines, HeightInfo *th, int cx) const; Lines Begin(const Rect& page, PageY& py, int nbefore, int nline) const; bool BreaksPage(PageY py, const Lines& pl, int i, const Rect& page) const; void PackParts(Stream& out, const CharFormat& chrstyle, const Array& part, CharFormat& cf, Array& obj) const; void UnpackParts(Stream& in, const CharFormat& chrstyle, Array& part, const Array& obj, int& oi); static void Flush(Draw& draw, const PaintInfo& pi, wchar *text, const CharFormat **i0, int *wd, int pos, int len, int x0, int x, int y0, int y, int linecy, int lineascent, Zoom z, bool highlight); int PosInLine(int x, const Rect& page, const Lines& pl, int lni) const; struct StorePart; }; inline bool operator==(const RichPara::Tab& a, const RichPara::Tab& b) { return a.pos == b.pos && a.align == b.align && a.fillchar == b.fillchar; } bool operator==(const Vector& a, const Vector& b); inline bool operator!=(const Vector& a, const Vector& b) { return !(a == b); } bool NumberingDiffers(const RichPara::Format& fmt1, const RichPara::Format& fmt2); void Sort(Vector& tab); void operator*=(RichPara::Format& fmt, Zoom z); #line 248 "u:/uppsrc\\RichText/RichText.h" struct RichPos { int tabtextparti; int tabtextpartcount; int tabposintabtext; int tabtextlen; int table; Size tabsize; Point cell; int tablen; int posintab; int celllen; int posincell; int parai; int partcount; int posinpara; int paralen; int level; int parenttab; RichPara::Format format; int chr; RichObject object; Id field; String fieldparam; RichPara::CharFormat fieldformat; RichPos(); }; inline bool InSameTxt(const RichPos& a, const RichPos& b) { return a.table == b.table && (a.table == 0 || a.cell == b.cell); } struct RichCaret : PageRect { int lineascent; int caretascent; int caretdescent; int objectcy; int objectyd; int line; Rect textpage; RichCaret() { lineascent = caretascent = caretdescent = 0; } }; struct RichStyle { RichPara::Format format; String name; Uuid next; static Uuid GetDefaultId(); static const RichStyle& GetDefault(); RichStyle() { next = GetDefaultId(); } }; typedef ArrayMap RichStyles; const RichStyle& GetStyle(const RichStyles& s, const Uuid& id); int FindStyleWithName(const RichStyles& style, const String& name); struct RichContext { const RichStyles& styles; Rect page; PageY py; void Page() { py.page++; py.y = page.top; } RichContext(const RichStyles& styles) : styles(styles) {} }; struct RichCellPos; #line 1 "u:\\uppsrc\\richtext\\Txt.h" class RichTxt : DeepCopyOption { public: enum { BOLD = 0x00000001, ITALIC = 0x00000002, UNDERLINE = 0x00000004, FACE = 0x00000008, HEIGHT = 0x00000010, LANGUAGE = 0x00000020, INK = 0x00000040, PAPER = 0x00000080, LINK = 0x00000100, SSCRIPT = 0x00000200, CAPITALS = 0x00000400, STRIKEOUT = 0x00000800, LANG = 0x00001000, INDEXENTRY = 0x00002000, DASHED = 0x00004000, }; enum { ALIGN = 0x80000000, BEFORE = 0x40000000, LM = 0x20000000, INDENT = 0x10000000, RM = 0x08000000, AFTER = 0x04000000, TABSIZE = 0x02000000, BULLET = 0x01000000, NEWPAGE = 0x00800000, KEEP = 0x00400000, TABS = 0x00200000, STYLE = 0x00100000, LABEL = 0x00080000, KEEPNEXT = 0x00040000, ORPHAN = 0x00020000, NUMBERING = 0x00010000, SPACING = 0x00008000, }; struct FormatInfo : RichPara::Format { dword charvalid; dword paravalid; void Set(const RichPara::Format& fmt); void Set(const RichPara::CharFormat& fmt); void Combine(const RichPara::CharFormat& fmt); void Combine(const RichPara::Format& fmt); void Combine(const FormatInfo& fmt); void ApplyTo(RichPara::CharFormat& fmt) const; void ApplyTo(RichPara::Format& fmt) const; }; class Formating { Vector styleid; Vector format; friend class RichText; friend class RichTxt; }; protected: struct Para : DeepCopyOption { Uuid styleid; int length; String content; Array object; mutable int cx; mutable int cy; mutable int before; mutable Vector linecy; mutable int after; mutable bool newpage; mutable bool keep; mutable bool keepnext; mutable bool orphan; mutable int numbering; mutable Bits spellerrors; mutable bool checked; mutable bool haspos; One number; Para(const Para& src, int); Para() { length = 0; cx = -1; numbering = -1; checked = false; haspos = false; } }; struct Part : MoveableAndDeepCopyOption< Part, Any> { Part(const Part& src, int); Part(); }; Vector part; mutable int length; mutable int tabcount; mutable Rect rect; mutable Vector py; enum { NONE, SPARA, PARA, FROM, ALL }; int r_type; int r_parti; int r_paraocx; int r_paraocy; bool r_keep; bool r_keepnext; bool r_newpage; void Init(); void Invalidate(); void SetRefresh(int parai); void SetRefreshFrom(int parai); void RefreshAll() { SetRefreshFrom(0); } void ParaRemove(int parai, int pos, int count); void ParaInsert(int parai, int pos, const RichPara& p); RichPara ParaCopy(int parai, int pos, int count) const; void Put(int i, const RichPara& p, const RichStyle& s); void Put(int i, const RichPara& p, const RichStyles& s); int GetPartLength(int pi) const; int FindPart(int& pos) const; int GetPartPos(int pi) const; void Sync0(const Para& pp, int parti, const RichContext& rc) const; inline void Sync(int parti, const RichContext& rc) const { int cx = rc.page.Width(); ; const Para& pp = part[parti].Get(); if(pp.cx == cx) return; Sync0(pp, parti, rc); } bool BreaksPage(PageY py, const Para& pp, int i, const Rect& page) const; PageY GetNextPageY(int parti, const RichContext& rc) const; PageY GetPartPageY(int parti, RichContext rc) const; struct ParaOp { virtual bool operator()(RichTxt::Para& p) = 0; virtual ~ParaOp() {} }; bool Update(ParaOp& op); RichTxt& GetText0(int& pos, bool update); RichTxt& GetUpdateText(int& pos); const RichTxt& GetConstText(int& pos) const; RichTable& GetTable0(int table, bool update); RichTable& GetUpdateTable(int table); const RichTable& GetConstTable(int table) const; RichTxt& GetTableUpdateText(int table, const RichStyles& style, int& pi); void CombineFormat(FormatInfo& f, int pi, int pi2, bool& first, const RichStyles& style) const; static void Apply(const FormatInfo& fi, RichPara& pa); void ApplyFormat(const FormatInfo& f, int pi, int pi2, const RichStyles& style); void SaveFormat(Formating& f, int p1, int p2, const RichStyles& style) const; void RestoreFormat(int pi, const Formating& info, int& ii, const RichStyles& style); void GetAllLanguages(Index& all) const; friend class RichTable; friend class RichText; friend class RichCell; int ComputeLength() const; void GetRichPos(int pos, RichPos& rp, int ti, int maxlevel, const RichStyles& st) const; RichPara::Format GetFirstFormat(const RichStyles& st) const; PageY GetTop(RichContext rc) const; PageY GetHeight(RichContext rc) const; int GetWidth(const RichStyles& st) const; void Paint(PageDraw& w, RichContext rc, const PaintInfo& pi) const; RichCaret GetCaret(int pos, RichContext rc) const; int GetPos(int x, PageY y, RichContext rc) const; int GetVertMove(int pos, int gx, RichContext rc, int dir) const; RichHotPos GetHotPos(int x, PageY y, int tolerance, RichContext rc) const; void GatherValPos(Vector& f, RichContext rc, int pos, int type) const; bool EvaluateFields(const RichStyles& s, VectorMap& vars); void ApplyZoom(Zoom z, const RichStyles& ostyle, const RichStyles& zstyle); public: enum ValPosType { LABELS, INDEXENTRIES }; RichPara Get(int i, const RichStyles& s) const; RichPara Get(int i, const Uuid& styleid, const RichStyles& s) const; RichPara Get(int i, const RichStyle& style) const; Uuid GetParaStyle(int i) const { return part[i].Get().styleid; } void SetParaStyle(int i, const Uuid& si); int GetPartCount() const { return part.GetCount(); } bool IsPara(int i) const { return part[i].Is(); } bool IsTable(int i) const; const RichTable& GetTable(int i) const; int GetLength() const; int GetTableCount() const; bool IsEmpty() const; RichCellPos GetCellPos(int table, int row, int column) const; RichCellPos GetCellPos(int table, Point p) const; void Clear(); void ClearSpelling(); void SetPick(int parti, RichTable& table); void CatPick( RichTable& table) { SetPick(GetPartCount(), table); } void Set(int parai, const RichPara& p, const RichStyles& s); void Insert(int parai, const RichPara& p, const RichStyles& s); void Cat(const RichPara& p, const RichStyles& s) { Set(GetPartCount(), p, s); } void Normalize(); Vector GetAllLanguages() const; WString GetPlainText() const; struct UpdateIterator { enum { CONTINUE = 0, STOP = 1, UPDATE = 2 }; virtual int operator()(int pos, RichPara& para) = 0; virtual ~UpdateIterator() {} }; bool Iterate(UpdateIterator& r, int gpos, const RichStyles& s); struct Iterator { virtual bool operator()(int pos, const RichPara& para) = 0; virtual ~Iterator() {} }; bool Iterate(Iterator& r, int gpos, const RichStyles& s) const; RichTxt(const RichTxt& src, int); RichTxt(); }; #line 333 "u:/uppsrc\\RichText/RichText.h" #line 1 "u:\\uppsrc\\richtext\\Table.h" class RichCell : DeepCopyOption { public: struct Format { Rect border; Rect margin; int align; int minheight; Color color; Color bordercolor; bool keep; Format(); }; Format format; int vspan, hspan; RichTxt text; private: bool Reduce(RichContext& rc) const; PageY Align(const RichContext& rc, PageY npy) const; void DrawCell(Draw& w, int l, int r, int y, int yy, const Rect& border) const; void ClearText(); void ClearText(const RichPara::Format& format, const RichStyles& style); void Clear(); PageY GetTop(RichContext rc) const; PageY GetHeight(RichContext rc) const; void Paint(PageDraw& pw, RichContext rc, PageY npy, const Rect& xpg, int y, int ny, const PaintInfo& pi, bool select) const; RichCaret GetCaret(int pos, RichContext rc, PageY pyy) const; int GetPos(int x, PageY y, RichContext rc, PageY pyy) const; RichHotPos GetHotPos(int x, PageY y, int tolerance, RichContext rc, PageY pyy) const; void GatherValPos(Vector& f, RichContext rc, PageY pyy, int pos, int type) const; friend class RichTable; friend class RichText; public: RichCell(const RichCell& src, int); RichCell(); }; class RichTable : DeepCopyOption { public: struct Format { int before, lm, rm, after; int frame; Color framecolor; int grid; Color gridcolor; WithDeepCopy< Vector > column; int header; bool keep; Format(); }; struct CellInfo { bool valid; Point master; operator bool() const { return valid; } CellInfo() { valid = true; } }; Format format; Array< Array > cell; private: struct PaintCell : Moveable { int left; int right; Rect page; PageY hy; bool top; bool bottom; PaintCell() { top = true; } }; struct PaintRow : Moveable { PageY gpy; PageY py, pyy; Buffer cell; bool first; PaintCell& operator[](int i) { return cell[i]; } const PaintCell& operator[](int i) const { return cell[i]; } }; struct Layout { Buffer col; Buffer row; int frame; int grid; PageY pyy; PaintRow& operator[](int i) { return row[i]; } const PaintRow& operator[](int i) const { return row[i]; } }; struct TabLayout : Layout { bool hasheader; Layout header; Rect page; int page0; Size sz; }; mutable TabLayout clayout; mutable Rect cpage; mutable PageY cpy; Buffer< Buffer > ci; int r_row, r_column; Rect r_page; PageY r_py, r_pyy; void Invalidate(); void InvalidateRefresh(int i, int j); void InvalidateRefresh(Point p) { InvalidateRefresh(p.y, p.x); } bool Reduce(RichContext& rc) const; Layout Realize(RichContext rc, int ny) const; bool RowPaint(PageDraw& pw, const RichStyles& st, const Layout& tab, int i, int ny, const Rect& pg, VectorMap& frr, PaintInfo& pi, int pd, bool sel) const; const TabLayout& Realize(RichContext rc) const; mutable int length, tabcount; static void ExpandFrr(VectorMap& frr, int pi, int l, int r, int t, int b); friend class RichTxt; friend class RichText; public: Array& operator[](int i) { return cell[i]; } const Array& operator[](int i) const { return cell[i]; } RichCell& operator[](Point p) { return cell[p.y][p.x]; } const RichCell& operator[](Point p) const { return cell[p.y][p.x]; } int GetCellPos(int i, int j) const; int GetCellPos(Point p) const { return GetCellPos(p.y, p.x); } int GetTableCount(int i, int j) const; int GetTableCount(Point p) const { return GetTableCount(p.y, p.x); } Point GetMasterCell(int i, int j) const; Point GetMasterCell(Point p) const { return GetMasterCell(p.y, p.x); } const RichCell& GetMaster(int i, int j) const; int GetLength() const; int GetTableCount() const; private: void Normalize0(); RichTable Copy(const Rect& sel) const; void Paste(Point pos, const RichTable& tab); void RemoveRow0(int rowi); void RemoveRow(int rowi); void InsertRow(int rowi, const RichStyles& style); void RemoveColumn0(int column); void RemoveColumn(int column); void InsertColumn(int column, const RichStyles& style); bool IsRowEmpty(int row); bool IsColumnEmpty(int column); void SplitCell(Point cl, Size sz, const RichStyles& style); RichCell::Format GetCellFormat(const Rect& sel) const; void SetCellFormat(const Rect& sel, const RichCell::Format& fmt, bool setkeep); PageY GetHeight(RichContext rc) const; PageY GetTop(RichContext rc) const; void Paint(PageDraw& pw, RichContext rc, const PaintInfo& pi) const; RichCaret GetCaret(int pos, RichContext rc) const; int GetPos(int x, PageY y, RichContext rc) const; int GetVertMove(int pos, int gx, RichContext rc, int dir) const; RichHotPos GetHotPos(int x, PageY y, int tolerance, RichContext rc) const; void AdjustSel(Rect& sel) const; void GatherValPos(Vector& f, RichContext rc, int pos, int type) const; void ClearSpelling(); Point FindCell(int& pos) const; RichPos GetRichPos(int pos, const RichStyles& st) const; CellInfo GetCellInfo(int i, int j) { return ci[i][j]; } int GetInvalid(PageY& top, PageY& bottom, RichContext rc) const; void Validate(); void ApplyZoom(Zoom z, const RichStyles& ostyle, const RichStyles& zstyle); public: void AddColumn(int cx); void SetPick(int i, int j, RichTxt& text); RichTxt GetPick(int i, int j); const RichTxt& Get(int i, int j) const { return cell[i][j].text; } void SetQTF(int i, int j, const char *qtf); void SetFormat(int i, int j, const RichCell::Format& fmt); const RichCell::Format& GetFormat(int i, int j) { return cell[i][j].format; } bool operator()(int i, int j) const { return ci[i][j].valid; } void SetSpan(int i, int j, int vspan, int hspan); Size GetSpan(int i, int j) const; void SetFormat(const Format& fmt); const Format& GetFormat() const { return format; } int GetColumns() const { return format.column.GetCount(); } int GetRows() const { return cell.GetCount(); } Size GetSize() const { return Size(GetColumns(), GetRows()); } void Normalize(); RichTable(const RichTable& src, int); RichTable(); }; #line 334 "u:/uppsrc\\RichText/RichText.h" #line 1 "u:\\uppsrc\\richtext\\Text.h" class RichText : public RichTxt, public DeepCopyOption { RichStyles style; String footer; bool nolinks; void Init(); struct StyleChangeOp; struct SetStylesOp; struct RemoveStyleOp; struct MergeStylesOp; friend struct MergeStylesOp; struct OverrideStylesOp; public: void Clear(); int GetStyleCount() const { return style.GetCount(); } Uuid GetStyleId(int i) const { return style.GetKey(i); } Uuid GetStyleId(const String& name) const; const RichStyle& GetStyle(int i) const { return style[i]; } const RichStyle& GetStyle(const Uuid& id) const { return Upp::GetStyle(style, id); } void SetStyle(const Uuid& id, const RichStyle& _style); bool HasStyle(const Uuid& id) { return style.Find(id) >= 0; } void RemoveStyle(const Uuid& id); const RichStyles& GetStyles() const { return style; } void SetStyles(const RichStyles& styles); void OverrideStyles(const RichStyles& masterstyles, bool matchname = true, bool addmissing = true); void MergeStyles(const RichText& text); RichPara Get(int i) const { return RichTxt::Get(i, style); } void Cat(const RichPara& p) { RichTxt::Cat(p, style); } void CatPick( RichText& p); using RichTxt::CatPick; RichContext Context(const Rect& page) const; RichPos GetRichPos(int pos, int maxlevel = 2147483647) const; int operator[](int pos) const { return GetRichPos(pos).chr; } void ApplyZoom(Zoom z); PageY GetHeight(PageY py, const Rect& page) const; PageY GetHeight(const Rect& page) const; void Paint(PageDraw& w, PageY py, const Rect& page, const PaintInfo& pi) const; void Paint(PageDraw& w, const Rect& page, const PaintInfo& pi) const; RichCaret GetCaret(int pos, const Rect& page) const; int GetPos(int x, PageY y, const Rect& page) const; RichHotPos GetHotPos(int x, PageY y, int tolerance, const Rect& page) const; int GetVertMove(int pos, int gx, const Rect& page, int dir) const; int GetWidth() const; int GetHeight(int cx) const; int GetHeight(Zoom zoom, int cx) const; void Paint(Draw& w, int x, int y, int cx, const PaintInfo& pi) const; void Paint(Zoom zoom, Draw& w, int x, int y, int cx) const; void Paint(Draw& w, int x, int y, int cx) const; Vector GetValPos(const Rect& page, int type) const; int AdjustCursor(int anchor, int cursor) const; void Remove(int pos, int count); void Insert(int pos, const RichText& p); RichText Copy(int pos, int count) const; FormatInfo GetFormatInfo(int pos, int count) const; void ApplyFormatInfo(int pos, const RichText::FormatInfo& fi, int count); void ReStyle(int pos, const Uuid& id); Formating SaveFormat(int pos, int count) const; void RestoreFormat(int pos, const Formating& info); RichTable::Format GetTableFormat(int table) const; void SetTableFormat(int table, const RichTable::Format& fmt); int SetTable(int pos, const RichTable& table); void DestroyTable(int table); RichTable CopyTable(int table) const; void ReplaceTable(int table, const RichTable& tab); void RemoveParaSpecial(int table, bool before); bool CanRemoveParaSpecial(int table, bool before); void InsertParaSpecial(int table, bool before, const RichPara::Format& fmt); bool ShouldInsertParaSpecial(int table, bool before); RichTable CopyTable(int table, const Rect& sel) const; void ClearTable(int table, const Rect& sel); void PasteTable(int table, Point pos, const RichTable& tab); void InsertTableRow(int table, int row); void RemoveTableRow(int table, int row); void InsertTableColumn(int table, int column); void RemoveTableColumn(int table, int column); Point GetMasterCell(int table, int row, int column); Point GetMasterCell(int table, Point p) { return GetMasterCell(table, p.y, p.x); } void SplitCell(int table, Point cell, Size sz); void JoinCell(int table, const Rect& sel); RichCell::Format GetCellFormat(int table, const Rect& sel) const; void SetCellFormat(int table, const Rect& sel, const RichCell::Format& fmt, bool setkeep); FormatInfo GetTableFormatInfo(int table, const Rect& sel) const; void ApplyTableFormatInfo(int table, const Rect& sel, const RichText::FormatInfo& fi); void AdjustTableSel(int table, Rect& sel) const { return GetConstTable(table).AdjustSel(sel); } bool Iterate(Iterator& r) const { return RichTxt::Iterate(r, 0, style); } bool Iterate(UpdateIterator& r) { return RichTxt::Iterate(r, 0, style); } bool EvaluateFields(VectorMap& vars) { return RichTxt::EvaluateFields(style, vars); } void InvalidateAll() { r_type = ALL; } void Validate(); bool GetInvalid(PageY& top, PageY& bottom, const Rect& page, int sell, int selh, int osell, int oselh) const; struct ClipboardType { ClipboardType(); virtual ~ClipboardType(); virtual int Level(); virtual RichText ReadClipboard(const RichPara::Format& f) = 0; virtual void WriteClipboard(const RichText& text) = 0; }; static void Register(ClipboardType& type); void SetFooter(const String& s) { footer = s; } String GetFooter() const { return footer; } void PrintNoLinks(bool b = true) { nolinks = b; } bool IsPrintNoLinks() const { return nolinks; } RichText() { Init(); } RichText(const RichText& x, int); RichText( RichTxt& x, RichStyles& st); }; #line 335 "u:/uppsrc\\RichText/RichText.h" struct RichCellPos { int pos; int textlen; Size tabsize; int tabpos; int tablen; int cellpos; int celllen; int level; RichCell::Format format; RichTable::Format tableformat; }; String DeQtf(const char *s); String DeQtfLf(const char *s); struct QtfRichObject { RichObject obj; public: String ToString() const; QtfRichObject() {} QtfRichObject(const RichObject& o); }; String AsQTF(const RichObject& obj); RichText ParseQTF(const char *qtf, bool scolors = false, byte accesskey = 0); RichText AsRichText(const wchar *s, const RichPara::Format& f = RichPara::Format()); enum { QTF_BODY = 1, QTF_ALL_STYLES = 2, QTF_NOSTYLES = 4, QTF_CRLF = 8, QTF_NOCHARSET = 16, QTF_NOLANG = 32, }; String AsQTF(const RichText& doc, byte charset = 255, dword options = QTF_BODY|QTF_ALL_STYLES|QTF_CRLF); inline String StylesAsQTF(const RichText& doc, byte charset = 255) { return AsQTF(doc, charset, QTF_ALL_STYLES|QTF_CRLF); } inline String BodyAsQTF(const RichText& doc, byte charset = 255) { return AsQTF(doc, charset, QTF_BODY|QTF_CRLF); } enum { ROUNDOFF = 1 << 20, MAX_FONTS = 10000, MAX_DOTS = 600 * 100, MAX_DOT_HEIGHT = 1200, MAX_POINT_HEIGHT = MAX_DOT_HEIGHT * 3 / 25, }; inline int DotTwips (int dots) { return (dots * 12 + 5 * ROUNDOFF + 2) / 5 - ROUNDOFF; } inline int TwipDots (int twp) { return (twp * 5 + 12 * ROUNDOFF + 6) / 12 - ROUNDOFF; } inline int DotPoints(int dots) { return (dots * 3 + 25 * ROUNDOFF + 12) / 25 - ROUNDOFF; } inline int PointDots(int pts) { return (pts * 25 + 3 * ROUNDOFF + 1) / 3 - ROUNDOFF; } inline int TwipDotSize(int twp) { return IsNull(twp) ? 0 : minmax(TwipDots(twp), 0, MAX_DOTS); } inline int PointDotHeight(int p) { return (minmax(Nvl(p, 0), 0, MAX_POINT_HEIGHT) * 25 + 5) / 6; } void EncodeRTF(Stream& stream, const RichText& richtext, byte charset); String EncodeRTF(const RichText& richtext, byte charset); String EncodeRTF(const RichText& richtext); RichText ParseRTF(const char *rtf); Zoom GetRichTextStdScreenZoom(); const Display& QTFDisplay(); const Display& QTFDisplayVCenter(); String EncodeHtml(const RichText& text, Index& css, const VectorMap& links, const VectorMap& labels, const String& path, const String& base = Null, Zoom z = Zoom(8, 40), const VectorMap& escape = VectorMap(), int imtolerance = 0); String AsCss(Index& ss); inline String EncodeHtml(const RichText& text, Index& css, const VectorMap& links, const String& path, const String& base = Null, Zoom z = Zoom(8, 40)) { return EncodeHtml(text, css, links, VectorMap(), path, base, z); } struct SimplePageDraw : PageDraw { Draw& w; virtual Draw& Info(); virtual Draw& Page(int); SimplePageDraw(Draw& w) : w(w) {} virtual ~SimplePageDraw() {} }; struct PrintPageDraw : PageDraw { int page; Draw& w; NilDraw nw; Draw& Page(int _page) { return page == _page ? w : (Draw&)nw; } Draw& Info() { return w; } void SetPage(int _page) { page = _page; } PrintPageDraw(Draw& w) : w(w) {} virtual ~PrintPageDraw() {} }; }; #line 460 "u:/uppsrc\\RichText/RichText.h" #line 6 "u:/uppsrc\\CtrlLib/CtrlLib.h" namespace Upp { #line 1 "u:/uppsrc\\Draw/iml_header.h" class CtrlImg { public: enum { #line 1 "u:/uppsrc\\CtrlLib/Ctrl.iml" I_arrow, I_exclamation, I_information, I_question, I_error, I_smallcheck, I_smallup, I_smalldown, I_smallleft, I_smallright, I_spinup3, I_spinup2, I_spinup, I_spindown3, I_spindown2, I_spindown, I_reporticon, I_smallreporticon, I_ibeam0, I_HandCursor, I_HelpCursor0, I_HelpCursor1, I_write, I_open, I_save, I_save_as, I_print, I_new_doc, I_menu_window, I_undo, I_redo, I_cut, I_copy, I_paste, I_remove, I_menu_check, I_menu_radio, I_right_arrow, I_white_right_arrow, I_check, I_white_check, I_left_arrow, I_white_left_arrow, I_cross, I_up_arrow, I_down_arrow, I_plus, I_selection, I_Dir, I_DirUp, I_MkDir, I_File, I_Plus, I_Minus, I_Toggle, I_Diskette, I_Hd, I_CdRom, I_Computer, I_Network, I_Var, I_Home, I_MenuCheck1, I_MenuCheck0, I_Empty16x16, I_MenuRadio0, I_MenuRadio1, I_set_transparent, I_wheel_cursor, I_white_wheel_cursor, I_column_cursor, I_swap_color_cursor, I_fetch_color, I_fetch_color_cursor, I_tab_wheel, I_hthumb, I_vthumb, I_hthumb1, I_vthumb1, I_treeplus, I_tree0, I_tree1, I_tree2, I_treeminus, I_Add, I_Remove, I_SmallDown, I_SmallUp, I_SmallRight, I_SmallLeft, I_go_back, I_go_forward, I_font_size, I_help, I_focus_h, I_focus_v, I_checkers, I_SmallDot, I_SmallDotH, I_BigDot, I_BigDotH, I_Bg, I_SortUp, I_SortDown, #line 20 "u:/uppsrc\\Draw/iml_header.h" COUNT }; public: static Upp::Iml& Iml(); static void Register__() { Register("CtrlImg", Iml()); } static int Find(const Upp::String& s); static int Find(const char *s); static int GetCount() { return Iml().GetCount(); } static Upp::String GetId(int i) { return Iml().GetId(i); } static Upp::Image Get(int i); static Upp::Image Get(const char *s); static Upp::Image Get(const Upp::String& s); static void Set(int i, const Upp::Image& m); static void Set(const char *s, const Upp::Image& m); static void Reset() { Iml().Reset(); } #line 1 "u:/uppsrc\\CtrlLib/Ctrl.iml" static Upp::Image arrow() { return Get(I_arrow); } static Upp::Image exclamation() { return Get(I_exclamation); } static Upp::Image information() { return Get(I_information); } static Upp::Image question() { return Get(I_question); } static Upp::Image error() { return Get(I_error); } static Upp::Image smallcheck() { return Get(I_smallcheck); } static Upp::Image smallup() { return Get(I_smallup); } static Upp::Image smalldown() { return Get(I_smalldown); } static Upp::Image smallleft() { return Get(I_smallleft); } static Upp::Image smallright() { return Get(I_smallright); } static Upp::Image spinup3() { return Get(I_spinup3); } static Upp::Image spinup2() { return Get(I_spinup2); } static Upp::Image spinup() { return Get(I_spinup); } static Upp::Image spindown3() { return Get(I_spindown3); } static Upp::Image spindown2() { return Get(I_spindown2); } static Upp::Image spindown() { return Get(I_spindown); } static Upp::Image reporticon() { return Get(I_reporticon); } static Upp::Image smallreporticon() { return Get(I_smallreporticon); } static Upp::Image ibeam0() { return Get(I_ibeam0); } static Upp::Image HandCursor() { return Get(I_HandCursor); } static Upp::Image HelpCursor0() { return Get(I_HelpCursor0); } static Upp::Image HelpCursor1() { return Get(I_HelpCursor1); } static Upp::Image write() { return Get(I_write); } static Upp::Image open() { return Get(I_open); } static Upp::Image save() { return Get(I_save); } static Upp::Image save_as() { return Get(I_save_as); } static Upp::Image print() { return Get(I_print); } static Upp::Image new_doc() { return Get(I_new_doc); } static Upp::Image menu_window() { return Get(I_menu_window); } static Upp::Image undo() { return Get(I_undo); } static Upp::Image redo() { return Get(I_redo); } static Upp::Image cut() { return Get(I_cut); } static Upp::Image copy() { return Get(I_copy); } static Upp::Image paste() { return Get(I_paste); } static Upp::Image remove() { return Get(I_remove); } static Upp::Image menu_check() { return Get(I_menu_check); } static Upp::Image menu_radio() { return Get(I_menu_radio); } static Upp::Image right_arrow() { return Get(I_right_arrow); } static Upp::Image white_right_arrow() { return Get(I_white_right_arrow); } static Upp::Image check() { return Get(I_check); } static Upp::Image white_check() { return Get(I_white_check); } static Upp::Image left_arrow() { return Get(I_left_arrow); } static Upp::Image white_left_arrow() { return Get(I_white_left_arrow); } static Upp::Image cross() { return Get(I_cross); } static Upp::Image up_arrow() { return Get(I_up_arrow); } static Upp::Image down_arrow() { return Get(I_down_arrow); } static Upp::Image plus() { return Get(I_plus); } static Upp::Image selection() { return Get(I_selection); } static Upp::Image Dir() { return Get(I_Dir); } static Upp::Image DirUp() { return Get(I_DirUp); } static Upp::Image MkDir() { return Get(I_MkDir); } static Upp::Image File() { return Get(I_File); } static Upp::Image Plus() { return Get(I_Plus); } static Upp::Image Minus() { return Get(I_Minus); } static Upp::Image Toggle() { return Get(I_Toggle); } static Upp::Image Diskette() { return Get(I_Diskette); } static Upp::Image Hd() { return Get(I_Hd); } static Upp::Image CdRom() { return Get(I_CdRom); } static Upp::Image Computer() { return Get(I_Computer); } static Upp::Image Network() { return Get(I_Network); } static Upp::Image Var() { return Get(I_Var); } static Upp::Image Home() { return Get(I_Home); } static Upp::Image MenuCheck1() { return Get(I_MenuCheck1); } static Upp::Image MenuCheck0() { return Get(I_MenuCheck0); } static Upp::Image Empty16x16() { return Get(I_Empty16x16); } static Upp::Image MenuRadio0() { return Get(I_MenuRadio0); } static Upp::Image MenuRadio1() { return Get(I_MenuRadio1); } static Upp::Image set_transparent() { return Get(I_set_transparent); } static Upp::Image wheel_cursor() { return Get(I_wheel_cursor); } static Upp::Image white_wheel_cursor() { return Get(I_white_wheel_cursor); } static Upp::Image column_cursor() { return Get(I_column_cursor); } static Upp::Image swap_color_cursor() { return Get(I_swap_color_cursor); } static Upp::Image fetch_color() { return Get(I_fetch_color); } static Upp::Image fetch_color_cursor() { return Get(I_fetch_color_cursor); } static Upp::Image tab_wheel() { return Get(I_tab_wheel); } static Upp::Image hthumb() { return Get(I_hthumb); } static Upp::Image vthumb() { return Get(I_vthumb); } static Upp::Image hthumb1() { return Get(I_hthumb1); } static Upp::Image vthumb1() { return Get(I_vthumb1); } static Upp::Image treeplus() { return Get(I_treeplus); } static Upp::Image tree0() { return Get(I_tree0); } static Upp::Image tree1() { return Get(I_tree1); } static Upp::Image tree2() { return Get(I_tree2); } static Upp::Image treeminus() { return Get(I_treeminus); } static Upp::Image Add() { return Get(I_Add); } static Upp::Image Remove() { return Get(I_Remove); } static Upp::Image SmallDown() { return Get(I_SmallDown); } static Upp::Image SmallUp() { return Get(I_SmallUp); } static Upp::Image SmallRight() { return Get(I_SmallRight); } static Upp::Image SmallLeft() { return Get(I_SmallLeft); } static Upp::Image go_back() { return Get(I_go_back); } static Upp::Image go_forward() { return Get(I_go_forward); } static Upp::Image font_size() { return Get(I_font_size); } static Upp::Image help() { return Get(I_help); } static Upp::Image focus_h() { return Get(I_focus_h); } static Upp::Image focus_v() { return Get(I_focus_v); } static Upp::Image checkers() { return Get(I_checkers); } static Upp::Image SmallDot() { return Get(I_SmallDot); } static Upp::Image SmallDotH() { return Get(I_SmallDotH); } static Upp::Image BigDot() { return Get(I_BigDot); } static Upp::Image BigDotH() { return Get(I_BigDotH); } static Upp::Image Bg() { return Get(I_Bg); } static Upp::Image SortUp() { return Get(I_SortUp); } static Upp::Image SortDown() { return Get(I_SortDown); } #line 47 "u:/uppsrc\\Draw/iml_header.h" }; #line 64 "u:/uppsrc\\Draw/iml_header.h" #line 12 "u:/uppsrc\\CtrlLib/CtrlLib.h" #line 1 "u:/uppsrc\\Draw/iml_header.h" class CtrlsImg { public: enum { #line 1 "u:/uppsrc\\CtrlLib/Ctrls.iml" I_S0, I_S0h, I_S0p, I_S0d, I_S1, I_S1h, I_S1p, I_S1d, I_O0, I_O0h, I_O0p, I_O0d, I_O1, I_O1h, I_O1p, I_O1d, I_O2, I_O2h, I_O2p, I_O2d, I_B, I_Bh, I_Bp, I_Bd, I_EB, I_EBh, I_EBp, I_EBd, I_SB, I_SBh, I_SBp, I_SBd, I_SBHT, I_SBHTh, I_SBHTp, I_SBHTd, I_SBVT, I_SBVTh, I_SBVTp, I_SBVTd, I_OkB, I_OkBh, I_OkBp, I_OkBd, I_OBlack, I_SBlack, I_SizeGrip, I_kDA, I_kUA, I_kLA, I_kRA, I_kSpU, I_kSpD, I_DA, I_UA, I_LA, I_RA, I_SpU, I_SpD, I_SBVU, I_SBVUh, I_SBVUp, I_SBVUd, I_SBVL, I_SBVLh, I_SBVLp, I_SBVLd, I_SBHU, I_SBHUh, I_SBHUp, I_SBHUd, I_SBHL, I_SBHLh, I_SBHLp, I_SBHLd, I_SBVI, I_SBHI, I_EFE, I_VE, I_HorzPos, I_HorzSplit, I_HTB, I_HTBh, I_HTBp, I_HTBd, I_PI, I_VPI, I_PIC, I_VPIC, I_TAB, I_TABh, I_TABs, I_TABd, I_FTAB, I_FTABh, I_FTABs, I_FTABd, I_LTAB, I_LTABh, I_LTABs, I_LTABd, I_BTAB, I_BTABh, I_BTABs, I_BTABd, I_TABB, I_SLA, I_SRA, I_TB, I_TBh, I_TBp, I_TBd, I_TB1, I_TB1h, #line 20 "u:/uppsrc\\Draw/iml_header.h" COUNT }; public: static Upp::Iml& Iml(); static void Register__() { Register("CtrlsImg", Iml()); } static int Find(const Upp::String& s); static int Find(const char *s); static int GetCount() { return Iml().GetCount(); } static Upp::String GetId(int i) { return Iml().GetId(i); } static Upp::Image Get(int i); static Upp::Image Get(const char *s); static Upp::Image Get(const Upp::String& s); static void Set(int i, const Upp::Image& m); static void Set(const char *s, const Upp::Image& m); static void Reset() { Iml().Reset(); } #line 1 "u:/uppsrc\\CtrlLib/Ctrls.iml" static Upp::Image S0() { return Get(I_S0); } static Upp::Image S0h() { return Get(I_S0h); } static Upp::Image S0p() { return Get(I_S0p); } static Upp::Image S0d() { return Get(I_S0d); } static Upp::Image S1() { return Get(I_S1); } static Upp::Image S1h() { return Get(I_S1h); } static Upp::Image S1p() { return Get(I_S1p); } static Upp::Image S1d() { return Get(I_S1d); } static Upp::Image O0() { return Get(I_O0); } static Upp::Image O0h() { return Get(I_O0h); } static Upp::Image O0p() { return Get(I_O0p); } static Upp::Image O0d() { return Get(I_O0d); } static Upp::Image O1() { return Get(I_O1); } static Upp::Image O1h() { return Get(I_O1h); } static Upp::Image O1p() { return Get(I_O1p); } static Upp::Image O1d() { return Get(I_O1d); } static Upp::Image O2() { return Get(I_O2); } static Upp::Image O2h() { return Get(I_O2h); } static Upp::Image O2p() { return Get(I_O2p); } static Upp::Image O2d() { return Get(I_O2d); } static Upp::Image B() { return Get(I_B); } static Upp::Image Bh() { return Get(I_Bh); } static Upp::Image Bp() { return Get(I_Bp); } static Upp::Image Bd() { return Get(I_Bd); } static Upp::Image EB() { return Get(I_EB); } static Upp::Image EBh() { return Get(I_EBh); } static Upp::Image EBp() { return Get(I_EBp); } static Upp::Image EBd() { return Get(I_EBd); } static Upp::Image SB() { return Get(I_SB); } static Upp::Image SBh() { return Get(I_SBh); } static Upp::Image SBp() { return Get(I_SBp); } static Upp::Image SBd() { return Get(I_SBd); } static Upp::Image SBHT() { return Get(I_SBHT); } static Upp::Image SBHTh() { return Get(I_SBHTh); } static Upp::Image SBHTp() { return Get(I_SBHTp); } static Upp::Image SBHTd() { return Get(I_SBHTd); } static Upp::Image SBVT() { return Get(I_SBVT); } static Upp::Image SBVTh() { return Get(I_SBVTh); } static Upp::Image SBVTp() { return Get(I_SBVTp); } static Upp::Image SBVTd() { return Get(I_SBVTd); } static Upp::Image OkB() { return Get(I_OkB); } static Upp::Image OkBh() { return Get(I_OkBh); } static Upp::Image OkBp() { return Get(I_OkBp); } static Upp::Image OkBd() { return Get(I_OkBd); } static Upp::Image OBlack() { return Get(I_OBlack); } static Upp::Image SBlack() { return Get(I_SBlack); } static Upp::Image SizeGrip() { return Get(I_SizeGrip); } static Upp::Image kDA() { return Get(I_kDA); } static Upp::Image kUA() { return Get(I_kUA); } static Upp::Image kLA() { return Get(I_kLA); } static Upp::Image kRA() { return Get(I_kRA); } static Upp::Image kSpU() { return Get(I_kSpU); } static Upp::Image kSpD() { return Get(I_kSpD); } static Upp::Image DA() { return Get(I_DA); } static Upp::Image UA() { return Get(I_UA); } static Upp::Image LA() { return Get(I_LA); } static Upp::Image RA() { return Get(I_RA); } static Upp::Image SpU() { return Get(I_SpU); } static Upp::Image SpD() { return Get(I_SpD); } static Upp::Image SBVU() { return Get(I_SBVU); } static Upp::Image SBVUh() { return Get(I_SBVUh); } static Upp::Image SBVUp() { return Get(I_SBVUp); } static Upp::Image SBVUd() { return Get(I_SBVUd); } static Upp::Image SBVL() { return Get(I_SBVL); } static Upp::Image SBVLh() { return Get(I_SBVLh); } static Upp::Image SBVLp() { return Get(I_SBVLp); } static Upp::Image SBVLd() { return Get(I_SBVLd); } static Upp::Image SBHU() { return Get(I_SBHU); } static Upp::Image SBHUh() { return Get(I_SBHUh); } static Upp::Image SBHUp() { return Get(I_SBHUp); } static Upp::Image SBHUd() { return Get(I_SBHUd); } static Upp::Image SBHL() { return Get(I_SBHL); } static Upp::Image SBHLh() { return Get(I_SBHLh); } static Upp::Image SBHLp() { return Get(I_SBHLp); } static Upp::Image SBHLd() { return Get(I_SBHLd); } static Upp::Image SBVI() { return Get(I_SBVI); } static Upp::Image SBHI() { return Get(I_SBHI); } static Upp::Image EFE() { return Get(I_EFE); } static Upp::Image VE() { return Get(I_VE); } static Upp::Image HorzPos() { return Get(I_HorzPos); } static Upp::Image HorzSplit() { return Get(I_HorzSplit); } static Upp::Image HTB() { return Get(I_HTB); } static Upp::Image HTBh() { return Get(I_HTBh); } static Upp::Image HTBp() { return Get(I_HTBp); } static Upp::Image HTBd() { return Get(I_HTBd); } static Upp::Image PI() { return Get(I_PI); } static Upp::Image VPI() { return Get(I_VPI); } static Upp::Image PIC() { return Get(I_PIC); } static Upp::Image VPIC() { return Get(I_VPIC); } static Upp::Image TAB() { return Get(I_TAB); } static Upp::Image TABh() { return Get(I_TABh); } static Upp::Image TABs() { return Get(I_TABs); } static Upp::Image TABd() { return Get(I_TABd); } static Upp::Image FTAB() { return Get(I_FTAB); } static Upp::Image FTABh() { return Get(I_FTABh); } static Upp::Image FTABs() { return Get(I_FTABs); } static Upp::Image FTABd() { return Get(I_FTABd); } static Upp::Image LTAB() { return Get(I_LTAB); } static Upp::Image LTABh() { return Get(I_LTABh); } static Upp::Image LTABs() { return Get(I_LTABs); } static Upp::Image LTABd() { return Get(I_LTABd); } static Upp::Image BTAB() { return Get(I_BTAB); } static Upp::Image BTABh() { return Get(I_BTABh); } static Upp::Image BTABs() { return Get(I_BTABs); } static Upp::Image BTABd() { return Get(I_BTABd); } static Upp::Image TABB() { return Get(I_TABB); } static Upp::Image SLA() { return Get(I_SLA); } static Upp::Image SRA() { return Get(I_SRA); } static Upp::Image TB() { return Get(I_TB); } static Upp::Image TBh() { return Get(I_TBh); } static Upp::Image TBp() { return Get(I_TBp); } static Upp::Image TBd() { return Get(I_TBd); } static Upp::Image TB1() { return Get(I_TB1); } static Upp::Image TB1h() { return Get(I_TB1h); } #line 47 "u:/uppsrc\\Draw/iml_header.h" }; #line 64 "u:/uppsrc\\Draw/iml_header.h" #line 16 "u:/uppsrc\\CtrlLib/CtrlLib.h" #line 1 "u:/uppsrc\\Draw/iml_header.h" class ClassicCtrlsImg { public: enum { #line 1 "u:/uppsrc\\CtrlLib/ClassicCtrls.iml" I_S0, I_S0h, I_S0p, I_S0d, I_S1, I_S1h, I_S1p, I_S1d, I_SBlack, I_O0, I_O0h, I_O0p, I_O0d, I_O1, I_O1h, I_O1p, I_O1d, I_O2, I_O2h, I_O2p, I_O2d, I_OBlack, I_SizeGrip, I_B, I_Bh, I_Bp, I_Bd, I_EB, I_EBh, I_EBp, I_EBd, I_SB, I_SBh, I_SBp, I_SBd, I_OkB, I_OkBh, I_OkBp, I_OkBd, I_DA, I_UA, I_LA, I_RA, I_EFE, I_VE, I_TAB, I_TABh, I_TABs, I_TABd, I_FTAB, I_FTABh, I_FTABs, I_FTABd, I_LTAB, I_LTABh, I_LTABs, I_LTABd, I_BTAB, I_BTABh, I_BTABs, I_BTABd, I_TABB, I_TB, I_TBh, I_TBp, I_TBd, I_TB1, I_TB1h, #line 20 "u:/uppsrc\\Draw/iml_header.h" COUNT }; public: static Upp::Iml& Iml(); static void Register__() { Register("ClassicCtrlsImg", Iml()); } static int Find(const Upp::String& s); static int Find(const char *s); static int GetCount() { return Iml().GetCount(); } static Upp::String GetId(int i) { return Iml().GetId(i); } static Upp::Image Get(int i); static Upp::Image Get(const char *s); static Upp::Image Get(const Upp::String& s); static void Set(int i, const Upp::Image& m); static void Set(const char *s, const Upp::Image& m); static void Reset() { Iml().Reset(); } #line 1 "u:/uppsrc\\CtrlLib/ClassicCtrls.iml" static Upp::Image S0() { return Get(I_S0); } static Upp::Image S0h() { return Get(I_S0h); } static Upp::Image S0p() { return Get(I_S0p); } static Upp::Image S0d() { return Get(I_S0d); } static Upp::Image S1() { return Get(I_S1); } static Upp::Image S1h() { return Get(I_S1h); } static Upp::Image S1p() { return Get(I_S1p); } static Upp::Image S1d() { return Get(I_S1d); } static Upp::Image SBlack() { return Get(I_SBlack); } static Upp::Image O0() { return Get(I_O0); } static Upp::Image O0h() { return Get(I_O0h); } static Upp::Image O0p() { return Get(I_O0p); } static Upp::Image O0d() { return Get(I_O0d); } static Upp::Image O1() { return Get(I_O1); } static Upp::Image O1h() { return Get(I_O1h); } static Upp::Image O1p() { return Get(I_O1p); } static Upp::Image O1d() { return Get(I_O1d); } static Upp::Image O2() { return Get(I_O2); } static Upp::Image O2h() { return Get(I_O2h); } static Upp::Image O2p() { return Get(I_O2p); } static Upp::Image O2d() { return Get(I_O2d); } static Upp::Image OBlack() { return Get(I_OBlack); } static Upp::Image SizeGrip() { return Get(I_SizeGrip); } static Upp::Image B() { return Get(I_B); } static Upp::Image Bh() { return Get(I_Bh); } static Upp::Image Bp() { return Get(I_Bp); } static Upp::Image Bd() { return Get(I_Bd); } static Upp::Image EB() { return Get(I_EB); } static Upp::Image EBh() { return Get(I_EBh); } static Upp::Image EBp() { return Get(I_EBp); } static Upp::Image EBd() { return Get(I_EBd); } static Upp::Image SB() { return Get(I_SB); } static Upp::Image SBh() { return Get(I_SBh); } static Upp::Image SBp() { return Get(I_SBp); } static Upp::Image SBd() { return Get(I_SBd); } static Upp::Image OkB() { return Get(I_OkB); } static Upp::Image OkBh() { return Get(I_OkBh); } static Upp::Image OkBp() { return Get(I_OkBp); } static Upp::Image OkBd() { return Get(I_OkBd); } static Upp::Image DA() { return Get(I_DA); } static Upp::Image UA() { return Get(I_UA); } static Upp::Image LA() { return Get(I_LA); } static Upp::Image RA() { return Get(I_RA); } static Upp::Image EFE() { return Get(I_EFE); } static Upp::Image VE() { return Get(I_VE); } static Upp::Image TAB() { return Get(I_TAB); } static Upp::Image TABh() { return Get(I_TABh); } static Upp::Image TABs() { return Get(I_TABs); } static Upp::Image TABd() { return Get(I_TABd); } static Upp::Image FTAB() { return Get(I_FTAB); } static Upp::Image FTABh() { return Get(I_FTABh); } static Upp::Image FTABs() { return Get(I_FTABs); } static Upp::Image FTABd() { return Get(I_FTABd); } static Upp::Image LTAB() { return Get(I_LTAB); } static Upp::Image LTABh() { return Get(I_LTABh); } static Upp::Image LTABs() { return Get(I_LTABs); } static Upp::Image LTABd() { return Get(I_LTABd); } static Upp::Image BTAB() { return Get(I_BTAB); } static Upp::Image BTABh() { return Get(I_BTABh); } static Upp::Image BTABs() { return Get(I_BTABs); } static Upp::Image BTABd() { return Get(I_BTABd); } static Upp::Image TABB() { return Get(I_TABB); } static Upp::Image TB() { return Get(I_TB); } static Upp::Image TBh() { return Get(I_TBh); } static Upp::Image TBp() { return Get(I_TBp); } static Upp::Image TBd() { return Get(I_TBd); } static Upp::Image TB1() { return Get(I_TB1); } static Upp::Image TB1h() { return Get(I_TB1h); } #line 47 "u:/uppsrc\\Draw/iml_header.h" }; #line 64 "u:/uppsrc\\Draw/iml_header.h" #line 20 "u:/uppsrc\\CtrlLib/CtrlLib.h" class Bar; #line 1 "u:/uppsrc\\CtrlLib/LabelBase.h" enum { CTRL_NORMAL, CTRL_HOT, CTRL_PRESSED, CTRL_DISABLED, CTRL_CHECKED, CTRL_HOTCHECKED }; struct CtrlsImgLook : Vector { CtrlsImgLook& operator()(int i, int n = 4); CtrlsImgLook& operator()(int i, const Image& img, Color (*fn)(int i), int n = 4); CtrlsImgLook& operator()(int i, const Image& img, int n = 4); CtrlsImgLook(int i, int n = 4); CtrlsImgLook(int i, const Image& img, Color (*fn)(int i), int n = 4); CtrlsImgLook(int i, const Image& img, int n = 4); }; void CtrlsImageLook(Value *look, int i, int n = 4); void CtrlsImageLook(Value *look, int i, const Image& image, const Color *color, int n = 4); void CtrlsImageLook(Value *look, int i, const Image& image, int n = 4); String DeAmp(const char *s); Size GetSmartTextSize(const char *text, Font font = StdFont(), int cx = 2147483647); int GetSmartTextHeight(const char *s, int cx, Font font = StdFont()); void DrawSmartText(Draw& w, int x, int y, int cx, const char *text, Font font = StdFont(), Color ink = DefaultInk, int accesskey = 0); byte ExtractAccessKey(const char *s, String& label); bool CompareAccessKey(byte accesskey, dword key); byte ChooseAccessKey(const char *s, dword used); void DrawFocus(Draw& w, int x, int y, int cx, int cy, Color c = SColorText()); void DrawFocus(Draw& w, const Rect& r, Color c = SColorText()); void DrawHorzDrop(Draw& w, int x, int y, int cx); void DrawVertDrop(Draw& w, int x, int y, int cy); Point GetDragScroll(Ctrl *ctrl, Point p, Size max); Point GetDragScroll(Ctrl *ctrl, Point p, int max = 16); struct DrawLabel { bool push; bool focus; bool disabled; PaintRect paintrect; Image limg; Color lcolor; int lspc; String text; Font font; Color ink; Image rimg; Color rcolor; int rspc; int align, valign; int accesskey; Size GetSize(int txtcx, Size sz1, int lspc, Size sz2, int rspc) const; Size GetSize(int txtcx = 2147483647) const; Size Paint(Draw& w, const Rect& r, bool visibleaccesskey = true) const; Size Paint(Draw& w, int x, int y, int cx, int cy, bool visibleaccesskey = true) const; DrawLabel(); }; Image DisabledImage(const Image& img, bool disabled = true); class LabelBase { protected: virtual void LabelUpdate(); DrawLabel lbl; public: LabelBase& SetLeftImage(const Image& bmp1, int spc = 0); LabelBase& SetPaintRect(const PaintRect& pr); LabelBase& SetText(const char *text); LabelBase& SetFont(Font font); LabelBase& SetInk(Color color); LabelBase& SetRightImage(const Image& bmp2, int spc = 0); LabelBase& SetAlign(int align); LabelBase& SetVAlign(int align); LabelBase& SetImage(const Image& bmp, int spc = 0) { SetLeftImage(bmp, spc); return *this; } int GetAlign() const { return lbl.align; } int GetVAlign() const { return lbl.valign; } PaintRect GetPaintRect() const { return lbl.paintrect; } String GetText() const { return lbl.text; } Font GetFont() const { return lbl.font; } Color GetInk() const { return lbl.ink; } Size PaintLabel(Draw& w, const Rect& r, bool disabled = false, bool push = false, bool focus = false, bool vak = true); Size PaintLabel(Draw& w, int x, int y, int cx, int cy, bool disabled = false, bool push = false, bool focus = false, bool vak = true); Size GetLabelSize() const; virtual ~LabelBase(); }; class DisplayPopup : Ctrl { virtual void Paint(Draw& w); virtual void LeftDown(Point p, dword); virtual void LeftDrag(Point p, dword); virtual void LeftDouble(Point p, dword); virtual void RightDown(Point p, dword); virtual void LeftUp(Point p, dword); virtual void MouseWheel(Point p, int zdelta, dword keyflags); virtual void MouseLeave(); virtual void MouseMove(Point p, dword); private: Ptr ctrl; Rect item; Rect slim; Value value; Color paper, ink; dword style; const Display *display; int margin; Point Op(Point p); void Sync(); public: void Set(Ctrl *ctrl, const Rect& item, const Value& v, const Display *display, Color ink, Color paper, dword style, int margin = 0); void Cancel(); bool IsOpen(); bool HasMouse(); DisplayPopup(); }; #line 24 "u:/uppsrc\\CtrlLib/CtrlLib.h" #line 1 "u:/uppsrc\\CtrlLib/StaticCtrl.h" class StaticText : public Ctrl, public LabelBase { public: virtual void Paint(Draw& w); virtual Size GetMinSize() const; virtual void LabelUpdate(); public: StaticText& SetFont(Font font) { LabelBase::SetFont(font); return *this; } StaticText& SetInk(Color color) { LabelBase::SetInk(color); return *this; } StaticText& SetAlign(int align) { LabelBase::SetAlign(align); return *this; } StaticText& SetImage(const Image& img, int spc = 0) { LabelBase::SetImage(img, spc); return *this; } StaticText& SetText(const char *text) { LabelBase::SetText(text); return *this; } StaticText& operator=(const char *s) { SetText(s); return *this; } StaticText(); }; class Label : public StaticText { public: virtual bool HotKey(dword key); virtual dword GetAccessKeys() const; virtual void AssignAccessKeys(dword used); private: bool noac; public: Label& SetText(const char *text); Label& SetLabel(const char *lbl); Label& operator=(const char *s) { SetText(s); return *this; } Label(); virtual ~Label(); }; class LabelBox : public Label { public: virtual void Paint(Draw& w); virtual void AssignAccessKeys(dword used); virtual Rect GetVoidRect(); public: LabelBox(); virtual ~LabelBox(); LabelBox& operator=(const char *s) { SetText(s); return *this; } }; Color LabelBoxTextColor(); Color LabelBoxColor(); void LabelBoxTextColor_Write(Color c); void LabelBoxColor_Write(Color c); class ParentCtrl : public Ctrl { Size minsize; public: virtual Rect GetVoidRect(); virtual Size GetStdSize() const; virtual Size GetMinSize() const; void SetMinSize(Size sz) { minsize = sz; } ParentCtrl(); }; class StaticRect : public Ctrl { public: virtual void Paint(Draw& w); protected: Value bg; public: StaticRect& Background(const Value& chvalue); StaticRect& Color(class Color c) { Background(c); return *this; } StaticRect(); virtual ~StaticRect(); }; class ImageCtrl : public Ctrl { public: virtual void Paint(Draw& w); virtual Size GetStdSize() const; virtual Size GetMinSize() const; protected: Image img; public: ImageCtrl& SetImage(const Image& _img) { img = _img; Refresh(); return *this; } ImageCtrl() { Transparent(); NoWantFocus(); } }; class DisplayCtrl : public Ctrl { public: virtual void Paint(Draw& w); virtual Size GetMinSize() const; virtual void SetData(const Value& v); private: PaintRect pr; public: void SetDisplay(const Display& d); }; typedef ImageCtrl Icon; class Picture : public Ctrl { public: virtual void Paint(Draw& w); protected: Drawing picture; Color background; bool ratio; public: Picture& Background(Color color) { background = color; Refresh(); return *this; } Picture& KeepRatio(bool keep = true) { ratio = keep; Refresh(); return *this; } Picture& NoKeepRatio() { return KeepRatio(false); } Picture& Set(const Drawing& _picture) { picture = _picture; Refresh(); return *this; } Picture& operator=(const Drawing& _picture) { return Set(_picture); } Picture(); }; class SeparatorCtrl : public Ctrl { public: virtual Size GetMinSize() const; virtual void Paint(Draw& w); struct Style : ChStyle