kcarddialog.h
00001 /* 00002 This file is part of the KDE games library 00003 Copyright (C) 2000 Martin Heni (martin@heni-online.de) 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License version 2 as published by the Free Software Foundation. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 #ifndef __KCARDDIALOG_H_ 00020 #define __KCARDDIALOG_H_ 00021 00022 #include <tqstring.h> 00023 #include <kdialogbase.h> 00024 #include <tqmap.h> // TODO: remove - it is in kcarddialog.cpp now; left here for source compatibility 00025 00026 #include <kdemacros.h> 00027 class TQIconViewItem; 00028 00029 class KConfig; 00030 00031 class KCardDialogPrivate; 00032 00090 class KDE_EXPORT KCardDialog : public KDialogBase 00091 { 00092 Q_OBJECT 00093 TQ_OBJECT 00094 00095 public: 00096 00102 enum CardFlags { Both=0, NoDeck=0x01, NoCards=0x02 }; 00103 00111 KCardDialog (TQWidget* parent = NULL,const char* name = NULL, 00112 CardFlags flags = Both); 00116 ~KCardDialog(); 00117 00157 static int getCardDeck(TQString &deck,TQString &carddir, TQWidget *parent=0, 00158 CardFlags flags=Both, bool* randomDeck=0, 00159 bool* randomCardDir=0, double* scale=0, KConfig* conf=0); 00160 00176 static void getConfigCardDeck(KConfig* conf, TQString& deck, TQString& cardDir, double& scale); 00177 00189 static TQString getDefaultDeck(); 00190 00202 static TQString getDefaultCardDir(); 00203 00211 static TQString getCardPath(const TQString &carddir, int index); 00212 00217 static TQString getRandomDeck(); 00218 00223 static TQString getRandomCardDir(); 00224 00229 void showRandomDeckBox(bool s); 00230 00235 void showRandomCardDirBox(bool s); 00236 00242 const TQString& deck() const; 00243 00248 void setDeck(const TQString& file); 00249 00253 const TQString& cardDir() const; 00254 00259 void setCardDir(const TQString& dir); 00260 00264 CardFlags flags() const; 00265 00271 void setupDialog(bool showResizeBox = false); 00272 00277 bool isRandomDeck() const; 00278 00283 bool isRandomCardDir() const; 00284 00288 bool isGlobalDeck() const; 00289 00293 bool isGlobalCardDir() const; 00294 00298 double cardScale() const; 00299 00304 void loadConfig(KConfig* conf); 00305 00312 void saveConfig(KConfig* conf); 00313 00314 00315 protected: 00316 void insertCardIcons(); 00317 void insertDeckIcons(); 00318 00319 static void getGlobalDeck(TQString& cardDir, bool& random); 00320 static void getGlobalCardDir(TQString& deck, bool& random); 00321 00322 static TQString getDeckName(const TQString& desktop); 00323 00328 static TQString group(); 00329 00330 protected slots: 00331 void slotDeckClicked(TQIconViewItem *); 00332 void slotCardClicked(TQIconViewItem *); 00333 void slotRandomCardDirToggled(bool on); 00334 void slotRandomDeckToggled(bool on); 00335 void slotCardResized(int); 00336 void slotDefaultSize(); 00337 void slotSetGlobalDeck(); 00338 void slotSetGlobalCardDir(); 00339 00340 private: 00341 static void init(); 00342 00343 KCardDialogPrivate* d; 00344 }; 00345 00346 #endif