1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/ribbon/gallery.cpp
3 // Purpose: Ribbon control which displays a gallery of items to choose from
4 // Author: Peter Cawley
8 // Copyright: (C) Peter Cawley
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
20 #include "wx/ribbon/gallery.h"
21 #include "wx/ribbon/art.h"
22 #include "wx/ribbon/bar.h"
23 #include "wx/dcbuffer.h"
24 #include "wx/clntdata.h"
30 #include "wx/msw/private.h"
33 wxDEFINE_EVENT(wxEVT_COMMAND_RIBBONGALLERY_HOVER_CHANGED
, wxRibbonGalleryEvent
);
34 wxDEFINE_EVENT(wxEVT_COMMAND_RIBBONGALLERY_SELECTED
, wxRibbonGalleryEvent
);
35 wxDEFINE_EVENT(wxEVT_COMMAND_RIBBONGALLERY_CLICKED
, wxRibbonGalleryEvent
);
37 IMPLEMENT_DYNAMIC_CLASS(wxRibbonGalleryEvent
, wxCommandEvent
)
38 IMPLEMENT_CLASS(wxRibbonGallery
, wxRibbonControl
)
40 class wxRibbonGalleryItem
49 void SetId(int id
) {m_id
= id
;}
50 void SetBitmap(const wxBitmap
& bitmap
) {m_bitmap
= bitmap
;}
51 const wxBitmap
& GetBitmap() const {return m_bitmap
;}
52 void SetIsVisible(bool visible
) {m_is_visible
= visible
;}
53 void SetPosition(int x
, int y
, const wxSize
& size
)
55 m_position
= wxRect(wxPoint(x
, y
), size
);
57 bool IsVisible() const {return m_is_visible
;}
58 const wxRect
& GetPosition() const {return m_position
;}
60 void SetClientObject(wxClientData
*data
) {m_client_data
.SetClientObject(data
);}
61 wxClientData
*GetClientObject() const {return m_client_data
.GetClientObject();}
62 void SetClientData(void *data
) {m_client_data
.SetClientData(data
);}
63 void *GetClientData() const {return m_client_data
.GetClientData();}
67 wxClientDataContainer m_client_data
;
73 BEGIN_EVENT_TABLE(wxRibbonGallery
, wxRibbonControl
)
74 EVT_ENTER_WINDOW(wxRibbonGallery::OnMouseEnter
)
75 EVT_ERASE_BACKGROUND(wxRibbonGallery::OnEraseBackground
)
76 EVT_LEAVE_WINDOW(wxRibbonGallery::OnMouseLeave
)
77 EVT_LEFT_DOWN(wxRibbonGallery::OnMouseDown
)
78 EVT_LEFT_UP(wxRibbonGallery::OnMouseUp
)
79 EVT_LEFT_DCLICK(wxRibbonGallery::OnMouseDClick
)
80 EVT_MOTION(wxRibbonGallery::OnMouseMove
)
81 EVT_PAINT(wxRibbonGallery::OnPaint
)
82 EVT_SIZE(wxRibbonGallery::OnSize
)
85 wxRibbonGallery::wxRibbonGallery()
89 wxRibbonGallery::wxRibbonGallery(wxWindow
* parent
,
94 : wxRibbonControl(parent
, id
, pos
, size
, wxBORDER_NONE
)
99 wxRibbonGallery::~wxRibbonGallery()
104 bool wxRibbonGallery::Create(wxWindow
* parent
,
110 if(!wxRibbonControl::Create(parent
, id
, pos
, size
, wxBORDER_NONE
))
119 void wxRibbonGallery::CommonInit(long WXUNUSED(style
))
121 m_selected_item
= NULL
;
122 m_hovered_item
= NULL
;
123 m_active_item
= NULL
;
124 m_scroll_up_button_rect
= wxRect(0, 0, 0, 0);
125 m_scroll_down_button_rect
= wxRect(0, 0, 0, 0);
126 m_extension_button_rect
= wxRect(0, 0, 0, 0);
127 m_mouse_active_rect
= NULL
;
128 m_bitmap_size
= wxSize(64, 32);
129 m_bitmap_padded_size
= m_bitmap_size
;
130 m_item_separation_x
= 0;
131 m_item_separation_y
= 0;
134 m_up_button_state
= wxRIBBON_GALLERY_BUTTON_DISABLED
;
135 m_down_button_state
= wxRIBBON_GALLERY_BUTTON_NORMAL
;
136 m_extension_button_state
= wxRIBBON_GALLERY_BUTTON_NORMAL
;
139 SetBackgroundStyle(wxBG_STYLE_CUSTOM
);
142 void wxRibbonGallery::OnMouseEnter(wxMouseEvent
& evt
)
145 if(m_mouse_active_rect
!= NULL
&& !evt
.LeftIsDown())
147 m_mouse_active_rect
= NULL
;
148 m_active_item
= NULL
;
153 void wxRibbonGallery::OnMouseMove(wxMouseEvent
& evt
)
155 bool refresh
= false;
156 wxPoint pos
= evt
.GetPosition();
158 if(TestButtonHover(m_scroll_up_button_rect
, pos
, &m_up_button_state
))
160 if(TestButtonHover(m_scroll_down_button_rect
, pos
, &m_down_button_state
))
162 if(TestButtonHover(m_extension_button_rect
, pos
, &m_extension_button_state
))
165 wxRibbonGalleryItem
*hovered_item
= NULL
;
166 wxRibbonGalleryItem
*active_item
= NULL
;
167 if(m_client_rect
.Contains(pos
))
169 if(m_art
&& m_art
->GetFlags() & wxRIBBON_BAR_FLOW_VERTICAL
)
170 pos
.x
+= m_scroll_amount
;
172 pos
.y
+= m_scroll_amount
;
174 size_t item_count
= m_items
.Count();
176 for(item_i
= 0; item_i
< item_count
; ++item_i
)
178 wxRibbonGalleryItem
*item
= m_items
.Item(item_i
);
179 if(!item
->IsVisible())
182 if(item
->GetPosition().Contains(pos
))
184 if(m_mouse_active_rect
== &item
->GetPosition())
191 if(active_item
!= m_active_item
)
193 m_active_item
= active_item
;
196 if(hovered_item
!= m_hovered_item
)
198 m_hovered_item
= hovered_item
;
199 wxRibbonGalleryEvent
notification(
200 wxEVT_COMMAND_RIBBONGALLERY_HOVER_CHANGED
, GetId());
201 notification
.SetEventObject(this);
202 notification
.SetGallery(this);
203 notification
.SetGalleryItem(hovered_item
);
204 ProcessWindowEvent(notification
);
212 bool wxRibbonGallery::TestButtonHover(const wxRect
& rect
, wxPoint pos
,
213 wxRibbonGalleryButtonState
* state
)
215 if(*state
== wxRIBBON_GALLERY_BUTTON_DISABLED
)
218 wxRibbonGalleryButtonState new_state
;
219 if(rect
.Contains(pos
))
221 if(m_mouse_active_rect
== &rect
)
222 new_state
= wxRIBBON_GALLERY_BUTTON_ACTIVE
;
224 new_state
= wxRIBBON_GALLERY_BUTTON_HOVERED
;
227 new_state
= wxRIBBON_GALLERY_BUTTON_NORMAL
;
229 if(new_state
!= *state
)
240 void wxRibbonGallery::OnMouseLeave(wxMouseEvent
& WXUNUSED(evt
))
243 m_active_item
= NULL
;
244 if(m_up_button_state
!= wxRIBBON_GALLERY_BUTTON_DISABLED
)
245 m_up_button_state
= wxRIBBON_GALLERY_BUTTON_NORMAL
;
246 if(m_down_button_state
!= wxRIBBON_GALLERY_BUTTON_DISABLED
)
247 m_down_button_state
= wxRIBBON_GALLERY_BUTTON_NORMAL
;
248 if(m_extension_button_state
!= wxRIBBON_GALLERY_BUTTON_DISABLED
)
249 m_extension_button_state
= wxRIBBON_GALLERY_BUTTON_NORMAL
;
250 if(m_hovered_item
!= NULL
)
252 m_hovered_item
= NULL
;
253 wxRibbonGalleryEvent
notification(
254 wxEVT_COMMAND_RIBBONGALLERY_HOVER_CHANGED
, GetId());
255 notification
.SetEventObject(this);
256 notification
.SetGallery(this);
257 ProcessWindowEvent(notification
);
262 void wxRibbonGallery::OnMouseDown(wxMouseEvent
& evt
)
264 wxPoint pos
= evt
.GetPosition();
265 m_mouse_active_rect
= NULL
;
266 if(m_client_rect
.Contains(pos
))
268 if(m_art
&& m_art
->GetFlags() & wxRIBBON_BAR_FLOW_VERTICAL
)
269 pos
.x
+= m_scroll_amount
;
271 pos
.y
+= m_scroll_amount
;
272 size_t item_count
= m_items
.Count();
274 for(item_i
= 0; item_i
< item_count
; ++item_i
)
276 wxRibbonGalleryItem
*item
= m_items
.Item(item_i
);
277 if(!item
->IsVisible())
280 const wxRect
& rect
= item
->GetPosition();
281 if(rect
.Contains(pos
))
283 m_active_item
= item
;
284 m_mouse_active_rect
= &rect
;
289 else if(m_scroll_up_button_rect
.Contains(pos
))
291 if(m_up_button_state
!= wxRIBBON_GALLERY_BUTTON_DISABLED
)
293 m_mouse_active_rect
= &m_scroll_up_button_rect
;
294 m_up_button_state
= wxRIBBON_GALLERY_BUTTON_ACTIVE
;
297 else if(m_scroll_down_button_rect
.Contains(pos
))
299 if(m_down_button_state
!= wxRIBBON_GALLERY_BUTTON_DISABLED
)
301 m_mouse_active_rect
= &m_scroll_down_button_rect
;
302 m_down_button_state
= wxRIBBON_GALLERY_BUTTON_ACTIVE
;
305 else if(m_extension_button_rect
.Contains(pos
))
307 if(m_extension_button_state
!= wxRIBBON_GALLERY_BUTTON_DISABLED
)
309 m_mouse_active_rect
= &m_extension_button_rect
;
310 m_extension_button_state
= wxRIBBON_GALLERY_BUTTON_ACTIVE
;
313 if(m_mouse_active_rect
!= NULL
)
317 void wxRibbonGallery::OnMouseUp(wxMouseEvent
& evt
)
319 if(m_mouse_active_rect
!= NULL
)
321 wxPoint pos
= evt
.GetPosition();
324 if(m_art
&& m_art
->GetFlags() & wxRIBBON_BAR_FLOW_VERTICAL
)
325 pos
.x
+= m_scroll_amount
;
327 pos
.y
+= m_scroll_amount
;
329 if(m_mouse_active_rect
->Contains(pos
))
331 if(m_mouse_active_rect
== &m_scroll_up_button_rect
)
333 m_up_button_state
= wxRIBBON_GALLERY_BUTTON_HOVERED
;
336 else if(m_mouse_active_rect
== &m_scroll_down_button_rect
)
338 m_down_button_state
= wxRIBBON_GALLERY_BUTTON_HOVERED
;
341 else if(m_mouse_active_rect
== &m_extension_button_rect
)
343 m_extension_button_state
= wxRIBBON_GALLERY_BUTTON_HOVERED
;
344 wxCommandEvent
notification(wxEVT_COMMAND_BUTTON_CLICKED
,
346 notification
.SetEventObject(this);
347 ProcessWindowEvent(notification
);
349 else if(m_active_item
!= NULL
)
351 if(m_selected_item
!= m_active_item
)
353 m_selected_item
= m_active_item
;
354 wxRibbonGalleryEvent
notification(
355 wxEVT_COMMAND_RIBBONGALLERY_SELECTED
, GetId());
356 notification
.SetEventObject(this);
357 notification
.SetGallery(this);
358 notification
.SetGalleryItem(m_selected_item
);
359 ProcessWindowEvent(notification
);
362 wxRibbonGalleryEvent
notification(
363 wxEVT_COMMAND_RIBBONGALLERY_CLICKED
, GetId());
364 notification
.SetEventObject(this);
365 notification
.SetGallery(this);
366 notification
.SetGalleryItem(m_selected_item
);
367 ProcessWindowEvent(notification
);
370 m_mouse_active_rect
= NULL
;
371 m_active_item
= NULL
;
376 void wxRibbonGallery::OnMouseDClick(wxMouseEvent
& evt
)
378 // The 2nd click of a double-click should be handled as a click in the
379 // same way as the 1st click of the double-click. This is useful for
380 // scrolling through the gallery.
385 void wxRibbonGallery::SetItemClientObject(wxRibbonGalleryItem
* itm
,
388 itm
->SetClientObject(data
);
391 wxClientData
* wxRibbonGallery::GetItemClientObject(const wxRibbonGalleryItem
* itm
) const
393 return itm
->GetClientObject();
396 void wxRibbonGallery::SetItemClientData(wxRibbonGalleryItem
* itm
, void* data
)
398 itm
->SetClientData(data
);
401 void* wxRibbonGallery::GetItemClientData(const wxRibbonGalleryItem
* itm
) const
403 return itm
->GetClientData();
406 bool wxRibbonGallery::ScrollLines(int lines
)
408 if(m_scroll_limit
== 0 || m_art
== NULL
)
411 return ScrollPixels(lines
* GetScrollLineSize());
414 int wxRibbonGallery::GetScrollLineSize() const
419 int line_size
= m_bitmap_padded_size
.GetHeight();
420 if(m_art
->GetFlags() & wxRIBBON_BAR_FLOW_VERTICAL
)
421 line_size
= m_bitmap_padded_size
.GetWidth();
426 bool wxRibbonGallery::ScrollPixels(int pixels
)
428 if(m_scroll_limit
== 0 || m_art
== NULL
)
433 if(m_scroll_amount
> 0)
435 m_scroll_amount
+= pixels
;
436 if(m_scroll_amount
<= 0)
439 m_up_button_state
= wxRIBBON_GALLERY_BUTTON_DISABLED
;
441 else if(m_up_button_state
== wxRIBBON_GALLERY_BUTTON_DISABLED
)
442 m_up_button_state
= wxRIBBON_GALLERY_BUTTON_NORMAL
;
443 if(m_down_button_state
== wxRIBBON_GALLERY_BUTTON_DISABLED
)
444 m_down_button_state
= wxRIBBON_GALLERY_BUTTON_NORMAL
;
450 if(m_scroll_amount
< m_scroll_limit
)
452 m_scroll_amount
+= pixels
;
453 if(m_scroll_amount
>= m_scroll_limit
)
455 m_scroll_amount
= m_scroll_limit
;
456 m_down_button_state
= wxRIBBON_GALLERY_BUTTON_DISABLED
;
458 else if(m_down_button_state
== wxRIBBON_GALLERY_BUTTON_DISABLED
)
459 m_down_button_state
= wxRIBBON_GALLERY_BUTTON_NORMAL
;
460 if(m_up_button_state
== wxRIBBON_GALLERY_BUTTON_DISABLED
)
461 m_up_button_state
= wxRIBBON_GALLERY_BUTTON_NORMAL
;
468 void wxRibbonGallery::EnsureVisible(const wxRibbonGalleryItem
* item
)
470 if(item
== NULL
|| !item
->IsVisible() || IsEmpty())
473 if(m_art
->GetFlags() & wxRIBBON_BAR_FLOW_VERTICAL
)
475 int x
= item
->GetPosition().GetLeft();
476 int base_x
= m_items
.Item(0)->GetPosition().GetLeft();
477 int delta
= x
- base_x
- m_scroll_amount
;
478 ScrollLines(delta
/ m_bitmap_padded_size
.GetWidth());
482 int y
= item
->GetPosition().GetTop();
483 int base_y
= m_items
.Item(0)->GetPosition().GetTop();
484 int delta
= y
- base_y
- m_scroll_amount
;
485 ScrollLines(delta
/ m_bitmap_padded_size
.GetHeight());
489 bool wxRibbonGallery::IsHovered() const
494 void wxRibbonGallery::OnEraseBackground(wxEraseEvent
& WXUNUSED(evt
))
496 // All painting done in main paint handler to minimise flicker
499 void wxRibbonGallery::OnPaint(wxPaintEvent
& WXUNUSED(evt
))
501 wxAutoBufferedPaintDC
dc(this);
505 m_art
->DrawGalleryBackground(dc
, this, GetSize());
507 int padding_top
= m_art
->GetMetric(wxRIBBON_ART_GALLERY_BITMAP_PADDING_TOP_SIZE
);
508 int padding_left
= m_art
->GetMetric(wxRIBBON_ART_GALLERY_BITMAP_PADDING_LEFT_SIZE
);
510 dc
.SetClippingRegion(m_client_rect
);
512 bool offset_vertical
= true;
513 if(m_art
->GetFlags() & wxRIBBON_BAR_FLOW_VERTICAL
)
514 offset_vertical
= false;
515 size_t item_count
= m_items
.Count();
517 for(item_i
= 0; item_i
< item_count
; ++item_i
)
519 wxRibbonGalleryItem
*item
= m_items
.Item(item_i
);
520 if(!item
->IsVisible())
523 const wxRect
& pos
= item
->GetPosition();
524 wxRect
offset_pos(pos
);
526 offset_pos
.SetTop(offset_pos
.GetTop() - m_scroll_amount
);
528 offset_pos
.SetLeft(offset_pos
.GetLeft() - m_scroll_amount
);
529 m_art
->DrawGalleryItemBackground(dc
, this, offset_pos
, item
);
530 dc
.DrawBitmap(item
->GetBitmap(), offset_pos
.GetLeft() + padding_left
,
531 offset_pos
.GetTop() + padding_top
);
535 void wxRibbonGallery::OnSize(wxSizeEvent
& WXUNUSED(evt
))
540 wxRibbonGalleryItem
* wxRibbonGallery::Append(const wxBitmap
& bitmap
, int id
)
542 wxASSERT(bitmap
.IsOk());
543 if(m_items
.IsEmpty())
545 m_bitmap_size
= bitmap
.GetSize();
550 wxASSERT(bitmap
.GetSize() == m_bitmap_size
);
553 wxRibbonGalleryItem
*item
= new wxRibbonGalleryItem
;
555 item
->SetBitmap(bitmap
);
560 wxRibbonGalleryItem
* wxRibbonGallery::Append(const wxBitmap
& bitmap
, int id
,
563 wxRibbonGalleryItem
*item
= Append(bitmap
, id
);
564 item
->SetClientData(clientData
);
568 wxRibbonGalleryItem
* wxRibbonGallery::Append(const wxBitmap
& bitmap
, int id
,
569 wxClientData
* clientData
)
571 wxRibbonGalleryItem
*item
= Append(bitmap
, id
);
572 item
->SetClientObject(clientData
);
576 void wxRibbonGallery::Clear()
578 size_t item_count
= m_items
.Count();
580 for(item_i
= 0; item_i
< item_count
; ++item_i
)
582 wxRibbonGalleryItem
*item
= m_items
.Item(item_i
);
588 bool wxRibbonGallery::IsSizingContinuous() const
593 void wxRibbonGallery::CalculateMinSize()
595 if(m_art
== NULL
|| !m_bitmap_size
.IsFullySpecified())
597 SetMinSize(wxSize(20, 20));
601 m_bitmap_padded_size
= m_bitmap_size
;
602 m_bitmap_padded_size
.IncBy(
603 m_art
->GetMetric(wxRIBBON_ART_GALLERY_BITMAP_PADDING_LEFT_SIZE
) +
604 m_art
->GetMetric(wxRIBBON_ART_GALLERY_BITMAP_PADDING_RIGHT_SIZE
),
605 m_art
->GetMetric(wxRIBBON_ART_GALLERY_BITMAP_PADDING_TOP_SIZE
) +
606 m_art
->GetMetric(wxRIBBON_ART_GALLERY_BITMAP_PADDING_BOTTOM_SIZE
));
609 SetMinSize(m_art
->GetGallerySize(dc
, this, m_bitmap_padded_size
));
611 // The best size is displaying several items
612 m_best_size
= m_bitmap_padded_size
;
614 m_best_size
= m_art
->GetGallerySize(dc
, this, m_best_size
);
618 bool wxRibbonGallery::Realize()
624 bool wxRibbonGallery::Layout()
631 wxSize client_size
= m_art
->GetGalleryClientSize(dc
, this, GetSize(),
632 &origin
, &m_scroll_up_button_rect
, &m_scroll_down_button_rect
,
633 &m_extension_button_rect
);
634 m_client_rect
= wxRect(origin
, client_size
);
639 size_t item_count
= m_items
.Count();
641 long art_flags
= m_art
->GetFlags();
642 for(item_i
= 0; item_i
< item_count
; ++item_i
)
644 wxRibbonGalleryItem
*item
= m_items
.Item(item_i
);
645 item
->SetIsVisible(true);
646 if(art_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
648 if(y_cursor
+ m_bitmap_padded_size
.y
> client_size
.GetHeight())
653 x_cursor
+= m_bitmap_padded_size
.x
;
655 item
->SetPosition(origin
.x
+ x_cursor
, origin
.y
+ y_cursor
,
656 m_bitmap_padded_size
);
657 y_cursor
+= m_bitmap_padded_size
.y
;
661 if(x_cursor
+ m_bitmap_padded_size
.x
> client_size
.GetWidth())
666 y_cursor
+= m_bitmap_padded_size
.y
;
668 item
->SetPosition(origin
.x
+ x_cursor
, origin
.y
+ y_cursor
,
669 m_bitmap_padded_size
);
670 x_cursor
+= m_bitmap_padded_size
.x
;
673 for(; item_i
< item_count
; ++item_i
)
675 wxRibbonGalleryItem
*item
= m_items
.Item(item_i
);
676 item
->SetIsVisible(false);
678 if(art_flags
& wxRIBBON_BAR_FLOW_VERTICAL
)
679 m_scroll_limit
= x_cursor
;
681 m_scroll_limit
= y_cursor
;
682 if(m_scroll_amount
>= m_scroll_limit
)
684 m_scroll_amount
= m_scroll_limit
;
685 m_down_button_state
= wxRIBBON_GALLERY_BUTTON_DISABLED
;
687 else if(m_down_button_state
== wxRIBBON_GALLERY_BUTTON_DISABLED
)
688 m_down_button_state
= wxRIBBON_GALLERY_BUTTON_NORMAL
;
690 if(m_scroll_amount
<= 0)
693 m_up_button_state
= wxRIBBON_GALLERY_BUTTON_DISABLED
;
695 else if(m_up_button_state
== wxRIBBON_GALLERY_BUTTON_DISABLED
)
696 m_up_button_state
= wxRIBBON_GALLERY_BUTTON_NORMAL
;
701 wxSize
wxRibbonGallery::DoGetBestSize() const
706 wxSize
wxRibbonGallery::DoGetNextSmallerSize(wxOrientation direction
,
707 wxSize relative_to
) const
714 wxSize client
= m_art
->GetGalleryClientSize(dc
, this, relative_to
, NULL
,
728 if(client
.GetWidth() < 0 || client
.GetHeight() < 0)
731 client
.x
= (client
.x
/ m_bitmap_padded_size
.x
) * m_bitmap_padded_size
.x
;
732 client
.y
= (client
.y
/ m_bitmap_padded_size
.y
) * m_bitmap_padded_size
.y
;
734 wxSize size
= m_art
->GetGallerySize(dc
, this, client
);
735 wxSize minimum
= GetMinSize();
737 if(size
.GetWidth() < minimum
.GetWidth() ||
738 size
.GetHeight() < minimum
.GetHeight())
746 size
.SetHeight(relative_to
.GetHeight());
749 size
.SetWidth(relative_to
.GetWidth());
758 wxSize
wxRibbonGallery::DoGetNextLargerSize(wxOrientation direction
,
759 wxSize relative_to
) const
766 wxSize client
= m_art
->GetGalleryClientSize(dc
, this, relative_to
, NULL
,
769 // No need to grow if the given size can already display every item
770 int nitems
= (client
.GetWidth() / m_bitmap_padded_size
.x
) *
771 (client
.GetHeight() / m_bitmap_padded_size
.y
);
772 if(nitems
>= (int)m_items
.GetCount())
778 client
.IncBy(m_bitmap_padded_size
.x
, 0);
781 client
.IncBy(0, m_bitmap_padded_size
.y
);
784 client
.IncBy(m_bitmap_padded_size
);
788 client
.x
= (client
.x
/ m_bitmap_padded_size
.x
) * m_bitmap_padded_size
.x
;
789 client
.y
= (client
.y
/ m_bitmap_padded_size
.y
) * m_bitmap_padded_size
.y
;
791 wxSize size
= m_art
->GetGallerySize(dc
, this, client
);
792 wxSize minimum
= GetMinSize();
794 if(size
.GetWidth() < minimum
.GetWidth() ||
795 size
.GetHeight() < minimum
.GetHeight())
803 size
.SetHeight(relative_to
.GetHeight());
806 size
.SetWidth(relative_to
.GetWidth());
815 bool wxRibbonGallery::IsEmpty() const
817 return m_items
.IsEmpty();
820 unsigned int wxRibbonGallery::GetCount() const
822 return (unsigned int)m_items
.GetCount();
825 wxRibbonGalleryItem
* wxRibbonGallery::GetItem(unsigned int n
)
829 return m_items
.Item(n
);
832 void wxRibbonGallery::SetSelection(wxRibbonGalleryItem
* item
)
834 if(item
!= m_selected_item
)
836 m_selected_item
= item
;
841 wxRibbonGalleryItem
* wxRibbonGallery::GetSelection() const
843 return m_selected_item
;
846 wxRibbonGalleryItem
* wxRibbonGallery::GetHoveredItem() const
848 return m_hovered_item
;
851 wxRibbonGalleryItem
* wxRibbonGallery::GetActiveItem() const
853 return m_active_item
;
856 wxRibbonGalleryButtonState
wxRibbonGallery::GetUpButtonState() const
858 return m_up_button_state
;
861 wxRibbonGalleryButtonState
wxRibbonGallery::GetDownButtonState() const
863 return m_down_button_state
;
866 wxRibbonGalleryButtonState
wxRibbonGallery::GetExtensionButtonState() const
868 return m_extension_button_state
;
871 #endif // wxUSE_RIBBON