UPLOAD - DOSUIT07.ZIP - COLSET.HPP

 
Output of file : COLSET.HPP contained in archive : DOSUIT07.ZIP

// Colour setting dialogs.
#ifndef COLSET_HPP
#define COLSET_HPP
#ifndef RADIO_HPP
#include "radio.hpp"
#endif
#ifndef COMMAND_HPP
#include "command.hpp"
#endif

// A Button to select a colour.
// You don't need to use this class, just call setColorDialog().
class ColoredButton : public RadioButton {
color &col;
Command *command;
public:
ColoredButton(color &color, const char *name, Command *cmd);
virtual int setpressed();
virtual void paint(Rectangle r);
};

// Two sets of RadioButtons for selecting foregound & background colour.
// You don't need to use this class, just call setColorDialog().
class ColorSelect : public HCluster {
RadioCCluster *foreground;
RadioVCluster *background;
int fgcol, bgcol, blink;
color *col;
VObject *example;
int updateColor(const char *o = 0);
void setFGCol(int newcol);
void setBGCol(int newcol);
public:
ColorSelect(color *col = 0, VObject *example = 0);
// Example is a VObject to paint in the selected colour.
void setColor(color c);
// Set the current colour value.
int newColor(color *col = 0, VObject *example = 0);
// Attach the selector to a different colour.

// Methods called by the colour select buttons when they are pressed.
int pressFGColor(VObject *o);
int pressBGColor(VObject *o);
};

declare(GCommand,ColorSelect);

// The Control that implements colour selection.
// You don't need to use this class, just call setColorDialog().
class SetColorControl : public EditControl, public HCluster {
ColorSelect *select;
RadioVCluster *pickstate;
ColoredButton *examples[8];
int state;
ColorSet &colors;
ColorSet tempColors;
public:
SetColorControl(ColorSet &c);
int setState(const char *o);
virtual void read();
virtual int writeback();
virtual VObject *inheritingVObject();
};

declare(GCommand,SetColorControl);

/*
This is the function you call to allow the user to select all the
different colours that go to make up a ColorSet.

It places a Dialog on the screen which enables the user to fully
customise the particular ColorSet, and returns with the ColorSet
updated to reflect the user's preference.
*/
extern int setColorDialog(ColorSet &colors);


#endif