menubar.hpp 1.67 KB
Newer Older
Ercan Ersoy's avatar
Ercan Ersoy committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
/*
 MENUBAR.HPP

 License CC0 PUBLIC DOMAIN

 To the extent possible under law, Mark J. Olesen has waived all copyright 
 and related or neighboring rights to FDOSTUI Library. This work is published 
 from: United States.
*/
#ifndef __menubar_hpp__

#include "widget.hpp"
#include "menuitem.h"

class menubar : public widget
{

public:

    menubar(
        int const                       i_pos_x,
        int const                       i_pos_y,
        unsigned int const              i_len_x,
        unsigned int const              i_len_y);
    
    virtual
    ~menubar();

    virtual void
    draw() const;

    enum event_response
    event_key_default(
       enum scancodes const             i_scan);

    virtual enum event_response
    event_key(
        struct event_key const&         i_event);
    
    virtual enum event_response
    event_mouse(
        struct event_mouse const&       i_event);

    void
    set_menu(
        struct menuitembar const*       i_menu);

protected:

    struct item
    {
        struct menuitembar const*       m_menu;
        int                             m_pos_x;
        unsigned int                    m_len_x;
    };

    unsigned                            m_selected;
    struct item*                        m_item;
    size_t                              m_item_count;

private:

    menubar();

    menubar(
        const menubar&);

    menubar&
    operator=(menubar const&);

    void
    draw_item(
        struct item const&              i_item) const;

    void
    popup(
        struct item&                    i_item);

};

#define __menubarbar_hpp__
#endif