mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 16:00:16 +02:00
gtk2 intf: TGtkWSCustomNotebook.GetTabIndexAtPos: replaced hack with slow but more generic solution
git-svn-id: trunk@9508 -
This commit is contained in:
parent
125ffee4cb
commit
30a5749d02
@ -390,25 +390,25 @@ end;
|
|||||||
end;
|
end;
|
||||||
}
|
}
|
||||||
|
|
||||||
class function TGtkWSCustomNotebook.GetTabIndexAtPos(const ANotebook: TCustomNotebook;
|
class function TGtkWSCustomNotebook.GetTabIndexAtPos(
|
||||||
const AClientPos: TPoint): integer;
|
const ANotebook: TCustomNotebook; const AClientPos: TPoint): integer;
|
||||||
var
|
var
|
||||||
NoteBookWidget: PGtkNotebook;
|
NoteBookWidget: PGtkNotebook;
|
||||||
i: integer;
|
i: integer;
|
||||||
TabWidget: PGtkWidget;
|
TabWidget: PGtkWidget;
|
||||||
PageWidget: PGtkWidget;
|
PageWidget: PGtkWidget;
|
||||||
NotebookPos: TPoint;
|
NotebookPos: TPoint;
|
||||||
PageListItem: PGList;
|
Count: guint;
|
||||||
begin
|
begin
|
||||||
Result:=-1;
|
Result:=-1;
|
||||||
NoteBookWidget:=PGtkNotebook(ANotebook.Handle);
|
NoteBookWidget:=PGtkNotebook(ANotebook.Handle);
|
||||||
if (NotebookWidget=nil) then exit;
|
if (NotebookWidget=nil) then exit;
|
||||||
|
//DebugLn(['TGtkWSCustomNotebook.GetTabIndexAtPos ',GetWidgetDebugReport(PGtkWidget(NotebookWidget))]);
|
||||||
NotebookPos:=AClientPos;
|
NotebookPos:=AClientPos;
|
||||||
// go through all tabs
|
// go through all tabs
|
||||||
i:=0;
|
Count:=g_list_length(NoteBookWidget^.Children);
|
||||||
PageListItem:=NoteBookWidget^.Children;
|
for i:=0 to Count-1 do begin
|
||||||
while PageListItem<>nil do begin
|
PageWidget:=gtk_notebook_get_nth_page(NoteBookWidget,i);
|
||||||
PageWidget:=PGtkWidget(PageListItem^.Data);
|
|
||||||
if PageWidget<>nil then begin
|
if PageWidget<>nil then begin
|
||||||
TabWidget:=gtk_notebook_get_tab_label(NoteBookWidget, PageWidget);
|
TabWidget:=gtk_notebook_get_tab_label(NoteBookWidget, PageWidget);
|
||||||
if TabWidget<>nil then begin
|
if TabWidget<>nil then begin
|
||||||
@ -423,18 +423,18 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
PageListItem:=PageListItem^.Next;
|
|
||||||
inc(i);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TGtkWSCustomNotebook.SetPageIndex(const ANotebook: TCustomNotebook; const AIndex: integer);
|
class procedure TGtkWSCustomNotebook.SetPageIndex(
|
||||||
|
const ANotebook: TCustomNotebook; const AIndex: integer);
|
||||||
begin
|
begin
|
||||||
gtk_notebook_set_page(PGtkNotebook(ANotebook.Handle), AIndex);
|
gtk_notebook_set_page(PGtkNotebook(ANotebook.Handle), AIndex);
|
||||||
UpdateNoteBookClientWidget(ANotebook);
|
UpdateNoteBookClientWidget(ANotebook);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TGtkWSCustomNotebook.SetTabPosition(const ANotebook: TCustomNotebook; const ATabPosition: TTabPosition);
|
class procedure TGtkWSCustomNotebook.SetTabPosition(
|
||||||
|
const ANotebook: TCustomNotebook; const ATabPosition: TTabPosition);
|
||||||
var
|
var
|
||||||
GtkNotebook: PGtkNotebook;
|
GtkNotebook: PGtkNotebook;
|
||||||
begin
|
begin
|
||||||
@ -447,14 +447,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TGtkWSCustomNotebook.ShowTabs(const ANotebook: TCustomNotebook; AShowTabs: boolean);
|
class procedure TGtkWSCustomNotebook.ShowTabs(const ANotebook: TCustomNotebook;
|
||||||
|
AShowTabs: boolean);
|
||||||
begin
|
begin
|
||||||
gtk_notebook_set_show_tabs(PGtkNotebook(ANotebook.Handle), AShowTabs);
|
gtk_notebook_set_show_tabs(PGtkNotebook(ANotebook.Handle), AShowTabs);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TGtkWSCustomSplitter }
|
{ TGtkWSCustomSplitter }
|
||||||
|
|
||||||
class procedure TGtkWSCustomSplitter.DrawSplitter(const ASplitter: TCustomSplitter);
|
class procedure TGtkWSCustomSplitter.DrawSplitter(
|
||||||
|
const ASplitter: TCustomSplitter);
|
||||||
var
|
var
|
||||||
Widget: PGtkWidget;
|
Widget: PGtkWidget;
|
||||||
ClientWidget: Pointer;
|
ClientWidget: Pointer;
|
||||||
|
Loading…
Reference in New Issue
Block a user