| 5 skipped lines |
|
|
|
| 9 | C | #include <wx/wx.h> | | 9 | C | #include "wx/wx.h" |
| 10 | C | #include <wx/encconv.h> | | 10 | C | #include "wx/encconv.h" |
| 11 | C | #include <wx/listctrl.h> | | 11 | C | #include "wx/listctrl.h" |
| 12 | C | #include <wx/mstream.h> | | 12 | C | #include "wx/mstream.h" |
| 13 | C | #include <wx/image.h> | | 13 | C | #include "wx/image.h" |
| 14 | C | #include <wx/imaglist.h> | | 14 | C | #include "wx/imaglist.h" |
| | | 15 | C | #include "wx/tokenzr.h" |
|
| 16 | U | 17 | U | #include "Platform.h" |
|
| 17 | U | 18 | U | #include "PlatWX.h" |
|
| 89 skipped lines |
| 107 | U | 108 | U | // so we adjust the encoding before passing it to Scintilla. See also |
|
| 108 | U | 109 | U | // wxStyledTextCtrl::StyleSetCharacterSet |
|
| 109 | U | 110 | U | wxFontEncoding encoding = (wxFontEncoding)(characterSet-1); |
|
| 110 | C | | | 111 | C | |
| 111 | U | 112 | U | wxFontEncodingArray ea = wxEncodingConverter::GetPlatformEquivalents(encoding); |
|
| 112 | U | 113 | U | if (ea.GetCount()) |
|
| 113 | U | 114 | U | encoding = ea[0]; |
|
| 487 skipped lines |
|
|
| 603 | U | 604 | U | void Window::SetTitle(const char *s) { |
|
| 604 | C | GETWIN(id)->SetTitle(stc2wx(s)); | | 605 | C | GETWIN(id)->SetLabel(stc2wx(s)); |
|
|
|
| 58 skipped lines |
|
|
|
| 669 | C | #if wxUSE_POPUPWIN //----------------------------------- | | 670 | C | #if wxUSE_POPUPWIN //----------------------------------- |
| 670 | U | 671 | U | #include <wx/popupwin.h> |
|
|
|
| 3 skipped lines |
| 676 | U | 677 | U | // implement wxPopupWindow for the Mac!!) |
|
|
| 678 | U | 679 | U | // In the meantime, be careful to duplicate any changes as needed... |
|
| 679 | C | // | | 680 | C | // |
| 680 | C | | | 681 | C | |
| 681 | C | // A popup window to place the wxSTCListBox upon | | 682 | C | // A popup window to place the wxSTCListBox upon |
| 682 | U | 683 | U | class wxSTCListBoxWin : public wxPopupWindow |
|
|
|
| 1 skipped line |
| 686 | U | 687 | U | CallBackAction doubleClickAction; |
|
| 687 | U | 688 | U | void* doubleClickActionData; |
|
|
| 689 | C | wxSTCListBoxWin(wxWindow* parent, wxWindowID id) : | | 690 | C | wxSTCListBoxWin(wxWindow* parent, wxWindowID id, Point WXUNUSED(location)) : |
| 690 | U | 691 | U | wxPopupWindow(parent, wxBORDER_NONE) |
|
|
| 692 | U | 693 | U | SetBackgroundColour(*wxBLACK); // for our simple border |
|
| 9 skipped lines |
| 702 | U | 703 | U | // "right" to the user. But since the wxPopupWindow or its children |
|
| 703 | U | 704 | U | // can't receive focus then we have to pull a fast one and temporarily |
|
| 704 | U | 705 | U | // parent the listctrl on the STC window and then call SetFocus and |
|
| 705 | C | // then reparent it back to the popup. | | 706 | C | // then reparent it back to the popup. |
|
| 707 | U | 708 | U | lv->Reparent(this); |
|
|
| 84 skipped lines |
| 793 | U | 794 | U | EVT_LIST_ITEM_ACTIVATED(wxID_ANY, wxSTCListBoxWin::OnActivate) |
|
| 794 | U | 795 | U | END_EVENT_TABLE() |
|
|
| 796 | C | | | 797 | C | |
|
| 798 | U | 799 | U | #else // wxUSE_POPUPWIN ----------------------------------- |
|
|
| 4 skipped lines |
| 804 | U | 805 | U | CallBackAction doubleClickAction; |
|
| 805 | U | 806 | U | void* doubleClickActionData; |
|
|
| 807 | C | wxSTCListBoxWin(wxWindow* parent, wxWindowID id) : | | 808 | C | wxSTCListBoxWin(wxWindow* parent, wxWindowID id, Point location) : |
| 808 | C | wxWindow(parent, id, wxDefaultPosition, wxSize(0,0), wxSIMPLE_BORDER ) | | 809 | C | wxWindow(parent, id, wxPoint(location.x, location.y), wxSize(0,0), wxSIMPLE_BORDER ) |
|
|
| 811 | U | 812 | U | lv = new wxSTCListBox(this, id, wxDefaultPosition, wxDefaultSize, |
|
| 69 skipped lines |
|
|
|
| 884 | C | | | 885 | C | |
| 885 | U | 886 | U | void OnActivate(wxListEvent& WXUNUSED(event)) { |
|
| 886 | U | 887 | U | doubleClickAction(doubleClickActionData); |
|
|
| 30 skipped lines |
| 918 | U | 919 | U | bool unicodeMode; |
|
| 919 | U | 920 | U | int desiredVisibleRows; |
|
| 920 | U | 921 | U | int aveCharWidth; |
|
| 921 | C | int maxStrWidth; | | 922 | C | size_t maxStrWidth; |
| | | 923 | C | Point location; // Caret location at which the list is opened |
| 922 | U | 924 | U | wxImageList* imgList; |
|
| 923 | U | 925 | U | wxArrayInt* imgTypeMap; |
|
|
| 2 skipped lines |
|
|
| 929 | U | 931 | U | virtual void SetFont(Font &font); |
|
| 930 | C | virtual void Create(Window &parent, int ctrlID, int lineHeight_, bool unicodeMode_); | | 932 | C | virtual void Create(Window &parent, int ctrlID, Point location_, int lineHeight_, bool unicodeMode_); |
| 931 | U | 933 | U | virtual void SetAverageCharWidth(int width); |
|
| 932 | U | 934 | U | virtual void SetVisibleRows(int rows); |
|
| | | 935 | A | virtual int GetVisibleRows() const; |
| 933 | U | 936 | U | virtual PRectangle GetDesiredRect(); |
|
| 934 | U | 937 | U | virtual int CaretFromEdge(); |
|
| 935 | U | 938 | U | virtual void Clear(); |
|
| 936 | U | 939 | U | virtual void Append(char *s, int type = -1); |
|
| | | 940 | A | void Append(const wxString& text, int type); |
| 937 | U | 941 | U | virtual int Length(); |
|
| 938 | U | 942 | U | virtual void Select(int n); |
|
| 939 | U | 943 | U | virtual int GetSelection(); |
|
| 2 skipped lines |
| 942 | U | 946 | U | virtual void RegisterImage(int type, const char *xpm_data); |
|
| 943 | U | 947 | U | virtual void ClearRegisteredImages(); |
|
| 944 | U | 948 | U | virtual void SetDoubleClickAction(CallBackAction, void *); |
|
| 945 | C | | | 949 | C | virtual void SetList(const char* list, char separator, char typesep); |
|
|
|
| 21 skipped lines |
|
|
|
| 973 | C | void ListBoxImpl::Create(Window &parent, int ctrlID, int lineHeight_, bool unicodeMode_) { | | 977 | C | void ListBoxImpl::Create(Window &parent, int ctrlID, Point location_, int lineHeight_, bool unicodeMode_) { |
| | | 978 | C | location = location_; |
| 974 | U | 979 | U | lineHeight = lineHeight_; |
|
| 975 | U | 980 | U | unicodeMode = unicodeMode_; |
|
| 976 | U | 981 | U | maxStrWidth = 0; |
|
| 977 | C | id = new wxSTCListBoxWin(GETWIN(parent.GetID()), ctrlID); | | 982 | C | id = new wxSTCListBoxWin(GETWIN(parent.GetID()), ctrlID, location); |
| 978 | U | 983 | U | if (imgList != NULL) |
|
| 979 | U | 984 | U | GETLB(id)->SetImageList(imgList, wxIMAGE_LIST_SMALL); |
|
|
| 9 skipped lines |
|
|
|
| | | 998 | A | int ListBoxImpl::GetVisibleRows() const { |
| | | 999 | A | return desiredVisibleRows; |
| | | 1000 | A | } |
| | | 1001 | A | |
| 993 | U | 1002 | U | PRectangle ListBoxImpl::GetDesiredRect() { |
|
| 994 | U | 1003 | U | // wxListCtrl doesn't have a DoGetBestSize, so instead we kept track of |
|
| 995 | U | 1004 | U | // the max size in Append and calculate it here... |
|
| 996 | C | int maxw = maxStrWidth; | | 1005 | C | int maxw = maxStrWidth * aveCharWidth; |
|
|
| 999 | U | 1008 | U | // give it a default if there are no lines, and/or add a bit more |
|
| 39 skipped lines |
|
|
| 1041 | U | 1050 | U | void ListBoxImpl::Append(char *s, int type) { |
|
| 1042 | C | wxString text = stc2wx(s); | | 1051 | C | Append(stc2wx(s), type); |
| | | 1052 | C | } |
| | | 1053 | C | |
| | | 1054 | C | void ListBoxImpl::Append(const wxString& text, int type) { |
| 1043 | U | 1055 | U | long count = GETLB(id)->GetItemCount(); |
|
| 1044 | U | 1056 | U | long itemID = GETLB(id)->InsertItem(count, wxEmptyString); |
|
| 1045 | U | 1057 | U | GETLB(id)->SetItem(itemID, 1, text); |
|
| 1046 | C | int itemWidth = 0; | | |
| 1047 | C | GETLB(id)->GetTextExtent(text, &itemWidth, NULL); | | |
| 1048 | C | maxStrWidth = wxMax(maxStrWidth, itemWidth); | | 1058 | C | maxStrWidth = wxMax(maxStrWidth, text.length()); |
| 1049 | U | 1059 | U | if (type != -1) { |
|
| 1050 | U | 1060 | U | wxCHECK_RET(imgTypeMap, wxT("Unexpected NULL imgTypeMap")); |
|
| 1051 | U | 1061 | U | long idx = imgTypeMap->Item(type); |
|
| 1 skipped line |
|
|
|
| | | 1066 | A | void ListBoxImpl::SetList(const char* list, char separator, char typesep) { |
| | | 1067 | A | GETLB(id)->Freeze(); |
| | | 1068 | A | Clear(); |
| | | 1069 | A | wxStringTokenizer tkzr(stc2wx(list), (wxChar)separator); |
| | | 1070 | A | while ( tkzr.HasMoreTokens() ) { |
| 7 skipped lines |
| | | 1078 | A | Append(token, (int)type); |
| | | 1079 | A | } |
| | | 1080 | A | GETLB(id)->Thaw(); |
| | | 1081 | A | } |
| | | 1082 | A | |
|
| 1057 | U | 1084 | U | int ListBoxImpl::Length() { |
|
| 1058 | U | 1085 | U | return GETLB(id)->GetItemCount(); |
|
| 74 skipped lines |
|
|
|
| 1136 | R | | | |
| 1137 | U | 1163 | U | ListBox::ListBox() { |
|
|
|
| 230 skipped lines |
|
|
|
| 1373 | R | | | |
| 1374 | R | | | |
| 1375 | R | | | |
| 1376 | R | | | |
| 1377 | R | | | |
| 1378 | R | | | |
|