This file is indexed.

/usr/include/wx-2.6/wx/cmdproc.h is in wx2.6-headers 2.6.3.2.2-5ubuntu4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
///////////////////////////////////////////////////////////////////////////////
// Name:        wx/cmdproc.h
// Purpose:     undo/redo capable command processing framework
// Author:      Julian Smart (extracted from docview.h by VZ)
// Modified by:
// Created:     05.11.00
// RCS-ID:      $Id: cmdproc.h,v 1.19 2005/02/19 16:49:25 VZ Exp $
// Copyright:   (c) wxWidgets team
// Licence:     wxWindows licence
///////////////////////////////////////////////////////////////////////////////

#ifndef _WX_CMDPROC_H_
#define _WX_CMDPROC_H_

#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
    #pragma interface "cmdproc.h"
#endif

#include "wx/defs.h"
#include "wx/object.h"
#include "wx/list.h"

class WXDLLEXPORT wxMenu;

// ----------------------------------------------------------------------------
// wxCommand: a single command capable of performing itself
// ----------------------------------------------------------------------------

class WXDLLEXPORT wxCommand : public wxObject
{
public:
    wxCommand(bool canUndoIt = false, const wxString& name = wxEmptyString);
    ~wxCommand(){}

    // Override this to perform a command
    virtual bool Do() = 0;

    // Override this to undo a command
    virtual bool Undo() = 0;

    virtual bool CanUndo() const { return m_canUndo; }
    virtual wxString GetName() const { return m_commandName; }

protected:
    bool     m_canUndo;
    wxString m_commandName;

private:
    DECLARE_CLASS(wxCommand)
};

// ----------------------------------------------------------------------------
// wxCommandProcessor: wxCommand manager
// ----------------------------------------------------------------------------

class WXDLLEXPORT wxCommandProcessor : public wxObject
{
public:
    // if max number of commands is -1, it is unlimited
    wxCommandProcessor(int maxCommands = -1);
    virtual ~wxCommandProcessor();

    // Pass a command to the processor. The processor calls Do(); if
    // successful, is appended to the command history unless storeIt is false.
    virtual bool Submit(wxCommand *command, bool storeIt = true);

    // just store the command without executing it
    virtual void Store(wxCommand *command);

    virtual bool Undo();
    virtual bool Redo();
    virtual bool CanUndo() const;
    virtual bool CanRedo() const;

    // Initialises the current command and menu strings.
    virtual void Initialize();

    // Sets the Undo/Redo menu strings for the current menu.
    virtual void SetMenuStrings();

    // Gets the current Undo menu label.
    wxString GetUndoMenuLabel() const;

    // Gets the current Undo menu label.
    wxString GetRedoMenuLabel() const;

#if wxUSE_MENUS
    // Call this to manage an edit menu.
    void SetEditMenu(wxMenu *menu) { m_commandEditMenu = menu; }
    wxMenu *GetEditMenu() const { return m_commandEditMenu; }
#endif // wxUSE_MENUS

    // command list access
    wxList& GetCommands() const { return (wxList&) m_commands; }
    wxCommand *GetCurrentCommand() const
    {
        return (wxCommand *)(m_currentCommand ? m_currentCommand->GetData() : NULL);
    }
    int GetMaxCommands() const { return m_maxNoCommands; }
    virtual void ClearCommands();

    // Has the current project been changed?
    virtual bool IsDirty() const
    {
        return m_currentCommand && (m_lastSavedCommand != m_currentCommand);
    }

    // Mark the current command as the one where the last save took place
    void MarkAsSaved()
    {
        m_lastSavedCommand = m_currentCommand;
    }


    // By default, the accelerators are "\tCtrl+Z" and "\tCtrl+Y"
    const wxString& GetUndoAccelerator() const { return m_undoAccelerator; }
    const wxString& GetRedoAccelerator() const { return m_redoAccelerator; }

    void SetUndoAccelerator(const wxString& accel) { m_undoAccelerator = accel; }
    void SetRedoAccelerator(const wxString& accel) { m_redoAccelerator = accel; }

protected:
    // for further flexibility, command processor doesn't call wxCommand::Do()
    // and Undo() directly but uses these functions which can be overridden in
    // the derived class
    virtual bool DoCommand(wxCommand& cmd);
    virtual bool UndoCommand(wxCommand& cmd);

    int           m_maxNoCommands;
    wxList        m_commands;
    wxList::compatibility_iterator m_currentCommand,
                                   m_lastSavedCommand;

#if wxUSE_MENUS
    wxMenu*       m_commandEditMenu;
#endif // wxUSE_MENUS

    wxString      m_undoAccelerator;
    wxString      m_redoAccelerator;

private:
    DECLARE_DYNAMIC_CLASS(wxCommandProcessor)
    DECLARE_NO_COPY_CLASS(wxCommandProcessor)
};

#endif // _WX_CMDPROC_H_