Annotation of mstools/samples/spincube/spincube.h, revision 1.1.1.2

1.1       root        1: /******************************************************************************\
                      2: *
                      3: *                                  SPINCUBE.H
                      4: *
                      5: \******************************************************************************/
                      6: 
                      7: #include <custcntl.h>
                      8: 
                      9: 
                     10: 
                     11: /******************************************************************************\
                     12: *                               SYMBOLIC CONSTANTS
                     13: \******************************************************************************/
                     14: 
                     15: #define SPINCUBECLASS           "Spincube"
                     16: #define SPINCUBEDESCRIPTION     "An animated control"
                     17: #define SPINCUBEDEFAULTTEXT     ":-)"
                     18: 
                     19: #define CCHSTYLE                20  // size of style string, i.e. "SS_ERASE"
                     20: 
                     21: #define NUM_SPINCUBE_STYLES     2
                     22: 
                     23: #define SS_ERASE                0x0001  // spincube window styles
                     24: #define SS_INMOTION             0x0002
                     25: 
                     26: 
                     27: #define SPINCUBE_EXTRA          4   // number of extra bytes for spincube class
                     28: 
                     29: #define SPIN_EVENT              1   // timer event id to repaint control
1.1.1.2 ! root       30: #ifdef _ALPHA_
        !            31: #define SPIN_INTERVAL           0   // milliseconds between repaints. what
        !            32:                                     //   would be really cool is a way to
        !            33:                                     //   dynamically adjust the interval-
        !            34:                                     //   on real fast machines we might
        !            35:                                     //   almost be able to get decent-looking
        !            36:                                     //   animation! :)
        !            37: 
        !            38: #else
1.1       root       39: #define SPIN_INTERVAL           75  // milliseconds between repaints. what
                     40:                                     //   would be really cool is a way to
                     41:                                     //   dynamically adjust the interval-
                     42:                                     //   on real fast machines we might
                     43:                                     //   almost be able to get decent-looking
                     44:                                     //   animation! :)
                     45: 
1.1.1.2 ! root       46: #endif
1.1       root       47: #define DID_ERASE               101 // dialog control id's
                     48: #define DID_INMOTION            102
                     49: #define DID_OK                  103
                     50: 
                     51: #define GWL_SPINCUBEDATA        0   // offset of control's instance data
                     52: 
                     53: #define SPINCUBE_REPAINT_BKGND  0x00000001
                     54: 
                     55: #define DO_ERASE(hwnd)          GetWindowLong(hwnd,GWL_STYLE) & SS_ERASE \
                     56:                                            ? TRUE : FALSE
                     57: 
                     58: #define IN_MOTION(hwnd)         GetWindowLong(hwnd,GWL_STYLE) & SS_INMOTION \
                     59:                                            ? TRUE : FALSE
                     60: 
                     61: #define REPAINT_BKGND(pSCI)     pSCI->iOptions&SPINCUBE_REPAINT_BKGND \
                     62:                                            ? TRUE : FALSE
                     63: 
                     64: 
                     65: 
                     66: /******************************************************************************\
                     67: *                                    TYPEDEFs
                     68: \******************************************************************************/
                     69: 
                     70: typedef struct
                     71: {
                     72:   HDC      hdcCompat;               // the DC that will contain our off-screen
                     73:                                     //   image
                     74:   HBITMAP  hbmCompat;               // The bitmap that will contain the actual
                     75:                                     //   image, i.e. we will always do our
                     76:                                     //   drawing on this bmp & then blt the
                     77:                                     //   result to the screen.
                     78: 
                     79:   float    fCurrentXRotation;       // Angle (in radians) to rotate cube about
                     80:   float    fCurrentYRotation;       //   x, y, z axis
                     81:   float    fCurrentZRotation;
                     82: 
                     83:   float    fCurrentXRotationInc;    // Amount to inc rotation angle each
                     84:   float    fCurrentYRotationInc;    //   time we repaint (and are in motion)
                     85:   float    fCurrentZRotationInc;
                     86: 
                     87:   int      iCurrentXTranslation;    // Distance (in pels) to translate cube
                     88:   int      iCurrentYTranslation;
                     89:   int      iCurrentZTranslation;
                     90: 
                     91:   int      iCurrentXTranslationInc; // Amount to inc translation distance each
                     92:   int      iCurrentYTranslationInc; //   time we repaint (and are in motion)
                     93:   int      iCurrentZTranslationInc;
                     94: 
                     95:   RECT     rcCubeBoundary;          // Bounding rectangle (in 2D) of the last
                     96:                                     //   cube drawn.  We invalidate only this
                     97:                                     //   region when we're doing animation
                     98:                                     //   and get the WM_TIMER- it's alot more
                     99:                                     //   efficient that invalidating the whole
                    100:                                     //   control (there's less screen flashing.
                    101: 
                    102:   int      iOptions;                // Contains the current options for this
                    103:                                     //   ctrl, i.e. erase background.
                    104: 
                    105: } SPINCUBEINFO, *PSPINCUBEINFO;
                    106: 
                    107: 
                    108: 
                    109: /******************************************************************************\
                    110: *                                FUNCTION PROTOTYPES
                    111: \******************************************************************************/
                    112: 
                    113: INT     CALLBACK SpincubeSizeToText (DWORD, DWORD, HFONT,  LPSTR);
                    114: BOOL    CALLBACK SpincubeStyle      (HWND,  LPCCSTYLE);
                    115: LRESULT CALLBACK SpincubeWndProc    (HWND,  UINT,  WPARAM, LPARAM);
                    116: LRESULT CALLBACK SpincubeDlgProc    (HWND,  UINT,  WPARAM, LPARAM);

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.