Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXPathBox.h
1 /********************************************************************************
2 * *
3 * P a t h B o x W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2025 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXPATHBOX_H
22 #define FXPATHBOX_H
23 
24 #ifndef FXFRAME_H
25 #include "FXFrame.h"
26 #endif
27 
28 namespace FX {
29 
30 
31 class FXIcon;
32 class FXMenuButton;
33 class FXFileAssociations;
34 
35 
37 enum {
38  PATHBOX_NO_OWN_ASSOC = 0x00020000
39  };
40 
41 
47 class FXAPI FXPathBox : public FXFrame {
48  FXDECLARE(FXPathBox)
49 protected:
50  FXString path; // Path text
51  FXFont *font; // Label font
52  FXIcon *icon; // Icon at left
53  FXFileAssociations *associations; // Association table
54  FXIcon *foldericon; // Folder icons
55  FXIcon *cdromicon; // CDROM icon
56  FXIcon *harddiskicon; // Hard disk icon
57  FXIcon *netdriveicon; // Networked drive icon
58  FXIcon *floppyicon; // Floppy icon
59  FXIcon *nethoodicon; // Network neighborhood icon
60  FXIcon *zipdiskicon; // Zip drive icon
61  FXint hiliteBeg; // Highlight when hovering
62  FXint hiliteEnd; // Highlight when hovering
63  FXint selectBeg; // Selection begin
64  FXint selectEnd; // Selection end
65  FXColor textColor; // Text color
66  FXColor selbackColor; // Selected background color
67  FXColor seltextColor; // Selected text color
68  FXint columns; // Number of columns visible
69  FXString help; // Help message
70  FXString tip; // Tooltip
71  FXuchar mode; // Mode widget is in
72 protected:
73  FXPathBox();
74  void drawArrow(FXDCWindow& dc,FXint ix,FXint iy,FXint s) const;
75  FXint getPathComponent(FXint mx,FXint my,FXint& f,FXint& t) const;
76  static FXbool selectPathComponent(const FXString& base,const FXString& path,FXint& f,FXint& t);
77 protected:
78  enum {
79  MOUSE_NONE, // No mouse operation
80  MOUSE_DRAG, // Dragging text
81  MOUSE_TRYDRAG // Tentative drag
82  };
83 private:
84  FXPathBox(const FXPathBox&);
85  FXPathBox &operator=(const FXPathBox&);
86 public:
87  long onPaint(FXObject*,FXSelector,void*);
88  long onEnter(FXObject*,FXSelector,void*);
89  long onLeave(FXObject*,FXSelector,void*);
90  long onLeftBtnPress(FXObject*,FXSelector,void*);
91  long onLeftBtnRelease(FXObject*,FXSelector,void*);
92  long onMiddleBtnPress(FXObject*,FXSelector,void*);
93  long onMiddleBtnRelease(FXObject*,FXSelector,void*);
94  long onRightBtnPress(FXObject*,FXSelector,void*);
95  long onRightBtnRelease(FXObject*,FXSelector,void*);
96  long onMotion(FXObject*,FXSelector,void*);
97  long onCmdSetValue(FXObject*,FXSelector,void*);
98  long onCmdSetStringValue(FXObject*,FXSelector,void*);
99  long onCmdGetStringValue(FXObject*,FXSelector,void*);
100  long onCmdSetHelp(FXObject*,FXSelector,void*);
101  long onCmdGetHelp(FXObject*,FXSelector,void*);
102  long onCmdSetTip(FXObject*,FXSelector,void*);
103  long onCmdGetTip(FXObject*,FXSelector,void*);
104  long onQueryHelp(FXObject*,FXSelector,void*);
105  long onQueryTip(FXObject*,FXSelector,void*);
106  long onTipTimer(FXObject*,FXSelector,void*);
107 public:
108 
110  FXPathBox(FXComposite *p,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=FRAME_SUNKEN|FRAME_THICK,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD);
111 
113  virtual void create();
114 
116  virtual void detach();
117 
119  virtual void destroy();
120 
122  virtual void enable();
123 
125  virtual void disable();
126 
128  virtual FXint getDefaultWidth();
129 
131  virtual FXint getDefaultHeight();
132 
134  void setDirectory(const FXString& newpath,FXbool notify=false);
135 
137  const FXString& getDirectory() const { return path; }
138 
140  void setFont(FXFont *fnt);
141 
143  FXFont* getFont() const { return font; }
144 
146  void setAssociations(FXFileAssociations* assoc,FXbool owned=false,FXbool notify=false);
147 
149  FXFileAssociations* getAssociations() const { return associations; }
150 
152  void setNumColumns(FXint cols);
153 
155  FXint getNumColumns() const { return columns; }
156 
158  void setTextColor(FXColor clr);
159 
161  FXColor getTextColor() const { return textColor; }
162 
164  void setSelBackColor(FXColor clr);
165 
167  FXColor getSelBackColor() const { return selbackColor; }
168 
170  void setSelTextColor(FXColor clr);
171 
173  FXColor getSelTextColor() const { return seltextColor; }
174 
176  void setHelpText(const FXString& text){ help=text; }
177 
179  const FXString& getHelpText() const { return help; }
180 
182  void setTipText(const FXString& text){ tip=text; }
183 
185  const FXString& getTipText() const { return tip; }
186 
188  virtual void save(FXStream& store) const;
189 
191  virtual void load(FXStream& store);
192 
194  virtual ~FXPathBox();
195  };
196 
197 }
198 
199 #endif
FXColor getSelBackColor() const
Return selected background color.
Definition: FXPathBox.h:167
const FXString & getDirectory() const
Return current directory.
Definition: FXPathBox.h:137
The Frame widget provides borders around some contents.
Definition: FXFrame.h:58
Base composite.
Definition: FXComposite.h:32
const FXString & getTipText() const
Get the tool tip message for this label.
Definition: FXPathBox.h:185
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
FXColor getTextColor() const
Get the current text color.
Definition: FXPathBox.h:161
Definition: FX4Splitter.h:28
An Icon is an image with two additional server-side resources: a shape bitmap, which is used to mask ...
Definition: FXIcon.h:42
Path selection widget.
Definition: FXPathBox.h:47
const FXString & getHelpText() const
Get the status line help text for this label.
Definition: FXPathBox.h:179
The FileAssociations object manages file associations between a file extension and a FileAssoc record...
Definition: FXFileAssociations.h:101
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:138
Window Device Context.
Definition: FXDCWindow.h:48
void setTipText(const FXString &text)
Set the tool tip message for this label.
Definition: FXPathBox.h:182
void setHelpText(const FXString &text)
Set the status line help text for this label.
Definition: FXPathBox.h:176
FXFileAssociations * getAssociations() const
Return file associations.
Definition: FXPathBox.h:149
Font class.
Definition: FXFont.h:137
FXFont * getFont() const
Get the text font.
Definition: FXPathBox.h:143
FXColor getSelTextColor() const
Return selected text color.
Definition: FXPathBox.h:173
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42
FXint getNumColumns() const
Return number of visible columns.
Definition: FXPathBox.h:155

Copyright © 1997-2022 Jeroen van der Zijp