Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXChoiceBox.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * C h o i c e B o x *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2004,2006 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 *********************************************************************************
22 * $Id: FXChoiceBox.h,v 1.8 2006/01/22 17:57:59 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXCHOICEBOX_H
25 #define FXCHOICEBOX_H
26 
27 #ifndef FXDIALOGBOX_H
28 #include "FXDialogBox.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 class FXList;
35 
36 
37 /**
38 * The Choice Box provides a dialog panel to select one item out of a list
39 * of choices. The choices are provided as a list of text strings.
40 * When the dialog closes, the index of the selected choice is returned,
41 * while a -1 is returned if the dialog was canceled,
42 */
43 class FXAPI FXChoiceBox : public FXDialogBox {
45 protected:
46  FXList *list;
47 protected:
48  FXChoiceBox(){}
49 private:
51  FXChoiceBox &operator=(const FXChoiceBox&);
52  void initialize(const FXString& text,FXIcon* icon);
53 public:
54  long onCmdClicked(FXObject*,FXSelector,void*);
55  long onCmdCancel(FXObject*,FXSelector,void*);
56 public:
57  enum{
58  ID_CLICKED=FXDialogBox::ID_LAST,
59  ID_LAST
60  };
61 public:
62 
63  /// Construct choice box with given caption, icon, message text, and with choices from array of strings
64  FXChoiceBox(FXWindow* owner,const FXString& caption,const FXString& text,FXIcon* icon,const FXchar** choices,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
65 
66  /// Construct choice box with given caption, icon, message text, and with choices from newline separated strings
67  FXChoiceBox(FXWindow* owner,const FXString& caption,const FXString& text,FXIcon* icon,const FXString& choices,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
68 
69  /// Construct free floating choice box with given caption, icon, message text, and with choices from array of strings
70  FXChoiceBox(FXApp* app,const FXString& caption,const FXString& text,FXIcon* icon,const FXchar** choices,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
71 
72  /// Construct free floating choice box with given caption, icon, message text, and with choices from newline separated strings
73  FXChoiceBox(FXApp* app,const FXString& caption,const FXString& text,FXIcon* icon,const FXString& choices,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
74 
75  /**
76  * Show a modal choice dialog.
77  * Prompt the user using a dialog with given caption, icon,
78  * message text, and with choices from newline array of strings.
79  * The return value is -1 if cancelled, or the given choice.
80  */
81  static FXint ask(FXWindow* owner,FXuint opts,const FXString& caption,const FXString& text,FXIcon* icon,const FXchar** choices);
82 
83  /**
84  * Show a modal choice dialog.
85  * Prompt the user using a dialog with given caption, icon,
86  * message text, and with choices from newline separated strings.
87  * The return value is -1 if cancelled, or the given choice
88  */
89  static FXint ask(FXWindow* owner,FXuint opts,const FXString& caption,const FXString& text,FXIcon* icon,const FXString& choices);
90 
91  /**
92  * Show modal choice message, in free floating window.
93  * Prompt the user using a dialog with given caption, icon,
94  * message text, and with choices from newline array of strings.
95  * The return value is -1 if cancelled, or the given choice
96  */
97  static FXint ask(FXApp* app,FXuint opts,const FXString& caption,const FXString& text,FXIcon* icon,const FXchar** choices);
98 
99  /**
100  * Show modal choice message, in free floating window.
101  * Prompt the user using a dialog with given caption, icon,
102  * message text, and with choices from newline separated strings.
103  * The return value is -1 if cancelled, or the given choice
104  */
105  static FXint ask(FXApp* app,FXuint opts,const FXString& caption,const FXString& text,FXIcon* icon,const FXString& choices);
106 
107 
108  /// Save choice box to a stream
109  virtual void save(FXStream& store) const;
110 
111  /// Load choice box from a stream
112  virtual void load(FXStream& store);
113 
114  /// Destroy choice box
115  virtual ~FXChoiceBox();
116  };
117 
118 }
119 
120 #endif
DialogBox window.
Definition: FXDialogBox.h:40
char FXchar
Definition: fxdefs.h:387
Base class for all windows.
Definition: FXWindow.h:115
unsigned int FXuint
Definition: fxdefs.h:396
FXuint FXSelector
Association key.
Definition: FXObject.h:53
#define FXAPI
Definition: fxdefs.h:122
Application Object.
Definition: FXApp.h:158
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:99
A List Widget displays a list of items, each with a text and optional icon.
Definition: FXList.h:167
Definition: FX4Splitter.h:31
int FXint
Definition: fxdefs.h:397
An Icon is an image with two additional server-side resources: a shape bitmap, which is used to mask ...
Definition: FXIcon.h:45
The Choice Box provides a dialog panel to select one item out of a list of choices.
Definition: FXChoiceBox.h:43
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
Definition: FXDialogBox.h:51
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92
FXString provides essential string manipulation capabilities.
Definition: FXString.h:33

Copyright © 1997-2005 Jeroen van der Zijp