Changeset 5 for os/trunk/Xvcl


Ignore:
Timestamp:
Jun 2, 2013, 2:34:55 PM (12 years ago)
Author:
chronos
Message:
  • Added: Implemented sample desktop manager as simple application.
Location:
os/trunk
Files:
2 edited
5 moved

Legend:

Unmodified
Added
Removed
  • os/trunk

    • Property svn:ignore
      •  

        old new  
        11Win32
        22*.~dsk
         3__history
  • os/trunk/Xvcl

    • Property svn:ignore set to
      __history
  • os/trunk/Xvcl/Xvcl.Controls.pas

    r3 r5  
    2424  TMessageMouseUp = class(TMessageMouse);
    2525  TMessageMouseMove = class(TMessageMouse);
     26  TMessageResize = class(TMessage);
     27  TMessageTaskList = class(TMessage);
    2628
    2729  TKeyState = (ksShift, ksAlt, ksOS);
     
    186188  if FColor <> Value then begin
    187189    FColor := Value;
    188     Paint;
     190    if Visible then Paint;
    189191  end;
    190192end;
     
    225227  if FCaption <> Value then begin
    226228    FCaption := Value;
    227     Paint;
     229    if Visible then Paint;
    228230  end;
    229231end;
  • os/trunk/Xvcl/Xvcl.Forms.pas

    r3 r5  
    77
    88type
     9  TBorderStyle = (bsNormal, bsNone);
     10
    911  TForm = class(TWinControl)
    1012  private
    1113    FFocused: Boolean;
     14    FBorderStyle: TBorderStyle;
    1215    procedure SetFocused(const Value: Boolean);
     16    procedure SetBorderStyle(const Value: TBorderStyle);
    1317  protected
    1418    function GetVideoDevice: TVideoDevice; override;
     
    2226    procedure Paint; override;
    2327    property Focused: Boolean read FFocused write SetFocused;
     28    property BorderStyle: TBorderStyle read FBorderStyle write SetBorderStyle;
     29  end;
     30
     31  TPanel = class(TWinControl)
     32    Caption: string;
     33    procedure Paint; override;
    2434  end;
    2535
    2636  TApplication = class(TComponent)
     37  protected
     38  public
     39    Caption: string;
    2740    Screen: TObject; // TScreen;
    2841    Forms: TList<TForm>;
    2942    MainForm: TForm;
     43    function HandleMessage(Message: TMessage): Boolean; virtual;
    3044    procedure Run; virtual;
    3145    procedure Terminate; virtual;
     
    3650
    3751uses
    38   Xvcl.Kernel;
     52  LDOS.Kernel;
    3953
    4054{ TApplication }
     55
     56function TApplication.HandleMessage(Message: TMessage): Boolean;
     57begin
     58
     59end;
    4160
    4261procedure TApplication.Run;
     
    6786    TitleBarBounds := TRectangle.Create(0, 0, Bounds.Width, TitleBarHeight);
    6887    Focused := True;
    69     if TitleBarBounds.Contains(ScreenToClient(Position)) then begin
     88    if (BorderStyle = bsNormal) and TitleBarBounds.Contains(ScreenToClient(Position)) then begin
    7089      Move.StartControlPos := Bounds.TopLeft;
    7190      Move.StartMousePos := Position;
     
    92111  inherited;
    93112  with Canvas do begin
    94     if Focused then Brush.Color := clLightBlue else
    95       Brush.Color := clSilver;
    96     FillRect(TRectangle.Create(0, 0, Bounds.Width - 1, TitleBarHeight));
    97     MoveTo(TPoint.Create(0, 0));
    98     LineTo(TPoint.Create(Bounds.Width - 1, 0));
    99     LineTo(TPoint.Create(Bounds.Width - 1, Bounds.Height - 1));
    100     LineTo(TPoint.Create(0, Bounds.Height - 1));
    101     LineTo(TPoint.Create(0, 0));
    102     MoveTo(TPoint.Create(0, TitleBarHeight));
    103     LineTo(TPoint.Create(Bounds.Width - 1, TitleBarHeight));
    104     TextOut(TPoint.Create((Bounds.Width - GetTextSize(Caption).X) div 2,
    105       (TitleBarHeight - GetTextSize(Caption).Y) div 2), Caption);
     113    if BorderStyle = bsNormal then begin
     114      if Focused then Brush.Color := clLightBlue else
     115        Brush.Color := clSilver;
     116      FillRect(TRectangle.Create(0, 0, Bounds.Width - 1, TitleBarHeight));
     117      MoveTo(TPoint.Create(0, 0));
     118      LineTo(TPoint.Create(Bounds.Width - 1, 0));
     119      LineTo(TPoint.Create(Bounds.Width - 1, Bounds.Height - 1));
     120      LineTo(TPoint.Create(0, Bounds.Height - 1));
     121      LineTo(TPoint.Create(0, 0));
     122      MoveTo(TPoint.Create(0, TitleBarHeight));
     123      LineTo(TPoint.Create(Bounds.Width - 1, TitleBarHeight));
     124      TextOut(TPoint.Create((Bounds.Width - GetTextSize(Caption).X) div 2,
     125        (TitleBarHeight - GetTextSize(Caption).Y) div 2), Caption);
     126    end;
    106127  end;
     128end;
     129
     130procedure TForm.SetBorderStyle(const Value: TBorderStyle);
     131begin
     132  FBorderStyle := Value;
    107133end;
    108134
     
    115141end;
    116142
     143{ TPanel }
     144
     145procedure TPanel.Paint;
     146begin
     147  inherited;
     148  with Canvas do begin
     149    MoveTo(TPoint.Create(0, 0));
     150    LineTo(TPoint.Create(Bounds.Width - 1, 0));
     151    LineTo(TPoint.Create(Bounds.Width - 1, Bounds.Height - 1));
     152    LineTo(TPoint.Create(0, Bounds.Height - 1));
     153    LineTo(TPoint.Create(0, 0));
     154    TextOut(TPoint.Create((Bounds.Width - GetTextSize(Caption).X) div 2,
     155      (Bounds.Height - GetTextSize(Caption).Y) div 2), Caption);
     156  end;
     157end;
     158
    117159end.
Note: See TracChangeset for help on using the changeset viewer.