2 * Copyright 2002-2009 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Jerome Duval, jerome.duval@free.fr
8 #ifndef BACKGROUNDS_VIEW_H
9 #define BACKGROUNDS_VIEW_H
15 #include <ColorControl.h>
19 #include <FilePanel.h>
25 #include <ScrollView.h>
26 #include <ScrollBar.h>
28 #include <StringView.h>
29 #include <TextControl.h>
32 #include "BackgroundImage.h"
35 #define SETTINGS_FILE "Backgrounds_settings"
41 class BGImageMenuItem
: public BMenuItem
{
43 BGImageMenuItem(const char* label
, int32 imageIndex
,
44 BMessage
* message
, char shortcut
= 0,
45 uint32 modifiers
= 0);
47 int32
ImageIndex() { return fImageIndex
; }
66 class FramePart
: public BView
{
68 FramePart(int32 part
);
70 void Draw(BRect rect
);
71 void SetDesktop(bool isDesktop
);
74 void _SetSizeAndAlignment();
81 class Preview
: public BControl
{
89 void MouseDown(BPoint point
);
90 void MouseUp(BPoint point
);
91 void MouseMoved(BPoint point
, uint32 transit
,
92 const BMessage
* message
);
93 void AttachedToWindow();
102 class BackgroundsView
: public BBox
{
108 void MessageReceived(BMessage
* message
);
110 void RefsReceived(BMessage
* message
);
113 void WorkspaceActivated(uint32 oldWorkspaces
,
115 int32
AddImage(BPath path
);
116 Image
* GetImage(int32 imageIndex
);
118 bool FoundPositionSetting();
122 void _NotifyServer();
123 void _NotifyScreenPreflet();
124 void _LoadSettings();
125 void _LoadDesktopFolder();
126 void _LoadDefaultFolder();
127 void _LoadFolder(bool isDesktop
);
128 void _LoadRecentFolder(BPath path
);
129 void _UpdateWithCurrent();
130 void _UpdatePreview();
131 void _UpdateButtons();
132 void _SetDesktop(bool isDesktop
);
133 int32
_AddPath(BPath path
);
135 static int32
_NotifyThread(void* data
);
137 BGImageMenuItem
* _FindImageItem(const int32 imageIndex
);
139 bool _AddItem(BGImageMenuItem
* item
);
141 BackgroundImage::Mode
_FindPlacementMode();
143 BColorControl
* fPicker
;
146 BCheckBox
* fIconLabelOutline
;
147 BMenu
* fPlacementMenu
;
149 BMenu
* fWorkspaceMenu
;
150 BTextControl
* fXPlacementText
;
151 BTextControl
* fYPlacementText
;
153 BFilePanel
* fFolderPanel
;
154 ImageFilePanel
* fPanel
;
156 BackgroundImage
* fCurrent
;
158 BackgroundImage::BackgroundImageInfo
* fCurrentInfo
;
160 entry_ref fCurrentRef
;
161 int32 fLastImageIndex
;
162 int32 fLastWorkspaceIndex
;
165 BObjectList
<BPath
> fPathList
;
166 BObjectList
<Image
> fImageList
;
170 FramePart
* fTopRight
;
173 FramePart
* fBottomLeft
;
175 FramePart
* fBottomRight
;
177 bool fFoundPositionSetting
;
180 #endif // BACKGROUNDS_VIEW_H