/* Copyright (C) 2005 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see .
*/
#include
namespace Gtk
{
#ifndef GTKMM_DISABLE_DEPRECATED
StatusIcon::StatusIcon(const StockID& stock)
:
// Mark this class as non-derived to allow C++ vfuncs to be skipped.
Glib::ObjectBase(nullptr),
Glib::Object(Glib::ConstructParams(statusicon_class_.init(), "stock", (stock).get_c_str(), nullptr))
{}
#endif // GTKMM_DISABLE_DEPRECATED
#ifndef GTKMM_DISABLE_DEPRECATED
Glib::RefPtr StatusIcon::create(const StockID& stock_id)
{
return Glib::RefPtr( new StatusIcon(stock_id) );
}
#endif // GTKMM_DISABLE_DEPRECATED
Glib::RefPtr StatusIcon::create_from_file(const std::string& filename)
{
Glib::RefPtr status_icon( new StatusIcon() );
status_icon->set_from_file(Glib::ustring(filename));
return status_icon;
}
bool StatusIcon::get_geometry(Glib::RefPtr& screen, Gdk::Rectangle& area, Orientation& orientation)
{
GdkScreen* cscreen = nullptr;
GdkRectangle carea;
const bool result = gtk_status_icon_get_geometry(const_cast(gobj()), &cscreen, &carea, (GtkOrientation*)(&orientation));
if(cscreen)
{
screen = Glib::wrap(cscreen);
screen->reference();
}
*(area.gobj()) = carea;
return result;
}
void StatusIcon::popup_menu_at_position(Menu& menu, guint button, guint32 activate_time)
{
gtk_menu_popup(menu.gobj(), nullptr, nullptr,
gtk_status_icon_position_menu, gobj() /* user_data, passed to gtk_status_icon_position_menu()/ */,
button, activate_time);
}
} // namespace Gtk