Antares Simulator
Power System Simulator
listbox-panel.h
1 /*
2  * Copyright 2007-2025, RTE (https://www.rte-france.com)
3  * See AUTHORS.txt
4  * SPDX-License-Identifier: MPL-2.0
5  * This file is part of Antares-Simulator,
6  * Adequacy and Performance assessment for interconnected energy networks.
7  *
8  * Antares_Simulator is free software: you can redistribute it and/or modify
9  * it under the terms of the Mozilla Public Licence 2.0 as published by
10  * the Mozilla Foundation, either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * Antares_Simulator is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * Mozilla Public Licence 2.0 for more details.
17  *
18  * You should have received a copy of the Mozilla Public Licence 2.0
19  * along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
20  */
21 #ifndef __ANTARES_COMMON_COMPONENT_SPOTLIGHT_LISTBOX_PANEL_H__
22 #define __ANTARES_COMMON_COMPONENT_SPOTLIGHT_LISTBOX_PANEL_H__
23 
24 #include <yuni/yuni.h>
25 #include "../../wx-wrapper.h"
26 #include <wx/scrolwin.h>
27 #include "spotlight.h"
28 
29 namespace Antares::Component
30 {
31 class ListboxPanel: public wxScrolledWindow, public Yuni::IEventObserver<ListboxPanel>
32 {
33 public:
34  enum
35  {
36  searchResultTextHeight = 25,
37  };
38 
39 public:
41 
42 
45  ListboxPanel(Spotlight* parent, uint flags);
47  virtual ~ListboxPanel();
49 
50  void updateItems(const Spotlight::IItem::VectorPtr& vptr,
51  const Spotlight::SearchToken::VectorPtr& tokens);
52 
58  void resetProvider(Spotlight::IProvider::Ptr provider);
59 
60 protected:
62  void onDraw(wxPaintEvent& evt);
64  void onMouseMotion(wxMouseEvent& evt);
66  void onMouseLeave(wxMouseEvent&);
67 
69  void onEraseBackground(wxEraseEvent&)
70  {
71  }
72 
75 
77  void onMouseLeftUp(wxMouseEvent& evt);
79  void onMouseDblClick(wxMouseEvent& evt);
84 
85 private:
87  Spotlight* pParent;
89  Spotlight::IItem::VectorPtr pItems;
91  Spotlight::SearchToken::VectorPtr pTokens;
93  wxString pLonguestGroupName;
94  wxSize pLonguestGroupNameSize;
95  bool pRecomputeLonguestGroupNameSize;
96  wxColour pDisabledColor;
98  wxString pCacheResultText;
99  wxSize pCacheResultTextSize;
100  //
101  uint pMouseOverItem;
103  Spotlight::IProvider::Ptr pProvider;
105  uint pFlags;
106 
108  YString pLastGroupName;
109 
110 protected:
111  // Event table
112  DECLARE_EVENT_TABLE()
113 
114 }; // class ListboxPanel
115 
116 } // namespace Antares::Component
117 
118 #endif // __ANTARES_COMMON_COMPONENT_SPOTLIGHT_LISTBOX_PANEL_H__
Definition: listbox-panel.h:32
void onMouseMotion(wxMouseEvent &evt)
Event: mouse moved.
Definition: listbox-panel.cpp:86
void onMouseLeave(wxMouseEvent &)
Event: mouse leave.
Definition: listbox-panel.cpp:133
void onMouseLeftUp(wxMouseEvent &evt)
Event: Mouse Click.
Definition: listbox-panel.cpp:359
void onDraw(wxPaintEvent &evt)
Event: draw the panel.
Definition: listbox-panel.cpp:144
void doSelectItemFromMouseDblClick()
Delayed event.
Definition: listbox-panel.cpp:377
void onMouseDblClick(wxMouseEvent &evt)
Event: Mouse Double Click.
Definition: listbox-panel.cpp:368
void resetProvider(Spotlight::IProvider::Ptr provider)
Reset the data provider.
Definition: listbox-panel.cpp:139
virtual ~ListboxPanel()
Destructor.
Definition: listbox-panel.cpp:74
void recomputeBoundsForLonguestGroupName(wxDC &dc)
Recompute the bounds of the longuest group name.
Definition: listbox-panel.cpp:79
ListboxPanel(Spotlight *parent, uint flags)
Default constructor.
Definition: listbox-panel.cpp:51
void doSelectItemFromMouseLeftUp()
Delayed event.
Definition: listbox-panel.cpp:422
void onEraseBackground(wxEraseEvent &)
UI: Erase background, empty to avoid flickering.
Definition: listbox-panel.h:69
Definition: spotlight.h:38