// Description   : Editing forms for NANO OS $Revision: 16 $

// Copyright     : Proxima Centauri Romania SRL, ALL RIGHTS RESERVED. (http://www.ProximaCentauri.org)

// Author        : Alexander Ioan Mihail

 

#ifndef ourApp_h

#define ourApp_h 1

 

#include "ring1.h"

#include "nano.h"

#include "nui.h"

 

class Browser;

 

using namespace NANO_CORE;

#ifndef USE_QT

 using namespace NANO_UI;

#endif

class DockWindow;

 

class OurApplication : public GApplication

{

  #ifdef USE_QT

    Q_OBJECT

    friend void AppCreateWindow(void*app,ELEMENT*cat,ELEMENT*node);

    friend void CloseApplication(void*application);

  public slots:

      void CreateWidget (QWidget* parent, ELEMENT* node, ELEMENT* browse, QWidget** result);

      void DeleteWidget (QWidget* widget);

  signals:

      void sig_CreateWidget (QWidget* parent, ELEMENT* node, ELEMENT* browse, QWidget** result);

      void sig_DeleteWidget (QWidget* widget);

  public:

      Ui_MainWindow*main_window;

  #else

  public:

    friend void CreateWindow(void*app,ELEMENT*cat,ELEMENT*node);

      void CreateWidget (GControl* parent, ELEMENT* node, ELEMENT* browse, GControl** result);

      void DeleteWidget (GControl* widget);

      DockWindow*main_window;

  #endif

 

  public:

      OurApplication (int& argc, char** argv);

      virtual ~OurApplication ();

      void Dock (GTabPage* w);

};

 

class GenericWindow : public GTabPage

{

  public:

      GenericWindow (OurApplication* app, ELEMENT* node, int resid = 0);

      ~GenericWindow();

      void *ui;

};

 

class DockWindow : public GenericWindow

{

public:

 #ifndef USE_QT

  GSplitter*Splitter;

  GEdit*Log;

  GTabPage*About;

 #endif

  virtual void Notify(GWindow*Sender,int ctrlid);

  DockWindow (OurApplication* app, ELEMENT* node, ELEMENT* path);

};

 

class Edit_Generic : public GenericWindow

{

  public:

      Edit_Generic (OurApplication* app, ELEMENT* node);

};

 

class Edit_Folder : public GenericWindow

{

  public:

      Edit_Folder (OurApplication* app, ELEMENT* node);

};

 

class BrowserItem : public GTreeItem

{

  public:

      BrowserItem (GTreeItem* parent, BOND* st, ELEMENT* target, char* info);

      BrowserItem (Browser* parent, BOND* st, ELEMENT* target, char* info);

      ~BrowserItem ();

      virtual void SetTarget (BOND* sb, ELEMENT* target, GString info);

      ELEMENT* GetTarget ();

      void SetButton ();

      BOND *Tag;

      bool HasLabel(int aspect);

};

 

class Browser : public GTreeView

{

  #ifdef USE_QT

    Q_OBJECT

  public slots:

  #else

  public:

  #endif

      void onExpanded (const QModelIndex& index);

      void onCollapsed (const QModelIndex& index);

      void onItemDoubleClicked (const QModelIndex& index);

      void onEdit ();

      void onRefreshTimer ();

  public:

      Browser (char* name, ELEMENT* target, GWindow* parent);

      ~Browser ();

      virtual void SetTarget (ELEMENT* target);

      void Edit (BOND* tag);

      void RefreshTree (ELEMENT* endpoint, int depth);

      void LogForest (BrowserItem* branch, ELEMENT* ent, int flags);

      void LogTreeAspects (BrowserItem* branch, int flags, ELEMENT* ent);

      void LogAspect (BrowserItem* branch, BOND* sbent, int flags, ELEMENT* ent);

      GTimer *RefreshTimer;

};

 

#endif