///////////////////////////////////////////////////////////////////////////////
-// Name: listbox.cpp
+// Name: src/motif/listbox.cpp
// Purpose: wxListBox
// Author: Julian Smart
// Modified by:
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
- #pragma implementation "listbox.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
{
if( !wxControl::CreateControl( parent, id, pos, size, style,
validator, name ) )
- return FALSE;
+ return false;
m_noItems = n;
m_backgroundColour = * wxWHITE;
Widget parentWidget = (Widget) parent->GetClientWidget();
-
- WXFontType fontType = (WXFontType)NULL;
-
- if( m_font.Ok() )
- {
- fontType = m_font.GetFontType(XtDisplay(parentWidget));
- }
+ Display* dpy = XtDisplay(parentWidget);
Arg args[4];
int count = 0;
( m_windowStyle & wxLB_EXTENDED ) ? XmEXTENDED_SELECT :
XmBROWSE_SELECT );
++count;
- if( fontType )
+ if( m_font.Ok() )
{
- XtSetArg( args[count], (String)wxFont::GetFontTag(), fontType );
+ XtSetArg( args[count],
+ (String)wxFont::GetFontTag(), m_font.GetFontTypeC(dpy) );
++count;
}
if( m_windowStyle & wxLB_ALWAYS_SB )
ChangeBackgroundColour();
- return TRUE;
+ return true;
}
bool wxListBox::Create(wxWindow *parent, wxWindowID id,
if ( clientData )
for (i = 0; i < items.GetCount(); ++i)
- m_clientDataDict.Set(i, (wxClientData*)clientData[i], FALSE);
+ m_clientDataDict.Set(i, (wxClientData*)clientData[i], false);
XmListAddItems (listBox, text, items.GetCount(), 0);
for (i = 0; i < items.GetCount(); i++)
return -1;
}
-int wxListBox::FindString(const wxString& s) const
+int wxListBox::FindString(const wxString& s, bool WXUNUSED(bCase)) const
{
+ // FIXME: back to base class for not supported value of bCase
+
return wxDoFindStringInList( (Widget)m_mainWidget, s );
}
m_noItems = 0;
}
-void wxListBox::SetSelection(int N, bool select)
+void wxListBox::DoSetSelection(int N, bool select)
{
- m_inSetValue = TRUE;
+ m_inSetValue = true;
if (select)
{
#if 0
int i;
for (i = 0; i < n; i++)
XmListSelectPos ((Widget) m_mainWidget,
- selections[i] + 1, FALSE);
+ selections[i] + 1, False);
- XmListSelectPos ((Widget) m_mainWidget, N + 1, FALSE);
+ XmListSelectPos ((Widget) m_mainWidget, N + 1, False);
XtVaSetValues ((Widget) m_mainWidget,
XmNselectionPolicy, XmEXTENDED_SELECT,
}
else
#endif // 0
- XmListSelectPos ((Widget) m_mainWidget, N + 1, FALSE);
+ XmListSelectPos ((Widget) m_mainWidget, N + 1, False);
}
else
XmListDeselectPos ((Widget) m_mainWidget, N + 1);
- m_inSetValue = FALSE;
+ m_inSetValue = false;
}
bool wxListBox::IsSelected(int N) const
wxArrayInt theSelections;
int count = GetSelections (theSelections);
if (count == 0)
- return FALSE;
+ return false;
else
{
int j;
for (j = 0; j < count; j++)
if (theSelections[j] == N)
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
void wxListBox::DoSetItemClientObject(int n, wxClientData* clientData)
{
- m_clientDataDict.Set(n, clientData, FALSE);
+ m_clientDataDict.Set(n, clientData, false);
}
wxClientData* wxListBox::DoGetItemClientObject(int n) const
void wxListBox::DoSetItemClientData(int N, void *Client_data)
{
- m_clientDataDict.Set(N, (wxClientData*)Client_data, FALSE);
+ m_clientDataDict.Set(N, (wxClientData*)Client_data, false);
}
// Return number of selections and an array of selected integers
void wxListBox::Command (wxCommandEvent & event)
{
- if (event.m_extraLong)
- SetSelection (event.m_commandInt);
+ if (event.GetExtraLong())
+ SetSelection (event.GetInt());
else
{
- Deselect (event.m_commandInt);
+ Deselect (event.GetInt());
return;
}
ProcessCommand (event);
event.SetClientObject( item->GetClientObject(n) );
else if ( item->HasClientUntypedData() )
event.SetClientData( item->GetClientData(n) );
- event.m_commandInt = n;
- event.m_extraLong = TRUE;
+ event.SetInt(n);
+ event.SetExtraLong(true);
event.SetEventObject(item);
event.SetString( item->GetString( n ) );
* function to change them (by default, taken from wxSystemSettings)
*/
wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
- wxDoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE);
- wxDoChangeBackgroundColour((WXWidget) vsb, backgroundColour, TRUE);
+ wxDoChangeBackgroundColour((WXWidget) hsb, backgroundColour, true);
+ wxDoChangeBackgroundColour((WXWidget) vsb, backgroundColour, true);
XtVaSetValues (hsb,
XmNtroughColor, backgroundColour.AllocColour(XtDisplay(hsb)),
NULL);
// MBN: why change parent's background? It looks really ugly.
- // wxDoChangeBackgroundColour((WXWidget) parent, m_backgroundColour, TRUE);
+ // wxDoChangeBackgroundColour((WXWidget) parent, m_backgroundColour, true);
}
void wxListBox::ChangeForegroundColour()
{
return wxDoGetListBoxBestSize( (Widget)m_mainWidget, this );
}
-