notepad_point.h

Go to the documentation of this file.
00001 #ifndef __NOTEPAD_POINT_H__
00002 #define __NOTEPAD_POINT_H__
00003 
00004 /**
00005  * File Name  : notepad_point.h
00006  *
00007  * Description: notepad point class
00008  */
00009 
00010 /*
00011  * This file is part of notepad.
00012  *
00013  * notepad is free software: you can redistribute it and/or modify
00014  * it under the terms of the GNU General Public License as published by
00015  * the Free Software Foundation, either version 2 of the License, or
00016  * (at your option) any later version.
00017  *
00018  * notepad is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License
00024  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00025  */
00026 
00027 /**
00028  * Copyright (C) 2010 IREX Technologies B.V.
00029  * All rights reserved.
00030  */
00031  
00032 #include <liberscribble/scb.h>
00033 #include "notepad_utils.h"
00034 
00035 
00036 namespace notepad 
00037 {
00038     class CNPoint
00039     {
00040         public:
00041             // object lifecycle
00042             ~CNPoint();
00043             CNPoint(const CNPoint&);            
00044             CNPoint& operator=(const CNPoint&); 
00045 
00046         public:
00047             // methods
00048             // constructors
00049             CNPoint(int an_X, int a_Y); // X and Y are window coordinates (windowView)
00050             CNPoint(const ScbPoint& p);              // p is ScbPoint and is a storageView coordinate
00051             // View points
00052             ScbPoint deviceView(); // this is the deltaview: x and y are always in portrait and absolute screen coordinates
00053             ScbPoint windowView(); // this is the windowView: x and y are dependent of orientation and borders and as such relative to the window coordinates
00054             ScbPoint storageView();// this is the storageview: x and y are absolute and always in portrait and absolute screen coordinates
00055         public:
00056             // static functions
00057             static void setRotation(np_rotation aRotation);
00058             static void setClipBorder(int border);
00059             static void setBorders(int left, int right, int top, int bottom);
00060             static void setScreen(int w, int h);
00061         private:
00062             CNPoint();
00063             void clipToMaxBorder();
00064 
00065         private:
00066             // members
00067             // x and y are the absolute coordinates on the screen (not the gtk window)
00068             // which is the device view
00069             int x;
00070             int y;
00071 
00072         private:
00073             // class invariant: rotation is the current orientation of the DR 
00074             static np_rotation rotation;
00075             // class invariant: for all x,y: leftborder < x < rightborder && topborder < y < bottomborder
00076             static int left_border;
00077             static int right_border;
00078             static int top_border;
00079             static int bottom_border;
00080             static int max_border;
00081             static int screen_height;
00082             static int screen_width;
00083     };
00084 
00085 }
00086 
00087 #endif // __NOTEPAD_POINT_H__
Generated by  doxygen 1.6.2-20100208