mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-29 13:49:36 +02:00
convert LM_ADDPAGE and LM_REMOVEPAGE messages to new interface methods
git-svn-id: trunk@5993 -
This commit is contained in:
parent
12030d9c62
commit
692a8dc161
@ -73,7 +73,6 @@ end;
|
||||
|
||||
procedure TNBPages.RemovePage(Index: integer);
|
||||
var
|
||||
Msg: TLMNotebookEvent;
|
||||
NewPageIndex: integer;
|
||||
APage: TCustomPage;
|
||||
begin
|
||||
@ -107,10 +106,7 @@ begin
|
||||
if (FNoteBook.HandleAllocated)
|
||||
and (TCustomPage(fPageList[Index]).HandleAllocated)
|
||||
then begin
|
||||
Msg.Parent := fNotebook;
|
||||
Msg.fCompStyle := fNotebook.fCompStyle;
|
||||
Msg.Page := Index;
|
||||
CNSendMessage(LM_REMOVEPAGE, fNotebook, @Msg);
|
||||
TWSCustomNotebookClass(FNotebook.WidgetSetClass).RemovePage(FNotebook, Index);
|
||||
end;
|
||||
fPageList.Delete(Index);
|
||||
APage.Parent:=nil;
|
||||
@ -196,7 +192,6 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TNBPages.InsertPage(Index:integer; APage: TCustomPage);
|
||||
var
|
||||
Msg: TLMNotebookEvent;
|
||||
NewZPosition: integer;
|
||||
begin
|
||||
{$IFDEF NOTEBOOK_DEBUG}
|
||||
@ -216,13 +211,8 @@ begin
|
||||
if FNoteBook.HandleAllocated
|
||||
and (not (csLoading in FNoteBook.ComponentState))
|
||||
then begin
|
||||
Msg.Parent := TControl(fNotebook);
|
||||
Msg.Child := APage;
|
||||
Msg.fCompStyle := fNotebook.fCompStyle;
|
||||
Msg.Page := Index;
|
||||
|
||||
CNSendMessage(LM_ADDPAGE, fNotebook, @Msg);
|
||||
Include(APage.FFlags,pfAdded);
|
||||
TWSCustomNotebookClass(FNotebook.WidgetSetClass).AddPage(FNotebook, APage, Index);
|
||||
Include(APage.FFlags, pfAdded);
|
||||
if fNoteBook.PageIndex = Index then
|
||||
fNoteBook.DoSendPageIndex
|
||||
else
|
||||
@ -338,7 +328,6 @@ end;
|
||||
procedure TCustomNotebook.DoCreateWnd;
|
||||
var
|
||||
i: Integer;
|
||||
Msg: TLMNotebookEvent;
|
||||
begin
|
||||
{$IFDEF NOTEBOOK_DEBUG}
|
||||
DebugLn('TCustomNotebook.DoCreateWnd ',Name,':',ClassName,' HandleAllocated=',HandleAllocated);
|
||||
@ -349,11 +338,7 @@ begin
|
||||
DebugLn('TCustomNotebook.DoCreateWnd ',Name,':',ClassName,' ',Page[i].Caption,' ',not (pfAdded in Page[i].Flags));
|
||||
{$ENDIF}
|
||||
if not (pfAdded in Page[i].Flags) then begin
|
||||
Msg.Parent := Self;
|
||||
Msg.Child := TControl(FPageList[i]);
|
||||
Msg.fCompStyle := FCompStyle;
|
||||
Msg.Page := i;
|
||||
CNSendMessage(LM_ADDPAGE, Self, @Msg);
|
||||
TWSCustomNotebookClass(WidgetSetClass).AddPage(Self, TCustomPage(FPageList[i]), i);
|
||||
Include(Page[i].FFlags,pfAdded);
|
||||
end;
|
||||
end;
|
||||
@ -823,6 +808,9 @@ end;}
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.56 2004/09/13 19:06:04 micha
|
||||
convert LM_ADDPAGE and LM_REMOVEPAGE messages to new interface methods
|
||||
|
||||
Revision 1.55 2004/09/10 16:28:50 mattias
|
||||
implemented very rudimentary TTabControl
|
||||
|
||||
|
@ -221,10 +221,6 @@ type
|
||||
procedure GetNoteBookCloseBtnImage(var Img: PGdkPixbuf);virtual;
|
||||
{$EndIF}
|
||||
procedure AddDummyNoteBookPage(NoteBookWidget: PGtkNoteBook);virtual;
|
||||
procedure RemoveDummyNoteBookPage(NoteBookWidget: PGtkNotebook);virtual;
|
||||
procedure UpdateNotebookPageTab(ANoteBook, APage: TObject);virtual;
|
||||
procedure AddNBPage(ANoteBook, APage: TObject; Index: Integer);virtual;
|
||||
procedure RemoveNBPage(ANoteBook: TObject; Index: Integer);virtual;
|
||||
procedure MoveNBPage(ANoteBook, APage: TObject; NewIndex: Integer);virtual;
|
||||
|
||||
// listbox
|
||||
@ -302,6 +298,8 @@ type
|
||||
procedure SetResizeRequest(Widget: PGtkWidget);virtual;
|
||||
// |-forms
|
||||
procedure UpdateTransientWindows; virtual;
|
||||
// |-notebook
|
||||
procedure UpdateNotebookPageTab(ANoteBook, APage: TObject);virtual;
|
||||
function ForceLineBreaks(DC : hDC; Src: PChar; MaxWidthInPixels : Longint;
|
||||
ProcessAmpersands : Boolean) : PChar;
|
||||
|
||||
@ -456,6 +454,9 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.204 2004/09/13 19:06:04 micha
|
||||
convert LM_ADDPAGE and LM_REMOVEPAGE messages to new interface methods
|
||||
|
||||
Revision 1.203 2004/09/13 13:13:46 micha
|
||||
convert LM_SHOWMODAL to interface methods
|
||||
|
||||
|
@ -3134,17 +3134,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
LM_AddPage :
|
||||
if Sender is TCustomNoteBook then begin
|
||||
AddNBPage(TControl(Sender), TLMNotebookEvent(Data^).Child,
|
||||
TLMNotebookEvent(Data^).Page);
|
||||
end;
|
||||
|
||||
LM_RemovePage :
|
||||
if Sender is TCustomNoteBook then begin
|
||||
RemoveNBPage(TControl(Sender), TLMNotebookEvent(Data^).Page);
|
||||
end;
|
||||
|
||||
LM_MovePage :
|
||||
if Sender is TCustomNoteBook then begin
|
||||
MoveNBPage(TControl(Sender), TLMNotebookEvent(Data^).Child,
|
||||
@ -6330,24 +6319,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{-------------------------------------------------------------------------------
|
||||
procedure RemoveDummyNoteBookPage(NoteBookWidget: PGtkNotebook);
|
||||
|
||||
Removes the dummy page.
|
||||
See also AddDummyNoteBookPage
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TGtkWidgetSet.RemoveDummyNoteBookPage(NoteBookWidget: PGtkNotebook);
|
||||
var
|
||||
DummyWidget: PGtkWidget;
|
||||
begin
|
||||
DummyWidget:=GetGtkNoteBookDummyPage(NoteBookWidget);
|
||||
if DummyWidget=nil then exit;
|
||||
gtk_notebook_remove_page(NoteBookWidget,
|
||||
gtk_notebook_page_num(NoteBookWidget,DummyWidget));
|
||||
DummyWidget:=nil;
|
||||
SetGtkNoteBookDummyPage(NoteBookWidget,DummyWidget);
|
||||
end;
|
||||
|
||||
{-------------------------------------------------------------------------------
|
||||
method TGtkWidgetSet UpdateNotebookPageTab
|
||||
Params: ANoteBook: TCustomNotebook; APage: TCustomPage
|
||||
@ -6554,79 +6525,6 @@ begin
|
||||
UpdateTabCloseBtn;
|
||||
end;
|
||||
|
||||
{-------------------------------------------------------------------------------
|
||||
method TGtkWidgetSet AddNBPage
|
||||
Params: ANoteBook, APage: TObject; Index: Integer
|
||||
Result: none
|
||||
|
||||
Inserts a new page to a notebook at position Index. The ANotebook is a
|
||||
TCustomNoteBook, the APage one of its TCustomPage. Both handles must already
|
||||
be created. ANoteBook Handle is a PGtkNoteBook and APage handle is a
|
||||
PGtkFixed.
|
||||
This procedure creates a new tab with an optional image, the page caption and
|
||||
an optional close button. The image and the caption will also be added to the
|
||||
tab popup menu.
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TGtkWidgetSet.AddNBPage(ANoteBook, APage: TObject; Index: Integer);
|
||||
var
|
||||
NoteBookWidget: PGtkWidget; // the notebook
|
||||
PageWidget: PGtkWidget; // the page (content widget)
|
||||
TabWidget: PGtkWidget; // the tab (hbox containing a pixmap, a label
|
||||
// and a close button)
|
||||
TabLabelWidget: PGtkWidget; // the label in the tab
|
||||
MenuWidget: PGtkWidget; // the popup menu (hbox containing a pixmap and
|
||||
// a label)
|
||||
MenuLabelWidget: PGtkWidget; // the label in the popup menu item
|
||||
begin
|
||||
NoteBookWidget:=PGtkWidget(TWinControl(ANoteBook).Handle);
|
||||
PageWidget:=PGtkWidget(TWinControl(APage).Handle);
|
||||
|
||||
// create the tab (hbox container)
|
||||
TabWidget:=gtk_hbox_new(false,1);
|
||||
begin
|
||||
gtk_object_set_data(PGtkObject(TabWidget), 'TabImage', nil);
|
||||
gtk_object_set_data(PGtkObject(TabWidget), 'TabCloseBtn', nil);
|
||||
// put a label into the tab
|
||||
TabLabelWidget:=gtk_label_new('');
|
||||
gtk_object_set_data(PGtkObject(TabWidget), 'TabLabel', TabLabelWidget);
|
||||
gtk_widget_show(TabLabelWidget);
|
||||
gtk_box_pack_start_defaults(PGtkBox(TabWidget),TabLabelWidget);
|
||||
end;
|
||||
gtk_widget_show(TabWidget);
|
||||
|
||||
// create popup menu
|
||||
MenuWidget:=gtk_hbox_new(false,2);
|
||||
begin
|
||||
// set icon widget to nil
|
||||
gtk_object_set_data(PGtkObject(MenuWidget), 'TabImage', nil);
|
||||
// put a label into the menu
|
||||
MenuLabelWidget:=gtk_label_new('');
|
||||
gtk_object_set_data(PGtkObject(MenuWidget), 'TabLabel', MenuLabelWidget);
|
||||
gtk_widget_show(MenuLabelWidget);
|
||||
gtk_box_pack_start_defaults(PGtkBox(MenuWidget),MenuLabelWidget);
|
||||
end;
|
||||
|
||||
gtk_widget_show(MenuWidget);
|
||||
|
||||
RemoveDummyNoteBookPage(PGtkNotebook(NoteBookWidget));
|
||||
gtk_notebook_insert_page_menu(GTK_NOTEBOOK(NotebookWidget),PageWidget,
|
||||
TabWidget,MenuWidget,Index);
|
||||
|
||||
UpdateNotebookPageTab(TCustomNoteBook(ANoteBook),TCustomPage(APage));
|
||||
UpdateNoteBookClientWidget(ANoteBook);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TGtkWidgetSet RemoveNBPage
|
||||
*Note: Remove Notebook Page
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TGtkWidgetSet.RemoveNBPage(ANoteBook: TObject; Index: Integer);
|
||||
begin
|
||||
// The gtk does not provide a function to remove a page without destroying it.
|
||||
// Luckily the LCL destroys the Handle, when a page is removed, so this
|
||||
// function is not needed.
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
procedure TGtkWidgetSet.MoveNBPage(ANoteBook, APage: TObject; NewIndex: Integer);
|
||||
|
||||
@ -8417,6 +8315,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.562 2004/09/13 19:06:04 micha
|
||||
convert LM_ADDPAGE and LM_REMOVEPAGE messages to new interface methods
|
||||
|
||||
Revision 1.561 2004/09/13 14:34:53 micha
|
||||
convert LM_TB_BUTTONCOUNT to interface method
|
||||
|
||||
|
@ -34,7 +34,7 @@ uses
|
||||
gtk,
|
||||
{$ENDIF GTK2}
|
||||
GtkGlobals, GtkProc, ExtCtrls,
|
||||
WSExtCtrls, WSLCLClasses;
|
||||
WSExtCtrls, WSLCLClasses, gtkint, interfacebase;
|
||||
|
||||
type
|
||||
|
||||
@ -52,6 +52,9 @@ type
|
||||
private
|
||||
protected
|
||||
public
|
||||
class procedure AddPage(const ANotebook: TCustomNotebook; const AChild: TCustomPage; const AIndex: integer); override;
|
||||
class procedure RemovePage(const ANotebook: TCustomNotebook; const AIndex: integer); override;
|
||||
|
||||
class function GetNotebookMinTabHeight(const AWinControl: TWinControl): integer; override;
|
||||
class function GetNotebookMinTabWidth(const AWinControl: TWinControl): integer; override;
|
||||
end;
|
||||
@ -203,8 +206,93 @@ type
|
||||
|
||||
implementation
|
||||
|
||||
{-------------------------------------------------------------------------------
|
||||
procedure RemoveDummyNoteBookPage(NoteBookWidget: PGtkNotebook);
|
||||
|
||||
Removes the dummy page.
|
||||
See also AddDummyNoteBookPage
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure RemoveDummyNoteBookPage(NoteBookWidget: PGtkNotebook);
|
||||
var
|
||||
DummyWidget: PGtkWidget;
|
||||
begin
|
||||
DummyWidget:=GetGtkNoteBookDummyPage(NoteBookWidget);
|
||||
if DummyWidget=nil then exit;
|
||||
gtk_notebook_remove_page(NoteBookWidget,
|
||||
gtk_notebook_page_num(NoteBookWidget,DummyWidget));
|
||||
DummyWidget:=nil;
|
||||
SetGtkNoteBookDummyPage(NoteBookWidget,DummyWidget);
|
||||
end;
|
||||
|
||||
{ TGtkWSCustomNotebook }
|
||||
|
||||
procedure TGtkWSCustomNotebook.AddPage(const ANotebook: TCustomNotebook;
|
||||
const AChild: TCustomPage; const AIndex: integer);
|
||||
{
|
||||
Inserts a new page to a notebook at position Index. The ANotebook is a
|
||||
TCustomNoteBook, the AChild one of its TCustomPage. Both handles must already
|
||||
be created. ANoteBook Handle is a PGtkNoteBook and APage handle is a
|
||||
PGtkFixed.
|
||||
This procedure creates a new tab with an optional image, the page caption and
|
||||
an optional close button. The image and the caption will also be added to the
|
||||
tab popup menu.
|
||||
}
|
||||
var
|
||||
NoteBookWidget: PGtkWidget; // the notebook
|
||||
PageWidget: PGtkWidget; // the page (content widget)
|
||||
TabWidget: PGtkWidget; // the tab (hbox containing a pixmap, a label
|
||||
// and a close button)
|
||||
TabLabelWidget: PGtkWidget; // the label in the tab
|
||||
MenuWidget: PGtkWidget; // the popup menu (hbox containing a pixmap and
|
||||
// a label)
|
||||
MenuLabelWidget: PGtkWidget; // the label in the popup menu item
|
||||
begin
|
||||
NoteBookWidget:=PGtkWidget(ANoteBook.Handle);
|
||||
PageWidget:=PGtkWidget(AChild.Handle);
|
||||
|
||||
// create the tab (hbox container)
|
||||
TabWidget:=gtk_hbox_new(false,1);
|
||||
begin
|
||||
gtk_object_set_data(PGtkObject(TabWidget), 'TabImage', nil);
|
||||
gtk_object_set_data(PGtkObject(TabWidget), 'TabCloseBtn', nil);
|
||||
// put a label into the tab
|
||||
TabLabelWidget:=gtk_label_new('');
|
||||
gtk_object_set_data(PGtkObject(TabWidget), 'TabLabel', TabLabelWidget);
|
||||
gtk_widget_show(TabLabelWidget);
|
||||
gtk_box_pack_start_defaults(PGtkBox(TabWidget),TabLabelWidget);
|
||||
end;
|
||||
gtk_widget_show(TabWidget);
|
||||
|
||||
// create popup menu
|
||||
MenuWidget:=gtk_hbox_new(false,2);
|
||||
begin
|
||||
// set icon widget to nil
|
||||
gtk_object_set_data(PGtkObject(MenuWidget), 'TabImage', nil);
|
||||
// put a label into the menu
|
||||
MenuLabelWidget:=gtk_label_new('');
|
||||
gtk_object_set_data(PGtkObject(MenuWidget), 'TabLabel', MenuLabelWidget);
|
||||
gtk_widget_show(MenuLabelWidget);
|
||||
gtk_box_pack_start_defaults(PGtkBox(MenuWidget),MenuLabelWidget);
|
||||
end;
|
||||
|
||||
gtk_widget_show(MenuWidget);
|
||||
|
||||
RemoveDummyNoteBookPage(PGtkNotebook(NoteBookWidget));
|
||||
gtk_notebook_insert_page_menu(GTK_NOTEBOOK(NotebookWidget), PageWidget,
|
||||
TabWidget, MenuWidget, AIndex);
|
||||
|
||||
TGtkWidgetSet(InterfaceObject).UpdateNotebookPageTab(ANoteBook, AChild);
|
||||
UpdateNoteBookClientWidget(ANoteBook);
|
||||
end;
|
||||
|
||||
procedure TGtkWSCustomNotebook.RemovePage(const ANotebook: TCustomNotebook;
|
||||
const AIndex: integer);
|
||||
begin
|
||||
// The gtk does not provide a function to remove a page without destroying it.
|
||||
// Luckily the LCL destroys the Handle, when a page is removed, so this
|
||||
// function is not needed.
|
||||
end;
|
||||
|
||||
function TGtkWSCustomNotebook.GetNotebookMinTabHeight(
|
||||
const AWinControl: TWinControl): integer;
|
||||
var
|
||||
|
@ -137,8 +137,6 @@ Type
|
||||
procedure ChangeActivePage(const Data: TLMNotebookEvent);
|
||||
procedure AddAllNBPages(Notebook: TCustomNotebook);
|
||||
procedure RemoveAllNBPages(Notebook: TCustomNotebook);
|
||||
Procedure AddNBPage(Notebook: TCustomNotebook; NewPage: TCustomPage; Index: Integer);
|
||||
procedure RemoveNBPage(Notebook: TCustomNotebook; Index: Integer);
|
||||
Procedure SetText(Window: HWND; Data: Pointer);
|
||||
Function GetValue (Sender: TObject; Data: Pointer): Integer;
|
||||
Function SetValue (Sender: TObject; Data: Pointer): Integer;
|
||||
@ -230,7 +228,7 @@ Uses
|
||||
Win32WSDialogs,
|
||||
// Win32WSDirSel,
|
||||
// Win32WSEditBtn,
|
||||
// Win32WSExtCtrls,
|
||||
Win32WSExtCtrls,
|
||||
// Win32WSExtDlgs,
|
||||
// Win32WSFileCtrl,
|
||||
Win32WSForms,
|
||||
@ -282,6 +280,9 @@ End.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.109 2004/09/13 19:06:04 micha
|
||||
convert LM_ADDPAGE and LM_REMOVEPAGE messages to new interface methods
|
||||
|
||||
Revision 1.108 2004/09/13 13:13:46 micha
|
||||
convert LM_SHOWMODAL to interface methods
|
||||
|
||||
|
@ -352,15 +352,6 @@ Begin
|
||||
InvalidateRect(TCustomSpeedButton(Sender).Parent.Handle, @SizeRect, True);
|
||||
End;
|
||||
End;
|
||||
LM_ADDPAGE:
|
||||
Begin
|
||||
Assert(False, Format('Trace:[TWin32WidgetSet.IntSendMessage3] %S --> Add NB page: %S', [Sender.ClassName, TLMNotebookEvent(Data^).Child.ClassName]));
|
||||
AddNBPage(Sender as TCustomNotebook, TLMNotebookEvent(Data^).Child as TCustomPage, TLMNotebookEvent(Data^).Page);
|
||||
End;
|
||||
LM_REMOVEPAGE:
|
||||
Begin
|
||||
RemoveNBPage(Sender as TCustomNotebook, TLMNotebookEvent(Data^).Page);
|
||||
End;
|
||||
LM_SHOWTABS:
|
||||
Begin
|
||||
Result := Ord(True);
|
||||
@ -1988,7 +1979,7 @@ var
|
||||
R: TRect;
|
||||
begin
|
||||
for I := Notebook.PageCount - 1 downto 0 do
|
||||
RemoveNBPage(Notebook, I);
|
||||
Windows.SendMessage(Notebook.Handle, TCM_DELETEITEM, Windows.WPARAM(I), 0);
|
||||
// Adjust page size to fit in tabcontrol, need bounds of notebook in client of parent
|
||||
Self.GetClientRect(Notebook.Handle, R);
|
||||
R.Right := R.Right - R.Left;
|
||||
@ -2031,56 +2022,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{ -----------------------------------------------------------------------------
|
||||
Method: TWin32WidgetSet.AddNBPage
|
||||
Params: Notebook - A notebook control
|
||||
NewPage - Page to insert
|
||||
Index - The position in the notebook to insert the page
|
||||
Returns: Nothing
|
||||
|
||||
Adds a new page to a notebook
|
||||
------------------------------------------------------------------------------}
|
||||
Procedure TWin32WidgetSet.AddNBPage(Notebook: TCustomNotebook; NewPage: TCustomPage; Index: Integer);
|
||||
Var
|
||||
TCI: TC_ITEM;
|
||||
OldPageIndex: integer;
|
||||
R: TRect;
|
||||
Begin
|
||||
Assert(False, 'Trace:TWin32WidgetSet.AddNBPage - Start');
|
||||
With Notebook do
|
||||
Begin
|
||||
TCI.Mask := TCIF_TEXT or TCIF_PARAM;
|
||||
TCI.pszText := PChar(NewPage.Caption);
|
||||
// store handle as extra data, so we can verify we got the right page later
|
||||
TCI.lParam := NewPage.Handle;
|
||||
Windows.SendMessage(Handle, TCM_INSERTITEM, Index, LPARAM(@TCI));
|
||||
// Adjust page size to fit in tabcontrol, need bounds of notebook in client of parent
|
||||
Self.GetClientRect(Handle, R);
|
||||
TWin32WSWinControl.SetBounds(NewPage, R.Left, R.Top, R.Right - R.Left, R.Bottom - R.Top);
|
||||
// Do the page switch. The are no tabcontrol notifications so we have to
|
||||
// do the hiding and showing ourselves.
|
||||
OldPageIndex := SendMessage(Handle,TCM_GETCURSEL,0,0);
|
||||
SendMessage(Handle,TCM_SETCURSEL,NewPage.PageIndex,0);
|
||||
ShowWindow(NewPage.Handle, SW_SHOW);
|
||||
if (OldPageIndex>=0) and (OldPageIndex<>NewPage.PageIndex)
|
||||
then ShowWindow(Page[OldPageIndex].Handle, SW_HIDE);
|
||||
End;
|
||||
End;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TWin32WidgetSet.RemoveNBPage
|
||||
Params: Parent - The notebook control
|
||||
Index - The page to delete
|
||||
Returns: Nothing
|
||||
|
||||
Removes a page from a notebook control
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TWin32WidgetSet.RemoveNBPage(Notebook: TCustomNotebook; Index: Integer);
|
||||
Begin
|
||||
Assert(false, 'Trace:Removing a notebook page');
|
||||
Windows.SendMessage(Notebook.Handle, TCM_DELETEITEM, Windows.WPARAM(Index), 0);
|
||||
End;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TWin32WidgetSet.ReDraw
|
||||
Params: Child - Component to redraw
|
||||
@ -2456,6 +2397,9 @@ End;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.254 2004/09/13 19:06:04 micha
|
||||
convert LM_ADDPAGE and LM_REMOVEPAGE messages to new interface methods
|
||||
|
||||
Revision 1.253 2004/09/13 14:34:53 micha
|
||||
convert LM_TB_BUTTONCOUNT to interface method
|
||||
|
||||
|
@ -33,9 +33,9 @@ uses
|
||||
// To get as little as posible circles,
|
||||
// uncomment only when needed for registration
|
||||
////////////////////////////////////////////////////
|
||||
// ExtCtrls,
|
||||
ExtCtrls,
|
||||
////////////////////////////////////////////////////
|
||||
WSExtCtrls, WSLCLClasses;
|
||||
WSExtCtrls, WSLCLClasses, Windows, Win32Int, InterfaceBase, Win32WSControls;
|
||||
|
||||
type
|
||||
|
||||
@ -53,6 +53,8 @@ type
|
||||
private
|
||||
protected
|
||||
public
|
||||
class procedure AddPage(const ANotebook: TCustomNotebook; const AChild: TCustomPage; const AIndex: integer); override;
|
||||
class procedure RemovePage(const ANotebook: TCustomNotebook; const AIndex: integer); override;
|
||||
end;
|
||||
|
||||
{ TWin32WSPage }
|
||||
@ -202,6 +204,39 @@ type
|
||||
|
||||
implementation
|
||||
|
||||
procedure TWin32WSCustomNotebook.AddPage(const ANotebook: TCustomNotebook;
|
||||
const AChild: TCustomPage; const AIndex: integer);
|
||||
var
|
||||
TCI: TC_ITEM;
|
||||
OldPageIndex: integer;
|
||||
R: TRect;
|
||||
begin
|
||||
With ANotebook do
|
||||
Begin
|
||||
TCI.Mask := TCIF_TEXT or TCIF_PARAM;
|
||||
TCI.pszText := PChar(AChild.Caption);
|
||||
// store handle as extra data, so we can verify we got the right page later
|
||||
TCI.lParam := AChild.Handle;
|
||||
Windows.SendMessage(Handle, TCM_INSERTITEM, AIndex, LPARAM(@TCI));
|
||||
// Adjust page size to fit in tabcontrol, need bounds of notebook in client of parent
|
||||
TWin32WidgetSet(InterfaceObject).GetClientRect(Handle, R);
|
||||
TWin32WSWinControl.SetBounds(AChild, R.Left, R.Top, R.Right - R.Left, R.Bottom - R.Top);
|
||||
// Do the page switch. The are no tabcontrol notifications so we have to
|
||||
// do the hiding and showing ourselves.
|
||||
OldPageIndex := SendMessage(Handle,TCM_GETCURSEL,0,0);
|
||||
SendMessage(Handle,TCM_SETCURSEL, AChild.PageIndex,0);
|
||||
ShowWindow(AChild.Handle, SW_SHOW);
|
||||
if (OldPageIndex >= 0) and (OldPageIndex <> AChild.PageIndex) then
|
||||
ShowWindow(Page[OldPageIndex].Handle, SW_HIDE);
|
||||
End;
|
||||
end;
|
||||
|
||||
procedure TWin32WSCustomNotebook.RemovePage(const ANotebook: TCustomNotebook;
|
||||
const AIndex: integer);
|
||||
begin
|
||||
Windows.SendMessage(ANotebook.Handle, TCM_DELETEITEM, Windows.WPARAM(AIndex), 0);
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
@ -211,7 +246,7 @@ initialization
|
||||
// which actually implement something
|
||||
////////////////////////////////////////////////////
|
||||
// RegisterWSComponent(TCustomPage, TWin32WSCustomPage);
|
||||
// RegisterWSComponent(TCustomNotebook, TWin32WSCustomNotebook);
|
||||
RegisterWSComponent(TCustomNotebook, TWin32WSCustomNotebook);
|
||||
// RegisterWSComponent(TPage, TWin32WSPage);
|
||||
// RegisterWSComponent(TNotebook, TWin32WSNotebook);
|
||||
// RegisterWSComponent(TShape, TWin32WSShape);
|
||||
|
@ -54,11 +54,9 @@ const
|
||||
LM_AssignSelf = LM_ComUser+11;
|
||||
LM_SetName = LM_ComUser+12;
|
||||
LM_RESIZECHILDREN = LM_ComUser+13;
|
||||
LM_AddPage = LM_ComUser+15;
|
||||
LM_GetLineCount = LM_ComUser+16;
|
||||
LM_CANVASCREATE = LM_ComUser+19;
|
||||
LM_ReDraw = LM_ComUser+26;
|
||||
LM_RemovePage = LM_ComUser+28;
|
||||
LM_ShowTabs = LM_ComUser+29;
|
||||
LM_SetTabPosition = LM_ComUser+30;
|
||||
LM_Invalidate = LM_ComUser+32;
|
||||
@ -833,11 +831,9 @@ begin
|
||||
LM_AssignSelf :Result:='LM_AssignSelf';
|
||||
LM_SetName :Result:='LM_SetName';
|
||||
LM_RESIZECHILDREN :Result:='LM_RESIZECHILDREN';
|
||||
LM_AddPage :Result:='LM_AddPage';
|
||||
LM_GetLineCount :Result:='LM_GetLineCount';
|
||||
LM_CANVASCREATE :Result:='LM_CANVASCREATE';
|
||||
LM_ReDraw :Result:='LM_ReDraw';
|
||||
LM_RemovePage :Result:='LM_RemovePage';
|
||||
LM_ShowTabs :Result:='LM_ShowTabs';
|
||||
LM_SetTabPosition :Result:='LM_SetTabPosition';
|
||||
LM_Invalidate :Result:='LM_Invalidate';
|
||||
@ -980,6 +976,9 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.94 2004/09/13 19:06:04 micha
|
||||
convert LM_ADDPAGE and LM_REMOVEPAGE messages to new interface methods
|
||||
|
||||
Revision 1.93 2004/09/13 14:34:53 micha
|
||||
convert LM_TB_BUTTONCOUNT to interface method
|
||||
|
||||
|
@ -58,6 +58,9 @@ type
|
||||
|
||||
TWSCustomNotebook = class(TWSWinControl)
|
||||
public
|
||||
class procedure AddPage(const ANotebook: TCustomNotebook; const AChild: TCustomPage; const AIndex: integer); virtual;
|
||||
class procedure RemovePage(const ANotebook: TCustomNotebook; const AIndex: integer); virtual;
|
||||
|
||||
class function GetNotebookMinTabHeight(const AWinControl: TWinControl): integer; virtual;
|
||||
class function GetNotebookMinTabWidth(const AWinControl: TWinControl): integer; virtual;
|
||||
class procedure SetTabCaption(const ANotebook: TCustomNotebook; const AChild: TCustomPage; const AText: string); virtual;
|
||||
@ -159,6 +162,31 @@ implementation
|
||||
|
||||
{ TWSCustomNotebook }
|
||||
|
||||
{ -----------------------------------------------------------------------------
|
||||
Method: TWSCustomNotebook.AddPage
|
||||
Params: ANotebook - A notebook control
|
||||
AChild - Page to insert
|
||||
AIndex - The position in the notebook to insert the page
|
||||
Returns: Nothing
|
||||
|
||||
Adds a new page to a notebook
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TWSCustomNotebook.AddPage(const ANotebook: TCustomNotebook; const AChild: TCustomPage; const AIndex: integer);
|
||||
begin
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TWSCustomNotebook.RemovePage
|
||||
Params: ANotebook - The notebook control
|
||||
AIndex - The index of the page to delete
|
||||
Returns: Nothing
|
||||
|
||||
Removes a page from a notebook control
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TWSCustomNotebook.RemovePage(const ANotebook: TCustomNotebook; const AIndex: integer);
|
||||
begin
|
||||
end;
|
||||
|
||||
{-------------------------------------------------------------------------------
|
||||
function TWSCustomNotebook.GetNotebookMinTabHeight(
|
||||
const AWinControl: TWinControl): integer;
|
||||
@ -166,7 +194,7 @@ implementation
|
||||
Returns the minimum height of the horizontal tabs of a notebook. That is the
|
||||
Notebook with TabPosition in [tpTop,tpBottom] without the client panel.
|
||||
-------------------------------------------------------------------------------}
|
||||
function TWSCustomNotebook.GetNotebookMinTabHeight(
|
||||
function TWSCustomNotebook.GetNotebookMinTabHeight(
|
||||
const AWinControl: TWinControl): integer;
|
||||
begin
|
||||
Result:=30;
|
||||
|
Loading…
Reference in New Issue
Block a user