andlabs / libui

Simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports.
Other
10.72k stars 614 forks source link

Fix table row inserted/deleted documentation and windows implementation. #515

Open szanni opened 4 years ago

szanni commented 4 years ago

As I failed to understand the documentation of both uiTableModelRowInserted() and uiTableModelRowDeleted() on when to insert to/delete from the underlying model and when to in/decrease the NumRows() counter - I decided to do some digging.

As it stands the current implementation does not seem to be so sure itself. The windows code is completely broken. The TODOs regarding API clarification and compatability with unix and darwin were never implemented. This patch set fixes all that.

Strictly API wise speaking only gtk seems to require data insertion into the model before calling uiTableModelRowInserted(). With this patch set no implementation actually relies on the value in NumRows(). But my reasoning is that both functions are past tense. The operation has already been performed and hence the state of the model should represent that. Otherwise I would consider the function names to be buggy.

Oh and I used the win32 provided macros instead of the SendMessageW((CastARoo*))((FUNCTIONS))