X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7c78e7c70271608b076b1dbed201b1204e6898d4..aa8fb7a0164e989e09d2b78867633399a740f1d3:/src/qt/listbox.cpp diff --git a/src/qt/listbox.cpp b/src/qt/listbox.cpp index c1893d546f..a54523ab3d 100644 --- a/src/qt/listbox.cpp +++ b/src/qt/listbox.cpp @@ -1,137 +1,240 @@ -///////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// // 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" +#if !USE_SHARED_LIBRARY + IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl) +#endif -IMPLEMENT_DYNAMIC_CLASS(wxListBox,wxControl) +// ============================================================================ +// list box control implementation +// ============================================================================ -wxListBox::wxListBox(void) +// Listbox item +wxListBox::wxListBox() { -}; + m_noItems = 0; + m_selected = 0; +} -wxListBox::wxListBox( wxWindow *parent, wxWindowID id, - const wxPoint &pos, const wxSize &size, - int n, const wxString choices[], - long style, const wxString &name ) +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) { - Create( parent, id, pos, size, n, choices, style, name ); -}; + m_noItems = n; + m_selected = 0; + + SetName(name); + SetValidator(validator); + + if (parent) parent->AddChild(this); + + wxSystemSettings settings; + 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 ) + m_windowId = ( id == -1 ) ? (int)NewControlId() : id; + + // TODO create listbox + + return FALSE; +} + +wxListBox::~wxListBox() { - return TRUE; -}; +} -void wxListBox::Append( const wxString &item ) +void wxListBox::SetupColours() { - Append( item, (char*)NULL ); -}; + SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW)); +} -void wxListBox::Append( const wxString &WXUNUSED(item), char *WXUNUSED(clientData) ) +void wxListBox::SetFirstItem(int N) { -}; + // TODO +} -void wxListBox::Clear(void) +void wxListBox::SetFirstItem(const wxString& s) { -}; + // TODO +} -void wxListBox::Delete( int WXUNUSED(n) ) +void wxListBox::Delete(int N) { -}; + m_noItems --; + // TODO +} -void wxListBox::Deselect( int WXUNUSED(n) ) +void wxListBox::Append(const wxString& item) { -}; + m_noItems ++; + + // TODO +} -int wxListBox::FindString( const wxString &WXUNUSED(item) ) const +void wxListBox::Append(const wxString& item, char *Client_data) { - return -1; -}; + m_noItems ++; + + // TODO +} -char *wxListBox::GetClientData( int WXUNUSED(n) ) const +void wxListBox::Set(int n, const wxString *choices, char** clientData) { - return (char*)NULL; -}; + m_noItems = n; -int wxListBox::GetSelection(void) const + // TODO +} + +int wxListBox::FindString(const wxString& s) const { - return -1; -}; + // TODO + return -1; +} -int wxListBox::GetSelections( wxArrayInt& WXUNUSED(aSelections) ) const +void wxListBox::Clear() { - return 0; -}; + m_noItems = 0; + // TODO +} -wxString wxListBox::GetString( int WXUNUSED(n) ) const +void wxListBox::SetSelection(int N, bool select) { - return ""; -}; + // TODO +} -wxString wxListBox::GetStringSelection(void) const +bool wxListBox::Selected(int N) const { - return ""; -}; + // TODO + return FALSE; +} -int wxListBox::Number(void) +void wxListBox::Deselect(int N) { - return 0; -}; + // TODO +} -bool wxListBox::Selected( int WXUNUSED(n) ) +char *wxListBox::GetClientData(int N) const { - return FALSE; -}; + // TODO + return (char *)NULL; +} + +void wxListBox::SetClientData(int N, char *Client_data) +{ + // TODO +} + +// Return number of selections and an array of selected integers +int wxListBox::GetSelections(wxArrayInt& aSelections) const +{ + 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); +}