home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Today - The Disc! 8 / cdrt08.iso / mac / Shareware / HyperCard / demoCdef 120 ƒ / cdef3D source ƒ / cdef3D.c next >
Encoding:
Text File  |  1994-12-12  |  16.7 KB  |  612 lines  |  [TEXT/KAHL]

  1. //----------------------------------------------------------------------------------
  2. // File        : cdef3D.c
  3. // Date        : May 2, 1994
  4. // Author    : Jim Stout
  5. // Purpose    : A CDEF to implement 3D controls
  6. //            :
  7. //            : This CDEF supports the System 7 style gray drawing of an
  8. //            : inactive control and the useWindFont varCode.
  9. //            :
  10. //     NOTE    :    There are NO restrictions on this source or resulting code.
  11. //        
  12. //----------------------------------------------------------------------------------
  13.  
  14. #define _DEBUGCDEF 1            // comment this line to build the CDEF
  15.  
  16. #define PUSHED 1
  17.  
  18. #include <SetUpA4.h>
  19.  
  20. #include "colorCDEF.h"
  21. #include "grayCDEF.h"
  22. #include "miscCDEF.h"
  23.  
  24. #define togButProc 0x04
  25.  
  26. //----------------------------------------------------------------------------------
  27. //    CDEF private data
  28. //----------------------------------------------------------------------------------
  29. typedef struct {
  30. short    osVers;
  31. short    txFont;
  32. short    txSize;
  33. }cdefData,**cdefHdl;
  34.  
  35. //----------------------------------------------------------------------------------
  36. //    Function prototypes
  37. //----------------------------------------------------------------------------------
  38. static void doDraw                (ControlHandle cHdl, short varCode);
  39. static void drawPush            (ControlHandle cHdl, short varCode, Boolean inColor, 
  40.                                     Boolean bgInColor, short lnHt, short lnAdj);
  41. static void drawCheck            (ControlHandle cHdl, short varCode, Boolean bgInColor);
  42. static void drawRadio            (ControlHandle cHdl, short varCode, Boolean bgInColor);
  43. static void drawTog                (ControlHandle cHdl, short varCode, Boolean bgInColor);
  44. static void drawTitle            (ControlHandle cHdl, short varCode, short lnHt, short lnAdj,
  45.                                     Boolean emboss, Boolean pushed);
  46. static void getNextLine            (Str255 t, Str255 s, short num);
  47. static void frame3DRect            (ControlHandle theControl, Rect *rr, Boolean inColor);
  48. static void frame3DRoundRect    (ControlHandle theControl, Rect *rr, short radius, 
  49.                                     Boolean inColor);
  50.  
  51. //----------------------------------------------------------------------------------
  52. //    CDEF main
  53. //----------------------------------------------------------------------------------
  54. #ifdef _DEBUGCDEF
  55. pascal long CDmain (short varCode, ControlHandle theControl, short message, long param);
  56. pascal long CDmain (short varCode, ControlHandle theControl, short message, long param)
  57. #else
  58. pascal long main (short varCode, ControlHandle theControl, short message, long param)
  59. #endif
  60. {
  61.     short        txF,txS;
  62.     long        ret = 0L;
  63.     cdefHdl        hCdef;
  64.     Point        p;
  65.     GrafPtr        thisPort;
  66.         
  67.     RememberA0();
  68.     SetUpA4();
  69.         
  70.     if((**theControl).contrlData)
  71.         HLock((**theControl).contrlData);
  72.                 
  73.     GetPort(&thisPort);
  74.     
  75. // set window font & size info    
  76.     
  77.     txF = thisPort->txFont;
  78.     txS = thisPort->txSize;
  79.     if(!(varCode & useWindFont)) {                // use system font    
  80.         thisPort->txFont = SysFontFam;
  81.         thisPort->txSize = SysFontSize;
  82.     }
  83.  
  84. // Process messages to control    
  85.  
  86.     if (message == initCntl) {
  87.         hCdef = (cdefHdl)NewHandle(sizeof(cdefData));
  88.         (**hCdef).osVers = getOSVers();
  89.         (**hCdef).txFont = txF;
  90.         (**hCdef).txSize = txS;
  91.         (**theControl).contrlData = (Handle)hCdef;
  92.         HLock((**theControl).contrlData);
  93.     }
  94.     else
  95.     if (message == dispCntl) {
  96.         HUnlock((**theControl).contrlData);
  97.         DisposeHandle((**theControl).contrlData);
  98.         (**theControl).contrlData = 0;
  99.     }
  100.     if (message == drawCntl &&
  101.         (**theControl).contrlVis != 0 &&
  102.             ((WindowPeek)(**theControl).contrlOwner)->visible) {
  103.         doDraw(theControl, varCode);
  104.     }
  105.     else
  106.     if (message == testCntl) {
  107.         p.v=HiWord(param);
  108.         p.h=LoWord(param);
  109.         if(PtInRect(p,&(*theControl)->contrlRect)) 
  110.             ret = 1L;
  111.     }
  112.     else
  113.     if (message == calcCRgns)
  114.             RectRgn((RgnHandle)(param & 0x7fffffffL), &(*theControl)->contrlRect);
  115.     else
  116.     if (message == calcCntlRgn || message == calcThumbRgn)
  117.             RectRgn((RgnHandle)(param), &(*theControl)->contrlRect);
  118.  
  119. // restore window font & size info    
  120.  
  121.     if(!(varCode & useWindFont)) {
  122.         thisPort->txFont = txF;
  123.         thisPort->txSize = txS;
  124.     }
  125.     if((**theControl).contrlData)
  126.         HUnlock((**theControl).contrlData);
  127.     RestoreA4();
  128.     return (ret);
  129. }
  130.  
  131. //----------------------------------------------------------------------------------
  132. // main drawing routine for all variations of the control.  Also
  133. // handles setting of colors, inactive control drawing.
  134. //----------------------------------------------------------------------------------
  135.  
  136. static void doDraw(ControlHandle theControl, short varCode)
  137. {
  138.     Rect        r;
  139.     Point        p;
  140.     RgnHandle    c;
  141.     FontInfo    f;
  142.     Boolean        grayOK=false, inColor=false, inactive=false, bgInColor = false;
  143.     PenState    penSt;
  144.     short        pixDepth,osVers,lnHt,lnAdj;
  145.     RGBColor    saveFore, saveBack;
  146.     RGBColor    rgbWhite = {-1, -1, -1};
  147.     GrafPtr        thisPort;
  148.     cdefHdl        hCdef;
  149.         
  150.     hCdef = (cdefHdl)(**theControl).contrlData;
  151.     if(!hCdef)
  152.         return;
  153.     GetPort(&thisPort);
  154.     GetPenState(&penSt);
  155.     PenSize(1,1);
  156.     
  157.     GetFontInfo(&f);
  158.     lnAdj = f.descent + f.leading;                
  159.     lnHt = f.ascent + lnAdj;
  160.     
  161.     r = (*theControl)->contrlRect;
  162.     osVers = (**hCdef).osVers;
  163.     pixDepth = getPixDepth(&r);
  164.     
  165.     if((*theControl)->contrlHilite == 255)
  166.         inactive = true;
  167.  
  168.     if(pixDepth > 2) {
  169.         saveColors(&saveFore, &saveBack);    
  170.         setPartColor(theControl, cFrameColor, true);
  171.         inColor = true;
  172.         bgInColor = true;
  173.         if(saveBack.red == 65535 &&                        // is bg white?
  174.             saveBack.green == 65535 &&
  175.             saveBack.blue == 65535)
  176.             bgInColor = false;
  177.     }
  178.     
  179.     if(thisPort->txFont != (**hCdef).txFont ||            // if font changed,
  180.         thisPort->txSize != (**hCdef).txSize) {            // clear rect to erase
  181.         (**hCdef).txFont = thisPort->txFont;                // old font
  182.         (**hCdef).txSize = thisPort->txSize;
  183.         EraseRect(&r);
  184.     }
  185.     
  186.     c = NewRgn();                                        // set new clipping region    
  187.     GetClip(c);
  188.     ClipRect(&r);
  189.         
  190. // draw the body of the control    
  191.  
  192.     if(varCode & checkBoxProc) {
  193.         drawCheck(theControl, varCode, bgInColor);
  194.     }
  195.     else
  196.     if(varCode & radioButProc) {
  197.         drawRadio(theControl, varCode, bgInColor);
  198.     }
  199.     else
  200.     if(varCode & togButProc) {
  201.         drawTog(theControl, varCode, bgInColor);
  202.     }
  203.     else
  204.     if(varCode == pushButProc || varCode == useWindFont) {
  205.         drawPush(theControl, varCode, inColor, bgInColor, lnHt, lnAdj);
  206.     }
  207.         
  208.     if((*theControl)->contrlHilite != PUSHED) {                    // not pushed down
  209.         if(bgInColor) {                                            // draw embossed title
  210.             RGBForeColor(&rgbWhite);
  211.             drawTitle (theControl, varCode, lnHt, lnAdj, true, false);    // embossed, not pushed
  212.             RGBForeColor(&saveFore);
  213.         }
  214.     
  215. // Draw the control title, in color or gray if it is inactive        
  216.  
  217.         if(inColor)    {    
  218.             setPartColor(theControl, cTextColor, true);
  219.             grayOK = haveGrayText();
  220.             if(inactive && grayOK)
  221.                 TextMode(grayishTextOr);
  222.         }
  223.         drawTitle(theControl, varCode, lnHt, lnAdj, false, false);
  224.     }
  225.                 
  226.     if(!grayOK && inactive) {                            // gray out the old way    
  227.         PenPat( (ConstPatternParam) "\xAA\x55\xAA\x55\xAA\x55\xAA\x55");
  228.         PenMode(patBic);
  229.         r = (*theControl)->contrlRect;
  230.         if(varCode != pushButProc)    
  231.             r.left+=18;
  232.         else
  233.             InsetRect(&r, 2, 2);
  234.         PaintRect(&r);    
  235.     }
  236.  
  237. // Clean up and leave    
  238.  
  239.     SetClip(c);                                            // restore clip & pen        
  240.     DisposeRgn(c);
  241.     SetPenState(&penSt);
  242.     TextMode(srcOr);
  243.     if(inColor)    
  244.         restoreColors(&saveFore, &saveBack);
  245. }
  246.  
  247. //----------------------------------------------------------------------------------
  248. //    The push button drawing routine
  249. //----------------------------------------------------------------------------------
  250. static void drawPush(ControlHandle theControl, short varCode, Boolean inColor, 
  251.                         Boolean bgInColor, short lnHt, short lnAdj)
  252. {    
  253.     short        radius;
  254.     Rect        r;
  255.     RGBColor    rgbGray;
  256.     RGBColor    rgbWhite = {-1, -1, -1};
  257.  
  258.     r = (*theControl)->contrlRect;
  259.     EraseRect(&r);
  260.     
  261.     if(bgInColor) {
  262.         RGBForeColor(&rgbWhite);                                // 3D button
  263.         MoveTo(r.left,  r.bottom-2);
  264.         LineTo(r.left,  r.top);
  265.         LineTo(r.right-1, r.top);
  266.         
  267.         MoveTo(r.left+1,  r.bottom-3);
  268.         LineTo(r.left+1,  r.top+1);
  269.         LineTo(r.right-2, r.top+1);
  270.         
  271.         setPartColor(theControl, cFrameColor, true);
  272.             
  273.         MoveTo(r.right-1, r.top);
  274.         LineTo(r.right-1, r.bottom-1);
  275.         LineTo(r.left,  r.bottom-1);
  276.         
  277.         if(getGray(&rgbGray))
  278.             RGBForeColor(&rgbGray);
  279.         MoveTo(r.right-2, r.top+1);
  280.         LineTo(r.right-2, r.bottom-2);
  281.         LineTo(r.left+1,  r.bottom-2);
  282.     
  283.         if((*theControl)->contrlHilite == PUSHED) {                // hilited button
  284.             EraseRect(&r);
  285.             setPartColor(theControl, cFrameColor, true);
  286.             MoveTo(r.left,  r.bottom-2);
  287.             LineTo(r.left,  r.top);
  288.             LineTo(r.right-1, r.top);
  289.             
  290.             if(getGray(&rgbGray))
  291.                 RGBForeColor(&rgbGray);
  292.             MoveTo(r.left+1,  r.bottom-3);
  293.             LineTo(r.left+1,  r.top+1);
  294.             LineTo(r.right-2, r.top+1);
  295.             
  296.             RGBForeColor(&rgbWhite);
  297.             MoveTo(r.right-1, r.top);
  298.             LineTo(r.right-1, r.bottom-1);
  299.             LineTo(r.left,  r.bottom-1);
  300.             
  301.             MoveTo(r.right-2, r.top+1);
  302.             LineTo(r.right-2, r.bottom-2);
  303.             LineTo(r.left+1,  r.bottom-2);
  304.             drawTitle(theControl, varCode, lnHt, lnAdj, true, true);
  305.             setPartColor(theControl, cTextColor, true);
  306.             drawTitle(theControl, varCode, lnHt, lnAdj, false, true);
  307.         }
  308.     }
  309.     else {                                                        // normal button
  310.         if(inColor) {                                            // set background color
  311.             if((*theControl)->contrlHilite == PUSHED)
  312.                 setPartColor(theControl, cTextColor, false);
  313.             else
  314.                 setPartColor(theControl, cBodyColor, false);
  315.         }
  316.         
  317.         r = (*theControl)->contrlRect;
  318.         radius = (r.bottom - r.top)/2;
  319.         EraseRoundRect(&r, radius, radius);
  320.         if(inColor)
  321.             setPartColor(theControl, cFrameColor, true);        // set foreground color
  322.         FrameRoundRect(&r, radius, radius);
  323.         
  324.         if((*theControl)->contrlHilite == PUSHED) {                // draw title in
  325.             if(inColor)                                            // cBodyColor
  326.                 setPartColor(theControl, cBodyColor, true);
  327.             drawTitle(theControl, varCode, lnHt, lnAdj, false, PUSHED);
  328.             if(!inColor) {
  329.                 InsetRect(&r,1,1);
  330.                 radius = (r.bottom - r.top)/2;
  331.                 InvertRoundRect(&r, radius, radius);
  332.             }
  333.         }
  334.     }
  335. }
  336.  
  337. //----------------------------------------------------------------------------------
  338. //    The check box drawing routine
  339. //----------------------------------------------------------------------------------
  340. static void drawCheck(ControlHandle theControl, short varCode, Boolean bgInColor)
  341. {    
  342.     Rect    r,r2;
  343.     Point    p;
  344.  
  345.     r = r2 = (*theControl)->contrlRect;
  346.     p.h = r.left;
  347.     p.v = r.bottom - (r.bottom - r.top)/2 - 1;
  348.     
  349.     r2.left+=2;
  350.     r2.bottom = p.v+7;
  351.     r2.right = r2.left+12;
  352.     r2.top = r2.bottom-12;
  353.     
  354.     if((*theControl)->contrlHilite != 1) {                // remove old hiliting        
  355.         r.right = r2.right;
  356.         EraseRect(&r);
  357.     }
  358.     frame3DRect(theControl, &r2, bgInColor);            // button frame
  359.     
  360.     if((*theControl)->contrlHilite == 1) {                // hilited button
  361.         InsetRect(&r2, 1, 1);
  362.         frame3DRect(theControl, &r2, bgInColor);
  363.     }
  364.     if((*theControl)->contrlValue != 0) {                // button center
  365.         MoveTo(r2.right-2, r2.top+1);
  366.         LineTo(r2.left+1,  r2.bottom-2);
  367.         MoveTo(r2.left,  r2.top);
  368.         LineTo(r2.right-2, r2.bottom-2);            
  369.     }
  370. }
  371.  
  372. //----------------------------------------------------------------------------------
  373. //    The radio button drawing routine
  374. //----------------------------------------------------------------------------------
  375. static void drawRadio(ControlHandle theControl, short varCode, Boolean bgInColor)
  376. {    
  377.     Rect    r,r2;
  378.     Point    p;
  379.  
  380.     r = r2 = (*theControl)->contrlRect;                    // get pen loc for drawing
  381.     p.h = r.left;
  382.     p.v = r.bottom - (r.bottom - r.top)/2 - 1;
  383.     
  384.     r2.left+=2;
  385.     r2.bottom = p.v+7;
  386.     r2.right = r2.left+12;
  387.     r2.top = r2.bottom-12;
  388.     
  389.     if((*theControl)->contrlHilite != 1) {                // remove old hiliting        
  390.         r.right = r2.right;
  391.         EraseOval(&r);
  392.     }
  393.     
  394.     frame3DRoundRect(theControl, &r2, 12, bgInColor);    // button frame
  395.     
  396.     if((*theControl)->contrlHilite == 1) {                // hilited button
  397.         InsetRect(&r2, 1, 1);
  398.         frame3DRoundRect(theControl, &r2, 10, bgInColor);
  399.         InsetRect(&r2, -1, -1);
  400.     }
  401.     if((*theControl)->contrlValue != 0) {                // button center
  402.         InsetRect(&r2, 3, 3);
  403.         FillOval(&r2, (ConstPatternParam)"\xff\xff\xff\xff\xff\xff\xff\xff");        
  404.     }
  405.  
  406. }
  407.  
  408. //----------------------------------------------------------------------------------
  409. //    The "Tog Button" drawing routine
  410. //----------------------------------------------------------------------------------
  411. static void drawTog(ControlHandle theControl, short varCode, Boolean bgInColor)
  412. {
  413.     Rect    r;
  414.     Point    p;
  415.     short    i,x,y;
  416.  
  417.     r = (*theControl)->contrlRect;                        // get pen loc for drawing
  418.     
  419. // Draw the diamond shaped control 
  420.  
  421.     p.h = r.left+2;
  422.     p.v = r.bottom - (r.bottom - r.top)/2 - 1;
  423.     
  424.     if((*theControl)->contrlHilite != 1) {                // remove old hiliting    
  425.         r.right = r.left+18;
  426.         EraseRect(&r);
  427.     }
  428.     
  429.     if(bgInColor)
  430.         ForeColor(whiteColor);
  431.     MoveTo(p.h,p.v);                                    // button frame            
  432.     LineTo(p.h+7,p.v+7);
  433.     LineTo(p.h+14,p.v);
  434.     if(bgInColor)
  435.         setPartColor(theControl, cFrameColor, true);
  436.     LineTo(p.h+7,p.v-7);
  437.     LineTo(p.h,p.v);
  438.     
  439.     if((*theControl)->contrlHilite == 1) {                // hilited button
  440.         if(bgInColor)
  441.             ForeColor(whiteColor);
  442.         MoveTo(p.h+1,p.v);
  443.         LineTo(p.h+7,p.v+6);
  444.         LineTo(p.h+13,p.v);
  445.         if(bgInColor)
  446.             setPartColor(theControl, cFrameColor, true);
  447.         LineTo(p.h+7,p.v-6);
  448.         LineTo(p.h+1,p.v);
  449.     }
  450.     if((*theControl)->contrlValue != 0) {                // button center            
  451.         x = p.h+4;
  452.         y = p.v;
  453.         for(i=1;i<=4;i++) {
  454.             MoveTo(x,y);
  455.             LineTo(x+3,y+3);
  456.             x++;
  457.             y--;
  458.         }
  459.         x = p.h+5;
  460.         y = p.v;
  461.         for(i=1;i<=3;i++) {
  462.             MoveTo(x,y);
  463.             LineTo(x+2,y+2);
  464.             x++;
  465.             y--;
  466.         }
  467.     }
  468. }
  469. //----------------------------------------------------------------------------------
  470. // Draw the control titles - handles multiple lines and 3D embossing
  471. //----------------------------------------------------------------------------------
  472. static void drawTitle (ControlHandle theControl, short varCode, short lnHt, short lnAdj, 
  473.                         Boolean emboss, Boolean pushed)
  474. {
  475.     short     inx=1,lnCnt=1,lnSpace,ctlSpace,v,h,adj=0;
  476.     Rect    r;
  477.     Str255    s;
  478.     
  479.     r = (*theControl)->contrlRect;
  480.         
  481.     do {                                                // count number of lines
  482.         if((*theControl)->contrlTitle[inx++] == 0x0d)    
  483.             lnCnt++;
  484.     }while (inx <= (*theControl)->contrlTitle[0]);
  485.     
  486.     lnSpace = lnCnt * lnHt;                                // required space
  487.     ctlSpace = r.bottom - r.top;                        // available height
  488.     v = r.bottom;                                        // baseline
  489.     v-=(ctlSpace - lnSpace)/2;                            // minus free space
  490.     v-=lnAdj;                                            // minus descent+leading
  491.     v-=((lnCnt-1)*lnHt);                                // minus other lines
  492.                                                         // v is now base for line 1
  493.     for(inx=1;inx<=lnCnt;inx++) {
  494.         getNextLine((*theControl)->contrlTitle, s, inx);
  495.         if(s[0]) {
  496.             if(varCode == pushButProc || varCode == useWindFont)
  497.                 h = r.left + (r.right - r.left - StringWidth(s))/2;
  498.             else
  499.             if(varCode & togButProc)
  500.                 h = r.left + 20;
  501.             else
  502.                 h = r.left + 18;
  503.             if(emboss & pushed)
  504.                 adj = -1;
  505.             else
  506.             if(emboss) 
  507.                 adj = 1;
  508.     
  509.             MoveTo(h+adj, v+adj);
  510.             DrawString(s);
  511.         }
  512.         v+=lnHt;
  513.     }
  514. }
  515. //----------------------------------------------------------------------------------
  516. // Grab the next line of a control title (assumes lines separated
  517. // by CR
  518. //----------------------------------------------------------------------------------
  519. static void getNextLine(Str255 t, Str255 s, short line)
  520. {
  521.     short    inx=1,len=0,lnCnt=1;
  522.     
  523.     s[0] = 0;                        // always default to null string
  524.     
  525.     do {
  526.         if(t[inx] == 0x0d)            // next line
  527.             lnCnt++;
  528.         else
  529.         if(lnCnt == line) {            // return this line
  530.             len++;
  531.             s[0] = len;
  532.             s[len] = t[inx];
  533.         }
  534.         inx++;
  535.     }while (inx <= t[0]);
  536. }
  537. //----------------------------------------------------------------------------------
  538. // Frame a rectangle with a 3d effect - used for checkBoxes
  539. //----------------------------------------------------------------------------------
  540. static void frame3DRect(ControlHandle theControl, Rect *rr, Boolean inColor)
  541. {
  542.     Rect        r;
  543.     
  544.     r = *rr;
  545.     if(inColor)
  546.         ForeColor(whiteColor);
  547.     MoveTo(r.right-1, r.top);
  548.     LineTo(r.right-1, r.bottom-1);
  549.     LineTo(r.left,  r.bottom-1);
  550.     if(inColor)
  551.         setPartColor(theControl, cFrameColor, true);
  552.     MoveTo(r.left,  r.bottom-2);
  553.     LineTo(r.left,  r.top);
  554.     LineTo(r.right-1, r.top);
  555. }
  556.  
  557. //----------------------------------------------------------------------------------
  558. // Frame a rounded rectangle with a 3d effect - used for radioButtons
  559. //----------------------------------------------------------------------------------
  560. static void frame3DRoundRect(ControlHandle theControl, Rect *rr, short radius, 
  561.                                 Boolean inColor)
  562. {
  563.     Rect        r, r2;
  564.     Boolean        vert=false;
  565.     
  566.     r = r2 = *rr;
  567.     
  568.     if((r.right-r.left) < (r.bottom-r.top))
  569.         vert = true;
  570.  
  571.     if(vert) {
  572.         r2.bottom = r2.top + radius;
  573.         if(inColor)
  574.             ForeColor(whiteColor);
  575.         FrameArc(&r2, 45, 45);
  576.         MoveTo(r.right-1, r.top+radius/2);
  577.         LineTo(r.right-1, r.bottom-radius/2);
  578.         r2.bottom = r.bottom;
  579.         r2.top = r.bottom-radius;
  580.         FrameArc(&r2, 90, 135);
  581.  
  582.         if(inColor)
  583.             setPartColor(theControl, cFrameColor, true);
  584.         FrameArc(&r2, 225, 45);
  585.         MoveTo(r.left, r.bottom-radius/2);
  586.         LineTo(r.left, r.top+radius/2);
  587.         r2.top = r.top;
  588.         r2.bottom = r2.top+radius;
  589.         FrameArc(&r2, 270, 135); 
  590.     }
  591.     else {
  592.         if(inColor)
  593.             ForeColor(whiteColor);
  594.         r2.left = r2.right - radius;
  595.         FrameArc(&r2, 45, 135);
  596.         MoveTo(r.right-radius/2, r.bottom-1);
  597.         LineTo(r.left+radius/2, r.bottom-1);
  598.         r2.left=r.left;
  599.         r2.right=r.left+radius;
  600.         FrameArc(&r2, 180, 45);
  601.         
  602.         if(inColor)
  603.             setPartColor(theControl, cFrameColor, true);
  604.         FrameArc(&r2, 225, 135);
  605.         MoveTo(r.left+radius/2, r.top);
  606.         LineTo(r.right-radius/2, r.top);
  607.         r2.right=r.right;
  608.         r2.left=r.right-radius;
  609.         FrameArc(&r2, 0, 45);
  610.     }
  611. }
  612.