Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Attributes
MyBrowserView Class Reference

#import <MyBrowserView.h>

Inheritance diagram for MyBrowserView:
Inheritance graph
[legend]
Collaboration diagram for MyBrowserView:
Collaboration graph
[legend]

List of all members.

Public Member Functions

(IBAction) - load:
(void- awakeFromNib
(void- setFrame:
(void- onLoadingStarted
(void- onLoadingCompleted:
(void- onProgressChange:outOf:
(void- onLocationChange:
(void- onStatusChange:
(void- onSecurityStateChange:
(void- onShowContextMenu:domEvent:domNode:
(void- onShowTooltip:withText:
(void- onHideTooltip
(void- setStatus:ofType:
(NSString *) - title
(void- setTitle:
(void- sizeBrowserTo:
(CHBrowserView *) - createBrowserWindow:
(NSMenu *) - getContextMenu
(NSWindow *) - getNativeWindow
(BOOL- shouldAcceptDragFromSource:

Protected Attributes

IBOutlet id urlbar
IBOutlet id status
IBOutlet id progress
IBOutlet id progressSuper
CHBrowserViewbrowserView
NSStringdefaultStatus
NSStringloadingStatus

Detailed Description

Definition at line 4 of file MyBrowserView.h.


Member Function Documentation

Definition at line 14 of file MyBrowserView.mm.

{
  NSRect bounds = [self bounds];
  browserView = [[CHBrowserView alloc] initWithFrame:bounds];
  [self addSubview:browserView];
  [browserView setContainer:self];
  [browserView addListener:self];

  defaultStatus = NULL;
  loadingStatus = DOCUMENT_DONE_STRING;
  [status setStringValue:loadingStatus];

  [progress retain];
  [progress removeFromSuperview];
}

Here is the call graph for this function:

- (CHBrowserView *) createBrowserWindow: (unsigned int mask

Reimplemented from <CHBrowserContainer>.

Definition at line 177 of file MyBrowserView.mm.

                                     :(unsigned int)mask
{
  // XXX not implemented 
  return NULL;
}
- (NSMenu *) getContextMenu

Reimplemented from <CHBrowserContainer>.

Definition at line 183 of file MyBrowserView.mm.

{
  return nil;
}
- (NSWindow *) getNativeWindow

Reimplemented from <CHBrowserContainer>.

Definition at line 188 of file MyBrowserView.mm.

{
  return [self window];
}
- (IBAction) load: (id sender

Definition at line 8 of file MyBrowserView.mm.

                :(id)sender
{
  NSString* str = [urlbar stringValue];
  [browserView loadURI:str referrer:nil flags:NSLoadFlagsNone];
}

Here is the call graph for this function:

Reimplemented from <CHBrowserListener>.

Definition at line 146 of file MyBrowserView.mm.

{
}
- (void) onLoadingCompleted: (BOOL succeeded

Reimplemented from <CHBrowserListener>.

Definition at line 57 of file MyBrowserView.mm.

                          :(BOOL)succeeded
{
  [progress setIndeterminate:YES];
  [progress stopAnimation:self];
  [progress retain];
  [progress removeFromSuperview];

  loadingStatus = DOCUMENT_DONE_STRING;
  if (defaultStatus) {
    [status setStringValue:defaultStatus];
  }
  else {
    [status setStringValue:loadingStatus];
  }

  [browserView setActive:YES];
#ifdef DEBUG_vidur
  printf("Loading completed\n");
#endif
}

Here is the call graph for this function:

Reimplemented from <CHBrowserListener>.

Definition at line 37 of file MyBrowserView.mm.

{
  if (defaultStatus) {
    [defaultStatus release];
    defaultStatus = NULL;
  }

  [progressSuper addSubview:progress];
  [progress release];
  [progress setIndeterminate:YES];
  [progress startAnimation:self];

  loadingStatus = LOADING_STRING;
  [status setStringValue:loadingStatus];

#ifdef DEBUG_vidur
  printf("Starting to load\n");
#endif
}

Reimplemented from <CHBrowserListener>.

Definition at line 93 of file MyBrowserView.mm.

                        :(NSString*)url 
{
  [urlbar setStringValue:url];
  
#ifdef DEBUG_vidur
  const char* str = [spec cString];
  printf("Location changed to: %s\n", str);
#endif
}
- (void) onProgressChange: (int currentBytes
outOf: (int maxBytes 

Reimplemented from <CHBrowserListener>.

Definition at line 78 of file MyBrowserView.mm.

                        :(int)currentBytes outOf:(int)maxBytes 
{
  if (maxBytes > 0) {
    BOOL isIndeterminate = [progress isIndeterminate];
    if (isIndeterminate) {
      [progress setIndeterminate:NO];
    }
    double val = ((double)currentBytes / (double)maxBytes) * 100.0;
    [progress setDoubleValue:val];
#ifdef DEBUG_vidur
    printf("Progress notification: %f%%\n", val);
#endif
  }
}
- (void) onSecurityStateChange: (unsigned long newState

Reimplemented from <CHBrowserListener>.

Definition at line 132 of file MyBrowserView.mm.

                             :(unsigned long)newState
{
}
- (void) onShowContextMenu: (int flags
domEvent: (nsIDOMEvent*)  aEvent
domNode: (nsIDOMNode*)  aNode 

Reimplemented from <CHBrowserListener>.

Definition at line 136 of file MyBrowserView.mm.

                         :(int)flags domEvent:(nsIDOMEvent*)aEvent domNode:(nsIDOMNode*)aNode
{
  NSLog(@"Showing context menu");
}
- (void) onShowTooltip: (NSPoint)  where
withText: (NSString*)  text 

Reimplemented from <CHBrowserListener>.

Definition at line 141 of file MyBrowserView.mm.

                     :(NSPoint)where withText:(NSString*)text
{
  NSLog(@"Showing tooltip %@", text);
}
- (void) onStatusChange: (NSString*)  aMessage

Reimplemented from <CHBrowserListener>.

Definition at line 127 of file MyBrowserView.mm.

                      :(NSString*)aMessage
{
  NSLog(@"Status is %@", aMessage);
}
- (void) setFrame: (NSRect)  frameRect

Definition at line 30 of file MyBrowserView.mm.

                :(NSRect)frameRect
{
  [super setFrame:frameRect];
  NSRect bounds = [self bounds];
  [browserView setFrame:bounds];
}

Here is the call graph for this function:

- (void) setStatus: (NSString *)  statusString
ofType: (NSStatusType type 

Reimplemented from <CHBrowserContainer>.

Definition at line 103 of file MyBrowserView.mm.

                 :(NSString *)statusString ofType:(NSStatusType)type 
{
  if (type == NSStatusTypeScriptDefault) {
    if (defaultStatus) {
      [defaultStatus release];
    }
    defaultStatus = statusString;
    if (defaultStatus) {
      [defaultStatus retain];
    }
  }
  else if (!statusString) {
    if (defaultStatus) {
      [status setStringValue:defaultStatus];
    }
    else {
      [status setStringValue:loadingStatus];
    }      
  }
  else {
    [status setStringValue:statusString];
  }
}
- (void) setTitle: (NSString *)  title

Reimplemented from <CHBrowserContainer>.

Definition at line 157 of file MyBrowserView.mm.

                :(NSString *)title
{
  NSWindow* window = [self window];
  [window setTitle:title];
}
- (BOOL) shouldAcceptDragFromSource: (id dragSource

Reimplemented from <CHBrowserContainer>.

Definition at line 193 of file MyBrowserView.mm.

                                  :(id)dragSource
{
  return NO;
}
- (void) sizeBrowserTo: (NSSize)  dimensions

Reimplemented from <CHBrowserContainer>.

Definition at line 163 of file MyBrowserView.mm.

                     :(NSSize)dimensions
{
  NSRect bounds = [self bounds];
  float dx = dimensions.width - bounds.size.width;
  float dy = dimensions.height - bounds.size.height;

  NSWindow* window = [self window];
  NSRect frame = [window frame];
  frame.size.width += dx;
  frame.size.height += dy;

  [window setFrame:frame display:YES];
}
- (NSString *) title

Reimplemented from <CHBrowserContainer>.

Definition at line 150 of file MyBrowserView.mm.

{
  NSWindow* window = [self window];
  NSString* str = [window title];
  return str;
}

Member Data Documentation

- (CHBrowserView*) browserView [protected]

Definition at line 11 of file MyBrowserView.h.

- (NSString*) defaultStatus [protected]

Definition at line 12 of file MyBrowserView.h.

- (NSString*) loadingStatus [protected]

Definition at line 13 of file MyBrowserView.h.

- (IBOutlet id) progress [protected]

Definition at line 9 of file MyBrowserView.h.

- (IBOutlet id) progressSuper [protected]

Definition at line 10 of file MyBrowserView.h.

- (IBOutlet id) status [protected]

Definition at line 8 of file MyBrowserView.h.

- (IBOutlet id) urlbar [protected]

Definition at line 7 of file MyBrowserView.h.


The documentation for this class was generated from the following files: