view libgui/src/workspace-view.h @ 16463:8e2a853cdd7d

derive workspace_view from octave_dock_widget; style fixes * workspace-view.h, workspace-view.cc (workspace_view): Derive from octave_dock_widget. Delete functions that we now inherit. Style fixes.
author John W. Eaton <jwe@octave.org>
date Sun, 07 Apr 2013 16:08:15 -0400
parents 8c666c7b0e5d
children 64727ed135cb
line wrap: on
line source

/*

Copyright (C) 2013 John W. Eaton
Copyright (C) 2011-2012 Jacob Dawid

This file is part of Octave.

Octave is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.

Octave 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 General Public License
for more details.

You should have received a copy of the GNU General Public License
along with Octave; see the file COPYING.  If not, see
<http://www.gnu.org/licenses/>.

*/

#if !defined (workspace_view_h)
#define workspace_view_h 1

#include <QTreeView>
#include <QSemaphore>

#include "octave-dock-widget.h"
#include "workspace-model.h"

class workspace_view : public octave_dock_widget
{
  Q_OBJECT

public:

  workspace_view (QWidget * parent = 0);

  ~workspace_view (void);

public:

  void setModel (workspace_model *model) { view->setModel (model); }

public slots:

  void model_changed (void);

signals:

  /** signal that user had requested a command on a variable */
  void command_requested (const QString& cmd);

protected:

  void closeEvent (QCloseEvent *event);

protected slots:

  void collapse_requested (QModelIndex index);
  void expand_requested (QModelIndex index);
  void item_double_clicked (QModelIndex index);
  void contextmenu_requested (const QPoint& pos);

  // context menu slots
  void handle_contextmenu_disp (void);
  void handle_contextmenu_plot (void);
  void handle_contextmenu_stem (void);

private:

  void relay_contextmenu_command (const QString& cmdname);

  QTreeView *view;

  struct
  {
    bool local;
    bool global;
    bool persistent;
  } _explicit_collapse;
};

#endif