Course list http://www.c-jump.com/bcc/

Home work project 5: Advanced Scratch Pad App


  1. Description
  2. Things to do
  3. Optional: Advanced Features
  4. How to submit

Description



Things to do


  1. Add C++ classes for three more drawing primitives - text label, filled circle, and filled rectangle:

    
        CPrimitiveText
        CPrimitiveCircleFilled
        CPrimitiveRectangleFilled
    
    
  2. A text label is a very attractive detail on a drawing. Add "Text Label" radio button to the group of the radio buttons. Also, add a text input field where the user can enter the text. The label should be created as soon as the user selects the "Text Label" and clicks in the drawing area of the window.

    The following code will draw the text on the screen:

    
    // CDrawBox.cpp
    #include "FL/fl_draw.H"
    //...
    void CPrimitiveText::draw()
    {
        Fl_Color orig_color = fl_color(); // preserve color
        fl_color( color );                // set color
        const char* text = "Hello";       // sample text to draw
        fl_font( FL_TIMES, 18 );          // font and font size
        fl_draw( text, x1, y1 );          // display text at the specified location
        fl_color( orig_color );           // restore original color
    }
    
    
  3. The text field should be activated in "Text Label" mode and deactivated for all other types of shapes.

  4. Implement filled circle and filled rectangle shapes. Use check box to alternate between the filled and unfilled shapes. Research FLTK 1.3.2 Programming Manual for appropriate FLTK library functions to use.

     


Optional: Advanced Features



How to submit