parent
fe6e2c7eae
commit
e855fce170
|
|
@ -85,9 +85,6 @@ type tcontrol = class(tcomponent)
|
||||||
//FMouseEntered;//: boolean;
|
//FMouseEntered;//: boolean;
|
||||||
FVisible;//: Boolean; //可见
|
FVisible;//: Boolean; //可见
|
||||||
FID; //id
|
FID; //id
|
||||||
|
|
||||||
FOnMeasureItem;
|
|
||||||
FOnDrawItem;
|
|
||||||
#!end
|
#!end
|
||||||
//位置信息
|
//位置信息
|
||||||
FLeft:integer; //左边
|
FLeft:integer; //左边
|
||||||
|
|
@ -342,6 +339,15 @@ type tcontrol = class(tcomponent)
|
||||||
bindmessage(i,findfunction(v,o));
|
bindmessage(i,findfunction(v,o));
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
function preparesetparent(np);
|
||||||
|
begin
|
||||||
|
if (np is getparenttype()) then
|
||||||
|
begin
|
||||||
|
if not CheckNewParent(np) then return ;
|
||||||
|
if not np.checknewchild(self(true)) then return ;
|
||||||
|
end
|
||||||
|
SetParent(np);
|
||||||
|
end
|
||||||
protected //部分属性设置
|
protected //部分属性设置
|
||||||
function GetControlFont();virtual;
|
function GetControlFont();virtual;
|
||||||
begin
|
begin
|
||||||
|
|
@ -496,7 +502,7 @@ type tcontrol = class(tcomponent)
|
||||||
@explan(说明) 子控件删除 %%
|
@explan(说明) 子控件删除 %%
|
||||||
**}
|
**}
|
||||||
end
|
end
|
||||||
function operatectrl(actrl,op);virtual; //控件操作通知
|
function operatectrl(actrl,op); //控件操作通知
|
||||||
begin
|
begin
|
||||||
idx := FControls.indexof(actrl);
|
idx := FControls.indexof(actrl);
|
||||||
if op=opRemove then
|
if op=opRemove then
|
||||||
|
|
@ -689,36 +695,6 @@ type tcontrol = class(tcomponent)
|
||||||
begin
|
begin
|
||||||
DoCNCOMMAND(o,e);
|
DoCNCOMMAND(o,e);
|
||||||
end
|
end
|
||||||
function CNMEASUREITEM(o,e):CN_MEASUREITEM;virtual;
|
|
||||||
begin
|
|
||||||
CallMessgeFunction(FOnMeasureItem,o,e);
|
|
||||||
DoMeasureItem(o,e);
|
|
||||||
end
|
|
||||||
function DoMeasureItem(o,e);virtual;
|
|
||||||
begin
|
|
||||||
{**
|
|
||||||
@explan(说明) 控件测量通知消息 %%
|
|
||||||
@param(o)(TWinControl) 控件自身 %%
|
|
||||||
@param(e)(TMMEASUREITEM) 消息 %%
|
|
||||||
**}
|
|
||||||
end
|
|
||||||
function CNDRAWITEM(o,e):CN_DRAWITEM;virtual;
|
|
||||||
begin
|
|
||||||
//tb := new tbrush();
|
|
||||||
//tbh := tb.handle;
|
|
||||||
//odh := _wapi.SelectObject(canvas.Handle,tbh);
|
|
||||||
DoDrawItem(o,e);
|
|
||||||
//_wapi.SelectObject(canvas.Handle,odh);
|
|
||||||
end
|
|
||||||
function DoDrawItem(o,e);virtual;
|
|
||||||
begin
|
|
||||||
{
|
|
||||||
@explan(说明) 控件绘制通知消息 %%
|
|
||||||
@param(o)(TWinControl) 控件自身 %%
|
|
||||||
@param(e)(TMDRAWITEM) 消息 %%
|
|
||||||
}
|
|
||||||
CallMessgeFunction(FOnDrawItem,o,e);
|
|
||||||
end
|
|
||||||
function DoMouseEnter(o,e);virtual;
|
function DoMouseEnter(o,e);virtual;
|
||||||
begin
|
begin
|
||||||
{
|
{
|
||||||
|
|
@ -993,8 +969,6 @@ type tcontrol = class(tcomponent)
|
||||||
CallMessgeFunction(OnSize,o,e);
|
CallMessgeFunction(OnSize,o,e);
|
||||||
DoWMSIZE(o,e);
|
DoWMSIZE(o,e);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function CMCursorChanged(o,e):CM_CURSORCHANGED;virtual;
|
function CMCursorChanged(o,e):CM_CURSORCHANGED;virtual;
|
||||||
begin
|
begin
|
||||||
//if SetTempCursor(o.Cursor) then e.skip := true;
|
//if SetTempCursor(o.Cursor) then e.skip := true;
|
||||||
|
|
@ -1166,14 +1140,21 @@ type tcontrol = class(tcomponent)
|
||||||
FCursor := new tcustomcursor();
|
FCursor := new tcustomcursor();
|
||||||
FCursor.id := IDC_ARROW;
|
FCursor.id := IDC_ARROW;
|
||||||
end
|
end
|
||||||
procedure CheckNewParent(AParent:TWinControl);virtual; //检查parent
|
function checknewparent(AParent:TWinControl);virtual; //检查parent
|
||||||
begin
|
begin
|
||||||
{
|
{
|
||||||
@ignore(忽略)
|
@explan(说明) 判断是否可以作为当前类型的父节点 %%
|
||||||
@explan(说明) 判断是否可以作为父节点
|
@return(bool)
|
||||||
}
|
}
|
||||||
return(AParent is getparenttype()) ;//and AParent.IsContainer(self(true));
|
return true;
|
||||||
return false;
|
end
|
||||||
|
function checknewchild(achild);virtual;//检查child
|
||||||
|
begin
|
||||||
|
{
|
||||||
|
@explan(说明) 判断是否可以作为当前类型的子节点 %%
|
||||||
|
@return(bool)
|
||||||
|
}
|
||||||
|
return true;
|
||||||
end
|
end
|
||||||
function Recycling();override; //销毁处理
|
function Recycling();override; //销毁处理
|
||||||
begin
|
begin
|
||||||
|
|
@ -1281,10 +1262,6 @@ type tcontrol = class(tcomponent)
|
||||||
begin
|
begin
|
||||||
//if Dragging() then DragManager.DragStop(Drop);
|
//if Dragging() then DragManager.DragStop(Drop);
|
||||||
end
|
end
|
||||||
function getmessagehandle(id);virtual;
|
|
||||||
begin
|
|
||||||
if ifnumber(id)and FMessagehandle then return FMessagehandle[id];
|
|
||||||
end
|
|
||||||
function dispatch(o,e);virtual; //分发消息
|
function dispatch(o,e);virtual; //分发消息
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
|
|
@ -1292,9 +1269,13 @@ type tcontrol = class(tcomponent)
|
||||||
@param(o)()控件自身 %%
|
@param(o)()控件自身 %%
|
||||||
@param(e)(tuieventbase) 消息类及其子类 %%
|
@param(e)(tuieventbase) 消息类及其子类 %%
|
||||||
**}
|
**}
|
||||||
func := getmessagehandle(e.Msg);
|
id := e.Msg;
|
||||||
|
if ifnumber(id) and FMessagehandle then
|
||||||
|
begin
|
||||||
|
func := FMessagehandle[id];
|
||||||
if func then call(func,o,e);
|
if func then call(func,o,e);
|
||||||
end
|
end
|
||||||
|
end
|
||||||
procedure DoControlAlign();virtual;//调整子控件位置
|
procedure DoControlAlign();virtual;//调整子控件位置
|
||||||
begin
|
begin
|
||||||
end
|
end
|
||||||
|
|
@ -1491,7 +1472,7 @@ type tcontrol = class(tcomponent)
|
||||||
property OnDblClick:eventhandler read FOnDblClick write FOnDblClick;
|
property OnDblClick:eventhandler read FOnDblClick write FOnDblClick;
|
||||||
//property OnResize read FOnResize write FOnResize;
|
//property OnResize read FOnResize write FOnResize;
|
||||||
property OnShowHint read FOnShowHint write FOnShowHint;
|
property OnShowHint read FOnShowHint write FOnShowHint;
|
||||||
property Parent read FParent write SetParent;
|
property Parent read FParent write preparesetparent;
|
||||||
property PopupMenu:tpopupmenu read FPopupMenu write FPopupMenu{read GetPopupmenu write SetPopupMenu};
|
property PopupMenu:tpopupmenu read FPopupMenu write FPopupMenu{read GetPopupmenu write SetPopupMenu};
|
||||||
//property ShowHint read FShowHint write SetShowHint ;
|
//property ShowHint read FShowHint write SetShowHint ;
|
||||||
property Visible:bool read FVisible write SetVisible ;
|
property Visible:bool read FVisible write SetVisible ;
|
||||||
|
|
@ -1507,16 +1488,14 @@ type tcontrol = class(tcomponent)
|
||||||
@param(Height)(integer) 高度 %%
|
@param(Height)(integer) 高度 %%
|
||||||
@param(Width)(integer) 宽度 %%
|
@param(Width)(integer) 宽度 %%
|
||||||
@param(Zorder)(integer) 设置控件在父窗口的次序,最底层为 0 %%
|
@param(Zorder)(integer) 设置控件在父窗口的次序,最底层为 0 %%
|
||||||
@param(Top)() 上方位置 %%
|
@param(Top)(integer) 上方位置 %%
|
||||||
@param(Left)() 左边 %%
|
@param(Left)(integer) 左边 %%
|
||||||
**}
|
**}
|
||||||
property BoundsRect read GetBoundsRect write SetBoundsRect;
|
property BoundsRect read GetBoundsRect write SetBoundsRect;
|
||||||
property Zorder read GetZorder write SetZorder;
|
property Zorder read GetZorder write SetZorder;
|
||||||
property ControlState: TControlState read FControlState write FControlState;
|
property ControlState: TControlState read FControlState write FControlState;
|
||||||
property Color:color read getcolor write SetColor;//FColor;
|
property Color:color read getcolor write SetColor;//FColor;
|
||||||
property BKBitmap:tbitmap read FBKBitmap write SetBitmap;
|
property BKBitmap:tbitmap read FBKBitmap write SetBitmap;
|
||||||
property OnMeasureItem read FOnMeasureItem write FOnMeasureItem;
|
|
||||||
property OnDrawItem read FOnDrawItem write FOnDrawItem;
|
|
||||||
//property OnMouseEnter:eventhandler read FOnMouseEnter write FOnMouseEnter;
|
//property OnMouseEnter:eventhandler read FOnMouseEnter write FOnMouseEnter;
|
||||||
//property OnMouseLeave:eventhandler read FOnMouseLeave write FOnMouseLeave;
|
//property OnMouseLeave:eventhandler read FOnMouseLeave write FOnMouseLeave;
|
||||||
property Controls read FControls;
|
property Controls read FControls;
|
||||||
|
|
@ -1526,8 +1505,6 @@ type tcontrol = class(tcomponent)
|
||||||
@param(Controls)(TFpList of tcontrol) 子组件 %%
|
@param(Controls)(TFpList of tcontrol) 子组件 %%
|
||||||
@param(OnMouseLeave)(function[TControl,tuieventbase]) 鼠标离开回调 %%
|
@param(OnMouseLeave)(function[TControl,tuieventbase]) 鼠标离开回调 %%
|
||||||
@param(OnMouseEnter)(function[TControl,tuieventbase]) 鼠标进入回调 %%
|
@param(OnMouseEnter)(function[TControl,tuieventbase]) 鼠标进入回调 %%
|
||||||
@param(OnMeasureItem)(function[TControl,TMMEASUREITEM]) 控件测量回调 %%
|
|
||||||
@param(OnDrawItem)(function[TControl,TMDRAWITEM]) 控件绘制回调 %%
|
|
||||||
@param(Color)(integer) 背景色 %%
|
@param(Color)(integer) 背景色 %%
|
||||||
**}
|
**}
|
||||||
function isCustomPaint(); //提供给gtk使用
|
function isCustomPaint(); //提供给gtk使用
|
||||||
|
|
|
||||||
|
|
@ -3021,7 +3021,7 @@ type TPairSplitterSide=class(TCustomControl)
|
||||||
oldparent.RemoveSide(self);
|
oldparent.RemoveSide(self);
|
||||||
end
|
end
|
||||||
inherited;
|
inherited;
|
||||||
parent.AddSide(self);
|
parent.AddSide(self(true));
|
||||||
end else
|
end else
|
||||||
if not(p is class(TWincontrol))then
|
if not(p is class(TWincontrol))then
|
||||||
begin
|
begin
|
||||||
|
|
|
||||||
|
|
@ -1961,9 +1961,10 @@ type TWinControl = class(tcontrol)
|
||||||
end
|
end
|
||||||
function SetParent(NewParent);override; //type_twinctrol
|
function SetParent(NewParent);override; //type_twinctrol
|
||||||
begin
|
begin
|
||||||
|
ih := HandleAllocated();
|
||||||
if(NewParent=parent)and(NewParent is class(TWinControl))then //避免wrapcontrol句柄发生改变的问题
|
if(NewParent=parent)and(NewParent is class(TWinControl))then //避免wrapcontrol句柄发生改变的问题
|
||||||
begin
|
begin
|
||||||
if HandleAllocated()and NewParent.HandleAllocated()then
|
if ih and NewParent.HandleAllocated()then
|
||||||
begin
|
begin
|
||||||
if _wapi.GetParent(self.Handle)=NewParent.Handle then return;
|
if _wapi.GetParent(self.Handle)=NewParent.Handle then return;
|
||||||
end
|
end
|
||||||
|
|
@ -1974,7 +1975,8 @@ type TWinControl = class(tcontrol)
|
||||||
//都有句柄
|
//都有句柄
|
||||||
callparent := false;
|
callparent := false;
|
||||||
callalocate := false;
|
callalocate := false;
|
||||||
if HandleAllocated()and NewParent.HandleAllocated()then
|
ph := NewParent.HandleAllocated();
|
||||||
|
if ih and ph then
|
||||||
begin
|
begin
|
||||||
if WsPopUp then
|
if WsPopUp then
|
||||||
begin
|
begin
|
||||||
|
|
@ -1983,12 +1985,12 @@ type TWinControl = class(tcontrol)
|
||||||
end else
|
end else
|
||||||
if _wapi.SetParent(FHandle,NewParent.handle)then callparent := true;
|
if _wapi.SetParent(FHandle,NewParent.handle)then callparent := true;
|
||||||
end else
|
end else
|
||||||
if HandleAllocated()and not(NewParent.HandleAllocated())then
|
if ih and not(ph)then
|
||||||
begin
|
begin
|
||||||
DestroyHandle();
|
DestroyHandle();
|
||||||
callparent := true;
|
callparent := true;
|
||||||
end else
|
end else
|
||||||
if not(HandleAllocated())and NewParent.HandleAllocated()then
|
if not(ih)and ph then
|
||||||
begin
|
begin
|
||||||
callparent := true;
|
callparent := true;
|
||||||
callalocate := true;
|
callalocate := true;
|
||||||
|
|
@ -1998,7 +2000,7 @@ type TWinControl = class(tcontrol)
|
||||||
end
|
end
|
||||||
if callparent then
|
if callparent then
|
||||||
begin
|
begin
|
||||||
class(tcontrol).SetParent(NewParent);
|
inherited SetParent(NewParent);//class(tcontrol).SetParent(NewParent);
|
||||||
if Align <> alNone then
|
if Align <> alNone then
|
||||||
begin
|
begin
|
||||||
NewParent.DoControlAlign();
|
NewParent.DoControlAlign();
|
||||||
|
|
@ -2007,7 +2009,7 @@ type TWinControl = class(tcontrol)
|
||||||
if callalocate then HandleNeeded();
|
if callalocate then HandleNeeded();
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
if HandleAllocated()then DestroyHandle();
|
if ih then DestroyHandle();
|
||||||
inherited SetParent(NewParent);
|
inherited SetParent(NewParent);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -572,6 +572,14 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
(AIndexnew<FTabItems.length()) then
|
(AIndexnew<FTabItems.length()) then
|
||||||
begin
|
begin
|
||||||
FTabItems.swap(AIndex,AIndexnew);
|
FTabItems.swap(AIndex,AIndexnew);
|
||||||
|
if FCurrentid = AIndex then
|
||||||
|
begin
|
||||||
|
FCurrentid := AIndexnew;
|
||||||
|
end else
|
||||||
|
if FCurrentid = AIndexnew then
|
||||||
|
begin
|
||||||
|
FCurrentid := AIndex;
|
||||||
|
end
|
||||||
CalcTabs();
|
CalcTabs();
|
||||||
InvalidateRect(nil,false);
|
InvalidateRect(nil,false);
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue