Difference between revisions of "Console Framework Classes 20103 - OOP344"

From CDOT Wiki
Jump to: navigation, search
(General Internal Header file)
(FWBorder)
Line 46: Line 46:
  
 
===FWBorder===
 
===FWBorder===
====Attributes====
+
<big><syntaxhighlight lang="cpp">
<pre>
+
class FWBorder {
 
   int _row;
 
   int _row;
 
   int _col;
 
   int _col;
 
   int _height;
 
   int _height;
 
   int _width;
 
   int _width;
 +
  char _border[9];
 +
  bool _visible;
 
   FWBorder* _container;
 
   FWBorder* _container;
   bool _visible;
+
   void setLine(char* line, char left, char fill, char right)const;
   char _border[9];
+
protected:
</pre>
+
   int absRow()const;
====Methods====
+
  int absCol()const;
<big><syntaxhighlight lang="cpp">
+
public:
   FWBorder(int Row=-1, int Col=-1,int Height=-1, int Width=-1,
+
   FWBorder(int Row=-1, int Col=-1, int Width=-1,int Height=-1,
          bool Visible = false, FWBorder* Container = (FWBorder*)0,
+
    bool Visible = false,  
          const char* Border=FW_BORDER_CHARS);
+
    const char* Border=FW_BORDER_CHARS,
   virtual void draw()const; //if _container is null, then it is maximized into the size of screen
+
    FWBorder* Container = (FWBorder*)0);
                            // with no borders
+
 
 +
   virtual void draw(int refresh = FW_NO_REFRESH)const;
 
   virtual ~FWBorder();
 
   virtual ~FWBorder();
 
    
 
    
Line 70: Line 73:
 
   void container(FWBorder* theContainer);
 
   void container(FWBorder* theContainer);
 
   FWBorder* container();
 
   FWBorder* container();
 +
 +
  bool fullscreen()const;
  
 
   void row(int val);
 
   void row(int val);
 +
  int row()const;
 +
 
   void col(int val);
 
   void col(int val);
 +
  int col()const;
 +
 
   void size(int height, int width);
 
   void size(int height, int width);
 +
  int height()const;
 +
  int width()const;
 +
};
  
  virtual int row()const;
 
  virtual int col()const;
 
  virtual int height()const;
 
  virtual int width()const;
 
 
</syntaxhighlight></big>
 
</syntaxhighlight></big>

Revision as of 12:10, 8 November 2010

The Frame work

General Internal Header file

#ifndef ___CONFW_H__
#define ___CONFW_H__

 #ifndef _CRT_SECURE_NO_DEPRECATE
 #define _CRT_SECURE_NO_DEPRECATE
 #endif
 #ifndef _CRT_SECURE_NO_WARNINGS
 #define _CRT_SECURE_NO_WARNINGS
 #endif
#include <string.h>

extern "C"{
 #include "iol.h"
};

#define FW_BORDER_CHARS  "/-\\|/-\\|"

#define FW_MAX_NO_FIELDS 100
#define FW_BUTTON_HIT 1
#define FW_MAX_LINE_CHARS  (1024u)

#define FW_REFRESH -2
#define FW_FULL_FRAME -1
#define FW_NO_REFRESH 0


enum MessageStatus{ClearMessage,SetMessage};


#ifdef NO_HELPFUNC
# undef NO_HELPFUNC
#endif
#define NO_HELPFUNC ((void(*)(MessageStatus, FWDialog&))(0))
#ifdef NO_VALDFUNC
# undef NO_VALDFUNC
#endif
#define NO_VALDFUNC ((bool(*)(const char*, FWDialog&))(0))

#endif

Classes

FWBorder

class FWBorder {
  int _row;
  int _col;
  int _height;
  int _width;
  char _border[9];
  bool _visible;
  FWBorder* _container;
  void setLine(char* line, char left, char fill, char right)const;
protected:
  int absRow()const;
  int absCol()const;
public:
  FWBorder(int Row=-1, int Col=-1, int Width=-1,int Height=-1,
    bool Visible = false, 
    const char* Border=FW_BORDER_CHARS,
    FWBorder* Container = (FWBorder*)0);

  virtual void draw(int refresh = FW_NO_REFRESH)const;
  virtual ~FWBorder();
  
  void visible(bool val);
  bool visible()const;

  void container(FWBorder* theContainer);
  FWBorder* container();

  bool fullscreen()const;

  void row(int val);
  int row()const;

  void col(int val);
  int col()const;

  void size(int height, int width);
  int height()const;
  int width()const;
};