Banner

Hildon::Banner provides static methods and is not instantiable. These methods allow you to show a small popup window at the top of the screen, which can display text either with or without markup.

Banner Reference

Example

This example shows some of the functionality of Hildon::Banner, showing some simple text when a button is clicked.

Figure 5.19. Banner

Banner

Source Code

File: examplewindow.h

#ifndef _MAEMOMM_EXAMPLEWINDOW_H
#define _MAEMOMM_EXAMPLEWINDOW_H

#include <hildonmm/window.h>
#include <hildonmm/button.h>
#include <hildonmm/banner.h>
#include <gtkmm/buttonbox.h>

class ExampleWindow : public Hildon::Window
{
  public:
    ExampleWindow();
    virtual ~ExampleWindow();

  protected:
    //Signal handlers:
    void on_button_clicked();

    // Child widgets:
    Gtk::HButtonBox box_;
    Hildon::Button button_;
};

#endif /* _MAEMOMM_EXAMPLEWINDOW_H */

File: main.cc

#include <hildonmm.h>
#include "examplewindow.h"

int main(int argc, char *argv[])
{
  // Initialize gtkmm and maemomm:
  Gtk::Main kit(&argc, &argv);
  Hildon::init();

  // Create Window and set it to Program 
  ExampleWindow window;
  Hildon::Program::get_instance()->add_window(window);

  // Begin the main application
  kit.run(window);
  
  return 0;
}

File: examplewindow.cc

#include "examplewindow.h"

ExampleWindow::ExampleWindow() :
  button_(Gtk::Hildon::SIZE_HALFSCREEN_WIDTH | Gtk::Hildon::SIZE_FINGER_HEIGHT,
    Hildon::BUTTON_ARRANGEMENT_VERTICAL,
    "Show banner!",
    "by clicking this button")
{
  set_title("Hildon::Banner example");

  // Attach the callback functions to the activate signal:
  button_.signal_clicked().connect(sigc::mem_fun(*this, &ExampleWindow::on_button_clicked));

  add(box_);
  box_.pack_start(button_);

  // Make all menu widgets visible
  show_all();
}

ExampleWindow::~ExampleWindow()
{
}


void ExampleWindow::on_button_clicked()
{
  Hildon::Banner::show_information(*this, "Hi there");
}