home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 May / Chip_2002-05_cd1.bin / chplus / cpp / 3 / GrEdit1.exe / palette.cpp < prev    next >
C/C++ Source or Header  |  1998-02-09  |  3KB  |  62 lines

  1. //----------------------------------------------------------------------------
  2. //Borland C++Builder
  3. //Copyright (c) 1987, 1998 Borland International Inc. All Rights Reserved.
  4. //----------------------------------------------------------------------------
  5. //---------------------------------------------------------------------------
  6. #include <vcl.h>
  7. #pragma hdrstop
  8.  
  9. #include "palette.h"
  10. #include "main.h"
  11. //---------------------------------------------------------------------------
  12. #pragma resource "*.dfm"
  13. TToolPalette *ToolPalette;
  14. //---------------------------------------------------------------------------
  15. __fastcall TToolPalette::TToolPalette(TComponent* Owner)
  16.     : TForm(Owner)
  17. {
  18. }
  19. //---------------------------------------------------------------------------
  20. void __fastcall TToolPalette::ColorGrid1Change(TObject *Sender)
  21. {
  22.     // Set the colors of the glyphs that show foreground and background color.
  23.     // Since the ColorGrid already displays FG and BG, the glyphs aren't really
  24.     // needed.   Note that in the case of the color being black, the color of
  25.     // the boarder of the glyph (aka the Pen) is changed to white.  This is
  26.     // just so that the frame can still be seen against the fill color.
  27.     FGShape->Brush->Color = ColorGrid1->ForegroundColor;
  28.     if (FGShape->Brush->Color == TColor(clBlack))
  29.         FGShape->Pen->Color = TColor(clWhite);
  30.     else
  31.         FGShape->Pen->Color = TColor(clBlack);
  32.  
  33.     BGShape->Brush->Color = ColorGrid1->BackgroundColor;
  34.     if (BGShape->Brush->Color == TColor(clBlack))
  35.         BGShape->Pen->Color = TColor(clWhite);
  36.     else
  37.         BGShape->Pen->Color = TColor(clBlack);
  38. }
  39. //---------------------------------------------------------------------------
  40. void __fastcall TToolPalette::ShapeButtonClick(TObject *Sender)
  41. {
  42.     DoodleForm->Cursor = TCursor(crPlus);
  43. }
  44. //---------------------------------------------------------------------------
  45. void __fastcall TToolPalette::FillButtonClick(TObject *Sender)
  46. {
  47.     DoodleForm->Cursor = TCursor(crFill);
  48. }
  49. //---------------------------------------------------------------------------
  50. void __fastcall TToolPalette::PencilButtonClick(TObject *Sender)
  51. {
  52.     DoodleForm->Cursor = TCursor(crDraw);
  53. }
  54. //---------------------------------------------------------------------------
  55. void __fastcall TToolPalette::EraseButtonClick(TObject *Sender)
  56. {
  57.     DoodleForm->Cursor = TCursor(crErase);
  58. }
  59. //---------------------------------------------------------------------------
  60.  
  61.  
  62.