Back to index

plt-scheme  4.2.1
ListBox.h
Go to the documentation of this file.
00001 /*                                                      -*- C++ -*-
00002  *
00003  * Purpose: list box 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 ListBox_h
00028 #define ListBox_h
00029 
00030 #ifdef __GNUG__
00031 #pragma interface
00032 #endif
00033 
00034 class wxPanel;
00035 
00036 class wxListBox : public wxItem {
00037 public:
00038     wxListBox(wxPanel *panel, wxFunction func, char *title,
00039              Bool Multiple = FALSE,
00040              int x = -1, int y = -1, int width = -1, int height = -1,
00041              int n = 0, char **Choices = NULL,
00042              long style = 0, wxFont *_font = NULL, wxFont *_label_font = NULL, char *name = "listBox");
00043     ~wxListBox(void);
00044 
00045     // override parent methods
00046     virtual void SetSize(int width, int height) { SetSize(-1, -1, width, height); }
00047     virtual void SetSize(int x, int y, int width, int height, int flags=wxSIZE_AUTO);
00048     // handle the contents of the list
00049     void  Append(char *item);
00050     void  Append(char *item, char *client_data);
00051     void  Clear(void);
00052     Bool  Create(wxPanel *panel, wxFunction func, char *title,
00053                Bool multiple = FALSE,
00054                int x = -1, int y = -1, int width = -1, int height = -1,
00055                int n = 0, char **choices = NULL,
00056                long style = 0, char *name = "listBox");
00057     void  Delete(int n);
00058     void  Deselect(int n);
00059     int   FindString(char *s);
00060     char  *GetClientData(int n);
00061     int   GetSelection(void);
00062     int   GetSelections(int **list_selections);
00063     char  *GetString(int n);
00064     char  *GetStringSelection(void);
00065     void  SetString(int n, char *choice);
00066     void  InsertItems(int n_items, char **items, int pos);
00067     int   Number(void);
00068     Bool  Selected(int n);
00069     void  Set(int n, char *choices[]);
00070     void  SetClientData(int n, char *client_data);
00071     void  SetFirstItem(int n);
00072     void  SetFirstItem(char *s);
00073     void  SetSelection(int c, Bool select = TRUE);
00074     void  SetOneSelection(int c);
00075     Bool  SetStringSelection(char *s);
00076     int   GetFirstItem();
00077     int   NumberOfVisibleItems();
00078     void  Command(wxCommandEvent *event);
00079     void  OnChar(wxKeyEvent *e);
00080 
00081     void OnScroll(wxScrollEvent* event);
00082     void OnSize(int width, int height);
00083 
00084     wxFont *GetLabelFont() { return label_font; }
00085 
00086 private:
00087     void OnListSize(int width, int height);
00088 
00089 #   ifdef Have_Xt_Types
00090     static void EventCallback(Widget w, XtPointer, XtPointer);
00091 #   endif
00092     void  SetInternalData(void);
00093 
00094     char    **choices;
00095     char    **client_data;
00096     int     num_choices, num_free;
00097 
00098     char    typing[16];
00099     int     typepos;
00100     long    typetime;
00101 
00102     wxFont *label_font;
00103 };
00104 
00105 #endif // ListBox_h