- 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:
begin
case Details.Part of
HP_HEADERITEM:
begin
Result.DrawVariant := qdvControl;
Result.ControlElement := QStyleCE_HeaderSection;
end;
HP_HEADERITEM,
HP_HEADERITEMLEFT,
HP_HEADERITEMRIGHT:
begin
Result.DrawVariant := qdvControl;
{$ifdef USE_QT_4_3}
Result.ControlElement := QStyleCE_HeaderEmptyArea;
{$else}
Result.ControlElement := QStyleCE_HeaderSection;
{$endif}
end;
HP_HEADERSORTARROW:
begin

View File

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

View File

@ -70,6 +70,7 @@ type
class procedure Invalidate(const AWinControl: TWinControl); override;
public
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 SetSize(const AWinControl: TWinControl; const AWidth, AHeight: Integer); override;
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 AddControl(const AControl: TControl); override;
class procedure SetBorderStyle(const AWinControl: TWinControl; const ABorderStyle: TBorderStyle); override;
class procedure SetChildZPosition(const AWinControl, AChild: TWinControl;
const AOldPos, ANewPos: Integer;
@ -441,6 +441,22 @@ begin
TQtWidget(AWinControl.Handle).SetTextColor(@QColor);
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
////////////////////////////////////////////////////

View File

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