FLTK logo

Re: [fltk/fltk] possible incoherence in Fl_Tree_Item drawing (Issue #298)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.issues  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: [fltk/fltk] possible incoherence in Fl_Tree_Item drawing (Issue #298) erco77 Nov 27, 2021  
 

I can't answer to rust implications (don't know anything about it), but I'm guessing that's not an issue.

The purpose of the returned xmax is not used to determine where the widget is drawn (that position is determined by the label_x() + label_w()), which I think is what you're assuming.

The purpose of the returned xmax is used to calculate the horizontal scrollbar's width (as described in the docs for draw_item_content()) which is based on the widest item in the entire tree.

When a widget is assigned to the item, it appears to the right of the item, its position determined by label_x() + label_w(), and therefore when it's drawn, its xmax always overrides the item's xmax, because it will be drawn to the right of the item.

If you override draw_item_content(), you're supposed to draw within the xywh of the label_x()/label_y()/label_w()/label_h() dimensions, as shown in the example code, and return the xmax of your actually drawn content, in case it's less than the label's width. This helps the horizontal scrollbar be as precise as possible when the item is the right-most content being drawn. But that's not the case when a widget is assigned, as the widget becomes the right-most content.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.