-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ms-display-multiple-callsigns' into ms-2020c
- Loading branch information
Showing
6 changed files
with
120 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#include "wxListViewComboPopup.h" | ||
|
||
#include <wx/combo.h> | ||
#include <wx/listctrl.h> | ||
|
||
void wxListViewComboPopup::Init() | ||
{ | ||
m_value = -1; | ||
} | ||
|
||
// Create popup control | ||
bool wxListViewComboPopup::Create(wxWindow* parent) | ||
{ | ||
return wxListView::Create(parent,1,wxPoint(0,0),wxDefaultSize,wxLC_REPORT | wxLC_SINGLE_SEL); | ||
} | ||
|
||
// Return pointer to the created control | ||
wxWindow *wxListViewComboPopup::GetControl() { return this; } | ||
|
||
// Translate string into a list selection | ||
void wxListViewComboPopup::SetStringValue(const wxString& s) | ||
{ | ||
int n = wxListView::FindItem(-1,s); | ||
if ( n >= 0 && n < wxListView::GetItemCount() ) | ||
wxListView::Select(n); | ||
} | ||
|
||
// Get list selection as a string | ||
wxString wxListViewComboPopup::GetStringValue() const | ||
{ | ||
if ( m_value >= 0 ) | ||
return wxListView::GetItemText(m_value); | ||
return wxEmptyString; | ||
} | ||
|
||
// Do mouse hot-tracking (which is typical in list popups) | ||
void wxListViewComboPopup::OnMouseMove(wxMouseEvent& event) | ||
{ | ||
// TODO: Move selection to cursor | ||
} | ||
|
||
// On mouse left up, set the value and close the popup | ||
void wxListViewComboPopup::OnMouseClick(wxMouseEvent& WXUNUSED(event)) | ||
{ | ||
m_value = wxListView::GetFirstSelected(); | ||
// TODO: Send event as well | ||
Dismiss(); | ||
} | ||
|
||
wxBEGIN_EVENT_TABLE(wxListViewComboPopup, wxListView) | ||
EVT_MOTION(wxListViewComboPopup::OnMouseMove) | ||
EVT_LEFT_UP(wxListViewComboPopup::OnMouseClick) | ||
wxEND_EVENT_TABLE() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#ifndef WX_LIST_VIEW_COMBO_POPUP_H | ||
#define WX_LIST_VIEW_COMBO_POPUP_H | ||
|
||
#include <wx/combo.h> | ||
#include <wx/listctrl.h> | ||
|
||
class wxListViewComboPopup : public wxListView, public wxComboPopup | ||
{ | ||
public: | ||
// Initialize member variables | ||
virtual void Init(); | ||
|
||
// Create popup control | ||
virtual bool Create(wxWindow* parent); | ||
|
||
// Return pointer to the created control | ||
virtual wxWindow *GetControl(); | ||
|
||
// Translate string into a list selection | ||
virtual void SetStringValue(const wxString& s); | ||
|
||
// Get list selection as a string | ||
virtual wxString GetStringValue() const; | ||
|
||
// Do mouse hot-tracking (which is typical in list popups) | ||
void OnMouseMove(wxMouseEvent& event); | ||
|
||
// On mouse left up, set the value and close the popup | ||
void OnMouseClick(wxMouseEvent& WXUNUSED(event)); | ||
|
||
protected: | ||
int m_value; // current item index | ||
private: | ||
wxDECLARE_EVENT_TABLE(); | ||
}; | ||
|
||
#endif // WX_LIST_VIEW_COMBO_POPUP_H |