libui.cr icon indicating copy to clipboard operation
libui.cr copied to clipboard

OOP approach to libui.cr?

Open hanyuone opened this issue 7 years ago • 12 comments

Is it a good idea to create objects for each of the "types" in LibUI, to make it easier for a Crystal programmer to use, as opposed to a "functional" style in the Crystal port of controlgallery?

hanyuone avatar Aug 18 '17 11:08 hanyuone

@Fusion?

hanyuone avatar Aug 21 '17 01:08 hanyuone

Hello there. I found your port and your work great. However I think what Qwerp-Derp suggested to be considerated, OO will make our life to be simplified. As an instance, I am trying to use the lib using an OO approach and I am finding myself in trouble. I'll create a new post to open as an issue, there is the possibility, however, that the problem it's not even related with your bindings, but with Crystal itself. Anyways please don't stop your work, it's awesome! And please, please, please consider OO! Thank You!

felipetesc avatar Dec 11 '17 20:12 felipetesc

FWIW the maintainer of this repo doesn't seem to have been on GitHub since mid October (opening one issue for Mailspring) and before that since late June. The website linked hasn't been updated in ages, and many of the projects mentioned are now down. I wouldn't expect anything to come out of this repo anytime soon...

refi64 avatar Dec 11 '17 21:12 refi64

@kirbyfan64 Should I start a new repository for LibUI?

hanyuone avatar Dec 12 '17 03:12 hanyuone

Hi, guys.

@Qwerp-Derp and @felipetesc : if you look at this example (https://github.com/Fusion/libui.cr/blob/master/src/examples/objgallery/objgallery.cr) is this not what you are looking for?

@kirbyfan64 : While I understand your concern, please keep in mind that the upstream project's last release is 18 months old and its master branch has been frozen for a year. I will gladly resume work when there is something new to work with 😉

Fusion avatar Dec 12 '17 03:12 Fusion

Well, I wasn't really complaining or anything, but you have to admit it had kind of looked a bit deserted...

refi64 avatar Dec 12 '17 03:12 refi64

No problem. Actually, I wish the upstream project was active, especially now that there is a hope of Crystal being supported on Windows.

Fusion avatar Dec 12 '17 05:12 Fusion

@Fusion That's not really what I'm looking for here - the code just looks like a bunch of calls to C functions. There's hardly objects there, except for the main OBJGallery class. When you want to create a new window, instead of doing maybe UI::Window.new, you have to do UI.new_window, and to modify that window you have to do UI.window_set_margined instead of something like Window#set_margined. Same with UI.new_vertical_box, UI.new_horizontal_box, etc.

Overall, my problem with this library is that it doesn't feel like an OOP, Crystal library, it just feels like a thin wrapper around LibUI. Just my 2c.

hanyuone avatar Dec 12 '17 05:12 hanyuone

@Fusion Also, do you mean "upstream project" as in the master branch? Because I can see a lot of work being done in utflib-and-attrstr, as it's where andlabs is focused on currently.

hanyuone avatar Dec 12 '17 05:12 hanyuone

@Qwerp-Derp Yes, lots of rework under the hood in that branch, but nothing new interface-wise. I believe that, when that branch is complete, work on widget interfaces will resume but until then, there isn't much to do.

Fusion avatar Dec 12 '17 06:12 Fusion

Also, it's been so long that I forgot that I had given up in the OO approach early on, to focus on the YAML approach instead. Have you looked into it?

Fusion avatar Dec 12 '17 06:12 Fusion

@Fusion I have looked into it a little bit, but the syntax is a little overwhelming for me. Still, though, wouldn't an OOP approach still be beneficial for the user, when creating a Crystal app using libui.cr, and yourself, when implementing the YAML system?

hanyuone avatar Dec 12 '17 10:12 hanyuone