Ignore:
Timestamp:
May 15, 2001, 6:15:18 PM (24 years ago)
Author:
umoeller
Message:

Lotsa fixes from the last two weeks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/helpers/comctl.h

    r65 r68  
    102102    {
    103103        USHORT          usStartAngle,
    104                             // angle to start with (0%).
     104                            // for "pie chart" mode, angle to start with (0%).
    105105                            // This must be in the range of 0 to 360 degrees,
    106106                            // with 0 degrees being the rightmost point
    107107                            // of the arc.
     108
    108109                            // All degree values are counter-clockwise from that point.
    109110                            // Example: 90 will start the arc at the top.
     111
     112                            //                   90ø
     113                            //                 +++++++
     114                            //              +           +
     115                            //            +               +
     116                            //           +                 +
     117                            //          +                   +
     118                            //          +                   +
     119                            //   180ø   +         X         +     0ø
     120                            //          +                   +
     121                            //          +                   +
     122                            //           +                 +
     123                            //            +               +
     124                            //              +           +
     125                            //                 +++++++
     126                            //                   270ø
     127
    110128                        usSweepAngle;
    111                             // the maximum angle to use for 100%.
     129                            // the maximum angle to use for 100%, in addition to
     130                            // usStartAngle.
    112131                            // This must be in the range of 0 to 360 degrees,
    113132                            // with 0 degrees being usStartAngle.
    114133                            // All degree values are counter-clockwise from that point.
    115                             // Example 1: usStartAngle = 0 and usSweepAngle = 360
    116                             // will draw a full circle from the right.
    117                             // Example 2: usStartAngle = 180 and usSweepAngle = 270
    118                             // will draw a three-quarter angle from the left.
     134                            // Example: Specify usStartAngle = 180 (1) to start the pie
     135                            // at the left and usSweepAngle = 270 (2) to draw a
     136                            // three-quarter total pie.
     137
     138                            //                   90ø
     139                            //                    ++++
     140                            //                    +   _ +
     141                            //                    +  |\   +
     142                            //                    +    \   +
     143                            //                    +     \   +
     144                            //                    +     |   +
     145                            // (1) 180ø +++++++++++     |   +     0ø
     146                            //          +              /    +
     147                            //          +    \       (2)    +
     148                            //           +    \      /     +
     149                            //            +    ------     +
     150                            //              +           +
     151                            //                 +++++++
     152                            //                   270ø
     153
    119154        ULONG           cValues;
    120155                            // data item count; the arrays in *padValues and *palColors
     
    124159                            // pointer to an array of double values;
    125160                            // the sum of all these will make up 100%
    126                             // in the chart (i.e. the usSweepAngle angle).
    127                             // If this is NULL, the chart displays nothing.
     161                            // in the chart. In "pie chart" mode, the
     162                            // sum of all these values corresponds to
     163                            // the usSweepAngle angle; in "bar chart" mode,
     164                            // the sum corresponds to the width of the control.
     165                            // If this ptr is NULL, the chart displays nothing.
    128166                            // Otherwise, this array must have cValues items.
    129167        LONG*           palColors;
    130168                            // pointer to an array of LONG RGB colors;
    131169                            // each item in this array must correspond
    132                             // to an item in padValues.
     170                            // to an item in padValues and specifies the color
     171                            // to paint the corresponding data item with.
    133172                            // This _must_ be specified if padValues is != NULL.
    134173                            // This array must have cValues items.
     
    141180    } CHARTDATA, *PCHARTDATA;
    142181
    143     // chart display mode: currently only PCF_PIECHART is supported.
     182    // chart display mode:
    144183    #define CHS_PIECHART            0x0000
     184    #define CHS_BARCHART            0x0001
    145185
    146186    // chart display flags (CHARTSTYLE.ulStyle):
    147     #define CHS_SHADOW              0x0100  // draw shadow
    148     #define CHS_3D_BRIGHT           0x0200  // draw 3D block in same color as surface;
     187    #define CHS_SHADOW              0x0100  // (pie chart only) draw shadow
     188    #define CHS_3D_BRIGHT           0x0200  // (pie chart only)
     189                                            // // draw 3D block in same color as surface;
    149190                                            // CHARTSTYLE.ulThickness defines thickness
    150     #define CHS_3D_DARKEN           0x0600  // draw 3D block too, but darker
     191    #define CHS_3D_DARKEN           0x0600  // (pie chart only)
     192                                            // draw 3D block too, but darker
    151193                                            // compared to surface;
    152194                                            // CHARTSTYLE.ulThickness defines thickness
    153195
     196    #define CHS_DRAWLINES           0x0800  // draw lines between pie slices
     197                                            // added V0.9.12 (2001-05-03) [umoeller]
     198
    154199    #define CHS_DESCRIPTIONS        0x1000  // show descriptions
    155200    #define CHS_DESCRIPTIONS_3D     0x3000  // same as CHS_DESCRIPTIONS, but shaded
    156201
    157     #define CHS_SELECTIONS          0x4000  // allow data items to be selected
     202    #define CHS_SELECTIONS          0x4000  // allow data items to be selected using
     203                                            // mouse and keyboard; this also enables
     204                                            // WM_CONTROL notifications
    158205
    159206    /*
     
    165212    {
    166213        ULONG           ulStyle;        // CHS_* flags
    167         ULONG           ulThickness;    // pie thickness (with CHS_3D_xxx) in pixels
    168         double          dPieSize;       // size of the pie chart relative to the control
     214
     215        ULONG           ulThickness;    // (pie chart only)
     216                                        // pie thickness (with CHS_3D_xxx) in pixels
     217
     218        double          dPieSize;       // (pie chart only)
     219                                        // // size of the pie chart relative to the control
    169220                                        // size. A value of 1 would make the pie chart
    170221                                        // consume all available space. A value of .5
     
    172223                                        // control's space. The pie chart is always
    173224                                        // centered within the control.
    174         double          dDescriptions;  // position of the slice descriptions on the pie
     225
     226        double          dDescriptions;  // (pie chart only)
     227                                        // position of the slice descriptions on the pie
    175228                                        // relative to the window size. To calculate the
    176229                                        // description positions, the control calculates
     
    191244    } CHARTSTYLE, *PCHARTSTYLE;
    192245
    193     /*
    194      *@@ CHARTCDATA:
    195      *      pie chart control data. Composed from the various
    196      *      chart initialization data.
    197      *      Stored in QWL_USER of the subclassed static control.
    198      *      Not available to the application.
    199      */
    200 
    201     typedef struct _CHARTCDATA
    202     {
    203         // data which is initialized upon creation:
    204         PFNWP           OldStaticProc;  // old static window procedure (from WinSubclassWindow)
    205 
    206         // data which is initialized upon CHTM_SETCHARTDATA/CHTM_SETCHARTSTYLE:
    207         HDC             hdcMem;         // memory device context for bitmap
    208         HPS             hpsMem;         // memory presentation space for bitmap
    209         CHARTDATA       cd;             // chart data: initialized to null values
    210         CHARTSTYLE      cs;             // chart style: initialized to null values
    211 
    212         HBITMAP         hbmChart;       // chart bitmap (for quick painting)
    213         HRGN*           paRegions;      // pointer to array of GPI regions for each data item
    214 
    215         // user interaction data:
    216         LONG            lSelected;      // zero-based index of selected chart item, or -1 if none
    217         BOOL            fHasFocus;
    218     } CHARTCDATA, *PCHARTCDATA;
    219 
    220246    HBITMAP ctlCreateChartBitmap(HPS hpsMem,
    221247                                 LONG lcx,
     
    229255    BOOL ctlChartFromStatic(HWND hwndStatic);
    230256
    231     #define CHTM_SETCHARTDATA      WM_USER + 2
    232 
    233     #define CHTM_SETCHARTSTYLE     WM_USER + 3
    234 
    235     #define CHTM_ITEMFROMPOINT     WM_USER + 4
     257    #define CHTM_SETCHARTDATA      (WM_USER + 2)
     258
     259    #define CHTM_SETCHARTSTYLE     (WM_USER + 3)
     260
     261    #define CHTM_ITEMFROMPOINT     (WM_USER + 4)
     262
     263    #define CHTM_SETEMPHASIS       (WM_USER + 5)
     264
     265    // WM_CONTROL notification codes
     266
     267    /*
     268     *@@ CHTN_EMPHASISCHANGED:
     269     *      WM_CONTROL notification code sent (!)
     270     *      by a chart control to its owner when
     271     *      selections change in the control.
     272     *
     273     *      This is only sent if the CHS_SELECTIONS
     274     *      style bit is set in the control.
     275     *
     276     *      Parameters:
     277     *
     278     *      --  USHORT SHORT1FROMMP(mp1): usid (control ID).
     279     *      --  USHORT SHORT2FROMMP(mp1): CHTN_EMPHASISCHANGED.
     280     *
     281     *      --  mp2: pointer to EMPHASISNOTIFY structure.
     282     *
     283     *      Note: The control only sends one such notification,
     284     *      even if an old selection was undone. That is, if
     285     *      item 1 was previously selected and item 2 is then
     286     *      selected, only one notification for item 2 is sent.
     287     *
     288     *@@added V0.9.12 (2001-05-03) [umoeller]
     289     */
     290
     291    #define CHTN_EMPHASISCHANGED       1001
     292
     293    /*
     294     *@@ CHTN_CONTEXTMENU:
     295     *      WM_CONTROL notification code sent (!)
     296     *      by a chart control to its owner when
     297     *      a context menu was requested on the
     298     *      control.
     299     *
     300     *      This is only sent if the CHS_SELECTIONS
     301     *      style bit is set in the control.
     302     *
     303     *      Parameters:
     304     *
     305     *      --  USHORT SHORT1FROMMP(mp1): usid (control ID).
     306     *      --  USHORT SHORT2FROMMP(mp1): CHTN_EMPHASISCHANGED.
     307     *
     308     *      --  mp2: pointer to EMPHASISNOTIFY structure.
     309     *          If the context menu was requested on a chart
     310     *          slice, lIndex has the index of the slice.
     311     *          Otherwise (e.g. whitespace), lIndex will
     312     *          be -1.
     313     *
     314     *@@added V0.9.12 (2001-05-03) [umoeller]
     315     */
     316
     317    #define CHTN_CONTEXTMENU            1002
     318
     319    /*
     320     *@@ CHTN_ENTER:
     321     *      WM_CONTROL notification code sent (!)
     322     *      by a chart control to its owner when
     323     *      the user double-clicked on a data item.
     324     *
     325     *      This is only sent if the CHS_SELECTIONS
     326     *      style bit is set in the control.
     327     *
     328     *      Parameters:
     329     *
     330     *      --  USHORT SHORT1FROMMP(mp1): usid (control ID).
     331     *      --  USHORT SHORT2FROMMP(mp1): CHTN_ENTER.
     332     *
     333     *      --  mp2: pointer to EMPHASISNOTIFY structure.
     334     *          If the double click occured on a chart
     335     *          slice, lIndex has the index of the slice.
     336     *          Otherwise (e.g. whitespace), lIndex will
     337     *          be -1.
     338     *
     339     *@@added V0.9.12 (2001-05-03) [umoeller]
     340     */
     341
     342    #define CHTN_ENTER                  1003
     343
     344    /*
     345     *@@ EMPHASISNOTIFY:
     346     *      structure used with CHTN_EMPHASISCHANGED,
     347     *      CHTN_ENTER, and CHTN_CONTEXTMENU.
     348     *
     349     *@@added V0.9.12 (2001-05-03) [umoeller]
     350     */
     351
     352    typedef struct _EMPHASISNOTIFY
     353    {
     354        HWND    hwndSource;
     355                // window handle of the chart control
     356        ULONG   ulEmphasis;
     357                // with CHTN_EMPHASISCHANGED: emphasis which has changed
     358                // (0 for selection, 1 for source emphasis).
     359                // Otherwise undefined.
     360        LONG    lIndex;
     361                // with CHTN_EMPHASISCHANGED: index of the data
     362                // item for which emphasis has changed (counting
     363                // from 0); if -1, a previous emphasis has been undone.
     364                // With CHTN_CONTEXTMENU and CHTN_ENTER, index of the
     365                // data item for which the request occured, or -1 for
     366                // a request on the control's whitespace.
     367        POINTL  ptl;
     368                // exact window coordinates where mouse
     369                // click occured (e.g. for context menu).
     370                // This is undefined (-1) if the event was not
     371                // caused by a mouse click.
     372    } EMPHASISNOTIFY, *PEMPHASISNOTIFY;
    236373
    237374    /* ******************************************************************
Note: See TracChangeset for help on using the changeset viewer.