home *** CD-ROM | disk | FTP | other *** search
- #include "blocks.h"
- #include <windowsx.h>
-
- /*******************************************************************
- NOTE: Although the code for this class is provided if
- you wish to change it you chouls change the name because
- it is also in the DLL and LIB under the same name and
- can be used as is.
- *******************************************************************/
-
- void TBlockWindows::UCtlColor(RTMessage Msg)
- {
- TUnderlying::UCtlColor(Msg);
-
- if(Chars.CustomLevel < 1)
- return;
- //DefWindowProc would have been called by
- //TUnderlying
-
- /*******************************************************************
- It looked really nice when this was done for all controls
- not just the static controls, unfortunately the backrougn
- never gets erased and many of the controls can't be
- changed then.
- ******************************************************************/
- switch(Msg.LP.Hi)
- {
- case CTLCOLOR_STATIC:
- SetBkMode((HDC)Msg.WParam,NULL);
- SetWindowLong(MyHWindow, DWL_MSGRESULT, (LRESULT)GetStockBrush(HOLLOW_BRUSH));
- Msg.Result = (LRESULT)GetStockBrush(NULL_BRUSH);
- break;
- }
- }
-
- void TBlockWindows::UEraseBkGnd(RTMessage Msg)
- {
- if(Chars.CustomLevel < 1)
- {
- TUnderlying::UEraseBkGnd(Msg);
- return;
- }
-
- HBRUSH Fill1,Fill2,OldB;
- Fill1 = CreateSolidBrush(DrawColors.UpLeftBorders);
- Fill2 = CreateSolidBrush(DrawColors.RightBottomBorders);
-
- OldB = SelectBrush((HDC)Msg.WParam,Fill1);
- HPEN OldP = SelectPen((HDC)Msg.WParam,GetStockPen(NULL_PEN));
-
- RECT ClientArea;
- GetWindowRect(MyHWindow,&ClientArea);
-
- Rectangle((HDC)Msg.WParam,0,0,
- ClientArea.right,ClientArea.bottom);
-
- SelectBrush((HDC)Msg.WParam,Fill2);
- for(int x=0;x<=ClientArea.right+8;x+=ClientArea.right/8)
- for(int y=0;y<=ClientArea.bottom+8;y+=ClientArea.bottom/8)
- {
- Rectangle((HDC)Msg.WParam,x,y,
- x+ClientArea.right/16,
- y+ClientArea.bottom/16);
- Rectangle((HDC)Msg.WParam,x+ClientArea.right/16,
- y+ClientArea.bottom/16,
- x+ClientArea.right/8,
- y+ClientArea.bottom/8);
- }
-
- SelectPen((HDC)Msg.WParam,OldP);
- SelectBrush((HDC)Msg.WParam,OldB);
-
- DeleteBrush(Fill1);
- DeleteBrush(Fill2);
- }
-
- void TBlockWindows::UserFrame(HDC DrawDC)
- {
- HPEN Out = CreatePen(PS_SOLID, 1, DrawColors.WindowBack);
- HPEN OldP;
-
- HBRUSH Fill1,Fill2;
- Fill1 = CreateSolidBrush(DrawColors.UpLeftBorders);
- Fill2 = CreateSolidBrush(DrawColors.RightBottomBorders);
-
- HBRUSH OldB = SelectBrush(DrawDC, Fill2);
- OldP = SelectPen(DrawDC, GetStockPen(NULL_PEN));
-
- Rectangle(DrawDC, WindowRect.left, WindowRect.top,
- WindowRect.right+1, WindowRect.bottom+1);
-
- SelectPen(DrawDC, Out);
- SelectBrush(DrawDC, Fill1);
-
- for(int x=0;x<=WindowRect.right+8;x+=WindowRect.right/4)
- for(int y=0;y<=WindowRect.bottom+8;y+=WindowRect.bottom/4)
- {
- Rectangle(DrawDC,x,y,
- x+WindowRect.right/8,
- y+WindowRect.bottom/8);
- }
-
- SelectPen(DrawDC, OldP);
- SelectBrush(DrawDC,OldB);
-
- DeletePen(Out);
- DeleteBrush(Fill1);
- DeleteBrush(Fill2);
- }
-
- void TBlockWindows::UserTitle(HDC DrawDC)
- {
-
- HBRUSH Fill;
- if(Chars.IsActive)
- {
- SetTextColor(DrawDC,DrawColors.TitleTextActive);
- Fill = CreateSolidBrush(DrawColors.TitleBarActive);
- }
- else
- {
- SetTextColor(DrawDC,DrawColors.TitleTextInactive);
- Fill = CreateSolidBrush(DrawColors.TitleBarInactive);
- }
-
- HBRUSH OldB = SelectBrush(DrawDC, Fill);
-
- HPEN OldP = SelectPen(DrawDC, GetStockPen(BLACK_PEN));
-
- for(float x=TitleRect.left;x<=TitleRect.right;
- x+=(float)(TitleRect.right-TitleRect.left)/8.00)
- Rectangle(DrawDC, x,TitleRect.top,x+
- (((float)(TitleRect.right-TitleRect.left)/8.00 >
- TitleRect.right) ? TitleRect.right :
- (float)(TitleRect.right-TitleRect.left)/8.00),
- TitleRect.bottom);
-
- SetBkMode(DrawDC,TRANSPARENT);
- SetTextAlign(DrawDC,TA_RIGHT);
-
- char Text[80];
- GetWindowText( MyHWindow, Text, 79 );
-
- TextOut(DrawDC, TitleRect.right - BitWidth*2,
- TitleRect.top + 1, Text, lstrlen(Text));
-
- SelectPen(DrawDC, OldP);
- SelectBrush(DrawDC, OldB);
-
- DeleteBrush(Fill);
- }
-