Adding Animated Buttons and Circular Sliders

Animated buttons are customized push buttons. For example there is a play animated button, which has a play button graphic on it. Use the IAnimatedButton class to create and manage the animated buttons. You can use a set of predefined bitmaps as graphics on the animated button (such as fast-forward or stop). The event handling for animated buttons is the same as with push buttons.

See the wave player example for an example of animated buttons. The rewind, stop, pause, play, fast-forward, and record buttons are all examples of animated buttons.


Use circular sliders for functions that a user can manipulate, such as volume and balance. You probably know how a linear slider works. A circular slider provides the same function; however, physically it looks different because it is circular. Like the dials found on your home electronics, its slider arm is shown as a radius of the dial. Outside the perimeter of the dial is a circular scale with tick marks representing incremental values the slider arm can point to. Its value can be tracked by pointing to any area on the dial and pressing the select button while moving the mouse on the desktop.

Because of its shape, the circular slider takes up less space than a linear slider and gives you more flexibility in designing a panel that has multiple controls.

An example of a creating a circular slider follows:


#include 
#include 
#include 
#include 

#include 
#include 
class SliderArmHandler : public ISliderArmHandler
{
   public:
      SliderArmHandler();
};

/**************************************************************/
/*                                                            */
/* main() program entry point                                 */
/*                                                            */
/**************************************************************/
int main()
 {
  ICoordinateSystem::setApplicationOrientation(
                ICoordinateSystem::kOriginLowerLeft);
  IFrameWindow mainWindow ("Circular Slider Example",0x1000);   // Create the frame window 

  IWindow * pParent = &mainWindow;
  IWindow * pOwner = &mainWindow;

 ICircularSlider slider(0x8008,        // Create the slider control 
                        pParent,
                        pOwner,
                        IRectangle(),

   ICircularSlider::defaultStyle()
   |  ICircularSlider::proportionalTicks);

   slider.setArmRange(IRange(0,100));  // Customize the circular slider 
   slider.setRotationIncrement(1);
   slider.setText("Volume");

   SliderArmHandler *shslider = new SliderArmHandler;
   shslider->handleEventsFor(&slider);

   mainWindow.setClient(&slider);      // Attach a handler to the control 
   mainWindow.sizeTo(ISize(400,300));
   mainWindow.show();
   mainWindow.setFocus();
   IApplication::current().run();

   return 0;
} /* end main */

SliderArmHandler::SliderArmHandler()
   :ISliderArmHandler()
{}

The following figure shows a slider example. Note that its value is currently shown by both the detents and the number displayed on the dial.



Multimedia Devices


Creating Master Devices
Playing Audio Compact Discs
Creating Audio Devices
Creating Video Devices


IAnimatedButton
IApplication
ICircularSlider
IFrameWindow
IMultiCellCanvas
ISliderArmHandler
IStaticText