/*************************************************************************** * Copyright (C) 2003 by Ian Wadham and Marco Krüger * * ianw2@optusnet.com.au * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ #ifndef KGRDIALOG_TQT_H #define KGRDIALOG_TQT_H // If portable version, use TQDialog and TQMessageBox. // If KDE version, use KDialogBase and KMessageBox. #ifdef KGR_PORTABLE #include #define KGR_DIALOG TQDialog #include #else #include #include #define KGR_DIALOG KDialogBase #include #endif #include #include #include #include #include #include #include #include #ifdef QT3 #include #else #include #endif #include /** @author Ian Wadham and Marco Krüger */ class KGrCanvas; class KGrGame; class KGrCollection; class KGrThumbNail; /******************************************************************************/ /******************* DIALOG TO SELECT A GAME AND LEVEL *******************/ /******************************************************************************/ class KGrSLDialog : public KGR_DIALOG // KGR_PORTABLE sets TQDialog/KDialogBase { TQ_OBJECT public: KGrSLDialog (int action, int requestedLevel, int collnIndex, TQPtrList & gamesList, KGrGame * theGame, TQWidget * parent = 0, const char *name = 0); ~KGrSLDialog(); int selectedLevel() {return (number->value());} int selectedGame() {return (slCollnIndex);} private slots: void slSetCollections (int cIndex); void slColln (int i); void slAboutColln (); void slShowLevel (int i); void slUpdate (const TQString & text); void slPaintLevel (); void slotHelp (); // Will replace KDE slotHelp(). private: int slAction; TQPtrList collections; // List of games. int defaultLevel; int defaultGame; int slCollnIndex; KGrGame * game; KGrCollection * collection; TQWidget * slParent; TQLabel * collnL; TQListBox * colln; TQLabel * collnN; TQLabel * collnD; TQPushButton * collnA; TQLabel * numberL; TQLineEdit * display; TQScrollBar * number; TQPushButton * levelNH; TQLabel * slName; KGrThumbNail * thumbNail; #ifdef KGR_PORTABLE TQPushButton * OK; TQPushButton * HELP; TQPushButton * CANCEL; #endif }; /******************************************************************************* *************** DIALOG BOX TO CREATE/EDIT A LEVEL NAME AND HINT **************** *******************************************************************************/ class KGrNHDialog : public KGR_DIALOG // KGR_PORTABLE sets TQDialog/KDialogBase { TQ_OBJECT public: KGrNHDialog (const TQString & levelName, const TQString & levelHint, TQWidget * parent = 0, const char * name = 0); ~KGrNHDialog(); TQString getName() {return (nhName->text());} TQString getHint() {return (mle->text());} private: TQLineEdit * nhName; #ifdef QT3 TQTextEdit * mle; #else TQMultiLineEdit * mle; #endif }; /******************************************************************************* ***************** DIALOG TO CREATE OR EDIT A GAME (COLLECTION) ***************** *******************************************************************************/ class KGrECDialog : public KGR_DIALOG // KGR_PORTABLE sets TQDialog/KDialogBase { TQ_OBJECT public: KGrECDialog (int action, int collnIndex, TQPtrList & gamesList, TQWidget *parent = 0, const char *name = 0); ~KGrECDialog(); TQString getName() {return (ecName->text());} TQString getPrefix() {return (ecPrefix->text());} bool isTrad() {return (ecTradB->isChecked());} TQString getAboutText() {return (mle->text());} private slots: void ecSetRules (const char settings); void ecSetKGr(); // Radio button slots. void ecSetTrad(); private: TQPtrList collections; // List of existing games. int defaultGame; TQLabel * nameL; TQLineEdit * ecName; TQLabel * prefixL; TQLineEdit * ecPrefix; TQButtonGroup * ecGrp; TQRadioButton * ecKGrB; TQRadioButton * ecTradB; TQLabel * nLevL; TQLabel * mleL; #ifdef QT3 TQTextEdit * mle; #else TQMultiLineEdit * mle; #endif #ifdef KGR_PORTABLE TQPushButton * OK; TQPushButton * CANCEL; #endif }; /******************************************************************************* *************** DIALOG TO SELECT A SAVED GAME TO BE RE-LOADED **************** *******************************************************************************/ #include #include class KGrLGDialog : public KGR_DIALOG // KGR_PORTABLE sets TQDialog/KDialogBase { TQ_OBJECT public: KGrLGDialog (TQFile * savedGames, TQPtrList & collections, TQWidget * parent, const char * name); TQString getCurrentText() {return (lgList->currentText());} private slots: void lgSelect (int n); private: TQListBox * lgList; int lgHighlight; }; /******************************************************************************* ****************** PORTABLE MESSAGE FUNCTIONS (TQt Version) ******************* *******************************************************************************/ class KGrMessage : public TQDialog { public: static void information (TQWidget * parent, const TQString &caption, const TQString &text); static int warning (TQWidget * parent, TQString caption, TQString text, TQString label0, TQString label1, TQString label2 = ""); static void wrapped (TQWidget * parent, TQString caption, TQString text); }; #endif