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 BPictureButton* AddPictureButton(BView* panel, BRect frame, 51 const char* name, const char* on, 52 const char* off, uint32 what); 53 void PrinterForMimeType(); 54 void SetupPrintersMenu(BMenu* menu); 55 void UpdateAppSettings(const char* mime, const char* printer); 56 void UpdateSettings(bool read); 57 void UpdateUI(); 58 void Setup(config_setup_kind); 59 60 config_setup_kind fKind; 61 Printer* fDefaultPrinter; 62 BMessage* fSettings; 63 AutoReply* fSender; 64 BString fSenderMimeType; 65 66 BString fPrinterName; 67 Printer* fCurrentPrinter; 68 BMessage fPageSettings; 69 BMessage fJobSettings; 70 71 sem_id fFinished; 72 73 BMenuField* fPrinters; 74 BPictureButton* fPageSetup; 75 BPictureButton* fJobSetup; 76 BButton* fOk; 77 BStringView* fPageFormatText; 78 BStringView* fJobSetupText; 79 }; 80 81 82 #endif 83