1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/ribbon/gallery.cpp
3 // Purpose: Ribbon control which displays a gallery of items to choose from
4 // Author: Peter Cawley
7 // Copyright: (C) Peter Cawley
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #include "wx/wxprec.h"
19 #include "wx/ribbon/gallery.h"
20 #include "wx/ribbon/art.h"
21 #include "wx/ribbon/bar.h"
22 #include "wx/dcbuffer.h"
23 #include "wx/clntdata.h"
29 #include "wx/msw/private.h"
32 wxDEFINE_EVENT(wxEVT_RIBBONGALLERY_HOVER_CHANGED
, wxRibbonGalleryEvent
);
33 wxDEFINE_EVENT(wxEVT_RIBBONGALLERY_SELECTED
, wxRibbonGalleryEvent
);
34 wxDEFINE_EVENT(wxEVT_RIBBONGALLERY_CLICKED
, wxRibbonGalleryEvent
);
36 IMPLEMENT_DYNAMIC_CLASS(wxRibbonGalleryEvent
, wxCommandEvent
)
37 IMPLEMENT_CLASS(wxRibbonGallery
, wxRibbonControl
)
39 class wxRibbonGalleryItem
48 void SetId(int id
) {m_id
= id
;}
49 void SetBitmap(const wxBitmap
& bitmap
) {m_bitmap
= bitmap
;}
50 const wxBitmap
& GetBitmap() const {return m_bitmap
;}
51 void SetIsVisible(bool visible
) {m_is_visible
= visible
;}
52 void SetPosition(int x
, int y
, const wxSize
& size
)
54 m_position
= wxRect(wxPoint(x
, y
), size
);
56 bool IsVisible() const {return m_is_visible
;}
57 const wxRect
& GetPosition() const {return m_position
;}
59 void SetClientObject(wxClientData
*data
) {m_client_data
.SetClientObject(data
);}
60 wxClientData
*GetClientObject() const {return m_client_data
.GetClientObject();}
61 void SetClientData(void *data
) {m_client_data
.SetClientData(data
);}
62 void *GetClientData() const {return m_client_data
.GetClientData();}
66 wxClientDataContainer m_client_data
;
72 BEGIN_EVENT_TABLE(wxRibbonGallery
, wxRibbonControl
)
73 EVT_ENTER_WINDOW(wxRibbonGallery::OnMouseEnter
)
74 EVT_ERASE_BACKGROUND(wxRibbonGallery::OnEraseBackground
)
75 EVT_LEAVE_WINDOW(wxRibbonGallery::OnMouseLeave
)
76 EVT_LEFT_DOWN(wxRibbonGallery::OnMouseDown
)
77 EVT_LEFT_UP(wxRibbonGallery::OnMouseUp
)
78 EVT_LEFT_DCLICK(wxRibbonGallery::OnMouseDClick
)
79 EVT_MOTION(wxRibbonGallery::OnMouseMove
)
80 EVT_PAINT(wxRibbonGallery::OnPaint
)
81 EVT_SIZE(wxRibbonGallery::OnSize
)
84 wxRibbonGallery::wxRibbonGallery()
88 wxRibbonGallery::wxRibbonGallery(wxWindow
* parent
,
93 : wxRibbonControl(parent
, id
, pos
, size
, wxBORDER_NONE
)
98 wxRibbonGallery::~wxRibbonGallery()
103 bool wxRibbonGallery::Create(wxWindow
* parent
,
109 if(!wxRibbonControl::Create(parent
, id
, pos
, size
, wxBORDER_NONE
))
118 void wxRibbonGallery::CommonInit(long WXUNUSED(style
))
120 m_selected_item
= NULL
;
121 m_hovered_item
= NULL
;
122 m_active_item
= NULL
;
123 m_scroll_up_button_rect
= wxRect(0, 0, 0, 0);
124 m_scroll_down_button_rect
= wxRect(0, 0, 0, 0);
125 m_extension_button_rect
= wxRect(0, 0, 0, 0);
126 m_mouse_active_rect
= NULL
;
127 m_bitmap_size
= wxSize(64, 32);
128 m_bitmap_padded_size
= m_bitmap_size
;
129 m_item_separation_x
= 0;
130 m_item_separation_y
= 0;
133 m_up_button_state
= wxRIBBON_GALLERY_BUTTON_DISABLED
;
134 m_down_button_state
= wxRIBBON_GALLERY_BUTTON_NORMAL
;
135 m_extension_button_state
= wxRIBBON_GALLERY_BUTTON_NORMAL
;
138 SetBackgroundStyle(wxBG_STYLE_CUSTOM
);
141 void wxRibbonGallery::OnMouseEnter(wxMouseEvent
& evt
)
144 if(m_mouse_active_rect
!= NULL
&& !evt
.LeftIsDown())
146 m_mouse_active_rect
= NULL
;
147 m_active_item
= NULL
;
152 void wxRibbonGallery::OnMouseMove(wxMouseEvent
& evt
)
154 bool refresh
= false;
155 wxPoint pos
= evt
.GetPosition();
157 if(TestButtonHover(m_scroll_up_button_rect
, pos
, &m_up_button_state
))
159 if(TestButtonHover(m_scroll_down_button_rect
, pos
, &m_down_button_state
))
161 if(TestButtonHover(m_extension_button_rect
, pos
, &m_extension_button_state
))
164 wxRibbonGalleryItem
*hovered_item
= NULL
;
165 wxRibbonGalleryItem
*active_item
= NULL
;
166 if(m_client_rect
.Contains(pos
))
168 if(m_art
&& m_art
->GetFlags() & wxRIBBON_BAR_FLOW_VERTICAL
)
169 pos
.x
+= m_scroll_amount
;
171 pos
.y
+= m_scroll_amount
;
173 size_t item_count
= m_items
.Count();
175 for(item_i
= 0; item_i
< item_count
; ++item_i
)
177 wxRibbonGalleryItem
*item
= m_items
.Item(item_i
);
178 if(!item
->IsVisible())
181 if(item
->GetPosition().Contains(pos
))
183 if(m_mouse_active_rect
== &item
->GetPosition())
190 if(active_item
!= m_active_item
)
192 m_active_item
= active_item
;
195 if(hovered_item
!= m_hovered_item
)
197 m_hovered_item
= hovered_item
;
198 wxRibbonGalleryEvent
notification(
199 wxEVT_RIBBONGALLERY_HOVER_CHANGED
, GetId());
200 notification
.SetEventObject(this);
201 notification
.SetGallery(this);
202 notification
.SetGalleryItem(hovered_item
);
203 ProcessWindowEvent(notification
);
211 bool wxRibbonGallery::TestButtonHover(const wxRect
& rect
, wxPoint pos
,
212 wxRibbonGalleryButtonState
* state
)
214 if(*state
== wxRIBBON_GALLERY_BUTTON_DISABLED
)
217 wxRibbonGalleryButtonState new_state
;
218 if(rect
.Contains(pos
))
220 if(m_mouse_active_rect
== &rect
)
221 new_state
= wxRIBBON_GALLERY_BUTTON_ACTIVE
;
223 new_state
= wxRIBBON_GALLERY_BUTTON_HOVERED
;
226 new_state
= wxRIBBON_GALLERY_BUTTON_NORMAL
;
228 if(new_state
!= *state
)
239 void wxRibbonGallery::OnMouseLeave(wxMouseEvent
& WXUNUSED(evt
))
242 m_active_item
= NULL
;
243 if(m_up_button_state
!= wxRIBBON_GALLERY_BUTTON_DISABLED
)
244 m_up_button_state
= wxRIBBON_GALLERY_BUTTON_NORMAL
;
245 if(m_down_button_state
!= wxRIBBON_GALLERY_BUTTON_DISABLED
)
246 m_down_button_state
= wxRIBBON_GALLERY_BUTTON_NORMAL
;
247 if(m_extension_button_state
!= wxRIBBON_GALLERY_BUTTON_DISABLED
)
248 m_extension_button_state
= wxRIBBON_GALLERY_BUTTON_NORMAL
;
249 if(m_hovered_item
!= NULL
)
251 m_hovered_item
= NULL
;
252 wxRibbonGalleryEvent
notification(
253 wxEVT_RIBBONGALLERY_HOVER_CHANGED
, GetId());
254 notification
.SetEventObject(this);
255 notification
.SetGallery(this);
256 ProcessWindowEvent(notification
);
261 void wxRibbonGallery::OnMouseDown(wxMouseEvent
& evt
)
263 wxPoint pos
= evt
.GetPosition();
264 m_mouse_active_rect
= NULL
;
265 if(m_client_rect
.Contains(pos
))
267 if(m_art
&& m_art
->GetFlags() & wxRIBBON_BAR_FLOW_VERTICAL
)
268 pos
.x
+= m_scroll_amount
;
270 pos
.y
+= m_scroll_amount
;
271 size_t item_count
= m_items
.Count();
273 for(item_i
= 0; item_i
< item_count
; ++item_i
)
275 wxRibbonGalleryItem
*item
= m_items
.Item(item_i
);
276 if(!item
->IsVisible())
279 const wxRect
& rect
= item
->GetPosition();
280 if(rect
.Contains(pos
))
282 m_active_item
= item
;
283 m_mouse_active_rect
= &rect
;
288 else if(m_scroll_up_button_rect
.Contains(pos
))
290 if(m_up_button_state
!= wxRIBBON_GALLERY_BUTTON_DISABLED
)
292 m_mouse_active_rect
= &m_scroll_up_button_rect
;
293 m_up_button_state
= wxRIBBON_GALLERY_BUTTON_ACTIVE
;
296 else if(m_scroll_down_button_rect
.Contains(pos
))
298 if(m_down_button_state
!= wxRIBBON_GALLERY_BUTTON_DISABLED
)
300 m_mouse_active_rect
= &m_scroll_down_button_rect
;
301 m_down_button_state
= wxRIBBON_GALLERY_BUTTON_ACTIVE
;
304 else if(m_extension_button_rect
.Contains(pos
))
306 if(m_extension_button_state
!= wxRIBBON_GALLERY_BUTTON_DISABLED
)
308 m_mouse_active_rect
= &m_extension_button_rect
;
309 m_extension_button_state
= wxRIBBON_GALLERY_BUTTON_ACTIVE
;
312 if(m_mouse_active_rect
!= NULL
)
316 void wxRibbonGallery::OnMouseUp(wxMouseEvent
& evt
)
318 if(m_mouse_active_rect
!= NULL
)
320 wxPoint pos
= evt
.GetPosition();
323 if(m_art
&& m_art
->GetFlags() & wxRIBBON_BAR_FLOW_VERTICAL
)
324 pos
.x
+= m_scroll_amount
;
326 pos
.y
+= m_scroll_amount
;
328 if(m_mouse_active_rect
->Contains(pos
))
330 if(m_mouse_active_rect
== &m_scroll_up_button_rect
)
332 m_up_button_state
= wxRIBBON_GALLERY_BUTTON_HOVERED
;
335 else if(m_mouse_active_rect
== &m_scroll_down_button_rect
)
337 m_down_button_state
= wxRIBBON_GALLERY_BUTTON_HOVERED
;
340 else if(m_mouse_active_rect
== &m_extension_button_rect
)
342 m_extension_button_state
= wxRIBBON_GALLERY_BUTTON_HOVERED
;
343 wxCommandEvent
notification(wxEVT_BUTTON
,
345 notification
.SetEventObject(this);
346 ProcessWindowEvent(notification
);
348 else if(m_active_item
!= NULL
)
350 if(m_selected_item
!= m_active_item
)
352 m_selected_item
= m_active_item
;
353 wxRibbonGalleryEvent
notification(
354 wxEVT_RIBBONGALLERY_SELECTED
, GetId());
355 notification
.SetEventObject(this);
356 notification
.SetGallery(this);
357 notification
.SetGalleryItem(m_selected_item
);
358 ProcessWindowEvent(notification
);
361 wxRibbonGalleryEvent
notification(
362 wxEVT_RIBBONGALLERY_CLICKED
, GetId());
363 notification
.SetEventObject(this);
364 notification
.SetGallery(this);
365 notification
.SetGalleryItem(m_selected_item
);
366 ProcessWindowEvent(notification
);
369 m_mouse_active_rect
= NULL
;
370 m_active_item
= NULL
;
375 void wxRibbonGallery::OnMouseDClick(wxMouseEvent
& evt
)
377 // The 2nd click of a double-click should be handled as a click in the
378 // same way as the 1st click of the double-click. This is useful for
379 // scrolling through the gallery.
384 void wxRibbonGallery::SetItemClientObject(wxRibbonGalleryItem
* itm
,
387 itm
->SetClientObject(data
);
390 wxClientData
* wxRibbonGallery::GetItemClientObject(const wxRibbonGalleryItem
* itm
) const
392 return itm
->GetClientObject();
395 void wxRibbonGallery::SetItemClientData(wxRibbonGalleryItem
* itm
, void* data
)
397 itm
->SetClientData(data
);
400 void* wxRibbonGallery::GetItemClientData(const wxRibbonGalleryItem
* itm
) const
402 return itm
->GetClientData();
405 bool wxRibbonGallery::ScrollLines(int lines
)
407 if(m_scroll_limit
== 0 || m_art
== NULL
)
410 return ScrollPixels(lines
* GetScrollLineSize());
413 int wxRibbonGallery::GetScrollLineSize() const
418 int line_size
= m_bitmap_padded_size
.GetHeight();
419 if(m_art
->GetFlags() & wxRIBBON_BAR_FLOW_VERTICAL
)
420 line_size
= m_bitmap_padded_size
.GetWidth();
425 bool wxRibbonGallery::ScrollPixels(int pixels
)
427 if(m_scroll_limit
== 0 || m_art
== NULL
)
432 if(m_scroll_amount
> 0)
434 m_scroll_amount
+= pixels
;
435 if(m_scroll_amount
<= 0)
438 m_up_button_state
= wxRIBBON_GALLERY_BUTTON_DISABLED
;
440 else if(m_up_button_state
== wxRIBBON_GALLERY_BUTTON_DISABLED
)
441 m_up_button_state
= wxRIBBON_GALLERY_BUTTON_NORMAL
;
442 if(m_down_button_state
== wxRIBBON_GALLERY_BUTTON_DISABLED
)
443 m_down_button_state
= wxRIBBON_GALLERY_BUTTON_NORMAL
;
449 if(m_scroll_amount
< m_scroll_limit
)
451 m_scroll_amount
+= pixels
;
452 if(m_scroll_amount
>= m_scroll_limit
)
454 m_scroll_amount
= m_scroll_limit
;
455 m_down_button_state
= wxRIBBON_GALLERY_BUTTON_DISABLED
;
457 else if(m_down_button_state
== wxRIBBON_GALLERY_BUTTON_DISABLED
)
458 m_down_button_state
= wxRIBBON_GALLERY_BUTTON_NORMAL
;
459 if(m_up_button_state
== wxRIBBON_GALLERY_BUTTON_DISABLED
)
460 m_up_button_state
= wxRIBBON_GALLERY_BUTTON_NORMAL
;
467 void wxRibbonGallery::EnsureVisible(const wxRibbonGalleryItem
* item
)
469 if(item
== NULL
|| !item
->IsVisible() || IsEmpty())
472 if(m_art
->GetFlags() & wxRIBBON_BAR_FLOW_VERTICAL
)
474 int x
= item
->GetPosition().GetLeft();
475 int base_x
= m_items
.Item(0)->GetPosition().GetLeft();
476 int delta
= x
- base_x
- m_scroll_amount
;
477 ScrollLines(delta
/ m_bitmap_padded_size
.GetWidth());
481 int y
= item
->GetPosition().GetTop();
482 int base_y
= m_items
.Item(0)->GetPosition().GetTop();
483 int delta
= y
- base_y
- m_scroll_amount
;
484 ScrollLines(delta
/ m_bitmap_padded_size
.GetHeight());
488 bool wxRibbonGallery::IsHovered() const
493 void wxRibbonGallery::OnEraseBackground(wxEraseEvent
& WXUNUSED(evt
))
495 // All painting done in main paint handler to minimise flicker
498 void wxRibbonGallery::OnPaint(wxPaintEvent
& WXUNUSED(evt
))
500 wxAutoBufferedPaintDC
dc(this);
504 m_art
->DrawGalleryBackground(dc
, this, GetSize());
506 int padding_top
= m_art
->GetMetric(wxRIBBON_ART_GALLERY_BITMAP_PADDING_TOP_SIZE
);
507 int padding_left
= m_art
->GetMetric(wxRIBBON_ART_GALLERY_BITMAP_PADDING_LEFT_SIZE
);
509 dc
.SetClippingRegion(m_client_rect
);
511 bool offset_vertical
= true;
512 if(m_art
->GetFlags() & wxRIBBON_BAR_FLOW_VERTICAL
)
513 offset_vertical
= false;
514 size_t item_count
= m_items
.Count();
516 for(item_i
= 0; item_i
< item_count
; ++item_i
)
518 wxRibbonGalleryItem
*item
= m_items
.Item(item_i
);
519 if(!item
->IsVisible())
522 const wxRect
& pos
= item
->GetPosition();
523 wxRect
offset_pos(pos
);
525 offset_pos
.SetTop(offset_pos
.GetTop() - m_scroll_amount
);
527 offset_pos
.SetLeft(offset_pos
.GetLeft() - m_scroll_amount
);
528 m_art
->DrawGalleryItemBackground(dc
, this, offset_pos
, item
);
529 dc
.DrawBitmap(item
->GetBitmap(), offset_pos
.GetLeft() + padding_left
,
530 offset_pos
.GetTop() + padding_top
);
534 void wxRibbonGallery::OnSize(wxSizeEvent
& WXUNUSED(evt
))
539 wxRibbonGalleryItem
* wxRibbonGallery::Append(const wxBitmap
& bitmap
, int id
)
541 wxASSERT(bitmap
.IsOk());
542 if(m_items
.IsEmpty())
544 m_bitmap_size
= bitmap
.GetSize();
549 wxASSERT(bitmap
.GetSize() == m_bitmap_size
);
552 wxRibbonGalleryItem
*item
= new wxRibbonGalleryItem
;
554 item
->SetBitmap(bitmap
);
559 wxRibbonGalleryItem
* wxRibbonGallery::Append(const wxBitmap
& bitmap
, int id
,
562 wxRibbonGalleryItem
*item
= Append(bitmap
, id
);
563 item
->SetClientData(clientData
);
567 wxRibbonGalleryItem
* wxRibbonGallery::Append(const wxBitmap
& bitmap
, int id
,
568 wxClientData
* clientData
)
570 wxRibbonGalleryItem
*item
= Append(bitmap
, id
);
571 item
->SetClientObject(clientData
);
575 void wxRibbonGallery::Clear()
577 size_t item_count
= m_items
.Count();
579 for(item_i
= 0; item_i
< item_count
; ++item_i
)
581 wxRibbonGalleryItem
*item
= m_items
.Item(item_i
);
587 bool wxRibbonGallery::IsSizingContinuous() const
592 void wxRibbonGallery::CalculateMinSize()
594 if(m_art
== NULL
|| !m_bitmap_size
.IsFullySpecified())
596 SetMinSize(wxSize(20, 20));
600 m_bitmap_padded_size
= m_bitmap_size
;
601 m_bitmap_padded_size
.IncBy(
602 m_art
->GetMetric(wxRIBBON_ART_GALLERY_BITMAP_PADDING_LEFT_SIZE
) +
603 m_art
->GetMetric(wxRIBBON_ART_GALLERY_BITMAP_PADDING_RIGHT_SIZE
),
604 m_art
->GetMetric(wxRIBBON_ART_GALLERY_BITMAP_PADDING_TOP_SIZE
) +
605 m_art
->GetMetric(wxRIBBON_ART_GALLERY_BITMAP_PADDING_BOTTOM_SIZE
));
608 SetMinSize(m_art
->GetGallerySize(dc
, this, m_bitmap_padded_size
));
610 // The best size is displaying several items
611 m_best_size
= m_bitmap_padded_size
;
613 m_best_size
= m_art
->GetGallerySize(dc
, this, m_best_size
);
617 bool wxRibbonGallery::Realize()
623 bool wxRibbonGallery::Layout()
630 wxSize client_size
= m_art
->GetGalleryClientSize(dc
, this, GetSize(),
631 &origin
, &m_scroll_up_button_rect
, &m_scroll_down_button_rect
,
632 &m_extension_button_rect
);
633 m_client_rect
= wxRect(origin
, client_size
);
638 size_t item_count
= m_items
.Count();
640 long art_flags
= m_art
->GetFlags();
641 for(item_i
= 0; item_i
< item_count
; ++item_i
)
643 wxRibbonGalleryItem
*item
= m_items
.Item(item_i
);
644 item
->SetIsVisible(true);
645 if(art_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
647 if(y_cursor
+ m_bitmap_padded_size
.y
> client_size
.GetHeight())
652 x_cursor
+= m_bitmap_padded_size
.x
;
654 item
->SetPosition(origin
.x
+ x_cursor
, origin
.y
+ y_cursor
,
655 m_bitmap_padded_size
);
656 y_cursor
+= m_bitmap_padded_size
.y
;
660 if(x_cursor
+ m_bitmap_padded_size
.x
> client_size
.GetWidth())
665 y_cursor
+= m_bitmap_padded_size
.y
;
667 item
->SetPosition(origin
.x
+ x_cursor
, origin
.y
+ y_cursor
,
668 m_bitmap_padded_size
);
669 x_cursor
+= m_bitmap_padded_size
.x
;
672 for(; item_i
< item_count
; ++item_i
)
674 wxRibbonGalleryItem
*item
= m_items
.Item(item_i
);
675 item
->SetIsVisible(false);
677 if(art_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
678 m_scroll_limit
= x_cursor
;
680 m_scroll_limit
= y_cursor
;
681 if(m_scroll_amount
>= m_scroll_limit
)
683 m_scroll_amount
= m_scroll_limit
;
684 m_down_button_state
= wxRIBBON_GALLERY_BUTTON_DISABLED
;
686 else if(m_down_button_state
== wxRIBBON_GALLERY_BUTTON_DISABLED
)
687 m_down_button_state
= wxRIBBON_GALLERY_BUTTON_NORMAL
;
689 if(m_scroll_amount
<= 0)
692 m_up_button_state
= wxRIBBON_GALLERY_BUTTON_DISABLED
;
694 else if(m_up_button_state
== wxRIBBON_GALLERY_BUTTON_DISABLED
)
695 m_up_button_state
= wxRIBBON_GALLERY_BUTTON_NORMAL
;
700 wxSize
wxRibbonGallery::DoGetBestSize() const
705 wxSize
wxRibbonGallery::DoGetNextSmallerSize(wxOrientation direction
,
706 wxSize relative_to
) const
713 wxSize client
= m_art
->GetGalleryClientSize(dc
, this, relative_to
, NULL
,
727 if(client
.GetWidth() < 0 || client
.GetHeight() < 0)
730 client
.x
= (client
.x
/ m_bitmap_padded_size
.x
) * m_bitmap_padded_size
.x
;
731 client
.y
= (client
.y
/ m_bitmap_padded_size
.y
) * m_bitmap_padded_size
.y
;
733 wxSize size
= m_art
->GetGallerySize(dc
, this, client
);
734 wxSize minimum
= GetMinSize();
736 if(size
.GetWidth() < minimum
.GetWidth() ||
737 size
.GetHeight() < minimum
.GetHeight())
745 size
.SetHeight(relative_to
.GetHeight());
748 size
.SetWidth(relative_to
.GetWidth());
757 wxSize
wxRibbonGallery::DoGetNextLargerSize(wxOrientation direction
,
758 wxSize relative_to
) const
765 wxSize client
= m_art
->GetGalleryClientSize(dc
, this, relative_to
, NULL
,
768 // No need to grow if the given size can already display every item
769 int nitems
= (client
.GetWidth() / m_bitmap_padded_size
.x
) *
770 (client
.GetHeight() / m_bitmap_padded_size
.y
);
771 if(nitems
>= (int)m_items
.GetCount())
777 client
.IncBy(m_bitmap_padded_size
.x
, 0);
780 client
.IncBy(0, m_bitmap_padded_size
.y
);
783 client
.IncBy(m_bitmap_padded_size
);
787 client
.x
= (client
.x
/ m_bitmap_padded_size
.x
) * m_bitmap_padded_size
.x
;
788 client
.y
= (client
.y
/ m_bitmap_padded_size
.y
) * m_bitmap_padded_size
.y
;
790 wxSize size
= m_art
->GetGallerySize(dc
, this, client
);
791 wxSize minimum
= GetMinSize();
793 if(size
.GetWidth() < minimum
.GetWidth() ||
794 size
.GetHeight() < minimum
.GetHeight())
802 size
.SetHeight(relative_to
.GetHeight());
805 size
.SetWidth(relative_to
.GetWidth());
814 bool wxRibbonGallery::IsEmpty() const
816 return m_items
.IsEmpty();
819 unsigned int wxRibbonGallery::GetCount() const
821 return (unsigned int)m_items
.GetCount();
824 wxRibbonGalleryItem
* wxRibbonGallery::GetItem(unsigned int n
)
828 return m_items
.Item(n
);
831 void wxRibbonGallery::SetSelection(wxRibbonGalleryItem
* item
)
833 if(item
!= m_selected_item
)
835 m_selected_item
= item
;
840 wxRibbonGalleryItem
* wxRibbonGallery::GetSelection() const
842 return m_selected_item
;
845 wxRibbonGalleryItem
* wxRibbonGallery::GetHoveredItem() const
847 return m_hovered_item
;
850 wxRibbonGalleryItem
* wxRibbonGallery::GetActiveItem() const
852 return m_active_item
;
855 wxRibbonGalleryButtonState
wxRibbonGallery::GetUpButtonState() const
857 return m_up_button_state
;
860 wxRibbonGalleryButtonState
wxRibbonGallery::GetDownButtonState() const
862 return m_down_button_state
;
865 wxRibbonGalleryButtonState
wxRibbonGallery::GetExtensionButtonState() const
867 return m_extension_button_state
;
870 #endif // wxUSE_RIBBON