Hi everybody,

As a result of my fixing/enhancement around NSMenu* system I've decided to
create a replacement for NSMenuWindowTitle but enhanced. I've attached all
necessary files to test NSTitleView class. Here is some explain:

- Source-GNUmakefile.diff - patch for Source/GNUmakefile, adds
  NSTitleView.m and NSTitleView.h to compile and install;

- NSTitleView.tar.bz2 - NSTitleView.m (gui/Source) and
  NSTitleView.h (gui/Headers/AppKit);

- NSMenuView.diff - patch for using NSTitleView for menus instead
  NSMenuWindowTitleView;

- *.tiff - images for close and miniaturize button (title buttons now
  bordered and images support this, so it isn't WindowMaker style but 
  OPENSTEP style);

- NSMenuTest.tar.bz2 - test program. Choosing Document->New menu item
  produces window with NSTitleView inside window. You can see WindowMaker
  title bar also and can play around with windowStyleMask to see how
  NSTitleView reacts on window style changes compared to WindowMaker's.
  You can drag NSTiteView to move window, close miniaturized button to
  miniaturize window, and close button to close.
  Also notice the following:
  1. Create 2 windows selecting Document->New;
  2. Try to change focus between them. Focused window has black NSTitleView
     and inactive dark gray one. If change focus to another application,
     active window NSTitleView (black) turns into light gray but
     WindowMaker's becomes dark gray;

Why I create this class:
1. It can be used by NSMenuView, NSWindow and so on.
2. It can be used by Login-style applications (that is, before any window
   manager's loaded) to create own panels/windows which can be moved
   around.
3. It can be used by GNUstep ObjectiveC window managers (e.g. Interface).
4. It helps keeping consistent look and feel across the environments.
5. It helps dealing with focus issues.

But this is the simplest part of implementation, I guess. Next important
thing is to make NSWindow using NSTitleView.

But anyway, what do you think about adding this non-standard (Cocoa
and OpenStep doesn't have this) class? Should I commit it to CVS? Is there
any problems or difficulties I missed?

-- 
Serg Stoyan

Attachment: NSMenuTest.tar.bz2
Description: Binary data

--- CVS/core/gui/Source/NSMenuView.m    Mon Mar 31 22:42:31 2003
+++ CVS.build/core/gui/Source/NSMenuView.m      Mon Mar 31 16:12:26 2003
@@ -37,6 +37,7 @@
 #include <AppKit/NSButton.h>
 #include <AppKit/NSWindow.h>
 #include <AppKit/PSOperators.h>
+#include <AppKit/NSTitleView.h>
 
 #include <Foundation/NSDebug.h>
 
@@ -453,7 +454,7 @@
   if (![_menu _ownedByPopUp] && !_titleView)
     {
       // Add title view. If this menu not owned by popup
-      _titleView = [[NSMenuWindowTitleView alloc] init];
+      _titleView = [[NSTitleView alloc] init];
       [self addSubview: _titleView];
       [_titleView release];
     }
@@ -464,15 +465,15 @@
       _titleView = nil;
     }
   
-  if ([_titleView menu] == nil && _titleView)
-    [_titleView setMenu: _menu];
+  if ([_titleView owner] == nil && _titleView)
+    [_titleView setOwner: _menu];
   
   // Resize it anyway.
   [self sizeToFit];
   
   if ([_menu isTornOff] && ![_menu isTransient])
     {
-      [_titleView addCloseButton];
+      [_titleView addCloseButtonWithAction: @selector (_performMenuClose:)];
     }
   else
     {
--- CVS/core/gui/Source/GNUmakefile     Wed Feb 12 02:05:27 2003
+++ CVS.build/core/gui/Source/GNUmakefile       Mon Mar 31 11:47:43 2003
@@ -146,6 +146,7 @@
 NSTextField.m \
 NSTextFieldCell.m \
 NSTextStorage.m \
+NSTitleView.m \
 NSToolbar.m \
 NSToolbarItem.m \
 NSView.m \
@@ -311,6 +312,7 @@
 NSTextFieldCell.h \
 NSTextStorage.h \
 NSTextView.h \
+NSTitleView.h \
 NSToolbar.h \
 NSToolbarItem.h \
 NSView.h \

<<attachment: common_Close.tiff>>

<<attachment: common_CloseH.tiff>>

<<attachment: common_Miniaturize.tiff>>

<<attachment: common_MiniaturizeH.tiff>>

Attachment: NSTitleView.tar.bz2
Description: Binary data

_______________________________________________
Bug-gnustep mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to