First commit 19/07/1998
This commit is contained in:
BIN
CDopping/ActBtn/ActBtn.dcr
Normal file
BIN
CDopping/ActBtn/ActBtn.dcr
Normal file
Binary file not shown.
BIN
CDopping/ActBtn/ActImg.dcr
Normal file
BIN
CDopping/ActBtn/ActImg.dcr
Normal file
Binary file not shown.
64
CDopping/ActBtn/actbtn.cpp
Normal file
64
CDopping/ActBtn/actbtn.cpp
Normal file
@ -0,0 +1,64 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "actbtn.h"
|
||||
//---------------------------------------------------------------------------
|
||||
static inline TActiveButton *ValidCtrCheck()
|
||||
{
|
||||
return new TActiveButton(NULL);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TActiveButton::TActiveButton(TComponent* Owner)
|
||||
: TBitBtn(Owner)
|
||||
{
|
||||
captured = false;
|
||||
Glyph1 = new Graphics::TBitmap;
|
||||
FGlyph2 = new Graphics::TBitmap;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TActiveButton::~TActiveButton()
|
||||
{
|
||||
delete Glyph1;
|
||||
delete FGlyph2;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TActiveButton::MouseMove( Classes::TShiftState Shift, int X, int Y)
|
||||
{
|
||||
if( !captured){
|
||||
SetCapture( Handle);
|
||||
captured = true;
|
||||
Glyph1->Assign( Glyph); // save old glyph
|
||||
Glyph = Glyph2; // show new glyph
|
||||
}
|
||||
if( (X<0) || (Y<0) || (X>Width) || (Y>Height)){
|
||||
ReleaseCapture();
|
||||
captured = false;
|
||||
Glyph = Glyph1; // restore old glyph
|
||||
}else{
|
||||
TBitBtn::MouseMove( Shift, X, Y);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TActiveButton::Click( void)
|
||||
{
|
||||
TBitBtn::Click();
|
||||
ReleaseCapture();
|
||||
captured = false;
|
||||
Glyph = Glyph1;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TActiveButton::SetGlyph2( Graphics::TBitmap *val)
|
||||
{
|
||||
Glyph2->Assign( val);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Actbtn
|
||||
{
|
||||
void __fastcall Register()
|
||||
{
|
||||
TComponentClass classes[1] = {__classid(TActiveButton)};
|
||||
RegisterComponents("Extras", classes, 0);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
31
CDopping/ActBtn/actbtn.h
Normal file
31
CDopping/ActBtn/actbtn.h
Normal file
@ -0,0 +1,31 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef ActBtnH
|
||||
#define ActBtnH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\SysUtils.hpp>
|
||||
#include <vcl\Controls.hpp>
|
||||
#include <vcl\Classes.hpp>
|
||||
#include <vcl\Forms.hpp>
|
||||
#include <vcl\Buttons.hpp>
|
||||
#include <vcl\StdCtrls.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
class TActiveButton : public TBitBtn
|
||||
{
|
||||
private:
|
||||
bool captured;
|
||||
void __fastcall MouseMove( Classes::TShiftState Shift, int X, int Y);
|
||||
|
||||
protected:
|
||||
Graphics::TBitmap *Glyph1,*FGlyph2;
|
||||
void __fastcall SetGlyph2( Graphics::TBitmap* val);
|
||||
void __fastcall Click( void);
|
||||
|
||||
public:
|
||||
__fastcall TActiveButton(TComponent* Owner);
|
||||
__fastcall ~TActiveButton();
|
||||
|
||||
__published:
|
||||
__property Graphics::TBitmap *Glyph2={read=FGlyph2, write=SetGlyph2};
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
63
CDopping/ActBtn/actimg.cpp
Normal file
63
CDopping/ActBtn/actimg.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "actimg.h"
|
||||
//---------------------------------------------------------------------------
|
||||
static inline TActiveImage *ValidCtrCheck()
|
||||
{
|
||||
return new TActiveImage(NULL);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TActiveImage::TActiveImage(TComponent* Owner)
|
||||
: TImage(Owner)
|
||||
{
|
||||
captured = false;
|
||||
GlyphNormal = new Graphics::TPicture;
|
||||
GlyphOver = new Graphics::TPicture;
|
||||
GlyphPress = new Graphics::TPicture;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TActiveImage::~TActiveImage()
|
||||
{
|
||||
delete GlyphNormal;
|
||||
delete GlyphOver;
|
||||
delete GlyphPress;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TActiveImage::MouseMove( Classes::TShiftState Shift, int X, int Y )
|
||||
{
|
||||
if( !captured )
|
||||
{
|
||||
SetCapture( Parent );
|
||||
captured = true;
|
||||
GlyphNormal = Picture; // save old glyph
|
||||
Picture = GlyphOver; // show new glyph
|
||||
}
|
||||
if( (X<0) || (Y<0) || (X>Width) || (Y>Height))
|
||||
{
|
||||
ReleaseCapture();
|
||||
captured = false;
|
||||
Picture = GlyphNormal; // restore old glyph
|
||||
}else{
|
||||
TImage::MouseMove( Shift, X, Y );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TActiveImage::Click( void )
|
||||
{
|
||||
TImage::Click();
|
||||
ReleaseCapture();
|
||||
captured = false;
|
||||
Picture = GlyphNormal;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Actimg
|
||||
{
|
||||
void __fastcall Register()
|
||||
{
|
||||
TComponentClass classes[1] = {__classid(TActiveImage)};
|
||||
RegisterComponents("JD Soft.", classes, 0);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
32
CDopping/ActBtn/actimg.h
Normal file
32
CDopping/ActBtn/actimg.h
Normal file
@ -0,0 +1,32 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef ActBtnH
|
||||
#define ActBtnH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\SysUtils.hpp>
|
||||
#include <vcl\Controls.hpp>
|
||||
#include <vcl\Classes.hpp>
|
||||
#include <vcl\Forms.hpp>
|
||||
#include <vcl\ExtCtrls.hpp>
|
||||
#include <vcl\StdCtrls.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
class TActiveImage : public TImage
|
||||
{
|
||||
private:
|
||||
bool captured;
|
||||
void __fastcall MouseMove( Classes::TShiftState Shift, int X, int Y);
|
||||
|
||||
protected:
|
||||
Graphics::TPicture *GlyphOver,*GlyphNormal, *GlyphPress;
|
||||
|
||||
void __fastcall Click( void);
|
||||
|
||||
public:
|
||||
__fastcall TActiveImage(TComponent* Owner);
|
||||
__fastcall ~TActiveImage();
|
||||
|
||||
__published:
|
||||
__property Graphics::TPicture *Picture_Over={read=GlyphOver, write=GlyphOver};
|
||||
__property Graphics::TPicture *Picture_Press={read=GlyphPress, write=GlyphPress};
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
Reference in New Issue
Block a user