Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Overriding Display methods too complicated due to high amount of arguments (Making Display class easier to use)
Re: Overriding Display methods too complicated due to high amount of arguments [message #55205 is a reply to message #55204] Sun, 18 October 2020 19:16 Go to previous messageGo to previous message
Oblivion is currently offline  Oblivion
Messages: 1093
Registered: August 2007
Senior Contributor
As a user, my opinion:

I personally don't find Display paint methods confusing at all.

If the existing methods are going to be deprecated, however, I would suggest passing the reference of Draw and Value in DisplayDrawContext:

struct DisplayDrawContext
{
    Draw&        draw;
    const Value& value;
    Rect         rect;
    Color        ink   = SColorText;
    Color        paper = SColorPaper;
    dword        style = 0;
    DisplayDrawContext(Drww& w, const Value& q, const Rect& r) : draw(w), value(q), rect(r) {}
};

MyDisplay().Paint(DisplayDrawContext(w, q, r));



Copying the value is not always a good idea as it can contain large stuff.


Best regards,
Oblivion


[Updated on: Sun, 18 October 2020 19:35]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to use multi-tab control?
Next Topic: Can I make round form
Goto Forum:
  


Current Time: Mon Apr 29 03:31:56 CEST 2024

Total time taken to generate the page: 0.06145 seconds