00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef __JUCE_DOCUMENTWINDOW_JUCEHEADER__
00033 #define __JUCE_DOCUMENTWINDOW_JUCEHEADER__
00034
00035 #include "juce_ResizableWindow.h"
00036 #include "../buttons/juce_Button.h"
00037 #include "../menus/juce_MenuBarComponent.h"
00038
00039
00040
00063 class JUCE_API DocumentWindow : public ResizableWindow
00064 {
00065 public:
00066
00071 enum TitleBarButtons
00072 {
00073 minimiseButton = 1,
00074 maximiseButton = 2,
00075 closeButton = 4,
00076
00078 allButtons = 7
00079 };
00080
00081
00098 DocumentWindow (const String& name,
00099 const Colour& backgroundColour,
00100 const int requiredButtons,
00101 const bool addToDesktop = true);
00102
00108 ~DocumentWindow();
00109
00110
00116 void setName (const String& newName);
00117
00124 void setIcon (const Image* imageToUse);
00125
00127 void setTitleBarHeight (const int newHeight);
00128
00130 int getTitleBarHeight() const;
00131
00141 void setTitleBarButtonsRequired (const int requiredButtons,
00142 const bool positionTitleBarButtonsOnLeft);
00143
00149 void setTitleBarTextCentred (const bool textShouldBeCentred);
00150
00162 void setMenuBar (MenuBarModel* menuBarModel,
00163 const int menuBarHeight = 0);
00164
00165
00186 virtual void closeButtonPressed();
00187
00193 virtual void minimiseButtonPressed();
00194
00201 virtual void maximiseButtonPressed();
00202
00203
00205 Button* getCloseButton() const throw();
00206
00208 Button* getMinimiseButton() const throw();
00209
00211 Button* getMaximiseButton() const throw();
00212
00213
00214
00216 void paint (Graphics& g);
00218 void resized();
00220 void lookAndFeelChanged();
00222 const BorderSize getBorderThickness();
00224 const BorderSize getContentComponentBorder();
00226 void mouseDoubleClick (const MouseEvent& e);
00228 void userTriedToCloseWindow();
00230 void activeWindowStatusChanged();
00232 int getDesktopWindowStyleFlags() const;
00234 void parentHierarchyChanged();
00235
00236
00237
00238 juce_UseDebuggingNewOperator
00239
00240 private:
00241 int titleBarHeight, menuBarHeight, requiredButtons;
00242 bool positionTitleBarButtonsOnLeft, drawTitleTextCentred;
00243 Button* titleBarButtons [3];
00244 Image* titleBarIcon;
00245 MenuBarComponent* menuBar;
00246 MenuBarModel* menuBarModel;
00247
00248 class ButtonListenerProxy : public ButtonListener
00249 {
00250 public:
00251 ButtonListenerProxy();
00252 void buttonClicked (Button* button);
00253
00254 DocumentWindow* owner;
00255
00256 } buttonListener;
00257
00258 int getBorderSize() const;
00259 void repaintTitleBar();
00260
00261 DocumentWindow (const DocumentWindow&);
00262 const DocumentWindow& operator= (const DocumentWindow&);
00263 };
00264
00265
00266 #endif // __JUCE_DOCUMENTWINDOW_JUCEHEADER__