FXPrimaryButton.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                             Primary Dialog Button                             *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2004-2006 by Niall Douglas.   All Rights Reserved.              *
00007 *       NOTE THAT I DO NOT PERMIT ANY OF MY CODE TO BE PROMOTED TO THE GPL      *
00008 *********************************************************************************
00009 * This code is free software; you can redistribute it and/or modify it under    *
00010 * the terms of the GNU Library General Public License v2.1 as published by the  *
00011 * Free Software Foundation EXCEPT that clause 3 does not apply ie; you may not  *
00012 * "upgrade" this code to the GPL without my prior written permission.           *
00013 * Please consult the file "License_Addendum2.txt" accompanying this file.       *
00014 *                                                                               *
00015 * This code is distributed in the hope that it will be useful,                  *
00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                          *
00018 *********************************************************************************
00019 * $Id:                                                                          *
00020 ********************************************************************************/
00021 
00022 #if !defined(FXPRIMARYBUTTON_H) && !defined(FX_DISABLEGUI)
00023 #define FXPRIMARYBUTTON_H
00024 
00025 #include "FXButton.h"
00026 #include "FXPacker.h"
00027 #include <qptrvector.h>
00028 
00029 namespace FX {
00030 
00035 #ifdef _MSC_VER
00036 #pragma warning(push)
00037 #pragma warning(disable: 4251)
00038 #endif
00039 
00052 class FXAPI FXApplyResetList
00053 {
00054     QPtrVector<FXWindow> mywidgets;
00055 protected:
00056     FXApplyResetList() { }
00057 public:
00059     long onApply(FXObject*,FXSelector,void*);
00061     long onReset(FXObject*,FXSelector,void*);
00062 
00064     template<typename type> type *addApplyReset(type *widget)
00065     {
00066         mywidgets.append(widget);
00067         return widget;
00068     }
00070     void removeApplyReset(FXWindow *widget) { mywidgets.removeRef(widget); }
00072     void clearApplyReset() { mywidgets.clear(); }
00073 };
00074 #ifdef _MSC_VER
00075 #pragma warning(pop)
00076 #endif
00077 
00079 enum
00080 {
00081     PBUTTON_POSITIVE = 0x20000000,  
00082     PBUTTON_NEGATIVE = 0x40000000,  
00083     PBUTTON_NOAUTOLAYOUT = 0x80000000, 
00084     PBUTTON_NORMAL=BUTTON_NORMAL|LAYOUT_BOTTOM,
00086     PBUTTON_OK     = PBUTTON_NORMAL|PBUTTON_POSITIVE,
00088     PBUTTON_CANCEL = PBUTTON_NORMAL|PBUTTON_NEGATIVE,
00090     PBUTTON_DEFOK    = BUTTON_INITIAL|BUTTON_DEFAULT|PBUTTON_OK,
00092     PBUTTON_DEFCANCEL= BUTTON_INITIAL|BUTTON_DEFAULT|PBUTTON_CANCEL
00093 };
00094 
00095 
00139 class FXAPI FXPrimaryButton : public FXButton
00140 {
00141     FXDECLARE(FXPrimaryButton)
00142     FXColor surcol;
00143     FXint surwidth;
00144     FXPrimaryButton(const FXPrimaryButton &);
00145     FXPrimaryButton &operator=(const FXPrimaryButton &);
00146 protected:
00147     FXPrimaryButton() {}
00148 public:
00150     FXPrimaryButton(FXComposite *parent,const FXString &text,FXIcon *icon=NULL,
00151         FXObject *tgt=NULL,FXSelector sel=0,FXuint opts=PBUTTON_NORMAL,
00152         FXint x=0,FXint y=0,FXint w=0,FXint h=0,
00153         FXint pl=DEFAULT_PAD*4,FXint pr=DEFAULT_PAD*4,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD,
00154 #ifdef BUILDING_TCOMMON
00155         FXint sr=FXMAX(2, DEFAULT_SPACING));
00156 #else
00157         FXint sr=0);
00158 #endif
00159 public:
00160     long onPaint(FXObject*,FXSelector,void*);
00161     long onMiddleBtnRelease(FXObject*,FXSelector,void*);
00162 public:
00164     FXColor surroundColour() const throw();
00166     void setSurroundColour(FXColor c) throw();
00167 
00168     virtual void save(FXStream &store) const;
00169     virtual void load(FXStream &store);
00170 };
00171 
00172 } // namespace
00173 
00174 #endif

(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:31:23 2009 for TnFOX by doxygen v1.4.7