Planeshift

pawsyesnobox.h

Go to the documentation of this file.
00001 /*
00002  * pawsyesnobox.h - Author: Andrew Craig
00003  *
00004  * Copyright (C) 2003 Atomic Blue ([email protected], http://www.atomicblue.org)
00005  *
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation (version 2 of the License)
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017  *
00018  */
00019 
00020 #ifndef PAWS_YESNO_BOX_HEADER
00021 #define PAWS_YESNO_BOX_HEADER
00022 
00023 #include "pawswidget.h"
00024 class pawsMultiLineTextBox;
00025 
00030 
00031 //  GUI BUTTONS
00033 #define CONFIRM_YES -10
00034 #define CONFIRM_NO  -20
00035 
00036 
00037 typedef void (*YesNoResponseFunc)(bool, void*);
00038 
00041 class pawsYesNoBox : public pawsWidget
00042 {
00043 public:
00044 
00045     pawsYesNoBox();
00046     pawsYesNoBox(const pawsYesNoBox &origin);
00047     virtual ~pawsYesNoBox();
00048 
00049     bool OnButtonReleased(int mouseButton, int keyModifier, pawsWidget* widget);
00050     void SetNotify(pawsWidget* widget);
00051 
00052     bool PostSetup();
00053     void SetText(const char* text);
00054 
00055     void SetID(int yes = CONFIRM_YES, int no = CONFIRM_NO);
00056     void Hide();
00057     void SetCallBack(YesNoResponseFunc handler , void* owner, const char* text);
00058 
00061     static pawsYesNoBox* Create(pawsWidget* notify, const csString &text,
00062                                 int yesID = CONFIRM_YES, int noID = CONFIRM_NO);
00063 private:
00064     YesNoResponseFunc handler;
00065     void* owner;
00066 
00067     pawsMultiLineTextBox* text;
00068     pawsWidget* notify;
00069 
00070     pawsWidget* yesButton;
00071     pawsWidget* noButton;
00072     bool useCustomIDs;
00073 };
00074 
00075 CREATE_PAWS_FACTORY(pawsYesNoBox);
00076 
00079 #endif
00080 
00081