Explorer, Docking, Splitter-windows in plain C
-
I am looking for any helpful source code on how to implement Docking windows, Splitter-windows and an Explorer-like tree view in plain C, not C++ and not MFC. I think we can figure out how to display an Explorer-like view of a drive using plain C, but I don't have a clue where to even begin with Docking windows and Splitter windows. Thank you. Ted Green ted@vedit.com
-
I am looking for any helpful source code on how to implement Docking windows, Splitter-windows and an Explorer-like tree view in plain C, not C++ and not MFC. I think we can figure out how to display an Explorer-like view of a drive using plain C, but I don't have a clue where to even begin with Docking windows and Splitter windows. Thank you. Ted Green ted@vedit.com
I don't have any code but I can tell you were to start. Explorer's tree view uses the treeview common control which does not use MFC and can be used from C. Lookup the API function FindFirstFile for information on how to traverse directories. Docking windows and splitter windows use the same type of system. The main window controls the child windows size and location. One of the child windows, the view, is where the data is drawn. When docking windows are used the view window's size and location is changed by the main frame to allow other child windows to be positioned around it. When the docked window is clicked on and the cursor is dragged and released it tells its parent window that it needs space at its new position. The parent window resizes the view. (See Illus. 2.) When a splitter window is used one parent window controls the position of two or more view windows. In Windows Explorer the parent window is the main frame. (See Illus. 3.) When the parent window detects when the cursor pass over it the parent window changes the cursor to the splitter cursor. When the button is pressed and the cursor moved the parent window resizes its child windows (views) based on the cursor's new location. A way to see this behavior is to use the spy tool on Windows Explorer.
Illustrations
- Application window without toolbars.
+---------------------+ <-- Main frame
|Title |
+---------------------+
|File Edit Help |
|+-------------------+| <-- View window takes
|| || up the Main frame's
|| || GetClientRect().
|| ||
|| ||
|| ||
|+-------------------+|
+---------------------+- Notice how the view window size has been
decreased by the toolbar.
+---------------------+ <-- Main frame
|Title |
+---------------------+
|File Edit Help |
|+--------+ | <-- Docking window
|| | | (toolbar)
|+--------+ |
|+-------------------+| <-- View window
|| ||
|| ||
|+-------------------+|
+---------------------+- Like Windows Explorer, the main frame will
act as the splitter. For more complex
designs a child window can handle the
splitter logic.
+---------------------
-
I don't have any code but I can tell you were to start. Explorer's tree view uses the treeview common control which does not use MFC and can be used from C. Lookup the API function FindFirstFile for information on how to traverse directories. Docking windows and splitter windows use the same type of system. The main window controls the child windows size and location. One of the child windows, the view, is where the data is drawn. When docking windows are used the view window's size and location is changed by the main frame to allow other child windows to be positioned around it. When the docked window is clicked on and the cursor is dragged and released it tells its parent window that it needs space at its new position. The parent window resizes the view. (See Illus. 2.) When a splitter window is used one parent window controls the position of two or more view windows. In Windows Explorer the parent window is the main frame. (See Illus. 3.) When the parent window detects when the cursor pass over it the parent window changes the cursor to the splitter cursor. When the button is pressed and the cursor moved the parent window resizes its child windows (views) based on the cursor's new location. A way to see this behavior is to use the spy tool on Windows Explorer.
Illustrations
- Application window without toolbars.
+---------------------+ <-- Main frame
|Title |
+---------------------+
|File Edit Help |
|+-------------------+| <-- View window takes
|| || up the Main frame's
|| || GetClientRect().
|| ||
|| ||
|| ||
|+-------------------+|
+---------------------+- Notice how the view window size has been
decreased by the toolbar.
+---------------------+ <-- Main frame
|Title |
+---------------------+
|File Edit Help |
|+--------+ | <-- Docking window
|| | | (toolbar)
|+--------+ |
|+-------------------+| <-- View window
|| ||
|| ||
|+-------------------+|
+---------------------+- Like Windows Explorer, the main frame will
act as the splitter. For more complex
designs a child window can handle the
splitter logic.
+---------------------
Thank you for the prompt reply. I understand the basics and have programmed windows such as toolbars (before the common control in Win32), rulers, MDI, etc. Its all the "details" that are so time consuming. 1. Explorer tree view - I'm sure that I am not the first person writing an "explorer" in plain C. Its all the details of determining which drives are available, etc. that take time. However, I don't see any stumbling blocks; just would be nice if I could find complete sample code. The "chicoapp" example on MSDN and the FileTree example on codeproject.com are very useful. 2. Docking Windows - Details include the subtle ways that the mainframe's window borders are drawn/shaded when there is a docked window, the algorithm for outlining where the window can be docked. The slider for resizing the docked window in non-trivial. 3. MDI splitter windows. This also looks very difficult. It appears that you may have to sub-class the drawing of the MDI border and scroll bars in order to display the scrollbar "splitter", etc. Perhaps no one has attempted this in plain C. Any references to sample code will be appreciated. Thank you. Ted Green ted@vedit.com