Some tweaks to make the AutoComplete list box behave better, and a few

other little things


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@8611 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2000-10-21 22:09:00 +00:00
parent f1c90907c3
commit be62e9322d
6 changed files with 76 additions and 8 deletions

View File

@@ -446,6 +446,27 @@ void Window::SetTitle(const char *s) {
} }
class wxSTCListBox : public wxListBox {
public:
wxSTCListBox(wxWindow* parent, wxWindowID id)
: wxListBox(parent, id, wxDefaultPosition, wxDefaultSize,
0, NULL, wxLB_SINGLE | wxLB_SORT | wxSIMPLE_BORDER)
{}
void OnFocus(wxFocusEvent& event) {
GetParent()->SetFocus();
event.Skip();
}
private:
DECLARE_EVENT_TABLE()
};
BEGIN_EVENT_TABLE(wxSTCListBox, wxListBox)
EVT_SET_FOCUS(wxSTCListBox::OnFocus)
END_EVENT_TABLE()
ListBox::ListBox() { ListBox::ListBox() {
} }
@@ -454,8 +475,9 @@ ListBox::~ListBox() {
} }
void ListBox::Create(Window &parent, int ctrlID) { void ListBox::Create(Window &parent, int ctrlID) {
id = new wxListBox(parent.id, ctrlID, wxDefaultPosition, wxDefaultSize, id = new wxSTCListBox(parent.id, ctrlID);
0, NULL, wxLB_SINGLE | wxLB_SORT); //id = new wxListBox(parent.id, ctrlID, wxDefaultPosition, wxDefaultSize,
// 0, NULL, wxLB_SINGLE | wxLB_SORT | wxSIMPLE_BORDER);
} }
PRectangle ListBox::GetDesiredRect() { PRectangle ListBox::GetDesiredRect() {
@@ -463,6 +485,10 @@ PRectangle ListBox::GetDesiredRect() {
PRectangle rc; PRectangle rc;
rc.top = 0; rc.top = 0;
rc.left = 0; rc.left = 0;
if (sz.x > 150) // TODO: A better way to determine these max sizes
sz.x = 150;
if (sz.y > 100)
sz.y = 100;
rc.right = sz.x; rc.right = sz.x;
rc.bottom = sz.y; rc.bottom = sz.y;

View File

@@ -98,7 +98,7 @@ wxStyledTextCtrl::wxStyledTextCtrl(wxWindow *parent,
long style, long style,
const wxString& name) : const wxString& name) :
wxControl(parent, id, pos, size, wxControl(parent, id, pos, size,
style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS, style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS | wxCLIP_CHILDREN,
wxDefaultValidator, name) wxDefaultValidator, name)
{ {
m_swx = new ScintillaWX(this); m_swx = new ScintillaWX(this);
@@ -119,6 +119,10 @@ long wxStyledTextCtrl::SendMsg(int msg, long wp, long lp) {
} }
#ifdef MAKELONG
#undef MAKELONG
#endif
#define MAKELONG(a, b) ((a) | ((b) << 16)) #define MAKELONG(a, b) ((a) | ((b) << 16))

View File

@@ -98,7 +98,7 @@ wxStyledTextCtrl::wxStyledTextCtrl(wxWindow *parent,
long style, long style,
const wxString& name) : const wxString& name) :
wxControl(parent, id, pos, size, wxControl(parent, id, pos, size,
style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS, style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS | wxCLIP_CHILDREN,
wxDefaultValidator, name) wxDefaultValidator, name)
{ {
m_swx = new ScintillaWX(this); m_swx = new ScintillaWX(this);
@@ -119,6 +119,10 @@ long wxStyledTextCtrl::SendMsg(int msg, long wp, long lp) {
} }
#ifdef MAKELONG
#undef MAKELONG
#endif
#define MAKELONG(a, b) ((a) | ((b) << 16)) #define MAKELONG(a, b) ((a) | ((b) << 16))

View File

@@ -446,6 +446,27 @@ void Window::SetTitle(const char *s) {
} }
class wxSTCListBox : public wxListBox {
public:
wxSTCListBox(wxWindow* parent, wxWindowID id)
: wxListBox(parent, id, wxDefaultPosition, wxDefaultSize,
0, NULL, wxLB_SINGLE | wxLB_SORT | wxSIMPLE_BORDER)
{}
void OnFocus(wxFocusEvent& event) {
GetParent()->SetFocus();
event.Skip();
}
private:
DECLARE_EVENT_TABLE()
};
BEGIN_EVENT_TABLE(wxSTCListBox, wxListBox)
EVT_SET_FOCUS(wxSTCListBox::OnFocus)
END_EVENT_TABLE()
ListBox::ListBox() { ListBox::ListBox() {
} }
@@ -454,8 +475,9 @@ ListBox::~ListBox() {
} }
void ListBox::Create(Window &parent, int ctrlID) { void ListBox::Create(Window &parent, int ctrlID) {
id = new wxListBox(parent.id, ctrlID, wxDefaultPosition, wxDefaultSize, id = new wxSTCListBox(parent.id, ctrlID);
0, NULL, wxLB_SINGLE | wxLB_SORT); //id = new wxListBox(parent.id, ctrlID, wxDefaultPosition, wxDefaultSize,
// 0, NULL, wxLB_SINGLE | wxLB_SORT | wxSIMPLE_BORDER);
} }
PRectangle ListBox::GetDesiredRect() { PRectangle ListBox::GetDesiredRect() {
@@ -463,6 +485,10 @@ PRectangle ListBox::GetDesiredRect() {
PRectangle rc; PRectangle rc;
rc.top = 0; rc.top = 0;
rc.left = 0; rc.left = 0;
if (sz.x > 150) // TODO: A better way to determine these max sizes
sz.x = 150;
if (sz.y > 100)
sz.y = 100;
rc.right = sz.x; rc.right = sz.x;
rc.bottom = sz.y; rc.bottom = sz.y;

View File

@@ -98,7 +98,7 @@ wxStyledTextCtrl::wxStyledTextCtrl(wxWindow *parent,
long style, long style,
const wxString& name) : const wxString& name) :
wxControl(parent, id, pos, size, wxControl(parent, id, pos, size,
style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS, style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS | wxCLIP_CHILDREN,
wxDefaultValidator, name) wxDefaultValidator, name)
{ {
m_swx = new ScintillaWX(this); m_swx = new ScintillaWX(this);
@@ -119,6 +119,10 @@ long wxStyledTextCtrl::SendMsg(int msg, long wp, long lp) {
} }
#ifdef MAKELONG
#undef MAKELONG
#endif
#define MAKELONG(a, b) ((a) | ((b) << 16)) #define MAKELONG(a, b) ((a) | ((b) << 16))

View File

@@ -98,7 +98,7 @@ wxStyledTextCtrl::wxStyledTextCtrl(wxWindow *parent,
long style, long style,
const wxString& name) : const wxString& name) :
wxControl(parent, id, pos, size, wxControl(parent, id, pos, size,
style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS, style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS | wxCLIP_CHILDREN,
wxDefaultValidator, name) wxDefaultValidator, name)
{ {
m_swx = new ScintillaWX(this); m_swx = new ScintillaWX(this);
@@ -119,6 +119,10 @@ long wxStyledTextCtrl::SendMsg(int msg, long wp, long lp) {
} }
#ifdef MAKELONG
#undef MAKELONG
#endif
#define MAKELONG(a, b) ((a) | ((b) << 16)) #define MAKELONG(a, b) ((a) | ((b) << 16))