It is currently Wed Jun 20, 2018 10:34 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: PanelGadget Tabs too width on GTK3
PostPosted: Thu Jul 07, 2016 4:36 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Dec 03, 2011 5:54 pm
Posts: 727
Location: Oldenburg (Germany)
Hi,

the width of the PanelGadget tabs is too large. It seems that there is left space for a probably displayed icon. It just occurs with GTK3, GTK2 instead looks as expected. I know that this depends on the used theme, but the GTK3 theme is standard and if i create a similar widget with Glade Interface Designer, the space left of the text is exactly the same as on the right.

GTK3:
Image

GTK2:
Image

Regards
Uwe

_________________
PB 5.62 - Antergos Linux 64-Bit, Wayland Display Server


Top
 Profile  
Reply with quote  
 Post subject: Re: PanelGadget Tabs too width on GTK3
PostPosted: Fri Nov 03, 2017 10:16 am 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13304
Location: France
I don't think it's a PB issue as we use the standard API to create and render tabs.


Top
 Profile  
Reply with quote  
 Post subject: Re: PanelGadget Tabs too width on GTK3
PostPosted: Fri Nov 03, 2017 2:37 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Jun 26, 2014 9:17 am
Posts: 281
Location: Germany
Hello, Fred,
under gtk3 an image placeholder (invisible image) is indeed placed on the left side of the tabs. I don't know if this is done by PureBasic or the API.
I think this workaround shows the problem (you can set the Image size to' 0' or delete the image) then the text is centered.
Code:
ImportC ""
   gtk_image_set_pixel_size(*image.GtkImage, pixel_size)
EndImport

; Object constants
#Win_Main= 0

#Panel1  = 0

Global.i gEvent, gQuit
Global.i gI


Procedure PanelTab_RemoveImgSpacer(Gadget)
   Protected   *notebook.GtkNotebook= GadgetID(Gadget)
   Protected   *Widget.GtkWidget, *gHBox.GtkHBox
   Protected   *gList.GList
   Protected.i I, O
   Protected.i Tabs= gtk_notebook_get_n_pages_(GadgetID(Gadget))
   
   For I= 0 To Tabs- 1
      *Widget= gtk_notebook_get_nth_page_(*notebook, I);               panel widget
      *gHBox= gtk_notebook_get_tab_label_(*notebook, *Widget);         hbox from tab for panel
      If *gHBox
         *gList= gtk_container_get_children_(*gHBox)
         For O= 1 To g_list_length_(*gList)
            If PeekS(gtk_widget_get_name_(g_list_nth_data_(*gList, O-1)), -1, #PB_UTF8) = "GtkImage"
            ;set size to '0' ...
               ;gtk_image_set_pixel_size(g_list_nth_data_(*gList, O-1), 0)
            ;OR remove image ...
               gtk_container_remove_(*gHBox, g_list_nth_data_(*gList, O-1)); replace placeholder image
            EndIf
         Next O
         g_list_free_(*gList)
      EndIf
   Next I
EndProcedure

If OpenWindow(#Win_Main, 300, 200, 400, 310, "PanelGadget: gtk3 empty-tab-image fix", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
   PanelGadget(#Panel1, 0, 30, 400, 270)
   For gI= 0 To 3
      AddGadgetItem(#Panel1, -1, " Tab "+Str(gI))
      TextGadget(#PB_Any, 5, 5, 200, 20, "Panel " + Str(gI))
   Next gI
   
   ;comment out the next line to see default behaviour ...
   PanelTab_RemoveImgSpacer(#Panel1)
   
   Repeat
      gEvent= WaitWindowEvent()
      
      Select gEvent
         Case #PB_Event_CloseWindow
            gQuit= #True
      EndSelect
      
   Until gQuit
   
EndIf
Regards, Charly

_________________
PureBasic 5.3-5.5, Linux: (X/L/K)Ubuntus+Mint - Windows XP (32Bit)
PureBasic Linux-API-Library & Viewer: http://www.chabba.de


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye