X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7c78e7c70271608b076b1dbed201b1204e6898d4..0bbfe845edd561191700de32c2b4d0965a5c15b5:/src/qt/listbox.cpp diff --git a/src/qt/listbox.cpp b/src/qt/listbox.cpp index c1893d546f..f3d95d0d97 100644 --- a/src/qt/listbox.cpp +++ b/src/qt/listbox.cpp @@ -1,137 +1,238 @@ -///////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// // Name: listbox.cpp -// Purpose: -// Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - +// Purpose: wxListBox +// Author: AUTHOR +// Modified by: +// Created: ??/??/98 +// RCS-ID: $Id$ +// Copyright: (c) AUTHOR +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ #pragma implementation "listbox.h" #endif -#include "wx/dynarray.h" #include "wx/listbox.h" -#include "wx/utils.h" -//----------------------------------------------------------------------------- -// wxListBox -//----------------------------------------------------------------------------- +#include "wx/dynarray.h" +#include "wx/log.h" + + IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl) + +// ============================================================================ +// list box control implementation +// ============================================================================ + +// Listbox item +wxListBox::wxListBox() +{ + m_noItems = 0; + m_selected = 0; +} + +bool wxListBox::Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + int n, const wxString choices[], + long style, + const wxValidator& validator, + const wxString& name) +{ + m_noItems = n; + m_selected = 0; + + SetName(name); + SetValidator(validator); + + if (parent) parent->AddChild(this); + + wxSystemSettings settings; + SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW)); + m_windowId = ( id == -1 ) ? (int)NewControlId() : id; -IMPLEMENT_DYNAMIC_CLASS(wxListBox,wxControl) + // TODO create listbox -wxListBox::wxListBox(void) + return FALSE; +} + +wxListBox::~wxListBox() { -}; +} -wxListBox::wxListBox( wxWindow *parent, wxWindowID id, - const wxPoint &pos, const wxSize &size, - int n, const wxString choices[], - long style, const wxString &name ) +void wxListBox::SetupColours() { - Create( parent, id, pos, size, n, choices, style, name ); -}; + SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW)); +} -bool wxListBox::Create( wxWindow *parent, wxWindowID id, - const wxPoint &pos, const wxSize &size, - int n, const wxString choices[], - long style, const wxString &name ) +void wxListBox::SetFirstItem(int N) { - return TRUE; -}; + // TODO +} -void wxListBox::Append( const wxString &item ) +void wxListBox::SetFirstItem(const wxString& s) { - Append( item, (char*)NULL ); -}; + // TODO +} -void wxListBox::Append( const wxString &WXUNUSED(item), char *WXUNUSED(clientData) ) +void wxListBox::Delete(int N) { -}; + m_noItems --; + // TODO +} -void wxListBox::Clear(void) +void wxListBox::Append(const wxString& item) { -}; + m_noItems ++; + + // TODO +} -void wxListBox::Delete( int WXUNUSED(n) ) +void wxListBox::Append(const wxString& item, char *Client_data) { -}; + m_noItems ++; -void wxListBox::Deselect( int WXUNUSED(n) ) + // TODO +} + +void wxListBox::Set(int n, const wxString *choices, char** clientData) { -}; + m_noItems = n; + + // TODO +} -int wxListBox::FindString( const wxString &WXUNUSED(item) ) const +int wxListBox::FindString(const wxString& s) const { - return -1; -}; + // TODO + return -1; +} -char *wxListBox::GetClientData( int WXUNUSED(n) ) const +void wxListBox::Clear() { - return (char*)NULL; -}; + m_noItems = 0; + // TODO +} -int wxListBox::GetSelection(void) const +void wxListBox::SetSelection(int N, bool select) { - return -1; -}; + // TODO +} -int wxListBox::GetSelections( wxArrayInt& WXUNUSED(aSelections) ) const +bool wxListBox::Selected(int N) const { - return 0; -}; + // TODO + return FALSE; +} -wxString wxListBox::GetString( int WXUNUSED(n) ) const +void wxListBox::Deselect(int N) { - return ""; -}; + // TODO +} -wxString wxListBox::GetStringSelection(void) const +char *wxListBox::GetClientData(int N) const { - return ""; -}; + // TODO + return (char *)NULL; +} -int wxListBox::Number(void) +void wxListBox::SetClientData(int N, char *Client_data) { - return 0; -}; + // TODO +} -bool wxListBox::Selected( int WXUNUSED(n) ) +// Return number of selections and an array of selected integers +int wxListBox::GetSelections(wxArrayInt& aSelections) const { - return FALSE; -}; + aSelections.Empty(); -void wxListBox::Set( int WXUNUSED(n), const wxString *WXUNUSED(choices) ) +/* TODO + if ((m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED)) + { + int no_sel = ?? + for ( int n = 0; n < no_sel; n++ ) + aSelections.Add(??); + + return no_sel; + } + else // single-selection listbox + { + aSelections.Add(??); + + return 1; + } +*/ + return 0; +} + +// Get single selection, for single choice list items +int wxListBox::GetSelection() const { -}; + // TODO + return -1; +} -void wxListBox::SetClientData( int WXUNUSED(n), char *WXUNUSED(clientData) ) +// Find string for position +wxString wxListBox::GetString(int N) const { -}; + // TODO + return wxString(""); +} -void wxListBox::SetFirstItem( int WXUNUSED(n) ) +void wxListBox::SetSize(int x, int y, int width, int height, int sizeFlags) { -}; + // TODO +} -void wxListBox::SetFirstItem( const wxString &WXUNUSED(item) ) +void wxListBox::InsertItems(int nItems, const wxString items[], int pos) { -}; + m_noItems += nItems; -void wxListBox::SetSelection( int WXUNUSED(n), bool WXUNUSED(select) ) + // TODO +} + +void wxListBox::SetString(int N, const wxString& s) { -}; + // TODO +} -void wxListBox::SetString( int WXUNUSED(n), const wxString &WXUNUSED(string) ) +int wxListBox::Number () const { -}; + return m_noItems; +} -void wxListBox::SetStringSelection( const wxString &WXUNUSED(string), bool WXUNUSED(select) ) +// For single selection items only +wxString wxListBox::GetStringSelection () const { -}; + int sel = GetSelection (); + if (sel > -1) + return this->GetString (sel); + else + return wxString(""); +} +bool wxListBox::SetStringSelection (const wxString& s, bool flag) +{ + int sel = FindString (s); + if (sel > -1) + { + SetSelection (sel, flag); + return TRUE; + } + else + return FALSE; +} +void wxListBox::Command (wxCommandEvent & event) +{ + if (event.m_extraLong) + SetSelection (event.m_commandInt); + else + { + Deselect (event.m_commandInt); + return; + } + ProcessCommand (event); +}