mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-06 09:27:50 +01:00
gtk2 intf: added gdkwindows for client widgets: gtk_fixed_new
git-svn-id: trunk@10120 -
This commit is contained in:
parent
107c5e7c0b
commit
b8e285a693
@ -2304,8 +2304,7 @@ begin
|
||||
OIPropNameColorButton.ButtonColor:=
|
||||
ObjectInspectorOptions.PropertyNameColor;
|
||||
|
||||
OIDefaultItemHeightSpinEdit.Value:=
|
||||
ObjectInspectorOptions.DefaultItemHeight;
|
||||
OIDefaultItemHeightSpinEdit.Value:=ObjectInspectorOptions.DefaultItemHeight;
|
||||
OIShowHintCheckBox.Checked := ObjectInspectorOptions.ShowHints;
|
||||
|
||||
// window minimizing and hiding
|
||||
@ -2456,7 +2455,7 @@ begin
|
||||
OIPropNameColorButton.ButtonColor;
|
||||
|
||||
ObjectInspectorOptions.DefaultItemHeight:=
|
||||
RoundToInt(OIDefaultItemHeightSpinEdit.Value);
|
||||
RoundToInt(OIDefaultItemHeightSpinEdit.Value);
|
||||
ObjectInspectorOptions.ShowHints := OIShowHintCheckBox.Checked;
|
||||
|
||||
// window minimizing
|
||||
|
||||
@ -2718,6 +2718,7 @@ end;
|
||||
procedure TControl.SetLeft(Value: Integer);
|
||||
begin
|
||||
{$IFDEF CHECK_POSITION}
|
||||
if CheckPosition(Self) then
|
||||
DebugLn('[TControl.SetLeft] ',Name,':',ClassName,' ',DbgS(Value));
|
||||
{$ENDIF}
|
||||
if csLoading in ComponentState then begin
|
||||
@ -2734,6 +2735,7 @@ end;
|
||||
procedure TControl.SetTop(Value: Integer);
|
||||
begin
|
||||
{$IFDEF CHECK_POSITION}
|
||||
if CheckPosition(Self) then
|
||||
DebugLn('[TControl.SetTop] ',Name,':',ClassName,' ',Dbgs(Value));
|
||||
{$ENDIF}
|
||||
if csLoading in ComponentState then begin
|
||||
@ -2764,6 +2766,7 @@ procedure TControl.SetWidth(Value: Integer);
|
||||
|
||||
begin
|
||||
{$IFDEF CHECK_POSITION}
|
||||
if CheckPosition(Self) then
|
||||
DebugLn('[TControl.SetWidth] ',Name,':',ClassName,' ',dbgs(Value));
|
||||
{$ENDIF}
|
||||
if csLoading in ComponentState then begin
|
||||
@ -2795,6 +2798,7 @@ procedure TControl.SetHeight(Value: Integer);
|
||||
|
||||
begin
|
||||
{$IFDEF CHECK_POSITION}
|
||||
if CheckPosition(Self) then
|
||||
DebugLn('[TControl.SetHeight] ',Name,':',ClassName,' ',dbgs(Value));
|
||||
{$ENDIF}
|
||||
if csLoading in ComponentState then begin
|
||||
|
||||
@ -26,16 +26,16 @@
|
||||
{$ENDIF}
|
||||
|
||||
{ $DEFINE CHECK_POSITION}
|
||||
{$IFDEF CHECK_POSITION}
|
||||
{ $IFDEF CHECK_POSITION}
|
||||
const CheckPostionClassName = 'TButtonX';
|
||||
const CheckPostionName = 'GroupBox2';
|
||||
const CheckPostionName = 'OIDefaultItemHeightSpinEdit';
|
||||
|
||||
function CheckPosition(AControl: TControl): boolean;
|
||||
begin
|
||||
Result:=(CompareText(AControl.ClassName,CheckPostionClassName)=0)
|
||||
or (CompareText(AControl.Name,CheckPostionName)=0);
|
||||
end;
|
||||
{$ENDIF}
|
||||
{ $ENDIF}
|
||||
{ $DEFINE VerboseMouseBugfix}
|
||||
|
||||
|
||||
@ -1066,8 +1066,8 @@ var
|
||||
NewLeft, NewTop, NewWidth, NewHeight: Integer;
|
||||
ParentBaseClientSize: TPoint;
|
||||
CurBaseBounds: TRect;
|
||||
NewRight: Integer;
|
||||
NewBottom: Integer;
|
||||
NewRight: Integer;// temp variable, not always valid, use with care !
|
||||
NewBottom: Integer;// temp variable, not always valid, use with care !
|
||||
|
||||
MinWidth: Integer;
|
||||
MaxWidth: Integer;
|
||||
@ -1161,7 +1161,7 @@ var
|
||||
AnchorSideCache[Kind]:=Result;
|
||||
if ReferenceSide=asrTop then ;
|
||||
end;
|
||||
|
||||
|
||||
begin
|
||||
{$IFDEF CHECK_POSITION}
|
||||
if CheckPosition(Control) then
|
||||
@ -1322,14 +1322,14 @@ var
|
||||
//if csDesigning in ComponentState then
|
||||
if CheckPosition(Control) then
|
||||
with Control do begin
|
||||
DebugLn('[TWinControl.AlignControls.DoPosition] After Anchoring',
|
||||
DebugLn(['[TWinControl.AlignControls.DoPosition] After Anchoring',
|
||||
' ',Name,':',ClassName,
|
||||
' Align=',AlignNames[AAlign],
|
||||
' Control=',Dbgs(Control),
|
||||
' Old=',DbgS(Left,Top,Width,Height),
|
||||
' New=',DbgS(NewLeft,NewTop,NewWidth,NewHeight),
|
||||
'');
|
||||
DebugLn(['DoPosition akRight=',akRight in CurAnchors,' ',GetAnchorSidePosition(akRight,NewRight)]);
|
||||
' Control=',dbgsName(Control),
|
||||
' Old= l=',Left,',t=',Top,',w=',Width,',h=',Height,
|
||||
' New= l=',NewLeft,',t=',NewTop,',w=',NewWidth,',h=',NewHeight,
|
||||
'']);
|
||||
DebugLn(['DoPosition akRight=',akRight in CurAnchors,' ',GetAnchorSidePosition(akRight,NewLeft+NewWidth)]);
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
@ -1452,7 +1452,7 @@ var
|
||||
if CheckPosition(Control) then
|
||||
with Control do
|
||||
DebugLn('[TWinControl.AlignControls.DoPosition] NEW BOUNDS Control=',DbgSName(Control),
|
||||
' New=',dbgs(NewLeft)+','+dbgs(NewTop)+','+dbgs(NewRight)+','+dbgs(NewBottom));
|
||||
' New=l=',dbgs(NewLeft)+',t='+dbgs(NewTop)+',w='+dbgs(NewWidth)+',h='+dbgs(NewHeight));
|
||||
{$ENDIF}
|
||||
// lock the base bounds, so that the new automatic bounds do not override
|
||||
// the user settings
|
||||
@ -1585,15 +1585,16 @@ var
|
||||
end;
|
||||
end;
|
||||
{$IFDEF CHECK_POSITION}
|
||||
if AlignList.Count>0 then begin
|
||||
DbgOut('[TWinControl.AlignControls.DoAlign] Self=',DbgSName(Self),
|
||||
' current align=',AlignNames[AAlign],' AlignList=[');
|
||||
for i:=0 to AlignList.Count-1 do begin
|
||||
if i>0 then DbgOut(',');
|
||||
DbgOut(DbgSName(TObject(AlignList[i])));
|
||||
if CheckPosition(Self) then
|
||||
if AlignList.Count>0 then begin
|
||||
DbgOut('[TWinControl.AlignControls.DoAlign] Self=',DbgSName(Self),
|
||||
' current align=',AlignNames[AAlign],' AlignList=[');
|
||||
for i:=0 to AlignList.Count-1 do begin
|
||||
if i>0 then DbgOut(',');
|
||||
DbgOut(DbgSName(TObject(AlignList[i])));
|
||||
end;
|
||||
DebugLn(']');
|
||||
end;
|
||||
DebugLn(']');
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
if not DoAlignChildControls(AAlign,AControl,AlignList,RemainingClientRect) then
|
||||
@ -4814,6 +4815,7 @@ var
|
||||
NewBoundsRealized: TRect;
|
||||
begin
|
||||
{$IFDEF VerboseSizeMsg}
|
||||
if CheckPosition(Self) then
|
||||
DebugLn('TWinControl.WMSize A ',Name,':',ClassName,' Message=',dbgs(Message.Width),',',dbgs(Message.Height),
|
||||
' BoundsRealized=',dbgs(FBoundsRealized));
|
||||
{$ENDIF}
|
||||
@ -5959,10 +5961,12 @@ var
|
||||
NewBounds: TRect;
|
||||
begin
|
||||
NewBounds:=Bounds(Left, Top, Width, Height);
|
||||
//if CheckPosition(Self) then
|
||||
// DebugLn('[TWinControl.DoSendBoundsToInterface] A ',DbgSName(Self),
|
||||
// ' OldRelBounds=',dbgs(FBoundsRealized),
|
||||
// ' -> NewBounds=',dbgs(NewBounds));
|
||||
{$IFDEF CHECK_POSITION}
|
||||
if CheckPosition(Self) then
|
||||
DebugLn('[TWinControl.DoSendBoundsToInterface] A ',DbgSName(Self),
|
||||
' OldRelBounds=',dbgs(FBoundsRealized),
|
||||
' -> NewBounds=',dbgs(NewBounds));
|
||||
{$ENDIF}
|
||||
FBoundsRealized:=NewBounds;
|
||||
TWSWinControlClass(WidgetSetClass).SetBounds(Self, Left, Top, Width, Height);
|
||||
end;
|
||||
|
||||
@ -345,7 +345,7 @@ begin
|
||||
//' LI=',DbgS(LI),
|
||||
//' ');
|
||||
{$ifdef GTK2}
|
||||
DebugLn(['TGtkListStringList.ConnectItemCallbacks ',DbgSName(Owner)]);
|
||||
//DebugLn(['TGtkListStringList.ConnectItemCallbacks ',DbgSName(Owner)]);
|
||||
g_signal_connect_after(G_OBJECT(li), 'expose_event',
|
||||
G_CALLBACK(@gtkListItemExposeEvent), li);
|
||||
{$else}
|
||||
|
||||
@ -5204,7 +5204,7 @@ var
|
||||
WinWidgetInfo: PWinWidgetInfo;
|
||||
begin
|
||||
Result := gtk_hbox_new(false, 0);
|
||||
TempWidget := gtk_fixed_new();
|
||||
TempWidget := CreateFixedClientWidget;
|
||||
gtk_container_add(GTK_CONTAINER(Result), TempWidget);
|
||||
gtk_widget_show(TempWidget);
|
||||
if NotOnParentsClientArea then begin
|
||||
@ -5235,7 +5235,7 @@ begin
|
||||
gtk_toolbar_insert_widget(PGTKToolbar(Result),ClientWidget,nil,nil,0);
|
||||
{$ELSE}
|
||||
Result := gtk_hbox_new(false,0);
|
||||
ClientWidget := gtk_fixed_new();
|
||||
ClientWidget := CreateFixedClientWidget;
|
||||
gtk_container_add(GTK_CONTAINER(Result), ClientWidget);
|
||||
{$ENDIF}
|
||||
gtk_widget_show(ClientWidget);
|
||||
@ -5391,7 +5391,7 @@ begin
|
||||
csGroupBox:
|
||||
begin
|
||||
P := gtk_frame_new (StrTemp);
|
||||
TempWidget := gtk_fixed_new();
|
||||
TempWidget := CreateFixedClientWidget;
|
||||
gtk_container_add(GTK_CONTAINER(p), TempWidget);
|
||||
gtk_widget_show(TempWidget);
|
||||
SetFixedWidget(p, TempWidget);
|
||||
@ -5405,7 +5405,7 @@ begin
|
||||
gtk_window_set_policy (GTK_WINDOW (p), 0, 0, 0);
|
||||
|
||||
// Create the form client area
|
||||
TempWidget := gtk_fixed_new();
|
||||
TempWidget := CreateFixedClientWidget;
|
||||
gtk_container_add(p, TempWidget);
|
||||
gtk_widget_show(TempWidget);
|
||||
SetFixedWidget(p, TempWidget);
|
||||
@ -5563,7 +5563,7 @@ begin
|
||||
// create a fixed widget in a horizontal box
|
||||
// a fixed on a fixed has no z-order
|
||||
p := gtk_hbox_new(false,0);
|
||||
TempWidget := gtk_fixed_new();
|
||||
TempWidget := CreateFixedClientWidget;
|
||||
gtk_container_add(GTK_CONTAINER(P), TempWidget);
|
||||
gtk_widget_show(TempWidget);
|
||||
SetFixedWidget(p, TempWidget);
|
||||
@ -5659,10 +5659,7 @@ begin
|
||||
|
||||
csToolButton:
|
||||
begin
|
||||
p := gtk_fixed_new();
|
||||
{$IFDEF GTK2}
|
||||
gtk_fixed_set_has_window(PGtkFixed(p), True);
|
||||
{$ENDIF}
|
||||
p := CreateFixedClientWidget;
|
||||
end;
|
||||
|
||||
csTrackBar:
|
||||
@ -5967,7 +5964,7 @@ begin
|
||||
// the notebook has no pages
|
||||
// -> add a dummy page
|
||||
DummyWidget := gtk_hbox_new(false, 0);
|
||||
AWidget := gtk_fixed_new;
|
||||
AWidget := CreateFixedClientWidget;
|
||||
gtk_widget_show(AWidget);
|
||||
//gtk_box_pack_start_defaults(GTK_BOX(DummyWidget),AWidget);
|
||||
gtk_container_add(GTK_CONTAINER(DummyWidget), AWidget);
|
||||
|
||||
@ -3801,6 +3801,14 @@ begin
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
function CreateFixedClientWidget: PGTKWidget;
|
||||
begin
|
||||
Result := gtk_fixed_new();
|
||||
{$IFDEF GTK2}
|
||||
gtk_fixed_set_has_window(PGtkFixed(Result), True);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Procedure FixedMoveControl(Parent, Child : PGTKWIdget; Left, Top : Longint);
|
||||
|
||||
@ -6967,7 +6975,7 @@ function GetStyleWithName(const WName: String) : PGTKStyle;
|
||||
Result:=gtk_notebook_new;
|
||||
NoteBookWidget := PGtkNoteBook(Result);
|
||||
//NoteBookPageWidget := gtk_hbox_new(false, 0);
|
||||
NoteBookPageClientAreaWidget := gtk_fixed_new;
|
||||
NoteBookPageClientAreaWidget := CreateFixedClientWidget;
|
||||
gtk_widget_show(NoteBookPageClientAreaWidget);
|
||||
//gtk_container_add(GTK_CONTAINER(NoteBookPageWidget),
|
||||
// NoteBookPageClientAreaWidget);
|
||||
@ -7049,7 +7057,7 @@ begin
|
||||
//gtk_widget_show(VBox);
|
||||
//gtk_container_add(PGtkContainer(StyleObject^.Widget), VBox);
|
||||
//gtk_object_set_data(PGtkObject(StyleObject^.Widget),'vbox',VBox);
|
||||
WindowFixedWidget:=gtk_fixed_new;
|
||||
WindowFixedWidget:=CreateFixedClientWidget;
|
||||
gtk_widget_show(WindowFixedWidget);
|
||||
gtk_container_add(PGtkContainer(StyleObject^.Widget), WindowFixedWidget);
|
||||
gtk_object_set_data(PGtkObject(StyleObject^.Widget),'fixedwidget',WindowFixedWidget);
|
||||
|
||||
@ -416,6 +416,7 @@ function FindFixedLastChildListItem(ParentFixed: PGtkFixed): PGList;
|
||||
function GetFixedChildListWidget(Item: PGList): PGtkWidget;
|
||||
|
||||
// fixed widgets
|
||||
function CreateFixedClientWidget: PGTKWidget;
|
||||
Procedure FixedMoveControl(Parent, Child: PGTKWIdget; Left, Top: Longint);
|
||||
Procedure FixedPutControl(Parent, Child: PGTKWidget; Left, Top: Longint);
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ uses
|
||||
{$ELSE}
|
||||
glib, gdk, gtk,
|
||||
{$ENDIF}
|
||||
Spin, GtkProc, GtkWSStdCtrls, WSSpin, WSLCLClasses, LCLType;
|
||||
LCLProc, Spin, GtkProc, GtkWSStdCtrls, WSSpin, WSLCLClasses, LCLType;
|
||||
|
||||
type
|
||||
|
||||
@ -126,6 +126,7 @@ var
|
||||
wHandle: HWND;
|
||||
SpinWidget: PGtkSpinButton;
|
||||
begin
|
||||
//DebugLn(['TGtkWSCustomFloatSpinEdit.UpdateControl ',dbgsName(ACustomFloatSpinEdit)]);
|
||||
wHandle := ACustomFloatSpinEdit.Handle;
|
||||
SpinWidget:=GTK_SPIN_BUTTON(Pointer(wHandle));
|
||||
AnAdjustment:=gtk_spin_button_get_adjustment(SpinWidget);
|
||||
@ -152,4 +153,4 @@ initialization
|
||||
RegisterWSComponent(TCustomFloatSpinEdit, TGtkWSCustomFloatSpinEdit);
|
||||
// RegisterWSComponent(TFloatSpinEdit, TGtkWSFloatSpinEdit);
|
||||
////////////////////////////////////////////////////
|
||||
end.
|
||||
end.
|
||||
|
||||
@ -72,11 +72,12 @@ var
|
||||
ItemPath: PGtkTreePath;
|
||||
Column: PGtkTreeViewColumn;
|
||||
begin
|
||||
DebugLn(['LCLIntfCellRenderer_Render cell=',dbgs(cell),
|
||||
{DebugLn(['LCLIntfCellRenderer_Render cell=',dbgs(cell),
|
||||
' ',GetWidgetDebugReport(Widget),' ',
|
||||
' background_area=',dbgGRect(background_area),
|
||||
' cell_area=',dbgGRect(cell_area),
|
||||
' expose_area=',dbgGRect(expose_area)]);
|
||||
' expose_area=',dbgGRect(expose_area)]);}
|
||||
|
||||
// draw default
|
||||
CellClass:=PLCLIntfCellRendererClass(gtk_object_get_class(cell));
|
||||
CellClass^.DefaultGtkRender(cell,Window,Widget,background_area,cell_area,
|
||||
@ -138,7 +139,7 @@ begin
|
||||
Dispose(Msg.DrawListItemStruct);
|
||||
end;
|
||||
|
||||
DebugLn(['LCLIntfCellRenderer_Render END ',DbgSName(LCLObject)]);
|
||||
//DebugLn(['LCLIntfCellRenderer_Render END ',DbgSName(LCLObject)]);
|
||||
end;
|
||||
|
||||
procedure LCLIntfCellRenderer_ClassInit(aClass: Pointer); cdecl;
|
||||
@ -147,7 +148,7 @@ var
|
||||
LCLClass: PLCLIntfCellRendererClass;
|
||||
RendererClass: PGtkCellRendererClass;
|
||||
begin
|
||||
DebugLn(['LCLIntfCellRenderer_ClassInit ']);
|
||||
//DebugLn(['LCLIntfCellRenderer_ClassInit ']);
|
||||
LCLClass:=PLCLIntfCellRendererClass(aClass);
|
||||
RendererClass:=GTK_CELL_RENDERER_CLASS(aClass);
|
||||
LCLClass^.DefaultGtkRender:=RendererClass^.render;
|
||||
@ -159,7 +160,7 @@ procedure LCLIntfCellRenderer_Init(Instance:PGTypeInstance;
|
||||
// Instance: PLCLIntfCellRenderer;
|
||||
// theClass: PLCLIntfCellRendererClass
|
||||
begin
|
||||
DebugLn(['LCLIntfCellRenderer_Init ']);
|
||||
//DebugLn(['LCLIntfCellRenderer_Init ']);
|
||||
end;
|
||||
|
||||
function LCLIntfCellRenderer_GetType: TGtkType;
|
||||
|
||||
@ -114,6 +114,7 @@ type
|
||||
property OnChange;
|
||||
property OnChangeBounds;
|
||||
property OnClick;
|
||||
property OnEditingDone;
|
||||
property OnEnter;
|
||||
property OnExit;
|
||||
property OnKeyDown;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user