ObjGUI  Diff

Differences From Artifact [602c7b29cd]:

To Artifact [9cad780e9f]:


40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//==================================================================================================================================
static int CALLBACK Resize_EnumChildren(HWND child, LPARAM lparam)
{
  //it appears this is actually EnumAncestorWindows, and not EnumDirectChildWindows
  //so make sure child.parent == use
  HWND parent = (HWND)lparam;
  if(GetParent(child) != parent) return 1;
  
  RECT rc;
  GetClientRect(parent, &rc);
  SetWindowPos(child, NULL, 0, 0, rc.right, rc.bottom,
               SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER);
  return 1;
}
//==================================================================================================================================







|







40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//==================================================================================================================================
static int CALLBACK Resize_EnumChildren(HWND child, LPARAM lparam)
{
  //it appears this is actually EnumAncestorWindows, and not EnumDirectChildWindows
  //so make sure child.parent == use
  HWND parent = (HWND)lparam;
  if(GetParent(child) != parent) return 1;

  RECT rc;
  GetClientRect(parent, &rc);
  SetWindowPos(child, NULL, 0, 0, rc.right, rc.bottom,
               SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER);
  return 1;
}
//==================================================================================================================================
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//----------------------------------------------------------------------------------------------------------------------------------
- init
{
  self = [super init];

  SetWindowLong(widget, GWL_EXSTYLE, WS_EX_OVERLAPPEDWINDOW);
  //"event connections" are handled in MessageReceived
  
  [self retain];
  return self;
}
//----------------------------------------------------------------------------------------------------------------------------------
- (OFString*)title
{
  int tlen = GetWindowTextLength(widget);
  char *buff = (char *)malloc(tlen + 1);
  GetWindowText(widget, buff, tlen+1);
  
  OFString *ret = [OFString stringWithUTF8String : buff];
  free(buff);
  return ret;
}
//----------------------------------------------------------------------------------------------------------------------------------
- (void)setTitle: (OFString*)title
{







|









|







63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//----------------------------------------------------------------------------------------------------------------------------------
- init
{
  self = [super init];

  SetWindowLong(widget, GWL_EXSTYLE, WS_EX_OVERLAPPEDWINDOW);
  //"event connections" are handled in MessageReceived

  [self retain];
  return self;
}
//----------------------------------------------------------------------------------------------------------------------------------
- (OFString*)title
{
  int tlen = GetWindowTextLength(widget);
  char *buff = (char *)malloc(tlen + 1);
  GetWindowText(widget, buff, tlen+1);

  OFString *ret = [OFString stringWithUTF8String : buff];
  free(buff);
  return ret;
}
//----------------------------------------------------------------------------------------------------------------------------------
- (void)setTitle: (OFString*)title
{
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
  [pool release];
  return YES;
}
//----------------------------------------------------------------------------------------------------------------------------------
- (int)MessageReceived : (HWND)hwnd : (UINT)msg : (WPARAM)wparam : (LPARAM)lparam
{
  HWND ctrlHwnd;
  
  switch(msg)
  {
    case WM_COMMAND:
      //NOTE: TODO: IMPLEMENT: this may need revised later for Menus and Accelerators
      ctrlHwnd = (HWND)lparam;
      CommandHandlerData *chd = (CommandHandlerData *)GetProp(ctrlHwnd, "CommandHandlerData");
      if(chd        == NULL) return DefWindowProc(hwnd, msg, wparam, lparam);
      if(chd->funct == NULL) return DefWindowProc(hwnd, msg, wparam, lparam);
      chd->funct(chd->object, wparam);
      return 0;
    break;
    
    case WM_CLOSE:
      if([self OG_willClose] == YES)
        og_destroy(hwnd, self);
      return 0;
    break;
    
    case WM_SIZE:
      //act like GTK; expand our child(ren) to fit
      EnumChildWindows(widget, Resize_EnumChildren, (LPARAM)widget);
    break;
    
    case WM_SIZING:
      //act like GTK; expand our child(ren) to fit
      EnumChildWindows(widget, Resize_EnumChildren, (LPARAM)widget);
    break;
  }
  return DefWindowProc(hwnd, msg, wparam, lparam);
}
//----------------------------------------------------------------------------------------------------------------------------------
@end
//==================================================================================================================================







|











|





|




|










134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
  [pool release];
  return YES;
}
//----------------------------------------------------------------------------------------------------------------------------------
- (int)MessageReceived : (HWND)hwnd : (UINT)msg : (WPARAM)wparam : (LPARAM)lparam
{
  HWND ctrlHwnd;

  switch(msg)
  {
    case WM_COMMAND:
      //NOTE: TODO: IMPLEMENT: this may need revised later for Menus and Accelerators
      ctrlHwnd = (HWND)lparam;
      CommandHandlerData *chd = (CommandHandlerData *)GetProp(ctrlHwnd, "CommandHandlerData");
      if(chd        == NULL) return DefWindowProc(hwnd, msg, wparam, lparam);
      if(chd->funct == NULL) return DefWindowProc(hwnd, msg, wparam, lparam);
      chd->funct(chd->object, wparam);
      return 0;
    break;

    case WM_CLOSE:
      if([self OG_willClose] == YES)
        og_destroy(hwnd, self);
      return 0;
    break;

    case WM_SIZE:
      //act like GTK; expand our child(ren) to fit
      EnumChildWindows(widget, Resize_EnumChildren, (LPARAM)widget);
    break;

    case WM_SIZING:
      //act like GTK; expand our child(ren) to fit
      EnumChildWindows(widget, Resize_EnumChildren, (LPARAM)widget);
    break;
  }
  return DefWindowProc(hwnd, msg, wparam, lparam);
}
//----------------------------------------------------------------------------------------------------------------------------------
@end
//==================================================================================================================================