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:
@@ -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() {
|
||||
}
|
||||
@@ -454,8 +475,9 @@ ListBox::~ListBox() {
|
||||
}
|
||||
|
||||
void ListBox::Create(Window &parent, int ctrlID) {
|
||||
id = new wxListBox(parent.id, ctrlID, wxDefaultPosition, wxDefaultSize,
|
||||
0, NULL, wxLB_SINGLE | wxLB_SORT);
|
||||
id = new wxSTCListBox(parent.id, ctrlID);
|
||||
//id = new wxListBox(parent.id, ctrlID, wxDefaultPosition, wxDefaultSize,
|
||||
// 0, NULL, wxLB_SINGLE | wxLB_SORT | wxSIMPLE_BORDER);
|
||||
}
|
||||
|
||||
PRectangle ListBox::GetDesiredRect() {
|
||||
@@ -463,6 +485,10 @@ PRectangle ListBox::GetDesiredRect() {
|
||||
PRectangle rc;
|
||||
rc.top = 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.bottom = sz.y;
|
||||
|
||||
|
@@ -98,7 +98,7 @@ wxStyledTextCtrl::wxStyledTextCtrl(wxWindow *parent,
|
||||
long style,
|
||||
const wxString& name) :
|
||||
wxControl(parent, id, pos, size,
|
||||
style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS,
|
||||
style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS | wxCLIP_CHILDREN,
|
||||
wxDefaultValidator, name)
|
||||
{
|
||||
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))
|
||||
|
||||
|
||||
|
@@ -98,7 +98,7 @@ wxStyledTextCtrl::wxStyledTextCtrl(wxWindow *parent,
|
||||
long style,
|
||||
const wxString& name) :
|
||||
wxControl(parent, id, pos, size,
|
||||
style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS,
|
||||
style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS | wxCLIP_CHILDREN,
|
||||
wxDefaultValidator, name)
|
||||
{
|
||||
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))
|
||||
|
||||
|
||||
|
@@ -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() {
|
||||
}
|
||||
@@ -454,8 +475,9 @@ ListBox::~ListBox() {
|
||||
}
|
||||
|
||||
void ListBox::Create(Window &parent, int ctrlID) {
|
||||
id = new wxListBox(parent.id, ctrlID, wxDefaultPosition, wxDefaultSize,
|
||||
0, NULL, wxLB_SINGLE | wxLB_SORT);
|
||||
id = new wxSTCListBox(parent.id, ctrlID);
|
||||
//id = new wxListBox(parent.id, ctrlID, wxDefaultPosition, wxDefaultSize,
|
||||
// 0, NULL, wxLB_SINGLE | wxLB_SORT | wxSIMPLE_BORDER);
|
||||
}
|
||||
|
||||
PRectangle ListBox::GetDesiredRect() {
|
||||
@@ -463,6 +485,10 @@ PRectangle ListBox::GetDesiredRect() {
|
||||
PRectangle rc;
|
||||
rc.top = 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.bottom = sz.y;
|
||||
|
||||
|
@@ -98,7 +98,7 @@ wxStyledTextCtrl::wxStyledTextCtrl(wxWindow *parent,
|
||||
long style,
|
||||
const wxString& name) :
|
||||
wxControl(parent, id, pos, size,
|
||||
style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS,
|
||||
style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS | wxCLIP_CHILDREN,
|
||||
wxDefaultValidator, name)
|
||||
{
|
||||
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))
|
||||
|
||||
|
||||
|
@@ -98,7 +98,7 @@ wxStyledTextCtrl::wxStyledTextCtrl(wxWindow *parent,
|
||||
long style,
|
||||
const wxString& name) :
|
||||
wxControl(parent, id, pos, size,
|
||||
style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS,
|
||||
style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS | wxCLIP_CHILDREN,
|
||||
wxDefaultValidator, name)
|
||||
{
|
||||
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))
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user