btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / servers / print / PrintServerApp.h
blobd4c5a167745af8c614c382627848a015c7ee1127
1 /*
2 * Copyright 2001-2015, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Ithamar R. Adema
7 * Michael Pfeiffer
8 */
9 #ifndef _PRINT_SERVER_APP_H
10 #define _PRINT_SERVER_APP_H
13 #include <Bitmap.h>
14 #include <Catalog.h>
15 #include <OS.h>
16 #include <Server.h>
17 #include <String.h>
19 #include "FolderWatcher.h"
20 #include "ResourceManager.h"
21 #include "Settings.h"
24 class Printer;
25 class Transport;
28 // The global BLocker for synchronisation.
29 extern BLocker *gLock;
32 // The print_server application.
33 class PrintServerApp : public BServer, public FolderListener {
34 private:
35 typedef BServer Inherited;
37 public:
38 PrintServerApp(status_t* error);
39 ~PrintServerApp();
41 void Acquire();
42 void Release();
44 virtual bool QuitRequested();
45 virtual void MessageReceived(BMessage* msg);
46 void NotifyPrinterDeletion(Printer* printer);
48 // Scripting support, see PrintServerApp.Scripting.cpp
49 virtual status_t GetSupportedSuites(BMessage* msg);
50 void HandleScriptingCommand(BMessage* msg);
51 Printer* GetPrinterFromSpecifier(BMessage* msg);
52 Transport* GetTransportFromSpecifier(BMessage* msg);
53 virtual BHandler* ResolveSpecifier(BMessage* msg, int32 index,
54 BMessage* specifier, int32 form,
55 const char* property);
57 private:
58 bool OpenSettings(BFile& file, const char* name,
59 bool forReading);
60 void LoadSettings();
61 void SaveSettings();
63 status_t SetupPrinterList();
65 void HandleSpooledJobs();
67 status_t SelectPrinter(const char* printerName);
68 status_t CreatePrinter(const char* printerName,
69 const char* driverName,
70 const char* connection,
71 const char* transportName,
72 const char* transportPath);
74 void RegisterPrinter(BDirectory* node);
75 void UnregisterPrinter(Printer* printer);
77 // FolderListener
78 void EntryCreated(node_ref* node, entry_ref* entry);
79 void EntryRemoved(node_ref* node);
80 void AttributeChanged(node_ref* node);
82 status_t StoreDefaultPrinter();
83 status_t RetrieveDefaultPrinter();
85 status_t FindPrinterNode(const char* name, BNode& node);
87 // "Classic" BeOS R5 support, see PrintServerApp.R5.cpp
88 static status_t async_thread(void* data);
89 void AsyncHandleMessage(BMessage* msg);
90 void Handle_BeOSR5_Message(BMessage* msg);
92 private:
93 ResourceManager fResourceManager;
94 Printer* fDefaultPrinter;
95 size_t fIconSize;
96 uint8* fSelectedIcon;
97 int32 fReferences;
98 sem_id fHasReferences;
99 Settings* fSettings;
100 bool fUseConfigWindow;
101 FolderWatcher* fFolder;
105 #endif // _PRINT_SERVER_APP_H