Category : Recently Uploaded Files
Archive   : DOSUIT07.ZIP
Filename : CHECK.HPP

 
Output of file : CHECK.HPP contained in archive : DOSUIT07.ZIP
// Check Buttons
#ifndef CHECK_HPP
#define CHECK_HPP
#ifndef BUTTON_HPP
#include "button.hpp"
#endif
#ifndef EDITCTRL_HPP
#include "editctrl.hpp"
#endif

/*
A checkable button, with two states - on and off. Clicking on it, or
pressing the space bar, toggles it on or off. It can be used to set
whole or part of an unsigned int to bit-values of all 1's, or all
0's. This is achieved with a bit mask (setbits below). In this way,
you can use a series of CheckButtons to set each individual bit in a
word.
As this is also an EditControl, the initial value is read from
the unsigned int on creation, and written back only when the write
method is called. Normally, CheckButtons will be written back
automatically with a CloseEditButton or an ApplyEditButton.
*/
class CheckButton : public Button, public EditControl {
public:
CheckButton(const char *name,unsigned int &result,unsigned int setbits);
// If (result & setbits) == setbits the CheckButton will be on
// initially.
int value() const { return (pressed()) ? bits : 0; }
// Returns setbits if the CheckButton is pressed, 0 if it is not
// pressed.
virtual void read();
virtual int writeback();
virtual int setpressed();
virtual coord minwidth() const;
virtual void paint(Rectangle r);
virtual int kbdevent(KeyboardEvent &e);
virtual VObject *inheritingVObject();

private:
unsigned int bits;
unsigned int &res;
};

// A CheckButton which sets/resets the bits in result immediately it
// is pressed, without the write() method having to be called.
class InstantCheckButton : public CheckButton {
public:
InstantCheckButton(const char *name,unsigned int &result,
unsigned int setbits);
virtual int setpressed();
};

#endif



  3 Responses to “Category : Recently Uploaded Files
Archive   : DOSUIT07.ZIP
Filename : CHECK.HPP

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/