Browse Source

+ added the win16api color functions

git-svn-id: trunk@31602 -
nickysn 10 years ago
parent
commit
c65af63459
4 changed files with 69 additions and 0 deletions
  1. 4 0
      rtl/win16/win31.pp
  2. 19 0
      rtl/win16/winprocs.inc
  3. 16 0
      rtl/win16/winprocsh.inc
  4. 30 0
      rtl/win16/wintypes.inc

+ 4 - 0
rtl/win16/win31.pp

@@ -186,6 +186,10 @@ const
   DCB_ENABLE     = $0004;
   DCB_ENABLE     = $0004;
   DCB_DISABLE    = $0008;
   DCB_DISABLE    = $0008;
 
 
+{ Color support }
+  COLOR_INACTIVECAPTIONTEXT = 19;
+  COLOR_BTNHIGHLIGHT        = 20;
+
 function GetFreeSystemResources(SysResource: UINT): UINT; external 'USER';
 function GetFreeSystemResources(SysResource: UINT): UINT; external 'USER';
 
 
 procedure LogError(err: UINT; lpInfo: FarPointer); external 'KERNEL';
 procedure LogError(err: UINT; lpInfo: FarPointer); external 'KERNEL';

+ 19 - 0
rtl/win16/winprocs.inc

@@ -74,3 +74,22 @@ begin
   UnlockResource := GlobalUnlock(hResData);
   UnlockResource := GlobalUnlock(hResData);
 end;
 end;
 
 
+function RGB(cRed, cGreen, cBlue: BYTE): COLORREF;
+begin
+  RGB := COLORREF(cRed or (WORD(cGreen) shl 8) or (DWORD(cBlue) shl 16));
+end;
+
+function GetRValue(rgb: DWORD): BYTE;
+begin
+  GetRValue := Byte(rgb);
+end;
+
+function GetGValue(rgb: DWORD): BYTE;
+begin
+  GetGValue := Byte((Word(rgb) shr 8));
+end;
+
+function GetBValue(rgb: DWORD): BYTE;
+begin
+  GetBValue := Byte(rgb shr 16);
+end;

+ 16 - 0
rtl/win16/winprocsh.inc

@@ -340,3 +340,19 @@ function LPtoDP(hdc: HDC; lppt: LPPOINT; cPoints: SmallInt): BOOL; external 'GDI
 function DPtoLP(hdc: HDC; var pt; cPoints: SmallInt): BOOL; external 'GDI';
 function DPtoLP(hdc: HDC; var pt; cPoints: SmallInt): BOOL; external 'GDI';
 function LPtoDP(hdc: HDC; var pt; cPoints: SmallInt): BOOL; external 'GDI';
 function LPtoDP(hdc: HDC; var pt; cPoints: SmallInt): BOOL; external 'GDI';
 {$endif}
 {$endif}
+
+{ Color support }
+
+function RGB(cRed, cGreen, cBlue: BYTE): COLORREF; {$ifdef SYSTEMUNIT}forward;{$else}inline;{$endif}
+
+function GetRValue(rgb: DWORD): BYTE; {$ifdef SYSTEMUNIT}forward;{$else}inline;{$endif}
+function GetGValue(rgb: DWORD): BYTE; {$ifdef SYSTEMUNIT}forward;{$else}inline;{$endif}
+function GetBValue(rgb: DWORD): BYTE; {$ifdef SYSTEMUNIT}forward;{$else}inline;{$endif}
+
+function GetNearestColor(hdc: HDC; clrref: COLORREF): COLORREF; external 'GDI';
+
+function GetSysColor(nDspElement: SmallInt): COLORREF; external 'USER';
+procedure SetSysColors(cDspElements: SmallInt; lpnDspElements: LPINT; lpdwRgbValues: LPCOLORREF); external 'USER';
+{$ifdef VAR_PARAMS_ARE_FAR}
+procedure SetSysColors(cDspElements: SmallInt; var DspElements; var RgbValues); external 'USER';
+{$endif}

+ 30 - 0
rtl/win16/wintypes.inc

@@ -501,3 +501,33 @@ const
 { Coordinate Modes }
 { Coordinate Modes }
   ABSOLUTE = 1;
   ABSOLUTE = 1;
   RELATIVE = 2;
   RELATIVE = 2;
+
+{ Color support }
+type
+  PCOLORREF = ^COLORREF;
+  LPCOLORREF = ^COLORREF; far;
+  COLORREF = DWORD;
+  TColorRef = COLORREF;
+
+const
+  COLOR_SCROLLBAR       = 0;
+  COLOR_BACKGROUND      = 1;
+  COLOR_ACTIVECAPTION   = 2;
+  COLOR_INACTIVECAPTION = 3;
+  COLOR_MENU            = 4;
+  COLOR_WINDOW          = 5;
+  COLOR_WINDOWFRAME     = 6;
+  COLOR_MENUTEXT        = 7;
+  COLOR_WINDOWTEXT      = 8;
+  COLOR_CAPTIONTEXT     = 9;
+  COLOR_ACTIVEBORDER    = 10;
+  COLOR_INACTIVEBORDER  = 11;
+  COLOR_APPWORKSPACE    = 12;
+  COLOR_HIGHLIGHT       = 13;
+  COLOR_HIGHLIGHTTEXT   = 14;
+  COLOR_BTNFACE         = 15;
+  COLOR_BTNSHADOW       = 16;
+  COLOR_GRAYTEXT        = 17;
+  COLOR_BTNTEXT         = 18;
+
+  WM_SYSCOLORCHANGE = $0015;