Back to index

plt-scheme  4.2.1
Choice.h
Go to the documentation of this file.
00001 /*                                                      -*- C++ -*-
00002  *
00003  * Purpose: choice panel item
00004  *
00005  * Authors: Markus Holzem and Julian Smart
00006  *
00007  * Copyright: (C) 2004-2009 PLT Scheme Inc.
00008  * Copyright: (C) 1995, AIAI, University of Edinburgh (Julian)
00009  * Copyright: (C) 1995, GNU (Markus)
00010  *
00011  * This program is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License as published by
00013  * the Free Software Foundation; either version 2 of the License, or
00014  * (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00024  * 02110-1301 USA.
00025  */
00026 
00027 #ifndef Choice_h
00028 #define Choice_h
00029 
00030 #ifdef __GNUG__
00031 #pragma interface
00032 #endif
00033 
00034 class wxMenu;
00035 class wxPanel;
00036 
00037 // Choice item
00038 class wxChoice : public wxItem {
00039 public:
00040     wxChoice(wxPanel *panel, wxFunction func, char *label,
00041             int x = -1, int y = -1, int width = -1, int height = -1,
00042             int n = 0, char **choices = NULL,
00043             long style = 0, wxFont *_font = NULL, char *name = "choice");
00044     ~wxChoice(void);
00045 
00046     Bool Create(wxPanel *panel, wxFunction func, char *label,
00047               int x = -1, int y = -1, int width = -1, int height = -1,
00048               int n = 0, char **choices = NULL,
00049               long style = 0, char *name = "choice");
00050 
00051     void  Append(char *item);
00052     void  Clear(void);
00053     int   FindString(char *s);
00054     int   GetSelection(void) { return selection; }
00055     char  *GetString(int n);
00056     char  *GetStringSelection(void);
00057     void  SetSelection(int n);
00058     Bool  SetStringSelection(char *s);
00059     inline int Number() { return num_choices; }
00060 
00061     /* MATTHEW: [6] */
00062     virtual void  GetSize(int *width, int *height);
00063 
00064     // can't handle them
00065     int   GetColumns(void) { return 1; }
00066     void  SetColoumns(int WXUNUSED(n=1)) {};
00067 
00068     void Command(wxCommandEvent *event);
00069 
00070     void OnEvent(wxMouseEvent*);
00071     void OnChar(wxKeyEvent*);
00072 
00073     virtual void ChangeToGray(Bool gray);
00074 
00075 private:
00076 #   ifdef Have_Xt_Types
00077     static void EventCallback(Widget, XtPointer, XtPointer);
00078     static void MenuEventCallback(wxObject*, wxCommandEvent*);
00079 #endif
00080     wxMenu *choice_menu;
00081     int    num_choices;
00082     int    selection;
00083 };
00084 
00085 #endif // Choice_h