Class TMotifForm (unit Motif)

Inherits from

TForm

Constructors


constructor create(owner: tcomponent);

The following functions return empty rects.


Functions

procedure paint;


procedure resize;

Draw control box, min button, and max button as needed

procedure WMCommand(var Message : TMessage);

Call default processing.

procedure WMGetMinMaxInfo(var Message : TWMGetMinMaxInfo);

Call default processing.

procedure WMKeyDown(var Message : TWMKeyDown);

Call default processing.

procedure WMKeyUp(var Message : TWMKeyUp);

Call default processing.

procedure WMNCCalcSize(var Message : TWMNCCalcSize);

Call default processing.

procedure WMNCCreate(var Message : TWMNCCreate);

with Message do

procedure WMNCHitTest(var Message : TWMNCHitTest);

Call default processing.

procedure WMNCLButtonDblClk(var Message : TWMNCLButtonDblClk);

Indicate the system menu is not showing

procedure WMNCLButtonDown(var Message : TWMNCLButtonDown);

Call default processing.

procedure WMSysChar(var Message : TWMSysChar);

Call default processing.

procedure WMSysKeyDown(var Message : TWMSysKeyDown);

Call default processing.

procedure WMSysKeyUp(var Message : TWMSysKeyUp);

Call default processing.

procedure WndProc(var Message : TMessage);

Lower Left

function DepressMinMaxButton(HitTest : word; var rc : TRect) : boolean;

Adjust rcButton to everything inside the shadows/hilights

function DoMenu : boolean;

Initially assume no button.

procedure DrawButton(dc : HDC; fMin, fDepressed : boolean);

loop until the button is released

function DrawCaption : boolean;

Procedure TMotifForm.

procedure DrawControlBox(dc : HDC; fInvert : boolean);

Now check the window styles, etc.

Procedure drawframe;


function GetButtonRect(nPos : word; var rc : TRect) : boolean;

Initially assume no max.

function GetControlBoxRect(var rc : TRect) : boolean;

Adjust for borders.

function GetMaxButtonRect(var rc : TRect) : boolean;

min.

function GetMinButtonRect(var rc : TRect) : boolean;

Initially assume no control box.

function GetTitleBarRect(var rc : TRect) : boolean;


function HasCaption : boolean;


procedure SetupSystemMenu(menu : HMenu);

Convert coordinates to screen coords.

function TestWinStyle(dwStyleBit : longint) : boolean;

height of the title bar in pixels

Properties

Events

Variables

corner : integer;


fActive : BOOLEAN;

Procedure Drawcaptionpush(pushed:boolean);

fMax : BOOLEAN;


fMin : BOOLEAN;


FRAMEWIDTH : integer;


fSysMenu : BOOLEAN;


Pushed : boolean;


fMenuUp : boolean;

Private declarations

TitleBarSize : integer;

state of the system menu


Constructors


constructor create(owner: tcomponent);

The following functions return empty rects. if box/button doesn't exist


Functions


procedure paint;


procedure resize;

Draw control box, min button, and max button as needed


procedure WMCommand(var Message : TMessage);

Call default processing.


procedure WMGetMinMaxInfo(var Message : TWMGetMinMaxInfo);

Call default processing.


procedure WMKeyDown(var Message : TWMKeyDown);

Call default processing.


procedure WMKeyUp(var Message : TWMKeyUp);

Call default processing.


procedure WMNCCalcSize(var Message : TWMNCCalcSize);

Call default processing.


procedure WMNCCreate(var Message : TWMNCCreate);

with Message do


procedure WMNCHitTest(var Message : TWMNCHitTest);

Call default processing.


procedure WMNCLButtonDblClk(var Message : TWMNCLButtonDblClk);

Indicate the system menu is not showing


procedure WMNCLButtonDown(var Message : TWMNCLButtonDown);

Call default processing.


procedure WMSysChar(var Message : TWMSysChar);

Call default processing.


procedure WMSysKeyDown(var Message : TWMSysKeyDown);

Call default processing.


procedure WMSysKeyUp(var Message : TWMSysKeyUp);

Call default processing.


procedure WndProc(var Message : TMessage);

Lower Left


function DepressMinMaxButton(HitTest : word; var rc : TRect) : boolean;

Adjust rcButton to everything inside the shadows/hilights


function DoMenu : boolean;

Initially assume no button.


procedure DrawButton(dc : HDC; fMin, fDepressed : boolean);

loop until the button is released


function DrawCaption : boolean;

Procedure TMotifForm.drawcaptionpush; var Mpen : hpen; rc,rcCap : TRect; dc : Hdc; begin GetTitleBarRect(rcCap); GetWindowRect(Handle, rc); OffsetRect(rcCap, -rc.left, -rc.top); SetRect(rc, rcCap.left, rcCap.bottom , rcCap.right, rcCap.bottom ); if fSysMenu then Inc(rcCap.left, TitleBarSize -2); if fMax then Dec(rcCap.right, TitleBarSize); if fMin then Dec(rcCap.right, TitleBarSize); dc := GetWindowDC(Handle); MPEN := CREATEPEN(PS_SOLID,1,ColorToRGB(clBtnHighlight)); if NOT PUSHED then begin SelectObject(dc, mpen); moveto(dc, rcCap.left+2, rcCap.top); lineto(dc, rcCap.left+2,rcCap.bottom); moveto(dc, rcCap.left, rcCap.top +1); lineto(dc, rcCap.right,rcCap.top +1); end else begin SelectObject(dc, mpen); moveto(dc, rcCap.right-1, rcCap.top); lineto(dc, rcCap.right-1,rcCap.bottom); moveto(dc, rcCap.left, rcCap.bottom-1); lineto(dc, rcCap.right,rcCap.bottom -1); SelectObject(dc, GETSTOCKOBJECT(black_pen)); moveto(dc, rcCap.left+2, rcCap.top); lineto(dc, rcCap.left+2,rcCap.bottom); moveto(dc, rcCap.left, rcCap.top +1); lineto(dc, rcCap.right,rcCap.top +1); end; deleteobject(MPEN); ReleaseDC(Handle, dc); end;


procedure DrawControlBox(dc : HDC; fInvert : boolean);

Now check the window styles, etc.


Procedure drawframe;


function GetButtonRect(nPos : word; var rc : TRect) : boolean;

Initially assume no max. button.


function GetControlBoxRect(var rc : TRect) : boolean;

Adjust for borders.


function GetMaxButtonRect(var rc : TRect) : boolean;

min. box is in position 1.


function GetMinButtonRect(var rc : TRect) : boolean;

Initially assume no control box.


function GetTitleBarRect(var rc : TRect) : boolean;


function HasCaption : boolean;


procedure SetupSystemMenu(menu : HMenu);

Convert coordinates to screen coords. using functions in WinProcs unit} {("WinProcs" must be given to avoid calling TForm1's ClientToScreen()


function TestWinStyle(dwStyleBit : longint) : boolean;

height of the title bar in pixels


Properties


Events


Variables


corner : integer;


fActive : BOOLEAN;

Procedure Drawcaptionpush(pushed:boolean);


fMax : BOOLEAN;


fMin : BOOLEAN;


FRAMEWIDTH : integer;


fSysMenu : BOOLEAN;


Pushed : boolean;


fMenuUp : boolean;

Private declarations


TitleBarSize : integer;

state of the system menu