zsmith.co

Mobile

Open source

Documentation

Contact:
1 at zsmith dot co


About

TouchWidgets is my new widget library that is animation- and touch-friendly. I started TouchWidgets as a C++ project, in part because I based it partly on some of my previous C++ and C projects, but as of 0.28, TouchWidgets is an Objective C library. What that means is, I've painstakingly converted my C++ code to ObjC. It still sits on top of X Windows but eventually that too will change and I will go with OpenGL.

Features

TouchWidgets uses the Model-View-Controller paradigm, where the model is your data, the views are representations of your data and containers of data, and the controllers are code that manages views. Response to inputs is handled by both views and controllers.

The class hierarchy is as follows, using namespace TouchWidgets:

UXObject
  +----  UXView
  |       +---- UXLabel, UXButton, UXImageView, UXGraph etc.
  |       +---- UXContainer
  |               +---- UXGrid
  |               +---- UXScroll
  |                       +---- UXVerticalList
  +----  UXController
          +----  UXTabs
          +----  ExampleController

(I will probably change the UX prefix.)

Adding styles to widgets can be done programmatically or it can be done using an external style file. This second method is loosely based the idea of CSS but is far more rudimentary. A view or container object can take styles of four levels:

  • All instances
  • Class e.g. ImageView
  • Style class name e.g. screen2labels
  • Instance name e.g. label3

Screenshots from the C++ code

Tap to embiggen:

Downloads

TouchWidgets 0.28

Installation

If you're going to run TouchWidgets on a Mac, you'll need to install XQuartz.

The Makefile's install target puts libTouchWidgets.a in /usr/local/lib and the header files in /usr/local/include/TouchWidgets.

The Makefile is currently written for both GNU/Linux and OS/X. Eventually I will add an auto-configuration script.