1 /* 2 * Copyright 2002-2008, Haiku. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Michael Pfeiffer 7 */ 8 #ifndef _CONFIG_WINDOW_H 9 #define _CONFIG_WINDOW_H 10 11 12 #include <InterfaceKit.h> 13 #include <Window.h> 14 15 #include "BeUtils.h" 16 #include "ObjectList.h" 17 #include "Printer.h" 18 19 20 enum config_setup_kind { 21 kPageSetup, 22 kJobSetup, 23 }; 24 25 26 class ConfigWindow : public BWindow { 27 enum { 28 MSG_PAGE_SETUP = 'cwps', 29 MSG_JOB_SETUP = 'cwjs', 30 MSG_PRINTER_SELECTED = 'cwpr', 31 MSG_OK = 'cwok', 32 MSG_CANCEL = 'cwcl', 33 }; 34 35 public: 36 ConfigWindow(config_setup_kind kind, 37 Printer* defaultPrinter, BMessage* settings, 38 AutoReply* sender); 39 ~ConfigWindow(); 40 void Go(); 41 42 void MessageReceived(BMessage* m); 43 void AboutRequested(); 44 void FrameMoved(BPoint p); 45 46 static BRect GetWindowFrame(); 47 static void SetWindowFrame(BRect frame); 48 49 private: 50 BButton* AddPictureButton(BView* panel, const char* name, 51 const char* picture, uint32 what); 52 void PrinterForMimeType(); 53 void SetupPrintersMenu(BMenu* menu); 54 void UpdateAppSettings(const char* mime, const char* printer); 55 void UpdateSettings(bool read); 56 void UpdateUI(); 57 void Setup(config_setup_kind); 58 59 config_setup_kind fKind; 60 Printer* fDefaultPrinter; 61 BMessage* fSettings; 62 AutoReply* fSender; 63 BString fSenderMimeType; 64 65 BString fPrinterName; 66 Printer* fCurrentPrinter; 67 BMessage fPageSettings; 68 BMessage fJobSettings; 69 70 sem_id fFinished; 71 72 BMenuField* fPrinters; 73 BButton* fPageSetup; 74 BButton* fJobSetup; 75 BButton* fOk; 76 BStringView* fPageFormatText; 77 BStringView* fJobSetupText; 78 }; 79 80 81 #endif 82