36
36
using MonoDevelop . Components ;
37
37
using MonoDevelop . Components . Commands ;
38
38
using System . IO ;
39
+ using System . Runtime . InteropServices ;
39
40
40
41
namespace MonoDevelop . Ide . Projects
41
42
{
@@ -157,16 +158,21 @@ TreeIter AddPackageReference (ProjectReference refInfo)
157
158
}
158
159
return refTreeStore . AppendValues ( txt , secondaryTxt , GetTypeText ( refInfo ) , refInfo . Reference , refInfo , ImageService . GetIcon ( "md-package" , IconSize . Dnd ) ) ;
159
160
}
160
-
161
+
162
+ [ DllImport ( "libgtk-win32-2.0-0.dll" , CallingConvention = CallingConvention . Cdecl ) ]
163
+ private static extern void gtk_notebook_set_action_widget ( IntPtr notebook , IntPtr widget , int packType ) ;
164
+
161
165
public SelectReferenceDialog ( )
162
166
{
163
167
Build ( ) ;
164
168
165
169
combinedBox = new CombinedBox ( ) ;
166
170
combinedBox . Show ( ) ;
167
171
mainBook = new Notebook ( ) ;
168
- combinedBox . Add ( mainBook ) ;
169
- alignment1 . Add ( combinedBox ) ;
172
+
173
+ gtk_notebook_set_action_widget ( mainBook . Handle , combinedBox . Handle , ( int ) PackType . End ) ;
174
+
175
+ alignment1 . Add ( mainBook ) ;
170
176
mainBook . ShowAll ( ) ;
171
177
172
178
filterEntry = combinedBox . FilterEntry ;
@@ -250,7 +256,6 @@ public SelectReferenceDialog ()
250
256
251
257
void InsertFilterEntry ( )
252
258
{
253
- filterEntry . KeyPressEvent += HandleFilterEntryKeyPressEvent ;
254
259
filterEntry . Activated += HandleFilterEntryActivated ;
255
260
filterEntry . Changed += delegate {
256
261
foreach ( var p in panels )
@@ -264,19 +269,9 @@ void HandleFilterEntryActivated (object sender, EventArgs e)
264
269
mainBook . ChildFocus ( DirectionType . TabForward ) ;
265
270
}
266
271
267
- void HandleFilterEntryKeyPressEvent ( object o , KeyPressEventArgs args )
268
- {
269
- if ( args . Event . Key == Gdk . Key . Tab ) {
270
- mainBook . HasFocus = true ;
271
- mainBook . ChildFocus ( DirectionType . TabForward ) ;
272
- args . RetVal = true ;
273
- }
274
- }
275
-
276
272
protected override void OnShown ( )
277
273
{
278
274
base . OnShown ( ) ;
279
- filterEntry . HasFocus = true ;
280
275
}
281
276
282
277
protected override bool OnKeyPressEvent ( Gdk . EventKey evnt )
@@ -538,22 +533,24 @@ protected override void OnRemoved (Widget widget)
538
533
539
534
protected override void OnSizeAllocated ( Gdk . Rectangle allocation )
540
535
{
536
+ allocation . Y -= 2 ;
541
537
base . OnSizeAllocated ( allocation ) ;
542
538
RepositionFilter ( ) ;
543
539
}
544
540
545
541
protected override void OnSizeRequested ( ref Requisition requisition )
546
542
{
547
- if ( Child != null )
548
- requisition = Child . SizeRequest ( ) ;
549
- requisition . Width += filterEntry . SizeRequest ( ) . Width ;
543
+ requisition = Child ? . SizeRequest ( ) ?? Requisition . Zero ;
544
+ var entryRequest = filterEntry . SizeRequest ( ) ;
545
+ requisition . Width += entryRequest . Width ;
546
+ requisition . Height = Math . Max ( requisition . Height , entryRequest . Height ) ;
550
547
}
551
548
552
549
void RepositionFilter ( )
553
550
{
554
- int w = filterEntry . SizeRequest ( ) . Width ;
555
- int h = filterEntry . SizeRequest ( ) . Height ;
556
- filterEntry . SizeAllocate ( new Gdk . Rectangle ( Allocation . Width - w - 1 , 0 , w , h ) ) ;
551
+ var req = filterEntry . SizeRequest ( ) ;
552
+ int h = Math . Min ( Allocation . Height , req . Height ) ;
553
+ filterEntry . SizeAllocate ( new Gdk . Rectangle ( Allocation . Width - req . Width - 1 , 0 , req . Width , h ) ) ;
557
554
}
558
555
}
559
556
0 commit comments