Changeset 23


Ignore:
Timestamp:
Dec 30, 2018, 1:17:24 AM (6 years ago)
Author:
chronos
Message:
  • Added: Maximalize button to maximalize window.
Location:
branches/overos
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/overos/UApplication.pas

    r22 r23  
    4040    Message := MessageQueue.Messages.First;
    4141    MessageQueue.Messages.Delete(0);
    42     if Message is TMessageWindowClose then begin
    43       TWindow(Message.Handle).Free;
    44     end;
     42    if Message is TMessageWindow then
     43      TWindow(Message.Handle).HandleMessage(Message);
    4544  end;
    4645end;
  • branches/overos/UFormMain.pas

    r22 r23  
    101101  Y: Integer);
    102102begin
    103   Caption := IntToStr(X) + ',' + IntToStr(Y);
     103  //Caption := IntToStr(X) + ',' + IntToStr(Y);
    104104  System.Mouse.Move(TPosition.Create(X, Y));
    105105end;
  • branches/overos/UWindow.pas

    r22 r23  
    4747  end;
    4848
    49   TMessageWindowClose = class(TMessage);
     49  TMessageWindow = class(TMessage);
     50  TMessageWindowClose = class(TMessageWindow);
     51  TMessageWindowMaximize = class(TMessageWindow);
    5052
    5153  { TWindow }
     
    6567    Title: string;
    6668    Application: TObject; // TApplication
     69    procedure HandleMessage(Message: TMessage);
    6770    procedure MouseButtonDown(Pos: TPosition; Button: TMouseButton); override;
    6871    procedure MouseButtonUp(Pos: TPosition; Button: TMouseButton); override;
    6972    procedure Close;
     73    procedure Maximize;
    7074    procedure Focus;
    7175    procedure Paint; override;
     
    125129procedure TTitleBar.ButtonMaximizeClick(Sender: TObject);
    126130begin
    127   Rectangle := TRectangle.Create(TPosition.Create(0, 0), Window.Screen.Size);
    128   Paint;
     131  Window.Maximize;
    129132end;
    130133
     
    228231end;
    229232
     233procedure TWindow.HandleMessage(Message: TMessage);
     234begin
     235  if Message is TMessageWindowClose then begin
     236    Free;
     237  end else
     238  if Message is TMessageWindowMaximize then begin;
     239    Rectangle := TRectangle.Create(TPosition.Create(0, 0), Screen.Size);
     240    Paint;
     241  end;
     242end;
     243
    230244procedure TWindow.MouseButtonDown(Pos: TPosition; Button: TMouseButton);
    231245begin
     
    243257begin
    244258  TApplication(Application).MessageQueue.PostMessage(Self, TMessageWindowClose.Create);
     259end;
     260
     261procedure TWindow.Maximize;
     262begin
     263  TApplication(Application).MessageQueue.PostMessage(Self, TMessageWindowMaximize.Create);
    245264end;
    246265
Note: See TracChangeset for help on using the changeset viewer.