CubicSDR/src/forms/Bookmark/BookmarkView.h

109 lines
3.2 KiB
C
Raw Normal View History

#pragma once
#include "BookmarkPanel.h"
2016-09-14 19:46:57 -04:00
#include "BookmarkMgr.h"
2016-10-10 22:28:48 -04:00
class TreeViewItem : public wxTreeItemData {
public:
enum TreeViewItemType {
TREEVIEW_ITEM_TYPE_GROUP,
TREEVIEW_ITEM_TYPE_ACTIVE,
TREEVIEW_ITEM_TYPE_RECENT,
TREEVIEW_ITEM_TYPE_BOOKMARK
};
TreeViewItem() {
bookmarkEnt = nullptr;
demod = nullptr;
};
TreeViewItemType type;
BookmarkEntry *bookmarkEnt;
DemodulatorInstance *demod;
std::string groupName;
};
class BookmarkView : public BookmarkPanel {
public:
BookmarkView( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1, -1 ), long style = wxTAB_TRAVERSAL );
void updateActiveList();
2016-10-06 22:27:12 -04:00
void updateBookmarks();
void updateBookmarks(std::string group);
2016-09-28 20:37:39 -04:00
void activeSelection(DemodulatorInstance *dsel);
void bookmarkSelection(BookmarkEntry *bmSel);
void activateBookmark(BookmarkEntry *bmEnt);
void recentSelection(BookmarkEntry *bmSel);
2016-10-06 22:27:12 -04:00
wxTreeItemId refreshBookmarks();
void updateTheme();
2016-10-06 21:08:45 -04:00
void onMenuItem(wxCommandEvent& event);
bool isMouseInView();
protected:
2016-09-28 20:37:39 -04:00
void hideProps();
2016-09-14 22:49:32 -04:00
void onUpdateTimer( wxTimerEvent& event );
void doUpdateActiveList();
void onTreeBeginLabelEdit( wxTreeEvent& event );
void onTreeEndLabelEdit( wxTreeEvent& event );
void onTreeActivate( wxTreeEvent& event );
void onTreeCollapse( wxTreeEvent& event );
void onTreeExpanded( wxTreeEvent& event );
2016-10-06 21:08:45 -04:00
void onTreeItemMenu( wxTreeEvent& event );
void onTreeSelect( wxTreeEvent& event );
void onTreeSelectChanging( wxTreeEvent& event );
void onLabelText( wxCommandEvent& event );
void onDoubleClickFreq( wxMouseEvent& event );
void onDoubleClickBandwidth( wxMouseEvent& event );
void onTreeBeginDrag( wxTreeEvent& event );
void onTreeEndDrag( wxTreeEvent& event );
void onTreeDeleteItem( wxTreeEvent& event );
void onTreeItemGetTooltip( wxTreeEvent& event );
void onEnterWindow( wxMouseEvent& event );
void onLeaveWindow( wxMouseEvent& event );
2016-11-08 01:35:34 -05:00
void clearButtons();
void showButtons();
wxButton *makeButton(wxWindow *parent, std::string labelVal, wxObjectEventFunction handler);
wxButton *addButton(wxWindow *parent, std::string labelVal, wxObjectEventFunction handler);
void onBookmarkActive( wxCommandEvent& event );
void onBookmarkRecent( wxCommandEvent& event );
void onRemoveActive( wxCommandEvent& event );
void onRemoveBookmark( wxCommandEvent& event );
void onActivateBookmark( wxCommandEvent& event );
void onActivateRecent( wxCommandEvent& event );
std::atomic_bool mouseInView;
2016-09-14 19:46:57 -04:00
wxTreeItemId rootBranch, activeBranch, bookmarkBranch, recentBranch;
2016-10-06 21:08:45 -04:00
TreeViewItem *dragItem;
wxTreeItemId dragItemId;
2016-10-06 21:08:45 -04:00
// Bookmarks
2016-10-06 22:27:12 -04:00
std::atomic_bool doUpdateBookmarks;
std::set< std::string > doUpdateBookmarkGroup;
2016-10-06 21:08:45 -04:00
BookmarkNames groupNames;
std::map<std::string, wxTreeItemId> groups;
2016-10-06 21:08:45 -04:00
BookmarkEntry *bookmarkSel;
2016-10-06 22:27:12 -04:00
2016-10-06 21:08:45 -04:00
// Active
2016-10-06 22:27:12 -04:00
std::atomic_bool doUpdateActive;
2016-09-28 20:37:39 -04:00
DemodulatorInstance *activeSel;
2016-10-06 21:08:45 -04:00
// Recent
2016-10-10 22:28:48 -04:00
BookmarkEntry *recentSel;
};