Sunday, November 11, 2007

ANNOUNCE: cwidget

I've just uploaded the first release of libcwidget to Alioth and NEW. libcwidget is a high-level C++ library for developing user interfaces that run in a terminal using curses as the display and input layer. It uses widget abstractions similar (but of course not identical) to those found in GTK+ and Qt, with signals and slots provided by libsigc++.

Background



Back when I started writing aptitude, I had one general goal:

Just because it runs in a terminal doesn't mean it has to suck.


I tried to apply this in the user interface, but I also applied it internally. The curses programs I looked at before writing aptitude all had very ad-hoc UIs. In many cases the code was structured with each "view" that appeared mapped to a custom C function call; if the author was feeling ambitious, similar-looking screens might be abstracted into a single function call, but the basic structure of the interface still reflected the call graph of the program.

aptitude had a primitive interface abstraction layer from the get-go; over the years, I borrowed ideas from GTK+ and restructured this layer into a full widget set. libcwidget is this code, disentangled from the guts of aptitude and slightly cleaned up. Because of its history, it is missing widgets that aptitude doesn't need (like a multi-line text editor), but it provides an extensible base that you can build upon.

Getting cwidget



The cwidget library is available (both as source and as an i386 .deb) from the cwidget Alioth releases page. There is also API documentation automatically generated from the upstream repository, which, while it is woefully incomplete, should provide some information: I've tried to write Doxygen tags into most of the code I've added in the last 4 years or so.

The upstream code repository is in git (because what fun is a new project if you don't learn a new VCS?) and available here. To retrieve a copy of the repository for yourself, run this command:

git clone git://git.debian.org/git/cwidget/head cwidget

14 Comments:

At 12:54 AM, Anonymous ak said...

Although a C++ developer by myself, I find your language choice the greatest disadvantage. That's why I'll stick to STFL, which doesn't only support C/C++, but also Perl, Python, Ruby and SPL.

 
At 7:36 PM, Blogger dburrows said...

I hadn't heard of STFL before, thanks for the link. I certainly am not claiming that cwidget will solve all the world's curses problems: aside from anything else, it's newly yanked out of the aptitude source code and needs some love before it's a truly general library.

At a quick glance, I think the libraries compare like this:

Features SFTL has that cwidget doesn't:

* Bindings in many languages.
* A simple description language for creating UIs.
* vbox and hbox containers (cwidget only has a finicky table container).
* ... probably more I'm not aware of.

Features cwidget has that SFTL doesn't:
* A proper top-level main loop; you don't have to structure your program as a sequence of input "screens".
* A defined threading model and support for injecting events from background threads to foreground threads.
* Support for defining your own custom widgets at the same level as the predefined widgets.
* Events are handled using signals and slots.
* Support for laying out structured and styled text.
* Support for overlapping widgets.
* Widgets for drop-down menus and hierarchical trees.
* The ability to dynamically hide and show widgets, and dynamically manipulate them in other ways (e.g., scrolling around a text view or replacing the text in it).
* It's a C++ library.


In general, it looks to me like cwidget and STFL are solving different problems. STFL aims to be a library for presenting forms on the terminal that are more complicated than you can do with dialog. This is a fine goal and frankly probably one that's useful to more people than what cwidget provides (as you pointed out). cwidget is a backend for applications that have a moderately complex UI: programs like mutt, links, emacs and mc. I think there are something like three people still writing new code for this sort of program, and two of them don't know C++, so the audience is rather limited. ;-)

If I had an infinite amount of time and nothing to do but develop cwidget, I think that it would be interesting to provide bindings to other languages and even more interesting to have a UI description language. But since I have a finite and limited amount of time, I think I'll worry about making the documentation not suck first and plugging the gaping holes in the set of standard widgets that it provides. :-)

 
At 4:26 PM, Blogger Łukasz Bartnik said...

Hi! Now this is really something! I wanted to write sth like this a few years ago but didn't have the time and still lacked the knowledge about UIs. I think your work is more than welcome - there are people still using console apps instead of those fancy GTK/Qt ones ;) I hope to look into your code as soon as I have some spare time. Thanks again!

 
At 12:47 AM, Blogger Coach Factory said...

kate spade handbags, prada outlet, nike air max, louis vuitton, nike air max, louis vuitton outlet online, burberry outlet online, burberry outlet online, tiffany and co jewelry, michael kors outlet, gucci handbags, tory burch outlet, louis vuitton outlet, chanel handbags, jordan shoes, longchamp outlet online, nike shoes, louboutin shoes, red bottom shoes, coach outlet store online, kate spade outlet online, polo ralph lauren outlet, oakley vault, coach outlet, prada handbags, coach purses, louis vuitton handbags, longchamp handbags, christian louboutin outlet, oakley sunglasses, cheap oakley sunglasses, michael kors outlet online, michael kors outlet online, louis vuitton outlet, polo ralph lauren, christian louboutin shoes, michael kors outlet online, ray ban outlet, nike free, longchamp outlet, michael kors outlet store, michael kors outlet online, coach outlet, true religion, ray ban sunglasses

 
At 12:47 AM, Blogger Coach Factory said...

abercrombie and fitch, longchamp pas cher, north face, vans pas cher, nike free, nike air max, longchamp, tn pas cher, hollister, air max pas cher, michael kors canada, chaussure louboutin, oakley pas cher, sac vanessa bruno, ray ban uk, louis vuitton uk, hollister, new balance pas cher, lululemon, nike free pas cher, north face pas cher, scarpe hogan, nike trainers, air max, nike roshe, ralph lauren pas cher, barbour, nike huarache, burberry pas cher, guess pas cher, nike air max, true religion outlet, longchamp, lacoste pas cher, sac michael kors, ralph lauren, louis vuitton pas cher, michael kors uk, nike blazer pas cher, mulberry, nike air force, air jordan, hermes pas cher, louis vuitton, nike roshe run, timberland, sac louis vuitton, ray ban pas cher, converse pas cher, true religion outlet

 
At 12:48 AM, Blogger Coach Factory said...

herve leger, soccer jerseys, uggs outlet, jimmy choo shoes, lululemon outlet, nfl jerseys, canada goose pas cher, vans outlet, soccer shoes, roshe run, valentino shoes, moncler, rolex watches, chi flat iron, uggs on sale, canada goose, north face outlet, ghd, new balance outlet, north face jackets, mcm handbags, ugg soldes, moncler, canada goose uk, mont blanc pens, beats headphones, canada goose outlet, celine handbags, instyler ionic styler, ferragamo shoes, ugg boots, bottega veneta, ugg, moncler outlet, abercrombie and fitch, ugg outlet, wedding dresses, mac cosmetics, birkin bag, reebok outlet, canada goose outlet, insanity workout, moncler, giuseppe zanotti, asics shoes, hollister, canada goose outlet, babyliss pro, marc jacobs outlet, p90x workout

 
At 8:02 PM, Blogger 风骚达哥 said...

20151014 junda
Louis Vuitton Handbags Factory Store
Louis Vuitton Bags On Sale
Louis Vuitton Bags Outlet Store
cheap ugg boots
louis vuitton outlet
Michael Kors Outlet Real Handbags Online
ugg boots
Air Jordan 3 III Retro Free Shipping
louis vuitton outlet
celine
Christian Louis Vuitton Red Bottoms
coach factory outlet
ray ban sunglasses uk
Ugg Boots,Ugg Boots Outlet,Ugg Outlet,Cheap Uggs,Uggs On Sale,Ugg Boots Clearance,Uggs For Women
Coach Outlet Store Online Handbags Clearance
canada goose outlet
ugg boots outlet
Abercrombie And Fitch Kids Online
true religion outlet
cheap jordan shoes
New Louis Vuitton Handbags Outlet
cheap uggs
nfl jerseys
canada goose jackets
Abercrombie and Fitch Outlet Sale
louis vuitton outlet
canada goose outlet
uggs australia
michael kors outlet stores
Coach Factory Outlet Online Sale

 
At 8:15 PM, Blogger oakleyses said...

uggs outlet, uggs on sale, ray ban sunglasses, ray ban sunglasses, louis vuitton, michael kors outlet online, oakley sunglasses wholesale, christian louboutin outlet, louis vuitton, uggs outlet, louis vuitton outlet, polo outlet, prada handbags, nike free, chanel handbags, longchamp outlet, michael kors outlet, replica watches, louis vuitton outlet, oakley sunglasses, michael kors outlet online, prada outlet, michael kors outlet online, longchamp outlet, burberry handbags, michael kors outlet, kate spade outlet, ray ban sunglasses, longchamp outlet, louis vuitton outlet, oakley sunglasses, nike air max, oakley sunglasses, replica watches, ugg boots, polo ralph lauren outlet online, ugg boots, gucci handbags, jordan shoes, cheap oakley sunglasses, michael kors outlet online, christian louboutin uk, burberry outlet, tory burch outlet, tiffany and co, christian louboutin shoes

 
At 8:17 PM, Blogger oakleyses said...

uggs outlet, uggs on sale, ray ban sunglasses, ray ban sunglasses, louis vuitton, michael kors outlet online, oakley sunglasses wholesale, christian louboutin outlet, louis vuitton, uggs outlet, louis vuitton outlet, polo outlet, prada handbags, nike free, chanel handbags, longchamp outlet, michael kors outlet, replica watches, louis vuitton outlet, oakley sunglasses, michael kors outlet online, prada outlet, michael kors outlet online, longchamp outlet, burberry handbags, michael kors outlet, kate spade outlet, ray ban sunglasses, longchamp outlet, louis vuitton outlet, oakley sunglasses, nike air max, oakley sunglasses, replica watches, ugg boots, polo ralph lauren outlet online, ugg boots, gucci handbags, jordan shoes, cheap oakley sunglasses, michael kors outlet online, christian louboutin uk, burberry outlet, tory burch outlet, tiffany and co, christian louboutin shoes

 
At 8:19 PM, Blogger oakleyses said...

beats by dre, nfl jerseys, nike trainers uk, mcm handbags, lululemon, reebok outlet, valentino shoes, wedding dresses, nike roshe run, celine handbags, ghd hair, ferragamo shoes, mont blanc pens, louboutin, giuseppe zanotti outlet, new balance shoes, timberland boots, oakley, soccer shoes, nike air max, iphone 5s cases, nike huaraches, iphone 6 plus cases, herve leger, iphone 6s plus cases, p90x workout, babyliss, vans outlet, north face outlet, iphone cases, jimmy choo outlet, iphone 6 cases, s6 case, abercrombie and fitch, bottega veneta, north face outlet, hermes belt, longchamp uk, ralph lauren, chi flat iron, insanity workout, iphone 6s cases, ipad cases, baseball bats, mac cosmetics, instyler, hollister, soccer jerseys, asics running shoes, hollister clothing

 
At 8:21 PM, Blogger oakleyses said...

doudoune moncler, pandora uk, moncler outlet, vans, converse outlet, montre pas cher, louis vuitton, moncler, moncler, canada goose, canada goose outlet, ugg uk, links of london, barbour uk, supra shoes, replica watches, lancel, nike air max, moncler, moncler, moncler outlet, coach outlet, wedding dresses, canada goose outlet, pandora jewelry, karen millen uk, ugg, marc jacobs, juicy couture outlet, converse, moncler uk, louis vuitton, ugg pas cher, swarovski, pandora jewelry, gucci, canada goose, canada goose uk, ugg,uggs,uggs canada, pandora charms, juicy couture outlet, louis vuitton, louis vuitton, ray ban, ugg,ugg australia,ugg italia, canada goose jackets, swarovski crystal, canada goose, hollister, thomas sabo, canada goose outlet, toms shoes

 
At 8:23 PM, Blogger oakleyses said...

michael kors, nike tn, ralph lauren uk, abercrombie and fitch uk, north face uk, ray ban pas cher, nike free uk, lululemon canada, michael kors, true religion jeans, coach outlet, coach outlet store online, hollister uk, sac longchamp pas cher, vans pas cher, nike blazer pas cher, louboutin pas cher, nike air max uk, michael kors pas cher, nike free run, nike air max uk, new balance, sac hermes, jordan pas cher, true religion outlet, replica handbags, nike roshe, longchamp pas cher, guess pas cher, true religion outlet, north face, polo ralph lauren, coach purses, hollister pas cher, oakley pas cher, timberland pas cher, air max, polo lacoste, nike air force, nike roshe run uk, burberry pas cher, converse pas cher, nike air max, sac vanessa bruno, mulberry uk, hogan outlet, michael kors outlet, true religion outlet, ray ban uk, kate spade

 
At 2:25 AM, Blogger dong dong23 said...

air max 90
ray ban sunglasses
michael kors handbags
fitflops sale clearance
jordans
ray bans
nike outlet store
louis vuitton outlet
louis vuitton outlet
michael kors handbags
basketball shoes
ralph lauren sale
oakley sunglasses
michael kors outlet
hollister clothing
replica watches for sale
michael kors bags
nike roshe flyknit
true religion outlet
kate spade
replica watches
adidas shoes
air max 90
cheap nfl jerseys
michael kors outlet online
adidas stan smith
jordans for sale
louis vuitton handbags
nike air max
jordans
adidas superstar
nike roshe runs
louis vuitton handbags
nfl jerseys wholesale
nike uk
louis vuitton outlet
coach outlet
air jordan 13
fitflops sale clearance
michael kors uk
20166.3wengdongdong

 
At 7:00 AM, Blogger roba. gad3 said...


Very nice post. I definitely appreciate this site. Stick with it!
http://www.kuwait.prokr.net/
http://www.emirates.prokr.net/

 

Post a Comment

<< Home