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