qt,gtk,gtk2: use TPanel.BorderStyle in widget initialization code

gtk, gtk2: use GtkFrame instead of GTkHBox to implement panel container (since Frame can handle our BorderStyle property)

git-svn-id: trunk@16887 -
This commit is contained in:
paul 2008-10-06 02:15:17 +00:00
parent c17b1aa2d5
commit 586365803f
4 changed files with 18 additions and 12 deletions

View File

@ -1480,8 +1480,8 @@ type
wcfReAlignNeeded,
wcfAligningControls,
wcfEraseBackground,
wcfCreatingHandle, // Set while constructing the handle of this control
wcfInitializing, // Set while initializing during handle creation
wcfCreatingHandle, // Set while constructing the handle of this control
wcfInitializing, // Set while initializing during handle creation
wcfCreatingChildHandles, // Set while constructing the handles of the childs
wcfHandleVisible
);

View File

@ -6742,17 +6742,20 @@ begin
AChild.FBaseParentClientSize:=LoadedClientSize;
//DebugLn(['TWinControl.Loaded Self=',DbgSName(Self),' AChild=',AChild,' AChild.FBaseParentClientSize=',dbgs(AChild.FBaseParentClientSize)]);
end;
if HandleAllocated then begin
if HandleAllocated then
begin
// Set cached caption
if GetCachedText(CachedText) then
WSSetText(CachedText);
InvalidatePreferredSize;
if wcfColorChanged in FWinControlFlags then begin
if wcfColorChanged in FWinControlFlags then
begin
TWSWinControlClass(WidgetSetClass).SetColor(Self);
Exclude(FWinControlFlags,wcfColorChanged);
end;
if wcfFontChanged in FWinControlFlags then begin
if wcfFontChanged in FWinControlFlags then
begin
TWSWinControlClass(WidgetSetClass).SetFont(Self,Font);
NotifyControls(CM_PARENTCOLORCHANGED);
for i := 0 to ControlCount - 1 do

View File

@ -634,10 +634,15 @@ var
WidgetInfo: PWidgetInfo;
TempWidget: PGtkWidget; // pointer to gtk-widget (local use when neccessary)
begin
// create a fixed widget in a horizontal box
// a fixed on a fixed has no z-order
Widget := gtk_hbox_new(False, 0);
// TPanel control is a area with frame around. Area can have its own color
// To implement that in gtk we need:
// 1. GtkFrame to draw frame around area
// 2. GtkFixed to plaace controls and draw color area
Widget := gtk_frame_new(nil);
WidgetInfo := CreateWidgetInfo(Widget, AWinControl, AParams);
gtk_frame_set_shadow_type(PGtkFrame(Widget), BorderStyleShadowMap[TCustomPanel(AWinControl).BorderStyle]);
TempWidget := CreateFixedClientWidget;
gtk_container_add(GTK_CONTAINER(Widget), TempWidget);
gtk_widget_show(TempWidget);

View File

@ -31,7 +31,7 @@ interface
uses
// Bindings
qt4,
qtwidgets, qtobjects, qtproc,
qtwidgets, qtobjects, qtproc, QtWSControls,
// LCL
LMessages, LCLMessageGlue,
SysUtils, Classes, Controls, Graphics, Forms, StdCtrls, ExtCtrls, LCLType,
@ -256,11 +256,9 @@ begin
QtFrame.AttachEvents;
// Set's initial properties
QtFrame.setFrameShape(QFrameNoFrame);
QtFrame.setFrameShape(TBorderStyleToQtFrameShapeMap[TCustomPanel(AWinControl).BorderStyle]);
// Return the Handle
Result := TLCLIntfHandle(QtFrame);
end;