//---------------------------------------------------------------------------

#ifndef MainFormH
#define MainFormH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ComCtrls.hpp>
#include <ExtCtrls.hpp>
#include <Dialogs.hpp>
//---------------------------------------------------------------------------
class TfrmMain : public TForm
{
__published:	// IDE-managed Components
	TPageControl *pgeMain;
	TTabSheet *shtFonts;
	TListBox *lstFonts;
	TSplitter *splitVertical;
	TPanel *pnlFontsRight;
	TBevel *bvlSplit;
	TStatusBar *barStatus;
	TButton *btnGetFonts;
	TGroupBox *grpOwnerDrawOptions;
	TCheckBox *chkFontsOwnerDraw;
	TCheckBox *chkWordWrap;
	TFontDialog *dlgFonts;
	TButton *btnFonts;
	TLabel *lblFontName;
	TCheckBox *chkFontStyles;
	TUpDown *spnFontSize;
	TEdit *edtFontSize;
	TLabel *lblFontSize;
	TCheckBox *chkDoubleBuffered;
	TMemo *mmoPreview;
	void __fastcall btnGetFontsClick(TObject *Sender);
	void __fastcall FormCreate(TObject *Sender);
	void __fastcall chkFontsOwnerDrawClick(TObject *Sender);
	void __fastcall btnFontsClick(TObject *Sender);
	void __fastcall lstFontsMeasureItem(TWinControl *Control, int Index, int &Height);
	void __fastcall lstFontsDrawItem(TWinControl *Control, int Index, TRect &Rect, TOwnerDrawState State);
	void __fastcall lstFontsClick(TObject *Sender);
	void __fastcall splitVerticalMoved(TObject *Sender);
	void __fastcall chkFontStylesClick(TObject *Sender);
	void __fastcall edtFontSizeChange(TObject *Sender);
	void __fastcall shtFontsResize(TObject *Sender);
	void __fastcall chkDoubleBufferedClick(TObject *Sender);
	void __fastcall chkWordWrapClick(TObject *Sender);
	void __fastcall barStatusDrawPanel(TStatusBar *StatusBar, TStatusPanel *Panel, const TRect &Rect);

private:
	int WrapText(const AnsiString& text, int width, TStringList* lines);
	void RedrawList(void);
	void RecurseDoubleBuffer(TWinControl *control, bool onoff);

public:
	__fastcall TfrmMain(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TfrmMain *frmMain;
//---------------------------------------------------------------------------
#endif

