- correct painting of empty header area through themes
- filling Keys part of Mouse message on MouseMove event (splitter works now)
- remove frame around TCustomControl descendant and implement TQtWSWinControl.SetBorderStyle
LCL:
- add missed mouse buttons: MK_XBUTTON1, MK_XBUTTON2

git-svn-id: trunk@11545 -
This commit is contained in:
paul 2007-07-17 13:18:13 +00:00
parent 469476cde9
commit a51377f82d
4 changed files with 53 additions and 41 deletions

View File

@ -249,20 +249,12 @@ begin
teHeader: teHeader:
begin begin
case Details.Part of case Details.Part of
HP_HEADERITEM: HP_HEADERITEM,
begin
Result.DrawVariant := qdvControl;
Result.ControlElement := QStyleCE_HeaderSection;
end;
HP_HEADERITEMLEFT, HP_HEADERITEMLEFT,
HP_HEADERITEMRIGHT: HP_HEADERITEMRIGHT:
begin begin
Result.DrawVariant := qdvControl; Result.DrawVariant := qdvControl;
{$ifdef USE_QT_4_3}
Result.ControlElement := QStyleCE_HeaderEmptyArea;
{$else}
Result.ControlElement := QStyleCE_HeaderSection; Result.ControlElement := QStyleCE_HeaderSection;
{$endif}
end; end;
HP_HEADERSORTARROW: HP_HEADERSORTARROW:
begin begin

View File

@ -54,6 +54,7 @@ type
FPaintData: TPaintData; FPaintData: TPaintData;
FEventHook: QObject_hookH; FEventHook: QObject_hookH;
function GetProps(const AnIndex: String): pointer; function GetProps(const AnIndex: String): pointer;
function QtButtonsToLCLButtons(AButtons: QTMouseButton): PtrInt;
function QtKeyToLCLKey(key: Integer): Word; function QtKeyToLCLKey(key: Integer): Word;
procedure DeliverMessage(var Msg); procedure DeliverMessage(var Msg);
procedure SetProps(const AnIndex: String; const AValue: pointer); procedure SetProps(const AnIndex: String; const AValue: pointer);
@ -1243,7 +1244,7 @@ procedure TQtWidget.SlotMouse(Event: QEventH); cdecl;
var var
Msg: TLMMouse; Msg: TLMMouse;
MousePos: PQtPoint; MousePos: PQtPoint;
Mbutton: QTMouseButtons; MButton: QTMouseButton;
Modifiers: QtKeyboardModifiers; Modifiers: QtKeyboardModifiers;
begin begin
{$ifdef VerboseQt} {$ifdef VerboseQt}
@ -1270,22 +1271,11 @@ begin
case QEvent_type(Event) of case QEvent_type(Event) of
QEventMouseButtonPress: QEventMouseButtonPress:
begin begin
Msg.Keys := QtButtonsToLCLButtons(MButton);
case MButton of case MButton of
QtLeftButton: QtLeftButton: Msg.Msg := LM_LBUTTONDOWN;
begin QtRightButton: Msg.Msg := LM_RBUTTONDOWN;
Msg.Msg := LM_LBUTTONDOWN; QtMidButton: Msg.Msg := LM_MBUTTONDOWN;
Msg.Keys := MK_LBUTTON;
end;
QtRightButton:
begin
Msg.Msg := LM_RBUTTONDOWN;
Msg.Keys := MK_RBUTTON;
end;
QtMidButton:
begin
Msg.Msg := LM_MBUTTONDOWN;
Msg.Msg := MK_MBUTTON;
end;
end; end;
DeliverMessage(Msg); DeliverMessage(Msg);
Msg.Msg := LM_PRESSED; Msg.Msg := LM_PRESSED;
@ -1293,22 +1283,11 @@ begin
end; end;
QEventMouseButtonRelease: QEventMouseButtonRelease:
begin begin
Msg.Keys := QtButtonsToLCLButtons(MButton);
case MButton of case MButton of
QtLeftButton: QtLeftButton: Msg.Msg := LM_LBUTTONUP;
begin QtRightButton: Msg.Msg := LM_RBUTTONUP;
Msg.Msg := LM_LBUTTONUP; QtMidButton: Msg.Msg := LM_MBUTTONUP;
Msg.Keys := MK_LBUTTON;
end;
QtRightButton:
begin
Msg.Msg := LM_RBUTTONUP;
Msg.Keys := MK_RBUTTON;
end;
QtMidButton:
begin
Msg.Msg := LM_MBUTTONUP;
Msg.Msg := MK_MBUTTON;
end;
end; end;
DeliverMessage(Msg); DeliverMessage(Msg);
{ Clicking on buttons operates differently, because QEventMouseButtonRelease { Clicking on buttons operates differently, because QEventMouseButtonRelease
@ -1342,6 +1321,25 @@ begin
end; end;
end; end;
function TQtWidget.QtButtonsToLCLButtons(AButtons: QTMouseButton): PtrInt;
begin
Result := 0;
if (QtLeftButton and AButtons) <> 0 then
Result := Result or MK_LBUTTON;
if (QtRightButton and AButtons) <> 0 then
Result := Result or MK_RBUTTON;
if (QtMidButton and AButtons) <> 0 then
Result := Result or MK_MBUTTON;
if (QtXButton1 and AButtons) <> 0 then
Result := Result or MK_XBUTTON1;
if (QtXButton2 and AButtons) <> 0 then
Result := Result or MK_XBUTTON2;
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Function: TQtWidget.SlotMouseMove Function: TQtWidget.SlotMouseMove
Params: None Params: None
@ -1361,6 +1359,8 @@ begin
Msg.XPos := SmallInt(MousePos^.X); Msg.XPos := SmallInt(MousePos^.X);
Msg.YPos := SmallInt(MousePos^.Y); Msg.YPos := SmallInt(MousePos^.Y);
Msg.Keys := QtButtonsToLCLButtons(QmouseEvent_Buttons(QMouseEventH(Event)));
Msg.Msg := LM_MOUSEMOVE; Msg.Msg := LM_MOUSEMOVE;
DeliverMessage(Msg); DeliverMessage(Msg);
@ -5140,6 +5140,8 @@ begin
FViewPortWidget := NiL; FViewPortWidget := NiL;
Parent := TQtWidget(LCLObject.Parent.Handle).GetContainerWidget; Parent := TQtWidget(LCLObject.Parent.Handle).GetContainerWidget;
Result := QAbstractScrollArea_create(Parent); Result := QAbstractScrollArea_create(Parent);
// remove default shape
QFrame_setFrameShape(QFrameH(Result), QFrameNoFrame);
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------

View File

@ -70,6 +70,7 @@ type
class procedure Invalidate(const AWinControl: TWinControl); override; class procedure Invalidate(const AWinControl: TWinControl); override;
public public
class procedure SetBounds(const AWinControl: TWinControl; const ALeft, ATop, AWidth, AHeight: Integer); override; class procedure SetBounds(const AWinControl: TWinControl; const ALeft, ATop, AWidth, AHeight: Integer); override;
class procedure SetBorderStyle(const AWinControl: TWinControl; const ABorderStyle: TBorderStyle); override;
class procedure SetPos(const AWinControl: TWinControl; const ALeft, ATop: Integer); override; class procedure SetPos(const AWinControl: TWinControl; const ALeft, ATop: Integer); override;
class procedure SetSize(const AWinControl: TWinControl; const AWidth, AHeight: Integer); override; class procedure SetSize(const AWinControl: TWinControl; const AWidth, AHeight: Integer); override;
class procedure ShowHide(const AWinControl: TWinControl); override; //TODO: rename to SetVisible(control, visible) class procedure ShowHide(const AWinControl: TWinControl); override; //TODO: rename to SetVisible(control, visible)
@ -81,7 +82,6 @@ type
// class procedure SetText(const AWinControl: TWinControl; const AText: string); override; // class procedure SetText(const AWinControl: TWinControl; const AText: string); override;
{ class procedure AddControl(const AControl: TControl); override; { class procedure AddControl(const AControl: TControl); override;
class procedure SetBorderStyle(const AWinControl: TWinControl; const ABorderStyle: TBorderStyle); override;
class procedure SetChildZPosition(const AWinControl, AChild: TWinControl; class procedure SetChildZPosition(const AWinControl, AChild: TWinControl;
const AOldPos, ANewPos: Integer; const AOldPos, ANewPos: Integer;
@ -441,6 +441,22 @@ begin
TQtWidget(AWinControl.Handle).SetTextColor(@QColor); TQtWidget(AWinControl.Handle).SetTextColor(@QColor);
end; end;
class procedure TQtWSWinControl.SetBorderStyle(const AWinControl: TWinControl;
const ABorderStyle: TBorderStyle);
const
TBorderStyleToQtFrameShapeMap: array[TBorderStyle] of QFrameShape =
(
{bsNone} QFrameNoFrame,
{bsSingle} QFrameStyledPanel
);
var
Widget: TQtWidget;
begin
Widget := TQtWidget(AWinControl.Handle);
if Widget is TQtFrame then
TQtFrame(Widget).setFrameShape(TBorderStyleToQtFrameShapeMap[ABorderStyle]);
end;
initialization initialization
//////////////////////////////////////////////////// ////////////////////////////////////////////////////

View File

@ -2425,6 +2425,8 @@ const
MK_SHIFT = 4; MK_SHIFT = 4;
MK_CONTROL = 8; MK_CONTROL = 8;
MK_MBUTTON = $10; MK_MBUTTON = $10;
MK_XBUTTON1 = $20;
MK_XBUTTON2 = $40;
Function CS_To_String(CompStyle: Integer): String; Function CS_To_String(CompStyle: Integer): String;