diff options
author | Timothy Pearson <[email protected]> | 2011-07-10 15:17:53 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2011-07-10 15:17:53 -0500 |
commit | dda8474928bd7276e1fad8fb7a601e7c83ff2bc2 (patch) | |
tree | 7f83910598b33b12730035f086df20b5a53ab99c /tqtinterface/qt4/src/dialogs/tqmessagebox.cpp | |
parent | 6260b6178868c03aab1644bf93b0ef043654bdb0 (diff) | |
download | experimental-dda8474928bd7276e1fad8fb7a601e7c83ff2bc2.tar.gz experimental-dda8474928bd7276e1fad8fb7a601e7c83ff2bc2.zip |
Added TQt4 HEAD
Diffstat (limited to 'tqtinterface/qt4/src/dialogs/tqmessagebox.cpp')
-rw-r--r-- | tqtinterface/qt4/src/dialogs/tqmessagebox.cpp | 2605 |
1 files changed, 2605 insertions, 0 deletions
diff --git a/tqtinterface/qt4/src/dialogs/tqmessagebox.cpp b/tqtinterface/qt4/src/dialogs/tqmessagebox.cpp new file mode 100644 index 0000000..79f6bfc --- /dev/null +++ b/tqtinterface/qt4/src/dialogs/tqmessagebox.cpp @@ -0,0 +1,2605 @@ +/**************************************************************************** +** +** Implementation of TQMessageBox class +** +** Created : 950503 +** +** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. +** +** This file is part of the dialogs module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at [email protected]. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqmessagebox.h" + +#ifndef TQT_NO_MESSAGEBOX + +#include "tqaccel.h" +#include "tqlabel.h" +#include "tqpushbutton.h" +#include "tqimage.h" +#include "tqapplication.h" +#include "tqstyle.h" +#include "tqobjectlist.h" +#if defined(TQT_ACCESSIBILITY_SUPPORT) +#include "tqaccessible.h" +#endif +#if defined TQT_NON_COMMERCIAL +#include "tqnc_win.h" +#endif + + +// Internal class - don't touch + +class TQMessageBoxLabel : public TQLabel +{ + TQ_OBJECT +public: + TQMessageBoxLabel( TQWidget* tqparent ) : TQLabel( tqparent, "messageBoxText") + { + tqsetAlignment( TQt::AlignAuto|TQt::ExpandTabs ); + } +}; +#include "tqmessagebox.tqmoc" + + + +// the TQt logo, for aboutTQt +/* XPM */ +static char * qtlogo_xpm[] = { +"50 50 995 2", +" c None", +". c #2B2B7E", +"+ c #2A2A7D", +"@ c #28297C", +"# c #28277B", +"$ c #26267A", +"% c #252579", +"& c #242477", +"* c #232376", +"= c #212175", +"- c #212174", +"; c #1F1F73", +"> c #1E1E72", +", c #1D1D70", +"' c #1C1C6F", +") c #1B1A6E", +"! c #1A1A6D", +"~ c #18186C", +"{ c #17176A", +"] c #161669", +"^ c #141568", +"/ c #131367", +"( c #121366", +"_ c #111165", +": c #101064", +"< c #0F0F62", +"[ c #0E0E61", +"} c #0C0C60", +"| c #0B0B5F", +"1 c #0A0A5D", +"2 c #09095D", +"3 c #08085B", +"4 c #06065A", +"5 c #050659", +"6 c #040458", +"7 c #030357", +"8 c #020255", +"9 c #010154", +"0 c #000053", +"a c #2C2C80", +"b c #29297C", +"c c #27287B", +"d c #222275", +"e c #202174", +"f c #19196D", +"g c #17176B", +"h c #151568", +"i c #141467", +"j c #131266", +"k c #101063", +"l c #0E0D61", +"m c #0C0D60", +"n c #0A0A5E", +"o c #09095C", +"p c #07075A", +"q c #050559", +"r c #030356", +"s c #2D2E81", +"t c #2C2C7F", +"u c #D1D1D1", +"v c #D0D0D0", +"w c #CFCFCF", +"x c #CDCDCE", +"y c #CDCCCC", +"z c #CBCBCB", +"A c #CACACA", +"B c #C9C9C9", +"C c #C8C7C8", +"D c #C6C6C6", +"E c #C5C5C5", +"F c #C4C4C4", +"G c #C3C3C3", +"H c #C2C2C2", +"I c #C0C0C0", +"J c #BFBFBF", +"K c #BEBEBE", +"L c #BDBDBD", +"M c #BCBCBC", +"N c #BABABB", +"O c #B9B9B9", +"P c #B8B8B8", +"Q c #B7B7B7", +"R c #B6B6B6", +"S c #B5B5B5", +"T c #B3B4B4", +"U c #B3B3B2", +"V c #B1B1B1", +"W c #B0B0B0", +"X c #AFAFAF", +"Y c #AEAEAE", +"Z c #ACACAC", +"` c #ABABAB", +" . c #AAAAAA", +".. c #A9A9A9", +"+. c #A8A8A8", +"@. c #A7A7A7", +"#. c #A6A6A6", +"$. c #2E2F82", +"%. c #2D2D81", +"&. c #D2D2D2", +"*. c #CECFCF", +"=. c #CDCDCD", +"-. c #CCCCCC", +";. c #C7C8C8", +">. c #C7C6C6", +",. c #C1C1C1", +"'. c #BBBBBB", +"). c #B2B2B2", +"!. c #ADADAD", +"~. c #303083", +"{. c #2E2E82", +"]. c #D3D3D3", +"^. c #D0CFD0", +"/. c #CDCECD", +"(. c #C1C1C2", +"_. c #C1C1C0", +":. c #BCBCBB", +"<. c #B3B3B4", +"[. c #B2B3B2", +"}. c #ADACAC", +"|. c #313184", +"1. c #302F83", +"2. c #D5D5D5", +"3. c #CFCFCE", +"4. c #C9C8C9", +"5. c #C7C8C7", +"6. c #C2C1C2", +"7. c #C0C0C1", +"8. c #BBBCBC", +"9. c #BABABA", +"0. c #B9BAB9", +"a. c #B3B4B3", +"b. c #ACACAD", +"c. c #323285", +"d. c #313084", +"e. c #D6D5D5", +"f. c #D4D5D4", +"g. c #BB9936", +"h. c #7E7E2B", +"i. c #7D7D2A", +"j. c #7C7C29", +"k. c #7B7B27", +"l. c #7A7A26", +"m. c #787825", +"n. c #777724", +"o. c #767622", +"p. c #757522", +"q. c #737420", +"r. c #72731F", +"s. c #71711E", +"t. c #70701D", +"u. c #6F6F1D", +"v. c #78929D", +"w. c #BDBFBF", +"x. c #333386", +"y. c #D7D7D6", +"z. c #D4D4D4", +"A. c #BB9830", +"B. c #80802C", +"C. c #7A7926", +"D. c #797825", +"E. c #767623", +"F. c #757521", +"G. c #737320", +"H. c #73731F", +"I. c #76919D", +"J. c #BDC0C0", +"K. c #B3B3B3", +"L. c #343488", +"M. c #D8D8D8", +"N. c #D7D7D7", +"O. c #BC9932", +"P. c #81802D", +"Q. c #7F7F2C", +"R. c #7D7D29", +"S. c #797A26", +"T. c #787925", +"U. c #72721F", +"V. c #77929E", +"W. c #BEC1C1", +"X. c #BABBBA", +"Y. c #353589", +"Z. c #343487", +"`. c #D9D9D9", +" + c #D6D7D7", +".+ c #CEC4A5", +"++ c #BABAA0", +"@+ c #B9B99F", +"#+ c #B8B89E", +"$+ c #B7B79C", +"%+ c #B6B381", +"&+ c #917F29", +"*+ c #78783E", +"=+ c #9CAC95", +"-+ c #AEAE95", +";+ c #AEAD93", +">+ c #ACAC92", +",+ c #ABAB91", +"'+ c #AEB6B9", +")+ c #C2C2C3", +"!+ c #C1C2C1", +"~+ c #36368A", +"{+ c #DADADA", +"]+ c #D6D6D6", +"^+ c #D1CDAB", +"/+ c #9E832A", +"(+ c #7C7C28", +"_+ c #7B7A27", +":+ c #7A794E", +"<+ c #B0C5CB", +"[+ c #C9CACA", +"}+ c #C8C8C8", +"|+ c #C7C7C7", +"1+ c #C2C3C2", +"2+ c #BBBBBC", +"3+ c #38378B", +"4+ c #37368A", +"5+ c #DBDBDB", +"6+ c #D7D8D8", +"7+ c #D7D6D6", +"8+ c #D2CFAC", +"9+ c #9F852A", +"0+ c #7B7B4F", +"a+ c #B1C6CC", +"b+ c #CBCBCA", +"c+ c #C8C8C9", +"d+ c #C2C3C3", +"e+ c #39398C", +"f+ c #DCDCDC", +"g+ c #D3D0AD", +"h+ c #A0862C", +"i+ c #7C7C50", +"j+ c #B2C7CD", +"k+ c #BCBBBB", +"l+ c #3A3A8D", +"m+ c #38398C", +"n+ c #DEDDDE", +"o+ c #D4D1AF", +"p+ c #A1872D", +"q+ c #7E7E2A", +"r+ c #7D7D51", +"s+ c #B3C8CE", +"t+ c #CBCACB", +"u+ c #CAC9CA", +"v+ c #BBBCBB", +"w+ c #3B3B8E", +"x+ c #DFDFDF", +"y+ c #DDDDDD", +"z+ c #D9D9D8", +"A+ c #D5D2B0", +"B+ c #A2882E", +"C+ c #80802D", +"D+ c #7E7E52", +"E+ c #B4CACF", +"F+ c #CECECE", +"G+ c #CACACB", +"H+ c #C9C9CA", +"I+ c #ADAEAD", +"J+ c #3C3C8F", +"K+ c #E0E0E0", +"L+ c #DFDEDF", +"M+ c #D9D8D9", +"N+ c #D7D7D8", +"O+ c #D7D3B1", +"P+ c #A3892F", +"Q+ c #82822E", +"R+ c #7F7F53", +"S+ c #B5CBD1", +"T+ c #CACBCB", +"U+ c #C7C7C6", +"V+ c #BCB3B9", +"W+ c #A29DAF", +"X+ c #9798AF", +"Y+ c #9DA4B7", +"Z+ c #B2BBC1", +"`+ c #AEAEAD", +" @ c #040457", +".@ c #3D3D91", +"+@ c #3C3C90", +"@@ c #E1E1E1", +"#@ c #DFDFDE", +"$@ c #D7D5B2", +"%@ c #A48A30", +"&@ c #82822F", +"*@ c #81812E", +"=@ c #808055", +"-@ c #B6CCD1", +";@ c #C8BCB8", +">@ c #886C8F", +",@ c #3E2D76", +"'@ c #202073", +")@ c #1F1F72", +"!@ c #1E1E71", +"~@ c #1C1C72", +"{@ c #2E418C", +"]@ c #708CB4", +"^@ c #B7BEBF", +"/@ c #AEADAE", +"(@ c #050558", +"_@ c #3F3E92", +":@ c #3D3D90", +"<@ c #E2E2E2", +"[@ c #DEDFDF", +"}@ c #D8D6B3", +"|@ c #A58C31", +"1@ c #848430", +"2@ c #83832F", +"3@ c #828156", +"4@ c #B8CDD3", +"5@ c #CECECC", +"6@ c #B8969C", +"7@ c #442979", +"8@ c #242478", +"9@ c #232377", +"0@ c #1B1B6E", +"a@ c #294A9A", +"b@ c #9CB5BE", +"c@ c #060659", +"d@ c #403F93", +"e@ c #3E3E92", +"f@ c #E3E3E3", +"g@ c #DEDFDE", +"h@ c #DAD7B4", +"i@ c #A68C32", +"j@ c #858532", +"k@ c #828357", +"l@ c #B9CED4", +"m@ c #D1D2D1", +"n@ c #D1D0CF", +"o@ c #BB9398", +"p@ c #36287B", +"q@ c #27277A", +"r@ c #262679", +"s@ c #252478", +"t@ c #1C1C70", +"u@ c #1B1B6F", +"v@ c #1C3B96", +"w@ c #9BB6BF", +"x@ c #AFAFAE", +"y@ c #07085B", +"z@ c #414194", +"A@ c #404093", +"B@ c #E4E4E4", +"C@ c #DFE0DF", +"D@ c #DBD8B5", +"E@ c #A78E34", +"F@ c #868632", +"G@ c #858531", +"H@ c #848458", +"I@ c #BACFD5", +"J@ c #CCB5AA", +"K@ c #4B2B7E", +"L@ c #28287C", +"M@ c #26348E", +"N@ c #6D85B2", +"O@ c #A7B1C0", +"P@ c #B9B7BE", +"Q@ c #AA9DAA", +"R@ c #765B82", +"S@ c #231F72", +"T@ c #2856A7", +"U@ c #B1BEBF", +"V@ c #B6B5B6", +"W@ c #B5B4B5", +"X@ c #424295", +"Y@ c #E5E5E5", +"Z@ c #E0E1E1", +"`@ c #DEDEDF", +" # c #DCD9B7", +".# c #A98F35", +"+# c #878734", +"@# c #858559", +"## c #BBD1D6", +"$# c #D4D1CA", +"%# c #915581", +"&# c #2B2B7F", +"*# c #2A2A7E", +"=# c #29297D", +"-# c #2B49A4", +";# c #A7C3CC", +"># c #C7C7C5", +",# c #B08A8F", +"'# c #2D1F72", +")# c #1B1B77", +"!# c #609ABC", +"~# c #B5B6B5", +"{# c #B4B5B5", +"]# c #08085C", +"^# c #434396", +"/# c #E6E6E6", +"(# c #E0E1E0", +"_# c #DFDFE0", +":# c #DEDEDE", +"<# c #DDDAB8", +"[# c #AA9036", +"}# c #888835", +"|# c #86865A", +"1# c #BCD2D7", +"2# c #D0B7AA", +"3# c #442E81", +"4# c #2D2D80", +"5# c #2A3093", +"6# c #90BCCE", +"7# c #C7C6C3", +"8# c #9F687D", +"9# c #204BA6", +"0# c #B2BFC0", +"a# c #B5B6B6", +"b# c #0B0B5E", +"c# c #0A095D", +"d# c #444498", +"e# c #E8E7E8", +"f# c #E0DFDF", +"g# c #DEDBB9", +"h# c #AB9137", +"i# c #898936", +"j# c #87875B", +"k# c #BDD3D9", +"l# c #D7D7D5", +"m# c #BA838F", +"n# c #2F2F82", +"o# c #2E2E81", +"p# c #3C70BF", +"q# c #C9D0D0", +"r# c #C5B4A6", +"s# c #442073", +"t# c #1C2188", +"u# c #8EB5C1", +"v# c #BCBDBD", +"w# c #B6B7B7", +"x# c #B6B6B5", +"y# c #0C0C5F", +"z# c #454599", +"A# c #E9E9E9", +"B# c #E8E8E7", +"C# c #E7E6E6", +"D# c #E1E1E0", +"E# c #DFDCBA", +"F# c #AC9238", +"G# c #8B8A37", +"H# c #88885D", +"I# c #BFD4DA", +"J# c #D8D8D1", +"K# c #9D5985", +"L# c #2E2E86", +"M# c #6AAAD0", +"N# c #C8C5BD", +"O# c #7F3F74", +"P# c #1E1E79", +"Q# c #64A0C0", +"R# c #BDBCBD", +"S# c #B5B5B6", +"T# c #B5B4B4", +"U# c #0D0D60", +"V# c #46469A", +"W# c #EAEAEA", +"X# c #E7E8E8", +"Y# c #E0DDBB", +"Z# c #AE9439", +"`# c #8B8C38", +" $ c #8B8B37", +".$ c #898A5E", +"+$ c #BFD5DB", +"@$ c #DAD5CB", +"#$ c #844986", +"$$ c #313185", +"%$ c #2F2F92", +"&$ c #8EBFD3", +"*$ c #C9C9C5", +"=$ c #9D5B79", +"-$ c #4A91BF", +";$ c #B7B6B7", +">$ c #B6B5B5", +",$ c #0F0E61", +"'$ c #47489B", +")$ c #EBEBEB", +"!$ c #E1E0E1", +"~$ c #DBD5CA", +"{$ c #7A4487", +"]$ c #323286", +"^$ c #303097", +"/$ c #9CC8D5", +"($ c #CACAC8", +"_$ c #A5687E", +":$ c #448ABE", +"<$ c #C3C3C4", +"[$ c #0F0F63", +"}$ c #48489C", +"|$ c #47479B", +"1$ c #ECECEC", +"2$ c #E8E7E7", +"3$ c #E6E7E6", +"4$ c #DCD7CC", +"5$ c #814988", +"6$ c #313196", +"7$ c #97C6D5", +"8$ c #CCCCC8", +"9$ c #A3637D", +"0$ c #4A91C0", +"a$ c #C4C3C3", +"b$ c #BCBDBC", +"c$ c #111164", +"d$ c #4A4A9D", +"e$ c #EDEDED", +"f$ c #DDDBD3", +"g$ c #985589", +"h$ c #353588", +"i$ c #323290", +"j$ c #7DB8D4", +"k$ c #D0D0CF", +"l$ c #C8C4CC", +"m$ c #CCCECE", +"n$ c #CDCCC6", +"o$ c #934E79", +"p$ c #22227C", +"q$ c #62A1C4", +"r$ c #C4C4C5", +"s$ c #C4C2B3", +"t$ c #AA9B67", +"u$ c #929263", +"v$ c #919162", +"w$ c #929A94", +"x$ c #B7BDBE", +"y$ c #BDBCBC", +"z$ c #121265", +"A$ c #4B4B9E", +"B$ c #494A9D", +"C$ c #EFEEEF", +"D$ c #E7E8E7", +"E$ c #DEDEDB", +"F$ c #B77791", +"G$ c #363689", +"H$ c #5190CD", +"I$ c #D5D7D7", +"J$ c #D3D3D2", +"K$ c #C4A5A3", +"L$ c #453289", +"M$ c #6B9AC6", +"N$ c #CAC6BA", +"O$ c #65337A", +"P$ c #23248A", +"Q$ c #8CB8C7", +"R$ c #C5C2A5", +"S$ c #967A1E", +"T$ c #6F6F1C", +"U$ c #6E6E1B", +"V$ c #6D7970", +"W$ c #B2BDBF", +"X$ c #BDBEBE", +"Y$ c #131366", +"Z$ c #4C4CA0", +"`$ c #EFF0F0", +" % c #EEEEEE", +".% c #E7E7E7", +"+% c #D4AFA7", +"@% c #3F378A", +"#% c #344AAE", +"$% c #B8D2D8", +"%% c #CCB1AB", +"&% c #4E2E80", +"*% c #2A2A86", +"=% c #5C6C91", +"-% c #30287B", +";% c #252679", +">% c #2444A7", +",% c #B4C6C9", +"'% c #C6C3A6", +")% c #977B1E", +"!% c #71701D", +"~% c #6E7A71", +"{% c #B3BEC0", +"]% c #4D4DA1", +"^% c #F1F1F1", +"/% c #EEEFEE", +"(% c #DFD7CD", +"_% c #7C488B", +":% c #37378A", +"<% c #4F82C7", +"[% c #CED7D8", +"}% c #D3C8BF", +"|% c #7A4C82", +"1% c #2C2D80", +"2% c #28287B", +"3% c #26277B", +"4% c #4E8CC2", +"5% c #C8CACA", +"6% c #C7C4A7", +"7% c #997D20", +"8% c #72721E", +"9% c #70701E", +"0% c #6F7C72", +"a% c #B4BFC1", +"b% c #BFBEBF", +"c% c #BDBDBE", +"d% c #4E4EA1", +"e% c #4D4DA0", +"f% c #F2F2F2", +"g% c #F0F0F0", +"h% c #CDA3A4", +"i% c #40388B", +"j% c #5075BA", +"k% c #B6CAD7", +"l% c #D3CAC0", +"m% c #754481", +"n% c #283C9F", +"o% c #A7C5CD", +"p% c #CCCBCB", +"q% c #B79D4F", +"r% c #86853B", +"s% c #797421", +"t% c #70702B", +"u% c #7C7F3D", +"v% c #818B80", +"w% c #B5BEC0", +"x% c #BFBEBE", +"y% c #BEBDBE", +"z% c #16166A", +"A% c #504FA3", +"B% c #4E4EA2", +"C% c #F3F3F3", +"D% c #E0DFD9", +"E% c #A87394", +"F% c #38388B", +"G% c #404A94", +"H% c #525293", +"I% c #463C83", +"J% c #3A6CB9", +"K% c #C1CDCE", +"L% c #CBCCCB", +"M% c #B28F27", +"N% c #747421", +"O% c #6F7A6C", +"P% c #B2BFC1", +"Q% c #C0BFC0", +"R% c #BFBFBE", +"S% c #17186B", +"T% c #5050A4", +"U% c #4F4FA3", +"V% c #F4F4F4", +"W% c #EFEFF0", +"X% c #E0DBD5", +"Y% c #A07296", +"Z% c #343486", +"`% c #4672B8", +" & c #BFCCCE", +".& c #CDCCCD", +"+& c #BCA561", +"@& c #91904B", +"#& c #807623", +"$& c #737436", +"%& c #868A51", +"&& c #8B948B", +"*& c #B8C1C2", +"=& c #18196C", +"-& c #5252A5", +";& c #F5F5F5", +">& c #EFEFEF", +",& c #E0DFDC", +"'& c #C0A1B0", +")& c #60488B", +"!& c #333486", +"~& c #303086", +"{& c #4A65A8", +"]& c #7C6289", +"^& c #2A2B8E", +"/& c #82B5CD", +"(& c #CCC9AB", +"_& c #9D8124", +":& c #748077", +"<& c #B9C4C5", +"[& c #19186C", +"}& c #5353A6", +"|& c #F7F6F6", +"1& c #F0EFEF", +"2& c #DFDDDB", +"3& c #C8B8C3", +"4& c #998FB1", +"5& c #7E79A9", +"6& c #7475AA", +"7& c #7A7FB1", +"8& c #919DC2", +"9& c #BACAD6", +"0& c #D5D2CC", +"a& c #A0718D", +"b& c #2C2C8A", +"c& c #6D9FCA", +"d& c #CED0D0", +"e& c #CDCAAD", +"f& c #9F8226", +"g& c #758178", +"h& c #BAC5C6", +"i& c #C4C5C4", +"j& c #191A6D", +"k& c #5454A8", +"l& c #F8F8F8", +"m& c #F6F6F6", +"n& c #E2E1E2", +"o& c #DADBDB", +"p& c #D5D3CF", +"q& c #BAB7CC", +"r& c #CFD3D2", +"s& c #CECBAE", +"t& c #9F8326", +"u& c #797925", +"v& c #768279", +"w& c #BBC6C8", +"x& c #C6C6C7", +"y& c #1A1B6E", +"z& c #5555A9", +"A& c #5454A7", +"B& c #F9F9F9", +"C& c #E1E1E2", +"D& c #DBDBDA", +"E& c #D9DAD9", +"F& c #D4D3D4", +"G& c #CFCCAF", +"H& c #A18528", +"I& c #7A7A27", +"J& c #77847A", +"K& c #BCC7C9", +"L& c #C7C6C7", +"M& c #5656AA", +"N& c #5555A8", +"O& c #FAFAFA", +"P& c #F5EDE7", +"Q& c #ECE8F0", +"R& c #EFE8E2", +"S& c #E6DDDD", +"T& c #E5DBDB", +"U& c #E4DADD", +"V& c #E7E8EB", +"W& c #EAE8E2", +"X& c #E0CFCD", +"Y& c #DBD9E2", +"Z& c #E4E2DE", +"`& c #DCD1D3", +" * c #DDDEE1", +".* c #DEDBD3", +"+* c #D2C2C2", +"@* c #D2D2D9", +"#* c #DADAD8", +"$* c #D6CAC8", +"%* c #D1D2D7", +"&* c #D3C9C5", +"** c #CDCBD1", +"=* c #D3D4D3", +"-* c #D0CDB0", +";* c #A28629", +">* c #79857B", +",* c #BDC8CA", +"'* c #C6C5C5", +")* c #5757AB", +"!* c #FBFBFB", +"~* c #EBAC6F", +"{* c #AA85C9", +"]* c #F0F4F4", +"^* c #F3F3F0", +"/* c #E5A467", +"(* c #9E4F5F", +"_* c #AB6868", +":* c #AB6A79", +"<* c #C6CFE8", +"[* c #EBDBB9", +"}* c #B96150", +"|* c #9F6265", +"1* c #A2504F", +"2* c #A794C5", +"3* c #E2E5E6", +"4* c #E2BF83", +"5* c #983E40", +"6* c #A4A5D2", +"7* c #DFCCA4", +"8* c #A84D42", +"9* c #945758", +"0* c #95414D", +"a* c #A8A6C5", +"b* c #CA844E", +"c* c #8E67A5", +"d* c #D2CFB2", +"e* c #A64442", +"f* c #A3ABCC", +"g* c #D5D5D4", +"h* c #D4D4D3", +"i* c #D1CFB1", +"j* c #A3872A", +"k* c #7B7B28", +"l* c #7A867D", +"m* c #BEC9CB", +"n* c #5959AC", +"o* c #FCFCFC", +"p* c #ECAD70", +"q* c #AB87CA", +"r* c #F1F5F5", +"s* c #F4F4F1", +"t* c #E7A669", +"u* c #A57CBB", +"v* c #E6E3E3", +"w* c #E9E2E6", +"x* c #ECEEE8", +"y* c #DB8C5B", +"z* c #A388C2", +"A* c #E6EAEB", +"B* c #E8D9BB", +"C* c #C298B0", +"D* c #DCE3DF", +"E* c #D28054", +"F* c #9D6A5C", +"G* c #9866A4", +"H* c #DAE1DC", +"I* c #D0814F", +"J* c #977BB6", +"K* c #DBDEDE", +"L* c #D9BA90", +"M* c #AC8CB6", +"N* c #D5CDA8", +"O* c #A34654", +"P* c #AD8B63", +"Q* c #8E5791", +"R* c #CCD3D7", +"S* c #D4D4D5", +"T* c #D2D0B2", +"U* c #A4882B", +"V* c #7B877D", +"W* c #BFCACD", +"X* c #FDFDFD", +"Y* c #EEAE72", +"Z* c #AC88CB", +"`* c #F2F6F6", +" = c #F5F5F2", +".= c #E8A769", +"+= c #A0505D", +"@= c #AB6565", +"#= c #AA6B88", +"$= c #D7E2E2", +"%= c #D27051", +"&= c #ADB3DF", +"*= c #EBDEBB", +"== c #B96C66", +"-= c #A76F8E", +";= c #D6D8BD", +">= c #B25463", +",= c #C2C4AF", +"'= c #AB4F64", +")= c #C3D1D7", +"!= c #C96646", +"~= c #A1A5D2", +"{= c #DDDDD9", +"]= c #CF9055", +"^= c #883443", +"/= c #A6AECF", +"(= c #D6D5D6", +"_= c #D5D4D5", +":= c #D4D1B3", +"<= c #A5892C", +"[= c #7C877C", +"}= c #C0CBCD", +"|= c #FFFFFF", +"1= c #EFAF73", +"2= c #AD89CC", +"3= c #F4F8F8", +"4= c #F6F6F3", +"5= c #E9A86C", +"6= c #A884C8", +"7= c #EFF3F3", +"8= c #F1F1EB", +"9= c #DE905D", +"0= c #A381BC", +"a= c #E7E9E5", +"b= c #E3C59A", +"c= c #A75072", +"d= c #CBB17B", +"e= c #9A4343", +"f= c #984C4B", +"g= c #954041", +"h= c #A3A0CB", +"i= c #D18352", +"j= c #9980BA", +"k= c #DEE1E1", +"l= c #DBB684", +"m= c #A57DAD", +"n= c #D8DCDE", +"o= c #DBC590", +"p= c #98446C", +"q= c #C4D2DB", +"r= c #D6D6D5", +"s= c #D5D2B6", +"t= c #A88B2D", +"u= c #7D7E4D", +"v= c #A6B8AE", +"w= c #BFC0BC", +"x= c #CACCCC", +"y= c #222376", +"z= c #222175", +"A= c #F0B172", +"B= c #A7545A", +"C= c #AB5E5E", +"D= c #AA6582", +"E= c #CF9B6B", +"F= c #A24F55", +"G= c #A75959", +"H= c #A65860", +"I= c #B9BCE4", +"J= c #EFE1BF", +"K= c #BF6652", +"L= c #A16065", +"M= c #A65C67", +"N= c #AB5D6B", +"O= c #B96F54", +"P= c #A8A3D4", +"Q= c #E1B271", +"R= c #9A639F", +"S= c #D9CFAB", +"T= c #AE5448", +"U= c #9A5B5A", +"V= c #984656", +"W= c #AFAED1", +"X= c #DCC692", +"Y= c #99466E", +"Z= c #C6D3DB", +"`= c #D6D5C6", +" - c #B89631", +".- c #81812D", +"+- c #807F2C", +"@- c #7C8678", +"#- c #BECBCD", +"$- c #F1EFEA", +"%- c #E8DADB", +"&- c #E7E8ED", +"*- c #EDECEC", +"=- c #EAE9EA", +"-- c #E8E8E9", +";- c #E5E3DD", +">- c #DBCDCE", +",- c #DBDCE1", +"'- c #E1E2E1", +")- c #DDDCDD", +"!- c #D1C27C", +"~- c #8F822E", +"{- c #7D8779", +"]- c #C0CDCF", +"^- c #252578", +"/- c #FFFEFF", +"(- c #EBEAEB", +"_- c #E9EAEA", +":- c #E9E8E8", +"<- c #E3E2E2", +"[- c #DCDCDD", +"}- c #DCDCDB", +"|- c #D2CAA9", +"1- c #B4AC78", +"2- c #A2A06C", +"3- c #9FA177", +"4- c #A9B3B0", +"5- c #CBCFD0", +"6- c #F8F7F8", +"7- c #E9E9EA", +"8- c #E8E8E8", +"9- c #E3E3E4", +"0- c #DDDEDE", +"a- c #D6D6D7", +"b- c #CECECF", +"c- c #27277B", +"d- c #FEFFFF", +"e- c #F9F9F8", +"f- c #F7F8F8", +"g- c #F2F1F1", +"h- c #F0F0F1", +"i- c #E4E4E3", +"j- c #E2E3E2", +"k- c #CFCFD0", +"l- c #5757AA", +"m- c #5656A9", +"n- c #5151A4", +"o- c #5050A3", +"p- c #4F4FA2", +"q- c #4C4C9F", +"r- c #4A4B9E", +"s- c #49499C", +"t- c #48489B", +"u- c #47479A", +"v- c #464699", +"w- c #454598", +"x- c #434397", +"y- c #3F3F92", +"z- c #3E3E91", +"A- c #3C3D90", +"B- c #3B3B8F", +"C- c #303184", +"D- c #2F2F83", +"E- c #2A2B7E", +"F- c #5859AB", +"G- c #5253A6", +"H- c #5152A4", +"I- c #4B4A9E", +"J- c #2A297D", +". + @ # $ % & * = - ; > , ' ) ! ~ { ] ^ / ( _ : < [ } | 1 2 3 4 5 6 7 8 9 0 0 0 0 0 0 0 0 0 0 0 0 0 ", +"a . + b c $ % & * d e ; > , ' ) f ~ g ] h i j _ k < l m | n o 3 p q 6 r 8 9 0 0 0 0 0 0 0 0 0 0 0 0 ", +"s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ` ...+.@.#.#.#.#.#.#.#.#.#.0 0 ", +"$.%.&.u v *.=.-.z A B ;.>.E F G H ,.J K L M '.O P Q R S T ).V W X Y !.` ...+.@.#.#.#.#.#.#.#.#.0 0 ", +"~.{.].&.u ^.w /.-.z A B ;.D E F G (._.J K L :.N O P Q R S <.[.V W X Y }.` ...+.@.#.#.#.#.#.#.#.0 0 ", +"|.1.2.].&.u v 3.=.-.z A 4.5.D E F G 6.7.J K L 8.9.0.P Q R S a.).V W X Y b.` ...+.@.#.#.#.#.#.#.0 0 ", +"c.d.e.f.].g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.K L M 9.O P Q R S a.).V W X Y Z ` ...+.@.#.#.#.#.#.0 0 ", +"x.c.y.e.z.A.B.h.i.j.k.C.D.n.E.F.G.H.s.t.I.J.J K L 8.9.O P Q R S K.).V W X Y Z ` ...+.@.#.#.#.#.0 0 ", +"L.x.M.N.e.O.P.Q.h.R.j.k.S.T.n.E.F.G.U.s.V.W.I J K L :.X.O P Q R S K.).V W X Y Z ` ...+.@.#.#.#.0 0 ", +"Y.Z.`.M. +.+++@+#+$+%+&+k.C.*+=+-+;+>+,+'+)+!+I J K L M 9.O P Q R S K.).V W X Y Z ` ...+.@.#.#.0 0 ", +"~+Y.{+`.M.]+2.z.].&.^+/+(+_+:+<+[+}+|+D E F 1+,.I J K L 2+9.O P Q R S K.).V W X Y Z ` ...+.@.#.0 0 ", +"3+4+5+{+`.6+7+2.z.].8+9+R.(+0+a+b+A c+|+D E F d+(.I J K L :.9.O P Q R S K.).V W X Y Z ` [email protected] 0 ", +"e+3+f+5+{+`.M.]+2.z.g+h+h.R.i+j+-.z [+}+|+D E F H ,.I J K L k+9.O P Q R S K.).V W X Y Z ` ...+.9 0 ", +"l+m+n+f+5+{+`.M.]+2.o+p+Q.q+r+s+=.-.t+u+}+|+D E F )+,.I J K L v+9.O P Q R S K.).V W X Y Z ` ...8 9 ", +"w+l+x+y+f+5+{+z+6+]+A+B+C+Q.D+E+F+=.-.G+H+}+|+D E F H ,.I J K L '.9.O P Q R S K.).V W X I+Z ` .r 8 ", +"J+w+K+L+y+f+5+{+M+N+O+P+Q+C+R+S+w F+=.-.T+H+}+U+V+W+X+Y+Z+I J K L '.9.O P Q R S K.).V W X `+Z ` @r ", +".@+@@@K+#@y+f+5+{+`.$@%@&@*@=@-@v w F+=.-.;@>@,@- '@)@!@~@{@]@^@K L '.9.O P Q R S K.).V W X /@Z (@ @", +"_@:@<@@@K+[@y+f+5+{+}@|@1@2@3@4@&.v w 5@6@7@8@9@d - '@)@!@' 0@a@b@K L '.9.O P Q R S K.).V W X Y c@(@", +"d@e@f@<@@@K+g@y+f+5+h@i@j@1@k@l@].m@n@o@p@q@r@s@9@d - '@)@!@t@u@v@w@K L '.9.O P Q R S K.).V W x@y@c@", +"z@A@B@f@<@@@C@g@y+f+D@E@F@G@H@I@z.].J@K@b L@q@M@N@O@P@Q@R@S@!@t@0@T@U@K L '.9.O P Q V@W@K.).V W o y@", +"X@z@Y@B@f@<@Z@K+`@y+ #.#+#F@@###2.$#%#&#*#=#-#;#-.A B }+>#,#'#!@' )#!#J K L '.9.O P Q ~#{#K.).V 1 ]#", +"^#X@/#Y@B@f@<@(#_#:#<#[#}#+#|#1#]+2#3#4##6#F+=.-.A B }+7#8#)@!@' 9#0#J K L '.9.O P Q a#{#K.).b#c#", +"d#^#e#/#Y@B@f@<@@@f#g#h#i#}#j#k#l#m#n#o#4#p#q#w F+=.-.A B }+r#s#)@!@t#u#I J K v#'.9.O P w#x#{#K.y#b#", +"z#d#A#B#C#Y@B@f@<@D#E#F#G#i#H#I#J#K#~.n#L#M#u v w F+=.-.A B N#O#'@)@P#Q#,.I J K R#'.9.O P Q S#T#U#y#", +"V#z#W#A#X#/#Y@B@f@<@Y#Z#`# $.$+$@$#$$$~.%$&$].u v w F+=.-.A *$=$- '@; -$H ,.I J K M '.9.O P ;$>$,$U#", +"'$V#)$W#A#X#/#Y@B@f@<@!$x+:#y+f+~${$]$$$^$/$z.].u v w F+=.-.($_$d - '@:$<$H ,.I J K R#'.9.O P ;$[$[ ", +"}$|$1$)$W#A#2$3$Y@B@f@<@(#x+:#y+4$5$Z.]$6$7$2.z.].u v w F+=.8$9$9@d = 0$E a$H ,.I J K b$'.9.O P c$[$", +"d$}$e$1$)$W#A#2$/#Y@B@f@<@K+x+:#f$g$h$Z.i$j$]+2.z.].u k$l$m$n$o$8@* p$q$D r$s$t$u$v$w$x$y$'.9.O z$: ", +"A$B$C$e$1$)$W#A#D$/#Y@B@f@<@K+x+E$F$G$h$Z.H$I$]+2.z.J$K$L$M$N$O$r@8@P$Q$|+D R$S$T$U$V$W$X$M '.9.Y$z$", +"Z$A$`$ %e$1$)$W#A#.%/#Y@B@f@<@K+x++%@%G$h$#%$%N.]+2.%%&%. *%=%-%q@;%>%,%}+|+'%)%!%T$~%{%J L M '.i Y$", +"]%Z$^%`$/%e$1$)$W#A#.%/#Y@B@f@<@K+(%_%:%G$h$<%[%N.]+}%|%1%&#+ b 2%3%4%5%B }+6%7%8%9%0%a%I b%c%M h i ", +"d%e%f%^%g% %e$1$)$W#A#.%/#Y@B@f@<@K+h%i%:%G$Y.j%k%N.]+l%m%1%. + b n%o%p%A q%r%s%G.8%t%u%v%w%x%y%z%h ", +"A%B%C%f%^%`$ %e$1$)$W#A#.%/#Y@B@f@<@D%E%F%:%G$h$L.G%H%I%n#o#4#&#+ J%K%=.L%M%E.p.N%G.U.t.O%P%Q%R%S%z%", +"T%U%V%C%f%^%W% %e$1$)$W#A#.%/#Y@B@f@<@X%Y%F%:%G$h$Z%c.|.~.n#o#1%. *#`% &.&+&@&#&p.N%$&%&&&*&,.I =&g ", +"-&T%;&V%C%f%^%>& %e$1$)$W#A#.%/#Y@B@f@<@,&'&)&:%G$h$!&c.|.~&{&]&1%. ^&/&F+.&(&_&E.p.:&<&F G H ,.! [&", +"}&-&|&;&V%C%f%^%1& %e$1$)$W#A#.%/#Y@B@f@<@K+2&3&4&5&6&7&8&9&]+0&a&b&c&d&w F+e&f&n.E.g&h&E i&G H 0@j&", +"k&}&l&m&;&V%C%f%^%>& %e$1$)$W#A#.%/#Y@B@f@n&K+x+:#y+f+o&`.M.N.]+p&q&r&u v w s&t&u&n.v&w&x&E F G ' y&", +"z&A&B&l&|&;&V%C%f%^%>& %e$1$)$W#A#.%/#Y@B@f@C&K+x+:#y+f+D&E&M.N.]+2.F&&.u v G&H&I&u&J&K&}+L&E F , ' ", +"M&N&O&B&l&m&P&Q&C%f%R&S&T&U&V&)$W&X&Y&/#Y@Z&`& *K+x+.*+*@*#*$*%*y.&***=*&.u -*;*k.I&>*,*B }+D '*> , ", +")*M&!*O&B&l&~*{*]*^*/*(*_*:*<*[*}*|*1*2*3*4*5*6*@@7*8*9*0*a*b*c*d*e*f*g*h*&.i*j*j.k*l*m*A B C L&; !@", +"n*)*o*!*O&B&p*q*r*s*t*u*v*w*x*y*z*A*B*C*D*E*F*G*H*I*J*K*L*M*N*O*P*Q*R*]+S*].T*U*i.j.V*W*z A B 5.- ; ", +"n*n*X*o*!*O&Y*Z*`* =.=+=@=#=$=%=&=*===-=;=>=,='=)=!=~=K+x+:#{=]=^=/=M.N.(=_=:=<=h.i.[=}=-.z A B d - ", +"n*n*|=X*o*!*1=2=3=4=5=6=7=f%8=9=0=a=b=c=d=e=f=g=h=i=j=k=l=m=n=o=p=q=`.M.N.r=s=t=B.h.u=v=w=x=z A y=z=", +"n*n*|=|=X*o*A=B=C=D=E=F=G=H=I=J=K=L=M=N=O=P=X#Q=R=S=T=U=V=W=[@X=Y=Z={+`.M.N.`= -.-+-h.i.@-#--.z & * ", +"n*n*|=|=|=X*o*!*O&B&l&m&;&V%C%f%$-%-&-*-1$)$=---.%/#;->-,-'-K+x+:#)-5+{+`.M.y.!-~-.-B.h.{-]-=.-.^-& ", +"n*n*|=|=|=/-X*o*!*O&B&l&m&;&V%C%f%g%>& %e$1$(-_-:-.%/#Y@B@<-@@K+x+:#[-}-{+`.M.y.|-1-2-3-4-5-F+=.$ ^-", +"n*n*|=|=|=|=/-X*o*!*O&B&6-m&;&V%C%f%^%>& %e$1$(-7-8-.%/#Y@9-<@@@K+x+0-f+5+{+`.M.a-(=z.].&.u k$b-c-r@", +"n*n*|=|=|=|=|=d-X*o*!*O&e-f-m&;&V%C%g-h->& %e$1$(-A#8-.%/#Y@i-j-@@K+x+n+)-5+{+`.M.y.e.z.].&.u k-L@c-", +"n*n*n*n*n*n*n*n*n*l-m-N&A&}&n-o-p-d%e%q-r-s-t-u-v-w-x-X@z@A@y-z-A-B-l+e+F%4+Y.Z.x.c.C-D-{.%.a E-+ L@", +"n*n*n*n*n*n*n*n*n*F-l-m-N&A&G-H-T%p-d%e%q-I-s-t-u-v-w-x-X@z@A@_@z-+@B-l+e+F%4+Y.Z.x.c.C-D-{.%.t . J-" +}; + + +/*! + \class TQMessageBox + \brief The TQMessageBox class provides a modal dialog with a short message, an icon, and some buttons. + \ingroup dialogs + \mainclass + + Message boxes are used to provide informative messages and to ask + simple questions. + + TQMessageBox provides a range of different messages, arranged + roughly along two axes: severity and complexity. + + Severity is + \table + \row + \i \img qmessagebox-quest.png + \i Question + \i For message boxes that ask a question as part of normal + operation. Some style guides recommend using Information for this + purpose. + \row + \i \img qmessagebox-info.png + \i Information + \i For message boxes that are part of normal operation. + \row + \i \img qmessagebox-warn.png + \i Warning + \i For message boxes that tell the user about unusual errors. + \row + \i \img qmessagebox-crit.png + \i Critical + \i For message boxes that tell the user about critical errors. + \endtable + + The message box has a different icon for each of the severity levels. + + Complexity is one button (OK) for simple messages, or two or even + three buttons for questions. + + There are static functions for the most common cases. + + Examples: + + If a program is unable to tqfind a supporting file, but can do perfectly + well without it: + + \code + TQMessageBox::information( this, "Application name", + "Unable to tqfind the user preferences file.\n" + "The factory default will be used instead." ); + \endcode + + question() is useful for simple yes/no questions: + + \code + if ( TQFile::exists( filename ) && + TQMessageBox::question( + this, + tr("Overwrite File? -- Application Name"), + tr("A file called %1 already exists." + "Do you want to overwrite it?") + .arg( filename ), + tr("&Yes"), tr("&No"), + TQString::null, 0, 1 ) ) + return false; + \endcode + + warning() can be used to tell the user about unusual errors, or + errors which can't be easily fixed: + + \code + switch( TQMessageBox::warning( this, "Application name", + "Could not connect to the <mumble> server.\n" + "This program can't function correctly " + "without the server.\n\n", + "Retry", + "Quit", 0, 0, 1 ) ) { + case 0: // The user clicked the Retry again button or pressed Enter + // try again + break; + case 1: // The user clicked the Quit or pressed Escape + // exit + break; + } + \endcode + + The text part of all message box messages can be either rich text + or plain text. If you specify a rich text formatted string, it + will be rendered using the default stylesheet. See + TQStyleSheet::defaultSheet() for details. With certain strings that + contain XML meta characters, the auto-rich text detection may + fail, interpreting plain text incorrectly as rich text. In these + rare cases, use TQStyleSheet::convertFromPlainText() to convert + your plain text string to a visually equivalent rich text string + or set the text format explicitly with setTextFormat(). + + Note that the Microsoft Windows User Interface Guidelines + recommend using the application name as the window's caption. + + Below are more examples of how to use the static member functions. + After these examples you will tqfind an overview of the non-static + member functions. + + Exiting a program is part of its normal operation. If there is + unsaved data the user probably should be asked if they want to + save the data. For example: + + \code + switch( TQMessageBox::information( this, "Application name here", + "The document tqcontains unsaved changes\n" + "Do you want to save the changes before exiting?", + "&Save", "&Discard", "Cancel", + 0, // Enter == button 0 + 2 ) ) { // Escape == button 2 + case 0: // Save clicked or Alt+S pressed or Enter pressed. + // save + break; + case 1: // Discard clicked or Alt+D pressed + // don't save but exit + break; + case 2: // Cancel clicked or Escape pressed + // don't exit + break; + } + \endcode + + The Escape button cancels the entire exit operation, and pressing + Enter causes the changes to be saved before the exit occurs. + + Disk full errors are unusual and they certainly can be hard to + correct. This example uses predefined buttons instead of + hard-coded button texts: + + \code + switch( TQMessageBox::warning( this, "Application name here", + "Could not save the user preferences,\n" + "because the disk is full. You can delete\n" + "some files and press Retry, or you can\n" + "abort the Save Preferences operation.", + TQMessageBox::Retry | TQMessageBox::Default, + TQMessageBox::Abort | TQMessageBox::Escape )) { + case TQMessageBox::Retry: // Retry clicked or Enter pressed + // try again + break; + case TQMessageBox::Abort: // Abort clicked or Escape pressed + // abort + break; + } + \endcode + + The critical() function should be reserved for critical errors. In + this example errorDetails is a TQString or const char*, and TQString + is used to concatenate several strings: + + \code + TQMessageBox::critical( 0, "Application name here", + TQString("An internal error occurred. Please ") + + "call technical support at 1234-56789 and report\n"+ + "these numbers:\n\n" + errorDetails + + "\n\nApplication will now exit." ); + \endcode + + In this example an OK button is displayed. + + TQMessageBox provides a very simple About box which displays an + appropriate icon and the string you provide: + + \code + TQMessageBox::about( this, "About <Application>", + "<Application> is a <one-paragraph blurb>\n\n" + "Copyright 1991-2003 Such-and-such. " + "<License words here.>\n\n" + "For technical support, call 1234-56789 or see\n" + "http://www.such-and-such.com/Application/\n" ); + \endcode + + See about() for more information. + + If you want your users to know that the application is built using + TQt (so they know that you use high quality tools) you might like + to add an "About TQt" menu option under the Help menu to invoke + aboutTQt(). + + If none of the standard message boxes is suitable, you can create a + TQMessageBox from scratch and use custom button texts: + + \code + TQMessageBox mb( "Application name here", + "Saving the file will overwrite the original file on the disk.\n" + "Do you really want to save?", + TQMessageBox::Information, + TQMessageBox::Yes | TQMessageBox::Default, + TQMessageBox::No, + TQMessageBox::Cancel | TQMessageBox::Escape ); + mb.setButtonText( TQMessageBox::Yes, "Save" ); + mb.setButtonText( TQMessageBox::No, "Discard" ); + switch( mb.exec() ) { + case TQMessageBox::Yes: + // save and exit + break; + case TQMessageBox::No: + // exit without saving + break; + case TQMessageBox::Cancel: + // don't save and don't exit + break; + } + \endcode + + TQMessageBox defines two enum types: Icon and an unnamed button type. + Icon defines the \c Question, \c Information, \c Warning, and \c + Critical icons for each GUI style. It is used by the constructor + and by the static member functions question(), information(), + warning() and critical(). A function called standardIcon() gives + you access to the various icons. + + The button types are: + \list + \i Ok - the default for single-button message boxes + \i Cancel - note that this is \e not automatically Escape + \i Yes + \i No + \i Abort + \i Retry + \i Ignore + \i YesAll + \i NoAll + \endlist + + Button types can be combined with two modifiers by using OR, '|': + \list + \i Default - makes pressing Enter equivalent to + clicking this button. Normally used with Ok, Yes or similar. + \i Escape - makes pressing Escape equivalent to clicking this button. + Normally used with Abort, Cancel or similar. + \endlist + + The text(), icon() and iconPixmap() functions provide access to the + current text and pixmap of the message box. The setText(), setIcon() + and setIconPixmap() let you change it. The difference between + setIcon() and setIconPixmap() is that the former accepts a + TQMessageBox::Icon and can be used to set standard icons, whereas the + latter accepts a TQPixmap and can be used to set custom icons. + + setButtonText() and buttonText() provide access to the buttons. + + TQMessageBox has no Q_SIGNALS or Q_SLOTS. + + <img src=qmsgbox-m.png> <img src=qmsgbox-w.png> + + \sa TQDialog, + \link http://www.iarchitect.com/errormsg.htm + Isys on error messages \endlink, + \link guibooks.html#fowler GUI Design Handbook: Message Box \endlink +*/ + + +/*! + \enum TQMessageBox::Icon + + This enum has the following values: + + \value NoIcon the message box does not have any icon. + + \value Question an icon indicating that + the message is asking a question. + + \value Information an icon indicating that + the message is nothing out of the ordinary. + + \value Warning an icon indicating that the + message is a warning, but can be dealt with. + + \value Critical an icon indicating that + the message represents a critical problem. + +*/ + + +struct TQMessageBoxData { + TQMessageBoxData(TQMessageBox* tqparent) : + iconLabel( tqparent, "icon" ) + { + } + + int numButtons; // number of buttons + TQMessageBox::Icon icon; // message box icon + TQLabel iconLabel; // label holding any icon + int button[3]; // button types + int defButton; // default button (index) + int escButton; // escape button (index) + TQSize buttonSize; // button size + TQPushButton *pb[3]; // buttons +}; + +static const int LastButton = TQMessageBox::NoAll; + +/* + NOTE: The table of button texts correspond to the button enum. +*/ + +#ifndef TQ_OS_TEMP +static const char * const mb_texts[] = { +#else +const char * mb_texts[] = { +#endif + 0, + TQT_TRANSLATE_NOOP("TQMessageBox","OK"), + TQT_TRANSLATE_NOOP("TQMessageBox","Cancel"), + TQT_TRANSLATE_NOOP("TQMessageBox","&Yes"), + TQT_TRANSLATE_NOOP("TQMessageBox","&No"), + TQT_TRANSLATE_NOOP("TQMessageBox","&Abort"), + TQT_TRANSLATE_NOOP("TQMessageBox","&Retry"), + TQT_TRANSLATE_NOOP("TQMessageBox","&Ignore"), + TQT_TRANSLATE_NOOP("TQMessageBox","Yes to &All"), + TQT_TRANSLATE_NOOP("TQMessageBox","N&o to All"), + 0 +}; + +/*! + Constructs a message box with no text and a button with the label + "OK". + + If \a tqparent is 0, the message box becomes an application-global + modal dialog box. If \a tqparent is a widget, the message box + becomes modal relative to \a tqparent. + + The \a tqparent and \a name arguments are passed to the TQDialog + constructor. +*/ + +TQMessageBox::TQMessageBox( TQWidget *tqparent, const char *name ) + : TQDialog( tqparent, name, TRUE, (WFlags)(WStyle_Customize | TQt::WStyle_DialogBorder | TQt::WStyle_Title | TQt::WStyle_SysMenu) ) +{ + init( Ok, 0, 0 ); +} + + +/*! + Constructs a message box with a \a caption, a \a text, an \a icon, + and up to three buttons. + + The \a icon must be one of the following: + \list + \i TQMessageBox::NoIcon + \i TQMessageBox::Question + \i TQMessageBox::Information + \i TQMessageBox::Warning + \i TQMessageBox::Critical + \endlist + + Each button, \a button0, \a button1 and \a button2, can have one + of the following values: + \list + \i TQMessageBox::NoButton + \i TQMessageBox::Ok + \i TQMessageBox::Cancel + \i TQMessageBox::Yes + \i TQMessageBox::No + \i TQMessageBox::Abort + \i TQMessageBox::Retry + \i TQMessageBox::Ignore + \i TQMessageBox::YesAll + \i TQMessageBox::NoAll + \endlist + + Use TQMessageBox::NoButton for the later parameters to have fewer + than three buttons in your message box. If you don't specify any + buttons at all, TQMessageBox will provide an Ok button. + + One of the buttons can be OR-ed with the \c TQMessageBox::Default + flag to make it the default button (clicked when Enter is + pressed). + + One of the buttons can be OR-ed with the \c TQMessageBox::Escape + flag to make it the cancel or close button (clicked when Escape is + pressed). + + Example: + \code + TQMessageBox mb( "Application Name", + "Hardware failure.\n\nDisk error detected\nDo you want to stop?", + TQMessageBox::Question, + TQMessageBox::Yes | TQMessageBox::Default, + TQMessageBox::No | TQMessageBox::Escape, + TQMessageBox::NoButton ); + if ( mb.exec() == TQMessageBox::No ) + // try again + \endcode + + If \a tqparent is 0, the message box becomes an application-global + modal dialog box. If \a tqparent is a widget, the message box + becomes modal relative to \a tqparent. + + If \a modal is TRUE the message box is modal; otherwise it + is modeless. + + The \a tqparent, \a name, \a modal, and \a f arguments are passed to + the TQDialog constructor. + + \sa setCaption(), setText(), setIcon() +*/ + +TQMessageBox::TQMessageBox( const TQString& caption, + const TQString &text, Icon icon, + int button0, int button1, int button2, + TQWidget *tqparent, const char *name, + bool modal, WFlags f ) + : TQDialog( tqparent, name, modal, (WFlags)(f | (WFlags)WStyle_Customize | TQt::WStyle_DialogBorder | TQt::WStyle_Title | TQt::WStyle_SysMenu) ) +{ + init( button0, button1, button2 ); +#ifndef TQT_NO_WIDGET_TOPEXTRA + setCaption( caption ); +#endif + setText( text ); + setIcon( icon ); +} + + +/*! + Destroys the message box. +*/ + +TQMessageBox::~TQMessageBox() +{ + delete mbd; +} + +static TQString * translatedTextAboutTQt = 0; + +void TQMessageBox::init( int button0, int button1, int button2 ) +{ + if ( !translatedTextAboutTQt ) { + translatedTextAboutTQt = new TQString; + +// #if defined(TQT_NON_COMMERCIAL) +// TQT_NC_MSGBOX +// #else + *translatedTextAboutTQt = tr( + "<h3>About TQt</h3>" + "<p>This program uses TQt version %1.</p>" + "<p>TQt is a C++ toolkit for multiplatform GUI & " + "application development.</p>" + "<p>TQt provides single-source portability " + "to Qt v3, Qt v4, and future Qt versions.</p>" + "<p>TQt is a Pearson Computing product, based on Qt 3.3. " + "See <tt>http://tqt.pearsoncomputing.net/</tt> " + "for more information.</p>" + ).arg( TQT_VERSION_STR ); +// #endif + + } + label = new TQMessageBoxLabel( this ); + TQ_CHECK_PTR( label ); + + if ( (button2 && !button1) || (button1 && !button0) ) { +#if defined(TQT_CHECK_RANGE) + qWarning( "TQMessageBox: Inconsistent button parameters" ); +#endif + button0 = button1 = button2 = 0; + } + mbd = new TQMessageBoxData(this); + TQ_CHECK_PTR( mbd ); + mbd->icon = NoIcon; + mbd->iconLabel.setPixmap( TQPixmap() ); + mbd->numButtons = 0; + mbd->button[0] = button0; + mbd->button[1] = button1; + mbd->button[2] = button2; + mbd->defButton = -1; + mbd->escButton = -1; + int i; + for ( i=0; i<3; i++ ) { + int b = mbd->button[i]; + if ( (b & Default) ) { + if ( mbd->defButton >= 0 ) { +#if defined(TQT_CHECK_RANGE) + qWarning( "TQMessageBox: There can be at most one " + "default button" ); +#endif + } else { + mbd->defButton = i; + } + } + if ( (b & Escape) ) { + if ( mbd->escButton >= 0 ) { +#if defined(TQT_CHECK_RANGE) + qWarning( "TQMessageBox: There can be at most one " + "escape button" ); +#endif + } else { + mbd->escButton = i; + } + } + b &= ButtonMask; + if ( b == 0 ) { + if ( i == 0 ) // no buttons, add an Ok button + b = Ok; + } else if ( b < 0 || b > LastButton ) { +#if defined(TQT_CHECK_RANGE) + qWarning( "TQMessageBox: Invalid button specifier" ); +#endif + b = Ok; + } else { + if ( i > 0 && mbd->button[i-1] == 0 ) { +#if defined(TQT_CHECK_RANGE) + qWarning( "TQMessageBox: Inconsistent button parameters; " + "button %d defined but not button %d", + i+1, i ); +#endif + b = 0; + } + } + mbd->button[i] = b; + if ( b ) + mbd->numButtons++; + } + for ( i=0; i<3; i++ ) { + if ( i >= mbd->numButtons ) { + mbd->pb[i] = 0; + } else { + TQCString buttonName; + buttonName.sprintf( "button%d", i+1 ); + mbd->pb[i] = new TQPushButton( + tr(mb_texts[mbd->button[i]]), + this, buttonName ); + if ( mbd->defButton == i ) { + mbd->pb[i]->setDefault( TRUE ); + mbd->pb[i]->setFocus(); + } + mbd->pb[i]->setAutoDefault( TRUE ); + mbd->pb[i]->setFocusPolicy( Qt::StrongFocus ); + connect( mbd->pb[i], TQT_SIGNAL(clicked()), TQT_SLOT(buttonClicked()) ); + } + } + resizeButtons(); + reserved1 = reserved2 = 0; +} + + +int TQMessageBox::indexOf( int button ) const +{ + int index = -1; + for ( int i=0; i<mbd->numButtons; i++ ) { + if ( mbd->button[i] == button ) { + index = i; + break; + } + } + return index; +} + + +void TQMessageBox::resizeButtons() +{ + int i; + TQSize maxSize; + for ( i=0; i<mbd->numButtons; i++ ) { + TQSize s = mbd->pb[i]->tqsizeHint(); + maxSize.setWidth( TQMAX(maxSize.width(), s.width()) ); + maxSize.setHeight( TQMAX(maxSize.height(),s.height()) ); + } + mbd->buttonSize = maxSize; + for ( i=0; i<mbd->numButtons; i++ ) + mbd->pb[i]->resize( maxSize ); +} + + +/*! + \property TQMessageBox::text + \brief the message box text to be displayed. + + The text will be interpreted either as a plain text or as rich + text, depending on the text format setting (\l + TQMessageBox::textFormat). The default setting is \c AutoText, i.e. + the message box will try to auto-detect the format of the text. + + The default value of this property is TQString::null. + + \sa textFormat +*/ +TQString TQMessageBox::text() const +{ + return label->text(); +} + + +void TQMessageBox::setText( const TQString &text ) +{ + label->setText( text ); +} + + +/*! + \property TQMessageBox::icon + \brief the message box's icon + + The icon of the message box can be one of the following predefined + icons: + \list + \i TQMessageBox::NoIcon + \i TQMessageBox::Question + \i TQMessageBox::Information + \i TQMessageBox::Warning + \i TQMessageBox::Critical + \endlist + + The actual pixmap used for displaying the icon depends on the + current \link TQWidget::tqstyle() GUI style\endlink. You can also set + a custom pixmap icon using the \l TQMessageBox::iconPixmap + property. The default icon is TQMessageBox::NoIcon. + + \sa iconPixmap +*/ + +TQMessageBox::Icon TQMessageBox::icon() const +{ + return mbd->icon; +} + +void TQMessageBox::setIcon( Icon icon ) +{ + setIconPixmap( standardIcon(icon) ); + mbd->icon = icon; +} + +/*! + \obsolete + + Returns the pixmap used for a standard icon. This + allows the pixmaps to be used in more complex message boxes. + \a icon specifies the required icon, e.g. TQMessageBox::Information, + TQMessageBox::Warning or TQMessageBox::Critical. + + \a style is unused. +*/ + +TQPixmap TQMessageBox::standardIcon( Icon icon, TQt::GUIStyle style) +{ + TQ_UNUSED(style); + return TQMessageBox::standardIcon(icon); +} + + +/*! + Returns the pixmap used for a standard icon. This allows the + pixmaps to be used in more complex message boxes. \a icon + specifies the required icon, e.g. TQMessageBox::Question, + TQMessageBox::Information, TQMessageBox::Warning or + TQMessageBox::Critical. +*/ + +TQPixmap TQMessageBox::standardIcon( Icon icon ) +{ + TQPixmap pm; + switch ( icon ) { + case Information: + pm = TQApplication::tqstyle().stylePixmap( TQStyle::SP_MessageBoxInformation ); + break; + case Warning: + pm = TQApplication::tqstyle().stylePixmap( TQStyle::SP_MessageBoxWarning ); + break; + case Critical: + pm = TQApplication::tqstyle().stylePixmap( TQStyle::SP_MessageBoxCritical ); + break; + case Question: + pm = TQApplication::tqstyle().stylePixmap( TQStyle::SP_MessageBoxQuestion ); + default: + break; + } + return pm; +} + + +/*! + \property TQMessageBox::iconPixmap + \brief the current icon + + The icon currently used by the message box. Note that it's often + hard to draw one pixmap that looks appropriate in both Motif and + Windows GUI styles; you may want to draw two pixmaps. + + \sa icon +*/ + +const TQPixmap *TQMessageBox::iconPixmap() const +{ + return mbd->iconLabel.pixmap(); +} + + +void TQMessageBox::setIconPixmap( const TQPixmap &pixmap ) +{ + mbd->iconLabel.setPixmap(pixmap); + mbd->icon = NoIcon; +} + + +/*! + Returns the text of the message box button \a button, or + TQString::null if the message box does not contain the button. + + \sa setButtonText() +*/ + +TQString TQMessageBox::buttonText( int button ) const +{ + int index = indexOf(button); + return index >= 0 && mbd->pb[index] + ? mbd->pb[index]->text() + : TQString::null; +} + + +/*! + Sets the text of the message box button \a button to \a text. + Setting the text of a button that is not in the message box is + silently ignored. + + \sa buttonText() +*/ + +void TQMessageBox::setButtonText( int button, const TQString &text ) +{ + int index = indexOf(button); + if ( index >= 0 && mbd->pb[index] ) { + mbd->pb[index]->setText( text ); + resizeButtons(); + } +} + + +/*! + \internal + Internal slot to handle button clicks. +*/ + +void TQMessageBox::buttonClicked() +{ + int reply = 0; + const TQObject *s = TQT_TQOBJECT(sender()); + for ( int i=0; i<mbd->numButtons; i++ ) { + if ( TQT_TQOBJECT(mbd->pb[i]) == s ) + reply = mbd->button[i]; + } + done( reply ); +} + + +/*! + Adjusts the size of the message box to fit the contents just before + TQDialog::exec() or TQDialog::show() is called. + + This function will not be called if the message box has been explicitly + resized before showing it. +*/ +void TQMessageBox::adjustSize() +{ + if ( !testWState(TQt::WState_Polished) ) + polish(); + resizeButtons(); + label->adjustSize(); + TQSize labelSize( label->size() ); + int n = mbd->numButtons; + int bw = mbd->buttonSize.width(); + int bh = mbd->buttonSize.height(); + int border = bh / 2 - tqstyle().tqpixelMetric(TQStyle::PM_ButtonDefaultIndicator); + if ( border <= 0 ) + border = 10; + int btn_spacing = 7; + if ( tqstyle().tqstyleHint(TQStyle::SH_GUIStyle) == TQt::MotifStyle ) + btn_spacing = border; +#ifndef TQ_OS_TEMP + int buttons = mbd->numButtons * bw + (n-1) * btn_spacing; + int h = bh; +#else + int visibleButtons = 0; + for ( int i = 0; i < mbd->numButtons; ++i ) + visibleButtons += mbd->pb[i]->isVisible() ? 1 : 0; + int buttons = visibleButtons == 0 ? 0 : visibleButtons * bw + (visibleButtons-1) * btn_spacing; + int h = visibleButtons == 0 ? 0 : bh; + n = visibleButtons; +#endif + if ( labelSize.height() ) + h += labelSize.height() + 3*border; + else + h += 2*border; + int lmargin = 0; + if ( mbd->iconLabel.pixmap() && mbd->iconLabel.pixmap()->width() ) { + mbd->iconLabel.adjustSize(); + lmargin += mbd->iconLabel.width() + border; + if ( h < mbd->iconLabel.height() + 3*border + bh && n ) + h = mbd->iconLabel.height() + 3*border + bh; + } + int w = TQMAX( buttons, labelSize.width() + lmargin ) + 2*border; + TQRect screen = TQApplication::desktop()->screenGeometry( pos() ); + if ( w > screen.width() ) + w = screen.width(); + resize( w, h ); + setMinimumSize( size() ); +#ifdef TQ_WS_MAC + setMaximumSize(size()); +#endif +} + + +/*!\reimp +*/ +void TQMessageBox::resizeEvent( TQResizeEvent * ) +{ + int i; + int n = mbd->numButtons; + int bw = mbd->buttonSize.width(); + int bh = mbd->buttonSize.height(); +#ifdef TQ_OS_TEMP + int visibleButtons = 0; + for ( i = 0; i < n; ++i ) + visibleButtons += mbd->pb[i]->isVisible() ? 1 : 0; + n = visibleButtons; + bw = visibleButtons == 0 ? 0 : bw; + bh = visibleButtons == 0 ? 0 : bh; +#endif + int border = bh / 2 - tqstyle().tqpixelMetric(TQStyle::PM_ButtonDefaultIndicator); + if ( border <= 0 ) + border = 10; + int btn_spacing = 7; + if ( tqstyle().tqstyleHint(TQStyle::SH_GUIStyle) == TQt::MotifStyle ) + btn_spacing = border; + int lmargin = 0; + mbd->iconLabel.adjustSize(); + bool rtl = TQApplication::reverseLayout(); + if (rtl) + mbd->iconLabel.move(width() - border - mbd->iconLabel.width(), border); + else + mbd->iconLabel.move(border, border); + if ( mbd->iconLabel.pixmap() && mbd->iconLabel.pixmap()->width() ) + lmargin += mbd->iconLabel.width() + border; + label->setGeometry((rtl ? 0 : lmargin) + border, + border, + width() - lmargin -2*border, + height() - 3*border - bh); + int extra_space = (width() - bw*n - 2*border - (n-1)*btn_spacing); + if ( tqstyle().tqstyleHint(TQStyle::SH_GUIStyle) == TQt::MotifStyle ) + for ( i=0; i<n; i++ ) + mbd->pb[rtl ? n - i - 1 : i]->move(border + i*bw + i*btn_spacing + extra_space*(i+1)/(n+1), + height() - border - bh ); + else + for ( i=0; i<n; i++ ) + mbd->pb[rtl ? n - i - 1 : i]->move(border + i*bw + extra_space/2 + i*btn_spacing, + height() - border - bh ); +} + + +/*!\reimp +*/ +void TQMessageBox::keyPressEvent( TQKeyEvent *e ) +{ + if ( e->key() == Key_Escape ) { + if ( mbd->escButton >= 0 ) { + TQPushButton *pb = mbd->pb[mbd->escButton]; + pb->animateClick(); + e->accept(); + return; + } + } +#ifndef TQT_NO_ACCEL + if ( !( e->state() & TQt::AltButton ) ) { + TQObjectList *list = queryList( "TQPushButton" ); + TQObjectListIt it( *list ); + TQPushButton *pb; + while ( (pb = (TQPushButton*)it.current()) ) { + int key = e->key() & ~(Qt::MODIFIER_MASK|Qt::UNICODE_ACCEL); + int acc = pb->accel() & ~(Qt::MODIFIER_MASK|Qt::UNICODE_ACCEL); + if ( key && acc && acc == key ) { + delete list; + emit pb->animateClick(); + return; + } + ++it; + } + delete list; + } +#endif + TQDialog::keyPressEvent( e ); +} + +/*!\reimp +*/ +void TQMessageBox::showEvent( TQShowEvent *e ) +{ +#if defined(TQT_ACCESSIBILITY_SUPPORT) + TQAccessible::updateAccessibility( this, 0, TQAccessible::Alert ); +#endif + TQDialog::showEvent( e ); +} + +/*!\reimp +*/ +void TQMessageBox::closeEvent( TQCloseEvent *e ) +{ + TQDialog::closeEvent( e ); + if ( mbd->escButton != -1 ) + setResult( mbd->button[mbd->escButton] ); +} + +/***************************************************************************** + Static TQMessageBox functions + *****************************************************************************/ + +/*!\fn int TQMessageBox::message( const TQString &,const TQString&,const TQString&,TQWidget*,const char * ) + \obsolete + Opens a modal message box directly using the specified parameters. + + Please use information(), warning(), question(), or critical() instead. +*/ + +/*! \fn bool TQMessageBox::query( const TQString &,const TQString&,const TQString&,const TQString&,TQWidget *, const char * ) + \obsolete + Queries the user using a modal message box with two buttons. + Note that \a caption is not always shown, it depends on the window manager. + + Please use information(), question(), warning(), or critical() instead. +*/ + +/*! + Opens an information message box with the caption \a caption and + the text \a text. The dialog may have up to three buttons. Each of + the buttons, \a button0, \a button1 and \a button2 may be set to + one of the following values: + + \list + \i TQMessageBox::NoButton + \i TQMessageBox::Ok + \i TQMessageBox::Cancel + \i TQMessageBox::Yes + \i TQMessageBox::No + \i TQMessageBox::Abort + \i TQMessageBox::Retry + \i TQMessageBox::Ignore + \i TQMessageBox::YesAll + \i TQMessageBox::NoAll + \endlist + + If you don't want all three buttons, set the last button, or last + two buttons to TQMessageBox::NoButton. + + One button can be OR-ed with \c TQMessageBox::Default, and one + button can be OR-ed with \c TQMessageBox::Escape. + + Returns the identity (TQMessageBox::Ok, or TQMessageBox::No, etc.) + of the button that was clicked. + + If \a tqparent is 0, the message box becomes an application-global + modal dialog box. If \a tqparent is a widget, the message box + becomes modal relative to \a tqparent. + + \sa question(), warning(), critical() +*/ + +int TQMessageBox::information( TQWidget *tqparent, + const TQString& caption, const TQString& text, + int button0, int button1, int button2 ) +{ + TQMessageBox *mb = new TQMessageBox( caption, text, Information, + button0, button1, button2, + tqparent, "qt_msgbox_information", TRUE, + (WFlags)TQt::WDestructiveClose); + TQ_CHECK_PTR( mb ); + return mb->exec(); +} + +/*! + Opens a question message box with the caption \a caption and the + text \a text. The dialog may have up to three buttons. Each of the + buttons, \a button0, \a button1 and \a button2 may be set to one + of the following values: + + \list + \i TQMessageBox::NoButton + \i TQMessageBox::Ok + \i TQMessageBox::Cancel + \i TQMessageBox::Yes + \i TQMessageBox::No + \i TQMessageBox::Abort + \i TQMessageBox::Retry + \i TQMessageBox::Ignore + \i TQMessageBox::YesAll + \i TQMessageBox::NoAll + \endlist + + If you don't want all three buttons, set the last button, or last + two buttons to TQMessageBox::NoButton. + + One button can be OR-ed with \c TQMessageBox::Default, and one + button can be OR-ed with \c TQMessageBox::Escape. + + Returns the identity (TQMessageBox::Yes, or TQMessageBox::No, etc.) + of the button that was clicked. + + If \a tqparent is 0, the message box becomes an application-global + modal dialog box. If \a tqparent is a widget, the message box + becomes modal relative to \a tqparent. + + \sa information(), warning(), critical() +*/ + +int TQMessageBox::question( TQWidget *tqparent, + const TQString& caption, const TQString& text, + int button0, int button1, int button2 ) +{ + TQMessageBox *mb = new TQMessageBox( caption, text, Question, + button0, button1, button2, + tqparent, "qt_msgbox_information", TRUE, + (WFlags)TQt::WDestructiveClose); + TQ_CHECK_PTR( mb ); + return mb->exec(); +} + + +/*! + Opens a warning message box with the caption \a caption and the + text \a text. The dialog may have up to three buttons. Each of the + button parameters, \a button0, \a button1 and \a button2 may be + set to one of the following values: + + \list + \i TQMessageBox::NoButton + \i TQMessageBox::Ok + \i TQMessageBox::Cancel + \i TQMessageBox::Yes + \i TQMessageBox::No + \i TQMessageBox::Abort + \i TQMessageBox::Retry + \i TQMessageBox::Ignore + \i TQMessageBox::YesAll + \i TQMessageBox::NoAll + \endlist + + If you don't want all three buttons, set the last button, or last + two buttons to TQMessageBox::NoButton. + + One button can be OR-ed with \c TQMessageBox::Default, and one + button can be OR-ed with \c TQMessageBox::Escape. + + Returns the identity (TQMessageBox::Ok, or TQMessageBox::No, etc.) + of the button that was clicked. + + If \a tqparent is 0, the message box becomes an application-global + modal dialog box. If \a tqparent is a widget, the message box + becomes modal relative to \a tqparent. + + \sa information(), question(), critical() +*/ + +int TQMessageBox::warning( TQWidget *tqparent, + const TQString& caption, const TQString& text, + int button0, int button1, int button2 ) +{ + TQMessageBox *mb = new TQMessageBox( caption, text, Warning, + button0, button1, button2, + tqparent, "qt_msgbox_warning", TRUE, + (WFlags)TQt::WDestructiveClose); + TQ_CHECK_PTR( mb ); + return mb->exec(); +} + + +/*! + Opens a critical message box with the caption \a caption and the + text \a text. The dialog may have up to three buttons. Each of the + button parameters, \a button0, \a button1 and \a button2 may be + set to one of the following values: + + \list + \i TQMessageBox::NoButton + \i TQMessageBox::Ok + \i TQMessageBox::Cancel + \i TQMessageBox::Yes + \i TQMessageBox::No + \i TQMessageBox::Abort + \i TQMessageBox::Retry + \i TQMessageBox::Ignore + \i TQMessageBox::YesAll + \i TQMessageBox::NoAll + \endlist + + If you don't want all three buttons, set the last button, or last + two buttons to TQMessageBox::NoButton. + + One button can be OR-ed with \c TQMessageBox::Default, and one + button can be OR-ed with \c TQMessageBox::Escape. + + Returns the identity (TQMessageBox::Ok, or TQMessageBox::No, etc.) + of the button that was clicked. + + If \a tqparent is 0, the message box becomes an application-global + modal dialog box. If \a tqparent is a widget, the message box + becomes modal relative to \a tqparent. + + \sa information(), question(), warning() +*/ + +int TQMessageBox::critical( TQWidget *tqparent, + const TQString& caption, const TQString& text, + int button0, int button1, int button2 ) +{ + TQMessageBox *mb = new TQMessageBox( caption, text, Critical, + button0, button1, button2, + tqparent, "qt_msgbox_critical", TRUE, + (WFlags)TQt::WDestructiveClose); + TQ_CHECK_PTR( mb ); + return mb->exec(); +} + + +/*! + Displays a simple about box with caption \a caption and text \a + text. The about box's tqparent is \a tqparent. + + about() looks for a suitable icon in four locations: + \list 1 + \i It prefers \link TQWidget::icon() tqparent->icon() \endlink if that exists. + \i If not, it tries the top-level widget containing \a tqparent. + \i If that fails, it tries the \link + TQApplication::mainWidget() main widget. \endlink + \i As a last resort it uses the Information icon. + \endlist + + The about box has a single button labelled "OK". + + \sa TQWidget::icon() TQApplication::mainWidget() +*/ + +void TQMessageBox::about( TQWidget *tqparent, const TQString &caption, + const TQString& text ) +{ + TQMessageBox *mb = new TQMessageBox( caption, text, + Information, + Ok + Default, 0, 0, + tqparent, "qt_msgbox_simple_about_box", TRUE, + (WFlags)TQt::WDestructiveClose); + TQ_CHECK_PTR( mb ); +#ifndef TQT_NO_WIDGET_TOPEXTRA + const TQPixmap *pm = tqparent ? tqparent->icon() : 0; + if ( pm && !pm->isNull() ) + mb->setIconPixmap( *pm ); + else { + pm = tqparent ? tqparent->tqtopLevelWidget()->icon() : 0; + if ( pm && !pm->isNull() ) + mb->setIconPixmap( *pm ); + else { + pm = tqApp && tqApp->mainWidget() ? tqApp->mainWidget()->icon() : 0; + if ( pm && !pm->isNull() ) + mb->setIconPixmap( *pm ); + } + } +#endif + mb->exec(); +} + + +/*! \reimp +*/ + +void TQMessageBox::styleChanged( TQStyle& ) +{ + if ( mbd->icon != NoIcon ) { + // Reload icon for new style + setIcon( mbd->icon ); + } +} + + +static int textBox( TQWidget *tqparent, TQMessageBox::Icon severity, + const TQString& caption, const TQString& text, + const TQString& button0Text, + const TQString& button1Text, + const TQString& button2Text, + int defaultButtonNumber, + int escapeButtonNumber ) +{ + int b[3]; + b[0] = 1; + b[1] = button1Text.isEmpty() ? 0 : 2; + b[2] = button2Text.isEmpty() ? 0 : 3; + + int i; + for( i=0; i<3; i++ ) { + if ( b[i] && defaultButtonNumber == i ) + b[i] += TQMessageBox::Default; + if ( b[i] && escapeButtonNumber == i ) + b[i] += TQMessageBox::Escape; + } + + TQMessageBox *mb = new TQMessageBox( caption, text, severity, + b[0], b[1], b[2], + tqparent, "qt_msgbox_information", TRUE, + (WFlags)TQt::WDestructiveClose); + TQ_CHECK_PTR( mb ); + if ( button0Text.isEmpty() ) + mb->setButtonText( 1, TQMessageBox::tr(mb_texts[TQMessageBox::Ok]) ); + else + mb->setButtonText( 1, button0Text ); + if ( b[1] ) + mb->setButtonText( 2, button1Text ); + if ( b[2] ) + mb->setButtonText( 3, button2Text ); + +#ifndef TQT_NO_CURSOR + mb->setCursor( Qt::ArrowCursor ); +#endif + return mb->exec() - 1; +} + + +/*! + \overload + + Displays an information message box with caption \a caption, text + \a text and one, two or three buttons. Returns the index of the + button that was clicked (0, 1 or 2). + + \a button0Text is the text of the first button, and is optional. + If \a button0Text is not supplied, "OK" (translated) will be used. + \a button1Text is the text of the second button, and is optional. + \a button2Text is the text of the third button, and is optional. + \a defaultButtonNumber (0, 1 or 2) is the index of the default + button; pressing Return or Enter is the same as clicking the + default button. It defaults to 0 (the first button). \a + escapeButtonNumber is the index of the Escape button; pressing + Escape is the same as clicking this button. It defaults to -1; + supply 0, 1 or 2 to make pressing Escape equivalent to clicking + the relevant button. + + If \a tqparent is 0, the message box becomes an application-global + modal dialog box. If \a tqparent is a widget, the message box + becomes modal relative to \a tqparent. + + Note: If you do not specify an Escape button then if the Escape + button is pressed then -1 will be returned. It is suggested that + you specify an Escape button to prevent this from happening. + + \sa question(), warning(), critical() +*/ + +int TQMessageBox::information( TQWidget *tqparent, const TQString &caption, + const TQString& text, + const TQString& button0Text, + const TQString& button1Text, + const TQString& button2Text, + int defaultButtonNumber, + int escapeButtonNumber ) +{ + return textBox( tqparent, Information, caption, text, + button0Text, button1Text, button2Text, + defaultButtonNumber, escapeButtonNumber ); +} + +/*! + \overload + + Displays a question message box with caption \a caption, text \a + text and one, two or three buttons. Returns the index of the + button that was clicked (0, 1 or 2). + + \a button0Text is the text of the first button, and is optional. + If \a button0Text is not supplied, "OK" (translated) will be used. + \a button1Text is the text of the second button, and is optional. + \a button2Text is the text of the third button, and is optional. + \a defaultButtonNumber (0, 1 or 2) is the index of the default + button; pressing Return or Enter is the same as clicking the + default button. It defaults to 0 (the first button). \a + escapeButtonNumber is the index of the Escape button; pressing + Escape is the same as clicking this button. It defaults to -1; + supply 0, 1 or 2 to make pressing Escape equivalent to clicking + the relevant button. + + If \a tqparent is 0, the message box becomes an application-global + modal dialog box. If \a tqparent is a widget, the message box + becomes modal relative to \a tqparent. + + Note: If you do not specify an Escape button then if the Escape + button is pressed then -1 will be returned. It is suggested that + you specify an Escape button to prevent this from happening. + + \sa information(), warning(), critical() +*/ +int TQMessageBox::question( TQWidget *tqparent, const TQString &caption, + const TQString& text, + const TQString& button0Text, + const TQString& button1Text, + const TQString& button2Text, + int defaultButtonNumber, + int escapeButtonNumber ) +{ + return textBox( tqparent, Question, caption, text, + button0Text, button1Text, button2Text, + defaultButtonNumber, escapeButtonNumber ); +} + + +/*! + \overload + + Displays a warning message box with a caption, a text, and 1, 2 or + 3 buttons. Returns the number of the button that was clicked (0, + 1, or 2). + + \a button0Text is the text of the first button, and is optional. + If \a button0Text is not supplied, "OK" (translated) will be used. + \a button1Text is the text of the second button, and is optional, + and \a button2Text is the text of the third button, and is + optional. \a defaultButtonNumber (0, 1 or 2) is the index of the + default button; pressing Return or Enter is the same as clicking + the default button. It defaults to 0 (the first button). \a + escapeButtonNumber is the index of the Escape button; pressing + Escape is the same as clicking this button. It defaults to -1; + supply 0, 1, or 2 to make pressing Escape equivalent to clicking + the relevant button. + + If \a tqparent is 0, the message box becomes an application-global + modal dialog box. If \a tqparent is a widget, the message box + becomes modal relative to \a tqparent. + + Note: If you do not specify an Escape button then if the Escape + button is pressed then -1 will be returned. It is suggested that + you specify an Escape button to prevent this from happening. + + \sa information(), question(), critical() +*/ + +int TQMessageBox::warning( TQWidget *tqparent, const TQString &caption, + const TQString& text, + const TQString& button0Text, + const TQString& button1Text, + const TQString& button2Text, + int defaultButtonNumber, + int escapeButtonNumber ) +{ + return textBox( tqparent, Warning, caption, text, + button0Text, button1Text, button2Text, + defaultButtonNumber, escapeButtonNumber ); +} + + +/*! + \overload + + Displays a critical error message box with a caption, a text, and + 1, 2 or 3 buttons. Returns the number of the button that was + clicked (0, 1 or 2). + + \a button0Text is the text of the first button, and is optional. + If \a button0Text is not supplied, "OK" (translated) will be used. + \a button1Text is the text of the second button, and is optional, + and \a button2Text is the text of the third button, and is + optional. \a defaultButtonNumber (0, 1 or 2) is the index of the + default button; pressing Return or Enter is the same as clicking + the default button. It defaults to 0 (the first button). \a + escapeButtonNumber is the index of the Escape button; pressing + Escape is the same as clicking this button. It defaults to -1; + supply 0, 1, or 2 to make pressing Escape equivalent to clicking + the relevant button. + + If \a tqparent is 0, the message box becomes an application-global + modal dialog box. If \a tqparent is a widget, the message box + becomes modal relative to \a tqparent. + + \sa information(), question(), warning() +*/ + +int TQMessageBox::critical( TQWidget *tqparent, const TQString &caption, + const TQString& text, + const TQString& button0Text, + const TQString& button1Text, + const TQString& button2Text, + int defaultButtonNumber, + int escapeButtonNumber ) +{ + return textBox( tqparent, Critical, caption, text, + button0Text, button1Text, button2Text, + defaultButtonNumber, escapeButtonNumber ); +} + + +/*! + Displays a simple message box about TQt, with caption \a caption + and centered over \a tqparent (if \a tqparent is not 0). The message + includes the version number of TQt being used by the application. + + This is useful for inclusion in the Help menu of an application. + See the examples/menu/menu.cpp example. + + TQApplication provides this functionality as a slot. + + \sa TQApplication::aboutTQt() +*/ + +void TQMessageBox::aboutTQt( TQWidget *tqparent, const TQString &caption ) +{ + TQMessageBox *mb = new TQMessageBox( tqparent, "qt_msgbox_about_qt" ); + TQ_CHECK_PTR( mb ); + mb->setWFlags( TQt::WDestructiveClose ); + +#ifndef TQT_NO_WIDGET_TOPEXTRA + TQString c = caption; + if ( c.isNull() ) + c = tr( "About TQt" ); + mb->setCaption( c ); +#endif + mb->setText( *translatedTextAboutTQt ); +#ifndef TQT_NO_IMAGEIO + TQPixmap pm; + TQImage logo( (const char **)qtlogo_xpm); + if ( tqGray(mb->tqpalette().active().text().rgb()) > + tqGray(mb->tqpalette().active().base().rgb()) ) + { + // light on dark, adjust some colors (where's 10?) + logo.setColor( 0, 0xffffffff ); + logo.setColor( 1, 0xff666666 ); + logo.setColor( 2, 0xffcccc66 ); + logo.setColor( 4, 0xffcccccc ); + logo.setColor( 6, 0xffffff66 ); + logo.setColor( 7, 0xff999999 ); + logo.setColor( 8, 0xff3333ff ); + logo.setColor( 9, 0xffffff33 ); + logo.setColor( 11, 0xffcccc99 ); + } + if ( pm.convertFromImage( logo ) ) + mb->setIconPixmap( pm ); +#endif + mb->setButtonText( 0, tr("OK") ); + if ( mb->mbd && mb->mbd->pb[0] ) { + mb->mbd->pb[0]->setAutoDefault( TRUE ); + mb->mbd->pb[0]->setFocusPolicy( Qt::StrongFocus ); + mb->mbd->pb[0]->setDefault( TRUE ); + mb->mbd->pb[0]->setFocus(); + } + mb->exec(); +} + +/*! + \reimp +*/ + +void TQMessageBox::setIcon( const TQPixmap &pix ) +{ + //reimplemented to avoid compiler warning. +#ifndef TQT_NO_WIDGET_TOPEXTRA + TQDialog::setIcon( pix ); +#endif +} + + +/*! + \property TQMessageBox::textFormat + \brief the format of the text displayed by the message box + + The current text format used by the message box. See the \l + TQt::TextFormat enum for an explanation of the possible options. + + The default format is \c AutoText. + + \sa setText() +*/ + +TQt::TextFormat TQMessageBox::textFormat() const +{ + return label->textFormat(); +} + + +void TQMessageBox::setTextFormat( TQt::TextFormat format ) +{ + label->setTextFormat( format ); +} + + +#endif |