71
SetGeometry (nux::Geometry (0, 0, 1, 1));
72
_hlayout = new nux::HLayout (TEXT(""), NUX_TRACKER_LOCATION);
73
_vlayout = new nux::VLayout (TEXT(""), NUX_TRACKER_LOCATION);
74
_item_layout = new nux::VLayout (TEXT(""), NUX_TRACKER_LOCATION);
75
_default_item_layout = new nux::VLayout (TEXT(""), NUX_TRACKER_LOCATION);
77
_left_space = new nux::SpaceLayout (_padding + _anchor_width + _corner_radius, _padding + _anchor_width + _corner_radius, 1, 1000);
78
_right_space = new nux::SpaceLayout (_padding + _corner_radius, _padding + _corner_radius, 1, 1000);
80
_top_space = new nux::SpaceLayout (1, 1000, _padding + _corner_radius, _padding + _corner_radius);
81
_bottom_space = new nux::SpaceLayout (1, 1000, _padding + _corner_radius, _padding + _corner_radius);
83
_vlayout->AddLayout (_top_space, 0);
85
_vlayout->AddLayout (_item_layout, 0);
87
_vlayout->AddLayout (_default_item_layout, 0);
89
_vlayout->AddLayout (_bottom_space, 0);
91
_hlayout->AddLayout (_left_space, 0);
92
_hlayout->AddLayout (_vlayout, 0, nux::eCenter, nux::eFull);
93
_hlayout->AddLayout (_right_space, 0);
95
SetWindowSizeMatchLayout (true);
98
OnMouseDownOutsideArea.connect (sigc::mem_fun (this, &QuicklistView::RecvMouseDownOutsideOfQuicklist));
99
OnMouseDown.connect (sigc::mem_fun (this, &QuicklistView::RecvMouseDown));
100
OnMouseUp.connect (sigc::mem_fun (this, &QuicklistView::RecvMouseUp));
101
OnMouseClick.connect (sigc::mem_fun (this, &QuicklistView::RecvMouseClick));
102
OnMouseMove.connect (sigc::mem_fun (this, &QuicklistView::RecvMouseMove));
103
OnMouseDrag.connect (sigc::mem_fun (this, &QuicklistView::RecvMouseDrag));
104
OnKeyPressed.connect (sigc::mem_fun (this, &QuicklistView::RecvKeyPressed));
105
OnStartFocus.connect (sigc::mem_fun (this, &QuicklistView::RecvStartFocus));
106
OnEndFocus.connect (sigc::mem_fun (this, &QuicklistView::RecvEndFocus));
71
SetGeometry(nux::Geometry(0, 0, 1, 1));
72
_hlayout = new nux::HLayout(TEXT(""), NUX_TRACKER_LOCATION);
73
_vlayout = new nux::VLayout(TEXT(""), NUX_TRACKER_LOCATION);
74
_item_layout = new nux::VLayout(TEXT(""), NUX_TRACKER_LOCATION);
75
_default_item_layout = new nux::VLayout(TEXT(""), NUX_TRACKER_LOCATION);
77
_left_space = new nux::SpaceLayout(_padding + _anchor_width + _corner_radius, _padding + _anchor_width + _corner_radius, 1, 1000);
78
_right_space = new nux::SpaceLayout(_padding + _corner_radius, _padding + _corner_radius, 1, 1000);
80
_top_space = new nux::SpaceLayout(1, 1000, _padding + _corner_radius, _padding + _corner_radius);
81
_bottom_space = new nux::SpaceLayout(1, 1000, _padding + _corner_radius, _padding + _corner_radius);
83
_vlayout->AddLayout(_top_space, 0);
85
_vlayout->AddLayout(_item_layout, 0);
87
_vlayout->AddLayout(_default_item_layout, 0);
89
_vlayout->AddLayout(_bottom_space, 0);
91
_hlayout->AddLayout(_left_space, 0);
92
_hlayout->AddLayout(_vlayout, 0, nux::eCenter, nux::eFull);
93
_hlayout->AddLayout(_right_space, 0);
95
SetWindowSizeMatchLayout(true);
98
OnMouseDownOutsideArea.connect(sigc::mem_fun(this, &QuicklistView::RecvMouseDownOutsideOfQuicklist));
99
OnMouseDown.connect(sigc::mem_fun(this, &QuicklistView::RecvMouseDown));
100
OnMouseUp.connect(sigc::mem_fun(this, &QuicklistView::RecvMouseUp));
101
OnMouseClick.connect(sigc::mem_fun(this, &QuicklistView::RecvMouseClick));
102
OnMouseMove.connect(sigc::mem_fun(this, &QuicklistView::RecvMouseMove));
103
OnMouseDrag.connect(sigc::mem_fun(this, &QuicklistView::RecvMouseDrag));
104
OnKeyEvent.connect(sigc::mem_fun(this, &QuicklistView::RecvKeyPressed));
105
OnStartKeyboardReceiver.connect(sigc::mem_fun(this, &QuicklistView::RecvStartFocus));
106
OnStopKeyboardReceiver.connect(sigc::mem_fun(this, &QuicklistView::RecvEndFocus));
108
108
_mouse_down = false;
109
109
_enable_quicklist_for_testing = false;
110
110
_compute_blur_bkg = true;
112
112
_current_item_index = 0;
114
SetAcceptKeyNavFocus(true);
116
QuicklistView::RecvStartFocus ()
118
QuicklistView::RecvStartFocus()
122
QuicklistView::RecvEndFocus ()
124
QuicklistView::RecvEndFocus()
127
QuicklistView::IsMenuItemSeperator (int index)
129
QuicklistView::IsMenuItemSeperator(int index)
129
131
QuicklistMenuItem* menu_item = NULL;
130
132
DbusmenuMenuitem* item = NULL;
155
QuicklistView::RecvKeyPressed (unsigned int key_sym,
156
unsigned long key_code,
157
unsigned long key_state)
157
QuicklistView::RecvKeyPressed(nux::GraphicsEngine& GfxContext,
158
unsigned long eventType,
159
unsigned long key_sym,
160
unsigned long key_state,
161
const char* character,
162
unsigned short keyCount)
161
// up (highlight previous menu-item)
166
// up (highlight previous menu-item)
164
// protect against edge-case of first item being a separator
165
if (_current_item_index == 1 && IsMenuItemSeperator (0))
169
// protect against edge-case of first item being a separator
170
if (_current_item_index == 1 && IsMenuItemSeperator(0))
168
173
if (_current_item_index > 0)
170
GetNthItems (_current_item_index)->_prelight = false;
175
GetNthItems(_current_item_index)->_prelight = false;
171
176
_current_item_index--;
173
while (IsMenuItemSeperator (_current_item_index))
178
while (IsMenuItemSeperator(_current_item_index))
174
179
_current_item_index--;
176
GetNthItems (_current_item_index)->_prelight = true;
181
GetNthItems(_current_item_index)->_prelight = true;
181
// down (highlight next menu-item)
186
// down (highlight next menu-item)
182
187
case NUX_VK_DOWN:
183
188
case NUX_KP_DOWN:
184
// protect against edge-case of last item being a separator
185
if (_current_item_index == (GetNumItems () - 1) && IsMenuItemSeperator (GetNumItems ()))
189
// protect against edge-case of last item being a separator
190
if (_current_item_index == (GetNumItems() - 1) && IsMenuItemSeperator(GetNumItems()))
188
if (_current_item_index < GetNumItems () - 1)
193
if (_current_item_index < GetNumItems() - 1)
190
GetNthItems (_current_item_index)->_prelight = false;
195
GetNthItems(_current_item_index)->_prelight = false;
191
196
_current_item_index++;
193
while (IsMenuItemSeperator (_current_item_index))
198
while (IsMenuItemSeperator(_current_item_index))
194
199
_current_item_index++;
196
GetNthItems (_current_item_index)->_prelight = true;
201
GetNthItems(_current_item_index)->_prelight = true;
201
// left (close quicklist, go back to laucher key-nav)
206
// left (close quicklist, go back to laucher key-nav)
202
207
case NUX_VK_LEFT:
203
208
case NUX_KP_LEFT:
204
209
_current_item_index = 0;
205
GetNthItems (_current_item_index)->_prelight = true;
210
GetNthItems(_current_item_index)->_prelight = true;
207
212
// inform Launcher we switch back to Launcher key-nav
208
ubus_server_send_message (ubus_server_get_default (),
209
UBUS_QUICKLIST_END_KEY_NAV,
213
ubus_server_send_message(ubus_server_get_default(),
214
UBUS_QUICKLIST_END_KEY_NAV,
213
// esc (close quicklist, exit key-nav)
218
// esc (close quicklist, exit key-nav)
214
219
case NUX_VK_ESCAPE:
215
220
_current_item_index = 0;
216
GetNthItems (_current_item_index)->_prelight = true;
221
GetNthItems(_current_item_index)->_prelight = true;
218
223
// inform UnityScreen we leave key-nav completely
219
ubus_server_send_message (ubus_server_get_default (),
220
UBUS_LAUNCHER_END_KEY_NAV,
224
ubus_server_send_message(ubus_server_get_default(),
225
UBUS_LAUNCHER_END_KEY_NAV,
224
// <SPACE>, <RETURN> (activate selected menu-item)
229
// <SPACE>, <RETURN> (activate selected menu-item)
225
230
case NUX_VK_SPACE:
226
231
case NUX_VK_ENTER:
227
232
case NUX_KP_ENTER:
228
if (_current_item_index >= 0 && _current_item_index < GetNumItems () &&
229
GetNthItems (_current_item_index)->GetEnabled ())
233
if (_current_item_index >= 0 && _current_item_index < GetNumItems() &&
234
GetNthItems(_current_item_index)->GetEnabled())
232
dbusmenu_menuitem_handle_event (GetNthItems (_current_item_index)->_menuItem,
237
dbusmenu_menuitem_handle_event(GetNthItems(_current_item_index)->_menuItem,
236
241
_current_item_index = 0;
237
GetNthItems (_current_item_index)->_prelight = true;
242
GetNthItems(_current_item_index)->_prelight = true;
247
QuicklistView::~QuicklistView ()
252
QuicklistView::~QuicklistView()
253
_texture_bg->UnReference ();
258
_texture_bg->UnReference();
255
260
if (_texture_outline)
256
_texture_outline->UnReference ();
259
_texture_mask->UnReference ();
261
_texture_outline->UnReference();
264
_texture_mask->UnReference();
261
266
std::list<QuicklistMenuItem*>::iterator it;
262
267
for (it = _item_list.begin(); it != _item_list.end(); it++)
264
269
// Remove from introspection
266
271
(*it)->UnReference();
269
274
for (it = _default_item_list.begin(); it != _default_item_list.end(); it++)
271
276
// Remove from introspection
273
278
(*it)->UnReference();
276
_default_item_list.clear ();
281
_default_item_list.clear();
281
QuicklistView::EnableQuicklistForTesting (bool enable_testing)
286
QuicklistView::EnableQuicklistForTesting(bool enable_testing)
283
288
_enable_quicklist_for_testing = enable_testing;
286
void QuicklistView::ShowQuicklistWithTipAt (int anchor_tip_x, int anchor_tip_y)
291
void QuicklistView::ShowQuicklistWithTipAt(int anchor_tip_x, int anchor_tip_y)
288
293
_anchorX = anchor_tip_x;
289
294
_anchorY = anchor_tip_y;
291
296
if (!_enable_quicklist_for_testing)
293
if ((_item_list.size () != 0) || (_default_item_list.size () != 0))
298
if ((_item_list.size() != 0) || (_default_item_list.size() != 0))
295
int offscreen_size = GetBaseY () +
297
nux::GetWindow().GetWindowHeight ();
300
int offscreen_size = GetBaseY() +
302
nux::GetWindow().GetWindowHeight();
299
304
if (offscreen_size > 0)
300
305
_top_size = offscreen_size;
381
386
// This is meant to be easier since the quicklist has a atypical way of working.
384
ret = m_layout->ProcessEvent (window_event, ret, ProcEvInfo);
389
ret = m_layout->ProcessEvent(window_event, ret, ProcEvInfo);
387
// The quicklist itself does not process the evvent. Instead we do some analysis of the event
392
// The quicklist itself does not process the evvent. Instead we do some analysis of the event
388
393
// to detect the user action and perform the correct operation.
389
394
if (ievent.e_event == nux::NUX_MOUSE_PRESSED)
391
if (GetGeometry ().IsPointInside (ievent.e_x, ievent.e_y))
396
if (GetGeometry().IsPointInside(ievent.e_x, ievent.e_y))
393
398
_mouse_down = true;
397
402
_mouse_down = false;
399
404
return nux::eMouseEventSolved;
402
407
else if ((ievent.e_event == nux::NUX_MOUSE_RELEASED) && _mouse_down)
404
409
_mouse_down = false;
406
411
return nux::eMouseEventSolved;
409
ret = OnEvent (ievent, ret, ProcessEventInfo);
414
ret = OnEvent(ievent, ret, ProcessEventInfo);
414
void QuicklistView::Draw (nux::GraphicsEngine& gfxContext, bool forceDraw)
419
void QuicklistView::Draw(nux::GraphicsEngine& gfxContext, bool forceDraw)
416
421
// Get the geometry of the QuicklistView on the display
417
422
nux::Geometry base = GetGeometry();
419
// Get the background of the QuicklistView and apply some
424
// Get the background of the QuicklistView and apply some
420
425
if (_compute_blur_bkg /* Refresh the blurred background*/)
422
nux::ObjectPtr<nux::IOpenGLFrameBufferObject> current_fbo = nux::GetGraphicsDisplay ()->GetGpuDevice ()->GetCurrentFrameBufferObject ();
423
nux::GetGraphicsDisplay ()->GetGpuDevice ()->DeactivateFrameBuffer ();
425
gfxContext.SetViewport (0, 0, gfxContext.GetWindowWidth (), gfxContext.GetWindowHeight ());
426
gfxContext.SetScissor (0, 0, gfxContext.GetWindowWidth (), gfxContext.GetWindowHeight ());
427
gfxContext.GetRenderStates ().EnableScissor (false);
429
nux::ObjectPtr <nux::IOpenGLBaseTexture> bkg_texture = gfxContext.CreateTextureFromBackBuffer (base.x, base.y, base.width, base.height);
427
nux::ObjectPtr<nux::IOpenGLFrameBufferObject> current_fbo = nux::GetGraphicsDisplay()->GetGpuDevice()->GetCurrentFrameBufferObject();
428
nux::GetGraphicsDisplay()->GetGpuDevice()->DeactivateFrameBuffer();
430
gfxContext.SetViewport(0, 0, gfxContext.GetWindowWidth(), gfxContext.GetWindowHeight());
431
gfxContext.SetScissor(0, 0, gfxContext.GetWindowWidth(), gfxContext.GetWindowHeight());
432
gfxContext.GetRenderStates().EnableScissor(false);
434
nux::ObjectPtr <nux::IOpenGLBaseTexture> bkg_texture = gfxContext.CreateTextureFromBackBuffer(base.x, base.y, base.width, base.height);
431
436
nux::TexCoordXForm texxform_bkg;
432
bkg_blur_texture = gfxContext.QRP_GetBlurTexture (0, 0, base.width, base.height, bkg_texture, texxform_bkg, nux::color::White, 1.0f, 3);
437
bkg_blur_texture = gfxContext.QRP_GetBlurTexture(0, 0, base.width, base.height, bkg_texture, texxform_bkg, nux::color::White, 1.0f, 3);
434
if (current_fbo.IsValid ())
436
current_fbo->Activate (true);
437
gfxContext.Push2DWindow (current_fbo->GetWidth (), current_fbo->GetHeight ());
439
if (current_fbo.IsValid())
441
current_fbo->Activate(true);
442
gfxContext.Push2DWindow(current_fbo->GetWidth(), current_fbo->GetHeight());
441
gfxContext.SetViewport (0, 0, gfxContext.GetWindowWidth (), gfxContext.GetWindowHeight ());
442
gfxContext.Push2DWindow (gfxContext.GetWindowWidth (), gfxContext.GetWindowHeight ());
443
gfxContext.ApplyClippingRectangle ();
446
gfxContext.SetViewport(0, 0, gfxContext.GetWindowWidth(), gfxContext.GetWindowHeight());
447
gfxContext.Push2DWindow(gfxContext.GetWindowWidth(), gfxContext.GetWindowHeight());
448
gfxContext.ApplyClippingRectangle();
445
450
_compute_blur_bkg = false;
448
453
// the elements position inside the window are referenced to top-left window
449
454
// corner. So bring base to (0, 0).
452
gfxContext.PushClippingRectangle (base);
457
gfxContext.PushClippingRectangle(base);
454
459
nux::TexCoordXForm texxform_blur_bkg;
455
460
//texxform_blur_bkg.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP);
478
483
nux::color::White);
481
nux::GetGraphicsEngine ().GetRenderStates ().SetBlend (true);
482
nux::GetGraphicsEngine ().GetRenderStates ().SetPremultipliedBlend (nux::SRC_OVER);
483
gfxContext.QRP_2TexMod (base.x,
487
_texture_bg->GetDeviceTexture(),
489
nux::Color(1.0f, 1.0f, 1.0f, 1.0f),
490
_texture_mask->GetDeviceTexture(),
492
nux::Color(1.0f, 1.0f, 1.0f, 1.0f));
486
nux::GetGraphicsEngine().GetRenderStates().SetBlend(true);
487
nux::GetGraphicsEngine().GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);
488
gfxContext.QRP_2TexMod(base.x,
492
_texture_bg->GetDeviceTexture(),
494
nux::Color(1.0f, 1.0f, 1.0f, 1.0f),
495
_texture_mask->GetDeviceTexture(),
497
nux::Color(1.0f, 1.0f, 1.0f, 1.0f));
495
500
nux::TexCoordXForm texxform;
496
501
texxform.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP);
497
texxform.SetTexCoordType (nux::TexCoordXForm::OFFSET_COORD);
499
nux::GetGraphicsEngine ().GetRenderStates ().SetBlend (true);
500
nux::GetGraphicsEngine ().GetRenderStates ().SetPremultipliedBlend (nux::SRC_OVER);
501
gfxContext.QRP_1Tex (base.x,
505
_texture_outline->GetDeviceTexture(),
507
nux::Color(1.0f, 1.0f, 1.0f, 1.0f));
509
nux::GetGraphicsEngine().GetRenderStates().SetBlend (false);
502
texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
504
nux::GetGraphicsEngine().GetRenderStates().SetBlend(true);
505
nux::GetGraphicsEngine().GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);
506
gfxContext.QRP_1Tex(base.x,
510
_texture_outline->GetDeviceTexture(),
512
nux::Color(1.0f, 1.0f, 1.0f, 1.0f));
514
nux::GetGraphicsEngine().GetRenderStates().SetBlend(false);
511
516
std::list<QuicklistMenuItem*>::iterator it;
512
517
for (it = _item_list.begin(); it != _item_list.end(); it++)
614
621
if (!(*it)->GetVisible())
620
y += (*it)->GetBaseHeight ();
627
y += (*it)->GetBaseHeight();
623
630
// We must correct the width of line separators. The rendering of the separator can be smaller than the width of the
624
// quicklist. The reason for that is, the quicklist width is determined by the largest entry it contains. That size is
631
// quicklist. The reason for that is, the quicklist width is determined by the largest entry it contains. That size is
625
632
// only after MaxItemWidth is computed in QuicklistView::PreLayoutManagement.
626
// The setting of the separator width is done here after the Layout cycle for this widget is over. The width of the separator
633
// The setting of the separator width is done here after the Layout cycle for this widget is over. The width of the separator
627
634
// has bee set correctly during the layout cycle, but the cairo rendering still need to be adjusted.
628
int separator_width = nux::Max<int>(_default_item_layout->GetBaseWidth (), _item_layout->GetBaseWidth ());
635
int separator_width = nux::Max<int>(_default_item_layout->GetBaseWidth(), _item_layout->GetBaseWidth());
630
637
for (it = _item_list.begin(); it != _item_list.end(); it++)
632
QuicklistMenuItem* item = (QuicklistMenuItem*) (*it);
633
if (item->GetVisible() && item->CairoSurfaceWidth () != separator_width)
639
QuicklistMenuItem* item = (QuicklistMenuItem*)(*it);
640
if (item->GetVisible() && item->CairoSurfaceWidth() != separator_width)
635
642
// Compute textures of the item.
636
item->UpdateTexture ();
643
item->UpdateTexture();
640
647
for (it = _default_item_list.begin(); it != _default_item_list.end(); it++)
642
QuicklistMenuItem* item = (QuicklistMenuItem*) (*it);
643
if (item->GetVisible() && item->CairoSurfaceWidth () != separator_width)
649
QuicklistMenuItem* item = (QuicklistMenuItem*)(*it);
650
if (item->GetVisible() && item->CairoSurfaceWidth() != separator_width)
645
652
// Compute textures of the item.
646
item->UpdateTexture ();
653
item->UpdateTexture();
653
void QuicklistView::RecvCairoTextChanged (QuicklistMenuItem* cairo_text)
660
void QuicklistView::RecvCairoTextChanged(QuicklistMenuItem* cairo_text)
655
662
_cairo_text_has_changed = true;
658
void QuicklistView::RecvCairoTextColorChanged (QuicklistMenuItem* cairo_text)
663
void QuicklistView::RecvItemMouseClick (QuicklistMenuItem* item, int x, int y)
666
if (IsVisible () && item->GetEnabled ())
668
// Check if the mouse was released over an item and emit the signal
669
CheckAndEmitItemSignal (x + item->GetBaseX (), y + item->GetBaseY ());
675
void QuicklistView::CheckAndEmitItemSignal (int x, int y)
678
std::list<QuicklistMenuItem*>::iterator it;
679
for (it = _item_list.begin(); it != _item_list.end(); it++)
681
if (!(*it)->GetVisible())
684
geo = (*it)->GetGeometry ();
685
geo.width = _item_layout->GetBaseWidth ();
687
if (geo.IsPointInside (x, y))
689
// An action is performed: send the signal back to the application
690
if ((*it)->_menuItem)
692
dbusmenu_menuitem_handle_event ((*it)->_menuItem, "clicked", NULL, 0);
697
for (it = _default_item_list.begin(); it != _default_item_list.end(); it++)
699
if (!(*it)->GetVisible())
702
geo = (*it)->GetGeometry ();
703
geo.width = _default_item_layout->GetBaseWidth ();
705
if (geo.IsPointInside (x, y))
707
// An action is performed: send the signal back to the application
708
if ((*it)->_menuItem)
710
dbusmenu_menuitem_handle_event ((*it)->_menuItem, "clicked", NULL, 0);
716
void QuicklistView::RecvItemMouseRelease (QuicklistMenuItem* item, int x, int y)
721
if (IsVisible () && item->GetEnabled ())
723
// Check if the mouse was released over an item and emit the signal
724
CheckAndEmitItemSignal (x + item->GetBaseX (), y + item->GetBaseY ());
730
void QuicklistView::CancelItemsPrelightStatus ()
732
std::list<QuicklistMenuItem*>::iterator it;
733
for (it = _item_list.begin(); it != _item_list.end(); it++)
735
(*it)->_prelight = false;
738
for (it = _default_item_list.begin(); it != _default_item_list.end(); it++)
740
(*it)->_prelight = false;
744
void QuicklistView::RecvItemMouseDrag (QuicklistMenuItem* item, int x, int y)
747
std::list<QuicklistMenuItem*>::iterator it;
748
for (it = _item_list.begin(); it != _item_list.end(); it++)
750
if (!(*it)->GetVisible())
753
geo = (*it)->GetGeometry ();
754
geo.width = _item_layout->GetBaseWidth ();
756
if (geo.IsPointInside (x + item->GetBaseX (), y + item->GetBaseY ()))
758
(*it)->_prelight = true;
762
(*it)->_prelight = false;
766
for (it = _default_item_list.begin(); it != _default_item_list.end(); it++)
768
if (!(*it)->GetVisible())
771
geo = (*it)->GetGeometry ();
772
geo.width = _default_item_layout->GetBaseWidth ();
774
if (geo.IsPointInside (x + item->GetBaseX (), y + item->GetBaseY ()))
776
(*it)->_prelight = true;
780
(*it)->_prelight = false;
787
void QuicklistView::RecvItemMouseEnter (QuicklistMenuItem* item)
792
void QuicklistView::RecvItemMouseLeave (QuicklistMenuItem* item)
797
void QuicklistView::RecvMouseDown (int x, int y, unsigned long button_flags, unsigned long key_flags)
665
void QuicklistView::RecvCairoTextColorChanged(QuicklistMenuItem* cairo_text)
670
void QuicklistView::RecvItemMouseClick(QuicklistMenuItem* item, int x, int y)
673
if (IsVisible() && item->GetEnabled())
675
// Check if the mouse was released over an item and emit the signal
676
CheckAndEmitItemSignal(x + item->GetBaseX(), y + item->GetBaseY());
682
void QuicklistView::CheckAndEmitItemSignal(int x, int y)
685
std::list<QuicklistMenuItem*>::iterator it;
686
for (it = _item_list.begin(); it != _item_list.end(); it++)
688
if (!(*it)->GetVisible())
691
geo = (*it)->GetGeometry();
692
geo.width = _item_layout->GetBaseWidth();
694
if (geo.IsPointInside(x, y))
696
// An action is performed: send the signal back to the application
697
if ((*it)->_menuItem)
699
dbusmenu_menuitem_handle_event((*it)->_menuItem, "clicked", NULL, 0);
704
for (it = _default_item_list.begin(); it != _default_item_list.end(); it++)
706
if (!(*it)->GetVisible())
709
geo = (*it)->GetGeometry();
710
geo.width = _default_item_layout->GetBaseWidth();
712
if (geo.IsPointInside(x, y))
714
// An action is performed: send the signal back to the application
715
if ((*it)->_menuItem)
717
dbusmenu_menuitem_handle_event((*it)->_menuItem, "clicked", NULL, 0);
723
void QuicklistView::RecvItemMouseRelease(QuicklistMenuItem* item, int x, int y)
728
if (IsVisible() && item->GetEnabled())
730
// Check if the mouse was released over an item and emit the signal
731
CheckAndEmitItemSignal(x + item->GetBaseX(), y + item->GetBaseY());
737
void QuicklistView::CancelItemsPrelightStatus()
739
std::list<QuicklistMenuItem*>::iterator it;
740
for (it = _item_list.begin(); it != _item_list.end(); it++)
742
(*it)->_prelight = false;
745
for (it = _default_item_list.begin(); it != _default_item_list.end(); it++)
747
(*it)->_prelight = false;
751
void QuicklistView::RecvItemMouseDrag(QuicklistMenuItem* item, int x, int y)
754
std::list<QuicklistMenuItem*>::iterator it;
755
for (it = _item_list.begin(); it != _item_list.end(); it++)
757
if (!(*it)->GetVisible())
760
geo = (*it)->GetGeometry();
761
geo.width = _item_layout->GetBaseWidth();
763
if (geo.IsPointInside(x + item->GetBaseX(), y + item->GetBaseY()))
765
(*it)->_prelight = true;
769
(*it)->_prelight = false;
773
for (it = _default_item_list.begin(); it != _default_item_list.end(); it++)
775
if (!(*it)->GetVisible())
778
geo = (*it)->GetGeometry();
779
geo.width = _default_item_layout->GetBaseWidth();
781
if (geo.IsPointInside(x + item->GetBaseX(), y + item->GetBaseY()))
783
(*it)->_prelight = true;
787
(*it)->_prelight = false;
794
void QuicklistView::RecvItemMouseEnter(QuicklistMenuItem* item)
799
void QuicklistView::RecvItemMouseLeave(QuicklistMenuItem* item)
804
void QuicklistView::RecvMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags)
799
806
// if (IsVisible ())
809
void QuicklistView::RecvMouseUp (int x, int y, unsigned long button_flags, unsigned long key_flags)
816
void QuicklistView::RecvMouseUp(int x, int y, unsigned long button_flags, unsigned long key_flags)
811
// Check if the mouse was released over an item and emit the signal
812
CheckAndEmitItemSignal (x, y);
818
// Check if the mouse was released over an item and emit the signal
819
CheckAndEmitItemSignal(x, y);
815
void QuicklistView::RecvMouseClick (int x, int y, unsigned long button_flags, unsigned long key_flags)
822
void QuicklistView::RecvMouseClick(int x, int y, unsigned long button_flags, unsigned long key_flags)
823
void QuicklistView::RecvMouseMove (int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags)
828
void QuicklistView::RecvMouseDrag (int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags)
833
void QuicklistView::RecvMouseDownOutsideOfQuicklist (int x, int y, unsigned long button_flags, unsigned long key_flags)
838
void QuicklistView::RemoveAllMenuItem ()
830
void QuicklistView::RecvMouseMove(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags)
835
void QuicklistView::RecvMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags)
840
void QuicklistView::RecvMouseDownOutsideOfQuicklist(int x, int y, unsigned long button_flags, unsigned long key_flags)
845
void QuicklistView::RemoveAllMenuItem()
840
847
std::list<QuicklistMenuItem*>::iterator it;
841
848
for (it = _item_list.begin(); it != _item_list.end(); it++)
843
850
// Remove from introspection
845
852
(*it)->UnReference();
848
855
for (it = _default_item_list.begin(); it != _default_item_list.end(); it++)
850
857
// Remove from introspection
852
859
(*it)->UnReference();
856
_default_item_list.clear ();
858
_item_layout->Clear ();
859
_default_item_layout->Clear ();
863
_default_item_list.clear();
865
_item_layout->Clear();
866
_default_item_layout->Clear();
860
867
_cairo_text_has_changed = true;
861
nux::GetGraphicsThread ()->AddObjectToRefreshList (this);
868
nux::GetGraphicsThread()->AddObjectToRefreshList(this);
864
void QuicklistView::AddMenuItem (QuicklistMenuItem* item)
871
void QuicklistView::AddMenuItem(QuicklistMenuItem* item)
869
item->sigTextChanged.connect (sigc::mem_fun (this, &QuicklistView::RecvCairoTextChanged));
870
item->sigColorChanged.connect (sigc::mem_fun (this, &QuicklistView::RecvCairoTextColorChanged));
871
item->sigMouseClick.connect (sigc::mem_fun (this, &QuicklistView::RecvItemMouseClick));
872
item->sigMouseReleased.connect (sigc::mem_fun (this, &QuicklistView::RecvItemMouseRelease));
873
item->sigMouseEnter.connect (sigc::mem_fun (this, &QuicklistView::RecvItemMouseEnter));
874
item->sigMouseLeave.connect (sigc::mem_fun (this, &QuicklistView::RecvItemMouseLeave));
875
item->sigMouseDrag.connect (sigc::mem_fun (this, &QuicklistView::RecvItemMouseDrag));
877
_item_list.push_back (item);
876
item->sigTextChanged.connect(sigc::mem_fun(this, &QuicklistView::RecvCairoTextChanged));
877
item->sigColorChanged.connect(sigc::mem_fun(this, &QuicklistView::RecvCairoTextColorChanged));
878
item->sigMouseClick.connect(sigc::mem_fun(this, &QuicklistView::RecvItemMouseClick));
879
item->sigMouseReleased.connect(sigc::mem_fun(this, &QuicklistView::RecvItemMouseRelease));
880
item->sigMouseEnter.connect(sigc::mem_fun(this, &QuicklistView::RecvItemMouseEnter));
881
item->sigMouseLeave.connect(sigc::mem_fun(this, &QuicklistView::RecvItemMouseLeave));
882
item->sigMouseDrag.connect(sigc::mem_fun(this, &QuicklistView::RecvItemMouseDrag));
884
_item_list.push_back(item);
878
885
item->Reference();
879
886
// Add to introspection
882
889
_cairo_text_has_changed = true;
883
nux::GetGraphicsThread ()->AddObjectToRefreshList (this);
887
void QuicklistView::RenderQuicklistView ()
892
int QuicklistView::GetNumItems ()
894
return _item_list.size () + _default_item_list.size ();
897
QuicklistMenuItem* QuicklistView::GetNthItems (int index)
899
if (index < (int)_item_list.size ())
890
nux::GetGraphicsThread()->AddObjectToRefreshList(this);
894
void QuicklistView::RenderQuicklistView()
899
int QuicklistView::GetNumItems()
901
return _item_list.size() + _default_item_list.size();
904
QuicklistMenuItem* QuicklistView::GetNthItems(int index)
906
if (index < (int)_item_list.size())
902
909
std::list<QuicklistMenuItem*>::iterator it;
962
969
cairo_pattern_t* hl_pattern = NULL;
964
971
// create context for dot-pattern
965
dots_surf = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 4, 4);
966
dots_cr = cairo_create (dots_surf);
972
dots_surf = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 4, 4);
973
dots_cr = cairo_create(dots_surf);
968
975
// clear normal context
969
cairo_scale (cr, 1.0f, 1.0f);
970
cairo_set_source_rgba (cr, 0.0f, 0.0f, 0.0f, 0.0f);
971
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
976
cairo_scale(cr, 1.0f, 1.0f);
977
cairo_set_source_rgba(cr, 0.0f, 0.0f, 0.0f, 0.0f);
978
cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
974
981
// prepare drawing for normal context
975
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
982
cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
977
984
// create path in normal context
978
cairo_rectangle (cr, 0.0f, 0.0f, (gdouble) width, (gdouble) height);
985
cairo_rectangle(cr, 0.0f, 0.0f, (gdouble) width, (gdouble) height);
980
987
// fill path of normal context with tint
981
cairo_set_source_rgba (cr,
986
cairo_fill_preserve (cr);
988
cairo_set_source_rgba(cr,
993
cairo_fill_preserve(cr);
988
995
// create pattern in dot-context
989
cairo_set_operator (dots_cr, CAIRO_OPERATOR_CLEAR);
990
cairo_paint (dots_cr);
991
cairo_scale (dots_cr, 1.0f, 1.0f);
992
cairo_set_operator (dots_cr, CAIRO_OPERATOR_OVER);
993
cairo_set_source_rgba (dots_cr,
998
cairo_rectangle (dots_cr, 0.0f, 0.0f, 1.0f, 1.0f);
999
cairo_fill (dots_cr);
1000
cairo_rectangle (dots_cr, 2.0f, 2.0f, 1.0f, 1.0f);
1001
cairo_fill (dots_cr);
1002
dots_pattern = cairo_pattern_create_for_surface (dots_surf);
996
cairo_set_operator(dots_cr, CAIRO_OPERATOR_CLEAR);
997
cairo_paint(dots_cr);
998
cairo_scale(dots_cr, 1.0f, 1.0f);
999
cairo_set_operator(dots_cr, CAIRO_OPERATOR_OVER);
1000
cairo_set_source_rgba(dots_cr,
1005
cairo_rectangle(dots_cr, 0.0f, 0.0f, 1.0f, 1.0f);
1006
cairo_fill(dots_cr);
1007
cairo_rectangle(dots_cr, 2.0f, 2.0f, 1.0f, 1.0f);
1008
cairo_fill(dots_cr);
1009
dots_pattern = cairo_pattern_create_for_surface(dots_surf);
1004
1011
// fill path of normal context with dot-pattern
1005
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
1006
cairo_set_source (cr, dots_pattern);
1007
cairo_pattern_set_extend (dots_pattern, CAIRO_EXTEND_REPEAT);
1008
cairo_fill_preserve (cr);
1009
cairo_pattern_destroy (dots_pattern);
1010
cairo_surface_destroy (dots_surf);
1011
cairo_destroy (dots_cr);
1012
cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
1013
cairo_set_source(cr, dots_pattern);
1014
cairo_pattern_set_extend(dots_pattern, CAIRO_EXTEND_REPEAT);
1015
cairo_fill_preserve(cr);
1016
cairo_pattern_destroy(dots_pattern);
1017
cairo_surface_destroy(dots_surf);
1018
cairo_destroy(dots_cr);
1013
1020
// draw highlight
1014
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
1015
hl_pattern = cairo_pattern_create_radial (hl_x,
1021
cairo_pattern_add_color_stop_rgba (hl_pattern,
1027
cairo_pattern_add_color_stop_rgba (hl_pattern, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f);
1028
cairo_set_source (cr, hl_pattern);
1030
cairo_pattern_destroy (hl_pattern);
1021
cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
1022
hl_pattern = cairo_pattern_create_radial(hl_x,
1028
cairo_pattern_add_color_stop_rgba(hl_pattern,
1034
cairo_pattern_add_color_stop_rgba(hl_pattern, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f);
1035
cairo_set_source(cr, hl_pattern);
1037
cairo_pattern_destroy(hl_pattern);
1033
void ql_setup (cairo_surface_t** surf,
1040
void ql_setup(cairo_surface_t** surf,
1040
1047
// // create context
1041
1048
// if (outline)
1109
1116
//gint upper_dynamic_size = upper_size;
1110
1117
//gint lower_dynamic_size = dynamic_size - upper_dynamic_size;
1119
if (upper_size >= 0)
1114
if(upper_size > height - 2.0f * radius - anchor_height -2 * padding)
1121
if (upper_size > height - 2.0f * radius - anchor_height - 2 * padding)
1116
1123
//g_warning ("[_compute_full_mask_path] incorrect upper_size value");
1117
1124
HeightToAnchor = 0;
1121
HeightToAnchor = height - 2.0f * radius - anchor_height -2 * padding - upper_size;
1128
HeightToAnchor = height - 2.0f * radius - anchor_height - 2 * padding - upper_size;
1126
HeightToAnchor = (height - 2.0f * radius - anchor_height -2*padding) / 2.0f;
1133
HeightToAnchor = (height - 2.0f * radius - anchor_height - 2 * padding) / 2.0f;
1129
cairo_translate (cr, -0.5f, -0.5f);
1136
cairo_translate(cr, -0.5f, -0.5f);
1132
cairo_move_to (cr, padding + anchor_width + radius + ZEROPOINT5, padding + ZEROPOINT5); // Point 1
1133
cairo_line_to (cr, width - padding - radius, padding + ZEROPOINT5); // Point 2
1135
width - padding - radius + ZEROPOINT5,
1136
padding + radius + ZEROPOINT5,
1138
-90.0f * G_PI / 180.0f,
1139
0.0f * G_PI / 180.0f); // Point 4
1141
(gdouble) width - padding + ZEROPOINT5,
1142
(gdouble) height - radius - padding + ZEROPOINT5); // Point 5
1144
(gdouble) width - padding - radius + ZEROPOINT5,
1145
(gdouble) height - padding - radius + ZEROPOINT5,
1147
0.0f * G_PI / 180.0f,
1148
90.0f * G_PI / 180.0f); // Point 7
1150
anchor_width + padding + radius + ZEROPOINT5,
1151
(gdouble) height - padding + ZEROPOINT5); // Point 8
1154
anchor_width + padding + radius + ZEROPOINT5,
1155
(gdouble) height - padding - radius,
1157
90.0f * G_PI / 180.0f,
1158
180.0f * G_PI / 180.0f); // Point 10
1161
padding + anchor_width + ZEROPOINT5,
1162
(gdouble) height - padding - radius - HeightToAnchor + ZEROPOINT5 ); // Point 11
1164
padding + ZEROPOINT5,
1165
(gdouble) height - padding - radius - HeightToAnchor - anchor_height / 2.0f + ZEROPOINT5); // Point 12
1167
padding + anchor_width + ZEROPOINT5,
1168
(gdouble) height - padding - radius - HeightToAnchor - anchor_height + ZEROPOINT5); // Point 13
1170
cairo_line_to (cr, padding + anchor_width + ZEROPOINT5, padding + radius + ZEROPOINT5); // Point 14
1172
padding + anchor_width + radius + ZEROPOINT5,
1173
padding + radius + ZEROPOINT5,
1175
180.0f * G_PI / 180.0f,
1176
270.0f * G_PI / 180.0f);
1178
cairo_close_path (cr);
1139
cairo_move_to(cr, padding + anchor_width + radius + ZEROPOINT5, padding + ZEROPOINT5); // Point 1
1140
cairo_line_to(cr, width - padding - radius, padding + ZEROPOINT5); // Point 2
1142
width - padding - radius + ZEROPOINT5,
1143
padding + radius + ZEROPOINT5,
1145
-90.0f * G_PI / 180.0f,
1146
0.0f * G_PI / 180.0f); // Point 4
1148
(gdouble) width - padding + ZEROPOINT5,
1149
(gdouble) height - radius - padding + ZEROPOINT5); // Point 5
1151
(gdouble) width - padding - radius + ZEROPOINT5,
1152
(gdouble) height - padding - radius + ZEROPOINT5,
1154
0.0f * G_PI / 180.0f,
1155
90.0f * G_PI / 180.0f); // Point 7
1157
anchor_width + padding + radius + ZEROPOINT5,
1158
(gdouble) height - padding + ZEROPOINT5); // Point 8
1161
anchor_width + padding + radius + ZEROPOINT5,
1162
(gdouble) height - padding - radius,
1164
90.0f * G_PI / 180.0f,
1165
180.0f * G_PI / 180.0f); // Point 10
1168
padding + anchor_width + ZEROPOINT5,
1169
(gdouble) height - padding - radius - HeightToAnchor + ZEROPOINT5); // Point 11
1171
padding + ZEROPOINT5,
1172
(gdouble) height - padding - radius - HeightToAnchor - anchor_height / 2.0f + ZEROPOINT5); // Point 12
1174
padding + anchor_width + ZEROPOINT5,
1175
(gdouble) height - padding - radius - HeightToAnchor - anchor_height + ZEROPOINT5); // Point 13
1177
cairo_line_to(cr, padding + anchor_width + ZEROPOINT5, padding + radius + ZEROPOINT5); // Point 14
1179
padding + anchor_width + radius + ZEROPOINT5,
1180
padding + radius + ZEROPOINT5,
1182
180.0f * G_PI / 180.0f,
1183
270.0f * G_PI / 180.0f);
1185
cairo_close_path(cr);
1181
void ql_compute_mask (cairo_t* cr)
1188
void ql_compute_mask(cairo_t* cr)
1183
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
1184
cairo_fill_preserve (cr);
1190
cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
1191
cairo_fill_preserve(cr);
1187
void ql_compute_outline (cairo_t* cr,
1194
void ql_compute_outline(cairo_t* cr,
1192
1199
cairo_pattern_t* pattern = NULL;
1193
1200
float x = 0.0f;
1194
1201
float y = 0.0f;
1195
1202
float offset = 2.5f * ANCHOR_WIDTH / size;
1197
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
1199
pattern = cairo_pattern_create_linear (x, y, size, y);
1200
cairo_pattern_add_color_stop_rgba (pattern, 0.0f,
1205
cairo_pattern_add_color_stop_rgba (pattern, offset,
1210
cairo_pattern_add_color_stop_rgba (pattern, 1.1f * offset,
1211
rgba_line[0] * 0.65f,
1212
rgba_line[1] * 0.65f,
1213
rgba_line[2] * 0.65f,
1215
cairo_pattern_add_color_stop_rgba (pattern, 1.0f,
1216
rgba_line[0] * 0.65f,
1217
rgba_line[1] * 0.65f,
1218
rgba_line[2] * 0.65f,
1220
cairo_set_source (cr, pattern);
1221
cairo_set_line_width (cr, line_width);
1223
cairo_pattern_destroy (pattern);
1226
void ql_draw (cairo_t* cr,
1234
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
1236
// actually draw the mask
1239
cairo_set_line_width (cr, line_width);
1240
cairo_set_source_rgba (cr, rgba[0], rgba[1], rgba[2], rgba[3]);
1245
cairo_set_source_rgba (cr, 1.0f, 1.0f, 1.0f, 1.0f);
1247
cairo_set_source_rgba (cr, 0.0f, 0.0f, 0.0f, 0.0f);
1252
cairo_stroke_preserve (cr);
1254
cairo_fill_preserve (cr);
1257
void ql_finalize (cairo_t** cr,
1265
cairo_set_operator (*cr, CAIRO_OPERATOR_SOURCE);
1267
// actually draw the mask
1270
cairo_set_line_width (*cr, line_width);
1271
cairo_set_source_rgba (*cr, rgba[0], rgba[1], rgba[2], rgba[3]);
1276
cairo_set_source_rgba (*cr, 1.0f, 1.0f, 1.0f, 1.0f);
1278
cairo_set_source_rgba (*cr, 0.0f, 0.0f, 0.0f, 0.0f);
1204
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
1206
pattern = cairo_pattern_create_linear(x, y, size, y);
1207
cairo_pattern_add_color_stop_rgba(pattern, 0.0f,
1212
cairo_pattern_add_color_stop_rgba(pattern, offset,
1217
cairo_pattern_add_color_stop_rgba(pattern, 1.1f * offset,
1218
rgba_line[0] * 0.65f,
1219
rgba_line[1] * 0.65f,
1220
rgba_line[2] * 0.65f,
1222
cairo_pattern_add_color_stop_rgba(pattern, 1.0f,
1223
rgba_line[0] * 0.65f,
1224
rgba_line[1] * 0.65f,
1225
rgba_line[2] * 0.65f,
1227
cairo_set_source(cr, pattern);
1228
cairo_set_line_width(cr, line_width);
1230
cairo_pattern_destroy(pattern);
1233
void ql_draw(cairo_t* cr,
1241
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
1243
// actually draw the mask
1246
cairo_set_line_width(cr, line_width);
1247
cairo_set_source_rgba(cr, rgba[0], rgba[1], rgba[2], rgba[3]);
1252
cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f);
1254
cairo_set_source_rgba(cr, 0.0f, 0.0f, 0.0f, 0.0f);
1259
cairo_stroke_preserve(cr);
1261
cairo_fill_preserve(cr);
1264
void ql_finalize(cairo_t** cr,
1272
cairo_set_operator(*cr, CAIRO_OPERATOR_SOURCE);
1274
// actually draw the mask
1277
cairo_set_line_width(*cr, line_width);
1278
cairo_set_source_rgba(*cr, rgba[0], rgba[1], rgba[2], rgba[3]);
1283
cairo_set_source_rgba(*cr, 1.0f, 1.0f, 1.0f, 1.0f);
1285
cairo_set_source_rgba(*cr, 0.0f, 0.0f, 0.0f, 0.0f);
1289
ql_compute_full_outline_shadow (
1296
ql_compute_full_outline_shadow(
1291
1298
cairo_surface_t* surf,
1477
1484
delete cairo_mask;
1478
1485
delete cairo_outline;
1479
1486
_cairo_text_has_changed = false;
1481
1488
// Request a redraw, so this area will be added to Compiz list of dirty areas.
1485
void QuicklistView::PositionChildLayout (float offsetX, float offsetY)
1489
void QuicklistView::LayoutWindowElements ()
1493
void QuicklistView::NotifyConfigurationChange (int width, int height)
1497
void QuicklistView::SetText (nux::NString text)
1492
void QuicklistView::PositionChildLayout(float offsetX, float offsetY)
1496
void QuicklistView::LayoutWindowElements()
1500
void QuicklistView::NotifyConfigurationChange(int width, int height)
1504
void QuicklistView::SetText(nux::NString text)
1499
1506
if (_labelText == text)
1502
1509
_labelText = text;
1506
void QuicklistView::TestMenuItems (DbusmenuMenuitem* root)
1513
void QuicklistView::TestMenuItems(DbusmenuMenuitem* root)
1508
RemoveAllMenuItem ();
1515
RemoveAllMenuItem();
1513
GList * child = NULL;
1520
GList* child = NULL;
1514
1521
for (child = dbusmenu_menuitem_get_children(root); child != NULL; child = g_list_next(child))
1516
const gchar* type = dbusmenu_menuitem_property_get ((DbusmenuMenuitem*)child->data, DBUSMENU_MENUITEM_PROP_TYPE);
1517
const gchar* toggle_type = dbusmenu_menuitem_property_get ((DbusmenuMenuitem*)child->data, DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE);
1519
if (g_strcmp0 (type, DBUSMENU_CLIENT_TYPES_SEPARATOR) == 0)
1521
QuicklistMenuItemSeparator* item = new QuicklistMenuItemSeparator ((DbusmenuMenuitem*)child->data, NUX_TRACKER_LOCATION);
1524
else if (g_strcmp0 (toggle_type, DBUSMENU_MENUITEM_TOGGLE_CHECK) == 0)
1526
QuicklistMenuItemCheckmark* item = new QuicklistMenuItemCheckmark ((DbusmenuMenuitem*)child->data, NUX_TRACKER_LOCATION);
1529
else if (g_strcmp0 (toggle_type, DBUSMENU_MENUITEM_TOGGLE_RADIO) == 0)
1531
QuicklistMenuItemRadio* item = new QuicklistMenuItemRadio ((DbusmenuMenuitem*)child->data, NUX_TRACKER_LOCATION);
1534
else //if (g_strcmp0 (type, DBUSMENU_MENUITEM_PROP_LABEL) == 0)
1536
QuicklistMenuItemLabel* item = new QuicklistMenuItemLabel ((DbusmenuMenuitem*)child->data, NUX_TRACKER_LOCATION);
1523
const gchar* type = dbusmenu_menuitem_property_get((DbusmenuMenuitem*)child->data, DBUSMENU_MENUITEM_PROP_TYPE);
1524
const gchar* toggle_type = dbusmenu_menuitem_property_get((DbusmenuMenuitem*)child->data, DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE);
1526
if (g_strcmp0(type, DBUSMENU_CLIENT_TYPES_SEPARATOR) == 0)
1528
QuicklistMenuItemSeparator* item = new QuicklistMenuItemSeparator((DbusmenuMenuitem*)child->data, NUX_TRACKER_LOCATION);
1531
else if (g_strcmp0(toggle_type, DBUSMENU_MENUITEM_TOGGLE_CHECK) == 0)
1533
QuicklistMenuItemCheckmark* item = new QuicklistMenuItemCheckmark((DbusmenuMenuitem*)child->data, NUX_TRACKER_LOCATION);
1536
else if (g_strcmp0(toggle_type, DBUSMENU_MENUITEM_TOGGLE_RADIO) == 0)
1538
QuicklistMenuItemRadio* item = new QuicklistMenuItemRadio((DbusmenuMenuitem*)child->data, NUX_TRACKER_LOCATION);
1541
else //if (g_strcmp0 (type, DBUSMENU_MENUITEM_PROP_LABEL) == 0)
1543
QuicklistMenuItemLabel* item = new QuicklistMenuItemLabel((DbusmenuMenuitem*)child->data, NUX_TRACKER_LOCATION);
1542
1549
// Introspection
1544
const gchar* QuicklistView::GetName ()
1546
return g_strdup (_name);
1549
void QuicklistView::AddProperties (GVariantBuilder *builder)
1551
g_variant_builder_add (builder, "{sv}", "x", g_variant_new_int32 (GetBaseX ()));
1552
g_variant_builder_add (builder, "{sv}", "y", g_variant_new_int32 (GetBaseY ()));
1553
g_variant_builder_add (builder, "{sv}", "width", g_variant_new_int32 (GetBaseWidth ()));
1554
g_variant_builder_add (builder, "{sv}", "height", g_variant_new_int32 (GetBaseHeight ()));
1555
g_variant_builder_add (builder, "{sv}", "active", g_variant_new_boolean (IsVisible ()));
1551
const gchar* QuicklistView::GetName()
1553
return g_strdup(_name);
1556
void QuicklistView::AddProperties(GVariantBuilder* builder)
1558
g_variant_builder_add(builder, "{sv}", "x", g_variant_new_int32(GetBaseX()));
1559
g_variant_builder_add(builder, "{sv}", "y", g_variant_new_int32(GetBaseY()));
1560
g_variant_builder_add(builder, "{sv}", "width", g_variant_new_int32(GetBaseWidth()));
1561
g_variant_builder_add(builder, "{sv}", "height", g_variant_new_int32(GetBaseHeight()));
1562
g_variant_builder_add(builder, "{sv}", "active", g_variant_new_boolean(IsVisible()));
1569
QuicklistView::InspectKeyEvent(unsigned int eventType,
1570
unsigned int keysym,
1571
const char* character)
1573
// The Quicklist accepts all key inputs.