Changeset 3479 in Sophya for trunk/SophyaPI/PI/Quartz/pistdwdgmosx.cpp
- Timestamp:
- Apr 4, 2008, 2:27:12 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/Quartz/pistdwdgmosx.cpp
r3470 r3479 10 10 #include "pistdwdgmosx.h" 11 11 12 vector<PIWdg*> vpiwdg; 13 14 static void CommonControlActionCallback (ControlRef theControl, ControlPartCode partCode); 15 12 16 13 17 /* ========== PILabelQuartz ========== */ … … 52 56 : PITextGen(par, nom, sx, sy, px, py) 53 57 { 54 OSStatus err;55 58 wParent = ((PIContainer *)par)->GetWindowPtr(); 56 59 SetRect(&wdgRect,px,py,px+sx,py+sy); … … 214 217 215 218 } 219 220 /* ========== PIButtonQuartz ========== */ 221 222 EventTypeSpec controlEvents[] = {{kEventClassControl, kEventControlHit}}; 223 224 PIButtonQuartz::PIButtonQuartz(PIContainerQuartz *par,const char *nom, PIMessage msg,int sx, int sy, int px, int py) 225 :PIButtonGen(par,nom,msg,sx,sy,px,py) 226 { 227 wParent = ((PIContainer *)par)->GetWindowPtr(); 228 SetPortWindowPort(wParent); 229 SetRect(&wdgRect,px,py,px+sx,py+sy); 230 231 CreatePushButtonControl (par->GetWindowPtr(),&wdgRect,title,&contH); 232 SetControlTitleWithCFString (contH, title); 233 _actionProc = NewControlActionUPP (CommonControlActionCallback); 234 SetControlAction (contH, _actionProc); 235 vpiwdg.push_back(this); 236 } 237 238 239 PIButtonQuartz::~PIButtonQuartz() 240 { 241 } 242 243 void PIButtonQuartz::ActivatePress(bool acp) 244 { 245 return; 246 } 247 248 void PIButtonQuartz::SetLabel(string const& sText) 249 { 250 title = CFStringCreateWithCString (NULL, sText.c_str(), kCFStringEncodingMacRoman); 251 SetControlTitleWithCFString(contH,title); 252 return; 253 } 254 255 static void CommonControlActionCallback (ControlRef theControl, ControlPartCode partCode) 256 { 257 vector<PIWdg*>::iterator it; 258 for(it = vpiwdg.begin(); it != vpiwdg.end(); it++) 259 { 260 if (((*it)->GetControlRef())==theControl) 261 { 262 (*it)->Send((*it)->Msg(),PIMsg_Click,NULL); 263 printf ("click : %d \n",(int)(*it)->Msg()); 264 break; 265 } 266 } 267 } 268 269 270 /* ========== PICheckBoxQuartz ========== */ 271 272 PICheckBoxQuartz::PICheckBoxQuartz(PIContainerQuartz *par,const char *nom, PIMessage msg,int sx, int sy, int px, int py) 273 :PICheckBoxGen(par,nom,msg,sx,sy,px,py) 274 { 275 wParent = ((PIContainer *)par)->GetWindowPtr(); 276 SetPortWindowPort(wParent); 277 SetRect(&wdgRect,px,py,px+sx,py+sy); 278 _state = 1; 279 CreateCheckBoxControl (par->GetWindowPtr(),&wdgRect,title,_state,TRUE,&contH); 280 SetControlTitleWithCFString (contH, title); 281 _actionProc = NewControlActionUPP (CommonControlActionCallback); 282 SetControlAction (contH, _actionProc); 283 vpiwdg.push_back(this); 284 } 285 286 287 PICheckBoxQuartz::~PICheckBoxQuartz() 288 { 289 } 290 291 void PICheckBoxQuartz::SetState(bool acp) 292 { 293 _state = acp; 294 return; 295 } 296 297 bool PICheckBoxQuartz::GetState() 298 { 299 return _state; 300 } 301 302 /* ========== PIRadioQuartz ========== */ 303 304 PIRadioQuartz::PIRadioQuartz(PIContainerQuartz *par,const char *nom, PIMessage msg,int sx, int sy, int px, int py,int initialValue) 305 :PIWdg(par,nom,sx,sy,px,py) 306 { 307 SetMsg(msg); 308 wParent = ((PIContainer *)par)->GetWindowPtr(); 309 SetPortWindowPort(wParent); 310 SetRect(&wdgRect,px,py,px+sx,py+sy); 311 CreateRadioButtonControl (par->GetWindowPtr(),&wdgRect,title,initialValue,FALSE,&contH); 312 SetControlTitleWithCFString (contH, title); 313 _actionProc = NewControlActionUPP (CommonControlActionCallback); 314 SetControlAction (contH, _actionProc); 315 vpiwdg.push_back(this); 316 } 317 318 PIRadioQuartz::~PIRadioQuartz() 319 { 320 } 321 322 /* ========== PIRadioGroupQuartz ========== */ 323 324 PIRadioGroupQuartz::PIRadioGroupQuartz(PIContainerQuartz *par,const char *nom, PIMessage msg,int sx, int sy, int px, int py) 325 :PIWdg(par,nom,sx,sy,px,py) 326 { 327 SetMsg(msg); 328 wParent = ((PIContainer *)par)->GetWindowPtr(); 329 SetPortWindowPort(wParent); 330 SetRect(&wdgRect,px,py,px+sx,py+sy); 331 OSErr error; 332 error = CreateRadioGroupControl (par->GetWindowPtr(),&wdgRect,&contH); 333 _state = 0; 334 } 335 336 void PIRadioGroupQuartz::AddRadioButton(PIRadio* piRadio) 337 { 338 OSErr error; 339 error = EmbedControl(piRadio->GetControlRef(),contH); 340 341 return; 342 } 343 344 PIRadioGroupQuartz::~PIRadioGroupQuartz() 345 { 346 } 347
Note:
See TracChangeset
for help on using the changeset viewer.