Subversion Repositories Filer-Free


Rev 38 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

// This file is part of the free Filer module for RISC OS.
// Copyright © 2007 Graham Shaw.
// Redistribution and modification are permitted under the terms of the
// GNU General Public License (version 2 or any later version).


#include "directory.h"
#include "menu.h"
#include "filer_options.h"
#include "filer_window.h"

class layout_method;
class sort_method;

class filer_menu:
        public menu
        /** The filer window to which this menu belongs.
         * As menus may be shared between windows, ownership may change.

        filer_window* _owner;

        /** The selected object, or 0 if there is more or less than one
         * object selected.

        osgbpb_info* _object;

        /** The display submenu. */
        menu _display_menu;

        /** The rename submenu. */
        menu _rename_menu;

        /** The file access submenu. */
        menu _access_menu;

        /** The find submenu. */
        menu _find_menu;

        /** The filetype submenu. */
        menu _filetype_menu;

        /** The selection submenu. */
        menu _selection_menu;

        /** The options submenu. */
        menu _options_menu;

        /** A buffer for the rename menu option. */
        char* _rename_leafname;

        /** A buffer for the find menu option. */
        char* _find_pattern;

        /** A buffer for the filetype menu option. */
        char* _filetype_field;

        /** A buffer for the menu item leading to the selection menu. */
        char* _selection_text;

        /** The number of known layout methods. */
        unsigned int _layout_count;

        /** An array containing the known layout methods. */
        layout_method** _layout_methods;

        /** The number of known sorting methods. */
        unsigned int _sort_count;

        /** An array containing the known sorting methods. */
        sort_method** _sort_methods;
        /** Construct filer menu.
         * @param app the initial owner of this menu

        filer_menu(application* app);

        /** Destroy filer menu. */

        virtual void handle_menu_selection(wimp_selection& block);
        virtual void handle_menus_deleted();

        /** Show this menu.
         * @param block the pointer location

        void show(wimp_pointer& block);

        /** Update menu according to layout method of owner. */
        void update_layout();

        /** Update menu according to sorting method of owner. */
        void update_sort();

        /** Update menu according to selection within owner. */
        void update_selection();

        /** Update menu according to pathname of owner. */
        void update_pathname();

        /** Update menu to reflect state of owner.
         * @param the (possibly new) new owner of this menu

        void update(filer_window* owner);