diff --git a/lcl/include/customnotebook.inc b/lcl/include/customnotebook.inc index f3dc1fa110..dbe8c588d4 100644 --- a/lcl/include/customnotebook.inc +++ b/lcl/include/customnotebook.inc @@ -750,17 +750,12 @@ end; procedure TCustomNotebook.DoSendShowTabs; ------------------------------------------------------------------------------} procedure TCustomNotebook.DoSendShowTabs; -var - Msg: TLMNotebookEvent; begin if not HandleAllocated or (csLoading in ComponentState) then exit; - Msg.Parent := Self; - Msg.fCompStyle := fCompStyle; - Msg.ShowTabs := fShowTabs; {$IFDEF NOTEBOOK_DEBUG} DebugLn('[TCustomNotebook.DoSendShowTabs] A ',Name); {$ENDIF} - CNSendMessage(LM_SHOWTABS, Self, @Msg); + TWSCustomNotebookClass(WidgetSetClass).ShowTabs(Self, FShowTabs); {$IFDEF NOTEBOOK_DEBUG} DebugLn('[TCustomNotebook.DoSendShowTabs] B ',Name); {$ENDIF} @@ -808,6 +803,9 @@ end;} { ============================================================================= $Log$ + Revision 1.57 2004/09/13 19:57:30 micha + convert LM_SHOWTABS message to interface method + Revision 1.56 2004/09/13 19:06:04 micha convert LM_ADDPAGE and LM_REMOVEPAGE messages to new interface methods diff --git a/lcl/interfaces/gtk/gtkobject.inc b/lcl/interfaces/gtk/gtkobject.inc index 5a13cd5322..5cbb3f3740 100644 --- a/lcl/interfaces/gtk/gtkobject.inc +++ b/lcl/interfaces/gtk/gtkobject.inc @@ -3140,12 +3140,6 @@ begin TLMNotebookEvent(Data^).Page); end; - LM_ShowTabs : - begin - gtk_notebook_set_show_tabs(PGtkNotebook(Handle), - Boolean(Integer(TLMNotebookEvent(Data^).ShowTabs))); - end; - LM_SetTabPosition : begin case TTabPosition(TLMNotebookEvent(Data^).TabPosition^) of @@ -8315,6 +8309,9 @@ end; { ============================================================================= $Log$ + Revision 1.563 2004/09/13 19:57:30 micha + convert LM_SHOWTABS message to interface method + Revision 1.562 2004/09/13 19:06:04 micha convert LM_ADDPAGE and LM_REMOVEPAGE messages to new interface methods diff --git a/lcl/interfaces/gtk/gtkwsextctrls.pp b/lcl/interfaces/gtk/gtkwsextctrls.pp index d263785ace..fa8938cd59 100644 --- a/lcl/interfaces/gtk/gtkwsextctrls.pp +++ b/lcl/interfaces/gtk/gtkwsextctrls.pp @@ -57,6 +57,7 @@ type class function GetNotebookMinTabHeight(const AWinControl: TWinControl): integer; override; class function GetNotebookMinTabWidth(const AWinControl: TWinControl): integer; override; + class procedure ShowTabs(const ANotebook: TCustomNotebook; AShowTabs: boolean); override; end; { TGtkWSPage } @@ -349,6 +350,11 @@ begin Result:=inherited GetNotebookMinTabWidth(AWinControl); end; +procedure TGtkWSCustomNotebook.ShowTabs(const ANotebook: TCustomNotebook; AShowTabs: boolean); +begin + gtk_notebook_set_show_tabs(PGtkNotebook(ANotebook.Handle), AShowTabs); +end; + initialization //////////////////////////////////////////////////// diff --git a/lcl/interfaces/win32/win32int.pp b/lcl/interfaces/win32/win32int.pp index dc0693429e..83286e1bf8 100644 --- a/lcl/interfaces/win32/win32int.pp +++ b/lcl/interfaces/win32/win32int.pp @@ -135,8 +135,6 @@ Type Procedure ReDraw(Child: TObject); procedure ChangeActivePage(const Data: TLMNotebookEvent); - procedure AddAllNBPages(Notebook: TCustomNotebook); - procedure RemoveAllNBPages(Notebook: TCustomNotebook); Procedure SetText(Window: HWND; Data: Pointer); Function GetValue (Sender: TObject; Data: Pointer): Integer; Function SetValue (Sender: TObject; Data: Pointer): Integer; @@ -280,6 +278,9 @@ End. { ============================================================================= $Log$ + Revision 1.110 2004/09/13 19:57:30 micha + convert LM_SHOWTABS message to interface method + Revision 1.109 2004/09/13 19:06:04 micha convert LM_ADDPAGE and LM_REMOVEPAGE messages to new interface methods diff --git a/lcl/interfaces/win32/win32object.inc b/lcl/interfaces/win32/win32object.inc index 771fee593d..0dc372751c 100644 --- a/lcl/interfaces/win32/win32object.inc +++ b/lcl/interfaces/win32/win32object.inc @@ -352,16 +352,6 @@ Begin InvalidateRect(TCustomSpeedButton(Sender).Parent.Handle, @SizeRect, True); End; End; - LM_SHOWTABS: - Begin - Result := Ord(True); - if TLMNotebookEvent(Data^).ShowTabs then - begin - AddAllNBPages(Sender as TCustomNotebook); - end else begin - RemoveAllNBPages(Sender as TCustomNotebook); - end; - End; LM_SETTABPOSITION : Begin // VS: not tested @@ -1937,57 +1927,6 @@ Begin End; End; -{ ----------------------------------------------------------------------------- - Method: TWin32WidgetSet.AddAllNBPages - Params: Notebook - A notebook control - Returns: Nothing - - Adds all pages to notebook (showtabs becomes true) - ------------------------------------------------------------------------------} -procedure TWin32WidgetSet.AddAllNBPages(Notebook: TCustomNotebook); -var - TCI: TC_ITEM; - I, Res: Integer; - lPage: TCustomPage; -begin - for I := 0 to Notebook.PageCount - 1 do - begin - lPage := Notebook.Page[I]; - // check if already shown - TCI.Mask := TCIF_PARAM; - Res := Windows.SendMessage(Notebook.Handle, TCM_GETITEM, I, LPARAM(@TCI)); - if (Res = 0) or (dword(TCI.lParam) <> lPage.Handle) then - begin - TCI.Mask := TCIF_TEXT or TCIF_PARAM; - TCI.pszText := PChar(lPage.Caption); - TCI.lParam := lPage.Handle; - Windows.SendMessage(Notebook.Handle, TCM_INSERTITEM, I, LPARAM(@TCI)); - end; - end; -end; - -{------------------------------------------------------------------------------ - Method: TWin32WidgetSet.RemoveAllNBPages - Params: Notebook - The notebook control - Returns: Nothing - - Removes all pages from a notebook control (showtabs becomes false) - ------------------------------------------------------------------------------} -procedure TWin32WidgetSet.RemoveAllNBPages(Notebook: TCustomNotebook); -var - I: Integer; - R: TRect; -begin - for I := Notebook.PageCount - 1 downto 0 do - 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; - R.Bottom := R.Bottom - R.Top; - for I := 0 to Notebook.PageCount - 1 do - ResizeChild(Notebook.Page[I], R.Left, R.Top, R.Right, R.Bottom); -end; - {------------------------------------------------------------------------------ Method: TWin32WidgetSet.ChangeActivePage Params: Data - The notebook setitemindex message @@ -2397,6 +2336,9 @@ End; { $Log$ + Revision 1.255 2004/09/13 19:57:30 micha + convert LM_SHOWTABS message to interface method + Revision 1.254 2004/09/13 19:06:04 micha convert LM_ADDPAGE and LM_REMOVEPAGE messages to new interface methods diff --git a/lcl/interfaces/win32/win32wsextctrls.pp b/lcl/interfaces/win32/win32wsextctrls.pp index 85a61d25ad..1d578af553 100644 --- a/lcl/interfaces/win32/win32wsextctrls.pp +++ b/lcl/interfaces/win32/win32wsextctrls.pp @@ -55,6 +55,7 @@ type 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 procedure ShowTabs(const ANotebook: TCustomNotebook; AShowTabs: boolean); override; end; { TWin32WSPage } @@ -204,6 +205,59 @@ type implementation +{ ----------------------------------------------------------------------------- + Method: AddAllNBPages + Params: Notebook - A notebook control + Returns: Nothing + + Adds all pages to notebook (showtabs becomes true) + ------------------------------------------------------------------------------} +procedure AddAllNBPages(Notebook: TCustomNotebook); +var + TCI: TC_ITEM; + I, Res: Integer; + lPage: TCustomPage; +begin + for I := 0 to Notebook.PageCount - 1 do + begin + lPage := Notebook.Page[I]; + // check if already shown + TCI.Mask := TCIF_PARAM; + Res := Windows.SendMessage(Notebook.Handle, TCM_GETITEM, I, LPARAM(@TCI)); + if (Res = 0) or (dword(TCI.lParam) <> lPage.Handle) then + begin + TCI.Mask := TCIF_TEXT or TCIF_PARAM; + TCI.pszText := PChar(lPage.Caption); + TCI.lParam := lPage.Handle; + Windows.SendMessage(Notebook.Handle, TCM_INSERTITEM, I, LPARAM(@TCI)); + end; + end; +end; + +{------------------------------------------------------------------------------ + Method: RemoveAllNBPages + Params: Notebook - The notebook control + Returns: Nothing + + Removes all pages from a notebook control (showtabs becomes false) + ------------------------------------------------------------------------------} +procedure RemoveAllNBPages(Notebook: TCustomNotebook); +var + I: Integer; + R: TRect; +begin + for I := Notebook.PageCount - 1 downto 0 do + 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 + TWin32WidgetSet(InterfaceObject).GetClientRect(Notebook.Handle, R); + R.Right := R.Right - R.Left; + R.Bottom := R.Bottom - R.Top; + for I := 0 to Notebook.PageCount - 1 do + TWin32WidgetSet(InterfaceObject).ResizeChild(Notebook.Page[I], R.Left, R.Top, R.Right, R.Bottom); +end; + +{ TWin32WSCustomNotebook } + procedure TWin32WSCustomNotebook.AddPage(const ANotebook: TCustomNotebook; const AChild: TCustomPage; const AIndex: integer); var @@ -237,6 +291,16 @@ begin Windows.SendMessage(ANotebook.Handle, TCM_DELETEITEM, Windows.WPARAM(AIndex), 0); end; +procedure TWin32WSCustomNotebook.ShowTabs(const ANotebook: TCustomNotebook; AShowTabs: boolean); +begin + if AShowTabs then + begin + AddAllNBPages(ANotebook); + end else begin + RemoveAllNBPages(ANotebook); + end; +end; + initialization //////////////////////////////////////////////////// diff --git a/lcl/lmessages.pp b/lcl/lmessages.pp index f4247a1d3f..26c0c67148 100644 --- a/lcl/lmessages.pp +++ b/lcl/lmessages.pp @@ -57,7 +57,6 @@ const LM_GetLineCount = LM_ComUser+16; LM_CANVASCREATE = LM_ComUser+19; LM_ReDraw = LM_ComUser+26; - LM_ShowTabs = LM_ComUser+29; LM_SetTabPosition = LM_ComUser+30; LM_Invalidate = LM_ComUser+32; @@ -659,7 +658,6 @@ type fCompStyle: Integer; Str: String; Page: Integer; - ShowTabs: Boolean; TabPosition: Pointer; end; @@ -834,7 +832,6 @@ begin LM_GetLineCount :Result:='LM_GetLineCount'; LM_CANVASCREATE :Result:='LM_CANVASCREATE'; LM_ReDraw :Result:='LM_ReDraw'; - LM_ShowTabs :Result:='LM_ShowTabs'; LM_SetTabPosition :Result:='LM_SetTabPosition'; LM_Invalidate :Result:='LM_Invalidate'; @@ -976,6 +973,9 @@ end. { $Log$ + Revision 1.95 2004/09/13 19:57:30 micha + convert LM_SHOWTABS message to interface method + Revision 1.94 2004/09/13 19:06:04 micha convert LM_ADDPAGE and LM_REMOVEPAGE messages to new interface methods diff --git a/lcl/widgetset/wsextctrls.pp b/lcl/widgetset/wsextctrls.pp index 90eb3a1a7e..2c6f5091eb 100644 --- a/lcl/widgetset/wsextctrls.pp +++ b/lcl/widgetset/wsextctrls.pp @@ -64,6 +64,7 @@ type 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; + class procedure ShowTabs(const ANotebook: TCustomNotebook; AShowTabs: boolean); virtual; end; TWSCustomNotebookClass = class of TWSCustomNotebook; @@ -218,6 +219,10 @@ procedure TWSCustomNotebook.SetTabCaption(const ANotebook: TCustomNotebook; begin end; +procedure TWSCustomNotebook.ShowTabs(const ANotebook: TCustomNotebook; AShowTabs: boolean); +begin +end; + initialization ////////////////////////////////////////////////////