1 // -*- C++ -*-
2 /**
3  * \file WorkAreaManager.cpp
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Abdelrazak Younes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11 
12 #include <config.h>
13 
14 #include "WorkAreaManager.h"
15 
16 #include "Application.h"
17 #include "WorkArea.h"
18 
19 
20 namespace lyx {
21 namespace frontend {
22 
add(WorkArea * wa)23 void WorkAreaManager::add(WorkArea * wa)
24 {
25 	work_areas_.push_back(wa);
26 }
27 
28 
remove(WorkArea * wa)29 void WorkAreaManager::remove(WorkArea * wa)
30 {
31 	work_areas_.remove(wa);
32 }
33 
34 
redrawAll(bool update_metrics)35 void WorkAreaManager::redrawAll(bool update_metrics)
36 {
37 	for (WorkArea * wa : work_areas_)
38 		wa->scheduleRedraw(update_metrics);
39 }
40 
41 
closeAll()42 void WorkAreaManager::closeAll()
43 {
44 	while (!work_areas_.empty())
45 		// WorkArea is de-registering itself.
46 		(*work_areas_.begin())->close();
47 }
48 
49 
unhide(Buffer * buf)50 bool WorkAreaManager::unhide(Buffer * buf)
51 {
52 	if (!work_areas_.empty())
53 		return true;
54 	return theApp()->unhide(buf);
55 }
56 
57 
updateTitles()58 void WorkAreaManager::updateTitles()
59 {
60 	for (WorkArea * wa : work_areas_)
61 		wa->updateWindowTitle();
62 }
63 
64 
65 } // namespace frontend
66 } // namespace lyx
67 
68