forked from MaryamJamal89/PaintForKids
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplicationManager.h
More file actions
87 lines (59 loc) · 2.45 KB
/
ApplicationManager.h
File metadata and controls
87 lines (59 loc) · 2.45 KB
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
#ifndef APPLICATION_MANAGER_H
#define APPLICATION_MANAGER_H
#include "DEFS.h"
#include "Figures\CFigure.h"
#include <stdio.h>
#include <stdlib.h>
#include <cstdlib>
#include <iostream>
using namespace std;
class Action; //Forward Declaration
//Main class that manages everything in the application.
class ApplicationManager
{
enum { MaxFigCount = 200 }; //Max no of figures
private:
int x, y; //click points on Screen
int FigCount; //Actual number of figures
int DORF = 0; //Draw or fill or backgoround
CFigure* FigList[MaxFigCount]; //List of all figures (Array of pointers)
CFigure* CopyFigList[MaxFigCount]; //copy List of all figures (Array of pointers)
int copyArrayLength; // copy number of figures
//Pointers to Input and Output classes
GUI* pGUI;
bool inPlayMode;
public:
int multiSelect;//enabling multiSelect
int figType;
int numberOfDuplicatedFilesName; // this variable to know what number of files that has the same name
int ReturnNumberofDulicatedFile(); // this function use to return numberOfDuplicatedFilesName
void increamentNumberofDulicatedFile(); //this function use to increament numberOfDuplicatedFilesName
ApplicationManager();
~ApplicationManager();
int GetFigCount(); //get number of drawn figures
void ResetFigList(); //deletes all old figures
void Run(); //to run the application
// -- Action-Related Functions
Action* CreateAction(ActionType);
void ExecuteAction(Action*&); //Execute an action
// -- Figures Management Functions
void AddFigure(CFigure* pFig); //Adds a new figure to the FigList
CFigure* GetFigure(int x, int y) const; //Search for a figure given a point inside the figure
CFigure* GetSelectedFigureByFlag(int& selectedIndex, int& selectedNum); //get one selected figure by checking isSelected flag
void InsertFigure(bool isFront); //change location of selected figure to back or front
void DeleteSelectedFigures(); //delete selected figures
void RearrangingFigList(); //remove null refrences from the FigList
// -- Interface Management Functions
GUI* GetGUI() const; //Return pointer to the interface
void UpdateInterface() const; //Redraws all the drawing window
// Saving function
void SaveAll(ofstream& File)const; //Save All Figures To The File :Asmaa
// Show Figures
void ShowAllFigures();
void UnSelectFigures(int mul) const;
void TakeCopyOfFigures();
void TakeFigOfDrawMode();
CFigure* GetRandomFigure();
CFigure* getFigByIndex(int i);
};
#endif